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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0dc09b4f50c205e05d9999f52081b3d051649c1c | 4,296 | js | JavaScript | controllers/adminController.js | lamnghi2031/webbanhang | 9d1ce85c41e588528dd08747ba594f00635cacf3 | [
"MIT"
] | 1 | 2021-06-30T14:31:41.000Z | 2021-06-30T14:31:41.000Z | controllers/adminController.js | lamnghi2031/webbanhang | 9d1ce85c41e588528dd08747ba594f00635cacf3 | [
"MIT"
] | null | null | null | controllers/adminController.js | lamnghi2031/webbanhang | 9d1ce85c41e588528dd08747ba594f00635cacf3 | [
"MIT"
] | null | null | null | var express = require('express');
var productRepo = require('../repos/productRepo');
var categoryRepo = require('../repos/categoryRepo');
var brandRepo = require('../repos/brandRepo');
var router = express.Router();
var restrict = require('../middle-wares/restrict');
router.get('/', restrict, (req, res) => {
if (req.session.user.f_Permission === 0) {
res.redirect('/error/index');
}
else {
var rowCountBrand = brandRepo.count();
var rowCountCategory = categoryRepo.count();
var rowCountProduct = productRepo.count();
Promise.all([rowCountProduct,rowCountBrand,rowCountCategory]).then(([rowProduct, rowBrand, rowCategory]) => {
var vm = {
layout: 'admin.handlebars',
countProduct: rowProduct[0].soluong,
countBrand: rowBrand[0].soluongth,
countCategory: rowCategory[0].soluongtl
}
res.render('admin/index', vm);
});
}
})
router.get('/category', restrict, (req, res) => {
categoryRepo.loadAll().then(rows => {
var vm = {
layout: 'admin.handlebars',
categories: rows
};
res.render('admin/category/index', vm);
});
});
router.get('/category/edit', restrict, (req, res) => {
categoryRepo.single(req.query.id).then(c => {
var vm = {
Category: c,
layout: 'admin.handlebars',
};
res.render('admin/category/edit', vm);
});
});
router.post('/category/edit', restrict, (req, res) => {
categoryRepo.update(req.body).then(value => {
res.redirect('/admin/category');
});
});
router.get('/category/delete', restrict, (req, res) => {
var vm = {
layout: 'admin.handlebars',
CatId: req.query.id
}
res.render('admin/category/delete', vm);
});
router.post('/category/delete', restrict, (req, res) => {
categoryRepo.delete(req.body.CatId).then(value => {
res.redirect('/admin/category');
});
});
router.get('/category/add', restrict, (req, res) => {
var vm = {
layout: 'admin.handlebars',
showAlert: false
}
res.render('admin/category/add', vm);
});
router.post('/category/add', restrict, (req, res) => {
console.log(req.body);
categoryRepo.add(req.body).then(value => {
var vm = {
layout: 'admin.handlebars',
showAlert: true
};
res.render('admin/category/add', vm);
}).catch(err => {
res.end('fail');
});
});
router.get('/brand', restrict, (req, res) => {
brandRepo.loadAll().then(rows => {
var vm = {
layout: 'admin.handlebars',
brands: rows
};
res.render('admin/brand/index', vm);
});
});
router.get('/brand/edit', restrict, (req, res) => {
brandRepo.single(req.query.id).then(b => {
var vm = {
Brand: b,
layout: 'admin.handlebars',
};
res.render('admin/brand/edit', vm);
});
});
router.post('/brand/edit', restrict, (req, res) => {
console.log(req.body);
brandRepo.update(req.body).then(value => {
res.redirect('/admin/brand');
});
});
router.get('/brand/delete', restrict, (req, res) => {
var vm = {
layout: 'admin.handlebars',
BrandID: req.query.id
}
res.render('admin/brand/delete', vm);
});
router.post('/brand/delete', restrict, (req, res) => {
brandRepo.delete(req.body.BrandID).then(value => {
res.redirect('/admin/brand');
});
});
router.get('/brand/add', restrict, (req, res) => {
var vm = {
layout: 'admin.handlebars',
showAlert: false
}
res.render('admin/brand/add', vm);
});
router.post('/brand/add', restrict, (req, res) => {
brandRepo.add(req.body).then(value => {
var vm = {
layout: 'admin.handlebars',
showAlert: true
};
res.render('admin/brand/add', vm);
}).catch(err => {
res.end('fail');
});
});
module.exports = router;
| 28.078431 | 117 | 0.514898 |
0dc19ab43bc91ef6192906c927e2fda6fa0f63ed | 1,020 | js | JavaScript | src/ex17_js_components/src/containers/main/components/select/select.js | morozserge1st/external-courses | 81421dbb01f2afd1c3193b2168322b3b70cc13c4 | [
"MIT"
] | null | null | null | src/ex17_js_components/src/containers/main/components/select/select.js | morozserge1st/external-courses | 81421dbb01f2afd1c3193b2168322b3b70cc13c4 | [
"MIT"
] | 2 | 2019-11-13T22:51:56.000Z | 2019-11-18T23:48:52.000Z | src/ex17_js_components/src/containers/main/components/select/select.js | morozserge1st/external-courses | 81421dbb01f2afd1c3193b2168322b3b70cc13c4 | [
"MIT"
] | null | null | null | import {cards, addIssue, deleteIssue} from '../../main-controller';
import './select.css';
export const Select = (index) => {
function removeSelect() {
this.removeEventListener('blur', removeSelect);
if (this.selectedIndex) {
const issueId = +this[this.selectedIndex].id;
const issue = cards[index - 1].issues.find(x => x.id === issueId);
deleteIssue(issueId, index - 1);
addIssue(issue, index);
}
this.parentNode.remove();
}
const wrap = document.createElement('div');
wrap.className = 'wrap';
const select = document.createElement('select');
select.className = 'select';
wrap.append(select);
const option = document.createElement('option');
select.append(option);
cards[index - 1].issues.map(issue => {
const option = document.createElement('option');
option.id = issue.id;
option.value = issue.name;
option.textContent = issue.name;
select.append(option);
});
select.addEventListener('blur', removeSelect);
return wrap;
};
| 26.153846 | 72 | 0.659804 |
0dc328b367c770205a6fb9423a50cac7383fb079 | 1,688 | js | JavaScript | src/components/SeekBar.js | xavi160/react-video | 87573b32a6c82c2eccb658b8fdb7a8ab6f2cd764 | [
"MIT"
] | null | null | null | src/components/SeekBar.js | xavi160/react-video | 87573b32a6c82c2eccb658b8fdb7a8ab6f2cd764 | [
"MIT"
] | null | null | null | src/components/SeekBar.js | xavi160/react-video | 87573b32a6c82c2eccb658b8fdb7a8ab6f2cd764 | [
"MIT"
] | null | null | null | import React from 'react';
import styled from 'styled-components';
const SeekHolder = styled.div`
width: 100%;
height: 5px;
background-color: #BBB;
cursor: pointer;
`;
const ProgressBar = styled.div`
width: ${(props) => props.currentValue}%;
height: 100%;
background-color: #44c7ff;
cursor: inherit;
`;
export default class SeekBar extends React.Component {
constructor(props) {
super(props);
this.onMouseDown = this.onMouseDown.bind(this);
this.onMouseUp = this.onMouseUp.bind(this);
this.onMouseMove = this.onMouseMove.bind(this);
this.onClick = this.onClick.bind(this);
this.state = { dragging: false };
}
onMouseDown() {
this.setState({ dragging: true });
}
onMouseUp() {
this.setState({ dragging: false });
}
onMouseMove(event) {
if (this.props.onSeek && this.state.dragging) {
this.onSeek(event);
}
}
onClick(event) {
this.onSeek(event);
}
onSeek(event) {
event.persist();
const { duration } = this.props;
const { clientX, currentTarget } = event;
this.props.onSeek(
(clientX - currentTarget.offsetLeft) *
duration /
currentTarget.clientWidth
);
}
render() {
return (
<SeekHolder
onMouseDown={this.onMouseDown}
onMouseUp={this.onMouseUp}
onMouseMove={this.onMouseMove}
onClick={this.onClick}
>
<ProgressBar
currentValue={this.props.currentTime * 100.0 / this.props.duration}
/>
</SeekHolder>
);
}
}
SeekBar.propTypes = {
onSeek: React.PropTypes.func,
currentTime: React.PropTypes.number.isRequired,
duration: React.PropTypes.number.isRequired
};
| 21.641026 | 77 | 0.635664 |
0dc3cf04a9646083355e359d9de15ec7529ec60f | 537 | js | JavaScript | src/SEO.js | myungjaeyu/react-starter | 8176f04819cc3933703128b6b3626b359dc02222 | [
"MIT"
] | 15 | 2018-07-10T22:36:02.000Z | 2019-06-03T09:05:46.000Z | src/SEO.js | myungjaeyu/react-starter | 8176f04819cc3933703128b6b3626b359dc02222 | [
"MIT"
] | null | null | null | src/SEO.js | myungjaeyu/react-starter | 8176f04819cc3933703128b6b3626b359dc02222 | [
"MIT"
] | 1 | 2018-07-11T05:34:14.000Z | 2018-07-11T05:34:14.000Z | export default {
htmlAttributes: {
lang: 'en'
},
title: 'Super Simple React Starter',
link: (pathName) => [
{
rel: 'canonical',
href: `http://localhost:3000${ pathName }`
}
],
meta: [
{
charset: 'UTF-8'
},
{
'http-equiv': 'X-UA-Compatible',
content:'IE=edge'
},
{
name: 'viewport',
content: 'width=device-width',
'initial-scale': 1
}
]
} | 20.653846 | 54 | 0.394786 |
0dc499d78378bbed49c2f1cb9773fa78d7eb4603 | 327 | js | JavaScript | src/react/components/Loading.js | Ledoux/transactions-user-interface | 5a760cb2b953e23b576dfdc9ea24842a455d3cd9 | [
"MIT"
] | null | null | null | src/react/components/Loading.js | Ledoux/transactions-user-interface | 5a760cb2b953e23b576dfdc9ea24842a455d3cd9 | [
"MIT"
] | null | null | null | src/react/components/Loading.js | Ledoux/transactions-user-interface | 5a760cb2b953e23b576dfdc9ea24842a455d3cd9 | [
"MIT"
] | null | null | null | import React from 'react'
import { Loading as withState } from 'transactions-interface-state'
const Loading = ({ className,
isActive
}) => {
return (
<div className={className || 'loading'}>
{
isActive && <div className='loading__container' />
}
</div>
)
}
export default withState(Loading)
| 19.235294 | 67 | 0.633028 |
0dc63495c9c1887778a461fae53ae27436417476 | 392 | js | JavaScript | javascript/easy/maxConsecutiveOnes.js | scaffeinate/leetcode | 750620f0ab9ed2eb17e0cd3065e51176e0dca77a | [
"MIT"
] | 6 | 2018-03-09T18:45:21.000Z | 2020-10-02T22:54:51.000Z | javascript/easy/maxConsecutiveOnes.js | scaffeinate/leetcode | 750620f0ab9ed2eb17e0cd3065e51176e0dca77a | [
"MIT"
] | null | null | null | javascript/easy/maxConsecutiveOnes.js | scaffeinate/leetcode | 750620f0ab9ed2eb17e0cd3065e51176e0dca77a | [
"MIT"
] | 1 | 2020-08-28T14:48:52.000Z | 2020-08-28T14:48:52.000Z | /**
* @param {number[]} nums
* @return {number}
*/
var findMaxConsecutiveOnes = function(nums) {
let maxConsecutiveOnes = 0, count = 0;
for(let num of nums) {
if(num === 1) {
count++;
} else {
maxConsecutiveOnes = Math.max(maxConsecutiveOnes, count);
count = 0;
}
}
return Math.max(maxConsecutiveOnes, count);
};
| 23.058824 | 69 | 0.540816 |
0dc66ec848ba35ebfe07b45c87dfae1ad21d2991 | 914 | js | JavaScript | src/zero-ui/src/index.js | vueZZ/vue-admin | 0607565c22c77e89cc2e5f69b39cb9208fb711ff | [
"MIT"
] | 3 | 2018-09-05T08:55:59.000Z | 2019-07-04T05:58:06.000Z | src/zero-ui/src/index.js | vueZZ/vue-admin | 0607565c22c77e89cc2e5f69b39cb9208fb711ff | [
"MIT"
] | 1 | 2019-01-22T01:46:56.000Z | 2019-01-22T02:02:05.000Z | src/zero-ui/src/index.js | vueZZ/vue-admin | 0607565c22c77e89cc2e5f69b39cb9208fb711ff | [
"MIT"
] | null | null | null | import button from '../packages/button/index.js'
import input from '../packages/input/index.js'
import form from '../packages/form/index.js'
import formItem from '../packages/form-item/index.js'
import top from '../packages/top/index.js'
import img from '../packages/img/index.js'
import preview from '../packages/preview/index.js'
import geetest from '../packages/geetest/index.js'
import magnifier from '../packages/magnifier/index.js'
const components = [
// 通用组件
input,
form,
formItem,
// 特殊组件
top,
img,
geetest,
button,
magnifier
]
const install = function (Vue) {
/* istanbul ignore next */
if (install.installed) return
components.map(component => {
Vue.component(component.name, component)
})
Vue.prototype.$preview = preview
}
/* istanbul ignore next */
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue)
}
export default {
install,
top
}
| 20.772727 | 54 | 0.69256 |
0dc66f46b0e845e9e14546e63dcdd7fc4aa56bd8 | 971 | js | JavaScript | lib/privacy.js | jcpst/iconium | 6ef9eb65a2609cd8346b80bb8fc92b5250484b7c | [
"MIT"
] | null | null | null | lib/privacy.js | jcpst/iconium | 6ef9eb65a2609cd8346b80bb8fc92b5250484b7c | [
"MIT"
] | null | null | null | lib/privacy.js | jcpst/iconium | 6ef9eb65a2609cd8346b80bb8fc92b5250484b7c | [
"MIT"
] | null | null | null | /**
* @description Some functions for handling private environment variables.
* @author Joseph Post <joe@jcpst.com>
* @type {exports|module.exports}
*/
var crypto = require('crypto')
/**
* Generates an AES key.
*/
exports.generateAesKey = function () {
return crypto.randomBytes(32).toString('base64')
}
/**
* Encrypts a string.
* @param {string} text - string to encrypt
* @param {string} token - key to encrypt with
*/
exports.encrypt = function (text, token) {
var cipher = crypto.createCipher('aes-256-cbc', token)
var crypted = cipher.update(text, 'utf8', 'base64')
crypted += cipher.final('base64')
return crypted
}
/**
* Decrypts a string.
* @param {string} text - string to decrypt
* @param {string} token - key to decrypt with
*/
exports.decrypt = function (text, token) {
var decipher = crypto.createDecipher('aes-256-cbc', token)
var dec = decipher.update(text, 'base64', 'utf8')
dec += decipher.final('utf8')
return dec
}
| 24.275 | 74 | 0.677652 |
37b50e4d03d4db4ae153958d65795bf60bc59ab9 | 512 | js | JavaScript | packages/components/src/components/Layout/HeaderBackgrounds/index.js | grundeinkommensbuero/frontend-hooks | 0caf403dd2dd570267a979e97a83e47721cc8b65 | [
"MIT"
] | null | null | null | packages/components/src/components/Layout/HeaderBackgrounds/index.js | grundeinkommensbuero/frontend-hooks | 0caf403dd2dd570267a979e97a83e47721cc8b65 | [
"MIT"
] | null | null | null | packages/components/src/components/Layout/HeaderBackgrounds/index.js | grundeinkommensbuero/frontend-hooks | 0caf403dd2dd570267a979e97a83e47721cc8b65 | [
"MIT"
] | 1 | 2022-02-11T14:29:03.000Z | 2022-02-11T14:29:03.000Z | import React from 'react';
import s from './style.module.less';
import background1 from './backgrounds/01.svg';
import background2 from './backgrounds/02.svg';
import background3 from './backgrounds/03.svg';
import background4 from './backgrounds/04.svg';
const BACKGROUNDS = [background1, background2, background3, background4];
export default () => {
return (
<img
alt=""
className={s.background}
src={BACKGROUNDS[Math.round((BACKGROUNDS.length - 1) * Math.random())]}
/>
);
};
| 26.947368 | 77 | 0.683594 |
37b583845fa99fd4962ceacdbe7a9e7e7d023cae | 463 | js | JavaScript | components/Modules/Layout/index.js | gopeshjangid/comboware | 79a76787babfa1cc7105711a4e998d9c22abf88d | [
"MIT"
] | null | null | null | components/Modules/Layout/index.js | gopeshjangid/comboware | 79a76787babfa1cc7105711a4e998d9c22abf88d | [
"MIT"
] | null | null | null | components/Modules/Layout/index.js | gopeshjangid/comboware | 79a76787babfa1cc7105711a4e998d9c22abf88d | [
"MIT"
] | null | null | null | import React from 'react';
import Header from './header';
import Footer from './footer';
import { Grid } from '@material-ui/core';
import styles from './style';
export default function Layout(props) {
const classes = styles();
return (
<Grid container direction="column">
<Header />
<div className={classes.contentLayout} style={{background : 'white'}}>{props.children}</div>
<Footer />
</Grid>
)
} | 30.866667 | 104 | 0.606911 |
37b5c69a6927b82119dd34983133764eddb53a19 | 5,517 | js | JavaScript | web/app/themes/x/framework/js/src/site/x.js | whskyneat/element-wheels-blog | efc7dc413a96ed4fa56ff86ef46376195255374e | [
"MIT"
] | null | null | null | web/app/themes/x/framework/js/src/site/x.js | whskyneat/element-wheels-blog | efc7dc413a96ed4fa56ff86ef46376195255374e | [
"MIT"
] | null | null | null | web/app/themes/x/framework/js/src/site/x.js | whskyneat/element-wheels-blog | efc7dc413a96ed4fa56ff86ef46376195255374e | [
"MIT"
] | null | null | null | // =============================================================================
// JS/X.JS
// -----------------------------------------------------------------------------
// Theme specific functions.
// =============================================================================
// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
// 01. Global Functions
// =============================================================================
// Global Functions
// =============================================================================
jQuery(document).ready(function($) {
//
// Prevent default behavior of various toggles.
//
$('.x-btn-navbar, .x-btn-navbar-search, .x-btn-widgetbar').click(function(e) {
e.preventDefault();
});
//
// Scroll to the bottom of the slider.
//
$('.x-slider-container.above .x-slider-scroll-bottom').click(function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: $('.x-slider-container.above').outerHeight()
}, 850, 'easeInOutExpo');
});
$('.x-slider-container.below .x-slider-scroll-bottom').click(function(e) {
e.preventDefault();
var $mastheadHeight = $('.masthead').outerHeight();
var $navbarFixedTopHeight = $('.x-navbar-fixed-top-active .x-navbar').outerHeight();
var $sliderAboveHeight = $('.x-slider-container.above').outerHeight();
var $sliderBelowHeight = $('.x-slider-container.below').outerHeight();
var $heightSum = $mastheadHeight + $sliderAboveHeight + $sliderBelowHeight - $navbarFixedTopHeight;
$('html, body').animate({
scrollTop: $heightSum
}, 850, 'easeInOutExpo');
});
//
// Apply appropriate classes for the fixed-top navbar.
//
var $window = $(window);
var $this = $(this);
var $body = $('body');
var $navbar = $('.x-navbar');
var $navbarWrap = $('.x-navbar-fixed-top-active .x-navbar-wrap');
if ( ! $body.hasClass('page-template-template-blank-3-php') && ! $body.hasClass('page-template-template-blank-6-php') && ! $body.hasClass('page-template-template-blank-7-php') && ! $body.hasClass('page-template-template-blank-8-php') ) {
if ( $body.hasClass('x-boxed-layout-active') && $body.hasClass('x-navbar-fixed-top-active') && $body.hasClass('admin-bar') ) {
$window.scroll(function() {
var $adminbarHeight = $('#wpadminbar').outerHeight();
var $menuTop = $navbarWrap.offset().top - $adminbarHeight;
var $current = $this.scrollTop();
if ($current >= $menuTop) {
$navbar.addClass('x-navbar-fixed-top x-container-fluid max width');
} else {
$navbar.removeClass('x-navbar-fixed-top x-container-fluid max width');
}
});
} else if ( $body.hasClass('x-navbar-fixed-top-active') && $body.hasClass('admin-bar') ) {
$window.scroll(function() {
var $adminbarHeight = $('#wpadminbar').outerHeight();
var $menuTop = $navbarWrap.offset().top - $adminbarHeight;
var $current = $this.scrollTop();
if ($current >= $menuTop) {
$navbar.addClass('x-navbar-fixed-top');
} else {
$navbar.removeClass('x-navbar-fixed-top');
}
});
} else if ( $body.hasClass('x-boxed-layout-active') && $body.hasClass('x-navbar-fixed-top-active') ) {
$window.scroll(function() {
var $menuTop = $navbarWrap.offset().top;
var $current = $this.scrollTop();
if ($current >= $menuTop) {
$navbar.addClass('x-navbar-fixed-top x-container-fluid max width');
} else {
$navbar.removeClass('x-navbar-fixed-top x-container-fluid max width');
}
});
} else if ( $body.hasClass('x-navbar-fixed-top-active') ) {
$window.scroll(function() {
var $menuTop = $navbarWrap.offset().top;
var $current = $this.scrollTop();
if ($current >= $menuTop) {
$navbar.addClass('x-navbar-fixed-top');
} else {
$navbar.removeClass('x-navbar-fixed-top');
}
});
}
}
//
// YouTube z-index fix.
//
$('iframe[src*="youtube.com"]').each(function() {
var url = $(this).attr('src');
if ($(this).attr('src').indexOf('?') > 0) {
$(this).attr({
'src' : url + '&wmode=transparent',
'wmode' : 'Opaque'
});
} else {
$(this).attr({
'src' : url + '?wmode=transparent',
'wmode' : 'Opaque'
});
}
});
//
// Navbar search.
//
var $trigger = $('.x-btn-navbar-search');
var $formWrap = $('.x-searchform-overlay');
var $form = $formWrap.find('.form-search');
var $input = $formWrap.find('.search-query');
var escKey = 27;
function clearSearch() {
$formWrap.toggleClass('in');
setTimeout( function() { $input.val(''); }, 350 );
}
$trigger.click(function(e) {
e.preventDefault();
$formWrap.toggleClass('in');
$input.focus();
});
$formWrap.click(function(e) {
if ( ! $(e.target).hasClass('search-query') ) {
clearSearch();
}
});
$(document).keydown(function(e) {
if ( e.which === escKey ) {
if ( $formWrap.hasClass('in') ) {
clearSearch();
}
}
});
//
// scrollBottom function.
//
$.fn.scrollBottom = function() {
return $(document).height() - this.scrollTop() - this.height();
};
}); | 32.075581 | 239 | 0.508066 |
37b67c13a0dc477b641b6dda74d6e7b3382d1332 | 4,082 | js | JavaScript | pages/web/cmyk.js | tylodung/desunju | b31a400494141912d6f930b2e5cf289eace5b093 | [
"MIT"
] | null | null | null | pages/web/cmyk.js | tylodung/desunju | b31a400494141912d6f930b2e5cf289eace5b093 | [
"MIT"
] | null | null | null | pages/web/cmyk.js | tylodung/desunju | b31a400494141912d6f930b2e5cf289eace5b093 | [
"MIT"
] | null | null | null | import React from 'react';
import { prefixLink } from 'gatsby-helpers'; // eslint-disable-line
import Helmet from 'react-helmet';
export default class CMYK extends React.Component {
componentDidMount() {}
render() {
return (
<div>
<Helmet
title="Julia Sun | CMYK"
/>
<div className="page page--cmyk">
<div className="hero--img">
<img
src={prefixLink('../../img/works/web/cmyk.gif')}
alt="cmyk"
/>
</div>
<div className="hero--label">
<div className="hero--title">
CMYK Designathon
</div>
<div className="hero--summary">
<p>
CMYK Designathon is an annual designathon hosted by Innovative Design
at UC Berkeley, open to all students. Students team up
to design something while a panel of designers from the industry
give workshops and speeches and act as judges for the designathon.
</p>
<br />
<p>
I was tasked with making the event website for Fall 2016.
</p>
</div>
</div>
<div className="textbox">
<div className="textbox--title">
Concept and Design
</div>
<div className="textbox--content">
<p>
CMYK stands for “Come Make Your Mark” in the case of the event,
but according to Wikipedia CMYK is also the color model referring to the
ink colors used in printing,
cyan, magenta, yellow and key (black).
</p>
<br />
<p>
I decided to play incorporate the colors into the website by creating
a single page scroller, where each section had a different background color.
Coincidentally there were four sections for each of the four colors.
</p>
<br />
<p>
The idea for the flyers for the event was to be origami letters.
Given the flyers, I decided that it would be cool to make a step
by step origami animation to spice up the site some more. This
is the animation you see at the top of the page.
</p>
<br />
<p>
<a href="http://jubearsun.github.io/cmyk">Check out this iteration of the site live</a>.
The repo is on my <a href="https://github.com/jubearsun/cmyk">GitHub</a>.
</p>
</div>
</div>
<div className="double__wrapper">
<div className="img__wrapper">
<img
src={prefixLink('../../img/works/web/cmyk/flyer-front.jpg')}
alt="front"
/>
</div>
<div className="img__wrapper">
<img
src={prefixLink('../../img/works/web/cmyk/flyer-back.jpg')}
alt="back"
/>
</div>
</div>
<div className="page--nav">
<a href={prefixLink('/web/holiday-ui/')}>
<div className="button">
<div className="desc">
<div className="desc--title">
Previous
</div>
<div className="desc--content">
Holiday UI
</div>
</div>
</div>
</a>
<a href={prefixLink('/web/newsletter/')}>
<div className="button">
<div className="desc">
<div className="desc--title">
Next
</div>
<div className="desc--content">
Innovative Design Newsletter
</div>
</div>
</div>
</a>
</div>
</div>
</div>
);
}
}
| 35.189655 | 104 | 0.463743 |
37b797cf2a991cd56050459c22ad43840be3c69f | 674 | js | JavaScript | config.js | fewieden/CrossBot | f169aee06b161c6bc0787159803ce7bb19fd14bf | [
"MIT"
] | 1 | 2016-03-07T14:22:38.000Z | 2016-03-07T14:22:38.000Z | config.js | fewieden/CrossBot | f169aee06b161c6bc0787159803ce7bb19fd14bf | [
"MIT"
] | 1 | 2016-03-07T14:00:23.000Z | 2018-02-02T15:26:19.000Z | config.js | fewieden/CrossBot | f169aee06b161c6bc0787159803ce7bb19fd14bf | [
"MIT"
] | null | null | null | /**
* Created by fewieden on 28.02.16.
*/
var channel = "CHANNELNAME";
var config = {
channel: channel,
options: {
options: {
debug: true
},
connection: {
cluster: "chat",
reconnect: true,
secure: true
},
identity: {
username: "BOTNAME",
password: "oauth:BOTOAUTHTOKEN"
},
channels: ["#"+channel]
},
sounds: {
default: {
index: 0,
file: "test.mp3"
},
test: {
index: 1,
file: "test.mp3",
volume: 0.5
}
}
};
module.exports = config; | 18.722222 | 43 | 0.412463 |
37b8eef7f47628dfbae438d0707e93ad1e4233aa | 185 | js | JavaScript | gulp/package.js | douglascvas/biblicando-frontend | 65dc1127f8a1ae2bbb826f1644b6b4fe3cc9d8c3 | [
"Apache-2.0"
] | null | null | null | gulp/package.js | douglascvas/biblicando-frontend | 65dc1127f8a1ae2bbb826f1644b6b4fe3cc9d8c3 | [
"Apache-2.0"
] | null | null | null | gulp/package.js | douglascvas/biblicando-frontend | 65dc1127f8a1ae2bbb826f1644b6b4fe3cc9d8c3 | [
"Apache-2.0"
] | null | null | null | const gulp = require('gulp');
const paths = require('../paths');
module.exports = options => () => {
return gulp.src('./package.json')
.pipe(gulp.dest(paths.output.dirs.js));
};
| 23.125 | 43 | 0.621622 |
37b9c41c6a7020d4a9eaac1867e9db5ebb3f773a | 705 | js | JavaScript | src/loader.js | cds-snc/lighthouse-scanner | c673465d515fd5b81ec823038f064253e2f8e6b0 | [
"MIT"
] | null | null | null | src/loader.js | cds-snc/lighthouse-scanner | c673465d515fd5b81ec823038f064253e2f8e6b0 | [
"MIT"
] | null | null | null | src/loader.js | cds-snc/lighthouse-scanner | c673465d515fd5b81ec823038f064253e2f8e6b0 | [
"MIT"
] | null | null | null | import path from "path";
import { getFile } from "./lib/getFile";
import { saveToFirestore } from "./lib/";
async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
export const loadUrls = async () => {
const file = path.resolve(__dirname, `../urls.json`);
const result = await getFile(file);
try {
const urls = JSON.parse(result);
asyncForEach(urls, async url => {
const payload = {
url: url
};
await saveToFirestore(payload, "domains");
console.log(`Added ${url} to domains list`);
});
} catch (e) {
console.log(e.message);
return {};
}
};
| 25.178571 | 55 | 0.608511 |
37b9e8e7e9486893d6def91444f0693950d61e62 | 674 | js | JavaScript | coherence/web/static/js/redirect.js | palfrey/Cohen3 | d5779b4cbcf736e12d0ccfd162238ac5c376bb0b | [
"MIT"
] | 60 | 2018-09-14T18:57:38.000Z | 2022-02-19T18:16:24.000Z | coherence/web/static/js/redirect.js | palfrey/Cohen3 | d5779b4cbcf736e12d0ccfd162238ac5c376bb0b | [
"MIT"
] | 37 | 2018-09-04T08:51:11.000Z | 2022-02-21T01:36:21.000Z | coherence/web/static/js/redirect.js | palfrey/Cohen3 | d5779b4cbcf736e12d0ccfd162238ac5c376bb0b | [
"MIT"
] | 16 | 2019-02-19T18:34:58.000Z | 2022-02-05T15:36:33.000Z | $("div.devices-box").on('click', 'a', function(event){
if (this.href === '#'){
return true;
}
event.preventDefault()
event.stopPropagation();
if ($(this).hasClass( "item-audio" )){
openLinkInTab(this.href);
return false;
} else if ($(this).hasClass( "item-image" )){
openLinkInTab(this.href);
return false;
} else if ($(this).hasClass( "item-video" )){
openLinkInTab(this.href);
return false;
}
console.log('current href is: ' + this.href);
var link = this.href;
this.href = "#"
console.log('new href is: ' + this.href);
openLink(link, this)
return false;
}); | 25.923077 | 54 | 0.554896 |
37ba794760420f6877538489101e0769f7dbccf3 | 2,052 | js | JavaScript | ads/google/adsense-amp-auto-ads-responsive.js | jono-alderson/amphtml | 8e095cc511a41cf338789c29cf554e4ba8f42496 | [
"Apache-2.0"
] | 3 | 2020-06-08T21:29:14.000Z | 2021-07-27T18:03:46.000Z | ads/google/adsense-amp-auto-ads-responsive.js | jono-alderson/amphtml | 8e095cc511a41cf338789c29cf554e4ba8f42496 | [
"Apache-2.0"
] | 2 | 2018-10-10T04:32:06.000Z | 2018-10-16T02:15:17.000Z | ads/google/adsense-amp-auto-ads-responsive.js | jono-alderson/amphtml | 8e095cc511a41cf338789c29cf554e4ba8f42496 | [
"Apache-2.0"
] | 2 | 2017-01-19T12:01:12.000Z | 2022-01-14T19:37:43.000Z | /**
* Copyright 2018 The AMP HTML Authors. 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 {
ExperimentInfo, // eslint-disable-line no-unused-vars
getExperimentBranch,
randomlySelectUnsetExperiments,
} from '../../src/experiments';
/** @const {string} */
export const ADSENSE_AMP_AUTO_ADS_RESPONSIVE_EXPERIMENT_NAME =
'amp-auto-ads-adsense-responsive';
/**
* @enum {string}
*/
export const AdSenseAmpAutoAdsResponsiveBranches = {
CONTROL: '19861210', // don't attempt to expand auto ads to responsive format
EXPERIMENT: '19861211', // do attempt to expand auto ads to responsive format
};
/** @const {!ExperimentInfo} */
const ADSENSE_AMP_AUTO_ADS_RESPONSIVE_EXPERIMENT_INFO = {
isTrafficEligible: win => !!win.document.querySelector('AMP-AUTO-ADS'),
branches: [
AdSenseAmpAutoAdsResponsiveBranches.CONTROL,
AdSenseAmpAutoAdsResponsiveBranches.EXPERIMENT,
],
};
/**
* This has the side-effect of selecting the page into a branch of the
* experiment, which becomes sticky for the entire pageview.
*
* @param {!Window} win
* @return {?string}
*/
export function getAdSenseAmpAutoAdsResponsiveExperimentBranch(win) {
const experiments = /** @type {!Object<string, !ExperimentInfo>} */ ({});
experiments[ADSENSE_AMP_AUTO_ADS_RESPONSIVE_EXPERIMENT_NAME] =
ADSENSE_AMP_AUTO_ADS_RESPONSIVE_EXPERIMENT_INFO;
randomlySelectUnsetExperiments(win, experiments);
return getExperimentBranch(win,
ADSENSE_AMP_AUTO_ADS_RESPONSIVE_EXPERIMENT_NAME) || null;
}
| 32.0625 | 79 | 0.748051 |
37bb1e4199d94373186faa9f2193120cdad70d6d | 552 | js | JavaScript | src/components/resourceItem.js | alexxmitchell/WomenWhoCodeCincy.github.io | 678d771e79033b900b364388cd7c3d91dceac3e1 | [
"0BSD"
] | 1 | 2020-10-24T16:05:22.000Z | 2020-10-24T16:05:22.000Z | src/components/resourceItem.js | alexxmitchell/WomenWhoCodeCincy.github.io | 678d771e79033b900b364388cd7c3d91dceac3e1 | [
"0BSD"
] | 25 | 2020-10-14T23:40:18.000Z | 2020-11-07T14:12:28.000Z | src/components/resourceItem.js | alexxmitchell/WomenWhoCodeCincy.github.io | 678d771e79033b900b364388cd7c3d91dceac3e1 | [
"0BSD"
] | 8 | 2020-10-16T16:18:40.000Z | 2020-10-26T00:44:55.000Z | import React from "react"
import PropTypes from "prop-types"
const ResourceItem = ({ title, description, url, topics }) => (
<div>
<a target="_blank" rel="noopener noreferrer" href={url}>{title}</a>
<p>{description}</p>
<p>{topics.join(", ")}</p>
</div>
)
ResourceItem.propTypes = {
title: PropTypes.string,
description: PropTypes.string,
url: PropTypes.string,
topics: PropTypes.arrayOf(PropTypes.string)
}
ResourceItem.defaultProps = {
title: ``,
description: ``,
url: ``,
topics: []
}
export default ResourceItem
| 20.444444 | 71 | 0.65942 |
37bbddddecb3e2d78b3cb86f7c0f37296a6d9c70 | 327 | js | JavaScript | react/components/Footer/Footer.js | ChrisW-B/spotifyPlaylists | 9e647c99faf73f89301328d6ef4c3e607b4488d1 | [
"MIT"
] | 2 | 2016-10-13T02:34:55.000Z | 2016-11-11T18:23:41.000Z | react/components/Footer/Footer.js | ChrisW-B/spotifyPlaylists | 9e647c99faf73f89301328d6ef4c3e607b4488d1 | [
"MIT"
] | 6 | 2020-07-17T11:10:08.000Z | 2022-02-10T17:55:35.000Z | react/components/Footer/Footer.js | ChrisW-B/spotifyPlaylists | 9e647c99faf73f89301328d6ef4c3e607b4488d1 | [
"MIT"
] | 1 | 2017-10-02T15:05:04.000Z | 2017-10-02T15:05:04.000Z | import React, { Component } from 'react';
import { Wrapper, Text, Link } from './Styles';
export default class Footer extends Component {
render() {
return (
<Wrapper>
<Text>Made in 2017 By Chris Barry | <Link href='//github.com/chrisw-b/spotifyPlaylists'>Source</Link></Text>
</Wrapper>
);
}
} | 27.25 | 116 | 0.629969 |
37bd0c552abe821fc76b889a2f4c01a327784035 | 636 | js | JavaScript | src/assets/js/directives/waterfall.js | zhangzhaoaaa/nodePureFE | 5b7ca16f1e54ca7e4974cbe87f11f3957d865811 | [
"MIT"
] | null | null | null | src/assets/js/directives/waterfall.js | zhangzhaoaaa/nodePureFE | 5b7ca16f1e54ca7e4974cbe87f11f3957d865811 | [
"MIT"
] | null | null | null | src/assets/js/directives/waterfall.js | zhangzhaoaaa/nodePureFE | 5b7ca16f1e54ca7e4974cbe87f11f3957d865811 | [
"MIT"
] | null | null | null | var Vue = require('vue');
var perfCascade = require('../perf-cascade.js');
var options = {
rowHeight: 20, //default: 23
showAlignmentHelpers : true, //default: true
showIndicatorIcons: false, //default: true
leftColumnWith: 30 ,//default: 25
};
module.exports = {
deep: true,
bind: function () {
},
update: function (val, oldVal) {
var _this = this;
Vue.nextTick(function () {
var har = val.log;
var perfCascadeSvg = perfCascade.fromHar(har, options);
_this.el.appendChild(perfCascadeSvg);
});
},
unbind: function () {
}
}; | 24.461538 | 68 | 0.572327 |
37beea1f462eb01e8fdc43eb664a64939526887c | 764 | js | JavaScript | app/static/css/gulpfile.js | nextbase/jeetjat | 829ec497d169a42e7e9b98530d1f5afd58c6fbde | [
"MIT"
] | null | null | null | app/static/css/gulpfile.js | nextbase/jeetjat | 829ec497d169a42e7e9b98530d1f5afd58c6fbde | [
"MIT"
] | null | null | null | app/static/css/gulpfile.js | nextbase/jeetjat | 829ec497d169a42e7e9b98530d1f5afd58c6fbde | [
"MIT"
] | null | null | null | 'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
// load plugins
var $ = require('gulp-load-plugins')();
// compile SASS to CSS
gulp.task('styles', function () {
return gulp.src(['sass/main.scss'])
.pipe($.sass({errLogToConsole: true}))
.pipe($.autoprefixer('last 1 version'))
.pipe(gulp.dest('./'))
.pipe($.size())
.pipe($.notify("Compilation complete."));
});
gulp.task('clean', function () {
return gulp.src(['./main.css', 'dist'], { read: false }).pipe($.clean());
});
// run to build and quit
gulp.task('build', ['clean', 'styles']);
// by default gulp will build and watch
gulp.task('default', ['clean', 'build'], function () {
gulp.watch('sass/**/*.scss', ['styles']);
}); | 26.344828 | 77 | 0.579843 |
37bfcdd942ceb4c1c57d56ffb371be10c0ae1936 | 469 | js | JavaScript | B2G/gecko/js/src/jit-test/tests/collections/Map-iterator-pairs-1.js | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/js/src/jit-test/tests/collections/Map-iterator-pairs-1.js | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/js/src/jit-test/tests/collections/Map-iterator-pairs-1.js | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | // mapiter.next() returns an actual array.
var key = {};
var map = Map([[key, 'value']]);
var entry = map.iterator().next();
assertEq(Array.isArray(entry), true);
assertEq(Object.getPrototypeOf(entry), Array.prototype);
assertEq(Object.isExtensible(entry), true);
assertEq(entry.length, 2);
var names = Object.getOwnPropertyNames(entry).sort();
assertEq(names.length, 3);
assertEq(names.join(","), "0,1,length");
assertEq(entry[0], key);
assertEq(entry[1], 'value');
| 29.3125 | 56 | 0.705757 |
37c20a14906525cbbe350f6d0dc8cfbacacae774 | 2,546 | js | JavaScript | public/js/Screen.js | 2cats/webserial | 3aeb61849dd2d0718101e2fcd083b2be715fe447 | [
"MIT"
] | null | null | null | public/js/Screen.js | 2cats/webserial | 3aeb61849dd2d0718101e2fcd083b2be715fe447 | [
"MIT"
] | null | null | null | public/js/Screen.js | 2cats/webserial | 3aeb61849dd2d0718101e2fcd083b2be715fe447 | [
"MIT"
] | null | null | null | import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { Menu,Segment ,Input ,Button,Grid,Card,Checkbox,Form ,Dropdown,Icon} from 'semantic-ui-react'
import Socket from './Socket'
import DeleteButton from './DeleteButton'
import Style from './Style'
function getSelectionText(){
var selectedText = ""
if (window.getSelection){ // all modern browsers and IE9+
selectedText = window.getSelection().toString()
}
return selectedText
}
export default class Screen extends Component {
constructor(props){
super(props);
this.state = {
_newdata:[],
hex:false,
trans:"",
}
Socket.onData(this.handleSocketData.bind(this));
}
handleSocketData(dat){
this.setState({
_newdata:dat
})
document.getElementsByClassName('prescroll')[0].scrollTop=document.getElementsByClassName('prescroll')[0].scrollHeight;
}
onMouseUp(data){
if(!this.state.hex){
return;
}
let selection=window.getSelection();
let str=selection.toString()
if (str) {
this.setState({
trans:Socket.hexString2ASCII(str)
})
}else{
this.setState({
trans:""
})
}
}
handleHexChange(event, { name, value, checked }){
this.setState({
hex:checked
}
)
}
render(){
let dataShow;
if(this.state.hex){
dataShow=Socket.data;
}else{
dataShow=Socket.hexString2ASCII(Socket.data);
}
return (
<div className={this.props.className} onMouseUp={this.onMouseUp.bind(this)} style={{height:"100%",position:"relative"}}>
<Segment raised color='green' overflow='scroll' style={{height:"100%",paddingTop:"35px"}}>
<div className='prescroll' style={{overflowY:'auto',height:"100%",wordWrap:'break-word',wordBreak:'break-all'}}>
<pre className='datapre nodrag' style={Style.pre}>
{dataShow}
</pre>
</div>
</Segment>
<Segment raised color='violet' hidden={!this.state.trans} overflow='scroll' style={{overflowY:'auto'}}>
<pre className="nodrag" style={Style.pre}>
{this.state.trans}
</pre>
</Segment>
<div style={{position:"absolute" ,top:"5px",right:"5px"}}>
<Checkbox toggle checked={this.state.hex} onChange={this.handleHexChange.bind(this)} style={{marginLeft:"5px" ,marginRight:"5px",alignSelf:'center'}} label='Hex' />
<DeleteButton {...this.props} />
</div>
</div>
)
}
}
| 29.264368 | 174 | 0.609191 |
37c25fed4803128e489abf7027e88f4be458518f | 1,388 | js | JavaScript | app/js/app/directives/JsonLdWriter.js | ucam-cl-dtg/isaac-app | dffce53fd6b2a75daa7313a1be6001358030463c | [
"MIT"
] | 3 | 2015-10-28T15:39:20.000Z | 2018-06-25T11:40:48.000Z | app/js/app/directives/JsonLdWriter.js | ucam-cl-dtg/isaac-app | dffce53fd6b2a75daa7313a1be6001358030463c | [
"MIT"
] | 580 | 2015-01-06T11:20:57.000Z | 2019-03-28T15:56:22.000Z | app/js/app/directives/JsonLdWriter.js | ucam-cl-dtg/isaac-app | dffce53fd6b2a75daa7313a1be6001358030463c | [
"MIT"
] | 1 | 2021-08-15T01:35:30.000Z | 2021-08-15T01:35:30.000Z | /**
* Copyright 2014 Stephen Cummins
*
* 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 angular from "angular";
define([],function() {
return [function() {
return {
restrict: 'EA',
scope: {
script: '='
},
link: function(scope, element, _attrs) {
scope.$watch('script', function (newValue, _oldValue) {
if (newValue.name) {
element.empty();
let scriptTag = angular.element(document.createElement("script"));
scriptTag.attr("type", "application/ld+json")
scriptTag.text(JSON.stringify(newValue));
element.append(scriptTag);
}
});
}
};
}]
}) | 34.7 | 90 | 0.548991 |
37c33d98d90f4e2131738fa80a00fe086090c58d | 580 | js | JavaScript | lib/config/ConfigurationLoader.js | kjoshi1988/mongo-node-example | 360414728294de05a817a8ef9103497fb4907a53 | [
"Unlicense",
"MIT"
] | 1 | 2017-06-27T15:53:41.000Z | 2017-06-27T15:53:41.000Z | lib/config/ConfigurationLoader.js | kjoshi1988/mongo-node-example | 360414728294de05a817a8ef9103497fb4907a53 | [
"Unlicense",
"MIT"
] | null | null | null | lib/config/ConfigurationLoader.js | kjoshi1988/mongo-node-example | 360414728294de05a817a8ef9103497fb4907a53 | [
"Unlicense",
"MIT"
] | null | null | null | /**
* @author kjoshi
* @version $Id$*
*/
"use strict";
const properties = require("properties");
const fs = require("fs");
const path = require("path");
const AbstractConfig = require("./property/AbstractConfig");
const instancePath = "config/instance.properties";
/**
* Loads properties from provided path.
* Creates an object of AbstractConfig.
*
* @param filePath
*/
module.exports = {
load: function () {
var contents = fs.readFileSync(path.join(__rootDir, instancePath));
return new AbstractConfig(properties.parse(contents.toString()));
}
}; | 25.217391 | 75 | 0.681034 |
37c36778425f3e6d7cd50936d92c977a9106b06d | 3,403 | js | JavaScript | frontend/src/routers/Header.js | byn9826/Thousanday-Web | 5a72b25144a071f1a4fc77dbf5c9e85be79ce8fb | [
"BSD-3-Clause"
] | 11 | 2017-06-20T01:58:12.000Z | 2020-02-04T14:48:22.000Z | frontend/src/routers/Header.js | msdgwzhy6/Thousanday-Web | 5a72b25144a071f1a4fc77dbf5c9e85be79ce8fb | [
"BSD-3-Clause"
] | null | null | null | frontend/src/routers/Header.js | msdgwzhy6/Thousanday-Web | 5a72b25144a071f1a4fc77dbf5c9e85be79ce8fb | [
"BSD-3-Clause"
] | 9 | 2017-07-15T11:13:23.000Z | 2020-12-04T08:10:50.000Z | import React, {Component} from "react"
import { connect } from 'react-redux';
import { Redirect } from "react-router-dom";
import {
changeAccountData, deleteAccountToken, readAccountData, clearAccountSignup
} from '../redux/actions/account';
import { googleClientId, facebookClientId } from '../helpers/config';
import Googlelogin from '../components/Googlelogin';
import Facebooklogin from '../components/Facebooklogin';
class Header extends Component {
constructor(props) {
super(props);
this.state = {
showDrop: false,
redirectHome: false
};
}
componentWillMount() {
this.props.changeAccountData(
[
localStorage.getItem('id'),
localStorage.getItem('name'),
localStorage.getItem('token')
]
);
}
componentDidUpdate() {
if (this.state.redirectHome) {
this.setState({ redirectHome: false });
} else if (this.props.account.redirectSignup) {
this.props.clearAccountSignup();
}
}
gLogin(detail) {
if (this.props.account.id === null) {
this.props.readAccountData('google', detail);
}
}
fLogin(response, token) {
if (this.props.account.id === null) {
this.props.readAccountData('facebook', { response, token });
}
}
showDrop() {
this.setState({ showDrop: !this.state.showDrop });
}
logOut() {
if (FB) {
FB.logout();
}
if (gapi) {
let auth2 = gapi.auth2.getAuthInstance();
auth2.signOut();
}
this.props.deleteAccountToken(
this.props.account.id,
this.props.account.token
);
this.setState({ redirectHome: true });
}
render() {
if (this.state.redirectHome) {
return <Redirect to={ '/' } />;
} else if (this.props.account.redirectSignup) {
return <Redirect to={ '/signup' } />;
}
const loginStyle = this.state.showDrop ? "header-drop" : "header-drop-hide";
const userInfo = (
<div id="header-login" onClick={ this.showDrop.bind(this) }>
<h5>
{ this.props.account.id === null ? 'Login' : this.props.account.name }
</h5>
<img src="/public/icon/glyphicons-dropdown.png" />
</div>
);
let logoutBoard;
if (this.state.showDrop && this.props.account.id !== null) {
logoutBoard = (
<section className="header-drop">
<a href={ "/user/" + this.props.account.id }><h5>Home</h5></a>
<a href={ "/watch" }><h5>Watch List</h5></a>
<a href={ "/request" }><h5>Requests</h5></a>
<a href={ "/setting" }><h5>Setting</h5></a>
<h6 id="header-drop-logout" onClick={ this.logOut.bind(this) }>Log Out</h6>
</section>
);
}
return (
<header id="header">
<a href="/">
<img id="header-logo" src="/public/logo.png" alt="logo" />
</a>
<h5 id="header-desc">Homepage for pets</h5>
{ userInfo }
<a className="header-navi" href="/explore">
<h5>Explore</h5>
</a>
<a className="header-navi" href="/">
<h5>Public</h5>
</a>
<section className={ loginStyle }>
<h5 id="header-drop-notice">Click to sign in or sign up</h5>
<Googlelogin
clientId={ googleClientId }
width="200px"
gLogin={ this.gLogin.bind(this) }
/>
<Facebooklogin
clientId={ facebookClientId }
width="194px"
fLogin={ this.fLogin.bind(this) }
/>
</section>
{ logoutBoard }
</header>
);
}
}
export default connect(
(state) => ({ account: state.account }),
{ changeAccountData, deleteAccountToken, readAccountData, clearAccountSignup }
)(Header); | 27.443548 | 80 | 0.625037 |
37c39371c817312c11c7fa0ce4b1bd11b47c6ceb | 1,600 | js | JavaScript | src/js/diagrams/Graph/helpers/index.js | igncp/diagrams-collection | 345d0888f9d4a6466397910f960276fe00fdc436 | [
"MIT"
] | 1 | 2015-11-04T00:12:40.000Z | 2015-11-04T00:12:40.000Z | src/js/diagrams/Graph/helpers/index.js | igncp/diagrams-collections | 345d0888f9d4a6466397910f960276fe00fdc436 | [
"MIT"
] | null | null | null | src/js/diagrams/Graph/helpers/index.js | igncp/diagrams-collections | 345d0888f9d4a6466397910f960276fe00fdc436 | [
"MIT"
] | null | null | null | import addDiagramInfo from './addDiagramInfo'
import connectionFnFactory from './connectionFnFactory'
import dataFromGeneralToSpecific from './dataFromGeneralToSpecific'
import doWithMinIdAndMaxIdOfLinkNodes from './doWithMinIdAndMaxIdOfLinkNodes'
import generateConnectionWithText from './generateConnectionWithText'
import generateFnNodeWithSharedGetAndBoldIfFile from './generateFnNodeWithSharedGetAndBoldIfFile'
import generateNode from './generateNode'
import generateNodeOptions from './generateNodeOptions'
import generateNodeWithSharedGet from './generateNodeWithSharedGet'
import generateNodeWithTargetLink from './generateNodeWithTargetLink'
import generateNodeWithTextAsTargetLink from './generateNodeWithTextAsTargetLink'
import generatePrivateNode from './generatePrivateNode'
import getLinksNumberMapItemWithLink from './getLinksNumberMapItemWithLink'
import linksNumberMapHandler from './linksNumberMapHandler'
import mergeWithDefaultConnection from './mergeWithDefaultConnection'
import setReRender from './setReRender'
import updateLinksNumberMapWithLink from './updateLinksNumberMapWithLink'
export default {
addDiagramInfo,
connectionFnFactory,
dataFromGeneralToSpecific,
doWithMinIdAndMaxIdOfLinkNodes,
generateConnectionWithText,
generateFnNodeWithSharedGetAndBoldIfFile,
generateNode,
generateNodeOptions,
generateNodeWithSharedGet,
generateNodeWithTargetLink,
generateNodeWithTextAsTargetLink,
generatePrivateNode,
getLinksNumberMapItemWithLink,
linksNumberMapHandler,
mergeWithDefaultConnection,
setReRender,
updateLinksNumberMapWithLink,
}
| 42.105263 | 97 | 0.868125 |
37c5c40d1336bfcc0dffa09ac6a275ec6840744c | 276 | js | JavaScript | docs/search/variables_4.js | willdurand/ArvernOS | 4cb72648f0718c69a39fb664164490b138b770d2 | [
"MIT"
] | 77 | 2021-11-19T15:56:32.000Z | 2022-03-30T04:02:02.000Z | docs/search/variables_4.js | willdurand/ArvernOS | 4cb72648f0718c69a39fb664164490b138b770d2 | [
"MIT"
] | 57 | 2021-11-19T12:38:52.000Z | 2022-03-03T08:56:35.000Z | docs/search/variables_4.js | willdurand/ArvernOS | 4cb72648f0718c69a39fb664164490b138b770d2 | [
"MIT"
] | 2 | 2022-03-01T06:39:25.000Z | 2022-03-24T15:47:45.000Z | var searchData=
[
['flags_0',['flags',['../structelf__section__header__t.html#ae57befb1122af0a2f2a099ac4a892a58',1,'elf_section_header_t']]],
['function_5fnumber_1',['function_number',['../unionpci__device__t.html#a72ec60cd7f37ed6a45f2bdd341a656d3',1,'pci_device_t']]]
];
| 46 | 128 | 0.778986 |
37c60240c9cdedafac4d7cf92b8fd896bf6aa443 | 253 | js | JavaScript | src/js/handler/window/index.js | yujo11/javascript-youtube-classroom | 2ab6773c21a54f78a16b16f38db82185122209e5 | [
"MIT"
] | null | null | null | src/js/handler/window/index.js | yujo11/javascript-youtube-classroom | 2ab6773c21a54f78a16b16f38db82185122209e5 | [
"MIT"
] | null | null | null | src/js/handler/window/index.js | yujo11/javascript-youtube-classroom | 2ab6773c21a54f78a16b16f38db82185122209e5 | [
"MIT"
] | null | null | null | import { onWindowInput } from './onWindowInput.js';
import { onModalClose } from '../modal/visibility/onModalClose.js';
export default function () {
window.addEventListener('keyup', onWindowInput);
window.addEventListener('click', onModalClose);
}
| 31.625 | 67 | 0.747036 |
37c66a3651ee8315c3a25075d344817da6b851d1 | 523 | js | JavaScript | src/mixins/products.js | Yundun-FE/yundun-fe-explorer | b4ea911a13829dca819b00962b07a89f43c39995 | [
"MIT"
] | 1 | 2018-09-13T06:57:06.000Z | 2018-09-13T06:57:06.000Z | src/mixins/products.js | Yundun-FE/yundun-fe-web | b4ea911a13829dca819b00962b07a89f43c39995 | [
"MIT"
] | null | null | null | src/mixins/products.js | Yundun-FE/yundun-fe-web | b4ea911a13829dca819b00962b07a89f43c39995 | [
"MIT"
] | null | null | null | import { mapMutations, mapState, mapActions } from 'vuex'
export default {
computed: {
productsId: {
get() {
return this.$store.state.products.id
},
set(value) {
this.SET_ID(value)
}
},
...mapState({
productsData: state => state.products.data
})
},
methods: {
...mapMutations({
'PRODUCTS_SET_ID': 'products/SET_ID'
}),
...mapActions({
'productsSaveById': 'products/saveById',
'productsGetById': 'products/getById' })
}
}
| 19.37037 | 57 | 0.560229 |
37c763747c08c319d93f3c3aa301de610d8287c9 | 5,345 | js | JavaScript | src/experimental/services/expression/model/parser/ASTParser.js | flapjs/webapp | 99c115a86b694745a29a597bc19c379f2709ac4e | [
"MIT"
] | 2 | 2021-04-05T05:51:42.000Z | 2021-08-05T13:58:22.000Z | src/experimental/services/expression/model/parser/ASTParser.js | flapjs/webapp | 99c115a86b694745a29a597bc19c379f2709ac4e | [
"MIT"
] | 8 | 2020-03-23T03:14:52.000Z | 2022-02-28T01:33:21.000Z | src/experimental/services/expression/model/parser/ASTParser.js | flapjs/webapp | 99c115a86b694745a29a597bc19c379f2709ac4e | [
"MIT"
] | 2 | 2021-04-04T14:54:04.000Z | 2022-01-26T15:35:43.000Z | import AbstractParser from '@flapjs/util/loader/AbstractParser.js';
import SemanticVersion from '@flapjs/util/SemanticVersion.js';
import AST from '../AST.js';
import * as ASTUtils from '../util/ASTUtils.js';
export const VERSION_STRING = '1.0.0';
export const VERSION = SemanticVersion.parse(VERSION_STRING);
/**
* A class that parses and composes AST's to and from JSON data.
*/
class ASTParser extends AbstractParser
{
constructor()
{
super();
}
/**
* @override
* @param {object} data The ast data to parse.
* @param {AbstractNode} [dst=null] The target to set parsed ast data.
* @returns {AbstractNode} The result in the passed-in dst.
*/
parse(data, dst = null)
{
if (typeof data !== 'object')
{
throw new Error('Unable to parse data of non-object type');
}
const dataVersion = SemanticVersion.parse(data['_version'] || '0.0.0');
if (!dataVersion.canSupportVersion(VERSION))
{
throw new Error('Unable to parse data for incompatible version \'' + dataVersion + '\'');
}
const astData = data['ast'] || [];
let objectMapping = astData['objectMapping'];
let rootIndex = astData['rootIndex'];
let nodeMapping = new Map();
// Identify all objects and convert them to AST node instances (without children)...
for(let key of Object.keys(nodeMapping))
{
let astObject = objectMapping[key];
let typeClass = getClassForASTObjectType(astObject.type);
let typeClassArgs = getClassArgsForASTObject(astObject);
let astNode = new (typeClass)(astObject.symbol, key, ...typeClassArgs);
nodeMapping.set(key, astNode);
}
// Hydrate those objects with children!!!
for(let key of Object.keys(nodeMapping))
{
let astObject = objectMapping[key];
let astNode = nodeMapping.get(key);
if (Array.isArray(astObject.children) && astObject.children.length > 0)
{
for(let childIndex of astObject.children)
{
let childNode = nodeMapping.get(childIndex);
astNode.addChild(childNode);
}
}
}
dst = nodeMapping.get(rootIndex);
return dst;
}
/**
* @override
* @param {AbstractNode} target The root ast node to compose into data.
* @param {object} [dst={}] The object to append graph data.
* @returns {object} The result in the passed-in dst.
*/
compose(target, dst = {})
{
let objectIndexMapping = {};
// Identify all nodes and convert them to objects (without children)...
ASTUtils.forEach(target, astNode =>
objectIndexMapping[astNode.getIndex()] = objectifyASTWithoutChildren(astNode)
);
// Hydrate those objects with children!!!
ASTUtils.forEach(target, astNode =>
{
let astObjectIndex = astNode.getIndex();
let astObject = objectIndexMapping[astObjectIndex];
if (astNode.hasChildren())
{
for(let child of astNode.getChildren())
{
let astChildIndex = child.getIndex();
let astChild = objectIndexMapping[astChildIndex];
astChild.parent = astObjectIndex;
astObject.children.push(astChildIndex);
}
}
});
dst['_version'] = VERSION_STRING;
dst['ast'] = {
objectMapping: objectIndexMapping,
rootIndex: target ? target.getIndex() : -1,
};
return dst;
}
}
function objectifyASTWithoutChildren(astNode)
{
return {
type: getASTNodeType(astNode),
index: astNode.getIndex(),
symbol: astNode.getSymbol(),
parent: -1,
children: []
};
}
function getClassArgsForASTObject(astObject)
{
switch(astObject.type)
{
case 'op':
if (Array.isArray(astObject.children))
{
return [ astObject.children.length ];
}
else
{
return [];
}
default: return [];
}
}
function getClassForASTObjectType(type)
{
switch(type)
{
case 'terminal': return AST.Terminal;
case 'unary': return AST.Unary;
case 'binary': return AST.Binary;
case 'scope': return AST.Scope;
case 'op': return AST.Op;
default:
throw new Error(`Unknown AST node type '${type}'.`);
}
}
function getASTNodeType(astNode)
{
if (astNode instanceof AST.Terminal)
{
return 'terminal';
}
else if (astNode instanceof AST.Unary)
{
return 'unary';
}
else if (astNode instanceof AST.Binary)
{
return 'binary';
}
else if (astNode instanceof AST.Scope)
{
return 'scope';
}
else if (astNode instanceof AST.Op)
{
return 'op';
}
else
{
throw new Error(`Missing AST node type for class '${astNode.constructor.name}'.`);
}
}
export const INSTANCE = new ASTParser();
export default ASTParser;
| 28.430851 | 101 | 0.560337 |
37c803857bfb13b1fc45b88f087f4d110ee7ba85 | 302 | js | JavaScript | amplify/backend/function/amplifygraphqlschemaa58b2f6b/src/index.js | RigoMiranda/amplify-graphql-schema-designer | 3c857d1b330e59c3993b25d451cb67638444674e | [
"MIT"
] | null | null | null | amplify/backend/function/amplifygraphqlschemaa58b2f6b/src/index.js | RigoMiranda/amplify-graphql-schema-designer | 3c857d1b330e59c3993b25d451cb67638444674e | [
"MIT"
] | null | null | null | amplify/backend/function/amplifygraphqlschemaa58b2f6b/src/index.js | RigoMiranda/amplify-graphql-schema-designer | 3c857d1b330e59c3993b25d451cb67638444674e | [
"MIT"
] | null | null | null | const Template = require('./template');
exports.handler = async (event) => {
console.log(JSON.parse(event.arguments.input));
const input = { 'graph': JSON.parse(event.arguments.input) };
const templateText = Template.buildTemplate(input);
return JSON.stringify(templateText);
}; | 37.75 | 72 | 0.68543 |
37c87cae8c2df1592508f7f05acc60bb708e5f80 | 1,441 | js | JavaScript | public/backend_admin/vendors/select2/src/js/select2/data/ajax.min.js | liudianpeng/wisdom | 76a86f02440faa53adcfb6ee8f1037e256a6263b | [
"Apache-2.0"
] | 1 | 2021-03-28T07:35:01.000Z | 2021-03-28T07:35:01.000Z | public/backend_admin/vendors/select2/src/js/select2/data/ajax.min.js | liudianpeng/wisdom | 76a86f02440faa53adcfb6ee8f1037e256a6263b | [
"Apache-2.0"
] | null | null | null | public/backend_admin/vendors/select2/src/js/select2/data/ajax.min.js | liudianpeng/wisdom | 76a86f02440faa53adcfb6ee8f1037e256a6263b | [
"Apache-2.0"
] | null | null | null | define(["./array","../utils","jquery"],function(d,c,b){function a(e,f){this.ajaxOptions=this._applyDefaults(f.get("ajax"));if(this.ajaxOptions.processResults!=null){this.processResults=this.ajaxOptions.processResults}a.__super__.constructor.call(this,e,f)}c.Extend(a,d);a.prototype._applyDefaults=function(e){var f={data:function(g){return b.extend({},g,{q:g.term})},transport:function(j,i,h){var g=b.ajax(j);g.then(i);g.fail(h);return g}};return b.extend({},f,e,true)};a.prototype.processResults=function(e){return e};a.prototype.query=function(i,j){var h=[];var e=this;if(this._request!=null){if(b.isFunction(this._request.abort)){this._request.abort()}this._request=null}var f=b.extend({type:"GET"},this.ajaxOptions);if(typeof f.url==="function"){f.url=f.url.call(this.$element,i)}if(typeof f.data==="function"){f.data=f.data.call(this.$element,i)}function g(){var k=f.transport(f,function(m){var l=e.processResults(m,i);if(e.options.get("debug")&&window.console&&console.error){if(!l||!l.results||!b.isArray(l.results)){console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")}}j(l)},function(){if(k.status&&k.status==="0"){return}e.trigger("results:message",{message:"errorLoading"})});e._request=k}if(this.ajaxOptions.delay&&i.term!=null){if(this._queryTimeout){window.clearTimeout(this._queryTimeout)}this._queryTimeout=window.setTimeout(g,this.ajaxOptions.delay)}else{g()}};return a}); | 1,441 | 1,441 | 0.739764 |
37c95503963df83ec94f6b8d9494806e7cc0a15f | 1,364 | js | JavaScript | app/static/src/index.js | nkartha2/the-grocery-list | d61c80bc09b03a3855ec4b99014b2532f3da3980 | [
"MIT"
] | null | null | null | app/static/src/index.js | nkartha2/the-grocery-list | d61c80bc09b03a3855ec4b99014b2532f3da3980 | [
"MIT"
] | 7 | 2020-03-13T22:20:46.000Z | 2022-02-26T18:30:30.000Z | app/static/src/index.js | nkartha2/the-grocery-list | d61c80bc09b03a3855ec4b99014b2532f3da3980 | [
"MIT"
] | null | null | null | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import { Route, BrowserRouter as Router } from 'react-router-dom';
import { createStore } from 'redux';
import MainNav from './MainNav';
import './styles/_base.scss';
import rootReducer from './store/index';
import './index.css';
import App from './App';
import RecipeForm from "./RecipeForm";
import Recipes from "./Recipes";
import AdminAddIngredient from './admin/AdminAddIngredient';
import UOMForm from './admin/AdminAddUoM';
import * as serviceWorker from './serviceWorker';
const store = createStore(rootReducer);
const routing = (
<Provider store={store}>
<Router>
<div className="container">
<MainNav/>
<Route path="/" component={App} />
<Route path="/admin/uom" component={UOMForm} />
<Route path="/admin/recipe" component={RecipeForm} />
<Route path="/recipes" component={Recipes} />
<Route path="/admin/ingredient" component={AdminAddIngredient} />
</div>
</Router>
</Provider>
);
ReactDOM.render(routing, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
| 31.72093 | 73 | 0.691349 |
37cb50b24f4f662b9c769e83091ef66c887fdd0b | 1,260 | js | JavaScript | src/components/Person.js | hackcincinnati/site | 7945c499e58b747f5b7486efb80bbd82a9a9a494 | [
"MIT"
] | 6 | 2019-01-27T20:33:09.000Z | 2019-07-20T19:39:30.000Z | src/components/Person.js | hackcincinnati/site | 7945c499e58b747f5b7486efb80bbd82a9a9a494 | [
"MIT"
] | null | null | null | src/components/Person.js | hackcincinnati/site | 7945c499e58b747f5b7486efb80bbd82a9a9a494 | [
"MIT"
] | 4 | 2019-04-24T18:58:50.000Z | 2022-01-04T16:33:28.000Z | import React from 'react'
import { graphql } from 'gatsby'
import styled from 'styled-components'
import Img from 'gatsby-image'
import { OutboundLink } from 'gatsby-plugin-google-analytics'
import { FlexItem, FlexContent, colors } from '../components/Theme'
export const staffImage = graphql`
fragment staffImage on File {
childImageSharp {
fluid(maxWidth: 200) {
...GatsbyImageSharpFluid
}
}
}
`
const StyledFlexContent = styled(FlexContent)`
text-align: center;
p {
font-size: 0.85em;
line-height: 1em;
}
h3 {
margin: 5px 0;
color: ${colors.primary};
line-height: 1.2em;
word-spacing: 500px;
}
`
const StyledImage = styled(Img)`
border-radius: 50%;
margin: 0 auto 10px;
width: ${props => props.width};
`
const Person = ({ details, image, width }) => (
<FlexItem width="20%" mobileWidth="50%" margin="10px 0">
<StyledFlexContent>
<OutboundLink
target="_blank"
rel="noopener noreferrer"
href={details.social.linkedin}
>
<StyledImage fluid={image} alt={details.name} width={width} />
</OutboundLink>
<h3>{details.name}</h3>
<p>{details.position}</p>
</StyledFlexContent>
</FlexItem>
)
export default Person
| 22.105263 | 70 | 0.638095 |
37cc016f8da0dd757f1baef6934326522f9bd9ff | 2,343 | js | JavaScript | commands/Spell.js | Buluphont/Spellbot | f1c6a2dc2b2fe469b1399bb625529f96a458923f | [
"MIT"
] | 6 | 2017-01-23T13:30:14.000Z | 2020-01-31T04:47:36.000Z | commands/Spell.js | Buluphont/Spellbot | f1c6a2dc2b2fe469b1399bb625529f96a458923f | [
"MIT"
] | 14 | 2017-01-23T17:30:58.000Z | 2017-05-18T00:25:28.000Z | commands/Spell.js | Buluphont/Spellbot | f1c6a2dc2b2fe469b1399bb625529f96a458923f | [
"MIT"
] | 5 | 2017-01-23T10:53:21.000Z | 2019-06-01T05:28:30.000Z | const SearchCommand = require("../types/SearchCommand");
const Discord = require("discord.js");
const SpellModel = require("../models/Spell");
module.exports = class Spell extends SearchCommand{
constructor(client){
super(client, {
name: "spell",
category: "5e",
help: "Searches for a spell by name.",
helpArgs: "<Spell Name>",
elevation: 0,
timeout: 15000
});
this._ordinal_suffix_of = function(i){
var j = i % 10,
k = i % 100;
if (j == 1 && k != 11) {
return i + "st";
}
if (j == 2 && k != 12) {
return i + "nd";
}
if (j == 3 && k != 13) {
return i + "rd";
}
return i + "th";
};
}
async execute(msg, args){ // eslint-disable-line no-unused-vars
let prefix;
if(msg.guild){
prefix = await this.client.fetchPrefix(msg.guild.id);
}
else{
prefix = "";
}
if(!args){
return msg.reply(`invalid command; please specify a spell.\nProper usage: \`${prefix}${this.name} dancing lights\``);
}
let toEdit = await msg.reply("fetching your spell. . .");
let spells = await SpellModel.find({name: new RegExp(args.join(" "), "i")});
if(!spells || spells.length === 0){
return toEdit.edit("Unable to find your spell. Sorry!");
}
let result;
try{
result = await super.disambiguate(toEdit, msg.author, "spell", spells, "name");
}
catch(err){
return err.toEdit.edit(err.toString());
}
let descFieldValues = [];
let paragraphs = result.description.trim().split("\n");
paragraphs.forEach(p => {
if(p && p.length > 0){
descFieldValues.push(p);
}
});
let spellMeta = [];
let type = `*${this._ordinal_suffix_of(result.level)}-level ${result.school}${result.ritual ? " (ritual)" : ""}*\n`;
spellMeta.push(type);
spellMeta.push(`**Casting Time**: ${result.castingTime}`);
spellMeta.push(`**Range**: ${result.range}`);
spellMeta.push(`**Components**: ${result.components}`);
spellMeta.push(`**Duration**: ${result.duration}`);
let embed = new Discord.RichEmbed().setTitle(`__**${result.name}**__`)
.setDescription(spellMeta.join("\n"))
.setColor(0x97ff43);
descFieldValues.forEach((p, i) => {
if(i == 0){
embed = embed.addField("Description", p.trim());
}
else{
embed = embed.addField("\u200b", p.trim());
}
});
return msg.channel.send("", {embed: embed});
}
};
| 26.931034 | 120 | 0.599232 |
37ccb8e1cf330febd1b36a9cc98ba7e519069587 | 3,759 | js | JavaScript | server/routes/orderConfirm/timeChecker.js | elliothogg/cavallo-icecream | 03dcd601cc3ad4c79caa4c2ec51d709a75388556 | [
"MIT"
] | 1 | 2021-10-18T20:43:47.000Z | 2021-10-18T20:43:47.000Z | server/routes/orderConfirm/timeChecker.js | elliothogg/cavallo-icecream | 03dcd601cc3ad4c79caa4c2ec51d709a75388556 | [
"MIT"
] | null | null | null | server/routes/orderConfirm/timeChecker.js | elliothogg/cavallo-icecream | 03dcd601cc3ad4c79caa4c2ec51d709a75388556 | [
"MIT"
] | null | null | null | const e = require('express');
var connection = require('../../mysql/database');
function timechecker(storeID, orderTime, isDelivery, choosenTime, callback){
var OrderPlacedTime = orderTime.split(' ')[1];
var OrderPlacedHH = OrderPlacedTime.split(':')[0];
var OrderPlacedmm = OrderPlacedTime.split(':')[1];
return queryOpenTime(storeID, (err, data)=>{
if(isWeekday){
if(deliveryOrCollection(isDelivery, OrderPlacedHH, OrderPlacedmm, data.data[0].WeekdayOpeningTime, data.data[0].WeekdayClosingTime)){
if(isDeliveryOrCollectionTimeLaterThanCurrent(OrderPlacedHH, OrderPlacedmm, choosenTime) === true){
return callback(null, {
Status: true,
reason: "True"
})
}else{
return callback(null, {
Status: false,
reason: "Choosing Time invalide"
})
}
}else{
return callback(null, {
Status: false,
reason: "Shop Closed"
})
}
}else{
if(deliveryOrCollection(isDelivery, OrderPlacedHH, OrderPlacedmm, data.data[0].WeekendOpeningTime, data.data[0].WeekendClosingTime)){
return callback(null, {
Status: true,
reason: "Shop Open"
})
}else{
return callback(null, {
Status: false,
reason: "Shop Closed"
})
}
}
})
}
function isWeekday(){
if(new Date().getDay() === 0 || new Date().getDay() === 6){
return false;
}else{
return true;
}
}
function deliveryOrCollection(isDelivery, OrderPlacedHH, OrderPlacedmm, OpeningTime, ClosingTime){
if(isDelivery === true){
if(parseInt(OrderPlacedHH) < parseInt(OpeningTime.split(':')[0]) || parseInt(OrderPlacedHH) >= parseInt(ClosingTime.split(':')[0])){
console.log("1")
return false;
}else{
console.log("2")
return true;
}
}else{
if(parseInt(OrderPlacedHH) < parseInt(OpeningTime.split(':')[0]) || ((parseInt(OrderPlacedHH) === parseInt(ClosingTime.split(':')[0])-1) && parseInt(OrderPlacedmm) >= (parseInt(ClosingTime.split(':')[1])+45)) || parseInt(OrderPlacedHH) >= parseInt(ClosingTime.split(':')[0])){
console.log("3")
return false;
}else{
console.log("4")
return true;
}
}
}
function isDeliveryOrCollectionTimeLaterThanCurrent(OrderPlacedHH, OrderPlacedmm, chooseTime){
console.log("!!!!!!!!" + chooseTime)
if(chooseTime === "ASAP"){
return true;
}else{
var chooseHH = chooseTime.split(':')[0];
var choosemm = chooseTime.split(':')[1].substring(0,1);
if(chooseHH >= OrderPlacedHH && choosemm > OrderPlacedmm){
return true;
}else{
return false;
}
}
}
function queryOpenTime(storeID, callback){
let sql = `select WeekdayOpeningTime, WeekdayClosingTime, WeekendOpeningTime, WeekendClosingTime from RestaurantInfo where ID = '${storeID}'`;
connection.query(sql, function(error, results, fields){
if (error) {
callback(error);
} else {
if (results.length) {
return callback(null, {
code: 0,
data: results
});
} else {
return callback(null, {
code: 1
});
}
}
})
}
module.exports = timechecker; | 33.5625 | 284 | 0.522213 |
37ce1e62760eb9ca8bec9a81cabd22ca6aa53f9d | 2,372 | js | JavaScript | src/Input.component.test.js | DenisDashkevich/react-eco-ui-kit | 828f5aa70a85852b37a7b50280a27c26c08a1ea5 | [
"MIT"
] | 2 | 2018-10-16T14:45:51.000Z | 2018-10-16T15:00:18.000Z | src/Input.component.test.js | DenisDashkevich/react-eco-ui-kit | 828f5aa70a85852b37a7b50280a27c26c08a1ea5 | [
"MIT"
] | null | null | null | src/Input.component.test.js | DenisDashkevich/react-eco-ui-kit | 828f5aa70a85852b37a7b50280a27c26c08a1ea5 | [
"MIT"
] | null | null | null | import React from 'react';
import { shallow, mount } from 'enzyme';
import Input from './Input';
import { DEFAULT_VALUE } from './consts/core';
import { VALID, INVALID, INPUT } from './consts/input';
describe('Input spec', () => {
it('renders input with default value', () => {
const wrapper = shallow(<Input />);
const inputs = wrapper.find('input');
const props = inputs.props();
expect(inputs).toHaveLength(1);
expect(inputs.hasClass(VALID)).toBeTruthy();
expect(inputs.hasClass(INPUT)).toBeTruthy();
expect(props['data-valid']).toBeTruthy();
expect(props.value).toBe(DEFAULT_VALUE);
});
it('should call validator, when trigger input change', () => {
const validator = jest.fn();
const simulatedValue = 12;
const wrapper = mount(<Input validator={validator} />);
const inputs = wrapper.find('input');
expect(validator).toHaveBeenNthCalledWith(1, DEFAULT_VALUE);
inputs.simulate('change', { target: { value: simulatedValue } });
expect(validator).toHaveBeenCalledTimes(2);
expect(validator).toHaveBeenNthCalledWith(2, simulatedValue);
});
it('should call provided handler, if value is not same', () => {
const onChange = jest.fn();
const simulatedValue = 12;
const wrapper = mount(<Input onChange={onChange} />);
const inputs = wrapper.find('input');
inputs.simulate('change', { target: { value: simulatedValue } });
expect(onChange).toHaveBeenCalledTimes(1);
expect(onChange).toHaveBeenCalledWith(simulatedValue);
});
it('should not call provided handler if values are same', () => {
const onChange = jest.fn();
const simulatedValue = DEFAULT_VALUE;
const wrapper = mount(<Input onChange={onChange} />);
const inputs = wrapper.find('input');
inputs.simulate('change', { target: { value: simulatedValue } });
expect(onChange).not.toHaveBeenCalled();
});
it('should update ui after setState', () => {
const simulatedValue = 12;
const wrapper = mount(<Input validator={(val) => val < simulatedValue} />);
const inputs = wrapper.find('input');
inputs.simulate('change', { target: { value: simulatedValue } });
expect(inputs.hasClass(INVALID)).toBeTruthy();
expect(inputs.hasClass(VALID)).toBeFalsy();
});
it('should add className', () => {
const one = 'one';
const wrapper = mount(<Input className={one} />);
expect(wrapper.find('input').hasClass(one));
});
});
| 29.283951 | 77 | 0.679595 |
37ce3b64adfc5c7a105257a4dfdd8c4a1e1565cd | 2,995 | js | JavaScript | lib/transform.js | Ticketmaster/transform-jest-deps | 2bb4c743a5080e17d8c0f7931aac8633499da798 | [
"MIT"
] | 2 | 2015-12-16T04:19:17.000Z | 2016-01-23T16:41:21.000Z | lib/transform.js | Ticketmaster/transform-jest-deps | 2bb4c743a5080e17d8c0f7931aac8633499da798 | [
"MIT"
] | 2 | 2016-04-13T01:10:37.000Z | 2016-04-21T03:58:06.000Z | lib/transform.js | mwolson/transform-jest-deps | 2bb4c743a5080e17d8c0f7931aac8633499da798 | [
"MIT"
] | 3 | 2015-09-11T18:43:40.000Z | 2016-04-04T14:22:54.000Z | var _ = require('lodash');
var acorn = require('acorn-jsx');
var falafel = require('falafel');
var defaultOptions = {
ecmaVersion: 6,
ignoreTryCatch: false,
parser: acorn,
plugins: { jsx: true },
ranges: true
};
var jestFunctions = ['dontMock', 'genMockFromModule', 'mock', 'setMock', 'unmock'];
var requireFunctions = ['requireActual', 'requireMock', 'resolve'];
function parentsOf(node) {
var arr = [];
for (var p = node.parent; p; p = p.parent) {
arr.push(p);
}
return arr;
}
function callExpressionsOf(node) {
var arr = [];
for (; _.get(node, 'type') === 'CallExpression'; node = _.get(node, 'callee.object')) {
arr.push(node);
}
return arr;
}
function inTryCatch(node) {
return parentsOf(node).some(function(parent) {
return parent.type === 'TryStatement' || parent.type === 'CatchClause';
});
}
function isJestStatement(node) {
var callExprs = callExpressionsOf(node);
return node.type === 'CallExpression' &&
node.arguments &&
node.callee.type === 'MemberExpression' &&
node.callee.property.type === 'Identifier' &&
_.includes(jestFunctions, node.callee.property.name) &&
callExprs.some(function(expr) {
return expr.callee.object.type === 'Identifier' &&
expr.callee.object.name === 'jest';
});
}
function isRequireStatement(node) {
return node.type === 'CallExpression' &&
node.arguments &&
node.callee.type === 'Identifier' &&
node.callee.name === 'require';
}
function isRequireExtensionStatement(node) {
return node.type === 'CallExpression' &&
node.arguments &&
node.callee.type === 'MemberExpression' &&
node.callee.object.name === 'require' &&
node.callee.object.type === 'Identifier' &&
_.includes(requireFunctions, node.callee.property.name) &&
node.callee.property.type === 'Identifier';
}
function replaceFirstArg(node, update) {
var firstArg = node.arguments[0];
var firstArgSource = firstArg.source();
var parts = [
firstArgSource.substring(0, 1),
update,
firstArgSource.substring(firstArgSource.length - 1)
];
var newValue = parts.join('');
firstArg.update(newValue);
}
function processCallExpression(node, transformFn) {
var firstArg = node.arguments[0];
var newValue = transformFn(firstArg.value);
if (newValue && typeof newValue === 'string') {
replaceFirstArg(node, newValue);
}
}
module.exports = function(src, options, transformFn) {
if (typeof options === 'function') {
transformFn = options;
options = _.assign({}, defaultOptions);
} else {
options = _.assign({}, defaultOptions, options);
}
var ignoreTryCatch = options.ignoreTryCatch;
delete options.ignoreTryCatch;
return falafel(src, options, function(node) {
if (isRequireStatement(node) ||
isRequireExtensionStatement(node) ||
isJestStatement(node)) {
if (!(ignoreTryCatch && inTryCatch(node))) {
processCallExpression(node, transformFn);
}
}
}).toString();
};
| 27.227273 | 89 | 0.657095 |
37ce5f2799bd604965466b764242784b3f430d06 | 296 | js | JavaScript | config/dev.env.js | Lceq/yf-admin | 18e2b18dbaa1422555c39d49dc4f8d0af0c88f2f | [
"MIT"
] | null | null | null | config/dev.env.js | Lceq/yf-admin | 18e2b18dbaa1422555c39d49dc4f8d0af0c88f2f | [
"MIT"
] | null | null | null | config/dev.env.js | Lceq/yf-admin | 18e2b18dbaa1422555c39d49dc4f8d0af0c88f2f | [
"MIT"
] | null | null | null | var merge = require('webpack-merge');
var prodEnv = require('./test.env');
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
REQUEST_HOST: '"http://36.155.114.131:8088"',
MAIN_TITLE: '"智造管理平台"',
LOGIN_TITLE: '"昇虹纺纱智造管理平台"',
LOGIN_TITLE_MIN: '"纺纱专版"'
});
| 26.909091 | 50 | 0.614865 |
37cf02954b2beeb95683526601496888b5d49d61 | 2,884 | js | JavaScript | database/controllers/infraction.js | BobbyTheCatfish/icarus5 | 9f76df59cf13ce4bb3416d443d98db537ab8c6d3 | [
"MIT"
] | 4 | 2022-01-02T23:50:22.000Z | 2022-03-28T16:35:29.000Z | database/controllers/infraction.js | BobbyTheCatfish/icarus5 | 9f76df59cf13ce4bb3416d443d98db537ab8c6d3 | [
"MIT"
] | 65 | 2022-01-02T03:35:20.000Z | 2022-03-31T21:07:29.000Z | database/controllers/infraction.js | BobbyTheCatfish/icarus5 | 9f76df59cf13ce4bb3416d443d98db537ab8c6d3 | [
"MIT"
] | 3 | 2021-08-13T18:50:59.000Z | 2021-09-13T17:27:26.000Z | const Discord = require("discord.js"),
moment = require("moment");
const Infraction = require("../models/Infraction.model");
module.exports = {
/**
* Get an infraction by its associated mod flag.
* @function getByFlag
* @param {String|Discord.Message} flag The mod flag for the infraction
*/
getByFlag: function(flag) {
if (flag.id) flag = flag.id;
return Infraction.findOne({ flag }).exec();
},
/**
* Get a summary of a user's infractions.
* @async
* @function getSummary
* @param {String|Discord.User|Discord.Member} discordId The user whose summary you want to view.
* @param {Number} [time=28] The time in days to review.
*/
getSummary: async function(discordId, time = 28) {
discordId = discordId.id ?? discordId;
const since = moment().subtract(time, "days");
const records = await Infraction.find({ discordId, timestamp: { $gte: since } }).exec();
return {
discordId,
count: records.length,
points: records.reduce((c, r) => c + r.value, 0),
time,
detail: records
};
},
/**
* Remove/delete an infraction
* @function remove
* @param {String|Discord.Message} flag The infraction flag
*/
remove: function(flag) {
if (flag.id) flag = flag.id;
return Infraction.findOneAndDelete({ flag }).exec();
},
/**
* Save an infraction
* @function save
* @param {Object} data Data to save
* @param {String|Discord.User|Discord.GuildMember} data.discordId User's Discord Id
* @param {String} data.channel The channel Id where the infraction took place
* @param {String} data.message The message Id where the infraction took place
* @param {String} data.flag The mod flag created for the infraction
* @param {String} data.description The description of the infraction
* @param {String|Discord.User|Discord.GuildMember} data.mod The mod's Discord Id
* @param {String} data.value The point value of the infraction
*/
save: function(data) {
if (data.message instanceof Discord.Message) {
data.discordId = data.discordId?.id ?? data.discordId ?? data.message.author.id;
data.channel = data.channel?.id ?? data.channel ?? data.message.channel.id;
data.description = data.description ?? data.message.cleanContent;
data.message = data.message.id;
}
data.discordId = data.discordId.id ?? data.discordId;
data.channel = data.channel?.id ?? data.channel;
data.mod = data.mod.id ?? data.mod;
data.flag = data.flag?.id ?? data.flag;
return new Infraction(data).save();
},
/**
* Update an infraction
* @function update
* @param {Infraction} infraction The infraction, post-update
*/
update: function(infraction) {
return Infraction.findByIdAndUpdate(infraction._id, infraction, { new: true }).exec();
}
};
| 36.05 | 101 | 0.650485 |
37cf628da79112129592138cc54be8028e0a6a9b | 828 | js | JavaScript | src/14-queue.js | oksana-svynarova/rs-school-short-track-2021 | 9c429d42953b41227bd2e6d90814a58f0b297e9a | [
"MIT"
] | null | null | null | src/14-queue.js | oksana-svynarova/rs-school-short-track-2021 | 9c429d42953b41227bd2e6d90814a58f0b297e9a | [
"MIT"
] | null | null | null | src/14-queue.js | oksana-svynarova/rs-school-short-track-2021 | 9c429d42953b41227bd2e6d90814a58f0b297e9a | [
"MIT"
] | null | null | null | // const ListNode = require('../extensions/list-node');
/**
* Implement the Queue with a given interface via linked list (use ListNode extension above).
*
* @example
* const queue = new Queue();
*
* queue.enqueue(1); // adds the element to the queue
* queue.enqueue(3); // adds the element to the queue
* queue.dequeue(); // returns the top element from queue and deletes it, returns 1
*
*/
class Queue {
get size() {
const s = this.length;
return s;
}
enqueue(element) {
this.backIndex++;
this.element[this.backIndex] = element;
this.length++;
}
dequeue() {
if (this.isEmpty()) throw (new Error('No elements'));
const value = this.getFront();
this.element[this.frontIndex] = null;
this.frontIndex++;
this.length--;
return value;
}
}
module.exports = Queue;
| 22.378378 | 93 | 0.636473 |
37d06dcfcef0b6958046e76c1fc9035fd55c4706 | 3,935 | js | JavaScript | src/tools.js | stoe/gh-ps-tools | dbcd7b90ebd70e6acb067f0c454fb09a32307237 | [
"MIT"
] | null | null | null | src/tools.js | stoe/gh-ps-tools | dbcd7b90ebd70e6acb067f0c454fb09a32307237 | [
"MIT"
] | null | null | null | src/tools.js | stoe/gh-ps-tools | dbcd7b90ebd70e6acb067f0c454fb09a32307237 | [
"MIT"
] | null | null | null | // Packages
const ghgot = require('gh-got');
const moment = require('moment');
// Mine
const getResponse = query => {
/* eslint import/no-unresolved: [2, { ignore: ['config.json'] }] */
const token = require('../config.json').token || false;
if (!token) {
throw new Error(`token is not defined`);
}
return ghgot('https://api.github.com/graphql', {
json: true,
headers: {authorization: `bearer ${token}`},
body: {query}
});
};
exports.tools = {
status: () => {
return new Promise((resolve, reject) => {
ghgot('https://status.github.com/api/last-message.json')
.then(response => {
let data = response.body;
resolve({
status: `${data.status} 🦄`,
msg: data.body,
date: moment(data.created_on).format('MMMM DD YYYY HH:mm')
});
})
.catch(err => {
reject(err);
});
});
},
radar: () => {
return new Promise((resolve, reject) => {
let query = `query {
repository(owner: "github", name: "services") {
issues(first: 1, labels: "O: radar", states: OPEN) {
edges {
node {
url
}
}
}
}
}`;
getResponse(query)
.then(response => {
let url = response.body.data.repository.issues.edges[0].node.url;
resolve(`${url}`);
})
.catch(err => {
reject(err);
});
});
},
repo: repo => {
return new Promise((resolve, reject) => {
let query = `query {
repository(owner: "github", name: "${repo}") {
url
}
}`;
getResponse(query)
.then(response => {
let url = response.body.data.repository.url;
resolve(`${url}`);
})
.catch(err => {
reject(err);
});
});
},
territory: territory => {
return new Promise((resolve, reject) => {
let query = `query {
repository(owner: "github", name: "services") {
url
issues(states: OPEN, labels: "ST: ${territory}") {
totalCount
}
projects(first: 1, search: "ST: ${territory}") {
nodes {
url
}
}
}
}`;
getResponse(query)
.then(response => {
let repo = response.body.data.repository;
resolve({
url: repo.url ?
`${repo.url}/issues?q=is:open is:issue label:"ST: ${territory}"` :
null,
count: Number.parseInt(repo.issues.totalCount, 10),
project: repo.projects.nodes[0].url
});
})
.catch(err => {
reject(err);
});
});
},
projects: (number = 2) => {
return new Promise((resolve, reject) => {
let query = `query {
repository(owner: "github", name: "services") {
project(number: ${number}) {
... on Project {
columns(first: 3) {
nodes {
... on ProjectColumn {
name
}
cards(first: 100) {
edges {
node {
content {
... on Issue {
title
url
}
... on PullRequest {
title
url
}
}
}
}
}
}
}
}
}
}
}`;
getResponse(query)
.then(response => {
resolve(response.body.data.repository.project.columns.nodes);
})
.catch(err => {
reject(err);
});
});
}
};
| 24.59375 | 80 | 0.40737 |
37d0c74469cd50614e79ba95ce47d9e564bf2952 | 451 | js | JavaScript | 01-create-asteroid/code.js | sdepold/asteroids-workshop | d8754594854eafd7123395ddb9a2d3ad8027c901 | [
"MIT"
] | 7 | 2020-08-06T16:20:13.000Z | 2021-08-17T15:05:52.000Z | 01-create-asteroid/code.js | sdepold/asteroids-workshop | d8754594854eafd7123395ddb9a2d3ad8027c901 | [
"MIT"
] | null | null | null | 01-create-asteroid/code.js | sdepold/asteroids-workshop | d8754594854eafd7123395ddb9a2d3ad8027c901 | [
"MIT"
] | 1 | 2020-08-06T16:20:16.000Z | 2020-08-06T16:20:16.000Z | // Initialize the Kontra.js framework
kontra.init();
// Create a single asteroid sprite and render it
let asteroid = kontra.Sprite({
type: "asteroid",
x: 100,
y: 100,
dx: Math.random() * 4 - 2,
dy: Math.random() * 4 - 2,
radius: 30,
render() {
this.context.strokeStyle = "white";
this.context.beginPath();
this.context.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
this.context.stroke();
},
});
asteroid.render();
| 22.55 | 66 | 0.627494 |
37d3f61f167cc6efb0c421e6e6955d2123dcf282 | 101 | js | JavaScript | results/4_extract-code/code/steam-client/steam-client_16.js | proglang/dts-generate-results | 937a89a919814372cae8ea424d88edd8f7eaf87f | [
"MIT"
] | 2 | 2021-04-21T16:38:38.000Z | 2021-11-17T15:20:30.000Z | results/4_extract-code/code/steam-client/steam-client_16.js | proglang/dts-generate-results | 937a89a919814372cae8ea424d88edd8f7eaf87f | [
"MIT"
] | null | null | null | results/4_extract-code/code/steam-client/steam-client_16.js | proglang/dts-generate-results | 937a89a919814372cae8ea424d88edd8f7eaf87f | [
"MIT"
] | 1 | 2019-10-31T18:45:26.000Z | 2019-10-31T18:45:26.000Z | var Steam = require('steam-client');
var client = new Steam.CMClient(Steam.EConnectionProtocol.TCP);
| 33.666667 | 63 | 0.772277 |
37d4098a4625d45d2687015a923222171f54299a | 72 | js | JavaScript | packages/line-ripple/index.js | iFaxity/vue-mdc-web | 1a7c6d9928a85bdadfb26424394a47a0df3becd8 | [
"MIT"
] | 1 | 2018-06-01T17:07:36.000Z | 2018-06-01T17:07:36.000Z | packages/line-ripple/index.js | iFaxity/vue-mdc-web | 1a7c6d9928a85bdadfb26424394a47a0df3becd8 | [
"MIT"
] | null | null | null | packages/line-ripple/index.js | iFaxity/vue-mdc-web | 1a7c6d9928a85bdadfb26424394a47a0df3becd8 | [
"MIT"
] | null | null | null | import MDCLineRipple from './LineRipple.vue';
export { MDCLineRipple }; | 24 | 45 | 0.763889 |
37d4f769398be3a1358b44cc1268827793edc4dc | 270 | js | JavaScript | plugins/no-inferred-method-name.js | alex-lit/config-eslint | 7816a4e740b0c43f111a047b5fd5e5b3437b485d | [
"MIT"
] | null | null | null | plugins/no-inferred-method-name.js | alex-lit/config-eslint | 7816a4e740b0c43f111a047b5fd5e5b3437b485d | [
"MIT"
] | null | null | null | plugins/no-inferred-method-name.js | alex-lit/config-eslint | 7816a4e740b0c43f111a047b5fd5e5b3437b485d | [
"MIT"
] | 1 | 2021-08-03T07:37:31.000Z | 2021-08-03T07:37:31.000Z | /**
* @see [eslint-no-inferred-method-name](https://github.com/johnstonbl01/eslint-no-inferred-method-name)
*/
module.exports = {
plugins: ['eslint-plugin-no-inferred-method-name'],
rules: {
'no-inferred-method-name/no-inferred-method-name': 'error',
},
};
| 24.545455 | 104 | 0.677778 |
37d5b63dc8d4f5a59fa45f1dba931eaba7be3289 | 485 | js | JavaScript | src/caterpillar/static/tinymce/plugins/catimgmanager/plugin.min.js | ryu22e/gcpug-shonan-cms | 11c368213a6dd07f4c575725a82626c79e96863f | [
"MIT"
] | null | null | null | src/caterpillar/static/tinymce/plugins/catimgmanager/plugin.min.js | ryu22e/gcpug-shonan-cms | 11c368213a6dd07f4c575725a82626c79e96863f | [
"MIT"
] | null | null | null | src/caterpillar/static/tinymce/plugins/catimgmanager/plugin.min.js | ryu22e/gcpug-shonan-cms | 11c368213a6dd07f4c575725a82626c79e96863f | [
"MIT"
] | null | null | null | tinymce.PluginManager.add("catimgmanager",function(a,c){function b(){a.windowManager.open({title:"\u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9",url:c+"/dialog.html",width:350,height:240,buttons:[{text:"\u9589\u3058\u308b",onclick:"close"}]})}a.addButton("catimgmanager",{text:"\u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9",icon:"image",onclick:b});a.addMenuItem("catimgmanager",{text:"\u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9",icon:"image",context:"file",onclick:b})}); | 485 | 485 | 0.758763 |
37d637ddab067a2c7f88cd1e2dcd743b0858139c | 664 | js | JavaScript | src/validator/string/isBase64.js | iamchenxin/flow-dynamic | d8ca5a5793e8732ff04453f90d4e816715877523 | [
"MIT"
] | 2 | 2017-04-17T11:46:51.000Z | 2017-04-17T12:35:33.000Z | src/validator/string/isBase64.js | iamchenxin/flow-dynamic | d8ca5a5793e8732ff04453f90d4e816715877523 | [
"MIT"
] | null | null | null | src/validator/string/isBase64.js | iamchenxin/flow-dynamic | d8ca5a5793e8732ff04453f90d4e816715877523 | [
"MIT"
] | null | null | null | /* @flow
*
*/
import {isString} from './string.js';
import {RunTimeCheckE} from '../../definition/def.js';
const notBase64 = /[^A-Z0-9+\/=]/i;
export default function isBase64(_mix_str:mixed):string {
const str = isString(_mix_str);
const len = str.length;
if (!len || len % 4 !== 0 || notBase64.test(str)) {
throw new RunTimeCheckE(`(${str}) is not Base64`);
}
const firstPaddingChar = str.indexOf('=');
const stat = firstPaddingChar === -1 ||
firstPaddingChar === len - 1 ||
(firstPaddingChar === len - 2 && str[len - 1] === '=');
if (stat) {
return str;
} else {
throw new RunTimeCheckE(`(${str}) is not Base64`);
}
}
| 25.538462 | 59 | 0.59488 |
37d6e9af02db223ae77044eb96b05268a38a6701 | 2,413 | js | JavaScript | public/electron.js | TEAM-OSTRICH/CHRISDIFFER | 0b8c6f5fd64bfad65e1461b9b55ea1eafc950ea8 | [
"MIT"
] | 78 | 2018-11-17T03:54:18.000Z | 2018-11-28T17:10:26.000Z | public/electron.js | TEAM-OSTRICH/CHRISDIFFER | 0b8c6f5fd64bfad65e1461b9b55ea1eafc950ea8 | [
"MIT"
] | 1 | 2018-11-16T18:49:57.000Z | 2018-11-16T18:49:57.000Z | public/electron.js | TEAM-OSTRICH/SYS-DIFFER | 0b8c6f5fd64bfad65e1461b9b55ea1eafc950ea8 | [
"MIT"
] | 5 | 2018-12-07T17:22:37.000Z | 2020-01-06T22:37:06.000Z | const {
electron,
app,
BrowserWindow,
ipcMain,
} = require('electron');
const path = require('path');
const url = require('url');
// const isDev = require('electron-is-dev');
const fs = require('fs');
let mainWindow;
let scriptWindow;
// create main window and initialize options
function createMainWindow() {
mainWindow = new BrowserWindow({
frame: false,
width: 960,
height: 760,
x: 50,
y: 0,
minWidth: 960,
minHeight: 760,
backgroundColor: '#f1f2f4',
});
mainWindow.loadURL(
// isDev ? 'http://localhost:3000' :
`file://${path.join(__dirname, './../dist/index.html')}`,
);
mainWindow.on('closed', () => mainWindow = null);
}
// create script window and set options
exports.createScriptWindow = () => {
if (!scriptWindow) {
const mainWindowPos = mainWindow.getPosition();
scriptWindow = new BrowserWindow({
frame: false,
// titleBarStyle: 'hidden',
width: 400,
height: 600,
minWidth: 400,
minHeight: 600,
// minHeight: 680,
// backgroundColor: '#b5beda',
backgroundColor: '#f1f2f4',
// show: false,
x: mainWindowPos[0] + 960,
y: mainWindowPos[1],
alwaysOnTop: true,
parent: mainWindow, // return to this
});
scriptWindow.loadURL(
// isDev ? 'http://localhost:3000' :
`file://${path.join(__dirname, './../public/script.html')}`,
);
scriptWindow.on('closed', () => scriptWindow = null);
}
};
exports.closeScriptWindow = () => {
if (scriptWindow) {
scriptWindow.close();
scriptWindow = null;
}
};
app.on('ready', createMainWindow);
// app.on('ready', createScriptWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (mainWindow === null) {
createMainWindow();
// createScriptWindow();
}
});
// listening for 'updateScript' from MainContainer -> send 'updateScript' and script-array with all queries to display to scriptWindow
ipcMain.on('updateScript', (event, script) => {
scriptWindow.webContents.send('updateScript', script);
});
// listening for 'addAll' from script.js -> send 'addAll' to DiffDbDisplayContainer component in mainWindow
ipcMain.on('addAll', (event) => {
mainWindow.webContents.send('addAll');
});
ipcMain.on('removeAll', (event) => {
mainWindow.webContents.send('removeAll');
});
| 23.201923 | 134 | 0.623705 |
37d737bc1c03c245d2b0b927e838672b31358d5c | 2,537 | js | JavaScript | src/pages/index.js | zeeshanhanif/gatsby-blog-strapi-netlify | 36851908f8f660a22bf1797550d380caeeb3f28f | [
"RSA-MD"
] | 3 | 2020-10-10T16:24:09.000Z | 2020-12-15T08:59:34.000Z | src/pages/index.js | zeeshanhanif/gatsby-blog-strapi-netlify | 36851908f8f660a22bf1797550d380caeeb3f28f | [
"RSA-MD"
] | null | null | null | src/pages/index.js | zeeshanhanif/gatsby-blog-strapi-netlify | 36851908f8f660a22bf1797550d380caeeb3f28f | [
"RSA-MD"
] | null | null | null | import { graphql, Link, useStaticQuery } from "gatsby";
import React from "react"
import Layout from "../components/layout";
import SEO from "../components/seo";
import Img from 'gatsby-image';
const Home = ()=> {
const data = useStaticQuery(
graphql`
query {
allStrapiBlog(sort: {fields: PublishedDate, order: DESC}) {
edges {
node {
id
Slug
Title
PublishedDate(formatString: "DD MMMM YYYY")
Excerpt
}
}
}
}
`
);
console.log("data = ",data);
return (
<Layout>
<SEO title="Blog Home" />
<div>
<ul className="posts">
{
data.allStrapiBlog.edges.map(edge=>{
return (
<li className="post" key={edge.node.id} >
<h2>
<Link to={`/${edge.node.Slug}`}>
{edge.node.Title}
</Link>
</h2>
<div className="meta">
<span>Posted on {edge.node.PublishedDate}</span>
</div>
{/*
edge.node.FeaturedImage && (
<Img className="featured" fluid={edge.node.FeaturedImage.childImageSharp.fluid}
alt={edge.node.Title} />
)
*/}
<p className="excerpt">
{edge.node.Excerpt}
</p>
<div className="button">
<Link to={`/${edge.node.Slug}`}>Read More</Link>
</div>
</li>
)
})
}
</ul>
</div>
</Layout>
)
}
export default Home; | 37.308824 | 123 | 0.289318 |
37d798b07f88b82de4432f10ce15424f1ce14c7c | 116 | js | JavaScript | public/node_modules/nodeman/docs/imagemagick.meta.js | EveRainbow/new_validation_with_nodejs | 25da372cbcd76d49c6b1380480111907980bdbb5 | [
"MIT"
] | 2 | 2017-05-16T15:04:54.000Z | 2017-05-16T15:07:53.000Z | public/node_modules/nodeman/docs/imagemagick.meta.js | EveRainbow/new_validation_with_nodejs | 25da372cbcd76d49c6b1380480111907980bdbb5 | [
"MIT"
] | 2 | 2018-12-06T17:03:03.000Z | 2018-12-06T18:52:58.000Z | public/node_modules/nodeman/docs/imagemagick.meta.js | EveRainbow/new_validation_with_nodejs | 25da372cbcd76d49c6b1380480111907980bdbb5 | [
"MIT"
] | 2 | 2017-02-01T22:35:20.000Z | 2020-10-31T20:50:38.000Z | exports.name = 'imagemagick';
exports.category = '';
exports.homepage = "https://github.com/rsms/node-imagemagick";
| 29 | 62 | 0.732759 |
37d84fd5df9673b8adc019fa9d535be135c25d36 | 7,316 | js | JavaScript | packages/demo/src/index.js | chachakawooka/LiberalDemocratsReact | b5b6dc1d7954a51cc2f06d00c88fbf6347381f44 | [
"MIT"
] | 1 | 2019-11-06T23:36:18.000Z | 2019-11-06T23:36:18.000Z | packages/demo/src/index.js | chachakawooka/LiberalDemocratsReact | b5b6dc1d7954a51cc2f06d00c88fbf6347381f44 | [
"MIT"
] | 6 | 2020-09-06T22:10:19.000Z | 2022-02-26T16:35:28.000Z | packages/demo/src/index.js | chachakawooka/LiberalDemocratsReact | b5b6dc1d7954a51cc2f06d00c88fbf6347381f44 | [
"MIT"
] | null | null | null | import React, { Component } from 'react'
import styles from '../index.module.scss'
import Image from 'react-image';
import Logo from '@liberaldemocrats/logo'
import Triangles from '@liberaldemocrats/triangles'
import Section from '@liberaldemocrats/section'
import Card from '@liberaldemocrats/card'
const hero = (<Image
src='http://www.bolton-libdems.org.uk/userfiles/media/139.59.166.45/1904161159475cb5c3b343bcfbolton.jpeg'
/>);
class Demo extends Component {
render() {
return (
<div>
<div className={styles.logo} ><Logo strap="Bolton" /></div>
<Triangles background={hero} bottom={<Logo strap="DEMAND BETTER" />} />
<Section title="Demand Better For Britain">
<div className={styles.manifesto}>
<div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13372/attachments/original/1495011869/card_reform.jpg?1495011869'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div>
<div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13370/attachments/original/1495012048/card_world.jpg?1495012048'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fight for a better world"
linktext="International Affairs" />
</div>
<div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div><div className={styles.item}>
<Card
img={
<Image
src='https://d3n8a8pro7vhmx.cloudfront.net/libdems/pages/13367/attachments/original/1495014349/card_families.jpg?1495014349'
/>
}
onClick={function () { alert('clicked') }}
hovertext="Fix Our Broken System"
linktext="CONSTITUTIONAL & POLITICAL REFORM" />
</div>
</div>
</Section>
</div>
)
}
}
export default Demo | 53.40146 | 164 | 0.395981 |
37da70bf4519865eae44bfde1d296460c29f72b5 | 10,799 | js | JavaScript | lib/qiankun/slave/index.js | WangKCarol/umi-plugin-planet | d974e046ddb1726d4a1cc98c8bc5c9d20b867b95 | [
"MIT"
] | null | null | null | lib/qiankun/slave/index.js | WangKCarol/umi-plugin-planet | d974e046ddb1726d4a1cc98c8bc5c9d20b867b95 | [
"MIT"
] | null | null | null | lib/qiankun/slave/index.js | WangKCarol/umi-plugin-planet | d974e046ddb1726d4a1cc98c8bc5c9d20b867b95 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.isSlaveEnable = isSlaveEnable;
function _address() {
const data = _interopRequireDefault(require("address"));
_address = function _address() {
return data;
};
return data;
}
function _assert() {
const data = _interopRequireDefault(require("assert"));
_assert = function _assert() {
return data;
};
return data;
}
function _fs() {
const data = require("fs");
_fs = function _fs() {
return data;
};
return data;
}
function _lodash() {
const data = require("lodash");
_lodash = function _lodash() {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function _path() {
return data;
};
return data;
}
var _constants = require("../constants");
var _addSpecifyPrefixedRoute = require("./addSpecifyPrefixedRoute");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function isSlaveEnable(api) {
var _api$userConfig, _api$userConfig$qiank, _api$userConfig2;
const slaveCfg = (_api$userConfig = api.userConfig) === null || _api$userConfig === void 0 ? void 0 : (_api$userConfig$qiank = _api$userConfig.qiankun) === null || _api$userConfig$qiank === void 0 ? void 0 : _api$userConfig$qiank.slave;
if (slaveCfg) {
return slaveCfg.enable !== false;
} // 兼容早期配置, qiankun 配一个空,相当于开启 slave
if ((0, _lodash().isEqual)((_api$userConfig2 = api.userConfig) === null || _api$userConfig2 === void 0 ? void 0 : _api$userConfig2.qiankun, {})) {
return true;
}
return !!process.env.INITIAL_QIANKUN_SLAVE_OPTIONS;
}
function _default(api) {
api.describe({
enableBy: () => isSlaveEnable(api)
});
api.addRuntimePlugin(() => '@@/plugin-qiankun/slaveRuntimePlugin');
api.register({
key: 'addExtraModels',
fn: () => [{
absPath: '@@/plugin-qiankun/qiankunModel',
namespace: _constants.qiankunStateFromMasterModelNamespace
}]
}); // eslint-disable-next-line import/no-dynamic-require, global-require
api.modifyDefaultConfig(memo => {
var _api$userConfig$qiank2, _api$userConfig$qiank3, _api$userConfig$qiank4;
const initialSlaveOptions = _objectSpread(_objectSpread({
devSourceMap: true
}, JSON.parse(process.env.INITIAL_QIANKUN_SLAVE_OPTIONS || '{}')), (memo.qiankun || {}).slave);
const modifiedDefaultConfig = _objectSpread(_objectSpread({}, memo), {}, {
disableGlobalVariables: true,
// 默认开启 runtimePublicPath,避免出现 dynamic import 场景子应用资源地址出问题
runtimePublicPath: true,
runtimeHistory: {},
qiankun: _objectSpread(_objectSpread({}, memo.qiankun), {}, {
slave: initialSlaveOptions
})
});
const shouldNotModifyDefaultBase = (_api$userConfig$qiank2 = (_api$userConfig$qiank3 = api.userConfig.qiankun) === null || _api$userConfig$qiank3 === void 0 ? void 0 : (_api$userConfig$qiank4 = _api$userConfig$qiank3.slave) === null || _api$userConfig$qiank4 === void 0 ? void 0 : _api$userConfig$qiank4.shouldNotModifyDefaultBase) !== null && _api$userConfig$qiank2 !== void 0 ? _api$userConfig$qiank2 : initialSlaveOptions.shouldNotModifyDefaultBase;
if (!shouldNotModifyDefaultBase) {
modifiedDefaultConfig.base = `/${api.pkg.name}`;
}
return modifiedDefaultConfig;
});
api.modifyConfig(config => {
// mfsu 场景默认给子应用增加 mfName 配置,从而避免冲突
if (config.mfsu && !config.mfsu.mfName) {
var _api$pkg$name;
// 替换掉包名里的特殊字符
config.mfsu.mfName = `mf_${(_api$pkg$name = api.pkg.name) === null || _api$pkg$name === void 0 ? void 0 : _api$pkg$name.replace(/^@/, '').replace(/\W/g, '_')}`;
}
return config;
});
api.modifyPublicPathStr(publicPathStr => {
const runtimePublicPath = api.config.runtimePublicPath;
const _ref = (api.config.qiankun || {}).slave,
shouldNotModifyRuntimePublicPath = _ref.shouldNotModifyRuntimePublicPath;
if (runtimePublicPath === true && !shouldNotModifyRuntimePublicPath) {
return `window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "${api.config.publicPath || '/'}"`;
}
return publicPathStr;
});
api.chainWebpack((config, {
webpack
}) => {
var _webpack$version;
(0, _assert().default)(api.pkg.name, 'You should have name in package.json');
const _ref2 = (api.config.qiankun || {}).slave,
shouldNotAddLibraryChunkName = _ref2.shouldNotAddLibraryChunkName;
config.output.libraryTarget('umd').library(shouldNotAddLibraryChunkName ? api.pkg.name : `${api.pkg.name}-[name]`);
const usingWebpack5 = (_webpack$version = webpack.version) === null || _webpack$version === void 0 ? void 0 : _webpack$version.startsWith('5'); // webpack5 移除了 jsonpFunction 配置,且不再需要配置 jsonpFunction,see https://webpack.js.org/blog/2020-10-10-webpack-5-release/#automatic-unique-naming
if (!usingWebpack5) {
config.output.jsonpFunction(`webpackJsonp_${api.pkg.name}`);
}
return config;
}); // umi bundle 添加 entry 标记
api.modifyHTML($ => {
$('script').each((_, el) => {
var _scriptEl$attr;
const scriptEl = $(el);
const umiEntryJs = /\/?umi(\.\w+)?\.js$/g;
if (umiEntryJs.test((_scriptEl$attr = scriptEl.attr('src')) !== null && _scriptEl$attr !== void 0 ? _scriptEl$attr : '')) {
scriptEl.attr('entry', '');
}
});
return $;
});
api.chainWebpack((memo, {
webpack
}) => {
const port = process.env.PORT; // source-map 跨域设置
if (api.env === 'development' && port) {
const localHostname = process.env.USE_REMOTE_IP ? _address().default.ip() : process.env.HOST || 'localhost';
const protocol = process.env.HTTPS ? 'https' : 'http'; // 变更 webpack-dev-server websocket 默认监听地址
process.env.SOCKET_SERVER = `${protocol}://${localHostname}:${port}/`; // 开启了 devSourceMap 配置,默认为 true
if (api.config.qiankun && api.config.qiankun.slave.devSourceMap) {
// 禁用 devtool,启用 SourceMapDevToolPlugin
memo.devtool(false);
memo.plugin('source-map').use(webpack.SourceMapDevToolPlugin, [{
// @ts-ignore
namespace: api.pkg.name,
append: `\n//# sourceMappingURL=${protocol}://${localHostname}:${port}/[url]`,
filename: '[file].map'
}]);
}
}
return memo;
});
api.addEntryImports(() => {
return {
source: '@@/plugin-qiankun/lifecycles',
specifier: '{ genMount as qiankun_genMount, genBootstrap as qiankun_genBootstrap, genUnmount as qiankun_genUnmount, genUpdate as qiankun_genUpdate }'
};
});
api.addEntryCode(() => `
export const bootstrap = qiankun_genBootstrap(clientRender);
export const mount = qiankun_genMount('${api.config.mountElementId}');
export const unmount = qiankun_genUnmount('${api.config.mountElementId}');
export const update = qiankun_genUpdate();
if (!window.__POWERED_BY_QIANKUN__) {
bootstrap().then(mount);
}
`);
api.onGenerateFiles(() => {
api.writeTmpFile({
path: 'plugin-qiankun/slaveOptions.js',
content: `
let options = ${JSON.stringify((api.config.qiankun || {}).slave || {})};
export const getSlaveOptions = () => options;
export const setSlaveOptions = (newOpts) => options = ({ ...options, ...newOpts });
`
});
api.writeTmpFile({
path: 'plugin-qiankun/qiankunModel.ts',
content: (0, _fs().readFileSync)((0, _path().join)(__dirname, 'qiankunModel.ts.tpl'), 'utf-8')
});
api.writeTmpFile({
path: 'plugin-qiankun/connectMaster.tsx',
content: (0, _fs().readFileSync)((0, _path().join)(__dirname, 'connectMaster.tsx.tpl'), 'utf-8')
});
api.writeTmpFile({
path: 'plugin-qiankun/slaveRuntimePlugin.ts',
content: (0, _fs().readFileSync)((0, _path().join)(__dirname, 'slaveRuntimePlugin.ts.tpl'), 'utf-8')
});
api.writeTmpFile({
path: 'plugin-qiankun/lifecycles.ts',
content: (0, _fs().readFileSync)((0, _path().join)(__dirname, 'lifecycles.ts.tpl'), 'utf-8')
});
});
useLegacyMode(api);
}
function useLegacyMode(api) {
var _api$userConfig3, _api$userConfig3$qian;
const options = (_api$userConfig3 = api.userConfig) === null || _api$userConfig3 === void 0 ? void 0 : (_api$userConfig3$qian = _api$userConfig3.qiankun) === null || _api$userConfig3$qian === void 0 ? void 0 : _api$userConfig3$qian.slave;
const _ref3 = options || {},
_ref3$keepOriginalRou = _ref3.keepOriginalRoutes,
keepOriginalRoutes = _ref3$keepOriginalRou === void 0 ? false : _ref3$keepOriginalRou;
api.onGenerateFiles(() => {
api.writeTmpFile({
path: 'plugin-qiankun/qiankunContext.js',
content: `
import { createContext, useContext } from 'react';
export const Context = createContext(null);
export function useRootExports() {
if (process.env.NODE_ENV === 'development') {
console.error(
'[@umijs/plugin-qiankun] Deprecated: useRootExports 通信方式不再推荐,并将在后续版本中移除,请尽快升级到新的应用通信模式,以获得更好的开发体验。详见 https://umijs.org/plugins/plugin-qiankun#%E7%88%B6%E5%AD%90%E5%BA%94%E7%94%A8%E9%80%9A%E8%AE%AF',
);
}
return useContext(Context);
}`.trim()
});
});
api.addUmiExports(() => [{
specifiers: ['useRootExports'],
source: '../plugin-qiankun/qiankunContext'
}, {
specifiers: ['connectMaster'],
source: '../plugin-qiankun/connectMaster'
}]);
api.modifyRoutes(routes => {
// 开启keepOriginalRoutes配置
if (keepOriginalRoutes === true || (0, _lodash().isString)(keepOriginalRoutes)) {
return (0, _addSpecifyPrefixedRoute.addSpecifyPrefixedRoute)(routes, keepOriginalRoutes, api.pkg.name);
}
return routes;
});
} | 37.237931 | 506 | 0.660709 |
37dc188c0be3d4d7446499b5f25512b752249ac0 | 48 | js | JavaScript | src/Layout/components/index.js | aliziaeijazi/TodoList | 4ee3814b55c362338160682d738ead83a71fa892 | [
"MIT"
] | null | null | null | src/Layout/components/index.js | aliziaeijazi/TodoList | 4ee3814b55c362338160682d738ead83a71fa892 | [
"MIT"
] | null | null | null | src/Layout/components/index.js | aliziaeijazi/TodoList | 4ee3814b55c362338160682d738ead83a71fa892 | [
"MIT"
] | null | null | null | export {Header} from './Header/Header.component' | 48 | 48 | 0.770833 |
37dd3b7471b86f3f7c47eca48cd64248d1324176 | 8,506 | js | JavaScript | target/classes/static/js/darkmode.js | DevilFront/Campnic | 6dd30447414b90e151d20c43eaca1253dfe13ac3 | [
"MIT"
] | null | null | null | target/classes/static/js/darkmode.js | DevilFront/Campnic | 6dd30447414b90e151d20c43eaca1253dfe13ac3 | [
"MIT"
] | null | null | null | target/classes/static/js/darkmode.js | DevilFront/Campnic | 6dd30447414b90e151d20c43eaca1253dfe13ac3 | [
"MIT"
] | null | null | null | $(function() {
var sessionValue=localStorage.getItem('darkmode');
if(sessionValue=="false"||sessionValue==null)
var flag = false;
else if(sessionValue=="true")
flag=true;
var darkBtn = document.querySelector(".dark-mode-btn");
var body = document.querySelector("body");
var logo = $(".logo");
darkBtn.style.backgroundImage = "url('/images/night.png')";
var searchStatus=true;
$(".fa-search").click(function(){
searchStatus= !searchStatus;
if(searchStatus)
$(".search-field").css("transition", "0.7s").css("width","0px");
else
$(".search-field").css("transition", "0.7s").css("width","130px");
});
$(document).ready(function() {
var flag= sessionValue;
if (flag == "false") { // 다크모드
$(".search-field").css("transition", "0.7s").attr("style","color:white;");
$(".search-icon").css("transition", "0.7s").css("color","white");
$(".comment-Line").css("transition", "0.7s").css("border","1px solid lightgrey");
logo.attr("src", "/images/indexlogo-w.png");
$(".header").css("background-color","rgb(47, 47, 47)");
$("body").css("background-color","rgb(15,15,15)").css("color", "rgb(166,170,175)");
darkBtn.style.backgroundImage = "url('https://png.pngtree.com/png-vector/20190115/ourmid/pngtree-vector-stars-and-moon-icon-png-image_317944.jpg')";
$(".sidemenu").css("color", "white");
$(".aside-list").css("background-color","rgb(47, 47, 47)").find("li").css("transition", "0.7s").css("background-color", "rgb(47, 47, 47)").css("color", "white").hover(
function() {$(this).css("background-color","rgb(86,88,96)").css("color","white")},
function() {$(this).css("background-color","rgb(47, 47, 47)").css("color", "white")}).find("i").css("color", "white");
$(".region-list").find("li a").css("transition", "0.7s").css("color","white");
$("a").css("color","white");
$(".title").find("a").css("color","white");
$(".survival-items").css("transition", "0.7s").css("color","white").css("background-color","rgb(41,41,41)");
$(".linear").attr("src","../../images/mark-w.png");
$(".checklist-wrap").css("transition", "0.7s").css("background-color","rgb(150,150,150)").css("color","black");
$(".listcontent").css("transition", "0.7s").css("background-color","rgb(150,150,150)").css("color","black");
$(".item-text").css("transition", "0.7s").css("background-color","white").css("color","black");
} else {// 라이트모드
$(".title").find("a").css("color","black");
$(".search-field").css("transition", "0.7s").attr("style","color:black;");
$(".search-icon").css("transition", "0.7s").css("color","black");
$(".comment-Line").css("transition", "0.7s").css("border","1px solid black");
logo.attr("src", "/images/indexlogo-b.png");
$(".header").css("background-color", "white");
$("body").css("background-color", "white").css("color", "black");
darkBtn.style.backgroundImage = "url('/images/night.png')";
$(".sidemenu").css("color", "black");
$(".aside-list").css("background-color","white").find("li").css("background-color", "white").css("color", "black").hover(
function() {$(this).css("background-color", "rgb(210,210,210)").css("color", "black")},
function() {$(this).css("background-color", "white").css("color","black")}).find("i").css("color", "black");
$(".region-list").find("li a").css("transition", "0.7s").css("color","black");
$("a").css("transition", "0.7s").css("color","black");
$(".survival-items").css("transition", "0.7s").css("color","black").css("background-color","rgb(226,225,225)");
$(".linear").attr("src","../../images/mark-b.png");
$(".checklist-wrap").css("transition", "0.7s").css("background-color","white").css("color","black");
$(".listcontent").css("transition", "0.7s").css("background-color","white").css("color","black");
$(".item-text").css("transition", "0.7s").css("background-color","white").css("color","black");
}
});
darkBtn.onclick = function() {
console.log(flag);
flag = !flag;
if (flag == false) { // 다크모드
localStorage.setItem('darkmode','false');
$(".search-icon").css("transition", "0.7s").css("color","white");
$(".search-field").css("transition", "0.7s").attr("style","color:white;");
$(".search").css("transition", "0.7s").css("color","white");
$(".comment-Line").css("transition", "0.7s").css("border","1px solid lightgrey");
logo.attr("src", "/images/indexlogo-w.png");
$(".header").css("transition", "0.7s").css("background-color","rgb(47, 47, 47)").css("color","rgb(166,170,175)");
$("body").css("transition", "0.7s").css("background-color","rgb(15,15,15)").css("color", "rgb(166,170,175)");
darkBtn.style.backgroundImage = "url('https://png.pngtree.com/png-vector/20190115/ourmid/pngtree-vector-stars-and-moon-icon-png-image_317944.jpg')";
$(".sidemenu").css("color", "white");
$(".aside-list").css("transition", "0.7s").css("background-color","rgb(47, 47, 47)").find("li").css("transition", "0.7s").css("background-color", "rgb(47, 47, 47)").css("color", "white").hover(
function() {$(this).css("background-color","rgb(86,88,96)").css("color","white")},
function() {$(this).css("background-color","rgb(47, 47, 47)").css("color", "white")}).find("i").css("color", "white");
$(".region-list").find("li a").css("transition", "0.7s").css("color","white");
$("a").css("color","white");
$(".survival-items").css("transition", "0.7s").css("color","white").css("background-color","rgb(41,41,41)");
$(".title").find("a").css("color","white");
$(".linear").attr("src","../../images/mark-w.png");
$(".checklist-wrap").css("transition", "0.7s").css("background-color","rgb(150,150,150)").css("color","black");
$(".listcontent").css("transition", "0.7s").css("background-color","rgb(150,150,150)").css("color","black");
$(".item-text").css("transition", "0.7s").css("background-color","white").css("color","black");
} else {// 라이트모드
localStorage.setItem('darkmode','true');
$(".search-field").css("transition", "0.7s").attr("style","color:black;");
$(".search-icon").css("transition", "0.7s").css("color","black");
$(".search").css("transition", "0.7s").css("color","black");
$(".comment-Line").css("transition", "0.7s").css("border","1px solid black");
logo.attr("src", "/images/indexlogo-b.png");
$(".header").css("transition", "0.7s").css("background-color", "white").css("color","black");
$("body").css("transition", "0.7s").css("background-color", "white").css("color", "black");
darkBtn.style.backgroundImage = "url('/images/night.png')";
$(".sidemenu").css("color", "black");
$(".aside-list").css("transition", "0.7s").css("background-color","white").find("li").css("transition", "0.7s").css("background-color", "white").css("color", "black").hover(
function() {$(this).css("background-color", "rgb(210,210,210)").css("color", "black")},
function() {$(this).css("background-color", "white").css("color","black")}).find("i").css("color", "black");
$(".region-list").find("li a").css("transition", "0.7s").css("color","black");
$("a").css("transition", "0.7s").css("color","black");
$(".survival-items").css("transition", "0.7s").css("color","black").css("background-color","rgb(226,225,225)");
$(".title").find("a").css("color","black");
$(".linear").attr("src","../../images/mark-b.png");
$(".checklist-wrap").css("transition", "0.7s").css("background-color","white").css("color","black");
$(".listcontent").css("transition", "0.7s").css("background-color","white").css("color","black");
$(".item-text").css("transition", "0.7s").css("background-color","white").css("color","black");
}
};
// ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
}); | 69.721311 | 203 | 0.539384 |
37df045e86ffce936083eca16745a0eb1dda7db5 | 306 | js | JavaScript | src/util/audio.js | bjoluc/jspsych-toj-experiments | f783d19a92cfe3233fdac4c477d93e4bbf04a5be | [
"MIT"
] | 3 | 2020-02-20T21:45:35.000Z | 2020-03-30T08:02:10.000Z | src/util/audio.js | PsyLab-UPB/jspsych-toj-experiments | eaa03d75bb0bc84cd4378d5589c5a73e12df17da | [
"MIT"
] | 6 | 2020-09-17T17:06:28.000Z | 2021-05-12T07:45:48.000Z | src/util/audio.js | PsyLab-UPB/jspsych-toj-experiments | eaa03d75bb0bc84cd4378d5589c5a73e12df17da | [
"MIT"
] | 1 | 2022-03-29T15:49:51.000Z | 2022-03-29T15:49:51.000Z | import { Howl } from "howler";
/**
* Plays a sound file from a provided URL
*
* @param {string} url The URL to load the sound file from
*/
export function playAudio(url) {
return new Promise((resolve) => {
new Howl({
src: [url],
autoplay: true,
onend: resolve,
});
});
}
| 18 | 58 | 0.584967 |
37e12c2466346aa8f906ee7108c211d2c2256bd0 | 73 | js | JavaScript | node_modules/unicode-12.1.0/Binary_Property/Prepended_Concatenation_Mark/code-points.js | ShinKano/ssi-codecamp | 50806c4beadfec61cbea1ea7a27ee8deaa518691 | [
"MIT"
] | null | null | null | node_modules/unicode-12.1.0/Binary_Property/Prepended_Concatenation_Mark/code-points.js | ShinKano/ssi-codecamp | 50806c4beadfec61cbea1ea7a27ee8deaa518691 | [
"MIT"
] | null | null | null | node_modules/unicode-12.1.0/Binary_Property/Prepended_Concatenation_Mark/code-points.js | ShinKano/ssi-codecamp | 50806c4beadfec61cbea1ea7a27ee8deaa518691 | [
"MIT"
] | null | null | null | module.exports=[1536,1537,1538,1539,1540,1541,1757,1807,2274,69821,69837] | 73 | 73 | 0.808219 |
37e1517979cdca3e180aca9d84f552b54e0f20a0 | 1,836 | js | JavaScript | tools/build-lin.js | bclicn/shrink-shrimp | b2d0834ce2c5b87bdaf641c2ecd6acddf0b279c9 | [
"MIT"
] | 8 | 2019-03-27T10:28:34.000Z | 2021-01-21T19:39:28.000Z | tools/build-lin.js | sudo-bcli/shrink-shrimp | b2d0834ce2c5b87bdaf641c2ecd6acddf0b279c9 | [
"MIT"
] | null | null | null | tools/build-lin.js | sudo-bcli/shrink-shrimp | b2d0834ce2c5b87bdaf641c2ecd6acddf0b279c9 | [
"MIT"
] | 1 | 2021-04-29T23:22:44.000Z | 2021-04-29T23:22:44.000Z | /**
* Linux Builder
* @author bcli
* @description builder for Linux x64, tested on Ubuntu 16.04 x64
* @see https://github.com/electron-userland/electron-packager/blob/master/usage.txt
*/
const builder = require('./builder');
// cli options
const opt = {
name: "shrink_shrimp", // name of executable
version: process.env.npm_package_version,// use version defined in package.json
platform: "linux", // target platform
arch: "x64", // target arch
icon: "assets/icon/shrimp_lin.png", // app icon
copyright: "MIT License", // copyright
remove: [ // remove some unnecessary files which will only add to release size
'locales',
'swiftshader',
'chrome_100_percent.pak',
'chrome_200_percent.pak',
'libVkICD_mock_icd.so',
'libGLESv2.so',
'libVkICD_mock_icd.so',
'LICENSES.chromium.html',
'snapshot_blob.bin'
]
};
// electron packager command
const command = `npx electron-packager . ${opt.name} --platform=${opt.platform} --arch=${opt.arch} --app-version=${opt.version} --build-version=${opt.version} --icon=${opt.icon} --overwrite --asar --no-deref-symlinks --prune=true --out=./release-builds/${opt.version}/`;
async function build(){
try{
await builder.prebuild(opt);
await builder.build(command);
await builder.postbuild(opt);
console.log('BUILD COMPLETE');
process.exit(0);
}catch(err){
console.error(err);
process.exit(1);
}
}
build();
| 37.469388 | 270 | 0.527233 |
37e1e4fbb63b29e28b8f14873d2f7473f1d59ddc | 2,353 | js | JavaScript | dist/controllers/travelController.js | ali-sharafi/TicketWatcher | 4f2d7ec9fb849e25398310271bccb8887e1992d0 | [
"MIT"
] | null | null | null | dist/controllers/travelController.js | ali-sharafi/TicketWatcher | 4f2d7ec9fb849e25398310271bccb8887e1992d0 | [
"MIT"
] | null | null | null | dist/controllers/travelController.js | ali-sharafi/TicketWatcher | 4f2d7ec9fb849e25398310271bccb8887e1992d0 | [
"MIT"
] | null | null | null | "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TravelController = void 0;
const travel_1 = __importDefault(require("../models/travel"));
const alibaba_1 = require("../services/alibaba");
const flightio_1 = require("../services/flightio");
const ghasedak_1 = require("../services/ghasedak");
const logger_1 = __importDefault(require("../utils/logger"));
class TravelController {
constructor() {
this.services = [new alibaba_1.Alibaba(), new flightio_1.Flightio(), new ghasedak_1.Ghasedak()];
}
read() {
return __awaiter(this, void 0, void 0, function* () {
const travels = yield travel_1.default.findAll({
where: {
is_completed: false
}
});
if (travels.length == 0) {
(0, logger_1.default)('There is not any active travel...');
return;
}
for (let i = 0; i < this.services.length; i++) {
const service = this.services[i];
service.handle(travels);
}
});
}
static add(req, res) {
var _a;
travel_1.default.create({
type: req.body.type,
origin: req.body.origin,
destination: req.body.destination,
date_at: req.body.date_at,
max_price: (_a = req.body.max_price) !== null && _a !== void 0 ? _a : null
});
res.send('success');
}
}
exports.TravelController = TravelController;
| 42.781818 | 118 | 0.582235 |
37e2728606c3f58feec8c11d83d0d564c7b19553 | 1,400 | js | JavaScript | app/scripts/popup.js | dokudami-honey/mirrativ-bouyomichan-websocket | a2030f4039c9b6cb4f38ba59c13ace77bcb1ec9c | [
"MIT"
] | null | null | null | app/scripts/popup.js | dokudami-honey/mirrativ-bouyomichan-websocket | a2030f4039c9b6cb4f38ba59c13ace77bcb1ec9c | [
"MIT"
] | null | null | null | app/scripts/popup.js | dokudami-honey/mirrativ-bouyomichan-websocket | a2030f4039c9b6cb4f38ba59c13ace77bcb1ec9c | [
"MIT"
] | null | null | null | import { u } from './libs/umbrella.min.js';
import uu from './modules/umbrella-utils';
import translate from './modules/i18n-translate';
import logger from './modules/log';
const log = process.env.NODE_ENV === 'development' ? logger.debug : () => { };
(function () {
console.log('hello popup.');
const $viewLoading = u('#loading');
const $viewEnabled = u('#enabled');
const $viewDisabled = u('#disabled');
const $disableButton = u('#disable-button');
const $enableButton = u('#enable-button');
const $optionPageButton = u('.option-page');
// 初期表示/設定反映
const reloadSettings = () => {
uu.show($viewLoading);
uu.hide($viewEnabled);
uu.hide($viewDisabled);
chrome.storage.local.get({ enabled: false }, (items) => {
log('got items:', items);
if (items.enabled) {
uu.hide($viewLoading);
uu.show($viewEnabled);
} else {
uu.hide($viewLoading);
uu.show($viewDisabled);
}
});
};
// 有効
$enableButton.on('click', () => {
chrome.storage.local.set({ enabled: true }, () => {
reloadSettings();
});
});
// 無効
$disableButton.on('click', () => {
chrome.storage.local.set({ enabled: false }, () => {
reloadSettings();
});
});
// 詳細設定ボタン
$optionPageButton.on('click', () => {
chrome.runtime.openOptionsPage();
});
// 初期表示
reloadSettings();
// i18n
translate();
})(); | 28 | 78 | 0.581429 |
37e2ad5881adc60681e5a7ad0a50c5898312b1e1 | 3,308 | js | JavaScript | alljoyn/alljoyn_js/test/GameTest.js | WigWagCo/alljoyn | 1b148edd934882ca32fd319af86a5a927f9d35a7 | [
"0BSD"
] | 37 | 2015-01-18T21:27:23.000Z | 2018-01-12T00:33:43.000Z | alljoyn/alljoyn_js/test/GameTest.js | WigWagCo/alljoyn | 1b148edd934882ca32fd319af86a5a927f9d35a7 | [
"0BSD"
] | 14 | 2015-02-24T11:44:01.000Z | 2020-07-20T18:48:44.000Z | alljoyn/alljoyn_js/test/GameTest.js | WigWagCo/alljoyn | 1b148edd934882ca32fd319af86a5a927f9d35a7 | [
"0BSD"
] | 29 | 2015-01-23T16:40:52.000Z | 2019-10-21T12:22:30.000Z | /*
* Copyright (c) 2011, 2013, AllSeen Alliance. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
AsyncTestCase("GameTest", {
_setUp: ondeviceready(function(callback) {
bus = new org.alljoyn.bus.BusAttachment();
bus.create(false, callback);
}),
tearDown: function() {
bus.destroy();
},
testGame: function(queue) {
queue.call(function(callbacks) {
var connect = function(err) {
assertFalsy(err);
bus.connect(callbacks.add(createInterface));
};
var createInterface = function(err) {
assertFalsy(err);
bus.createInterface({
name: "org.alljoyn.bus.PlayerState",
signal: [
{ name: "PlayerPosition", signature: "uuu", argNames: "x,y,rotation" }
]
}, callbacks.add(registerBusObject));
};
var player = {
"org.alljoyn.bus.PlayerState": {}
};
var registerBusObject = function(err) {
assertFalsy(err);
bus.registerBusObject("/game/player", player, false, callbacks.add(registerSignalHandler));
};
var registerSignalHandler = function(err) {
assertFalsy(err);
bus.registerSignalHandler(callbacks.add(onPlayerPosition), "org.alljoyn.bus.PlayerState.PlayerPosition", callbacks.add(getDbus));
};
var onPlayerPosition = function(context, x, y, rotation) {
assertEquals(100, x);
assertEquals(200, y);
assertEquals(100, rotation);
};
var getDbus = function(err) {
assertFalsy(err);
bus.getProxyBusObject("org.freedesktop.DBus/org/freedesktop/DBus", callbacks.add(requestName));
};
var requestName = function(err, dbus) {
assertFalsy(err);
dbus.methodCall("org.freedesktop.DBus", "RequestName", "org.alljoyn.bus.game", 0, callbacks.add(onRequestName));
};
var onRequestName = function(err, context, result) {
assertFalsy(err);
assertEquals(1, result);
player.signal("org.alljoyn.bus.PlayerState", "PlayerPosition", 100, 200, 100, callbacks.add(done));
};
var done = function(err) {
assertFalsy(err);
};
this._setUp(callbacks.add(connect));
});
}
});
| 43.526316 | 145 | 0.576179 |
37e42351196746ba7984bc794d2c8621a969e531 | 2,329 | js | JavaScript | src/lib/components/nav/index.stories.js | zbisj/imbabala | c9e1957119c4576c24c4cb6dcff4857830155462 | [
"MIT"
] | null | null | null | src/lib/components/nav/index.stories.js | zbisj/imbabala | c9e1957119c4576c24c4cb6dcff4857830155462 | [
"MIT"
] | null | null | null | src/lib/components/nav/index.stories.js | zbisj/imbabala | c9e1957119c4576c24c4cb6dcff4857830155462 | [
"MIT"
] | null | null | null | import React from "react";
import Nav from ".";
export default {
title: "Navigation/Nav",
component: Nav,
argTypes: {
tabs: { controls: "boolean" },
pills: { controls: "boolean" },
color: { controls: "text" },
items: { controls: "array" },
vertical: { controls: "boolean" },
background: { controls: "text" },
alignItems: {
options: ["end", "start", "center", "around", "evenly", "between"],
controls: "select",
},
},
};
const Template = (args) => <Nav {...args} />;
export const Default = Template.bind({});
Default.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
};
export const Info = Template.bind({});
Info.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
color: "info",
background: "info",
};
export const Danger = Template.bind({});
Danger.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
color: "danger",
background: "danger",
};
export const Primary = Template.bind({});
Primary.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
color: "primary",
background: "primary",
};
export const Success = Template.bind({});
Success.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
color: "success",
background: "success",
};
export const Warning = Template.bind({});
Warning.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
color: "warning",
background: "warning",
};
export const Secondary = Template.bind({});
Secondary.args = {
items: [
{ label: "Active" },
{ label: "Link" },
{ label: "Link" },
{ label: "Disabled", link: "https://github.com", disabled: true },
],
color: "secondary",
background: "secondary",
};
| 22.394231 | 73 | 0.55088 |
37e673885df28b66fdc97cf81311eddbffe156b7 | 942 | js | JavaScript | app/data/friends.js | rsharar/FriendFinder | 85657f28255ebbc0ee3abf643789e6e3c4e51558 | [
"MIT"
] | null | null | null | app/data/friends.js | rsharar/FriendFinder | 85657f28255ebbc0ee3abf643789e6e3c4e51558 | [
"MIT"
] | null | null | null | app/data/friends.js | rsharar/FriendFinder | 85657f28255ebbc0ee3abf643789e6e3c4e51558 | [
"MIT"
] | null | null | null | // friends data array
var friends = [
{
name: "Rudy",
photo: "https://yt3.ggpht.com/a-/ACSszfGctGmgKQbGg4vvImfo-5xaOWTAA4Tc21T1nw=s900-mo-c-c0xffffffff-rj-k-no",
scores: [1,1,1,2,2,2,2,1,1,1]
},
{
name: "Gary Payton",
photo: "https://www.gannett-cdn.com/-mm-/8177e1eeb06a934d4135ff6c395a147b5d96b563/c=0-261-1148-1124/local/-/media/USATODAY/USATODAY/2013/04/05/xxx-nba-playoffs_-lakers_sonics.jpg?width=534&height=401&fit=crop",
scores: [3,3,3,3,2,4,3,2,1,2]
},
{
name: "Lisa Simpson",
photo: "https://vignette.wikia.nocookie.net/simpsons/images/5/57/Lisa_Simpson2.png/revision/latest?cb=20180319000458",
scores: [5,4,4,3,5,5,4,5,5,5]
},
{
name: "Barack Obama",
photo: "https://upload.wikimedia.org/wikipedia/commons/8/8d/President_Barack_Obama.jpg",
scores: [4,2,3,1,3,2,4,1,1,5]
}
]
module.exports = friends;
| 33.642857 | 218 | 0.623142 |
37e8382fb6a1c6d4be3a9e4be0b2be15ab741e4e | 280 | js | JavaScript | src/router.js | jesprider/vue-churnzero | 2ff16fc2607ead81a77e31a42b20be329e90124c | [
"MIT"
] | 4 | 2019-05-15T16:02:20.000Z | 2020-02-18T01:46:50.000Z | src/router.js | jesprider/vue-churnzero | 2ff16fc2607ead81a77e31a42b20be329e90124c | [
"MIT"
] | null | null | null | src/router.js | jesprider/vue-churnzero | 2ff16fc2607ead81a77e31a42b20be329e90124c | [
"MIT"
] | 1 | 2020-06-30T22:08:31.000Z | 2020-06-30T22:08:31.000Z | import trackEvent from './lib/event';
export default function trackRoutes(router, routerEventName) {
router.beforeEach((to, from, next) => {
if (from.path !== to.path) {
trackEvent(routerEventName, to.name || to.path);
}
next();
});
}
| 25.454545 | 62 | 0.585714 |
37e86c8749fbe23328c12e1aae6a1124ca3519b7 | 3,641 | js | JavaScript | Files/script.js | ankitkec18/Js-Projects | 654ed51b1a9e6440225396d6ba8b5819621d0610 | [
"MIT"
] | 1 | 2022-01-01T13:36:22.000Z | 2022-01-01T13:36:22.000Z | Files/script.js | ankitkec18/Js-Projects | 654ed51b1a9e6440225396d6ba8b5819621d0610 | [
"MIT"
] | null | null | null | Files/script.js | ankitkec18/Js-Projects | 654ed51b1a9e6440225396d6ba8b5819621d0610 | [
"MIT"
] | null | null | null | const themSwitcher = document.querySelector('#themeSwitcher');
navigator.geolocation.getCurrentPosition((position) => {
let sunset = new Date().sunset(position.coords.latitude, position.coords.longitude);
let sunrise = new Date().sunrise(position.coords.latitude, position.coords.longitude);
if (isDay(sunset, sunrise)) {
setTheme('theme-light');
} else {
setTheme('theme-dark');
}
function isDay(sunset, sunrise) {
const nowHours = new Date().getHours();
return nowHours >= sunrise.getHours() && nowHours < sunset.getHours();
}
});
const defaultTheme = localStorage.getItem('theme') || 'theme-light';
setTheme(defaultTheme);
themSwitcher.addEventListener('change', (e) => {
setTheme(e.target.value);
});
function setTheme(theme) {
theme = theme || 'theme-light';
// theme-light, theme-dark
document.documentElement.className = theme;
localStorage.setItem('theme', theme);
themSwitcher.value = theme;
}
$(document).ready(function(){
$('#menu').click(function(){
$(this).toggleClass('fa-times');
$('.navbar').toggleClass('nav-toggle');
});
$(window).on('scroll load',function(){
$('#menu').removeClass('fa-times');
$('.navbar').removeClass('nav-toggle');
if(window.scrollY>60){
document.querySelector('#scroll-top').classList.add('active');
}else{
document.querySelector('#scroll-top').classList.remove('active');
}
// scroll spy
$('section').each(function(){
let height = $(this).height();
let offset = $(this).offset().top - 200;
let top = $(window).scrollTop();
let id = $(this).attr('id');
if(top>offset && top<offset+height){
$('.navbar ul li a').removeClass('active');
$('.navbar').find(`[href="#${id}"]`).addClass('active');
}
});
});
// smooth scrolling
$('a[href*="#"]').on('click',function(e){
e.preventDefault();
$('html, body').animate({
scrollTop : $($(this).attr('href')).offset().top,
},500, 'linear')
})
});
// work in progressssss....
// text animation
var _CONTENT = [
"Build a JavaScript Calculator.",
"Build a JavaScript Todo List.",
"Build a JavaScript Age Calculator.",
"Build a JavaScript Clock.",
"Build a JavaScript Issue Tracker.",
"Build a Password Generator.",
"Build a JavaScript Weather API.",
"So Let's Get Started!"
];
var _PART = 0;
var _PART_INDEX = 0;
var _INTERVAL_VAL;
var _ELEMENT = document.querySelector("#text");
var _CURSOR = document.querySelector("#cursor");
// typing effect
function Type() {
var text = _CONTENT[_PART].substring(0, _PART_INDEX + 1);
_ELEMENT.innerHTML = text;
_PART_INDEX++;
if(text === _CONTENT[_PART]) {
// hide the cursor
_CURSOR.style.display = 'none';
clearInterval(_INTERVAL_VAL);
setTimeout(function() {
_INTERVAL_VAL = setInterval(Delete, 50);
}, 1000);
}
}
// deleting effect
function Delete() {
var text = _CONTENT[_PART].substring(0, _PART_INDEX - 1);
_ELEMENT.innerHTML = text;
_PART_INDEX--;
if(text === '') {
clearInterval(_INTERVAL_VAL);
if(_PART == (_CONTENT.length - 1))
_PART = 0;
else
_PART++;
_PART_INDEX = 0;
setTimeout(function() {
_CURSOR.style.display = 'inline-block';
_INTERVAL_VAL = setInterval(Type, 100);
}, 200);
}
}
_INTERVAL_VAL = setInterval(Type, 100); | 27.171642 | 91 | 0.583631 |
37e87e79925a8d099b15eee8cded01887d89da8f | 495 | js | JavaScript | array/14_Imperativo_Declarativo.js | MateusMacial/Udemy-WebModerno | 3fa70f909c2ae9fb522ed073b940bf04fcd47e4f | [
"MIT"
] | null | null | null | array/14_Imperativo_Declarativo.js | MateusMacial/Udemy-WebModerno | 3fa70f909c2ae9fb522ed073b940bf04fcd47e4f | [
"MIT"
] | null | null | null | array/14_Imperativo_Declarativo.js | MateusMacial/Udemy-WebModerno | 3fa70f909c2ae9fb522ed073b940bf04fcd47e4f | [
"MIT"
] | null | null | null | const alunos = [
{ nome: 'João', nota: 7.9 },
{ nome: 'Maria', nota: 9.2 }
]
// Imperativo
let total1 = 0;
for (let i = 0; i < alunos.length; i++) {
total1 += alunos[i].nota;
}
console.log(total1 / alunos.length);
// Declarativo
/*const getNota = aluno => aluno.nota;
const soma = (total, atual) => total + atual;
const total2 = alunos.map(getNota).reduce(soma);
console.log(total2 / alunos.length);*/
console.log(alunos.map(a => a.nota).reduce((a, b) => a + b) / alunos.length); | 24.75 | 77 | 0.616162 |
37e8f7dfda075bb37d91eccb4197e6c2a80df96c | 1,019 | js | JavaScript | bower_components/jscover/src/test-integration/resources/data/javascript.expected/javascript-unaryop.js | v0lkan/o2.js | d835204184570bcd8f2fe3713d3dc8ecf2464c3a | [
"MIT"
] | 16 | 2015-05-25T06:43:23.000Z | 2021-06-03T18:47:24.000Z | bower_components/jscover/src/test-integration/resources/data/javascript.expected/javascript-unaryop.js | v0lkan/o2.js | d835204184570bcd8f2fe3713d3dc8ecf2464c3a | [
"MIT"
] | 1 | 2016-12-06T04:12:10.000Z | 2016-12-06T04:12:10.000Z | bower_components/jscover/src/test-integration/resources/data/javascript.expected/javascript-unaryop.js | v0lkan/o2.js | d835204184570bcd8f2fe3713d3dc8ecf2464c3a | [
"MIT"
] | 5 | 2015-05-07T19:04:12.000Z | 2016-12-05T23:25:20.000Z | if (! _$jscoverage['javascript-unaryop.js']) {
_$jscoverage['javascript-unaryop.js'] = {};
_$jscoverage['javascript-unaryop.js'].lineData = [];
_$jscoverage['javascript-unaryop.js'].lineData[1] = 0;
_$jscoverage['javascript-unaryop.js'].lineData[2] = 0;
_$jscoverage['javascript-unaryop.js'].lineData[3] = 0;
_$jscoverage['javascript-unaryop.js'].lineData[4] = 0;
_$jscoverage['javascript-unaryop.js'].lineData[5] = 0;
_$jscoverage['javascript-unaryop.js'].lineData[6] = 0;
_$jscoverage['javascript-unaryop.js'].lineData[7] = 0;
}
_$jscoverage['javascript-unaryop.js'].lineData[1]++;
x = -x;
_$jscoverage['javascript-unaryop.js'].lineData[2]++;
x = +x;
_$jscoverage['javascript-unaryop.js'].lineData[3]++;
x = !x;
_$jscoverage['javascript-unaryop.js'].lineData[4]++;
x = ~x;
_$jscoverage['javascript-unaryop.js'].lineData[5]++;
x = typeof x;
_$jscoverage['javascript-unaryop.js'].lineData[6]++;
x = typeof 123;
_$jscoverage['javascript-unaryop.js'].lineData[7]++;
x = void x;
| 39.192308 | 57 | 0.672228 |
37e95cb743d7514c9bdb1e235e5dade2efc556ea | 2,263 | js | JavaScript | poker-utils.js | mduleone/nodePoker | 206eb84bd713333a0780010b1024f8399c9e74d7 | [
"MIT"
] | 11 | 2016-01-21T13:40:00.000Z | 2018-11-11T22:06:39.000Z | poker-utils.js | mduleone/nodePoker | 206eb84bd713333a0780010b1024f8399c9e74d7 | [
"MIT"
] | null | null | null | poker-utils.js | mduleone/nodePoker | 206eb84bd713333a0780010b1024f8399c9e74d7 | [
"MIT"
] | 3 | 2018-06-26T23:12:26.000Z | 2022-02-22T15:26:44.000Z | "use strict";
const shuffle = require('./shuffle');
const cards = [
'As', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', 'Ts', 'Js', 'Qs', 'Ks',
'Ad', '2d', '3d', '4d', '5d', '6d', '7d', '8d', '9d', 'Td', 'Jd', 'Qd', 'Kd',
'Ac', '2c', '3c', '4c', '5c', '6c', '7c', '8c', '9c', 'Tc', 'Jc', 'Qc', 'Kc',
'Ah', '2h', '3h', '4h', '5h', '6h', '7h', '8h', '9h', 'Th', 'Jh', 'Qh', 'Kh',
];
function newDeck() {
return shuffle(cards.slice());
}
function drawCards(numCards, deck) {
const draw = [];
for (let i = 0; i < numCards; i++) {
draw.push(deck.shift());
}
return {
deck: deck,
draw: draw,
};
}
function existInHand(card, hand) {
if (hand.indexOf(card) > -1) {
return true;
}
return false;
}
function convertCardToEmoji(card) {
let rank = card.slice(0, 1);
let suit = card.slice(1, 2);
if (rank === 'T') {
rank = '10';
}
if (suit === 's') {
suit = '♠️';
} else if (suit === 'd') {
suit = '♦️';
} else if (suit === 'c') {
suit = '♣️';
} else if (suit === 'h') {
suit = '♥️';
}
return `${rank}${suit}`;
}
function convertHandToEmoji(hand) {
return hand.map(convertCardToEmoji).join('');
}
function convertCardToSpeech(card) {
let rank = card.slice(0, 1);
let suit = card.slice(1, 2);
if (rank === 'A') {
rank = 'Ace';
}
if (rank === 'K') {
rank = 'King';
}
if (rank === 'Q') {
rank = 'Queen';
}
if (rank === 'J') {
rank = 'Jack';
}
if (rank === 'T') {
rank = '10';
}
if (suit === 's') {
suit = 'spades'
} else if (suit === 'd') {
suit = 'diamonds'
} else if (suit === 'c') {
suit = 'clubs'
} else if (suit === 'h') {
suit = 'hearts'
}
return `${rank} of ${suit}`;
}
function convertHandToSpeech(hand) {
return hand.map(convertCardtoSpeech).join(', ');
}
module.exports = {
newDeck: newDeck,
drawCards: drawCards,
existInHand: existInHand,
convertCardToEmoji: convertCardToEmoji,
convertHandToEmoji: convertHandToEmoji,
convertCardToSpeech: convertCardToSpeech,
convertHandToSpeech: convertHandToSpeech,
};
| 21.349057 | 81 | 0.477684 |
37e9af76d7b1f129671da00e6cd39f6f09f5c2f8 | 9,263 | js | JavaScript | utils/utils.js | FKrauss/rudder-sdk-js | 6f8fc520e2a44b4b41f128c6f2303bf23555cdaf | [
"Apache-2.0"
] | null | null | null | utils/utils.js | FKrauss/rudder-sdk-js | 6f8fc520e2a44b4b41f128c6f2303bf23555cdaf | [
"Apache-2.0"
] | null | null | null | utils/utils.js | FKrauss/rudder-sdk-js | 6f8fc520e2a44b4b41f128c6f2303bf23555cdaf | [
"Apache-2.0"
] | null | null | null | //import * as XMLHttpRequestNode from "Xmlhttprequest";
import logger from "./logUtil";
import {commonNames} from "../integrations/integration_cname"
import {clientToServerNames} from "../integrations/client_server_name"
let XMLHttpRequestNode;
if (!process.browser) {
XMLHttpRequestNode = require("Xmlhttprequest");
}
let btoaNode;
if (!process.browser) {
btoaNode = require("btoa");
}
/**
*
* Utility method for excluding null and empty values in JSON
* @param {*} key
* @param {*} value
* @returns
*/
function replacer(key, value) {
if (value === null || value === undefined) {
return undefined;
} else {
return value;
}
}
/**
*
* Utility function for UUID genration
* @returns
*/
function generateUUID() {
// Public Domain/MIT
let d = new Date().getTime();
if (
typeof performance !== "undefined" &&
typeof performance.now === "function"
) {
d += performance.now(); //use high-precision timer if available
}
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
let r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
});
}
/**
*
* Utility function to get current time (formatted) for including in sent_at field
* @returns
*/
function getCurrentTimeFormatted() {
let curDateTime = new Date().toISOString();
// Keeping same as iso string
/* let curDate = curDateTime.split("T")[0];
let curTimeExceptMillis = curDateTime
.split("T")[1]
.split("Z")[0]
.split(".")[0];
let curTimeMillis = curDateTime.split("Z")[0].split(".")[1];
return curDate + " " + curTimeExceptMillis + "+" + curTimeMillis; */
return curDateTime;
}
/**
*
* Utility function to retrieve configuration JSON from server
* @param {*} url
* @param {*} wrappers
* @param {*} isLoaded
* @param {*} callback
*/
function getJSON(url, wrappers, isLoaded, callback) {
//server-side integration, XHR is node module
if (process.browser) {
var xhr = new XMLHttpRequest();
} else {
var xhr = new XMLHttpRequestNode.XMLHttpRequest();
}
xhr.open("GET", url, false);
xhr.onload = function() {
let status = xhr.status;
if (status == 200) {
logger.debug("status 200");
callback(null, xhr.responseText, wrappers, isLoaded);
} else {
callback(status);
}
};
xhr.send();
}
/**
*
* Utility function to retrieve configuration JSON from server
* @param {*} context
* @param {*} url
* @param {*} callback
*/
function getJSONTrimmed(context, url, writeKey, callback) {
//server-side integration, XHR is node module
let cb_ = callback.bind(context);
if (process.browser) {
var xhr = new XMLHttpRequest();
} else {
var xhr = new XMLHttpRequestNode.XMLHttpRequest();
}
xhr.open("GET", url, true);
if (process.browser) {
xhr.setRequestHeader("Authorization", "Basic " + btoa(writeKey + ":"));
} else {
xhr.setRequestHeader("Authorization", "Basic " + btoaNode(writeKey + ":"));
}
xhr.onload = function() {
let status = xhr.status;
if (status == 200) {
logger.debug("status 200 " + "calling callback");
cb_(200, xhr.responseText);
} else {
handleError(
new Error(
"request failed with status: " + xhr.status + " for url: " + url
)
);
cb_(status);
}
};
xhr.send();
}
function handleError(error, analyticsInstance) {
let errorMessage = error.message ? error.message : undefined;
let sampleAdBlockTest = undefined
try {
if (error instanceof Event) {
if (error.target && error.target.localName == "script") {
errorMessage = "error in script loading:: src:: " + error.target.src + " id:: " + error.target.id;
if(analyticsInstance && error.target.src.includes("adsbygoogle")) {
sampleAdBlockTest = true
analyticsInstance.page("RudderJS-Initiated", "ad-block page request", {path: "/ad-blocked", title: errorMessage}, analyticsInstance.sendAdblockPageOptions)
}
}
}
if (errorMessage && !sampleAdBlockTest) {
logger.error("[Util] handleError:: ", errorMessage);
}
} catch (e) {
logger.error("[Util] handleError:: ", e)
}
}
function getDefaultPageProperties() {
let canonicalUrl = getCanonicalUrl();
let path = canonicalUrl ? canonicalUrl.pathname : window.location.pathname;
let referrer = document.referrer;
let search = window.location.search;
let title = document.title;
let url = getUrl(search);
return {
path: path,
referrer: referrer,
search: search,
title: title,
url: url
};
}
function getUrl(search) {
let canonicalUrl = getCanonicalUrl();
let url = canonicalUrl
? canonicalUrl.indexOf("?") > -1
? canonicalUrl
: canonicalUrl + search
: window.location.href;
let hashIndex = url.indexOf("#");
return hashIndex > -1 ? url.slice(0, hashIndex) : url;
}
function getCanonicalUrl() {
var tags = document.getElementsByTagName("link");
for (var i = 0, tag; (tag = tags[i]); i++) {
if (tag.getAttribute("rel") === "canonical") {
return tag.getAttribute("href");
}
}
}
function getCurrency(val) {
if (!val) return;
if (typeof val === "number") {
return val;
}
if (typeof val !== "string") {
return;
}
val = val.replace(/\$/g, "");
val = parseFloat(val);
if (!isNaN(val)) {
return val;
}
}
function getRevenue(properties, eventName) {
var revenue = properties.revenue;
var orderCompletedRegExp = /^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;
// it's always revenue, unless it's called during an order completion.
if (!revenue && eventName && eventName.match(orderCompletedRegExp)) {
revenue = properties.total;
}
return getCurrency(revenue);
}
/**
*
*
* @param {*} integrationObject
*/
function tranformToRudderNames(integrationObject) {
Object.keys(integrationObject).forEach(key => {
if(integrationObject.hasOwnProperty(key)) {
if(commonNames[key]) {
integrationObject[commonNames[key]] = integrationObject[key]
}
if(key != "All") {
// delete user supplied keys except All and if except those where oldkeys are not present or oldkeys are same as transformed keys
if(commonNames[key] != undefined && commonNames[key] != key) {
delete integrationObject[key]
}
}
}
})
}
function transformToServerNames(integrationObject) {
Object.keys(integrationObject).forEach(key => {
if(integrationObject.hasOwnProperty(key)) {
if(clientToServerNames[key]) {
integrationObject[clientToServerNames[key]] = integrationObject[key]
}
if(key != "All") {
// delete user supplied keys except All and if except those where oldkeys are not present or oldkeys are same as transformed keys
if(clientToServerNames[key] != undefined && clientToServerNames[key] != key) {
delete integrationObject[key]
}
}
}
})
}
/**
*
* @param {*} sdkSuppliedIntegrations
* @param {*} configPlaneEnabledIntegrations
*/
function findAllEnabledDestinations(sdkSuppliedIntegrations, configPlaneEnabledIntegrations) {
let enabledList = []
if(!configPlaneEnabledIntegrations || configPlaneEnabledIntegrations.length == 0) {
return enabledList
}
let allValue = true
if(typeof configPlaneEnabledIntegrations[0] == "string") {
if(sdkSuppliedIntegrations["All"] != undefined) {
allValue = sdkSuppliedIntegrations["All"]
}
configPlaneEnabledIntegrations.forEach(intg => {
if(!allValue) {
// All false ==> check if intg true supplied
if(sdkSuppliedIntegrations[intg]!= undefined && sdkSuppliedIntegrations[intg] == true) {
enabledList.push(intg)
}
} else {
// All true ==> intg true by default
let intgValue = true
// check if intg false supplied
if(sdkSuppliedIntegrations[intg] != undefined && sdkSuppliedIntegrations[intg] == false) {
intgValue = false
}
if(intgValue) {
enabledList.push(intg)
}
}
})
return enabledList
}
if(typeof configPlaneEnabledIntegrations[0] == "object") {
if(sdkSuppliedIntegrations["All"] != undefined) {
allValue = sdkSuppliedIntegrations["All"]
}
configPlaneEnabledIntegrations.forEach(intg => {
if(!allValue) {
// All false ==> check if intg true supplied
if(sdkSuppliedIntegrations[intg.name]!= undefined && sdkSuppliedIntegrations[intg.name] == true) {
enabledList.push(intg)
}
} else {
// All true ==> intg true by default
let intgValue = true
// check if intg false supplied
if(sdkSuppliedIntegrations[intg.name] != undefined && sdkSuppliedIntegrations[intg.name] == false) {
intgValue = false
}
if(intgValue) {
enabledList.push(intg)
}
}
})
return enabledList
}
}
export {
replacer,
generateUUID,
getCurrentTimeFormatted,
getJSONTrimmed,
getJSON,
getRevenue,
getDefaultPageProperties,
findAllEnabledDestinations,
tranformToRudderNames,
transformToServerNames,
handleError
};
| 26.927326 | 165 | 0.636511 |
37ea1875674acb465c3855d6cb6ce33795cdbc04 | 2,433 | js | JavaScript | app/module_gps/controllers/GpsRuleController.js | pujjr/pcms-client | 10124381effd621ceabc32161c59105483d413e2 | [
"MIT"
] | null | null | null | app/module_gps/controllers/GpsRuleController.js | pujjr/pcms-client | 10124381effd621ceabc32161c59105483d413e2 | [
"MIT"
] | null | null | null | app/module_gps/controllers/GpsRuleController.js | pujjr/pcms-client | 10124381effd621ceabc32161c59105483d413e2 | [
"MIT"
] | null | null | null | 'use strict';
/* Controllers */
// signin controllers
angular.module("pu.gps.controllers")
.controller('GpsRuleController',function ($scope, $rootScope, $state, toaster, $uibModal,GpsService) {
$scope.init = function () {
$scope.queryGpsRuleList();
};
$scope.queryGpsRuleList = function(){
$scope.gpsRuleList= GpsService.queryGpsRuleList(false).$object;
}
$scope.addGpsRule = function(){
var modalInstance = $uibModal.open({
animation: true,
backdrop:'false',
templateUrl :'module_gps/tpl/dialog-gpsrule-add.html',
controller:function($scope,RestApi){
$scope.item={};
$scope.ok=function(){
modalInstance.close($scope.item);
};
$scope.cancel = function () {
modalInstance.dismiss('cancel');
};
}
});
modalInstance.result.then(function(response){
GpsService.addGpsRule(response).then(function(){
toaster.pop('success', '操作提醒', '增加成功');
$scope.queryGpsRuleList();
})
})
};
$scope.editGpsRule = function(item){
var modalInstance = $uibModal.open({
animation: true,
backdrop:'false',
templateUrl :'module_gps/tpl/dialog-gpsrule-edit.html',
controller:function($scope,RestApi){
$scope.item=item;
$scope.ok=function(){
GpsService.modifyGpsRule($scope.item).then(function(){
modalInstance.close('修改成功');
})
};
$scope.delete = function(){
GpsService.deleteGpsRule(item.id).then(function(){
modalInstance.close('删除成功');
})
}
$scope.cancel = function () {
modalInstance.dismiss('cancel');
};
}
});
modalInstance.result.then(function(response){
toaster.pop('success', '操作提醒', response);
$scope.queryGpsRuleList();
})
};
})
; | 38.619048 | 106 | 0.453761 |
37ef294ad773dcc4cb61f034414d160bde7c541f | 256 | js | JavaScript | generators/app/templates/src/app/components/Card.js | ccau1/generator-hexin-react | a06fe89dc53a77d2e27e1642228fac2edfe9e810 | [
"MIT"
] | null | null | null | generators/app/templates/src/app/components/Card.js | ccau1/generator-hexin-react | a06fe89dc53a77d2e27e1642228fac2edfe9e810 | [
"MIT"
] | null | null | null | generators/app/templates/src/app/components/Card.js | ccau1/generator-hexin-react | a06fe89dc53a77d2e27e1642228fac2edfe9e810 | [
"MIT"
] | null | null | null | import styled from 'styled-components';
export default styled.div`
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
&:hover {
box-shadow: ${props => props.hover ? '0 8px 16px 0 rgba(0,0,0,0.2)' : '0 4px 8px 0 rgba(0,0,0,0.2)'};
}
`;
| 25.6 | 105 | 0.613281 |
37ef5316ff1aea54e6b9b8d35ec52d7b400eef45 | 1,886 | js | JavaScript | src/components/Header/Header.js | digirati-co-uk/pmc-viewer | f671da7815a8aa4a958dc82dca60213a6b63d878 | [
"MIT"
] | 2 | 2018-10-04T18:54:15.000Z | 2019-09-30T14:52:37.000Z | src/components/Header/Header.js | digirati-co-uk/pmc-viewer | f671da7815a8aa4a958dc82dca60213a6b63d878 | [
"MIT"
] | 9 | 2018-05-02T13:59:52.000Z | 2022-02-26T01:39:03.000Z | src/components/Header/Header.js | digirati-co-uk/pmc-viewer | f671da7815a8aa4a958dc82dca60213a6b63d878 | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import { connect } from 'react-redux';
import Title from '../Title/Title';
import Close from '../Close/Close';
import ControlBar from '../ControlBar/ControlBar';
import Controls from '../Controls/Controls';
import Pager from '../Pager/Pager';
import IIIFLink from '../IIIFLink/IIIFLink';
let leftPad = n => (n <= 999 ? ('00' + n).slice(-3) : n);
class Header extends Component {
getCurrentPage() {
const { currentCanvas, totalCanvases } = this.props;
return `Page ${leftPad(currentCanvas + 1)} of ${leftPad(totalCanvases)}`;
}
render() {
const { viewport, onClose, id } = this.props;
return (
<div style={{ position: 'relative' }}>
<Title>{this.props.label}</Title>
{onClose ? <Close onClose={onClose} /> : null}
<ControlBar>
<ControlBar.Left>
<Pager>{this.getCurrentPage()}</Pager>
</ControlBar.Left>
<ControlBar.Right>
{viewport ? (
<Controls
onZoomIn={() => viewport.zoomIn()}
onZoomOut={() => viewport.zoomOut()}
/>
) : null}
{id ? <IIIFLink manifest={id} /> : null}
</ControlBar.Right>
</ControlBar>
</div>
);
}
}
function mapStateToProps(state) {
return {
id: state.manifest.jsonLd ? state.manifest.jsonLd['@id'] : null,
label: state.manifest.jsonLd ? state.manifest.jsonLd.label : '',
// canvasLabel: state.canvas
// ? state.canvas.jsonLd ? state.canvas.jsonLd.label : ''
// : '',
canvasLabel: state.canvas ? state.canvas.getLabel() : '',
currentCanvas: state.manifest ? state.manifest.currentCanvas : null,
totalCanvases: state.manifest.jsonLd
? state.manifest.jsonLd.sequences[0].canvases.length
: null,
};
}
export default connect(mapStateToProps)(Header);
| 31.966102 | 77 | 0.59597 |
37efb251e808ed3600266eb0201cbda325e13eb9 | 537 | js | JavaScript | 10DaysOfJavascript/Day2_ConditionalStatements_Switch.js | weekendchow/HackerRank_JS | cc6e7d51d46684654c76785d9610713f969a269a | [
"MIT"
] | null | null | null | 10DaysOfJavascript/Day2_ConditionalStatements_Switch.js | weekendchow/HackerRank_JS | cc6e7d51d46684654c76785d9610713f969a269a | [
"MIT"
] | 1 | 2018-05-10T18:46:09.000Z | 2018-05-10T18:46:09.000Z | 10DaysOfJavascript/Day2_ConditionalStatements_Switch.js | weekendchow/HackerRank_JS | cc6e7d51d46684654c76785d9610713f969a269a | [
"MIT"
] | null | null | null | function getLetter(s) {
let letter;
// Write your code here
const set1 = new Set(['a','e','i','o','u'])
const set2 = new Set(['b','c','d','f','g'])
const set3 = new Set(['h','j','k','l','m'])
switch(true){
case set1.has(s[0]):
letter = 'A'
break
case set2.has(s[0]):
letter = 'B'
break
case set3.has(s[0]):
letter = 'C'
break
default :
letter = 'D'
break
}
return letter;
}
| 20.653846 | 47 | 0.409683 |
37f02ecfe8e41dd3909c4c834813e2a92aa55ba2 | 2,798 | js | JavaScript | app/screens/accountEditor/AccountEditorScreenView.js | DaxiALex/Perfi | 0b72718f11e836edd96f1e9b310161a42e633f1f | [
"Apache-2.0"
] | 3 | 2018-10-10T09:00:53.000Z | 2021-08-12T18:20:49.000Z | app/screens/accountEditor/AccountEditorScreenView.js | DaxiALex/Perfi | 0b72718f11e836edd96f1e9b310161a42e633f1f | [
"Apache-2.0"
] | null | null | null | app/screens/accountEditor/AccountEditorScreenView.js | DaxiALex/Perfi | 0b72718f11e836edd96f1e9b310161a42e633f1f | [
"Apache-2.0"
] | 1 | 2021-05-08T01:05:59.000Z | 2021-05-08T01:05:59.000Z | import React from 'react';
import { View, TouchableOpacity } from 'react-native';
import T from 'prop-types';
import Modal from 'react-native-modal';
import { ColorPicker } from 'react-native-color-picker';
import { getParam } from '../../utils/navHelpers';
import DeleteButton from './DeleteButton';
import {
Input,
Button,
Text,
KeyboardAvoidingView,
DatePicker,
ScreenWrapper,
HeaderTitle,
} from '../../components/index';
import s from './styles';
const AccountEditor = ({
name,
date,
onSubmit,
isValid,
initialBalance,
onNameChange,
onDateChange,
onChangeBalance,
onToggleColorPicker,
isColorPickerVisible,
onSelectColor,
icon,
color,
}) => (
<View style={s.root}>
<ScreenWrapper>
<Modal
animationIn="fadeIn"
animationOut="fadeOut"
isVisible={isColorPickerVisible}
onBackdropPress={onToggleColorPicker}
>
<ColorPicker
style={s.modal}
onColorSelected={onSelectColor}
defaultColor={color}
hideSliders
/>
</Modal>
<View style={s.container}>
<View style={s.secondContainer}>
<TouchableOpacity
onPress={onToggleColorPicker}
style={[s.colorPickerContainer, { backgroundColor: color }]}
/>
<Text style={s.label}>Choose color</Text>
</View>
<Input
isValid
placeholder="Account name"
value={name}
onChangeText={onNameChange}
containerStyle={s.root}
/>
</View>
<Input
isValid
placeholder="Initial balance"
value={initialBalance ? initialBalance.toString() : ''}
onChangeText={onChangeBalance}
keyboardType="phone-pad"
containerStyle={s.balanceContainer}
iconRight={icon}
/>
<DatePicker
placeholder="Initial date"
onSelectDate={onDateChange}
defaultValue={date}
/>
</ScreenWrapper>
<KeyboardAvoidingView withHeader>
{isValid &&
<Button
secondaryOpacity
title="Save"
onPress={onSubmit}
/>
}
</KeyboardAvoidingView>
</View>
);
AccountEditor.navigationOptions = ({ navigation }) => ({
headerTitle:
<HeaderTitle title={getParam('account')(navigation) ? 'Edit account' : 'New account'} />,
headerRight: <DeleteButton navigation={navigation} />,
});
AccountEditor.propTypes = {
name: T.string,
date: T.any,
onSubmit: T.func,
isValid: T.bool,
initialBalance: T.number,
onNameChange: T.func,
onDateChange: T.func,
onChangeBalance: T.func,
onToggleColorPicker: T.func,
isColorPickerVisible: T.bool,
onSelectColor: T.func,
icon: T.object,
color: T.string,
};
export default AccountEditor;
| 22.384 | 91 | 0.619014 |
37f1452a150efe9f3dfb876ed4981b5d6cdc46a7 | 539 | js | JavaScript | node_modules/postcss-get-variables/test/test.js | spenhar/countdown | f08518bf5a551604bae9ac614a406b580bbb53ec | [
"MIT"
] | 1 | 2016-09-02T02:23:26.000Z | 2016-09-02T02:23:26.000Z | node_modules/postcss-get-variables/test/test.js | spenhar/countdown | f08518bf5a551604bae9ac614a406b580bbb53ec | [
"MIT"
] | null | null | null | node_modules/postcss-get-variables/test/test.js | spenhar/countdown | f08518bf5a551604bae9ac614a406b580bbb53ec | [
"MIT"
] | null | null | null | 'use strict'
import fs from 'fs'
import test from 'ava'
import postcss from 'postcss'
import isPresent from 'is-present'
import getVariables from '..'
test('postcss-get-variables', t => {
t.plan(2)
postcss()
.use(getVariables(variables => {
t.true(isPresent(variables))
t.true(isPresent(variables['primary-color']))
}))
.process(fixture('basic'))
.catch(error => {
console.log(error)
})
})
function fixture (name) {
return fs.readFileSync('fixtures/' + name + '.css', 'utf8').toString()
}
| 19.962963 | 72 | 0.636364 |
37f1e18f6cb3f5fef4e4043927d3a734ba8241c6 | 1,057 | js | JavaScript | dist/components/EditorButtonActions.js | jhta/simple-draftjs | 92be2a3b810292679816e41140a5b673efe770ba | [
"MIT"
] | null | null | null | dist/components/EditorButtonActions.js | jhta/simple-draftjs | 92be2a3b810292679816e41140a5b673efe770ba | [
"MIT"
] | null | null | null | dist/components/EditorButtonActions.js | jhta/simple-draftjs | 92be2a3b810292679816e41140a5b673efe770ba | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (_ref) {
var showButtons = _ref.showButtons;
var onSendResponse = _ref.onSendResponse;
var onHideEditor = _ref.onHideEditor;
var messages = _ref.messages;
var hasHideEditorButton = _ref.hasHideEditorButton;
if (!showButtons) return null;
return _react2.default.createElement(
"div",
{ className: "RichEditor-actions" },
_react2.default.createElement(
"button",
{
className: "RichEditor-actionsButton btn-Sky",
onClick: onSendResponse
},
messages.buttons.send || 'send'
),
hasHideEditorButton ? _react2.default.createElement(
"p",
{
className: "RichEditor-actionsButtonCancel",
onClick: onHideEditor
},
messages.buttons.cancel || 'cancel'
) : null
);
}; | 25.780488 | 95 | 0.667928 |
37f2e100ee97efc97031822cf681e06765197a58 | 47,733 | js | JavaScript | gci-vci-react/src/components/variant-central/AuditTrail.js | ClinGen/gene-and-variant-curation-tools | 30f21d8f03d8b5c180c1ce3cb8401b5abc660080 | [
"MIT"
] | 1 | 2021-09-17T20:39:07.000Z | 2021-09-17T20:39:07.000Z | gci-vci-react/src/components/variant-central/AuditTrail.js | ClinGen/gene-and-variant-curation-tools | 30f21d8f03d8b5c180c1ce3cb8401b5abc660080 | [
"MIT"
] | 133 | 2021-08-29T17:24:26.000Z | 2022-03-25T17:24:31.000Z | gci-vci-react/src/components/variant-central/AuditTrail.js | ClinGen/gene-and-variant-curation-tools | 30f21d8f03d8b5c180c1ce3cb8401b5abc660080 | [
"MIT"
] | null | null | null | import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { useTable, useFilters, useGlobalFilter, useSortBy, usePagination } from 'react-table';
import { API } from 'aws-amplify';
import moment from 'moment';
import { API_NAME } from '../../utils';
import { getUserName } from "../../helpers/getUserName";
import { convertDiseasePKToMondoId } from '../../utilities/diseaseUtilities';
import { useAmplifyAPIRequestRecycler } from '../../utilities/fetchUtilities';
import { TableFilters, TableContent, Pagination } from '../common/TableComponents';
import Popover from '../common/Popover';
import LoadingSpinner from '../common/LoadingSpinner';
function AuditTrail(props) {
const requestRecycler = useAmplifyAPIRequestRecycler();
const [itemType, setItemType] = useState(props.itemType);
const [itemPK, setItemPK] = useState(props.itemPK);
const [historyData, setHistoryData] = useState(null);
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
if (historyData === null && !isLoading) {
setIsLoading(true);
const historyResults = getHistoryData(itemPK);
historyResults.then(results => {
setHistoryData(generateTableData(results));
setIsLoading(false);
}).catch(error => {
setHistoryData({});
setIsLoading(false);
console.log('History request failed');
});
requestRecycler.cancelAll();
}
});
/**
* Method to retrieve data from history table for the specified item (plus other linked-to items of related types)
* @param {string} itemPK - PK of the item of interest
*/
async function getHistoryData(itemPK) {
try {
const url = '/history/' + itemPK + '?related=curated_evidence_list,evaluations';
const history = await API.get(API_NAME, url);
return (history);
} catch(error) {
if (API.isCancel(error)) {
console.log('History request cancelled');
}
console.log(error);
return ({});
}
}
// React Table configuration
const dataHistory = React.useMemo(() => historyData ? historyData : [], [historyData]);
const columnsHistory = React.useMemo(() => [
{
Header: 'User',
accessor: 'user_filter',
style: { width: '20%' },
Cell: cell => { return cell.row && cell.row.original ? cell.row.original.user_display : cell.value }
},
{
Header: 'Event',
accessor: 'event_filter',
Cell: cell => { return cell.row && cell.row.original ? cell.row.original.event_display : cell.value }
},
{
Header: 'Date',
accessor: 'date_sort',
style: { width: '20%' },
Cell: cell => { return cell.row && cell.row.original ? cell.row.original.date_display : cell.value }
},
{
accessor: 'date_filter'
}], []
);
const {
getTableProps,
getTableBodyProps,
headerGroups,
prepareRow,
state: { globalFilter },
preGlobalFilteredRows,
setGlobalFilter,
rows,
pageOptions,
page,
pageCount,
state: { pageIndex, pageSize },
gotoPage,
previousPage,
nextPage,
setPageSize,
canPreviousPage,
canNextPage
} = useTable(
{
columns: columnsHistory,
data: dataHistory,
initialState: {
hiddenColumns: ['date_filter'],
pageIndex: 0,
sortBy: [
{ id: 'date_sort', desc: true }
]
},
},
useFilters,
useGlobalFilter,
useSortBy,
usePagination
);
const pageSizeOptions = [10, 20, 30, 50, 100];
/**
* Method to generate audit trail display data
* @param {object} historyRequestData - data returned by /history request
*/
function generateTableData(historyRequestData) {
return processRawData(historyRequestData).map(eventElement => {
if (eventElement) {
let tableDataElement = {};
const userData = renderUser(eventElement.user_name, eventElement.user_family_name, eventElement.user_email, eventElement.user_pk);
const dateData = renderDate(eventElement.last_modified);
const eventData = renderEvent(eventElement);
if (userData) {
tableDataElement['user_display'] = userData.display;
tableDataElement['user_filter'] = userData.filter;
} else {
tableDataElement['user_display'] = '';
tableDataElement['user_filter'] = '';
}
if (dateData) {
tableDataElement['date_display'] = dateData.display;
tableDataElement['date_filter'] = dateData.filter;
tableDataElement['date_sort'] = dateData.sort;
} else {
tableDataElement['date_display'] = '';
tableDataElement['date_filter'] = '';
tableDataElement['date_sort'] = '';
}
if (eventData && Array.isArray(eventData)) {
const lastIndex = eventData.length - 1;
eventData.forEach((eventDataElement, eventDataIndex) => {
if (eventDataElement) {
if (eventDataIndex === 0) {
tableDataElement['event_display'] = eventDataElement.display;
tableDataElement['event_filter'] = eventDataElement.filter;
} else {
tableDataElement['event_display'] = (<>{tableDataElement['event_display']}<br />{eventDataElement.display}</>);
tableDataElement['event_filter'] = tableDataElement['event_filter'] + ' ' + eventDataElement.filter;
}
}
});
} else {
tableDataElement['event_display'] = '';
tableDataElement['event_filter'] = '';
}
return (tableDataElement);
}
});
}
/**
* Method to find and retrieve action data (i.e. changed by user) at the specified key or array of keys (for nested data)
* If data is found via an array of keys, the returned key is a concatenation of those keys
* @param {object} sourceData - data that was added/updated/deleted
* @param {array or string} searchKey - key or array of keys to locate data of interest
*/
function findActionData(sourceData, searchKey) {
if (Array.isArray(searchKey)) {
let flatKey = '';
let dataNotFound = false;
for (let currentKey of searchKey) {
if (sourceData[currentKey]) {
sourceData = sourceData[currentKey];
flatKey = flatKey ? flatKey + '_' + currentKey : currentKey;
} else {
dataNotFound = true;
break;
}
}
if (!dataNotFound) {
return ({
'save_key': flatKey,
'save_value': sourceData,
'found': true
});
}
} else if (sourceData[searchKey]) {
return ({
'save_key': searchKey,
'save_value': sourceData[searchKey],
'found': true
});
}
return ({
'found': false
});
}
/**
* Method to extract data of interest for audit trail display from /history request results
* @param {object} historyRawData - data returned by /history request
*/
function processRawData(historyRawData) {
// Arrays of keys referencing data to save, grouped by item type
const actionDataToSave = {
'curated-evidence': ['evidenceCriteria', 'evidenceDescription',
['articles', 0, 'pmid'],
['sourceInfo', 'metadata', '_kind_key'],
['sourceInfo', 'metadata', '_kind_title'],
['sourceInfo', 'metadata', 'clinvar_gtr_labid'],
['sourceInfo', 'metadata', 'clinvar_scv'],
['sourceInfo', 'metadata', 'department_affiliation'],
['sourceInfo', 'metadata', 'institutional_affiliation'],
['sourceInfo', 'metadata', 'lab_name'],
['sourceInfo', 'metadata', 'name'],
['sourceInfo', 'metadata', 'pmid'],
['sourceInfo', 'metadata', 'source'],
['sourceInfo', 'metadata', 'url'],
['sourceInfo', 'metadata', 'variant_id'],
['sourceInfo', 'data', 'comments'],
['sourceInfo', 'data', 'hpoData'],
['sourceInfo', 'data', 'is_disease_associated_with_probands'],
['sourceInfo', 'data', 'label'],
['sourceInfo', 'data', 'num_control_with_variant'],
['sourceInfo', 'data', 'num_control_with_variant_comment'],
['sourceInfo', 'data', 'num_de_novo_confirmed'],
['sourceInfo', 'data', 'num_de_novo_confirmed_comment'],
['sourceInfo', 'data', 'num_de_novo_unconfirmed'],
['sourceInfo', 'data', 'num_de_novo_unconfirmed_comment'],
['sourceInfo', 'data', 'num_non_segregations'],
['sourceInfo', 'data', 'num_non_segregations_comment'],
['sourceInfo', 'data', 'num_proband_double_het'],
['sourceInfo', 'data', 'num_proband_double_het_comment'],
['sourceInfo', 'data', 'num_proband_hom'],
['sourceInfo', 'data', 'num_proband_hom_comment'],
['sourceInfo', 'data', 'num_probands_compound_het'],
['sourceInfo', 'data', 'num_probands_compound_het_comment'],
['sourceInfo', 'data', 'num_probands_relevant_phenotype'],
['sourceInfo', 'data', 'num_probands_relevant_phenotype_comment'],
['sourceInfo', 'data', 'num_probands_with_alt_genetic_cause'],
['sourceInfo', 'data', 'num_probands_with_alt_genetic_cause_comment'],
['sourceInfo', 'data', 'num_segregations'],
['sourceInfo', 'data', 'num_segregations_comment'],
['sourceInfo', 'data', 'num_total_controls'],
['sourceInfo', 'data', 'num_unaffected_family_with_variant'],
['sourceInfo', 'data', 'num_unaffected_family_with_variant_comment'],
['sourceInfo', 'data', 'proband_free_text'],
['sourceInfo', 'data', 'proband_hpo_comment'],
['sourceInfo', 'data', 'proband_hpo_ids']],
'evaluation': ['criteria', 'criteriaStatus', 'explanation'],
'interpretation': ['cspec', 'disease', 'diseaseTerm', 'modeInheritance', 'modeInheritanceAdjective', 'variant',
['provisionalVariant', 'alteredClassification'],
['provisionalVariant', 'reason'],
['provisionalVariant', 'evidenceSummary'],
['provisionalVariant', 'classificationStatus']]
};
let allTypesArray = [];
Object.keys(historyRawData).forEach(historyPK => {
if (historyRawData[historyPK].history) {
let caseSegEvidenceKey = '';
let caseSegEvidenceType = '';
let caseSegEvidenceID = '';
historyRawData[historyPK].history.forEach(historyElement => {
if (historyElement && historyElement.item_type && actionDataToSave[historyElement.item_type]) {
// Save reference data
let auditTrailElement = {
'item_type': historyElement.item_type,
'user_pk': historyElement.modified_by,
'user_name': historyElement.user_name,
'user_family_name': historyElement.user_family_name,
'user_email': historyElement.user_email,
'affiliation_id': historyElement.affiliation,
'last_modified': historyElement.last_modified,
'criteria': historyElement.criteria,
'evidenceCriteria': historyElement.evidenceCriteria
};
// Process item creation
if (historyElement.change_type === 'INSERT') {
if (historyElement.add) {
let dataFound = false;
let addData = {};
actionDataToSave[historyElement.item_type].forEach(dataElement => {
const findResult = findActionData(historyElement.add, dataElement);
if (findResult.found) {
// Don't save auto-created "Not Evaluated" evaluations
if ((historyElement.item_type !== 'evaluation') ||
((findResult.save_key === 'criteriaStatus' || findResult.save_key === 'explanation') && findResult.save_value)) {
addData[findResult.save_key] = findResult.save_value;
dataFound = true;
}
}
});
if (dataFound) {
// Save case seg evidence reference data (key and type, which most likely won't change, and ID) for subsequent item events
if (addData.sourceInfo_metadata__kind_key) {
caseSegEvidenceKey = addData.sourceInfo_metadata__kind_key;
auditTrailElement['case_seg_evidence_key'] = caseSegEvidenceKey;
caseSegEvidenceType = addData.sourceInfo_metadata__kind_title;
auditTrailElement['case_seg_evidence_type'] = caseSegEvidenceType;
caseSegEvidenceID = addData.sourceInfo_metadata_pmid ? 'PMID ' + addData.sourceInfo_metadata_pmid
: addData.sourceInfo_metadata_lab_name ? addData.sourceInfo_metadata_lab_name
: addData.sourceInfo_metadata_institutional_affiliation ? addData.sourceInfo_metadata_institutional_affiliation
: addData.sourceInfo_metadata_name ? addData.sourceInfo_metadata_name
: addData.sourceInfo_metadata_source ? addData.sourceInfo_metadata_source
: '';
if (caseSegEvidenceID) {
auditTrailElement['case_seg_evidence_id'] = caseSegEvidenceID;
}
}
auditTrailElement['events'] = [{'action': 'create', 'data': addData}];
allTypesArray.push(auditTrailElement);
}
}
} else {
// If present for the current item, add case seg evidence reference data
if (caseSegEvidenceKey) {
auditTrailElement['case_seg_evidence_key'] = caseSegEvidenceKey;
auditTrailElement['case_seg_evidence_type'] = caseSegEvidenceType;
if (caseSegEvidenceID) {
auditTrailElement['case_seg_evidence_id'] = caseSegEvidenceID;
}
}
// Process data added to item
if (historyElement.add) {
let dataFound = false;
let addData = {};
actionDataToSave[historyElement.item_type].forEach(dataElement => {
const findResult = findActionData(historyElement.add, dataElement);
if (findResult.found) {
addData[findResult.save_key] = findResult.save_value;
dataFound = true;
}
});
if (dataFound) {
auditTrailElement['events'] = [{'action': 'add', 'data': addData}];
}
}
// Process data updated within item
if (historyElement.update) {
let dataFound = false;
let updateData = {};
actionDataToSave[historyElement.item_type].forEach(dataElement => {
const findResult = findActionData(historyElement.update, dataElement);
if (findResult.found) {
updateData[findResult.save_key] = findResult.save_value;
dataFound = true;
}
});
if (dataFound) {
// Save case seg evidence reference data (type, in case it's changed system-wide, and ID) for subsequent item events
if (updateData.sourceInfo_metadata__kind_title) {
caseSegEvidenceType = updateData.sourceInfo_metadata__kind_title;
auditTrailElement['case_seg_evidence_type'] = caseSegEvidenceType;
}
caseSegEvidenceID = updateData.sourceInfo_metadata_pmid ? 'PMID ' + updateData.sourceInfo_metadata_pmid
: updateData.sourceInfo_metadata_lab_name ? updateData.sourceInfo_metadata_lab_name
: updateData.sourceInfo_metadata_institutional_affiliation ? updateData.sourceInfo_metadata_institutional_affiliation
: updateData.sourceInfo_metadata_name ? updateData.sourceInfo_metadata_name
: updateData.sourceInfo_metadata_source ? updateData.sourceInfo_metadata_source
: '';
if (caseSegEvidenceID) {
auditTrailElement['case_seg_evidence_id'] = caseSegEvidenceID;
}
if (auditTrailElement['events']) {
auditTrailElement['events'].push({'action': 'update', 'data': updateData});
} else {
auditTrailElement['events'] = [{'action': 'update', 'data': updateData}];
}
}
}
// Process data deleted from item
if (historyElement.delete) {
let dataFound = false;
let deleteData = {};
actionDataToSave[historyElement.item_type].forEach(dataElement => {
const findResult = findActionData(historyElement.delete, dataElement);
if (findResult.found) {
deleteData[findResult.save_key] = findResult.save_value;
dataFound = true;
}
});
if (dataFound) {
if (auditTrailElement['events']) {
auditTrailElement['events'].push({'action': 'delete', 'data': deleteData});
} else {
auditTrailElement['events'] = [{'action': 'delete', 'data': deleteData}];
}
}
}
if (auditTrailElement['events']) {
allTypesArray.push(auditTrailElement);
}
}
}
});
}
});
return (allTypesArray);
}
/**
* Method to generate display/filter data for a user
* @param {string} userName - first name of user
* @param {string} userFamilyName - last name of user
* @param {string} userEmail - email address for user
* @param {string} userPK - PK of item containing user data
*/
function renderUser(userName, userFamilyName, userEmail, userPK) {
const textUserName = userName && userFamilyName ? getUserName({'name': userName, 'family_name': userFamilyName})
: userPK && props.auth && userPK === props.auth.PK ? getUserName(props.auth)
: 'Curator';
const textEmail = userEmail ? userEmail
: userPK && props.auth && userPK === props.auth.PK ? props.auth.email
: null;
if (textEmail) {
return ({
display: (<a href={'mailto:' + textEmail} className="audit-trail-data user">{textUserName}</a>),
filter: textUserName
});
} else {
return ({
display: (<span className="audit-trail-data user">{textUserName}</span>),
filter: textUserName
});
}
}
/**
* Method to generate display/filter data for a date
* @param {string} dateTimestamp - date and time (of event)
*/
function renderDate(dateTimestamp) {
const textDate = dateTimestamp ? moment(dateTimestamp).format('YYYY MMM DD, h:mm a') : 'Unrecognized date';
return ({
display: (<span className="audit-trail-data timestamp">{textDate}</span>),
filter: textDate,
sort: dateTimestamp
});
}
/**
* Method to generate display/filter data for a variant
* @param {string} variantPK - PK of item containing variant data
*/
function renderVariant(variantPK) {
if (variantPK && props.variant && variantPK === props.variant.PK) {
const textVariantTitle = props.variant.preferredTitle ? props.variant.preferredTitle + ', ' : '';
const textVariantClinVarID = props.variant.clinvarVariantId ? 'ClinVar ID: ' + props.variant.clinvarVariantId : '';
const textVariantCARID = props.variant.carId ? 'CAR ID: ' + props.variant.carId : '';
const textSeparator = textVariantClinVarID && textVariantCARID ? ', ' : '';
return ({
display: (<>variant <span className="audit-trail-data variant">{textVariantTitle}{textVariantClinVarID}{
textSeparator}{textVariantCARID}</span></>),
filter: 'variant ' + textVariantTitle + textVariantClinVarID + textSeparator + textVariantCARID
});
} else {
return ({
display: (<span className="audit-trail-data variant">an unrecognized variant</span>),
filter: 'an unrecognized variant'
});
}
}
/**
* Method to generate display/filter data for a saved cspec doc
* @param {*} cspec
*/
function renderCspec(cspec) {
if (cspec) {
const documentName = cspec.documentName;
return ({
display: (<>specification document <span className="audit-trail-data cspec">{documentName}</span></>),
filter: 'specification document ' + documentName
});
} else {
return ({
display: (<span className="audit-trail-data cspec">an unrecognized specification document</span>),
filter: 'an unrecognized specification document'
});
}
}
/**
* Method to generate display/filter data for a disease
* @param {string} diseasePK - PK of item containing disease data
* @param {string} diseaseTerm - name of disease
*/
function renderDisease(diseasePK, diseaseTerm) {
if (diseasePK || diseaseTerm) {
const diseaseMondoID = convertDiseasePKToMondoId(diseasePK);
const textDisease = diseaseTerm && diseaseMondoID ? diseaseTerm + ' (' + diseaseMondoID + ')'
: diseaseTerm ? diseaseTerm
: diseaseMondoID;
return ({
display: (<>disease <span className="audit-trail-data disease">{textDisease}</span></>),
filter: 'disease ' + textDisease
});
} else {
return ({
display: (<span className="audit-trail-data disease">an unrecognized disease</span>),
filter: 'an unrecognized disease'
});
}
}
/**
* Method to generate display/filter data for a mode of inheritance
* @param {string} modeOfInheritance - mode of inheritance
* @param {string} modeOfInheritanceAdjective - adjective to the mode of inheritance
*/
function renderMOI(modeOfInheritance, modeOfInheritanceAdjective) {
if (modeOfInheritance || modeOfInheritanceAdjective) {
const adjectiveText = !modeOfInheritance && modeOfInheritanceAdjective ? 'adjective ' : '';
const textMOI = modeOfInheritance && modeOfInheritanceAdjective ? modeOfInheritance + ' (' + modeOfInheritanceAdjective + ')'
: modeOfInheritance ? modeOfInheritance
: modeOfInheritanceAdjective;
return ({
display: (<>mode of inheritance {adjectiveText}<span className="audit-trail-data moi">{textMOI}</span></>),
filter: 'mode of inheritance ' + adjectiveText + textMOI
});
} else {
return ({
display: (<span className="audit-trail-data moi">an unrecognized mode of inheritance</span>),
filter: 'an unrecognized mode of inheritance'
});
}
}
/**
* Method to generate display/filter data for an interpretation's classification/summary
* @param {object} classificationData - data related to classification/summary of interpretation
*/
function renderClassification(classificationData) {
let displayPathogenicity = '';
let filterPathogenicity = '';
let andText = '';
let displaySummary = '';
let filterSummary = '';
if (classificationData.provisionalVariant_alteredClassification && classificationData.provisionalVariant_reason) {
displayPathogenicity = (<>modified pathogenicity <span className="audit-trail-data pathogenicity">{
classificationData.provisionalVariant_alteredClassification}</span> with reason <span className="audit-trail-data reason">{
classificationData.provisionalVariant_reason}</span></>);
filterPathogenicity = 'modified pathogenicity ' + classificationData.provisionalVariant_alteredClassification + ' with reason ' +
classificationData.provisionalVariant_reason;
} else if (classificationData.provisionalVariant_alteredClassification) {
displayPathogenicity = (<>modified pathogenicity <span className="audit-trail-data pathogenicity">{
classificationData.provisionalVariant_alteredClassification}</span></>);
filterPathogenicity = 'modified pathogenicity ' + classificationData.provisionalVariant_alteredClassification;
} else if (classificationData.provisionalVariant_reason) {
displayPathogenicity = (<>modified pathogenicity reason <span className="audit-trail-data reason">{
classificationData.provisionalVariant_reason}</span></>);
filterPathogenicity = 'modified pathogenicity reason ' + classificationData.provisionalVariant_reason;
}
if (classificationData.provisionalVariant_evidenceSummary) {
if (filterPathogenicity) {
andText = ' and '
}
displaySummary = (<>evidence summary <span className="audit-trail-data summary">{
classificationData.provisionalVariant_evidenceSummary}</span></>);
filterSummary = 'evidence summary ' + classificationData.provisionalVariant_evidenceSummary;
}
return ({
display: (<>{displayPathogenicity}{andText}{displaySummary}</>),
filter: filterPathogenicity + andText + filterSummary
});
}
/**
* Method to generate display/filter data for evidence
* @param {object} evidenceData - data related to evidence
* @param {string} evidenceCriteria - target criteria of non-case seg evidence
* @param {string} caseSegEvidenceKey - system key for source of case seg evidence
* @param {string} caseSegEvidenceType - system label for source of case seg evidence
* @param {string} caseSegEvidenceID - user-supplied name for source of case seg evidence
*/
function renderEvidence(evidenceData, evidenceCriteria, caseSegEvidenceKey, caseSegEvidenceType, caseSegEvidenceID) {
if (evidenceData && evidenceData.data) {
const evidenceSourceKeys = ['sourceInfo_metadata_lab_name', 'sourceInfo_metadata_institutional_affiliation',
'sourceInfo_metadata_department_affiliation', 'sourceInfo_metadata_name', 'sourceInfo_metadata_url', 'sourceInfo_metadata_variant_id',
'sourceInfo_metadata_source', 'sourceInfo_metadata_clinvar_gtr_labid', 'sourceInfo_metadata_clinvar_scv'];
const evidenceSourceLabels = {
'sourceInfo_metadata_lab_name': 'Laboratory Name',
'sourceInfo_metadata_institutional_affiliation': 'Institutional Affiliation',
'sourceInfo_metadata_department_affiliation': 'Department Affiliation',
'sourceInfo_metadata_name': 'Name of Database',
'sourceInfo_metadata_url': 'Database URL',
'sourceInfo_metadata_variant_id': 'Database Variant ID',
'sourceInfo_metadata_source': 'Describe Source',
'sourceInfo_metadata_clinvar_gtr_labid': 'ClinVar/GTR LabID',
'sourceInfo_metadata_clinvar_scv': 'ClinVar Submission Accession (SCV)'
};
const evidenceDataKeys = ['articles_0_pmid', 'evidenceDescription', 'sourceInfo_data_label', 'sourceInfo_data_is_disease_associated_with_probands',
'sourceInfo_data_proband_hpo_ids', 'sourceInfo_data_hpoData', 'sourceInfo_data_proband_free_text', 'sourceInfo_data_proband_hpo_comment',
'sourceInfo_data_num_probands_relevant_phenotype', 'sourceInfo_data_num_probands_relevant_phenotype_comment',
'sourceInfo_data_num_unaffected_family_with_variant', 'sourceInfo_data_num_unaffected_family_with_variant_comment',
'sourceInfo_data_num_control_with_variant', 'sourceInfo_data_num_total_controls', 'sourceInfo_data_num_control_with_variant_comment',
'sourceInfo_data_num_segregations', 'sourceInfo_data_num_segregations_comment', 'sourceInfo_data_num_non_segregations',
'sourceInfo_data_num_non_segregations_comment', 'sourceInfo_data_num_de_novo_unconfirmed', 'sourceInfo_data_num_de_novo_unconfirmed_comment',
'sourceInfo_data_num_de_novo_confirmed', 'sourceInfo_data_num_de_novo_confirmed_comment', 'sourceInfo_data_num_proband_hom',
'sourceInfo_data_num_proband_hom_comment', 'sourceInfo_data_num_proband_double_het', 'sourceInfo_data_num_proband_double_het_comment',
'sourceInfo_data_num_probands_with_alt_genetic_cause', 'sourceInfo_data_num_probands_with_alt_genetic_cause_comment',
'sourceInfo_data_num_probands_compound_het', 'sourceInfo_data_num_probands_compound_het_comment', 'sourceInfo_data_comments'];
const evidenceDataLabels = {
'articles_0_pmid': 'PMID',
'evidenceDescription': 'Evidence',
'sourceInfo_data_label': 'Label for case information',
'sourceInfo_data_is_disease_associated_with_probands': 'Disease associated with proband(s) (HPO) (Check here if unaffected)',
'sourceInfo_data_proband_hpo_ids': 'Phenotypic feature(s) associated with proband(s) (HPO) (PP4)',
'sourceInfo_data_hpoData': 'Terms for phenotypic feature(s) associated with proband(s):',
'sourceInfo_data_proband_free_text': 'Phenotypic feature(s) associated with proband(s) (free text) (PP4)',
'sourceInfo_data_proband_hpo_comment': 'Comment for Phenotypic feature(s) associated with proband(s)',
'sourceInfo_data_num_probands_relevant_phenotype': '# probands with relevant phenotype (PS4)',
'sourceInfo_data_num_probands_relevant_phenotype_comment': 'Comment for # probands with relevant phenotype (PS4)',
'sourceInfo_data_num_unaffected_family_with_variant': '# unaffected family members with variant (BS2)',
'sourceInfo_data_num_unaffected_family_with_variant_comment': 'Comment for # unaffected family members with variant (BS2)',
'sourceInfo_data_num_control_with_variant': '# control individuals with variant (BS2)',
'sourceInfo_data_num_total_controls': 'Total control individuals tested',
'sourceInfo_data_num_control_with_variant_comment': 'Comment for # control individuals with variant (BS2)',
'sourceInfo_data_num_segregations': '# segregations (PP1)',
'sourceInfo_data_num_segregations_comment': 'Comment for # segregations (PP1)',
'sourceInfo_data_num_non_segregations': '# non-segregations (BS4)',
'sourceInfo_data_num_non_segregations_comment': 'Comment for # non-segregations (BS4)',
'sourceInfo_data_num_de_novo_unconfirmed': '# proband de novo occurrences (with unknown or no parental identity confirmation) (PM6)',
'sourceInfo_data_num_de_novo_unconfirmed_comment': 'Comment for # proband de novo occurrences (with unknown or no parental identity confirmation) (PM6)',
'sourceInfo_data_num_de_novo_confirmed': '# proband de novo occurrences (with parental identity confirmation) (PS2)',
'sourceInfo_data_num_de_novo_confirmed_comment': 'Comment for # proband de novo occurrences (with parental identity confirmation) (PS2)',
'sourceInfo_data_num_proband_hom': '# proband homozygous occurrences (PM3)',
'sourceInfo_data_num_proband_hom_comment': 'Comment for # proband homozygous occurrences (PM3)',
'sourceInfo_data_num_proband_double_het': '# proband double het occurrences (BP2)',
'sourceInfo_data_num_proband_double_het_comment': 'Comment for # proband double het occurrences (BP2)',
'sourceInfo_data_num_probands_with_alt_genetic_cause': '# probands with alternative genetic cause (BP5)',
'sourceInfo_data_num_probands_with_alt_genetic_cause_comment': 'Comment for # probands with alternative genetic cause (BP5)',
'sourceInfo_data_num_probands_compound_het': '# proband compound het occurrences (PM3)',
'sourceInfo_data_num_probands_compound_het_comment': 'Comment for # proband compound het occurrences (PM3)',
'sourceInfo_data_comments': 'Additional comments'
};
const startText = evidenceData.action === 'create' ? 'Created'
: evidenceData.action === 'add' ? 'Added to'
: evidenceData.action === 'update' ? 'Updated'
: evidenceData.action === 'delete' ? 'Removed from'
: '';
const displayType = caseSegEvidenceType ? (<> <span className="audit-trail-data evidence-type">{caseSegEvidenceType}</span> evidence</>)
: evidenceData.data.evidenceCriteria || evidenceCriteria ? (<> <span className="audit-trail-data evidence-type">PMID</span> evidence for</>)
: ' evidence';
const filterType = caseSegEvidenceType ? ' ' + caseSegEvidenceType + ' evidence'
: evidenceData.data.evidenceCriteria || evidenceCriteria ? ' PMID evidence for'
: ' evidence';
const displayID = caseSegEvidenceID ? (<> <span className="audit-trail-data evidence-id">{caseSegEvidenceID}</span></>)
: evidenceData.data.evidenceCriteria ? (<> <span className="audit-trail-data evidence-id">{evidenceData.data.evidenceCriteria}</span></>)
: evidenceCriteria ? (<> <span className="audit-trail-data evidence-id">{evidenceCriteria}</span></>)
: '';
const filterID = caseSegEvidenceID ? ' ' + caseSegEvidenceID
: evidenceData.data.evidenceCriteria ? ' ' + evidenceData.data.evidenceCriteria
: evidenceCriteria ? ' ' + evidenceCriteria
: '';
const phraseText = evidenceData.action === 'create' ? ' with'
: evidenceData.action === 'update' ? ' to'
: '';
let displayTable = '';
let filterTable = '';
// Add evidence source information to table
evidenceSourceKeys.forEach(evidenceSourceKey => {
if (evidenceData.data[evidenceSourceKey]) {
// Alternate source label for Research Lab evidence
const labelText = caseSegEvidenceKey === 'research_lab' && evidenceSourceKey === 'sourceInfo_metadata_department_affiliation'
? 'Department Affiliation/Principal Investigator' : evidenceSourceLabels[evidenceSourceKey];
displayTable = (<>{displayTable}<div className="audit-trail-table-row"><div className="audit-trail-table-cell label">{
labelText}</div><div className="audit-trail-table-cell audit-trail-data">{evidenceData.data[evidenceSourceKey]}</div></div></>);
filterTable = filterTable + ' ' + labelText + ' ' + evidenceData.data[evidenceSourceKey];
}
});
// Add evidence data to table
evidenceDataKeys.forEach(evidenceDataKey => {
if (evidenceData.data[evidenceDataKey]) {
// Special handling for HPO terms array
if (evidenceDataKey === 'sourceInfo_data_hpoData') {
let hpoDataText = '';
if (Array.isArray(evidenceData.data[evidenceDataKey])) {
evidenceData.data[evidenceDataKey].forEach((hpoDataElement, hpoDataIndex) => {
if (hpoDataElement) {
const commaText = hpoDataIndex > 0 ? ', ' : '';
if (hpoDataElement.hpoTerm && hpoDataElement.hpoId) {
hpoDataText = hpoDataText + commaText + hpoDataElement.hpoTerm + ' (' + hpoDataElement.hpoId + ')';
} else if (hpoDataElement.hpoTerm) {
hpoDataText = hpoDataText + commaText + hpoDataElement.hpoTerm;
} else if (hpoDataElement.hpoId) {
hpoDataText = hpoDataText + commaText + hpoDataElement.hpoId;
}
}
});
}
if (hpoDataText) {
displayTable = (<>{displayTable}<div className="audit-trail-table-row"><div className="audit-trail-table-cell label">{
evidenceDataLabels[evidenceDataKey]}</div><div className="audit-trail-table-cell audit-trail-data">{hpoDataText}</div></div></>);
filterTable = filterTable + ' ' + evidenceDataLabels[evidenceDataKey] + ' ' + hpoDataText;
}
// Special handling for checkbox boolean
} else if (evidenceDataKey === 'sourceInfo_data_is_disease_associated_with_probands') {
const checkedText = evidenceData.data[evidenceDataKey] ? 'Checked' : 'Not Checked';
displayTable = (<>{displayTable}<div className="audit-trail-table-row"><div className="audit-trail-table-cell label">{
evidenceDataLabels[evidenceDataKey]}</div><div className="audit-trail-table-cell audit-trail-data">{checkedText}</div></div></>);
filterTable = filterTable + ' ' + evidenceDataLabels[evidenceDataKey] + ' ' + checkedText;
} else {
displayTable = (<>{displayTable}<div className="audit-trail-table-row"><div className="audit-trail-table-cell label">{
evidenceDataLabels[evidenceDataKey]}</div><div className="audit-trail-table-cell audit-trail-data">{evidenceData.data[evidenceDataKey]}</div></div></>);
filterTable = filterTable + ' ' + evidenceDataLabels[evidenceDataKey] + ' ' + evidenceData.data[evidenceDataKey];
}
}
});
if (displayTable) {
displayTable = (<div className="audit-trail-table">{displayTable}</div>);
}
return ({
display: (<><span>{startText}{displayType}{displayID}{phraseText}:</span>{displayTable}</>),
filter: startText + filterType + filterID + phraseText + ':' + filterTable
});
}
}
/**
* Method to generate display/filter data for an evaluation
* @param {object} evaluationData - data related to an evaluation
* @param {string} evaluationCriteria - target criteria of an evaluation
*/
function renderEvaluation(evaluationData, evaluationCriteria) {
if (evaluationData && evaluationData.data && (evaluationData.data.criteria || evaluationCriteria)) {
const textCriteria = evaluationData.data.criteria ? evaluationData.data.criteria : evaluationCriteria;
if (evaluationData.action === 'create') {
const statusText = evaluationData.data.criteriaStatus ? ' as ' : '';
const displayStatus = evaluationData.data.criteriaStatus ? (<span className="audit-trail-data status">{
evaluationData.data.criteriaStatus}</span>) : '';
const filterStatus = evaluationData.data.criteriaStatus ? evaluationData.data.criteriaStatus : '';
const explanationText = evaluationData.data.explanation ? ' with explanation ' : '';
const displayExplanation = evaluationData.data.explanation ? (<span className="audit-trail-data explanation">{
evaluationData.data.explanation}</span>) : '';
const filterExplanation = evaluationData.data.explanation ? evaluationData.data.explanation : '';
return ({
display : (<>Created <span className="audit-trail-data criteria">{textCriteria}</span> evaluation{
statusText}{displayStatus}{explanationText}{displayExplanation}</>),
filter: 'Created ' + textCriteria + ' evaluation' + statusText + filterStatus + explanationText + filterExplanation
});
} else {
const startText = evaluationData.action === 'add' ? 'Added to '
: evaluationData.action === 'update' ? 'Updated '
: evaluationData.action === 'delete' ? 'Removed from '
: '';
const toText = evaluationData.action === 'update' ? ' to' : '';
if (evaluationData.data.criteriaStatus && evaluationData.data.explanation) {
return ({
display : (<>{startText}<span className="audit-trail-data criteria">{textCriteria}</span>{toText} evaluation <span
className="audit-trail-data status">{evaluationData.data.criteriaStatus}</span> and explanation <span
className="audit-trail-data explanation">{evaluationData.data.explanation}</span></>),
filter: startText + textCriteria + toText + ' evaluation ' + evaluationData.data.criteriaStatus + ' and explanation ' + evaluationData.data.explanation
});
} else if (evaluationData.data.criteriaStatus) {
return ({
display : (<>{startText}<span className="audit-trail-data criteria">{textCriteria}</span>{toText} evaluation <span
className="audit-trail-data status">{evaluationData.data.criteriaStatus}</span></>),
filter: startText + textCriteria + toText + ' evaluation ' + evaluationData.data.criteriaStatus
});
} else if (evaluationData.data.explanation) {
return ({
display : (<>{startText}<span className="audit-trail-data criteria">{textCriteria}</span>{toText} explanation <span
className="audit-trail-data explanation">{evaluationData.data.explanation}</span></>),
filter: startText + textCriteria + toText + ' explanation ' + evaluationData.data.explanation
});
}
}
}
return ({
display: '',
filter: ''
});
}
/**
* Method to generate display/filter data for an interpretation
* @param {object} interpretationData - data related to an interpretation
*/
function renderInterpretation(interpretationData) {
if (interpretationData && interpretationData.data) {
if (interpretationData.action === 'create') {
const variantData = renderVariant(interpretationData.data.variant);
return ({
display: (<span>Created interpretation for {variantData.display}</span>),
filter: 'Created interpretation for ' + variantData.filter
});
} else {
let displayCombined = '';
let filterCombined = '';
const startText = interpretationData.action === 'add' ? 'Added to interpretation '
: interpretationData.action === 'update' ? 'Updated interpretation '
: interpretationData.action === 'delete' ? 'Removed from interpretation '
: '';
if (interpretationData.data.disease || interpretationData.data.diseaseTerm) {
const diseaseData = renderDisease(interpretationData.data.disease, interpretationData.data.diseaseTerm);
displayCombined = (<>{startText}{diseaseData.display}</>);
filterCombined = startText + diseaseData.filter;
}
if (interpretationData.data.cspec) {
const cspecData = renderCspec(interpretationData.data.cspec);
displayCombined = (<>{startText}{cspecData.display}</>);
filterCombined = startText + cspecData.filter;
}
if (interpretationData.data.modeInheritance || interpretationData.data.modeInheritanceAdjective) {
const moiData = renderMOI(interpretationData.data.modeInheritance, interpretationData.data.modeInheritanceAdjective);
if (filterCombined || displayCombined) {
displayCombined = (<>{displayCombined}<br />{startText}{moiData.display}</>);
filterCombined = filterCombined + ' ' + startText + moiData.filter;
} else {
displayCombined = (<>{startText}{moiData.display}</>);
filterCombined = startText + moiData.filter;
}
}
if (interpretationData.data.provisionalVariant_alteredClassification || interpretationData.data.provisionalVariant_reason || interpretationData.data.provisionalVariant_evidenceSummary) {
const classificationData = renderClassification(interpretationData.data);
if (filterCombined || displayCombined) {
displayCombined = (<>{displayCombined}<br />{startText}{classificationData.display}</>);
filterCombined = filterCombined + ' ' + startText + classificationData.filter;
} else {
displayCombined = (<>{startText}{classificationData.display}</>);
filterCombined = startText + classificationData.filter;
}
} else if (interpretationData.action === 'update' && interpretationData.data.provisionalVariant_classificationStatus) {
if (filterCombined || displayCombined) {
displayCombined = (<>{displayCombined}<br />{startText}to status <span className="audit-trail-data status">{interpretationData.data.provisionalVariant_classificationStatus}</span></>);
filterCombined = filterCombined + ' ' + startText + 'to status ' + interpretationData.data.provisionalVariant_classificationStatus;
} else {
displayCombined = (<>{startText}to status <span className="audit-trail-data status">{interpretationData.data.provisionalVariant_classificationStatus}</span></>);
filterCombined = startText + 'to status ' + interpretationData.data.provisionalVariant_classificationStatus;
}
}
if (displayCombined) {
displayCombined = (<span>{displayCombined}</span>);
}
return ({
display: displayCombined,
filter: filterCombined
});
}
}
return ({
display: '',
filter: ''
});
}
/**
* Method to generate display/filter data for an event
* @param {object} eventData - data related to an event
*/
function renderEvent(eventData) {
if (eventData.item_type && eventData.events) {
return eventData.events.map(actionElement => {
switch (eventData.item_type) {
case 'curated-evidence':
return (renderEvidence(actionElement, eventData.evidenceCriteria, eventData.case_seg_evidence_key,
eventData.case_seg_evidence_type, eventData.case_seg_evidence_id));
break;
case 'evaluation':
return (renderEvaluation(actionElement, eventData.criteria));
break;
case 'interpretation':
return (renderInterpretation(actionElement));
break;
default:
return ({
display: '',
filter: ''
});
break;
}
});
}
return ([{
display: '',
filter: ''
}]);
}
return (
<div className="audit-trail">
<h3 className="audit-trail-title">Variant Interpretation Audit Trail
<Popover
className="audit-trail-tooltip ml-1"
placement="top"
popoverClassName="popover-bg-black"
trigger={['hover', 'focus']}
triggerComponent={<i className="icon icon-info-circle" />}
content={
<span className="text-light">
This table contains the complete history of curation actions for this interpretation record.
It will not include actions from other interpretations for this same variant.
</span>
}
/>
</h3>
{historyData && historyData.length > 0
? <>
<div className="audit-trail-filter">
<TableFilters
preGlobalFilteredRows={preGlobalFilteredRows}
globalFilter={globalFilter}
setGlobalFilter={setGlobalFilter}
hideStatusFilters={true}
/>
</div>
<TableContent
getTableProps={getTableProps}
headerGroups={headerGroups}
getTableBodyProps={getTableBodyProps}
page={page}
prepareRow={prepareRow}
/>
<Pagination
pageIndex={pageIndex}
pageOptions={pageOptions}
gotoPage={gotoPage}
canPreviousPage={canPreviousPage}
previousPage={previousPage}
nextPage={nextPage}
canNextPage={canNextPage}
pageCount={pageCount}
pageSize={pageSize}
setPageSize={setPageSize}
pageSizeOptions={pageSizeOptions}
/>
</>
: !isLoading
? <p className="audit-trail-clear">No historical data found.</p>
: <div className="audit-trail-clear text-center pt-3"><LoadingSpinner /></div>
}
</div>
)
}
const mapStateToProps = state => ({
auth: state.auth,
variant: state.variant,
});
export default connect(mapStateToProps)(AuditTrail);
| 46.029894 | 196 | 0.642176 |
37f48dcd1d86bc1c2fb55abf01f97141441619f6 | 22,490 | js | JavaScript | docs/assets/js/46.9bbdb287.js | moxiworks/mds | 138be825212f18b8edd88c4f763e83a50ece124e | [
"MIT"
] | 2 | 2021-06-22T19:07:13.000Z | 2022-01-06T00:59:13.000Z | docs/assets/js/46.9bbdb287.js | moxiworks/mds | 138be825212f18b8edd88c4f763e83a50ece124e | [
"MIT"
] | 19 | 2021-05-24T17:30:24.000Z | 2022-03-18T15:34:40.000Z | docs/assets/js/46.9bbdb287.js | moxiworks/mds | 138be825212f18b8edd88c4f763e83a50ece124e | [
"MIT"
] | 3 | 2021-05-17T19:54:41.000Z | 2022-03-23T17:12:25.000Z | (window.webpackJsonp=window.webpackJsonp||[]).push([[46],{454:function(t,o,e){"use strict";e.r(o);var r=e(46),a=Object(r.a)({},(function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"effects"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#effects"}},[t._v("#")]),t._v(" Effects")]),t._v(" "),e("h2",{attrs:{id:"box-shadow"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#box-shadow"}},[t._v("#")]),t._v(" Box Shadow")]),t._v(" "),e("p",[t._v("These values correspond to "),e("RouterLink",{attrs:{to:"/css-documentation/elevations.html"}},[t._v("Elevations")]),t._v(".")],1),t._v(" "),e("section",{staticClass:"mds"},[e("table",{staticClass:"w-full text-left border-collapse"},[e("thead",[e("tr",[e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pr-2 border-b border-gray-200"},[t._v("Class")])]),e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pl-2 border-b border-gray-200"},[t._v("Properties")])])])]),e("tbody",{staticClass:"align-baseline"},[e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap"},[t._v("*")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre"},[t._v("--tw-shadow: 0 0 #0000;")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-0")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-1")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 0px 2px rgba(0, 0, 0, 0.04), 0px 2px 2px rgba(0, 0, 0, 0.02), 0px 1px 3px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-2")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04), 0px 3px 4px rgba(0, 0, 0, 0.02), 0px 1px 5px rgba(0, 0, 0, 0.04);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-3")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 3px 3px rgba(0, 0, 0, 0.06), 0px 3px 4px rgba(0, 0, 0, 0.04), 0px 1px 8px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-4")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 2px 4px rgba(0, 0, 0, 0.06), 0px 4px 5px rgba(0, 0, 0, 0.04), 0px 1px 10px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-6")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 6px 10px rgba(0, 0, 0, 0.06), 0px 1px 18px rgba(0, 0, 0, 0.04), 0px 3px 5px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-8")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 8px 10px rgba(0, 0, 0, 0.06), 0px 3px 14px rgba(0, 0, 0, 0.04), 0px 4px 5px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-9")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 9px 12px rgba(0, 0, 0, 0.06), 0px 3px 16px rgba(0, 0, 0, 0.04), 0px 5px 6px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-12")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 12px 17px rgba(0, 0, 0, 0.04), 0px 5px 22px rgba(0, 0, 0, 0.02), 0px 7px 8px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-16")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 6px 30px rgba(0, 0, 0, 0.02), 0px 8px 10px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])]),t._v(" "),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("shadow-24")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("--tw-shadow: 0px 24px 38px rgba(0, 0, 0, 0.04), 0px 9px 46px rgba(0, 0, 0, 0.02), 0px 11px 15px rgba(0, 0, 0, 0.06);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);")])])])])]),t._v(" "),e("h2",{attrs:{id:"opacity"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#opacity"}},[t._v("#")]),t._v(" Opacity")]),t._v(" "),e("table",{staticClass:"w-full text-left border-collapse"},[e("thead",[e("tr",[e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pr-2 border-b border-gray-200"},[t._v("Class")])]),e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pl-2 border-b border-gray-200"},[t._v("Properties")])])])]),e("tbody",{staticClass:"align-baseline"},[e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap"},[t._v("opacity-0")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre"},[t._v("opacity: 0;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-5")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.05;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-10")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.1;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-20")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.2;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-25")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.25;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-30")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.3;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-40")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.4;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-50")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.5;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-60")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.6;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-70")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.7;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-75")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.75;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-80")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.8;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-90")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.9;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-95")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 0.95;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("opacity-100")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("opacity: 1;")])])])]),t._v(" "),e("h2",{attrs:{id:"mix-blend-mode"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#mix-blend-mode"}},[t._v("#")]),t._v(" Mix Blend Mode")]),t._v(" "),e("table",{staticClass:"w-full text-left border-collapse"},[e("thead",[e("tr",[e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pr-2 border-b border-gray-200"},[t._v("Class")])]),e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pl-2 border-b border-gray-200"},[t._v("Properties")])])])]),e("tbody",{staticClass:"align-baseline"},[e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap"},[t._v("mix-blend-normal")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre"},[t._v("mix-blend-mode: normal;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-multiply")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: multiply;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-screen")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: screen;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-overlay")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: overlay;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-darken")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: darken;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-lighten")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: lighten;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-color-dodge")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: color-dodge;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-color-burn")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: color-burn;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-hard-light")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: hard-light;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-soft-light")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: soft-light;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-difference")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: difference;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-exclusion")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: exclusion;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-hue")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: hue;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-saturation")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: saturation;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-color")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: color;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("mix-blend-luminosity")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("mix-blend-mode: luminosity;")])])])]),t._v(" "),e("h2",{attrs:{id:"background-blend-mode"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#background-blend-mode"}},[t._v("#")]),t._v(" Background Blend Mode")]),t._v(" "),e("table",{staticClass:"w-full text-left border-collapse"},[e("thead",[e("tr",[e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pr-2 border-b border-gray-200"},[t._v("Class")])]),e("th",{staticClass:"z-20 sticky top-0 text-4 font-semibold text-gray-600 bg-white p-0"},[e("div",{staticClass:"pb-2 pl-2 border-b border-gray-200"},[t._v("Properties")])])])]),e("tbody",{staticClass:"align-baseline"},[e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap"},[t._v("bg-blend-normal")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre"},[t._v("background-blend-mode: normal;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-multiply")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: multiply;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-screen")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: screen;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-overlay")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: overlay;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-darken")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: darken;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-lighten")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: lighten;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-color-dodge")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: color-dodge;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-color-burn")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: color-burn;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-hard-light")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: hard-light;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-soft-light")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: soft-light;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-difference")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: difference;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-exclusion")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: exclusion;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-hue")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: hue;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-saturation")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: saturation;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-color")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: color;")])]),e("tr",[e("td",{staticClass:"py-2 pr-2 font-mono caption1 text-violet-600 whitespace-nowrap border-t border-gray-200"},[t._v("bg-blend-luminosity")]),e("td",{staticClass:"py-2 pl-2 font-mono caption1 text-light-blue-600 whitespace-pre border-t border-gray-200"},[t._v("background-blend-mode: luminosity;")])])])])])}),[],!1,null,null,null);o.default=a.exports}}]); | 22,490 | 22,490 | 0.688884 |
37f5860589a4147a51ff6f8833ca1b37e71f5e2a | 5,604 | js | JavaScript | source/code/boom/entity/entity.js | sivertsenstian/boom | b03f0e876fd137b4e066692a2a3c57d2141e3e9f | [
"MIT"
] | null | null | null | source/code/boom/entity/entity.js | sivertsenstian/boom | b03f0e876fd137b4e066692a2a3c57d2141e3e9f | [
"MIT"
] | 64 | 2015-01-27T06:52:53.000Z | 2015-03-01T21:25:35.000Z | source/code/boom/entity/entity.js | sivertsenstian/boom | b03f0e876fd137b4e066692a2a3c57d2141e3e9f | [
"MIT"
] | null | null | null | Boom.Entities = Boom.Entities || {};
Boom.MergedEntities = Boom.MergedEntities || [];
Boom.Collidables = Boom.Collidables || [];
Boom.Entity = function( params ){
params = params || {};
this.id = Boom.guid();
this.name = params.name || "EntityName";
this.faction = params.faction || Boom.Constants.HOSTILE;
this.boundingBox = params.boundingBox || new THREE.Vector3(Boom.Constants.World.SIZE, Boom.Constants.World.SIZE, Boom.Constants.World.SIZE);
this.__addToScene = params.hasOwnProperty('addToScene') ? params.addToScene : true; //Defaults to new
this.__isStatic = params.hasOwnProperty('is_static') ? params.is_static : true; //Defaults to static
this.__isMerged = params.hasOwnProperty('is_merged') ? params.is_merged : false; //Defaults to un-merged
this.__singular = params.hasOwnProperty('is_singular') ? params.is_singular : false; //Defaults to not singular (defines a static entity not to be merged but added to scene solo)
this.__dispose = params.dispose || false;
this.__local = params.local || false;
this.__triggerable = params.triggerable || false;
this.message_sendt = false;
//this.message = ? //TODO: IMPLEMENT MISSING MESSAGE THAT THROWS EXCEPTION OR TRIGGERS SOMETHING DEBUGGABLE
this.components = {};
this.children = [];
this.score = params.hasOwnProperty('score') ? params.score : 10;
this.init();
};
Boom.Entity.prototype = {
constructor: Boom.Entity,
init: function(){
try{
Boom.Entities[this.id] = this;
}
catch( error ){
Boom.handleError( error , 'Boom.Entity');
}
},
load: function(){
for (var component in this.components) {
if (!this.components.hasOwnProperty(component)) {
continue;
}
this.components[component].load();
}
},
update: function(){
for (var component in this.components) {
if (!this.components.hasOwnProperty(component)) {
continue;
}
this.components[component].update();
}
},
send: function( message ){
try{
for (var component in this.components) {
if (!this.components.hasOwnProperty(component)) {
continue;
}
if (!message.hasOwnProperty('receiver')){
throw Boom.Exceptions.NoMessageReceiverException;
}
if( message.receiver === Boom.Constants.Message.ALL || this.components[component].type === message.receiver){
this.components[component].receive( message );
}
}
}
catch( error ){
Boom.handleError( error , 'Boom.Entity.send()');
}
},
add: function( other, override ){
this.children.push( other );
var this_physical = this.getObjectComponent();
var other_physical = other.getObjectComponent();
if( this_physical && other_physical ){
var parent = override || this_physical.object;
parent.add( other_physical.object );
}
},
remove: function( other, override ){
for(var i = 0; i < this.children.length; i++ ){
if( this.children[i].id === other.id ){
var this_physical = this.getObjectComponent();
var other_physical = other.getObjectComponent();
if( this_physical && other_physical ){
var parent = override || this_physical.object;
parent.remove( other_physical.object );
}
this.children.splice(i, 1);
}
}
},
child: function( id ){
for(var i = 0; i < this.children.length; i++ ){
if( this.children[i].id === id ){
return this.children[i];
}
}
return false;
},
dispose: function(){
if(!this.isDisposed()){
this.__dispose = true;
this.process();
//Dispose all components of this entity
for (var component in this.components) {
if (!this.components.hasOwnProperty(component)) {
continue;
}
this.components[component].dispose();
}
}
},
isDisposed: function(){
return this.__dispose;
},
//Returns entity-component based on type or name (first of its kind)
getComponent: function( c ){
for (var component in this.components) {
if (!this.components.hasOwnProperty(component)) {
continue;
}
if( this.components[component].type === c || this.components[component].name === c){
return this.components[component];
}
}
return false;
},
//Returns a component that has an 'object'-property that is a THREE.Object3D-object,
//expects there to be only one such component defined on an entity
//TODO: CHECK THIS IN COMPONENT INIT AND THROW EXCEPTION IF A SECOND IS ADDED
getObjectComponent: function(){
for (var component in this.components) {
if (!this.components.hasOwnProperty(component)) {
continue;
}
if( this.components[component].type === Boom.Constants.Component.TYPE.PHYSICAL ||
this.components[component].type === Boom.Constants.Component.TYPE.LIGHT){
return this.components[component];
}
}
return false;
},
//If this entity has a passable message, it is fetched
getMessage: function(){
if(!this.message_sendt && this.message){
this.message_sendt = true;
this.dispose(); //TODO: MOVE THIS ??
return this.message;
}
return false;
},
//Registers the entity as a player-used entity
process: function(){
Boom.Constants.UI.PLAYER.SCORE += this.score;
},
//Adds entity to world-total in statistics
register: function(){
//Empty - no stats to process
},
trigger: function(){
throw Boom.NotTriggerableEntityException;//TODO: LOG HERE ?
}
};
| 30.961326 | 180 | 0.639008 |
377448877aec35bab484baca4fde7e43aceb6250 | 982 | js | JavaScript | Mozart/CMSAdmin/TemplateManage/scripts/autoComplete.js | zhenghua75/WeiXinEasy | f21f0f0788f4792a1e30ec4e8ec190984ca13713 | [
"Apache-2.0"
] | 2 | 2019-07-09T05:12:52.000Z | 2021-02-22T20:00:51.000Z | Mozart/CMSAdmin/TemplateManage/scripts/autoComplete.js | zhenghua75/WeiXinEasy | f21f0f0788f4792a1e30ec4e8ec190984ca13713 | [
"Apache-2.0"
] | null | null | null | Mozart/CMSAdmin/TemplateManage/scripts/autoComplete.js | zhenghua75/WeiXinEasy | f21f0f0788f4792a1e30ec4e8ec190984ca13713 | [
"Apache-2.0"
] | null | null | null |
var AutoComplete = {
bind: function (inputId, sqlId, length, row) {
$("#" + inputId).autocomplete(
{
minLength: length || 2,
source: function (request, response) {
$.ajax({
url: "/auto/auto_complete.action",
dataType: "json",
data: {
maxRows: row || 12,
sqlId: sqlId,
term: request.term
},
success: function (data) {
response($.map(data.data, function (item) {
return {
label: item.label,
value: item.value
}
}));
}
});
}
});
}
} | 31.677419 | 71 | 0.284114 |
3775c8edb61d5b6a5c0cd2cb0e7d59d0ac79fbc7 | 4,271 | js | JavaScript | src/components/ModalMenu.js | NeuroTechX/neurodoro | 34f1620c0c85cf49f379ce60303ef0721070ecfd | [
"MIT"
] | 47 | 2017-03-28T17:19:21.000Z | 2022-01-26T14:37:39.000Z | src/components/ModalMenu.js | NeuroTechX/neurodoro | 34f1620c0c85cf49f379ce60303ef0721070ecfd | [
"MIT"
] | 28 | 2017-03-28T01:27:04.000Z | 2020-08-02T12:56:39.000Z | src/components/ModalMenu.js | NeuroTechX/neurodoro | 34f1620c0c85cf49f379ce60303ef0721070ecfd | [
"MIT"
] | 6 | 2017-04-03T22:24:40.000Z | 2018-11-20T12:37:47.000Z | // ModalMenu.js
// A popup modal menu
import React, { Component } from "react";
import { Text, View, Modal, Slider, Switch } from "react-native";
import { MediaQueryStyleSheet } from "react-native-responsive";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import { setEncouragementEnabled } from "../redux/actions";
import Button from "../components/Button";
import * as colors from "../styles/colors";
function mapStateToProps(state) {
return {
encouragementEnabled: state.encouragementEnabled
};
}
// Binds actions to component's props
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{
setEncouragementEnabled
},
dispatch
);
}
class ModalMenu extends Component {
constructor(props) {
super(props);
this.state = {
workTime: 25,
breakTime: 5
};
}
render() {
return (
<Modal
animationType={"fade"}
transparent={true}
onRequestClose={() =>
this.props.onClose(this.state.workTime, this.state.breakTime)}
visible={this.props.visible}
>
<View style={styles.modalBackground}>
<View style={styles.modalInnerContainer}>
<Text style={styles.modalTitle}>Settings</Text>
<Text style={styles.modalText}>Set your target work duration:</Text>
<Text style={styles.modalText}>
{this.state.workTime}
</Text>
<Slider
maximumValue={60}
step={1}
value={this.state.workTime}
onSlidingComplete={value => this.setState({ workTime: value })}
/>
<Text style={styles.modalText}>Set your break duration</Text>
<Text style={styles.modalText}>
{this.state.breakTime}
</Text>
<Slider
maximumValue={60}
step={1}
value={this.state.breakTime}
onSlidingComplete={value => this.setState({ breakTime: value })}
/>
<View style={styles.switchContainer}>
<Text style={styles.modalText}>Enable encouraging messages</Text>
<Switch
value={this.props.encouragementEnabled}
onValueChange={bool => this.props.setEncouragementEnabled(bool)}
/>
</View>
<View style={styles.buttonContainer}>
<Button
fontSize={15}
onPress={() =>
this.props.onClose(this.state.workTime, this.state.breakTime)}
>
Close Menu
</Button>
</View>
</View>
</View>
</Modal>
);
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ModalMenu);
const styles = MediaQueryStyleSheet.create(
// Base styles
{
modalBackground: {
flex: 1,
justifyContent: "center",
alignItems: "stretch",
padding: 20,
backgroundColor: colors.tomato
},
modalText: {
fontFamily: "OpenSans-Regular",
fontSize: 15,
margin: 15,
color: colors.grey
},
modalTitle: {
color: colors.tomato,
fontFamily: "YanoneKaffeesatz-Regular",
fontSize: 30
},
modalInnerContainer: {
flex: 1,
alignItems: "stretch",
backgroundColor: "white",
padding: 20
},
modal: {
flex: 0.25,
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
backgroundColor: "white"
},
buttonContainer: {
margin: 20,
flex: 1,
justifyContent: "center"
},
switchContainer: {
alignItems: 'center',
flex: 1,
flexDirection: 'row',
}
},
// Responsive styles
{
"@media (min-device-height: 700)": {
modalBackground: {
backgroundColor: "rgba(12, 89, 128, 0.25)",
justifyContent: "flex-end",
paddingBottom: 50
},
modalTitle: {
fontSize: 30
},
modalText: {
fontSize: 18
}
},
"@media (min-device-height: 1000)": {
modalBackground: {
paddingBottom: 100,
paddingLeft: 120,
paddingRight: 120
}
}
}
);
| 23.860335 | 80 | 0.556076 |
3775de65748bace5db7860e564b28fba55eb9595 | 504 | js | JavaScript | client/dev/js/container/reducers.js | rachelylim/simple-mgmt | a8be635b80a1826e22137b09254977f603cb2183 | [
"MIT"
] | null | null | null | client/dev/js/container/reducers.js | rachelylim/simple-mgmt | a8be635b80a1826e22137b09254977f603cb2183 | [
"MIT"
] | null | null | null | client/dev/js/container/reducers.js | rachelylim/simple-mgmt | a8be635b80a1826e22137b09254977f603cb2183 | [
"MIT"
] | null | null | null | import {combineReducers} from 'redux';
import { actionTypes } from './actions';
const tasks = (state = [], action) => {
switch (action.type) {
case actionTypes.SET_TASKS:
return [...action.tasks];
default:
return state;
}
}
const filter = (state = 'all', action) => {
switch (action.type) {
case actionTypes.SET_FILTER:
return action.filter;
default:
return state;
}
}
const allReducers = combineReducers({ filter, tasks });
export default allReducers
| 20.16 | 55 | 0.638889 |
3776572361bb2b14d2f9994ea51099a75f5b28a4 | 175 | js | JavaScript | assets/js/index.js | 3DE-io/ractive-live | f91583e14746f20e1a69b5424c3cf3f0c0887171 | [
"MIT"
] | 1 | 2015-07-30T18:25:44.000Z | 2015-07-30T18:25:44.000Z | assets/js/index.js | 3DE-io/ractive-live | f91583e14746f20e1a69b5424c3cf3f0c0887171 | [
"MIT"
] | null | null | null | assets/js/index.js | 3DE-io/ractive-live | f91583e14746f20e1a69b5424c3cf3f0c0887171 | [
"MIT"
] | null | null | null | import setup from './setup-ractive';
import App from './app';
// As of 0.7 default for debug is true
// Ractive.defaults.debug = false;
new App({
el: document.body
});
| 15.909091 | 38 | 0.657143 |
377663143c6907ec8be23c51d37d32e74ef8b671 | 679 | js | JavaScript | app/js/fp/canvas/tap_label/main.js | Daniel1984/60fps | 9fa393f7cc7b6310301976366a1012bfd407f635 | [
"MIT"
] | null | null | null | app/js/fp/canvas/tap_label/main.js | Daniel1984/60fps | 9fa393f7cc7b6310301976366a1012bfd407f635 | [
"MIT"
] | 2 | 2015-01-12T18:01:16.000Z | 2015-01-14T13:56:05.000Z | app/js/fp/canvas/tap_label/main.js | Daniel1984/60fps | 9fa393f7cc7b6310301976366a1012bfd407f635 | [
"MIT"
] | null | null | null | (function() {
'use strict';
var PIXI = require('pixi.js');
function TapRightLabel(tapType, options) {
this.options = options || {};
this.texture = PIXI.Texture.fromFrame(FP.UI_PATH + tapType + '.png');
PIXI.Sprite.call(this, this.texture);
this.setupDimention();
}
TapRightLabel.prototype = Object.create(PIXI.Sprite.prototype);
TapRightLabel.prototype.constructor = TapRightLabel;
TapRightLabel.prototype.setupDimention = function() {
this.position.y = this.options.posY || Math.floor(FP.getHeight() / 2 + this.height);
this.position.x = Math.floor(FP.getWidth() / 2 - (this.width + 30));
};
module.exports = TapRightLabel;
})();
| 29.521739 | 88 | 0.675994 |
377780d7667a498785dada184d141242e2728ab6 | 48 | js | JavaScript | src/core/constants.js | ryuzaki01/Interview-Frontend-Web | a93b7fdf17e8c42659336ae14d272d5d85660799 | [
"Info-ZIP"
] | null | null | null | src/core/constants.js | ryuzaki01/Interview-Frontend-Web | a93b7fdf17e8c42659336ae14d272d5d85660799 | [
"Info-ZIP"
] | null | null | null | src/core/constants.js | ryuzaki01/Interview-Frontend-Web | a93b7fdf17e8c42659336ae14d272d5d85660799 | [
"Info-ZIP"
] | null | null | null | export const MOBILE_DEVICE = ['android', 'ios']; | 48 | 48 | 0.708333 |
3777c880356f3bf7e637440439e6fa7503bfff19 | 28,990 | js | JavaScript | src/cli/static/js/main.38d7b230.chunk.js | zeburek/xunit-viewer | 0182815894670f4e3c4a8f2f8d76497ff07e0ce2 | [
"MIT"
] | null | null | null | src/cli/static/js/main.38d7b230.chunk.js | zeburek/xunit-viewer | 0182815894670f4e3c4a8f2f8d76497ff07e0ce2 | [
"MIT"
] | null | null | null | src/cli/static/js/main.38d7b230.chunk.js | zeburek/xunit-viewer | 0182815894670f4e3c4a8f2f8d76497ff07e0ce2 | [
"MIT"
] | null | null | null | (this["webpackJsonpxunit-viewer"]=this["webpackJsonpxunit-viewer"]||[]).push([[0],{128:function(e,t,a){e.exports=a(280)},136:function(e,t,a){},252:function(e,t,a){"use strict";a.r(t),function(e){var t=a(33),s=a.n(t),n=a(54),i=a(17),r=a(254),c=function(e){return new Promise((function(t,a){r.parseString(e,(function(e,s){e?a(new Error(e)):t(s)}))}))},l=function(e){var t=0;if(0===e.length)return t;for(var a=0;a<e.length;a++){t=(t<<5)-t+e.charCodeAt(a),t&=t}return t},o=function e(t,a,s){a.tests=a.tests||{},s.forEach((function(s){var n=s.$||{},i=n.name||"No Name",r=n.time||0,c=l(i),o=a.tests[c]||{id:c,name:i,messages:[],visible:!0};if(o.time=r,"string"===typeof s&&o.messages.push(s.trim()),s._&&o.messages.push(s._.trim()),n.message&&o.messages.push(s.$.message.trim()),"string"!==typeof s){var p=Object.keys(s).filter((function(e){return"$"!==e&&"_"!==e&&"testcase"!==e}))[0];p&&function(e,t){t.forEach((function(t){var a="string"===typeof t._,s="undefined"!==typeof t.$&&"message"in t.$,n="undefined"!==typeof t.$&&"type"in t.$,i="string"===typeof t;a&&e.messages.push(t._.trim()),s&&e.messages.push(t.$.message.trim()),n&&e.messages.push(t.$.type.trim()),i&&e.messages.push(t.trim())}))}(o,s[p]),"system-out"===p&&(p="passed"),o.status=p||"passed"}o.messages=o.messages.filter((function(e){return""!==e})),a.tests[c]=o,"undefined"!==typeof s.testcase&&e(t,a,s.testcase),"undefined"!==typeof s.testsuite&&u(t,s.testsuite)}))},u=function(e,t){Array.isArray(t)||(t=[t]),t.forEach((function(t){var a=function(e,t){var a=t.$||{},s=a.name||"No Name",n=l(s),r=e.suites[n]||{};return r.tests=r.tests||{},r.systemOut=r.systemOut||[],r.properties=r.properties||{_visible:!0},Object.entries(a).forEach((function(e){var t=Object(i.a)(e,2),a=t[0],s=t[1];["errors","failures","name","skipped","tests","time"].includes(a)||(r.properties[a]=r.properties[a]||[],r.properties[a].push(s))})),r.id=n,r.name=s,r.time=a.time||0,r}(e,t);"undefined"!==typeof t.properties&&function(e,t){e.properties=e.properties||{},t.properties.forEach((function(t){"string"===typeof t?""!==(t=t.trim())&&(e.properties["No Name"]=e.properties["No Name"]||[],e.properties["No Name"].push(t)):t.property.forEach((function(t){var a=t.$||{},s=a.name||"No Name",n=a.value||t._;"string"===typeof t&&(n=t),n=(n=n||"").trim(),e.properties[s]=e.properties[s]||[],n&&e.properties[s].push(n)}))}))}(a,t),"undefined"!==typeof t.testcase&&o(e,a,t.testcase),"undefined"!==typeof t["system-out"]&&function(e,t){e.systemOut=e.systemOut||[];var a=t["system-out"];Array.isArray(a)||(a=[a]),e.systemOut=e.systemOut.concat(a)}(a,t),e.suites[a.id]=a}))},p=function e(t,a){Array.isArray(a)||(a=[a]),a.forEach((function(a){u(t,a),"undefined"!==typeof a.testsuite&&e(t,a.testsuite)}))},m=function(){var e=Object(n.a)(s.a.mark((function e(t){var a,n,i,r,l,o;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a={suites:{}},e.next=3,c(t);case 3:for((n=e.sent).testsuites?(i=n.testsuites.testsuite,p(a,i)):n.testsuite&&p(a,n.testsuite),r=0,l=Object.values(a.suites);r<l.length;r++)(o=l[r]).systemOut=o.systemOut.map((function(e){return e.trim()}));return e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();"undefined"!==typeof window?window.parse=m:e.exports=m}.call(this,a(253)(e))},269:function(e,t){},271:function(e,t){},280:function(e,t,a){"use strict";a.r(t);var s=a(0),n=a.n(s),i=a(125),r=a.n(i),c=(a(133),a(134),a(136),a(17)),l=a(33),o=a.n(l),u=a(54),p=a(34),m=a.n(p),d=a(35),v=a.n(d),f=function(){return n.a.createElement("svg",{className:"logo",width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n.a.createElement("rect",{width:"64",height:"64",fill:"#2C3E50"}),n.a.createElement("path",{d:"M19.0625 28.9688L24.5156 20.25H28.0469L20.8594 31.5312L28.2188 43H24.6562L19.0625 34.125L13.4375 43H9.89062L17.2656 31.5312L10.0625 20.25H13.5781L19.0625 28.9688Z",fill:"#0DBF1F"}),n.a.createElement("path",{d:"M42.4344 39.0156L48.9344 20.25H52.2156L43.7781 43H41.1219L32.7 20.25H35.9656L42.4344 39.0156Z",fill:"#B32010"}),n.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 64L4 60V4H60L64 0H4H0V4V64Z",fill:"#0DBF1F"}),n.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 64H60H64V60V0L60 4V60H4L0 64Z",fill:"#B32010"}))},E=a(126),g=function(e){var t=e.active,a=e.onClick;return n.a.createElement("section",{className:"hero is-black"},n.a.createElement("div",{className:"container"},n.a.createElement("div",{className:"columns is-mobile"},n.a.createElement("div",{className:"column is-1"},n.a.createElement(E.Slider,{className:"button",active:t,onClick:a,borderRadius:4,color:"#fff"})),n.a.createElement("div",{className:"column is-11"},n.a.createElement("div",{className:"hero-center"},n.a.createElement(f,null),n.a.createElement("h1",{className:"title"},"Xunit Viewer"))))))},b=function(e){var t=e.active,a=e.onIcon,s=e.offIcon,i=e.onLabel,r=e.offLabel,c=e.disabled,l=void 0!==c&&c,o=e.onChange,u=void 0===o?function(){}:o,p=e.className,m=void 0===p?"":p;return n.a.createElement("button",{onClick:function(){u(!t)},disabled:l,className:"button toggle is-".concat(t?"active":"inactive"," ").concat(m)},n.a.createElement("div",{className:"toggle-rail"},n.a.createElement("div",{className:"toggle-handle"})),t?a:s,n.a.createElement("span",null,t?i:r))},h=function(e){var t=e.label,a=e.dispatch;return n.a.createElement("div",{className:"field options-search"},n.a.createElement("div",{className:"control"},n.a.createElement("input",{onChange:function(e){a({type:"search-suites",payload:{value:e.target.value}})},className:"input",type:"text",placeholder:t})))},N=function(e){var t=e.count,a=e.total;return n.a.createElement("div",{className:"options-total"},n.a.createElement("b",null,t),n.a.createElement("span",null,"/",a))},y=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-chevron-up"}))},w=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-chevron-down"}))},k=function(e){var t=e.suitesExpanded,a=void 0===t||t,s=e.count,i=void 0===s?0:s,r=e.total,c=void 0===r?0:r,l=e.dispatch,o=e.active,u=void 0!==o&&o;return n.a.createElement("div",{className:"options card ".concat(u?"is-active":"is-inactive")},n.a.createElement("header",{className:"card-header"},n.a.createElement(h,{label:"Suites",dispatch:l}),n.a.createElement("button",{onClick:function(){return l({type:"toggle-suite-options"})},className:"button card-header-icon"},n.a.createElement("div",{className:"options-inputs"},n.a.createElement(N,{count:i,total:c})),n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-angle-down"})))),n.a.createElement("div",{className:"card-content"},u?n.a.createElement(b,{onChange:function(){return l({type:"toggle-all-suites"})},active:a,onLabel:"Expanded",offLabel:"Contracted",offIcon:n.a.createElement(y,null),onIcon:n.a.createElement(w,null)}):null))},O={passed:"check",failure:"times",error:"exclamation",skipped:"ban",unknown:"question"},j=function(e){var t=e.label,a=e.dispatch;e.suite,e.id;return n.a.createElement("div",{className:"field options-search"},n.a.createElement("div",{className:"control"},n.a.createElement("input",{onChange:function(e){a({type:"search-tests",payload:{value:e.target.value}})},className:"input",type:"text",placeholder:t})))},x=function(e){var t=e.count,a=e.total,s=e.icon;return n.a.createElement("div",{className:"options-total"},s?n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-".concat(O[s]||O.unknown),"aria-hidden":"true"})):null,n.a.createElement("b",null,t),n.a.createElement("span",null,"/",a))},S=function(e,t,a){return(e[t]||{})[a]||0},T=function(){return n.a.createElement(n.a.Fragment,null,n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-eye"})))},C=function(){return n.a.createElement(n.a.Fragment,null,n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-eye-slash"})))},L=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-star"}))},_=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-code"}))},A=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-chevron-up"}))},I=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-chevron-down"}))},H=function(e){var t=e.testCounts,a=e.status;return S(t,a,"total")>0?n.a.createElement(x,{count:S(t,a,"count"),total:S(t,a,"total"),icon:a}):null},V=function(e){var t=e.status,a=e.label,s=e.dispatch,i=e.visible,r=void 0===i||i,c=e.expanded,l=void 0===c||c,o=e.raw,u=void 0===o||o;return n.a.createElement("div",{className:"test-options-toggle-row"},n.a.createElement("div",{className:"test-options-toggle-row-label"},"all"!==t?n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-".concat(O[t]||O.unknown),"aria-hidden":"true"})):n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"far fa-circle","aria-hidden":"true"})),n.a.createElement("span",null,a)),n.a.createElement(b,{onChange:function(){s({type:"toggle-test-visibility",payload:{status:t,active:!r}})},active:r,onLabel:"Visible",offLabel:"Hidden",onIcon:n.a.createElement(T,null),offIcon:n.a.createElement(C,null)}),n.a.createElement(b,{onChange:function(){s({type:"toggle-test-expanded",payload:{status:t,active:!l}})},active:l,onLabel:"Expanded",offLabel:"Contracted",onIcon:n.a.createElement(I,null),offIcon:n.a.createElement(A,null)}),n.a.createElement(b,{onChange:function(){s({type:"toggle-test-raw",payload:{status:t,active:!u}})},active:u,onLabel:"Raw",offLabel:"Pretty",onIcon:n.a.createElement(_,null),offIcon:n.a.createElement(L,null)}))},F=function(e){var t=e.testCounts,a=void 0===t?{}:t,s=e.testToggles,i=void 0===s?{}:s,r=e.count,c=void 0===r?0:r,l=e.total,o=void 0===l?0:l,u=e.dispatch,p=e.active,m=void 0!==p&&p;return n.a.createElement("div",{className:"options card ".concat(m?"is-active":"is-inactive")},n.a.createElement("header",{className:"card-header"},n.a.createElement(j,{label:"Tests",dispatch:u}),n.a.createElement("button",{onClick:function(){return u({type:"toggle-test-options"})},className:"button card-header-icon"},n.a.createElement("div",{className:"options-inputs"},n.a.createElement(x,{count:c,total:o}),n.a.createElement(H,{testCounts:a,status:"passed"}),n.a.createElement(H,{testCounts:a,status:"failure"}),n.a.createElement(H,{testCounts:a,status:"error"}),n.a.createElement(H,{testCounts:a,status:"skipped"}),n.a.createElement(H,{testCounts:a,status:"unknown"})),n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-angle-down"})))),n.a.createElement("div",{className:"card-content options-toggles"},m?n.a.createElement(n.a.Fragment,null,n.a.createElement(V,Object.assign({status:"all",label:"All",dispatch:u},i.all)),n.a.createElement(V,Object.assign({status:"passed",label:"Passed",dispatch:u},i.passed)),n.a.createElement(V,Object.assign({status:"failure",label:"Failure",dispatch:u},i.failure)),n.a.createElement(V,Object.assign({status:"error",label:"Error",dispatch:u},i.error)),n.a.createElement(V,Object.assign({status:"skipped",label:"Skipped",dispatch:u},i.skipped)),n.a.createElement(V,Object.assign({status:"unknown",label:"Unknown",dispatch:u},i.unknown))):null))},$=function(e){var t=e.label,a=e.dispatch;return n.a.createElement("div",{className:"field options-search"},n.a.createElement("div",{className:"control"},n.a.createElement("input",{onChange:function(e){a({type:"search-properties",payload:{value:e.target.value}})},className:"input",type:"text",placeholder:t})))},R=function(e){var t=e.count,a=e.total;return n.a.createElement("div",{className:"options-total"},n.a.createElement("b",null,t),n.a.createElement("span",null,"/",a))},B=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-eye"}))},P=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-eye-slash"}))},M=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-chevron-up"}))},Z=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-chevron-down"}))},q=function(e){var t=e.count,a=void 0===t?0:t,s=e.total,i=void 0===s?0:s,r=e.active,c=void 0!==r&&r,l=e.dispatch,o=e.propertiesExpanded,u=void 0===o||o,p=e.propertiesVisible,m=void 0===p||p;return n.a.createElement("div",{className:"options card ".concat(c?"is-active":"is-inactive")},n.a.createElement("header",{className:"card-header"},n.a.createElement($,{label:"Properties",dispatch:l}),n.a.createElement("button",{onClick:function(){return l({type:"toggle-properties-options"})},className:"button card-header-icon"},n.a.createElement("div",{className:"options-inputs"},n.a.createElement(R,{count:a,total:i})),n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-angle-down"})))),n.a.createElement("div",{className:"card-content"},c?n.a.createElement("div",null,n.a.createElement(b,{className:"properties-options-toggle",active:m,onChange:function(){l({type:"toggle-properties-visbility",payload:{active:!m}})},onLabel:"Visible",offLabel:"Hidden",onIcon:n.a.createElement(B,null),offIcon:n.a.createElement(P,null)}),n.a.createElement(b,{onChange:function(){l({type:"toggle-all-properties",payload:{active:!u}})},className:"properties-options-toggle",active:u,onLabel:"Expanded",offLabel:"Contracted",offIcon:n.a.createElement(M,null),onIcon:n.a.createElement(Z,null)})):null))},D=(a(127),a(235),a(236),a(91)),J=a.n(D),U={passed:"check",failure:"times",error:"exclamation",skipped:"ban",unknown:"question"},X=function(e){var t=e.properties,a=e.active,s=void 0===a||a,i=e.dispatch,r=e.suite;return n.a.createElement("div",{className:"properties card is-".concat(s?"active":"inactive")},n.a.createElement("button",{className:"card-header",onClick:function(){i({type:"toggle-properties",payload:{suite:r,active:!s}})}},n.a.createElement("p",{className:"card-header-title"},"Properties"),n.a.createElement("span",{className:"card-header-icon"},n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-angle-down"})))),s?n.a.createElement("div",{className:"card-content"},n.a.createElement("table",{className:"table"},n.a.createElement("thead",null,n.a.createElement("tr",null,n.a.createElement("th",null,"Property"),n.a.createElement("th",null,"Value"))),n.a.createElement("tbody",null,Object.keys(t).filter((function(e){return"_active"!==e&&"_visible"!==e})).map((function(e){return n.a.createElement("tr",{key:e},n.a.createElement("td",null,e),n.a.createElement("td",null,t[e].join(", ")))}))))):null)},z=function(e){var t=e.messages;return n.a.createElement("div",{className:"raw-content"},t.map((function(e,t){return n.a.createElement("pre",{key:"test-message-".concat(t)},e)})))},G=function(e){var t=e.messages;return n.a.createElement("div",{className:"pretty-content"},t.map((function(e,t){return n.a.createElement("div",{key:"test-message-".concat(t),dangerouslySetInnerHTML:{__html:e}})})))},K=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-star"}))},Q=function(){return n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-code"}))},W=function(e){var t=e.id,a=e.messages,s=e.status,i=e.time,r=e.name,c=e.active,l=void 0===c||c,o=e.raw,u=void 0===o||o,p=e.dispatch,m=e.suite;return n.a.createElement("div",{className:"test card is-".concat(l?"active":"inactive"," is-").concat(s," is-").concat(0===a.length?"empty":"populated")},n.a.createElement("button",{className:"card-header",onClick:function(){p({type:"toggle-test",payload:{suite:m,id:t,active:!l}})},disabled:0===a.length},n.a.createElement("p",{className:"card-header-title"},n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-".concat(U[s]||U.unknown),"aria-hidden":"true"})),n.a.createElement("span",null,J.a.titleCase(r)),i?n.a.createElement("small",null,"time = ",i):null),a.length>0?n.a.createElement("span",{className:"card-header-icon"},n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-angle-down"}))):null),l&&a.length>0?n.a.createElement("div",{className:"card-content"},n.a.createElement(b,{active:u,onLabel:"raw",onIcon:n.a.createElement(Q,null),offIcon:n.a.createElement(K,null),offLabel:"pretty",onChange:function(){return p({type:"toggle-test-mode",payload:{suite:m,id:t,raw:!u}})}}),u?n.a.createElement(z,{messages:a}):n.a.createElement(G,{messages:a})):null)},Y=function(e){var t=e.count,a=e.type;return t>0?n.a.createElement("span",{className:"suite-count"},n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-".concat(U[a]),"aria-hidden":"true"})),t):null},ee=function(e){var t=e.id,a=e.name,s=e.active,i=void 0!==s&&s,r=e.properties,c=void 0===r?{}:r,l=e.time,o=e.tests,u=void 0===o?{}:o,p=e.dispatch,m=e.systemOut,d=void 0===m?[]:m,v=0,f=0,E=0,g=0,b=0;Object.keys(u).forEach((function(e){var t=u[e].status;"passed"===t?v+=1:"failure"===t?f+=1:"skipped"===t?E+=1:"error"===t?g+=1:b+=1}));var h=Object.keys(u).length>0&&Object.values(u).some((function(e){return e.visible})),N="_visible"in c&&c._visible&&Object.keys(c).filter((function(e){return"_active"!==e&&"_visible"!==e})).length>0,y=h||N;return n.a.createElement("div",{className:"card suite is-".concat(i?"active":"inactive"," is-").concat(y?"populated":"empty")},n.a.createElement("button",{className:"card-header",onClick:function(){y&&p({type:"toggle-suite",payload:{id:t,active:!i}})},disabled:!y},n.a.createElement("p",{className:"card-header-title"},n.a.createElement("span",null,J.a.titleCase(a)),l?n.a.createElement("small",null,"time = ",l):null),y?n.a.createElement("span",{className:"card-header-icon"},n.a.createElement("span",{className:"icon"},n.a.createElement("i",{className:"fas fa-angle-down"}))):null,y?n.a.createElement("p",{className:"suite-count-container"},n.a.createElement(Y,{type:"failure",count:f}),n.a.createElement(Y,{type:"error",count:g}),n.a.createElement(Y,{type:"passed",count:v}),n.a.createElement(Y,{type:"skipped",count:E}),n.a.createElement(Y,{type:"unknown",count:b})):null),i&&y?n.a.createElement("div",{className:"card-content"},n.a.createElement("div",{className:"content"},d.length>0?d.map((function(e,a){return n.a.createElement("pre",{key:"".concat(t,"-sysout-").concat(a)},e)})):null,N?n.a.createElement(X,{properties:c,suite:t,dispatch:p,active:c._active}):null,n.a.createElement("div",null,Object.keys(u).filter((function(e){return u[e].visible&&"failure"===u[e].status})).map((function(e){return n.a.createElement(W,Object.assign({key:e},u[e],{suite:t,dispatch:p}))})),Object.keys(u).filter((function(e){return u[e].visible&&"error"===u[e].status})).map((function(e){return n.a.createElement(W,Object.assign({key:e},u[e],{suite:t,dispatch:p}))})),Object.keys(u).filter((function(e){return u[e].visible&&"passed"===u[e].status})).map((function(e){return n.a.createElement(W,Object.assign({key:e},u[e],{suite:t,dispatch:p}))})),Object.keys(u).filter((function(e){return u[e].visible&&"skipped"===u[e].status})).map((function(e){return n.a.createElement(W,Object.assign({key:e},u[e],{suite:t,dispatch:p}))})),Object.keys(u).filter((function(e){return u[e].visible&&!["failure","error","passed","skipped"].includes(u[e].status)})).map((function(e){return n.a.createElement(W,Object.assign({key:e},u[e],{suite:t,dispatch:p}))}))))):null)};a(252);var te=window.parse,ae=function(){var e=Object(u.a)(o.a.mark((function e(t,a,s){var n,i,r,c,l,u,p,d,v;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,i=!1,r=void 0,e.prev=3,c=a[Symbol.iterator]();case 5:if(n=(l=c.next()).done){e.next=20;break}return u=l.value,p=u.file,d=u.contents,e.prev=7,e.next=10,te(d);case 10:v=e.sent,s=m.a.recursive(!0,s,v),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.log("Failed to parse",p,"\n",e.t0.message);case 17:n=!0,e.next=5;break;case 20:e.next=26;break;case 22:e.prev=22,e.t1=e.catch(3),i=!0,r=e.t1;case 26:e.prev=26,e.prev=27,n||null==c.return||c.return();case 29:if(e.prev=29,!i){e.next=32;break}throw r;case 32:return e.finish(29);case 33:return e.finish(26);case 34:t({type:"parse-suites",payload:{suites:s.suites}});case 35:case"end":return e.stop()}}),e,null,[[3,22,26,34],[7,14],[27,,29,33]])})));return function(t,a,s){return e.apply(this,arguments)}}(),se=function(e,t){var a=t.type,s=t.payload;var n={};return n.currentSuites=e.currentSuites,"parse-suites"===a?((e=m.a.recursive(!0,{},e)).suites=s.suites,e.currentSuites=s.suites,Object.values(e.currentSuites).forEach((function(e){(Object.keys(e.tests).length>0||Object.keys(e.properties).length>0)&&(e.active=!0)})),e):("search-suites"===a&&(Object.values(e.suites).forEach((function(t){var a=t.name,i=t.id;v.a.test(s.value.toLowerCase(),a.toLowerCase())?(n.currentSuites[i]=n.currentSuites[i]||m.a.recursive(!0,{},e.suites[i]),"active"in n.currentSuites[i]||(n.currentSuites[i].active=!0)):delete n.currentSuites[i]})),n.suitesExpanded=Object.values(n.currentSuites).some((function(e){return!0===e.active}))),"search-tests"===a&&Object.values(e.suites).forEach((function(t){Object.values(t.tests).forEach((function(a){v.a.test(s.value.toLowerCase(),a.name.toLowerCase())||a.messages.some((function(e){return v.a.test(s.value.toLowerCase(),e.toLowerCase())}))?t.id in n.currentSuites&&!(a.id in n.currentSuites[t.id].tests)&&n.currentSuites[t.id]&&(n.currentSuites[t.id].tests[a.id]=m.a.recursive(!0,{},e.suites[t.id].tests[a.id]),n.currentSuites[t.id].tests[a.id].active=!0,n.currentSuites[t.id].tests[a.id].visible=!0,n.currentSuites[t.id].tests[a.id].raw=!0):n.currentSuites[t.id]&&delete n.currentSuites[t.id].tests[a.id]}))})),"search-properties"===a&&(Object.values(e.suites).forEach((function(t){Object.entries(t.properties).filter((function(e){var t=Object(c.a)(e,1)[0];return"_visible"!==t&&"_active"!==t})).forEach((function(a){var i=Object(c.a)(a,2),r=i[0],l=i[1];l=l||[],v.a.test(s.value.toLowerCase(),r.toLowerCase())||l.some((function(e){return v.a.test(s.value.toLowerCase(),e.toLowerCase())}))?t.id in n.currentSuites&&!(r in n.currentSuites[t.id].properties)&&n.currentSuites[t.id]&&(n.currentSuites[t.id].properties[r]=[].concat(e.suites[t.id].properties[r]),n.currentSuites[t.id].properties._active=!0,n.currentSuites[t.id].properties._visible=!0,n.propertiesExpanded=!1):delete n.currentSuites[t.id].properties[r]}))})),n.propertiesExpanded=Object.values(n.currentSuites).some((function(e){return e.properties._active||!1})),n.propertiesVisible=Object.values(n.currentSuites).some((function(e){return e.properties._visible||!1}))),"toggle-all-suites"===a&&(n.suitesExpanded=!e.suitesExpanded,Object.values(n.currentSuites).forEach((function(e){e.active=n.suitesExpanded}))),"toggle-menu"===a&&(n.menuActive=!e.menuActive),"toggle-suite-options"===a&&(n.suiteOptionsActive=!e.suiteOptionsActive),"toggle-test-options"===a&&(n.testOptionsActive=!e.testOptionsActive),"toggle-properties-options"===a&&(n.propertiesOptionsActive=!e.propertiesOptionsActive),"toggle-files"===a&&(n.activeFiles=!e.activeFiles),"toggle-suite"===a&&(n.currentSuites[s.id].active=s.active,n.suitesExpanded=Object.values(n.currentSuites).some((function(e){return!0===e.active}))),"toggle-all-properties"===a&&(Object.values(n.currentSuites).forEach((function(e){e.properties._active=s.active})),n.propertiesExpanded=s.active),"toggle-properties"===a&&(n.currentSuites[s.suite].properties._active=s.active,n.propertiesExpanded=Object.values(n.currentSuites).some((function(e){return e.properties._active||!1}))),"toggle-properties-visbility"===a&&(Object.values(n.currentSuites).forEach((function(e){e.properties._visible=s.active})),n.propertiesVisible=s.active),"toggle-test"===a&&(n.currentSuites[s.suite].tests[s.id].active=s.active),"toggle-test-mode"===a&&(n.currentSuites[s.suite].tests[s.id].raw=s.raw),"toggle-test-visibility"===a&&(n.testToggles=e.testToggles,n.testToggles[s.status].visible=s.active,Object.values(n.currentSuites).forEach((function(e){Object.values(e.tests).forEach((function(e){"all"===s.status?e.visible=s.active:s.status===e.status?e.visible=s.active:"undefined"===typeof e.status&&"unknown"===s.status&&(e.visible=s.active)}))})),"all"===s.status?(n.testToggles.passed.visible=s.active,n.testToggles.failure.visible=s.active,n.testToggles.error.visible=s.active,n.testToggles.skipped.visible=s.active,n.testToggles.unknown.visible=s.active):(n.testToggles.passed.visible||n.testToggles.failure.visible||n.testToggles.error.visible||n.testToggles.skipped.visible||n.testToggles.unknown.visible)&&(n.testToggles.all.visible=!0)),"toggle-test-expanded"===a&&(n.testToggles=e.testToggles,n.testToggles[s.status].expanded=s.active,Object.values(n.currentSuites).forEach((function(e){Object.values(e.tests).forEach((function(e){"all"===s.status?e.active=s.active:s.status===e.status?e.active=s.active:"undefined"===typeof e.status&&"unknown"===s.status&&(e.active=s.active)}))})),"all"===s.status?(n.testToggles.passed.expanded=s.active,n.testToggles.failure.expanded=s.active,n.testToggles.error.expanded=s.active,n.testToggles.skipped.expanded=s.active,n.testToggles.unknown.expanded=s.active):(n.testToggles.passed.expanded||n.testToggles.failure.expanded||n.testToggles.error.expanded||n.testToggles.skipped.expanded||n.testToggles.unknown.expanded)&&(n.testToggles.all.expanded=!0)),"toggle-test-raw"===a&&(n.testToggles=e.testToggles,n.testToggles[s.status].raw=s.active,Object.values(n.currentSuites).forEach((function(e){Object.values(e.tests).forEach((function(e){"all"===s.status?e.raw=s.active:s.status===e.status?e.raw=s.active:"undefined"===typeof e.status&&"unknown"===s.status&&(e.raw=s.active)}))})),"all"===s.status?(n.testToggles.passed.raw=s.active,n.testToggles.failure.raw=s.active,n.testToggles.error.raw=s.active,n.testToggles.skipped.raw=s.active,n.testToggles.unknown.raw=s.active):(n.testToggles.passed.raw||n.testToggles.failure.raw||n.testToggles.error.raw||n.testToggles.skipped.raw||n.testToggles.unknown.raw)&&(n.testToggles.all.raw=!0)),m.a.recursive(!0,e,n))},ne={suites:{},currentSuites:{},menuActive:!1,suiteOptionsActive:!1,testOptionsActive:!1,propertiesOptionsActive:!1,activeFiles:!1,suitesExpanded:!0,propertiesExpanded:!0,propertiesVisible:!0,testToggles:{all:{visible:!0,expanded:!0,raw:!0},passed:{visible:!0,expanded:!0,raw:!0},failure:{visible:!0,expanded:!0,raw:!0},error:{visible:!0,expanded:!0,raw:!0},skipped:{visible:!0,expanded:!0,raw:!0},unknown:{visible:!0,expanded:!0,raw:!0}}},ie=function(e){var t=e.files,a=Object(s.useReducer)(se,ne),i=Object(c.a)(a,2),r=i[0],l=i[1];0===Object.keys(r.suites).length&&ae(l,t,{});var o=0,u=0;Object.entries(r.currentSuites).forEach((function(e){var t=Object(c.a)(e,2),a=(t[0],t[1]);o+=Object.keys(a.properties).filter((function(e){return"_active"!==e&&"_visible"!==e})).length})),Object.entries(r.currentSuites).forEach((function(e){var t=Object(c.a)(e,2),a=(t[0],t[1]);u+=Object.keys(a.properties).filter((function(e){return"_active"!==e&&"_visible"!==e})).length}));var p={},m=0,d=0;Object.entries(r.currentSuites).forEach((function(e){var t=Object(c.a)(e,2),a=(t[0],t[1]);Object.entries(a.tests).forEach((function(e){var t=Object(c.a)(e,2),a=(t[0],t[1].status||"unknown");p[a]=p[a]||{},p[a].count=p[a].count||0,p[a].total=p[a].total||0,p[a].count+=1,p[a].total+=1,d+=1,m+=1}))}));var v=function(e){var t=e.files;ae(l,t,{})};return window.sockets=window.sockets||null,Object(s.useEffect)((function(){null===window.sockets&&"io"in window&&(window.sockets=window.io(),window.sockets.on("update",v))})),n.a.createElement("div",null,n.a.createElement(g,{active:r.menuActive,onClick:function(){l({type:"toggle-menu"})}}),n.a.createElement("header",{className:"is-".concat(r.menuActive?"shown":"hidden")},n.a.createElement("div",{className:"container"},n.a.createElement(k,{active:r.suiteOptionsActive,suitesExpanded:r.suitesExpanded,dispatch:l,count:Object.keys(r.currentSuites).length,total:Object.keys(r.suites).length}),n.a.createElement(F,{active:r.testOptionsActive,testToggles:r.testToggles,testCounts:p,count:m,total:d,dispatch:l}),n.a.createElement(q,{propertiesExpanded:r.propertiesExpanded,propertiesVisible:r.propertiesVisible,active:r.propertiesOptionsActive,count:o,total:u,dispatch:l}),null)),n.a.createElement("main",null,n.a.createElement("div",{className:"container"},n.a.createElement("div",null,Object.values(r.currentSuites).map((function(e){return n.a.createElement(ee,Object.assign({key:e.id},e,{dispatch:l}))}))))))},re=window.files||[];r.a.render(n.a.createElement(ie,{files:re}),document.getElementById("root"))}},[[128,1,2]]]);
//# sourceMappingURL=main.38d7b230.chunk.js.map | 14,495 | 28,942 | 0.710693 |
3777e78b4159e3df032e36641a4ba5c0f662f5eb | 674 | js | JavaScript | commands/balance.js | NewCaledoniaDevTeam/BONC-BOT | 95d37fe6df6e1e0ca7e7100dc0949178e5778cac | [
"MIT"
] | null | null | null | commands/balance.js | NewCaledoniaDevTeam/BONC-BOT | 95d37fe6df6e1e0ca7e7100dc0949178e5778cac | [
"MIT"
] | null | null | null | commands/balance.js | NewCaledoniaDevTeam/BONC-BOT | 95d37fe6df6e1e0ca7e7100dc0949178e5778cac | [
"MIT"
] | null | null | null | const Discord = require("discord.js");
const db = require("quick.db");
let prefix = process.env.PREFIX;
module.exports.run = async(bot, message, args, utils) => {
if (!message.content.toLowerCase().startsWith(prefix)) return;
let user = message.mentions.members.first() || message.author;
let bal = db.fetch(`money_${message.guild.id}_${user.id}`)
if (bal === null) bal = 0;
let moneyEmbed = new Discord.RichEmbed()
.setColor("#2980b9")
.setDescription(`**${user} Balance**\n\nAccount: ${bal} checks`);
message.channel.send(moneyEmbed)
};
module.exports.help = {
name: "balance",
aliases: ["bal"]
} | 29.304348 | 74 | 0.620178 |
3778a25cf7c6c03aa5e03f5691cd659b84c9186f | 335 | js | JavaScript | src/components/Content/Content.js | jordanpapaleo/reno-js | 0fb4bf8f037b0d01cc63b6e7f133af291517d775 | [
"MIT"
] | null | null | null | src/components/Content/Content.js | jordanpapaleo/reno-js | 0fb4bf8f037b0d01cc63b6e7f133af291517d775 | [
"MIT"
] | null | null | null | src/components/Content/Content.js | jordanpapaleo/reno-js | 0fb4bf8f037b0d01cc63b6e7f133af291517d775 | [
"MIT"
] | 1 | 2019-05-10T18:20:08.000Z | 2019-05-10T18:20:08.000Z | import React from 'react'
import styled from '@emotion/styled'
type Props = {
children?: React.Node
}
const Content = (props: Props) => (
<StyledContent>
{props.children}
</StyledContent>
)
export default Content
const StyledContent = styled.main`
align-self: center;
display: flex;
flex: 1;
max-width: 1080px;
`
| 15.227273 | 36 | 0.683582 |
3779328219e4ca015c905102dc216987dd76e450 | 2,611 | js | JavaScript | __routes/HomeScreen.js | bjma/budgit | 2d1eb47944b7c299246a9fe44c7ed4460734b36d | [
"MIT"
] | null | null | null | __routes/HomeScreen.js | bjma/budgit | 2d1eb47944b7c299246a9fe44c7ed4460734b36d | [
"MIT"
] | null | null | null | __routes/HomeScreen.js | bjma/budgit | 2d1eb47944b7c299246a9fe44c7ed4460734b36d | [
"MIT"
] | null | null | null | import * as React from 'react';
import { View, Text, Button, StyleSheet, Image } from 'react-native'
import { TouchableOpacity } from 'react-native-gesture-handler';
// import libraries
import { NavigationActions } from '@react-navigation/native';
const HomeScreen = ({ navigation }) => {
/**
* Variant route access that chains navigation
* to the budget screen, then the add item screen
*/
const goToAddScreen = () => {
navigation.navigate('Budget', { addAction: true });
};
// const goToAnalytics
return (
<View style={ styles.container }>
<Image
style={styles.tinyLogo}
source={require('../__img/budgit_logo.png')}
/>
<View style={styles.welcomeText}>
<Text
style={{fontSize: 40, marginTop: 35, color: '#1FA68A',}}>
Hello!
</Text>
<Text
style={{fontSize: 20, margin: 5, color: '#1FA68A',}}>
What would you like to do?
</Text>
</View>
<TouchableOpacity
onPress={ goToAddScreen }
style={styles.button}
>
<Text style={styles.buttonText}>Add an Expense</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => navigation.navigate('Budget', { addAction: false })}
style={styles.button}
>
<Text style={styles.buttonText}>View Expenses</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => navigation.navigate('Analytics')}
style={styles.button}
>
<Text style={styles.buttonText}>View Analytics</Text>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1, alignItems: 'center', justifyContent: 'center',
paddingBottom: 100,
backgroundColor: '#FFFFFF'
},
button: {
alignItems: 'center', justifyContent: 'center',
height: 42, width: 175,
margin: 20, marginBottom: 10,
backgroundColor: '#FFFFFF',
borderColor: '#1FA68A', borderWidth: 1, borderRadius: 5,
},
buttonText: {
color: '#1FA68A',
fontSize: 15,
},
welcomeText: {
alignItems: 'center',
justifyContent: 'center',
paddingBottom: 30,
},
tinyLogo: {
marginTop: 60,
height: 145,
width: 145,
}
});
export default HomeScreen; | 30.011494 | 83 | 0.52432 |
37794f7021a8a563f0f80951624e9d908bc48e7b | 1,765 | js | JavaScript | dist/static/component/SideBar/index_fd6fc7e.js | DophinL/CPP-review | 215f7ce33b99aaae3c0c0e14ecf3c5064887e4df | [
"MIT"
] | 2 | 2016-01-30T03:29:48.000Z | 2016-02-27T02:36:46.000Z | dist/static/component/SideBar/index_fd6fc7e.js | DophinL/CPP-review | 215f7ce33b99aaae3c0c0e14ecf3c5064887e4df | [
"MIT"
] | null | null | null | dist/static/component/SideBar/index_fd6fc7e.js | DophinL/CPP-review | 215f7ce33b99aaae3c0c0e14ecf3c5064887e4df | [
"MIT"
] | null | null | null | define("component/SideBar/index",["require","exports","module","component/BaseComponent/index"],function(e,n,s){var i=e("component/BaseComponent/index"),t=i.util,u=i.extend({name:"menu",template:'<ol class="u-menu">\r\n {#list menuList as aMenu}\r\n <li class="menuTab {aMenu.selected? \'selected\' :\'\'}">\r\n <a href="/menus/{aMenu.menuCode}" {#if aMenu.hasChildren} on-click={this.__clickMenu($event, aMenu_index)}{/if}>\r\n <i class={aMenu.className}></i>\r\n {aMenu.menuName}\r\n </a>\r\n {#if aMenu.hasChildren}\r\n <ul class="u-submenu" r-hide={!aMenu.showChildren}>\r\n {#list aMenu.children as sMenu}\r\n <li class="submenu {sMenu.selected?\'selected\' : \'\'}">\r\n <a href="/menus/{sMenu.menuCode}">{sMenu.menuName}</a>\r\n </li>\r\n {/list}\r\n </ul>\r\n {/if}\r\n </li>\r\n {/list}\r\n</ol>\r\n\r\n<div class="m-cprt">xxx版权所有</div>',config:function(e){e.getMenuURL="/users/getCurMenus.do"},init:function(){var e=this,n=/\/(?:\w*)\/(\w*)/i,s=window.location.pathname;e.data.showMenuCode=n.test(s)?s.match(n)[1]:"",e.__getMemu()},__getMemu:function(){var e=this,n=e.data;this.$request({url:n.getMenuURL,type:"GET",success:function(s){var i=s.data;n.menuList=i,e.__selectedMenu(),e.$update()}})},__selectedMenu:function(){var e=this,n=e.data,s=n.showMenuCode,i=n.menuList,u={1:"i-capacity",2:"i-todo",14:"i-progress",15:"i-center",20:"i-permission"};t.each(i,function(e,n){n.className=u[n.id],n.menuCode&&n.menuCode==s&&(n.selected=!0);var i=n.children;i.length&&(n.hasChildren=!0,t.each(i,function(e,i){i.menuCode&&i.menuCode==s&&(i.selected=!0,n.selected=!0,n.showChildren=!0)}))})},__clickMenu:function(e,n){var s=this,i=s.data.menuList;i[n].showChildren=!i[n].showChildren,e.preventDefault()}});s.exports=u}); | 1,765 | 1,765 | 0.667989 |
377a4e65a7605832fecbc6416bf4dc323187b548 | 1,879 | js | JavaScript | src/actions/Login.spec.js | Korkemoms/amodahl.no | c749007e9af6edb88600baffef3d84a287c99d9e | [
"BSD-3-Clause"
] | null | null | null | src/actions/Login.spec.js | Korkemoms/amodahl.no | c749007e9af6edb88600baffef3d84a287c99d9e | [
"BSD-3-Clause"
] | null | null | null | src/actions/Login.spec.js | Korkemoms/amodahl.no | c749007e9af6edb88600baffef3d84a287c99d9e | [
"BSD-3-Clause"
] | null | null | null | // @flow
import expect from 'expect'
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
import promiseMiddleware from 'redux-promise'
import * as actions from './Login'
import fetchMock from 'fetch-mock'
const middlewares = [ promiseMiddleware, thunk ]
const mockStore = configureMockStore(middlewares)
describe('Signere login actions', () => {
it('fetchSignereUrl resolves with correct url', async () => {
const store = mockStore({})
const url = Math.random().toString(36).substring(7)
const expectedActions = [{
type: 'FETCH_SIGNERE_URL',
payload: url
}]
fetchMock.postOnce('*', {Url: url})
await store.dispatch(actions.fetchSignereUrl())
.then((action) => {
expect(store.getActions()).toEqual(expectedActions)
})
.catch(e => {
fail(e)
})
})
it('fetchSignereUrl resolves with error=true if bad response', async () => {
let store = mockStore({})
fetchMock.postOnce('*', {foo: 'bar'})
await store.dispatch(actions.fetchSignereUrl())
.then((action) => {
expect(action.error).toEqual(true)
})
.catch(e => {
fail(e)
})
store = mockStore({})
fetchMock.postOnce('*', 'asdf')
await store.dispatch(actions.fetchSignereUrl())
.then((action) => {
expect(action.error).toEqual(true)
})
.catch(e => {
fail(e)
})
store = mockStore({})
fetchMock.postOnce('*', ['token'])
await store.dispatch(actions.fetchSignereUrl())
.then((action) => {
expect(action.error).toEqual(true)
})
.catch(e => {
fail(e)
})
store = mockStore({})
fetchMock.postOnce('*', {body: {Url: '123'}, status: 400})
await store.dispatch(actions.fetchSignereUrl())
.then((action) => {
expect(action.error).toEqual(true)
})
.catch(e => {
fail(e)
})
})
})
| 25.053333 | 78 | 0.608834 |
377aa38f1305316d86180e8e84b564dc02bed931 | 2,081 | js | JavaScript | modules/cms/assets/es6/cms.editor.intellisense.completer.partials.js | Lawrence-Portfolio/BookhAssistant | e61a883ef29d8bbee14aabebffb9f86f7a41c3df | [
"RSA-MD"
] | 2 | 2021-12-11T13:42:46.000Z | 2021-12-11T13:43:05.000Z | modules/cms/assets/es6/cms.editor.intellisense.completer.partials.js | Lawrence-Portfolio/BookhAssistant | e61a883ef29d8bbee14aabebffb9f86f7a41c3df | [
"RSA-MD"
] | 1 | 2022-02-03T16:59:06.000Z | 2022-02-03T16:59:06.000Z | modules/cms/assets/es6/cms.editor.intellisense.completer.partials.js | ztamulis/jas | 01b696d315e4c8a965891e14a0a1f7a2fbc0bb85 | [
"RSA-MD"
] | 1 | 2021-06-02T15:11:17.000Z | 2021-06-02T15:11:17.000Z | $.oc.module.register('cms.editor.intellisense.completer.partials', function() {
'use strict';
const CompleterBase = $.oc.module.import('cms.editor.intellisense.completer.base');
class CompleterOctoberPartials extends CompleterBase {
get triggerCharacters() {
return [...['"', "'", '/', '-'], ...this.alphaNumCharacters];
}
getNormalizedPartials(range) {
return this.utils.getPartials().map((partial) => {
var result = {
label: partial.name,
insertText: partial.name,
kind: monaco.languages.CompletionItemKind.Enum,
range: range,
detail: 'October CMS partial'
};
return result;
});
}
provideCompletionItems(model, position) {
if (!this.intellisense.modelHasTag(model, 'cms-markup')) {
return;
}
const textUntilPosition = this.intellisense.utils.textUntilPosition(model, position);
const textAfterPosition = this.intellisense.utils.textAfterPosition(model, position);
const wordMatches = textUntilPosition.match(/\{%\s+partial\s+("|')(\w|\/|\-)*$/);
if (!wordMatches) {
return;
}
const wordMatchBefore = textUntilPosition.match(/("|')[\w\/\-]*$/);
if (!wordMatchBefore) {
return;
}
const wordMatchAfter = textAfterPosition.match(/[\w\/\-]?("|')/);
if (!wordMatchAfter) {
return;
}
const range = {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: wordMatchBefore.index + 2,
endColumn: position.column + wordMatchAfter[0].length - 1
};
return {
suggestions: this.getNormalizedPartials(range)
};
}
}
return CompleterOctoberPartials;
});
| 33.564516 | 97 | 0.520423 |
377bf2d0d4f4d97286fe8927340c24e1ca415548 | 1,455 | js | JavaScript | app/containers/LinkListContainer/saga.js | kprokkie/learn-react-boilerplate | 5252e09e49dd6b4d61cb044897552a40aa328e0f | [
"MIT"
] | null | null | null | app/containers/LinkListContainer/saga.js | kprokkie/learn-react-boilerplate | 5252e09e49dd6b4d61cb044897552a40aa328e0f | [
"MIT"
] | null | null | null | app/containers/LinkListContainer/saga.js | kprokkie/learn-react-boilerplate | 5252e09e49dd6b4d61cb044897552a40aa328e0f | [
"MIT"
] | null | null | null | // import { take, call, put, select } from 'redux-saga/effects';
// import {SELECTED_TOPIC} from '../NavigationContainer/constants';
// import { takeLatest } from 'redux-saga';
import { takeLatest, call, put } from 'redux-saga/effects';
import { REQUEST_LINKS } from './constants';
import { requestLinksSucceeded, requestLinksFailed } from './actions';
// Individual exports for testing
// export default function* linkListContainerSaga() {
// // See example in containers/HomePage/saga.js
// }
// export function fetchLinksFromServer() {
// return fetch('http://www.mocky.io/v2/5c29200c3300005f00a58bf1')
// .then(response => response.json());
// }
// function* fetchLinks() {
// try {
// const links = yield call(fetchLinksFromServer);
// console.log('Links from Server: ', links);
// yield put(requestLinksSucceeded(links));
// } catch (e) {
// yield put(requestLinksFailed(e.message));
// }
// }
export function fetchLinksFromServer(topic) {
return fetch('http://www.mocky.io/v2/5c29200c3300005f00a58bf1').then(
response => response.json(),
);
}
function* fetchLinks(action) {
try {
const links = yield call(fetchLinksFromServer, action.topic);
// console.log('Links from Server: ', links);
yield put(requestLinksSucceeded(links));
} catch (e) {
yield put(requestLinksFailed(e.message));
}
}
export default function* fetchLinksSaga() {
yield takeLatest(REQUEST_LINKS, fetchLinks);
}
| 30.957447 | 71 | 0.687973 |
377bf9f7d23590ec0e0fa6012f1a4e97c95e9dd6 | 820 | js | JavaScript | node_modules/styled-icons/icomoon/Hammer/Hammer.esm.js | venhrun-petro/oselya | 8f0476105c0d08495661f2b7236b4af89f6e0b72 | [
"MIT"
] | null | null | null | node_modules/styled-icons/icomoon/Hammer/Hammer.esm.js | venhrun-petro/oselya | 8f0476105c0d08495661f2b7236b4af89f6e0b72 | [
"MIT"
] | null | null | null | node_modules/styled-icons/icomoon/Hammer/Hammer.esm.js | venhrun-petro/oselya | 8f0476105c0d08495661f2b7236b4af89f6e0b72 | [
"MIT"
] | null | null | null | import * as tslib_1 from "tslib";
import * as React from 'react';
import { StyledIconBase } from '../../StyledIconBase';
export var Hammer = React.forwardRef(function (props, ref) {
var attrs = {
"fill": "currentColor",
};
return (React.createElement(StyledIconBase, tslib_1.__assign({ iconAttrs: attrs, iconVerticalAlign: "middle", iconViewBox: "0 0 16 16" }, props, { ref: ref }),
React.createElement("path", { d: "M15.781 12.953l-4.712-4.712a.752.752 0 0 0-1.061 0l-.354.354L6.779 5.72 11.499 1h-5l-2.22 2.22-.22-.22H2.998v1.061l.22.22-3.22 3.22 2.5 2.5 3.22-3.22 2.875 2.875-.354.354a.752.752 0 0 0 0 1.061l4.712 4.712a.752.752 0 0 0 1.061 0l1.768-1.768a.752.752 0 0 0 0-1.061z", key: "k0" })));
});
Hammer.displayName = 'Hammer';
export var HammerDimensions = { height: 16, width: 16 };
| 63.076923 | 324 | 0.659756 |
377c52efecd9152ac286b60980e231f89e8ae324 | 2,378 | js | JavaScript | .config/prompts/gitlab-group.js | megabyte-labs/ansible-docker | 172a906cb0218e0c9893ef5635352b1a2a180a2b | [
"MIT"
] | 5 | 2021-02-24T06:02:48.000Z | 2022-03-14T09:13:06.000Z | .config/prompts/gitlab-group.js | megabyte-labs/ansible-docker | 172a906cb0218e0c9893ef5635352b1a2a180a2b | [
"MIT"
] | 1 | 2021-11-03T15:54:59.000Z | 2021-12-02T22:04:24.000Z | .config/prompts/gitlab-group.js | megabyte-labs/ansible-docker | 172a906cb0218e0c9893ef5635352b1a2a180a2b | [
"MIT"
] | 4 | 2021-12-22T03:40:20.000Z | 2022-02-10T20:00:45.000Z | import inquirer from 'inquirer'
import { execSync } from 'node:child_process'
import { existsSync, writeFileSync } from 'node:fs'
import { logInstructions } from './lib/log.js'
const userScript = '.cache/gitlab-group-script.sh'
/**
* Prompts the user for the GitLab group they wish to run bulk commands on.
*
* @returns {string} The group path string
*/
async function promptForGroup() {
const response = await inquirer.prompt([
{
message: 'Enter the URL of the group you wish to target:',
name: 'groupURL',
type: 'input'
}
])
return response.groupURL.replace('https://gitlab.com/', '').replace('gitlab.com/', '')
}
/**
* If a script was already created, ask if the user would like to re-use it
*
* @returns {string} A boolean answer, true if they want to re-use the script
*/
async function promptForRecycle() {
const response = await inquirer.prompt([
{
message: 'You already created a script (located in .config/gitlab-group-script.sh). Would you like to re-use it?',
name: 'reuseScript',
type: 'confirm'
}
])
return response.reuseScript
}
/**
* Open editor where user can create the bash script they wish to run.
*
* @returns {string} The bash script the user created
*/
async function promptForScript() {
const response = await inquirer.prompt([
{
message: 'Enter the bash script',
name: 'bashScript',
type: 'editor'
}
])
return response.bashScript
}
/**
* Opens the default editor and then saves the file
* to .cache/gitlab-group-script.sh
*/
async function scriptPrompt() {
const script = await promptForScript()
writeFileSync(userScript, script)
}
/**
* Main script logic
*/
async function run() {
logInstructions(
'GitLab Group Command',
'Enter the URL of the GitLab group and this program will run a script on all projects in' +
' that group and its subgroup. After you enter the URL, an editor will open up where you can' +
' write/paste a bash script.'
)
const choice = await promptForGroup()
if (existsSync(userScript)) {
const reuse = await promptForRecycle()
if (!reuse) {
await scriptPrompt()
}
} else {
await scriptPrompt()
}
execSync(`task git:gitlab:group:exec:cli -- ${choice} ---- 'bash ${process.cwd()}/.cache/gitlab-group-script.sh'`, {
stdio: 'inherit'
})
}
run()
| 25.297872 | 120 | 0.663583 |
377dab6bcf89ed34be368677f42704d78920cd7c | 1,920 | js | JavaScript | vendors/tinymce/src/themes/mobile/src/demo/js/demo/StylesMenuDemo.js | royparsaoran/08d96bdd0decfafec36d18226b58e0ea | c0e29e2d34bbfcd2465d6d0ffb05ce5ac45b57fc | [
"MIT"
] | 13 | 2018-01-31T05:54:31.000Z | 2021-01-08T07:24:41.000Z | vendors/tinymce/src/themes/mobile/src/demo/js/demo/StylesMenuDemo.js | royparsaoran/08d96bdd0decfafec36d18226b58e0ea | c0e29e2d34bbfcd2465d6d0ffb05ce5ac45b57fc | [
"MIT"
] | 3 | 2018-04-14T04:25:17.000Z | 2018-12-06T03:13:03.000Z | vendors/tinymce/src/themes/mobile/src/demo/js/demo/StylesMenuDemo.js | royparsaoran/08d96bdd0decfafec36d18226b58e0ea | c0e29e2d34bbfcd2465d6d0ffb05ce5ac45b57fc | [
"MIT"
] | 3 | 2018-01-31T05:52:36.000Z | 2018-04-13T19:47:48.000Z | define(
'tinymce.themes.mobile.demo.StylesMenuDemo',
[
'ephox.alloy.api.component.GuiFactory',
'ephox.alloy.api.system.Attachment',
'ephox.alloy.api.system.Gui',
'ephox.katamari.api.Fun',
'ephox.sugar.api.search.SelectorFind',
'tinymce.themes.mobile.ui.StylesMenu',
'tinymce.themes.mobile.util.UiDomFactory'
],
function (GuiFactory, Attachment, Gui, Fun, SelectorFind, StylesMenu, UiDomFactory) {
return function () {
var ephoxUi = SelectorFind.first('#ephox-ui').getOrDie();
var menu = StylesMenu.sketch({
formats: {
menus: {
'Beta': [
{ title: 'Beta-1', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Beta-2', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Beta-3', isSelected: Fun.constant(false), getPreview: Fun.constant('') }
]
},
expansions: {
'Beta': 'Beta'
},
items: [
{ title: 'Alpha', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Beta', isSelected: Fun.constant(false), getPreview: Fun.constant('') },
{ title: 'Gamma', isSelected: Fun.constant(true), getPreview: Fun.constant('') }
]
},
handle: function (format) {
console.log('firing', format);
}
});
var gui = Gui.create();
Attachment.attachSystem(ephoxUi, gui);
var container = GuiFactory.build({
dom: UiDomFactory.dom('<div class="${prefix}-outer-container ${prefix}-fullscreen-maximized"></div>'),
components: [
{
dom: UiDomFactory.dom('<div class="${prefix}-dropup" style="height: 500px;"></div>'),
components: [
menu
]
}
]
});
gui.add(container);
}
}
);
| 31.47541 | 110 | 0.548958 |
377db4709730164092821cc2fea29c035d42df69 | 716 | js | JavaScript | node-primer/asynchCallback/read.js | Akhil1968/ng-day-3 | de81a38a156d6a05d886b0515414b6fc14883b0b | [
"MIT"
] | null | null | null | node-primer/asynchCallback/read.js | Akhil1968/ng-day-3 | de81a38a156d6a05d886b0515414b6fc14883b0b | [
"MIT"
] | null | null | null | node-primer/asynchCallback/read.js | Akhil1968/ng-day-3 | de81a38a156d6a05d886b0515414b6fc14883b0b | [
"MIT"
] | null | null | null | var fs = require('fs');
var chalk = require("chalk");
console.log("Asynch BEGIN");
var options = {encoding: 'utf8', flag: 'r'};
console.log(chalk.yellow("Data1 contents start"));
fs.readFile('./data1.txt', options, function(err, fileData){
if (err){
console.log(chalk.yellow("File not found"));
}else{
console.log(chalk.yellow(fileData));
console.log(chalk.yellow("Data1 contents over"));
};
});
console.log(chalk.green("Data contents start"));
fs.readFile('./data.txt', options, function(err, fileData){
if (err){
console.log(chalk.green("File not found"));
}else{
console.log(chalk.green(fileData));
console.log(chalk.green("Data contents over"));
};
});
console.log("Asynch Program ends");
| 24.689655 | 60 | 0.678771 |
377e1da6d3a953f9171b1f87ffeda07d6151f91a | 68 | js | JavaScript | src/main/the-main/overview/the-main/api-seo-holder/index.js | jalismrs/formation-vue | b7deef0b861643a389accb2ab3d356685a001b6c | [
"MIT"
] | null | null | null | src/main/the-main/overview/the-main/api-seo-holder/index.js | jalismrs/formation-vue | b7deef0b861643a389accb2ab3d356685a001b6c | [
"MIT"
] | null | null | null | src/main/the-main/overview/the-main/api-seo-holder/index.js | jalismrs/formation-vue | b7deef0b861643a389accb2ab3d356685a001b6c | [
"MIT"
] | 2 | 2020-10-29T13:41:20.000Z | 2021-01-26T10:55:26.000Z | export {default as ApiSeoComponent} from './api-seo.component.vue';
| 34 | 67 | 0.764706 |
377e2369e03a16ed3ea9acb914a905f6f6856738 | 2,637 | js | JavaScript | server/index.js | pohsiangchen/react-boilerplate-todo-list | 05004986c42344d74401fe6aa6638a989e9fca93 | [
"MIT"
] | null | null | null | server/index.js | pohsiangchen/react-boilerplate-todo-list | 05004986c42344d74401fe6aa6638a989e9fca93 | [
"MIT"
] | null | null | null | server/index.js | pohsiangchen/react-boilerplate-todo-list | 05004986c42344d74401fe6aa6638a989e9fca93 | [
"MIT"
] | null | null | null | /* eslint consistent-return:0 import/order:0 */
const express = require('express');
const mongoose = require('mongoose');
const morgan = require('morgan');
const cors = require('cors');
const helmet = require('helmet');
const compression = require('compression');
const Boom = require('boom');
const logger = require('./logger');
const argv = require('./argv');
const port = require('./port');
const setup = require('./middlewares/frontendMiddleware');
const routes = require('./routes');
const buildError = require('./utils/buildError');
const isDev = process.env.NODE_ENV !== 'production';
const ngrok =
(isDev && process.env.ENABLE_TUNNEL) || argv.tunnel
? require('ngrok')
: false;
const { resolve } = require('path');
const mongoDB = 'mongodb://127.0.0.1/todosapp';
mongoose.connect(mongoDB);
mongoose.Promise = global.Promise;
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'MongoDB connection error:'));
const app = express();
// get the intended host and port number, use localhost and port 3000 if not provided
const customHost = argv.host || process.env.HOST;
const host = customHost || null; // Let http.Server use its default IPv6/4 host
const prettyHost = customHost || 'localhost';
app.set('port', port);
app.set('host', host);
// TODO: dotenv
app.locals.title = 'Todo list app';
app.locals.version = '1.0.0';
app.use(cors());
app.use(helmet());
app.use(compression());
app.use(morgan('tiny'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
// If you need a backend, e.g. an API, add your custom backend-specific middleware here
app.use('/api', routes);
// In production we need to pass these values in instead of relying on webpack
setup(app, {
outputPath: resolve(process.cwd(), 'build'),
publicPath: '/',
});
// catch 404 and forward to error handler
app.use((req, res, next) => {
next(Boom.notFound('invalid url'));
});
// error handler
app.use((err, req, res, next) => {
logger.error(err.stack);
const error = buildError(err);
res.status(error.code).json({ error });
});
// use the gzipped bundle
app.get('*.js', (req, res, next) => {
req.url = req.url + '.gz'; // eslint-disable-line
res.set('Content-Encoding', 'gzip');
next();
});
// Start your app.
app.listen(port, host, async err => {
if (err) {
return logger.error(err.message);
}
// Connect to ngrok in dev mode
if (ngrok) {
let url;
try {
url = await ngrok.connect(port);
} catch (e) {
return logger.error(e);
}
logger.appStarted(port, prettyHost, url);
} else {
logger.appStarted(port, prettyHost);
}
});
| 26.636364 | 87 | 0.666667 |