{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n ,\n );\n\n return html;\n };\n\n render() {\n const { children, ...props } = this.props;\n\n return (\n \n {children}\n
\n );\n }\n}\n"}}},{"rowIdx":339,"cells":{"path":{"kind":"string","value":"client/src/components/Admin/Categories/CategoryList.js"},"repo_name":{"kind":"string","value":"hutchgrant/react-boilerplate"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport * as actions from '../../../actions/admin';\n\nclass CategoryList extends Component {\n render() {\n return (\n
\n

Category List

\n
\n );\n }\n};\n\nfunction mapStateToProps({ auth }) {\n return { auth };\n}\n\nexport default connect(mapStateToProps, actions)(CategoryList);"}}},{"rowIdx":340,"cells":{"path":{"kind":"string","value":"frontend/src/admin/header/LogoutButton.js"},"repo_name":{"kind":"string","value":"rabblerouser/core"},"content":{"kind":"string","value":"import React from 'react';\nimport { connect } from 'react-redux';\nimport styled from 'styled-components';\nimport { logout } from '../actions/';\nimport { Button } from '../common';\n\nconst StyledLogoutButton = styled(Button)`\n background-color: ${props => props.theme.primaryColour};\n color: white;\n border: 1px solid white;\n border-radius: 4px;\n font-size: 20px;\n`;\n\nconst LogoutButton = ({ onLogout }) => (\n Logout\n);\n\nconst mapDispatchToProps = dispatch => ({\n onLogout: () => dispatch(logout()),\n});\n\nexport default connect(() => ({}), mapDispatchToProps)(LogoutButton);\n"}}},{"rowIdx":341,"cells":{"path":{"kind":"string","value":"ui/js/components/Show.js"},"repo_name":{"kind":"string","value":"ericsoderberg/pbc-web"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { loadItem, unloadItem } from '../actions';\nimport ItemHeader from './ItemHeader';\nimport Loading from './Loading';\nimport NotFound from './NotFound';\n\nclass Show extends Component {\n\n componentDidMount() {\n this._load(this.props);\n }\n\n componentWillReceiveProps(nextProps) {\n if ((nextProps.category !== this.props.category ||\n nextProps.id !== this.props.id || !nextProps.item)) {\n this._load(nextProps);\n }\n if (nextProps.item) {\n document.title = nextProps.item.name;\n }\n }\n\n componentWillUnmount() {\n const { category, dispatch, id } = this.props;\n dispatch(unloadItem(category, id));\n }\n\n _load(props) {\n const {\n category, dispatch, id, item,\n } = props;\n if (item) {\n document.title = item.name;\n } else {\n dispatch(loadItem(category, id));\n }\n }\n\n render() {\n const {\n actions, category, Contents, item, notFound, title,\n } = this.props;\n\n let contents;\n if (item) {\n contents = ;\n } else if (notFound) {\n contents = ;\n } else {\n contents = ;\n }\n\n return (\n
\n \n {contents}\n
\n );\n }\n}\n\nShow.propTypes = {\n actions: PropTypes.arrayOf(PropTypes.element),\n category: PropTypes.string.isRequired,\n Contents: PropTypes.func.isRequired,\n dispatch: PropTypes.func.isRequired,\n id: PropTypes.string.isRequired,\n item: PropTypes.object,\n notFound: PropTypes.bool,\n title: PropTypes.string,\n};\n\nShow.defaultProps = {\n actions: [],\n item: undefined,\n notFound: false,\n title: undefined,\n};\n\nShow.contextTypes = {\n router: PropTypes.any,\n};\n\nconst select = (state, props) => ({\n id: props.match.params.id,\n item: state[props.match.params.id],\n notFound: state.notFound[props.match.params.id],\n});\n\nexport default connect(select)(Show);\n"}}},{"rowIdx":342,"cells":{"path":{"kind":"string","value":"src/js/components/icons/base/LinkBottom.js"},"repo_name":{"kind":"string","value":"odedre/grommet-final"},"content":{"kind":"string","value":"/** \n * @description LinkBottom SVG Icon. \n * @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon.\n * @property {string} colorIndex - The color identifier to use for the stroke color.\n * If not specified, this component will default to muiTheme.palette.textColor.\n * @property {xsmall|small|medium|large|xlarge|huge} size\t- The icon size. Defaults to small.\n * @property {boolean} responsive - Allows you to redefine what the coordinates. \n * @example \n * \n */\n// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP\n\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport CSSClassnames from '../../../utils/CSSClassnames';\nimport Intl from '../../../utils/Intl';\nimport Props from '../../../utils/Props';\n\nconst CLASS_ROOT = CSSClassnames.CONTROL_ICON;\nconst COLOR_INDEX = CSSClassnames.COLOR_INDEX;\n\nexport default class Icon extends Component {\n render () {\n const { className, colorIndex } = this.props;\n let { a11yTitle, size, responsive } = this.props;\n let { intl } = this.context;\n\n const classes = classnames(\n CLASS_ROOT,\n `${CLASS_ROOT}-link-bottom`,\n className,\n {\n [`${CLASS_ROOT}--${size}`]: size,\n [`${CLASS_ROOT}--responsive`]: responsive,\n [`${COLOR_INDEX}-${colorIndex}`]: colorIndex\n }\n );\n\n a11yTitle = a11yTitle || Intl.getMessage(intl, 'link-bottom');\n\n const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));\n return ;\n }\n};\n\nIcon.contextTypes = {\n intl: PropTypes.object\n};\n\nIcon.defaultProps = {\n responsive: true\n};\n\nIcon.displayName = 'LinkBottom';\n\nIcon.icon = true;\n\nIcon.propTypes = {\n a11yTitle: PropTypes.string,\n colorIndex: PropTypes.string,\n size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),\n responsive: PropTypes.bool\n};\n\n"}}},{"rowIdx":343,"cells":{"path":{"kind":"string","value":"docs/src/examples/elements/Divider/Types/DividerExampleHorizontal.js"},"repo_name":{"kind":"string","value":"Semantic-Org/Semantic-UI-React"},"content":{"kind":"string","value":"import React from 'react'\nimport { Button, Divider, Input, Segment } from 'semantic-ui-react'\n\nconst DividerExampleHorizontal = () => (\n \n \n\n Or\n\n \n \n)\n\nexport default DividerExampleHorizontal\n"}}},{"rowIdx":344,"cells":{"path":{"kind":"string","value":"src/components/BannerNavigation/BannerNavigationWithContent.js"},"repo_name":{"kind":"string","value":"wfp/ui"},"content":{"kind":"string","value":"import PropTypes from 'prop-types';\nimport React from 'react';\nimport { BannerNavigation, BannerNavigationItem } from './BannerNavigation';\nimport Search from '../Search';\nimport Link from '../Link';\n\nconst linkList = [\n { name: 'WFPgo', link: 'https://go.wfp.org/' },\n { name: 'Communities', link: 'https://communities.wfp.org/' },\n { name: 'Manuals', link: 'https://manuals.wfp.org/' },\n { name: 'GoDocs', link: 'https://godocs.wfp.org/' },\n { name: 'WeLearn', link: 'https://welearn.wfp.org/' },\n { name: 'Dashboard', link: 'https://dashboard.wfp.org/' },\n { name: 'OPweb', link: 'https://opweb.wfp.org/' },\n { name: 'Self-Service', link: 'https://selfservice.go.wfp.org/' },\n { name: 'UN Booking Hub', link: 'https://humanitarianbooking.wfp.org/' },\n { name: 'WFP.org', link: 'https://wfp.org/' },\n];\n\nconst BannerNavigationWithContent = ({ searchOnChange, search, ...other }) => (\n \n {linkList.map((e) => (\n \n \n {e.name}\n \n \n ))}\n \n);\n\nBannerNavigationWithContent.propTypes = {\n /**\n * The CSS class name to be placed on the wrapping element.\n */\n className: PropTypes.string,\n /**\n * Specify the max-width on desktop devices (same as \\`Wrapper\\` component)\n */\n pageWidth: PropTypes.oneOf(['sm', 'md', 'lg', 'full']),\n /**\n * Allows to disable the search input\n */\n search: PropTypes.bool,\n /**\n * A onChange Function for the search\n */\n searchOnChange: PropTypes.func,\n};\n\nBannerNavigationWithContent.defaultProps = {\n search: false,\n searchOnChange: () => {},\n};\n\nexport { BannerNavigationWithContent };\n"}}},{"rowIdx":345,"cells":{"path":{"kind":"string","value":"modules/Redirect.js"},"repo_name":{"kind":"string","value":"aaron-goshine/react-router"},"content":{"kind":"string","value":"import React from 'react'\nimport invariant from 'invariant'\nimport { createRouteFromReactElement } from './RouteUtils'\nimport { formatPattern } from './PatternUtils'\nimport { falsy } from './InternalPropTypes'\n\nconst { string, object } = React.PropTypes\n\n/**\n * A is used to declare another URL path a client should\n * be sent to when they request a given URL.\n *\n * Redirects are placed alongside routes in the route configuration\n * and are traversed in the same manner.\n */\nconst Redirect = React.createClass({\n\n statics: {\n \n createRouteFromReactElement(element) {\n const route = createRouteFromReactElement(element)\n\n if (route.from)\n route.path = route.from\n\n route.onEnter = function (nextState, replace) {\n const { location, params } = nextState\n\n let pathname\n if (route.to.charAt(0) === '/') {\n pathname = formatPattern(route.to, params)\n } else if (!route.to) {\n pathname = location.pathname\n } else {\n let routeIndex = nextState.routes.indexOf(route)\n let parentPattern = Redirect.getRoutePattern(nextState.routes, routeIndex - 1)\n let pattern = parentPattern.replace(/\\/*$/, '/') + route.to\n pathname = formatPattern(pattern, params)\n }\n\n replace({\n pathname,\n query: route.query || location.query,\n state: route.state || location.state\n })\n }\n\n return route\n },\n\n getRoutePattern(routes, routeIndex) {\n let parentPattern = ''\n\n for (let i = routeIndex; i >= 0; i--) {\n const route = routes[i]\n const pattern = route.path || ''\n\n parentPattern = pattern.replace(/\\/*$/, '/') + parentPattern\n\n if (pattern.indexOf('/') === 0)\n break\n }\n\n return '/' + parentPattern\n }\n\n },\n\n propTypes: {\n path: string,\n from: string, // Alias for path\n to: string.isRequired,\n query: object,\n state: object,\n onEnter: falsy,\n children: falsy\n },\n\n /* istanbul ignore next: sanity check */\n render() {\n invariant(\n false,\n ' elements are for router configuration only and should not be rendered'\n )\n }\n\n})\n\nexport default Redirect\n"}}},{"rowIdx":346,"cells":{"path":{"kind":"string","value":"src/encoded/static/components/item-pages/components/WorkflowDetailPane/ParameterDetailBody.js"},"repo_name":{"kind":"string","value":"hms-dbmi/fourfront"},"content":{"kind":"string","value":"'use strict';\n\nimport React from 'react';\n\n\nexport const ParameterDetailBody = React.memo(function ParameterDetailBody({ node, minHeight }){\n return (\n
\n
\n
\n\n
\n Parameter Name\n

{ node.name || node.meta.name }

\n
\n\n
\n Value Used\n

\n { node.meta.run_data.value }\n

\n
\n\n
\n
\n
\n
\n );\n});\n\n"}}},{"rowIdx":347,"cells":{"path":{"kind":"string","value":"src/containers/Mcml/Mcml.js"},"repo_name":{"kind":"string","value":"hahoocn/hahoo-admin"},"content":{"kind":"string","value":"import React from 'react';\nimport Helmet from 'react-helmet';\nimport { connect } from 'react-redux';\nimport ButtonToolbar from 'react-bootstrap/lib/ButtonToolbar';\nimport FormControl from 'react-bootstrap/lib/FormControl';\nimport toFloat from 'validator/lib/toFloat';\nimport isDecimal from 'validator/lib/isDecimal';\nimport config from './config';\nimport { filterPage } from '../../utils/filter';\nimport ListRow from './ListRow';\n\nimport {\n Navbar,\n PageWrapper,\n PageHeader,\n List,\n BtnAdd,\n BtnRefresh,\n Pagination,\n Dialog,\n Toast,\n ShowError\n} from '../../components';\n\nimport {\n getList,\n setListStatus,\n publish,\n del,\n order,\n getScrollPosition,\n cleanError,\n cleanLoading\n} from '../../actions/mcml';\n\nclass Mcml extends React.Component {\n static propTypes = {\n data: React.PropTypes.object,\n dispatch: React.PropTypes.func,\n params: React.PropTypes.object\n }\n\n static contextTypes = {\n router: React.PropTypes.object.isRequired\n }\n\n constructor(props) {\n super(props);\n this.state.pageSize = config.pageSize;\n this.pageSelect = this.pageSelect.bind(this);\n this.handleDelConfirm = this.handleDelConfirm.bind(this);\n this.changeOrderIdConfirm = this.changeOrderIdConfirm.bind(this);\n this.refresh = this.refresh.bind(this);\n }\n\n state = {\n pageSize: 10,\n isLoading: false,\n del: {\n isShowDialog: false,\n id: undefined,\n },\n order: {\n isShowDialog: false,\n id: undefined,\n orderId: undefined,\n newOrderId: undefined,\n }\n }\n\n componentWillMount() {\n this.setState({ isLoading: true });\n const { data, dispatch } = this.props;\n if (data.error) {\n dispatch(cleanError());\n }\n if (data.isLoading || data.isUpdating) {\n dispatch(cleanLoading());\n }\n }\n\n componentDidMount() {\n const page = filterPage(this.props.params.page);\n if (page === -1) {\n this.context.router.replace('/notfound');\n } else {\n const { data, dispatch } = this.props;\n if (page !== data.page || data.items.length === 0 ||\n (data.listUpdateTime && ((Date.now() - data.listUpdateTime) > config.listRefreshTime))) {\n dispatch(setListStatus('initPage'));\n dispatch(getList(config.api.resource, page, this.state.pageSize));\n }\n }\n\n if (this.state.isLoading) {\n setTimeout(() => {\n this.setState({ isLoading: false });\n }, 50);\n }\n }\n\n shouldComponentUpdate(nextProps, nextState) {\n const { data } = this.props;\n const page = filterPage(nextProps.params.page);\n if (page === -1) {\n return false;\n }\n if (page !== data.page || data.items.length === 0 ||\n (data.listUpdateTime && ((Date.now() - data.listUpdateTime) > config.listRefreshTime))) {\n return true;\n }\n if (data.shouldUpdate || nextProps.data.shouldUpdate) {\n return true;\n }\n if (nextState.del !== this.state.del ||\n nextState.order !== this.state.order ||\n nextState.isLoading !== this.state.isLoading) {\n return true;\n }\n return false;\n }\n\n componentDidUpdate(prevProps, prevState) {\n const { data, dispatch } = this.props;\n if (!data.isLoading && prevProps.data.isLoading && !data.error) {\n switch (data.listStatus) {\n case 'initPage':\n window.scrollTo(0, this.props.data.scrollY);\n break;\n case 'switchingPage':\n window.scrollTo(0, 0);\n this.context.router.push(`/${config.module}/list/${data.page}`);\n break;\n default:\n }\n dispatch(setListStatus('ok'));\n } else {\n // 直接从浏览器输入页码\n const page = filterPage(this.props.params.page);\n if (page === -1) {\n this.context.router.replace('/notfound');\n } else if (!data.isLoading && page !== data.page && !data.error && data.listStatus === 'ok') {\n dispatch(getList(config.api.resource, page, this.state.pageSize));\n }\n\n if (prevState.isLoading && !this.state.isLoading) {\n window.scrollTo(0, this.props.data.scrollY);\n }\n }\n }\n\n componentWillUnmount() {\n this.props.dispatch(getScrollPosition(window.scrollY));\n }\n\n pageSelect(page) {\n const { dispatch } = this.props;\n dispatch(setListStatus('switchingPage'));\n dispatch(getList(config.api.resource, page, this.state.pageSize));\n }\n\n refresh() {\n const { dispatch, data } = this.props;\n dispatch(getList(config.api.resource, data.page, this.state.pageSize));\n }\n\n handleDelConfirm(code) {\n if (code === 1) {\n this.props.dispatch(del(config.api.resource, this.state.del.id));\n }\n this.setState({ del: { isShowDialog: false, id: undefined } });\n }\n\n changeOrderIdConfirm(code) {\n if (code === 1) {\n if (isDecimal(`${this.state.order.newOrderId}`)) {\n const newOrderId = toFloat(`${this.state.order.newOrderId}`);\n if (newOrderId && newOrderId > 0 && newOrderId !== toFloat(`${this.state.order.orderId}`)) {\n const { dispatch, params } = this.props;\n dispatch(order(config.api.resource, this.state.order.id,\n 'changeOrderId', params.page, this.state.pageSize, newOrderId));\n }\n }\n }\n this.setState({\n order: { isShowDialog: false, id: undefined, orderId: undefined, newOrderId: undefined }\n });\n }\n\n render() {\n const { data, dispatch, params } = this.props;\n const { page } = params;\n const { pageSize } = this.state;\n\n let loading;\n if (data.isLoading || this.state.isLoading) {\n loading = ;\n }\n if (data.isUpdating) {\n loading = ;\n }\n\n let error;\n if (!loading && data.error) {\n error = dispatch(cleanError())} />;\n }\n\n let pageWrapper;\n let dialog;\n if (!this.state.isLoading && data.items && data.items.length > 0) {\n if (this.state.del.isShowDialog) {\n dialog = ;\n }\n if (this.state.order.isShowDialog) {\n dialog = ( this.setState({\n order: Object.assign({}, this.state.order, { newOrderId: e.target.value })\n })}\n />}\n type=\"confirm\"\n onClick={this.changeOrderIdConfirm}\n />);\n }\n\n const rows = data.items.map(item => ( this.setState({ del: { isShowDialog: true, id } })}\n onPublish={id => dispatch(publish(config.api.resource, id, true))}\n onUnPublish={id => dispatch(publish(config.api.resource, id, false))}\n onMoveUp={id => dispatch(order(config.api.resource, id, 'up', page, pageSize))}\n onMoveDown={id => dispatch(order(config.api.resource, id, 'down', page, pageSize))}\n onMoveTo={(id, orderId) => dispatch(order(config.api.resource, id, 'changeOrderId', page, pageSize, orderId))}\n onPopOrderIdPannel={(id, orderId) => this.setState({\n order: { isShowDialog: true, id, orderId, newOrderId: orderId }\n })}\n />));\n\n const pagination = ();\n\n pageWrapper = (
\n \n \n this.context.router.push(`/${config.module}/add`)} />\n \n \n \n\n \n {rows && rows}\n \n\n {pagination && pagination}\n
);\n }\n\n return (\n
\n \n \n\n {dialog && dialog}\n {error && error}\n {loading && loading}\n \n {pageWrapper}\n \n\n
\n );\n }\n}\n\nconst mapStateToProps = (state) => {\n const select = {\n data: state.mcml\n };\n return select;\n};\n\nexport default connect(mapStateToProps)(Mcml);\n"}}},{"rowIdx":348,"cells":{"path":{"kind":"string","value":"frontend/src/Settings/Indexers/Indexers/AddIndexerModal.js"},"repo_name":{"kind":"string","value":"geogolem/Radarr"},"content":{"kind":"string","value":"import PropTypes from 'prop-types';\nimport React from 'react';\nimport Modal from 'Components/Modal/Modal';\nimport AddIndexerModalContentConnector from './AddIndexerModalContentConnector';\n\nfunction AddIndexerModal({ isOpen, onModalClose, ...otherProps }) {\n return (\n \n \n \n );\n}\n\nAddIndexerModal.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n onModalClose: PropTypes.func.isRequired\n};\n\nexport default AddIndexerModal;\n"}}},{"rowIdx":349,"cells":{"path":{"kind":"string","value":"src/js/components/Map.js"},"repo_name":{"kind":"string","value":"kylebyerly-hp/grommet"},"content":{"kind":"string","value":"// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP\n\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { findDOMNode } from 'react-dom';\nimport classnames from 'classnames';\nimport CSSClassnames from '../utils/CSSClassnames';\nimport Intl from '../utils/Intl';\n\nconst CLASS_ROOT = CSSClassnames.MAP;\nconst COLOR_INDEX = CSSClassnames.COLOR_INDEX;\n\nexport default class ResourceMap extends Component {\n\n constructor(props, context) {\n super(props, context);\n\n this._onResize = this._onResize.bind(this);\n this._layout = this._layout.bind(this);\n this._onEnter = this._onEnter.bind(this);\n this._onLeave = this._onLeave.bind(this);\n\n this.state = { ...(this._stateFromProps(props)),\n height: 100, width: 100, paths: [] };\n }\n\n componentDidMount () {\n window.addEventListener('resize', this._onResize);\n this._layout();\n }\n\n componentWillReceiveProps (nextProps) {\n this.setState(this._stateFromProps(nextProps), this._layout);\n }\n\n componentWillUnmount () {\n window.removeEventListener('resize', this._onResize);\n }\n\n _hashItems (data) {\n let result = {};\n data.categories.forEach(category => {\n category.items.forEach(item => {\n result[item.id] = item;\n });\n });\n return result;\n }\n\n _children (parentId, links, items) {\n let result = [];\n links.forEach(link => {\n if (link.parentId === parentId) {\n result.push(items[link.childId]);\n }\n });\n return result;\n }\n\n _parents (childId, links, items) {\n let result = [];\n links.forEach((link) => {\n if (link.childId === childId) {\n result.push(items[link.parentId]);\n }\n });\n return result;\n }\n\n _buildAriaLabels (data, items) {\n const { intl } = this.context;\n let labels = {};\n data.categories.forEach(category => {\n category.items.forEach(item => {\n\n const children = this._children(item.id, data.links, items);\n const parents = this._parents(item.id, data.links, items);\n\n let message = '';\n if (children.length === 0 && parents.length === 0) {\n message = Intl.getMessage(intl, 'No Relationship');\n } else {\n if (parents.length > 0) {\n const prefix = Intl.getMessage(intl, 'Parents');\n const labels = parents.map(item => item.label || item.node).join();\n message += `${prefix}: (${labels})`;\n }\n if (children.length > 0) {\n if (parents.length > 0) {\n message += ', ';\n }\n const prefix = Intl.getMessage(intl, 'Children');\n const labels = children.map(item => item.label || item.node).join();\n message += `${prefix}: (${labels})`;\n }\n }\n\n labels[item.id] = message;\n });\n });\n return labels;\n }\n\n _stateFromProps (props, state = {}) {\n const activeId =\n props.hasOwnProperty('active') ? props.active : state.activeId;\n\n const items = this._hashItems(props.data);\n\n return {\n activeId: activeId,\n ariaLabels: this._buildAriaLabels(props.data, items),\n items: items\n };\n }\n\n _coords (id, containerRect) {\n const element = document.getElementById(id);\n const rect = element.getBoundingClientRect();\n const left = rect.left - containerRect.left;\n const top = rect.top - containerRect.top;\n const midX = left + (rect.width / 2);\n const midY = top + (rect.height / 2);\n return {\n top: [midX, top],\n bottom: [midX, top + rect.height],\n left: [left, midY],\n right: [left + rect.width, midY]\n };\n }\n\n _buildPaths (map) {\n const { linkColorIndex, data: { links }, vertical } = this.props;\n const { activeId } = this.state;\n const rect = map.getBoundingClientRect();\n\n const paths = links.map((link, index) => {\n\n const parentCoords = this._coords(link.parentId, rect);\n const childCoords = this._coords(link.childId, rect);\n\n let p1, p2;\n if (vertical) {\n if (parentCoords.right[0] < childCoords.left[0]) {\n p1 = parentCoords.right;\n p2 = childCoords.left;\n } else {\n p1 = parentCoords.left;\n p2 = childCoords.right;\n }\n } else {\n if (parentCoords.bottom[1] < childCoords.top[1]) {\n p1 = parentCoords.bottom;\n p2 = childCoords.top;\n } else {\n p1 = parentCoords.top;\n p2 = childCoords.bottom;\n }\n }\n\n let commands = `M${p1[0]},${p1[1]}`;\n const midX = p1[0] + ((p2[0] - p1[0]) / 2);\n const midY = p1[1] + ((p2[1] - p1[1]) / 2);\n if (vertical) {\n commands += ` Q ${midX + ((p1[0] - midX) / 2)},${p1[1]}` +\n ` ${midX},${midY}`;\n commands += ` Q ${midX - ((p1[0] - midX) / 2)},${p2[1]}` +\n ` ${p2[0]},${p2[1]}`;\n } else {\n commands += ` Q ${p1[0]},${midY + ((p1[1] - midY) / 2)}` +\n ` ${midX},${midY}`;\n commands += ` Q ${p2[0]},${midY - ((p1[1] - midY) / 2)}` +\n ` ${p2[0]},${p2[1]}`;\n }\n\n const pathColorIndex = link.colorIndex || linkColorIndex;\n const classes = classnames(\n `${CLASS_ROOT}__path`, {\n [`${CLASS_ROOT}__path--active`]:\n (activeId === link.parentId || activeId === link.childId),\n [`${COLOR_INDEX}-${pathColorIndex}`]: pathColorIndex\n }\n );\n\n return (\n \n );\n });\n\n return paths;\n }\n\n _layout () {\n const map = findDOMNode(this._mapRef);\n if (map) {\n this.setState({\n width: map.scrollWidth,\n height: map.scrollHeight,\n paths: this._buildPaths(map)\n });\n }\n }\n\n _onResize () {\n // debounce\n clearTimeout(this._layoutTimer);\n this._layoutTimer = setTimeout(this._layout, 50);\n }\n\n _onEnter (id) {\n this.setState({activeId: id}, this._layout);\n if (this.props.onActive) {\n this.props.onActive(id);\n }\n }\n\n _onLeave () {\n this.setState({activeId: undefined}, this._layout);\n if (this.props.onActive) {\n this.props.onActive(undefined);\n }\n }\n\n _renderItems (items) {\n const { data } = this.props;\n const { activeId, ariaLabels } = this.state;\n return items.map((item, index) => {\n\n const active = activeId === item.id ||\n data.links.some(link => {\n return ((link.parentId === item.id ||\n link.childId === item.id) &&\n (link.parentId === activeId ||\n link.childId === activeId));\n });\n const classes = classnames(\n `${CLASS_ROOT}__item`, {\n [`${CLASS_ROOT}__item--active`]: active,\n [`${CLASS_ROOT}__item--plain`]:\n (item.node && typeof item.node !== 'string')\n }\n );\n\n return (\n
  • \n {item.node || item.label}\n
  • \n );\n });\n }\n\n _renderCategories (categories) {\n return categories.map(category => {\n return (\n
  • \n
    \n {category.label}\n
    \n
      \n {this._renderItems(category.items)}\n
    \n
  • \n );\n });\n }\n\n render () {\n const { className, data, vertical, ...props } = this.props;\n delete props.active;\n delete props.colorIndex;\n delete props.linkColorIndex;\n delete props.onActive;\n const { height, paths, width } = this.state;\n const classes = classnames(\n CLASS_ROOT,\n {\n [`${CLASS_ROOT}--vertical`]: vertical\n },\n className\n );\n\n let categories;\n if (data.categories) {\n categories = this._renderCategories(data.categories);\n }\n\n return (\n
    this._mapRef = ref} {...props} className={classes}>\n \n {paths}\n \n
      \n {categories}\n
    \n
    \n );\n }\n\n}\n\nResourceMap.contextTypes = {\n intl: PropTypes.object\n};\n\nResourceMap.propTypes = {\n active: PropTypes.string,\n data: PropTypes.shape({\n categories: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.node,\n items: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.string,\n node: PropTypes.node\n }))\n })),\n links: PropTypes.arrayOf(PropTypes.shape({\n childId: PropTypes.string.isRequired,\n colorIndex: PropTypes.string,\n parentId: PropTypes.string.isRequired\n }))\n }).isRequired,\n linkColorIndex: PropTypes.string,\n onActive: PropTypes.func,\n vertical: PropTypes.bool\n};\n\nResourceMap.defaultProps = {\n linkColorIndex: 'graph-1'\n};\n"}}},{"rowIdx":350,"cells":{"path":{"kind":"string","value":"src/services/TplEmbeddedLoader.js"},"repo_name":{"kind":"string","value":"webcerebrium/ec-react15-lib"},"content":{"kind":"string","value":"import React from 'react';\nimport { render } from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { Logger } from './Logger';\nimport { getDocumentContext } from './TplContext';\nimport { matchConditions } from './DocumentCondition';\nimport { findDocumentElements } from './DocumentSelector';\nimport { downloadTemplateData } from './TplRouteData';\nimport ApplicationContainer from './../containers/ApplicationContainer';\n\nconst getTemplateDocument = tpl => (tpl ? `--Template-${tpl}` : '');\n\nexport const onStartApplications = (store, mount, callback) => {\n const context = getDocumentContext(store.getState());\n mount.forEach((potentialMount) => {\n // 1) - there has to be potentialMount.selector on the page currently\n const elementRoot = findDocumentElements(potentialMount.selector, document); // eslint-disable-line\n Logger.of('TplEmbeddedLoader.onStartApplication').info('check for mounting',\n potentialMount, 'elementRoot=', elementRoot);\n if (elementRoot) {\n // 2) - potentialMount.condition should be valid.\n let match = true;\n if (potentialMount.condition) {\n match = matchConditions({}, potentialMount.condition, context);\n Logger.of('TplEmbeddedLoader.onStartApplication').info('check for conditions',\n potentialMount.condition, match);\n }\n if (match) {\n // confirmed 'route' match\n const route = potentialMount;\n const { dispatch } = store;\n // we have both element and condition match, mounting it\n // and how to pass ... anything... ? it has global redux mapping...\n Logger.of('TplEmbeddedLoader.onStartApplication').info('mounting template', potentialMount.template);\n const tpl = getTemplateDocument(potentialMount.template);\n dispatch({ type: 'SET_DATA', payload: ['template', tpl] });\n\n downloadTemplateData({\n route,\n tpl,\n store,\n callback: () => {\n // notifying all reducers of what we currently have in the store.\n // this is used for setting up defaults at them.\n dispatch({ type: 'INIT_DATA', payload: store.getState() });\n // Logger.of('TplRouteLoader.Ready').info('state=', store.getState());\n // onDataReady(route, getDocumentContext(store.getState(), dispatch), callback);\n // route is released, we are starting to run hooks from plugins\n const ecOptions = store.getState().globals.ecOptions;\n if (ecOptions.plugins && ecOptions.plugins.length) {\n ecOptions.plugins.forEach((plugin) => {\n if (typeof plugin.onDataReady === 'function') {\n plugin.onDataReady({ route, tpl, store });\n }\n });\n }\n if (typeof callback === 'function') callback();\n }\n });\n const application = (\n \n \n \n );\n render(application, elementRoot);\n }\n }\n });\n};\n\nexport default {\n onStartApplications\n};\n"}}},{"rowIdx":351,"cells":{"path":{"kind":"string","value":"react/features/mobile/navigation/components/conference/ConferenceNavigationContainerRef.js"},"repo_name":{"kind":"string","value":"jitsi/jitsi-meet"},"content":{"kind":"string","value":"import React from 'react';\n\nexport const conferenceNavigationRef = React.createRef();\n\n/**\n * User defined navigation action included inside the reference to the container.\n *\n * @param {string} name - Destination name of the route that has been defined somewhere.\n * @param {Object} params - Params to pass to the destination route.\n * @returns {Function}\n */\nexport function navigate(name: string, params?: Object) {\n return conferenceNavigationRef.current?.navigate(name, params);\n}\n\n/**\n * User defined navigation action included inside the reference to the container.\n *\n * @returns {Function}\n */\nexport function goBack() {\n return conferenceNavigationRef.current?.goBack();\n}\n\n/**\n * User defined navigation action included inside the reference to the container.\n *\n * @param {Object} params - Params to pass to the destination route.\n * @returns {Function}\n */\nexport function setParams(params: Object) {\n return conferenceNavigationRef.current?.setParams(params);\n}\n\n"}}},{"rowIdx":352,"cells":{"path":{"kind":"string","value":"Redux/src/index.js"},"repo_name":{"kind":"string","value":"il-tmfv/ReactTutorialMaxP"},"content":{"kind":"string","value":"import 'babel-polyfill'\nimport React from 'react'\nimport { render } from 'react-dom'\nimport { Provider } from 'react-redux'\nimport App from './containers/App'\nrequire('./styles/app.css')\nimport configureStore from './store/configureStore'\n\nconst store = configureStore()\n\nrender(\n \n
    \n \n
    \n
    ,\n document.getElementById('root')\n)\n"}}},{"rowIdx":353,"cells":{"path":{"kind":"string","value":"client/providers/ServerProvider.js"},"repo_name":{"kind":"string","value":"Sing-Li/Rocket.Chat"},"content":{"kind":"string","value":"import React from 'react';\nimport { Meteor } from 'meteor/meteor';\n\nimport { Info as info } from '../../app/utils';\nimport { ServerContext } from '../contexts/ServerContext';\nimport { APIClient } from '../../app/utils/client';\n\nconst absoluteUrl = (path) => Meteor.absoluteUrl(path);\n\nconst callMethod = (methodName, ...args) => new Promise((resolve, reject) => {\n\tMeteor.call(methodName, ...args, (error, result) => {\n\t\tif (error) {\n\t\t\treject(error);\n\t\t\treturn;\n\t\t}\n\n\t\tresolve(result);\n\t});\n});\n\nconst callEndpoint = (httpMethod, endpoint, ...args) => {\n\tconst allowedHttpMethods = ['get', 'post', 'delete'];\n\tif (!httpMethod || !allowedHttpMethods.includes(httpMethod.toLowerCase())) {\n\t\tthrow new Error('Invalid http method provided to \"useEndpoint\"');\n\t}\n\tif (!endpoint) {\n\t\tthrow new Error('Invalid endpoint provided to \"useEndpoint\"');\n\t}\n\n\tif (endpoint[0] === '/') {\n\t\treturn APIClient[httpMethod.toLowerCase()](endpoint.slice(1), ...args);\n\t}\n\n\treturn APIClient.v1[httpMethod.toLowerCase()](endpoint, ...args);\n};\n\nconst uploadToEndpoint = (endpoint, params, formData) => {\n\tif (endpoint[0] === '/') {\n\t\treturn APIClient.upload(endpoint.slice(1), params, formData).promise;\n\t}\n\n\treturn APIClient.v1.upload(endpoint, params, formData).promise;\n};\n\nconst getStream = (streamName, options = {}) => new Meteor.Streamer(streamName, options);\n\nconst contextValue = {\n\tinfo,\n\tabsoluteUrl,\n\tcallMethod,\n\tcallEndpoint,\n\tuploadToEndpoint,\n\tgetStream,\n};\n\nexport function ServerProvider({ children }) {\n\treturn ;\n}\n"}}},{"rowIdx":354,"cells":{"path":{"kind":"string","value":"app/javascript/mastodon/features/ui/components/column_header.js"},"repo_name":{"kind":"string","value":"mhffdq/mastodon"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\nexport default class ColumnHeader extends React.PureComponent {\n\n static propTypes = {\n icon: PropTypes.string,\n type: PropTypes.string,\n active: PropTypes.bool,\n onClick: PropTypes.func,\n columnHeaderId: PropTypes.string,\n };\n\n handleClick = () => {\n this.props.onClick();\n }\n\n render () {\n const { icon, type, active, columnHeaderId } = this.props;\n let iconElement = '';\n\n if (icon) {\n iconElement = ;\n }\n\n return (\n

    \n \n

    \n );\n }\n\n}\n"}}},{"rowIdx":355,"cells":{"path":{"kind":"string","value":"src/Post.js"},"repo_name":{"kind":"string","value":"drop-table-ryhmatyo/tekislauta-front"},"content":{"kind":"string","value":"import React, { Component } from 'react';\nimport { Link } from 'react-router';\nimport Utilities from './Utilities';\nimport './styles/Post.css';\n\nclass Post extends Component {\n constructor(props) {\n super(props);\n this.containerClassName = 'Post Post--reply';\n }\n\n getIdColor() {\n const ip = this.props.data.ip;\n let r = parseInt(ip.substr(0, 2), 16);\n let g = parseInt(ip.substr(2, 2), 16);\n let b = parseInt(ip.substr(4, 2), 16);\n const modifier = parseInt(ip.substr(6, 2), 16);\n // the ip has 4 bytes, we only need 3. We could use the last one for alpha but that's trash\n // instead, we'll just xor\n r ^= modifier;\n g ^= modifier;\n b ^= modifier;\n let hsl = Utilities.RgbToHsl(r, g, b);\n hsl['s'] -= 20; // desaturate a little for that web 3.0 look\n return `hsl(${hsl.h}, ${hsl.s}%, ${hsl.l}%)`;\n }\n\n render() {\n const idStyle = {\n backgroundColor: this.getIdColor()\n }\n\n return (\n
    \n
    \n \n \n {this.props.data.subject}\n \n \n Anonymous \n (ID: {this.props.data.ip}) \n \n No.{this.props.data.id}\n \n
    \n
    \n \n
    \n
    \n );\n }\n}\n\nclass ReplyLink extends Component {\n render() {\n const link = `/boards/${this.props.board}/thread/${this.props.postId}`;\n if (this.props.onClickFunc !== undefined) {\n return (\n \n [ this.props.onClickFunc(this.props.postId) }>Reply]\n \n );\n } else {\n return (\n \n [Reply]\n \n );\n }\n }\n}\n\nclass ThreadReply extends Component {\n render() {\n var replyId = this.props.message.match(/>> \\b\\d{1,8}/);\n if (replyId) {\n replyId = replyId[0];\n return (\n

    \n {replyId}\n {this.props.message.replace(/>> \\b\\d{1,8}/, '') }\n

    \n )\n }\n\n return (\n

    {this.props.message}

    \n );\n }\n}\n\nclass OriginalPost extends Post { // thread starter\n constructor(props) {\n super(props);\n this.containerClassName = 'Post Post--op';\n }\n}\n\nclass ThreadlistOriginalPost extends OriginalPost {\n constructor(props) {\n super(props);\n this.containerClassName = 'Post Post--op Post--op_threadlist';\n }\n}\n\nexport { Post as default, OriginalPost, ThreadlistOriginalPost };"}}},{"rowIdx":356,"cells":{"path":{"kind":"string","value":"docs/app/Examples/modules/Dropdown/Types/DropdownExamplePointingTwo.js"},"repo_name":{"kind":"string","value":"koenvg/Semantic-UI-React"},"content":{"kind":"string","value":"import React from 'react'\nimport { Dropdown, Menu } from 'semantic-ui-react'\n\nconst DropdownExamplePointingTwo = () => (\n \n \n Home\n \n \n \n Inbox\n Starred\n Sent Mail\n Drafts (143)\n \n Spam (1009)\n Trash\n \n \n \n Browse\n \n \n Help\n \n \n)\n\nexport default DropdownExamplePointingTwo\n"}}},{"rowIdx":357,"cells":{"path":{"kind":"string","value":"packages/screenie-cli/src/browser-reporter/components/tests-chart.js"},"repo_name":{"kind":"string","value":"ParmenionUX/screenie"},"content":{"kind":"string","value":"import React from 'react'\nimport { connect } from 'react-redux'\n\nexport default connect(\n state => ({\n status: state.status,\n }),\n)(({ status }) =>\n
    \n \n {renderTests(status.tests)}\n \n
    \n)\n\nconst PADDING = 20\nconst TEST_PADDING = 30\nconst SNAPSHOT_PADDING = 5\nconst SNAPSHOT_SIZE = 16\n\nfunction renderTests(tests) {\n let x = PADDING\n\n return tests.map(test => {\n const startX = x\n\n if (test.snapshots != null) {\n const snapshots = test.snapshots.map(snapshot => {\n const thisX = x\n x += SNAPSHOT_SIZE + SNAPSHOT_PADDING\n\n return renderSnapshotOrTest(snapshot, test, thisX)\n })\n\n return [\n ,\n ...snapshots,\n ,\n ]\n }\n\n const thisX = x\n x += SNAPSHOT_SIZE + TEST_PADDING\n\n return [\n renderSnapshotOrTest(test, null, thisX),\n ,\n ]\n })\n}\n\nfunction renderSnapshotOrTest(testOrSnapshot, parentTest, x) {\n let snapshotStatusStyle = null\n\n if (testOrSnapshot.passed) {\n snapshotStatusStyle = styles.snapshotPassed\n } else if (testOrSnapshot.passed === false) {\n snapshotStatusStyle = styles.snapshotFailed\n }\n\n return (\n \n \n {parentTest != null\n ? `${parentTest.name} - ${testOrSnapshot.name}`\n : testOrSnapshot.name\n }\n \n \n )\n}\n\nconst styles = {\n container: {\n width: '100%',\n },\n svg: {\n width: '100%',\n height: 300,\n },\n snapshot: {\n fill: 'gray',\n width: SNAPSHOT_SIZE,\n height: SNAPSHOT_SIZE,\n },\n snapshotPassed: {\n fill: 'green',\n },\n snapshotFailed: {\n fill: 'red',\n },\n}\n"}}},{"rowIdx":358,"cells":{"path":{"kind":"string","value":"actor-apps/app-web/src/app/components/ToolbarSection.react.js"},"repo_name":{"kind":"string","value":"sc4599/actor-platform"},"content":{"kind":"string","value":"import React from 'react';\nimport ReactMixin from 'react-mixin';\nimport { IntlMixin } from 'react-intl';\nimport classnames from 'classnames';\n\nimport ActivityActionCreators from 'actions/ActivityActionCreators';\n\nimport DialogStore from 'stores/DialogStore';\nimport ActivityStore from 'stores/ActivityStore';\n\n//import AvatarItem from 'components/common/AvatarItem.react';\n\nconst getStateFromStores = () => {\n return {\n dialogInfo: DialogStore.getSelectedDialogInfo(),\n isActivityOpen: ActivityStore.isOpen()\n };\n};\n\n@ReactMixin.decorate(IntlMixin)\nclass ToolbarSection extends React.Component {\n state = {\n dialogInfo: null,\n isActivityOpen: false\n };\n\n constructor(props) {\n super(props);\n\n DialogStore.addSelectedChangeListener(this.onChange);\n ActivityStore.addChangeListener(this.onChange);\n }\n\n componentWillUnmount() {\n DialogStore.removeSelectedChangeListener(this.onChange);\n ActivityStore.removeChangeListener(this.onChange);\n }\n\n onClick = () => {\n if (!this.state.isActivityOpen) {\n ActivityActionCreators.show();\n } else {\n ActivityActionCreators.hide();\n }\n };\n\n onChange = () => {\n this.setState(getStateFromStores());\n };\n\n render() {\n const info = this.state.dialogInfo;\n const isActivityOpen = this.state.isActivityOpen;\n\n let infoButtonClassName = classnames('button button--icon', {\n 'button--active': isActivityOpen\n });\n\n if (info != null) {\n return (\n
    \n
    \n
    \n
    \n {info.name}\n {info.presence}\n
    \n
    \n
    \n\n
    \n
    \n search\n \n
    \n
    \n \n \n
    \n
    \n
    \n );\n } else {\n return (\n
    \n
    \n );\n }\n }\n}\n\nexport default ToolbarSection;\n"}}},{"rowIdx":359,"cells":{"path":{"kind":"string","value":"src/destinations/render.js"},"repo_name":{"kind":"string","value":"RoyalIcing/gateau"},"content":{"kind":"string","value":"import R from 'ramda'\nimport React from 'react'\nimport { Seed } from 'react-seeds'\n\nconst resolveContentIn = R.curry(function resolveItemIn(source, path) {\n\t//path = R.filter(R.isNil)\n\tconsole.log('resolveContentIn', path, source)\n\tpath = R.insertAll(1, ['content'], path)\n\treturn R.path(path, source)\n})\n\nconst variationForItemIn = R.curry(function adjustItemIn(source, path) {\n\tconst id = R.head(path)\n\treturn R.path([id, 'variationReference'], source)\n})\n\nconst resolveContentUsing = (ingredients) => {\n\tconst resolveIngredientReference = resolveContentIn(ingredients)\n\tconst variationForPath = variationForItemIn(ingredients)\n\treturn (value, { single = true, set, alter } = {}) => {\n\t\tif (R.isNil(value)) {\n\t\t\treturn\n\t\t}\n\t\telse if (value.mentions != null && value.mentions.length > 0 && value.mentions[0] != null) {\n\t\t\tconsole.log('MENTIONS', { set, alter })\n\t\t\tif (set) {\n\t\t\t\tR.forEach(\n\t\t\t\t\t(item) => item.set(set),\n\t\t\t\t\tresult\n\t\t\t\t)\n\t\t\t}\n\t\t\telse if (alter) {\n\t\t\t\tconst path = value.mentions[0]\n\t\t\t\tconst variation = variationForPath(path)\n\t\t\t\tconsole.log('altering variation', variation)\n\t\t\t\tconst innerPath = R.tail(path)\n\t\t\t\tvariation.adjustPath(innerPath, alter)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('RESOLVE', value.mentions)\n\t\t\t\tconst resolved = R.map(resolveIngredientReference, value.mentions)\n\t\t\t\tconsole.log('RESOLVED', resolved)\n\t\t\t\tif (resolved == null) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn single ? resolved[0] : resolved\n\t\t\t}\n\t\t}\n\t\telse if (value.texts != null) {\n\t\t\treturn value.texts\n\t\t}\n\t\telse {\n\t\t\treturn value\n\t\t}\n\t}\n}\n\nfunction elementFromText(text) {\n\treturn {\n\t\ttext,\n\t\treferences: [],\n\t\ttags: {},\n\t\tchildren: []\n\t}\n}\n\nexport const renderElement = ({ ingredients, elementRendererForTags }) => {\n\tconst resolveContent = resolveContentUsing(ingredients)\n\n\tconst extra = {\n\t\telementFromText\n\t}\n\n\tconst Element = R.converge(\n\t\tR.call, [\n\t\t\tR.pipe(\n\t\t\t\tR.props(['defaultTags', 'tags']),\n\t\t\t\tR.apply(R.mergeWith(R.merge)),\n\t\t\t\telementRendererForTags\n\t\t\t),\n\t\t\tR.prop('mentions'),\n\t\t\tR.prop('texts'),\n\t\t\tR.prop('children'),\n\t\t\t(ignore) => Element, // Have to put in closure as it is currently being assigned\n\t\t\tR.always(resolveContent),\n\t\t\tR.always(extra)\n\t\t]\n\t)\n\n\tElement.renderArray = (options, array) => (\n\t\tarray.map((element, index) => (\n\t\t\t\n\t\t))\n\t)\n\n\treturn Element\n}\n\nexport const DefaultSection = ({ children }) => (\n\t\n)\n\nexport const DefaultMaster = ({ children }) => (\n\t\n)\n\nexport const renderTreeUsing = ({\n\telementRendererForTags,\n\tSection = DefaultSection,\n\tMaster = DefaultMaster\n}) => ({\n\tingredients,\n\tcontentTree\n}) => {\n\t// FIXME: use valueForIngredient instead that encapsulates ingredientVariationIndexes \n\tconst Element = renderElement({ ingredients, elementRendererForTags }) \n\n\treturn (\n\t\t\n\t\t{\n\t\t\tcontentTree.map((section, sectionIndex) => (\n\t\t\t\t
    \n\t\t\t\t{\n\t\t\t\t\tsection.map((element, elementIndex) => (\n\t\t\t\t\t\t\t\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t\t
    \n\t\t\t))\n\t\t}\n\t\t
    \n\t)\n}\n"}}},{"rowIdx":360,"cells":{"path":{"kind":"string","value":"src/svg-icons/av/repeat.js"},"repo_name":{"kind":"string","value":"mtsandeep/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet AvRepeat = (props) => (\n \n \n \n);\nAvRepeat = pure(AvRepeat);\nAvRepeat.displayName = 'AvRepeat';\nAvRepeat.muiName = 'SvgIcon';\n\nexport default AvRepeat;\n"}}},{"rowIdx":361,"cells":{"path":{"kind":"string","value":"index.js"},"repo_name":{"kind":"string","value":"techiesanchez/rythus-app"},"content":{"kind":"string","value":"import 'babel-polyfill';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { createStore, applyMiddleware } from 'redux';\nimport createLogger from 'redux-logger';\nimport thunkMiddleware from 'redux-thunk';\nimport reducers from './reducers';\nimport { RythusCardsApp } from './components/App';\n\n\nconst middleware = [ thunkMiddleware ];\nif (process.env.NODE_ENV !== 'production') {\n middleware.push(createLogger());\n}\n\n\n\nvar initialState = {\n displayedCard: {},\n selectedItem: \"Encounter\",\n menuItems: [\n { name: 'resourcez', active: false },\n { name: 'settlementz', active: false },\n { name: 'battallionz', active: false },\n { name: 'heroz', active: false },\n { name: 'merchantz', active: false },\n { name: 'dungeonz', active: false },\n { name: 'villainz', active: false },\n { name: 'monsterz', active: false },\n { name: 'encounterz', active: false },\n { name: 'rewardz', active: false }\n ],\n isFetching: false,\n cards: {},\n discards: {}\n}\n\n\nvar store = createStore(reducers, initialState, applyMiddleware(...middleware));\nrender(\n \n \n ,\n document.getElementById('appy')\n);\n"}}},{"rowIdx":362,"cells":{"path":{"kind":"string","value":"src/client/routes.js"},"repo_name":{"kind":"string","value":"obimod/este"},"content":{"kind":"string","value":"import App from './app/app.react';\nimport Home from './home/index.react';\nimport Login from './auth/index.react';\nimport Me from './me/index.react';\nimport NotFound from './components/notfound.react';\nimport React from 'react';\nimport Todos from './todos/index.react';\nimport {DefaultRoute, NotFoundRoute, Route} from 'react-router';\n\nexport default (\n \n \n \n \n \n \n \n);\n"}}},{"rowIdx":363,"cells":{"path":{"kind":"string","value":"stories/index.js"},"repo_name":{"kind":"string","value":"ionutmilica/react-chartjs-components"},"content":{"kind":"string","value":"import React from 'react';\n\nimport './ComponentsExample';"}}},{"rowIdx":364,"cells":{"path":{"kind":"string","value":"src/svg-icons/communication/message.js"},"repo_name":{"kind":"string","value":"rhaedes/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet CommunicationMessage = (props) => (\n \n \n \n);\nCommunicationMessage = pure(CommunicationMessage);\nCommunicationMessage.displayName = 'CommunicationMessage';\n\nexport default CommunicationMessage;\n"}}},{"rowIdx":365,"cells":{"path":{"kind":"string","value":"ScrollableTabView自定义TarBar/index.android.js"},"repo_name":{"kind":"string","value":"yuanliangYL/ReactNative-Components-Demo"},"content":{"kind":"string","value":"/**\n * Sample React Native App\n * https://github.com/facebook/react-native\n * @flow\n */\n\nimport React, { Component } from 'react';\nimport {\n AppRegistry,\n StyleSheet,\n Text,\n View\n} from 'react-native';\n\nexport default class ScrollableTabView extends Component {\n render() {\n return (\n \n \n Welcome to React Native!\n \n \n To get started, edit index.android.js\n \n \n Double tap R on your keyboard to reload,{'\\n'}\n Shake or press menu button for dev menu\n \n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: '#F5FCFF',\n },\n welcome: {\n fontSize: 20,\n textAlign: 'center',\n margin: 10,\n },\n instructions: {\n textAlign: 'center',\n color: '#333333',\n marginBottom: 5,\n },\n});\n\nAppRegistry.registerComponent('ScrollableTabView', () => ScrollableTabView);\n"}}},{"rowIdx":366,"cells":{"path":{"kind":"string","value":"src/encoded/static/components/viz/FourfrontLogo.js"},"repo_name":{"kind":"string","value":"hms-dbmi/fourfront"},"content":{"kind":"string","value":"'use strict';\n\nimport React from 'react';\nimport _ from 'underscore';\nimport * as d3 from 'd3';\n\n/** Renders out the 4DN Logo SVG as a React element(s) */\nexport class FourfrontLogo extends React.PureComponent {\n\n static defaultProps = {\n 'id' : \"fourfront_logo_svg\",\n 'circlePathDefinitionOrig' : \"m1,30c0,-16.0221 12.9779,-29 29,-29c16.0221,0 29,12.9779 29,29c0,16.0221 -12.9779,29 -29,29c-16.0221,0 -29,-12.9779 -29,-29z\",\n 'circlePathDefinitionHover' : \"m3.33331,34.33326c-2.66663,-17.02208 2.97807,-23.00009 29.99997,-31.33328c27.02188,-8.33321 29.66667,22.31102 16.6669,34.66654c-12.99978,12.35552 -15.64454,20.00017 -28.66669,19.00018c-13.02214,-0.99998 -15.33356,-5.31137 -18.00018,-22.33344z\",\n 'textTransformOrig' : \"translate(9, 37)\",\n 'textTransformHover' : \"translate(48, 24) scale(0.2, 0.6)\",\n 'fgCircleTransformOrig' : \"translate(50, 20) scale(0.35, 0.35) rotate(-135)\",\n 'fgCircleTransformHover' : \"translate(36, 28) scale(0.7, 0.65) rotate(-135)\",\n 'hoverDelayUntilTransform' : 400,\n 'title' : \"Data Portal\"\n };\n\n static svgElemStyle = {\n 'verticalAlign' : 'middle',\n 'display' : 'inline-block',\n 'height' : '100%',\n 'paddingBottom' : 10,\n 'paddingTop' : 10,\n 'transition' : \"padding .3s, transform .3s\",\n 'maxHeight' : 80\n };\n\n static svgBGCircleStyle = {\n 'fill' : \"url(#fourfront_linear_gradient)\",\n \"stroke\" : \"transparent\",\n \"strokeWidth\" : 1\n };\n\n static svgTextStyleOut = {\n 'transition' : \"letter-spacing 1s, opacity .7s, stroke .7s, stroke-width .7s, fill .7s\",\n 'fontSize' : 23,\n 'fill' : '#fff',\n 'fontFamily' : '\"Mada\",\"Work Sans\",Helvetica,Arial,sans-serif',\n 'fontWeight' : '600',\n 'stroke' : 'transparent',\n 'strokeWidth' : 0,\n 'strokeLinejoin' : 'round',\n 'opacity' : 1,\n 'letterSpacing' : 0\n };\n\n static svgTextStyleIn = {\n 'transition' : \"letter-spacing 1s .4s linear, opacity .7s .4s, stroke .7s 4s, stroke-width .7s 4s, fill .7s .4s\",\n 'letterSpacing' : -14,\n 'stroke' : 'rgba(0,0,0,0.2)',\n 'opacity' : 0,\n 'fill' : 'transparent',\n 'strokeWidth' : 15\n };\n\n static svgInnerCircleStyleOut = {\n 'transition': \"opacity 1.2s\",\n 'opacity' : 0,\n 'fill' : 'transparent',\n 'strokeWidth' : 15,\n 'stroke' : 'rgba(0,0,0,0.2)',\n 'fontSize' : 23,\n 'fontFamily' : '\"Mada\",\"Work Sans\",Helvetica,Arial,sans-serif',\n 'fontWeight' : '600',\n 'strokeLinejoin' : 'round'\n };\n\n static svgInnerCircleStyleIn = {\n 'transition': \"opacity 1.2s .6s\",\n 'opacity' : 1\n };\n\n constructor(props){\n super(props);\n this.setHoverStateOnDoTiming = _.throttle(this.setHoverStateOnDoTiming.bind(this), 1000);\n this.setHoverStateOn = this.setHoverStateOn.bind(this);\n this.setHoverStateOff = this.setHoverStateOff.bind(this);\n\n this.svgRef = React.createRef();\n this.bgCircleRef = React.createRef();\n this.fgTextRef = React.createRef();\n this.fgCircleRef = React.createRef();\n\n this.state = { hover : false };\n }\n\n setHoverStateOn(e){\n this.setState({ 'hover': true }, this.setHoverStateOnDoTiming);\n }\n\n setHoverStateOnDoTiming(e){\n const { circlePathDefinitionHover, textTransformHover, fgCircleTransformHover, hoverDelayUntilTransform } = this.props;\n // CSS styles controlled via stylesheets\n\n setTimeout(()=>{\n const { hover } = this.state;\n if (!hover) return; // No longer hovering. Cancel.\n d3.select(this.bgCircleRef.current)\n .interrupt()\n .transition()\n .duration(1000)\n .attr('d', circlePathDefinitionHover);\n\n d3.select(this.fgTextRef.current)\n .interrupt()\n .transition()\n .duration(700)\n .attr('transform', textTransformHover);\n\n d3.select(this.fgCircleRef.current)\n .interrupt()\n .transition()\n .duration(1200)\n .attr('transform', fgCircleTransformHover);\n\n }, hoverDelayUntilTransform);\n }\n\n setHoverStateOff(e){\n const { circlePathDefinitionOrig, textTransformOrig, fgCircleTransformOrig } = this.props;\n this.setState({ 'hover' : false }, ()=>{\n\n d3.select(this.bgCircleRef.current)\n .interrupt()\n .transition()\n .duration(1000)\n .attr('d', circlePathDefinitionOrig);\n\n d3.select(this.fgTextRef.current)\n .interrupt()\n .transition()\n .duration(1200)\n .attr('transform', textTransformOrig);\n\n d3.select(this.fgCircleRef.current)\n .interrupt()\n .transition()\n .duration(1000)\n .attr('transform', fgCircleTransformOrig);\n });\n }\n\n renderDefs(){\n return (\n \n \n \n \n \n \n \n \n \n \n );\n }\n\n render(){\n const { id, circlePathDefinitionOrig, textTransformOrig, fgCircleTransformOrig, onClick, title } = this.props;\n const { hover } = this.state;\n\n return (\n
    \n \n { this.renderDefs() }\n \n \n 4DN\n \n \n O\n \n \n Data Portal\n
    \n );\n }\n\n}\n"}}},{"rowIdx":367,"cells":{"path":{"kind":"string","value":"server/frontend/components/Header/Header.js"},"repo_name":{"kind":"string","value":"SchadkoAO/FDTD_Solver"},"content":{"kind":"string","value":"import React from 'react';\nimport AppBar from 'material-ui/AppBar';\nimport Toolbar from 'material-ui/Toolbar';\nimport Typography from 'material-ui/Typography';\nimport Button from 'material-ui/Button';\nimport IconButton from 'material-ui/IconButton';\nimport MenuIcon from 'material-ui-icons/Menu';\n\nexport const Header = ({ children }) => (\n\t\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\tFDTD Solver\n\t\t\t\n\t\t\n\t\n);\n\nexport default Header;\n"}}},{"rowIdx":368,"cells":{"path":{"kind":"string","value":"src/js/components/Gallery/GalleryImage.js"},"repo_name":{"kind":"string","value":"jamieallen59/jamieallen"},"content":{"kind":"string","value":"import React from 'react'\nimport PropTypes from 'prop-types'\nimport CSSModules from 'react-css-modules'\nimport styles from './Gallery.less'\nimport { className } from './Gallery'\n\nconst GalleryImage = ({ imageUrl, onClick, display = true }) => (\n\t\n\t\t\n\t
    \n)\n\nGalleryImage.propTypes = {\n\tdisplay: PropTypes.bool,\n\timageUrl: PropTypes.string,\n\tonClick: PropTypes.func\n}\n\nexport default CSSModules(GalleryImage, styles, { allowMultiple: true })\n"}}},{"rowIdx":369,"cells":{"path":{"kind":"string","value":"docs/src/examples/elements/Input/index.js"},"repo_name":{"kind":"string","value":"Semantic-Org/Semantic-UI-React"},"content":{"kind":"string","value":"import React from 'react'\nimport Types from './Types'\nimport States from './States'\nimport Variations from './Variations'\nimport Usage from './Usage'\n\nconst InputExamples = () => (\n
    \n \n \n \n \n
    \n)\n\nexport default InputExamples\n"}}},{"rowIdx":370,"cells":{"path":{"kind":"string","value":"src/Parser/Hunter/BeastMastery/Modules/Talents/DireFrenzy.js"},"repo_name":{"kind":"string","value":"enragednuke/WoWAnalyzer"},"content":{"kind":"string","value":"import React from 'react';\nimport Analyzer from 'Parser/Core/Analyzer';\nimport Combatants from 'Parser/Core/Modules/Combatants';\nimport SPELLS from 'common/SPELLS';\nimport SpellIcon from 'common/SpellIcon';\nimport SpellLink from 'common/SpellLink';\nimport STATISTIC_ORDER from 'Main/STATISTIC_ORDER';\nimport { formatPercentage } from 'common/format';\nimport StatisticBox from 'Main/StatisticBox';\nimport ItemDamageDone from 'Main/ItemDamageDone';\nimport Wrapper from 'common/Wrapper';\n\n/*\n * Dire Frenzy\n * Causes your pet to enter a frenzy, performing a flurry of 5 attacks on the target,\n * and gaining 30% increased attack speed for 8 sec, stacking up to 3 times.\n */\n\n//max stacks pet can have of Dire Frenzy buff\nconst MAX_DIRE_FRENZY_STACKS = 3;\n\nconst DIRE_FRENZY_DURATION = 8000;\n\nclass DireFrenzy extends Analyzer {\n\n static dependencies = {\n combatants: Combatants,\n };\n\n damage = 0;\n buffStart = 0;\n buffEnd = 0;\n currentStacks = 0;\n startOfMaxStacks = 0;\n timeAtMaxStacks = 0;\n timeBuffed = 0;\n lastDireFrenzyCast = null;\n timeCalculated = null;\n\n on_initialized() {\n this.active = this.combatants.selected.hasTalent(SPELLS.DIRE_FRENZY_TALENT.id);\n }\n\n on_byPlayer_cast(event) {\n const spellId = event.ability.guid;\n if (spellId !== SPELLS.DIRE_FRENZY_TALENT.id) {\n return;\n }\n this.lastDireFrenzyCast = event.timestamp;\n }\n\n on_byPlayerPet_damage(event) {\n const spellId = event.ability.guid;\n if (spellId !== SPELLS.DIRE_FRENZY_DAMAGE.id) {\n return;\n }\n this.damage += event.amount + (event.absorbed || 0);\n }\n\n on_toPlayerPet_removebuff(event) {\n const spellId = event.ability.guid;\n if (spellId !== SPELLS.DIRE_FRENZY_TALENT.id) {\n return;\n }\n this.timeBuffed += event.timestamp - this.buffStart;\n if (this.currentStacks === MAX_DIRE_FRENZY_STACKS) {\n this.timeAtMaxStacks += event.timestamp - this.startOfMaxStacks;\n }\n this.currentStacks = 0;\n this.timeCalculated = true;\n }\n on_byPlayer_applybuff(event) {\n const spellId = event.ability.guid;\n if (spellId !== SPELLS.DIRE_FRENZY_TALENT.id) {\n return;\n }\n if (this.currentStacks > 0) {\n this.timeBuffed += (this.lastDireFrenzyCast + DIRE_FRENZY_DURATION) - this.buffStart;\n if (this.currentStacks === MAX_DIRE_FRENZY_STACKS) {\n this.timeAtMaxStacks += (this.lastDireFrenzyCast + DIRE_FRENZY_DURATION) - this.startOfMaxStacks;\n }\n }\n this.buffStart = event.timestamp;\n this.currentStacks = 1;\n this.timeCalculated = false;\n }\n on_byPlayer_applybuffstack(event) {\n const spellId = event.ability.guid;\n if (spellId !== SPELLS.DIRE_FRENZY_TALENT.id) {\n return;\n }\n this.currentStacks = event.stack;\n if (this.currentStacks === MAX_DIRE_FRENZY_STACKS) {\n this.startOfMaxStacks = event.timestamp;\n }\n\n }\n\n on_finished() {\n if (!this.timeCalculated) {\n if ((this.lastDireFrenzyCast + DIRE_FRENZY_DURATION) > this.owner.fight.end_time) {\n if (this.currentStacks > 0) {\n this.timeBuffed += this.owner.fight.end_time - this.buffStart;\n }\n if (this.currentStacks === 3) {\n this.timeAtMaxStacks += this.owner.fight.end_time - this.startOfMaxStacks;\n }\n } else {\n if (this.currentStacks > 0) {\n this.timeBuffed += (this.lastDireFrenzyCast + DIRE_FRENZY_DURATION) - this.buffStart;\n }\n if (this.currentStacks === 3) {\n this.timeAtMaxStacks += (this.lastDireFrenzyCast + DIRE_FRENZY_DURATION) - this.startOfMaxStacks;\n }\n }\n }\n }\n\n get percentUptimeMaxStacks() {\n return this.timeAtMaxStacks / this.owner.fightDuration;\n }\n get percentUptimePet() {\n return this.timeBuffed / this.owner.fightDuration;\n }\n\n get percentPlayerUptime() {\n //This calculates the uptime over the course of the encounter of Dire Frenzy for the player\n return (this.combatants.selected.getBuffUptime(SPELLS.DIRE_FRENZY_TALENT_BUFF_1.id) + this.combatants.selected.getBuffUptime(SPELLS.DIRE_FRENZY_TALENT_BUFF_2.id) + this.combatants.selected.getBuffUptime(SPELLS.DIRE_FRENZY_TALENT_BUFF_3.id) + this.combatants.selected.getBuffUptime(SPELLS.DIRE_FRENZY_TALENT_BUFF_4.id) + this.combatants.selected.getBuffUptime(SPELLS.DIRE_FRENZY_TALENT_BUFF_5.id)) / this.owner.fightDuration;\n }\n\n get direFrenzyUptimeThreshold() {\n return {\n actual: this.percentUptimePet,\n isLessThan: {\n minor: 0.85,\n average: 0.75,\n major: 0.7,\n },\n style: 'percentage',\n };\n }\n get direFrenzy3StackThreshold() {\n return {\n actual: this.percentUptimeMaxStacks,\n isLessThan: {\n minor: 0.45,\n average: 0.40,\n major: 0.35,\n },\n style: 'percentage',\n };\n }\n\n suggestions(when) {\n when(this.direFrenzyUptimeThreshold)\n .addSuggestion((suggest, actual, recommended) => {\n return suggest(Your pet has a general low uptime of the buff from , you should never be sitting on 2 stacks of this spells, if you've chosen this talent, it's your most important spell to continously be casting. )\n .icon(SPELLS.DIRE_FRENZY_TALENT.icon)\n .actual(`Your pet had the buff from Dire Frenzy for ${actual}% of the fight`)\n .recommended(`${recommended}% is recommended`);\n });\n when(this.direFrenzy3StackThreshold).addSuggestion((suggest, actual, recommended) => {\n return suggest(Your pet has a general low uptime of the 3 stacked buff from . It's important to try and maintain the buff at 3 stacks for as long as possible, this is done by spacing out your casts, but at the same time never letting them cap on charges. )\n .icon(SPELLS.DIRE_FRENZY_TALENT.icon)\n .actual(`Your pet had 3 stacks of the buff from Dire Frenzy for ${actual}% of the fight`)\n .recommended(`${recommended}% is recommended`);\n });\n }\n statistic() {\n return (\n }\n value={`${formatPercentage(this.percentUptimeMaxStacks)}%`}\n label={`3 Stack Uptime`}\n tooltip={`Your pet had an overall uptime of ${formatPercentage(this.percentUptimePet)}% on the increased attack speed buff
    You had an uptime of ${formatPercentage(this.percentPlayerUptime)}% on the focus regen buff, this number indicates you had an average of ${(this.percentPlayerUptime).toFixed(2)} stacks of the buff up over the course of the encounter`}\n />\n );\n }\n statisticOrder = STATISTIC_ORDER.CORE(5);\n\n subStatistic() {\n return (\n
    \n
    \n \n Dire Frenzy\n \n
    \n
    \n \n
    \n
    \n );\n }\n}\n\nexport default DireFrenzy;\n"}}},{"rowIdx":371,"cells":{"path":{"kind":"string","value":"packages/react/components/actions.js"},"repo_name":{"kind":"string","value":"iamxiaoma/Framework7"},"content":{"kind":"string","value":"import React from 'react';\nimport Mixins from '../utils/mixins';\nimport Utils from '../utils/utils';\nimport __reactComponentWatch from '../runtime-helpers/react-component-watch.js';\nimport __reactComponentDispatchEvent from '../runtime-helpers/react-component-dispatch-event.js';\nimport __reactComponentSlots from '../runtime-helpers/react-component-slots.js';\nimport __reactComponentSetProps from '../runtime-helpers/react-component-set-props.js';\n\nclass F7Actions extends React.Component {\n constructor(props, context) {\n super(props, context);\n this.__reactRefs = {};\n\n (() => {\n Utils.bindMethods(this, ['onOpen', 'onOpened', 'onClose', 'onClosed']);\n })();\n }\n\n onOpen(instance) {\n this.dispatchEvent('actions:open actionsOpen', instance);\n }\n\n onOpened(instance) {\n this.dispatchEvent('actions:opened actionsOpened', instance);\n }\n\n onClose(instance) {\n this.dispatchEvent('actions:close actionsClose', instance);\n }\n\n onClosed(instance) {\n this.dispatchEvent('actions:closed actionsClosed', instance);\n }\n\n open(animate) {\n const self = this;\n if (!self.f7Actions) return undefined;\n return self.f7Actions.open(animate);\n }\n\n close(animate) {\n const self = this;\n if (!self.f7Actions) return undefined;\n return self.f7Actions.close(animate);\n }\n\n render() {\n const self = this;\n const props = self.props;\n const {\n className,\n id,\n style,\n grid\n } = props;\n const classes = Utils.classNames(className, 'actions-modal', {\n 'actions-grid': grid\n }, Mixins.colorClasses(props));\n return React.createElement('div', {\n id: id,\n style: style,\n ref: __reactNode => {\n this.__reactRefs['el'] = __reactNode;\n },\n className: classes\n }, this.slots['default']);\n }\n\n componentWillUnmount() {\n const self = this;\n if (self.f7Actions) self.f7Actions.destroy();\n delete self.f7Actions;\n }\n\n componentDidMount() {\n const self = this;\n const el = self.refs.el;\n if (!el) return;\n const props = self.props;\n const {\n grid,\n target,\n convertToPopover,\n forceToPopover,\n opened,\n closeByBackdropClick,\n closeByOutsideClick,\n closeOnEscape,\n backdrop,\n backdropEl\n } = props;\n const actionsParams = {\n el,\n grid,\n on: {\n open: self.onOpen,\n opened: self.onOpened,\n close: self.onClose,\n closed: self.onClosed\n }\n };\n if (target) actionsParams.targetEl = target;\n {\n if ('convertToPopover' in props) actionsParams.convertToPopover = convertToPopover;\n if ('forceToPopover' in props) actionsParams.forceToPopover = forceToPopover;\n if ('backdrop' in props) actionsParams.backdrop = backdrop;\n if ('backdropEl' in props) actionsParams.backdropEl = backdropEl;\n if ('closeByBackdropClick' in props) actionsParams.closeByBackdropClick = closeByBackdropClick;\n if ('closeByOutsideClick' in props) actionsParams.closeByOutsideClick = closeByOutsideClick;\n if ('closeOnEscape' in props) actionsParams.closeOnEscape = closeOnEscape;\n }\n self.$f7ready(() => {\n self.f7Actions = self.$f7.actions.create(actionsParams);\n\n if (opened) {\n self.f7Actions.open(false);\n }\n });\n }\n\n get slots() {\n return __reactComponentSlots(this.props);\n }\n\n dispatchEvent(events, ...args) {\n return __reactComponentDispatchEvent(this, events, ...args);\n }\n\n get refs() {\n return this.__reactRefs;\n }\n\n set refs(refs) {}\n\n componentDidUpdate(prevProps, prevState) {\n __reactComponentWatch(this, 'props.opened', prevProps, prevState, opened => {\n const self = this;\n if (!self.f7Actions) return;\n\n if (opened) {\n self.f7Actions.open();\n } else {\n self.f7Actions.close();\n }\n });\n }\n\n}\n\n__reactComponentSetProps(F7Actions, Object.assign({\n id: [String, Number],\n className: String,\n style: Object,\n opened: Boolean,\n grid: Boolean,\n convertToPopover: Boolean,\n forceToPopover: Boolean,\n target: [String, Object],\n backdrop: Boolean,\n backdropEl: [String, Object, window.HTMLElement],\n closeByBackdropClick: Boolean,\n closeByOutsideClick: Boolean,\n closeOnEscape: Boolean\n}, Mixins.colorProps));\n\nF7Actions.displayName = 'f7-actions';\nexport default F7Actions;"}}},{"rowIdx":372,"cells":{"path":{"kind":"string","value":"docs/src/app/components/pages/components/RaisedButton/ExampleIcon.js"},"repo_name":{"kind":"string","value":"pradel/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport RaisedButton from 'material-ui/RaisedButton';\nimport {fullWhite} from 'material-ui/styles/colors';\nimport ActionAndroid from 'material-ui/svg-icons/action/android';\nimport FontIcon from 'material-ui/FontIcon';\n\nconst style = {\n margin: 12,\n};\n\nconst RaisedButtonExampleIcon = () => (\n
    \n }\n style={style}\n />\n }\n style={style}\n />\n }\n style={style}\n />\n
    \n);\n\nexport default RaisedButtonExampleIcon;\n"}}},{"rowIdx":373,"cells":{"path":{"kind":"string","value":"src/mongostick/frontend/src/screens/DatabaseOverview.js"},"repo_name":{"kind":"string","value":"RockingRolli/mongostick"},"content":{"kind":"string","value":"import React from 'react'\nimport { Col, Row, Table } from 'antd'\nimport { connect } from 'react-redux'\nimport { formatBytes } from '../lib/mongodb'\nimport { Link } from 'react-router-dom'\n\n\nclass Databases extends React.Component {\n getColumns = () => {\n return [\n {\n title: 'Name',\n dataIndex: 'stats.db',\n key: 'db',\n render: text => {text}\n },\n {\n title: 'Collections',\n dataIndex: 'stats.collections',\n key: 'collections',\n sorter: (a, b) => a.stats.collections - b.stats.collections,\n },\n {\n title: 'Storage Size',\n dataIndex: 'stats.storageSize',\n key: 'storageSize',\n render: text => formatBytes(text),\n sorter: (a, b) => a.stats.storageSize - b.stats.storageSize,\n },\n {\n title: 'Data Size',\n dataIndex: 'stats.dataSize',\n key: 'dataSize',\n render: text => formatBytes(text),\n sorter: (a, b) => a.stats.dataSize - b.stats.dataSize,\n },\n {\n title: 'AVG Obj Size',\n dataIndex: 'stats.avgObjSize',\n key: 'avgObjSize',\n render: text => formatBytes(text),\n sorter: (a, b) => a.stats.avgObjSize - b.stats.avgObjSize,\n },\n {\n title: 'objects',\n dataIndex: 'stats.objects',\n key: 'objects',\n render: text => text.toLocaleString(),\n sorter: (a, b) => a.stats.objects - b.stats.objects,\n },\n {\n title: 'Indexes',\n dataIndex: 'stats.indexes',\n key: 'indexes',\n sorter: (a, b) => a.stats.indexes - b.stats.indexes,\n },\n {\n title: 'Indexes',\n dataIndex: 'stats.indexSize',\n key: 'indexSize',\n render: text => formatBytes(text),\n sorter: (a, b) => a.stats.indexSize - b.stats.indexSize,\n },\n ]\n }\n\n getDataSource = () => {\n const { databases } = this.props\n\n return Object.keys(databases).map((index) => databases[index])\n }\n\n render() {\n return (\n
    \n \n \n record.stats.db}\n />\n \n \n
    \n )\n }\n}\n\nconst mapStateToProps = store => {\n return {\n databases: store.databases,\n }\n}\n\nexport default connect(mapStateToProps)(Databases)\n"}}},{"rowIdx":374,"cells":{"path":{"kind":"string","value":"app/addons/documents/routes-mango.js"},"repo_name":{"kind":"string","value":"apache/couchdb-fauxton"},"content":{"kind":"string","value":"// Licensed under the Apache License, Version 2.0 (the 'License'); you may not\n// use this file except in compliance with the License. You may obtain a copy of\n// the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT\n// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n// License for the specific language governing permissions and limitations under\n// the License.\n\nimport React from 'react';\nimport app from '../../app';\nimport FauxtonAPI from '../../core/api';\nimport Databases from '../databases/resources';\nimport DatabaseActions from '../databases/actions';\nimport Documents from './shared-resources';\nimport {MangoLayoutContainer} from './mangolayout';\n\nconst MangoIndexEditorAndQueryEditor = FauxtonAPI.RouteObject.extend({\n selectedHeader: 'Databases',\n hideApiBar: true,\n hideNotificationCenter: true,\n routes: {\n 'database/:database/_partition/:partitionkey/_index': {\n route: 'createIndex',\n roles: ['fx_loggedIn']\n },\n 'database/:database/_index': {\n route: 'createIndexNoPartition',\n roles: ['fx_loggedIn']\n },\n 'database/:database/_partition/:partitionkey/_find': {\n route: 'findUsingIndex',\n roles: ['fx_loggedIn']\n },\n 'database/:database/_find': {\n route: 'findUsingIndexNoPartition',\n roles: ['fx_loggedIn']\n },\n },\n\n initialize: function (route, options) {\n var databaseName = options[0];\n this.databaseName = databaseName;\n this.database = new Databases.Model({id: databaseName});\n },\n\n findUsingIndexNoPartition: function (database) {\n return this.findUsingIndex(database, '');\n },\n\n findUsingIndex: function (database, partitionKey) {\n const encodedPartitionKey = partitionKey ? encodeURIComponent(partitionKey) : '';\n const url = FauxtonAPI.urls(\n 'allDocs', 'app', encodeURIComponent(this.databaseName), encodedPartitionKey\n );\n\n const partKeyUrlComponent = partitionKey ? `/${encodedPartitionKey}` : '';\n const fetchUrl = '/' + encodeURIComponent(this.databaseName) + partKeyUrlComponent + '/_find';\n\n const crumbs = [\n {name: database, link: url},\n {name: app.i18n.en_US['mango-title-editor']}\n ];\n\n const endpoint = FauxtonAPI.urls('mango', 'query-apiurl', encodeURIComponent(this.databaseName), encodedPartitionKey);\n\n const navigateToPartitionedView = (partKey) => {\n const baseUrl = FauxtonAPI.urls('mango', 'query-app', encodeURIComponent(database),\n encodeURIComponent(partKey));\n FauxtonAPI.navigate('#/' + baseUrl);\n };\n const navigateToGlobalView = () => {\n const baseUrl = FauxtonAPI.urls('mango', 'query-app', encodeURIComponent(database));\n FauxtonAPI.navigate('#/' + baseUrl);\n };\n\n return ;\n },\n\n createIndexNoPartition: function (database) {\n return this.createIndex(database, '');\n },\n\n createIndex: function (database, partitionKey) {\n const designDocs = new Documents.AllDocs(null, {\n database: this.database,\n paging: {\n pageSize: 500\n },\n params: {\n startkey: '_design/',\n endkey: '_design0',\n include_docs: true,\n limit: 500\n }\n });\n\n const encodedPartitionKey = partitionKey ? encodeURIComponent(partitionKey) : '';\n const url = FauxtonAPI.urls(\n 'allDocs', 'app', encodeURIComponent(this.databaseName), encodedPartitionKey\n );\n const endpoint = FauxtonAPI.urls('mango', 'index-apiurl', encodeURIComponent(this.databaseName), encodedPartitionKey);\n\n const crumbs = [\n {name: database, link: url},\n {name: app.i18n.en_US['mango-indexeditor-title']}\n ];\n\n DatabaseActions.fetchSelectedDatabaseInfo(database);\n\n return ;\n }\n});\n\nexport default {\n MangoIndexEditorAndQueryEditor: MangoIndexEditorAndQueryEditor\n};\n"}}},{"rowIdx":375,"cells":{"path":{"kind":"string","value":"src/Row.js"},"repo_name":{"kind":"string","value":"westonplatter/react-bootstrap"},"content":{"kind":"string","value":"import React from 'react';\nimport classNames from 'classnames';\nimport CustomPropTypes from './utils/CustomPropTypes';\n\nconst Row = React.createClass({\n propTypes: {\n /**\n * You can use a custom element for this component\n */\n componentClass: CustomPropTypes.elementType\n },\n\n getDefaultProps() {\n return {\n componentClass: 'div'\n };\n },\n\n render() {\n let ComponentClass = this.props.componentClass;\n\n return (\n \n {this.props.children}\n \n );\n }\n});\n\nexport default Row;\n"}}},{"rowIdx":376,"cells":{"path":{"kind":"string","value":"src/components/Layer/Layer.js"},"repo_name":{"kind":"string","value":"nambawan/g-old"},"content":{"kind":"string","value":"// from : https://github.com/grommet/grommet/blob/master/src/js/components/Layer.js\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport withStyles from 'isomorphic-style-loader/withStyles';\nimport StyleContext from 'isomorphic-style-loader/StyleContext';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { IntlProvider } from 'react-intl';\nimport cn from 'classnames';\nimport LayerContents from '../LayerContents';\nimport s from './Layer.css';\n\nclass Layer extends React.Component {\n static propTypes = {\n onClose: PropTypes.func.isRequired,\n id: PropTypes.string,\n hidden: PropTypes.bool,\n fill: PropTypes.bool,\n };\n\n static defaultProps = {\n id: null,\n hidden: false,\n fill: false,\n };\n\n componentDidMount() {\n this.originalFocusedElement = document.activeElement;\n this.originalScrollPosition = {\n top: window.pageYOffset,\n left: window.pageXOffset,\n };\n this.addLayer();\n this.renderLayer();\n }\n\n componentDidUpdate() {\n this.renderLayer();\n }\n\n componentWillUnmount() {\n const { hidden } = this.props;\n if (this.originalFocusedElement && !hidden) {\n if (this.originalFocusedElement.focus) {\n // wait for the fixed positioning to come back to normal\n // see layer styling for reference\n setTimeout(() => {\n this.originalFocusedElement.focus();\n window.scrollTo(\n this.originalScrollPosition.left,\n this.originalScrollPosition.top,\n );\n }, 0);\n } else if (\n this.originalFocusedElement.parentNode &&\n this.originalFocusedElement.parentNode.focus\n ) {\n // required for IE11 and Edge\n this.originalFocusedElement.parentNode.focus();\n window.scrollTo(\n this.originalScrollPosition.left,\n this.originalScrollPosition.top,\n );\n }\n }\n\n this.removeLayer();\n }\n\n addLayer() {\n const { id } = this.props;\n\n const element = document.createElement('div');\n if (id) {\n element.id = id;\n }\n\n element.className = s.layer;\n const appElements = document.querySelectorAll('#app');\n let beforeElement;\n if (appElements.length > 0) {\n [beforeElement] = appElements;\n } else {\n beforeElement = document.body.firstChild;\n }\n if (beforeElement) {\n this.element = beforeElement.parentNode.insertBefore(\n element,\n beforeElement,\n );\n }\n }\n\n removeLayer() {\n this.element.removeEventListener('animationend', this.onAnimationEnd);\n\n ReactDOM.unmountComponentAtNode(this.element);\n this.element.parentNode.removeChild(this.element);\n this.element = undefined;\n this.handleAriaHidden(true);\n }\n\n handleAriaHidden(hideOverlay) {\n setTimeout(() => {\n const hidden = hideOverlay || false;\n const apps = document.querySelectorAll('#app');\n const visibleLayers = document.querySelectorAll(\n `.${s.layer}:not(.${s.hidden})`,\n );\n\n if (apps) {\n /* eslint-disable no-param-reassign */\n Array.prototype.slice.call(apps).forEach(app => {\n if (hidden && visibleLayers.length === 0) {\n // make sure to only show grommet apps if there is no other layer\n app.setAttribute('aria-hidden', false);\n app.classList.remove(s.hidden);\n // scroll body content to the original position\n app.style.top = `-${this.originalScrollPosition.top}px`;\n app.style.left = `-${this.originalScrollPosition.left}px`;\n } else {\n app.setAttribute('aria-hidden', true);\n app.classList.add(s.hidden);\n // this must be null to work\n app.style.top = null;\n app.style.left = null;\n // app.style.top = `-${this.originalScrollPosition.top}px`;\n // app.style.left = `-${this.originalScrollPosition.left}px`;\n }\n }, this);\n /* eslint-enable no-param-reassign */\n }\n }, 0);\n }\n\n renderLayer() {\n if (this.element) {\n this.element.className = s.layer;\n const { insertCss, store, intl } = this.context;\n const { onClose, fill } = this.props;\n const contents = (\n \n \n \n \n \n );\n ReactDOM.render(contents, this.element, () => {\n const { hidden } = this.props;\n if (hidden) {\n this.handleAriaHidden(true);\n } else {\n this.handleAriaHidden(false);\n }\n });\n }\n }\n\n render() {\n return null;\n }\n}\n\nLayer.contextTypes = {\n insertCss: PropTypes.func.isRequired,\n intl: IntlProvider.childContextTypes.intl,\n locale: PropTypes.string,\n store: PropTypes.shape({\n subscribe: PropTypes.func.isRequired,\n dispatch: PropTypes.func.isRequired,\n getState: PropTypes.func.isRequired,\n }),\n};\n\nexport default withStyles(s)(Layer);\n"}}},{"rowIdx":377,"cells":{"path":{"kind":"string","value":"src/components/AppRoutes.js"},"repo_name":{"kind":"string","value":"trda/seslisozluk-simple-ui-project"},"content":{"kind":"string","value":"import React from 'react';\nimport { Router, browserHistory } from 'react-router';\nimport routes from '../routes';\n\nexport default class AppRoutes extends React.Component {\n render() {\n return (\n window.scrollTo(0, 0)}/>\n );\n }\n}"}}},{"rowIdx":378,"cells":{"path":{"kind":"string","value":"src/navigators/ReduxNavigation.js"},"repo_name":{"kind":"string","value":"jfilter/frag-den-staat-app"},"content":{"kind":"string","value":"import { BackHandler, Linking, Platform } from 'react-native';\nimport { NavigationActions } from 'react-navigation';\nimport { connect } from 'react-redux';\nimport {\n createReactNavigationReduxMiddleware,\n createReduxContainer,\n} from 'react-navigation-redux-helpers';\nimport React from 'react';\nimport BackgroundFetch from 'react-native-background-fetch';\n\nimport {\n GET_REQUEST_ID_HOSTNAME,\n OAUTH_REDIRECT_URI,\n ORIGIN,\n FDROID,\n} from '../globals';\nimport I18n from '../i18n';\n\nimport { errorAlert, successAlert } from '../utils/dropDownAlert';\nimport {\n getUserInformation,\n receiveOauthRedirectError,\n oauthUpdateToken,\n} from '../actions/authentication';\nimport { loadToken, saveToken } from '../utils/secureStorage';\nimport AppNavigator from './AppNavigator';\nimport { fetchInitialToken } from '../utils/oauth';\nimport { searchUpdateAlertMatchesAction } from '../actions/search';\nimport { localNotif, setUp } from '../utils/notifications';\n\n// Note: createReactNavigationReduxMiddleware must be run before createReduxBoundAddListener\nconst navMiddleware = createReactNavigationReduxMiddleware(\n state => state.navigation\n);\n\nconst App = createReduxContainer(AppNavigator, 'root');\n\nclass ReduxNavigation extends React.Component {\n async componentDidMount() {\n BackHandler.addEventListener('hardwareBackPress', this.onBackPress);\n\n // universal linking, when app was closed\n // (and all android calls)\n Linking.getInitialURL().then(url => {\n if (url !== null) this.urlRouter(url);\n });\n\n // deep linking (and all ios)\n Linking.addEventListener('url', this.handleUrlEvent);\n\n const token = await loadToken();\n if (token !== null && Object.keys(token).length !== 0) {\n await this.props.updateToken(token);\n this.props.getUserInformation();\n }\n\n const nav = id => {\n this.props.dispatch(\n NavigationActions.navigate({\n routeName: 'FoiRequestsSingle',\n params: { foiRequestId: id },\n })\n );\n };\n\n if (!FDROID) setUp(nav);\n }\n\n componentWillUnmount() {\n BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);\n Linking.removeEventListener('url', this.handleUrlEvent);\n }\n\n handleUrlEvent = event => this.urlRouter(event.url);\n\n onBackPress = () => {\n const { dispatch, navigation } = this.props;\n // close the app when pressing back button on initial screen\n // because everything is wrapped in a Drawer, we need to go over this first\n // navigator\n if (\n navigation.routes[0].index === 0 &&\n navigation.routes[0].routes[0].index === 0\n ) {\n return false;\n }\n\n dispatch(NavigationActions.back());\n return true;\n };\n\n urlRouter = url => {\n if (url.startsWith(OAUTH_REDIRECT_URI)) {\n this.handleLoginRedirect(url);\n } else {\n this.navigate(url);\n }\n };\n\n handleLoginRedirect = url => {\n // 1. go back to page where clicked login (on iOS)\n if (Platform.OS === 'ios') this.props.dispatch(NavigationActions.back());\n fetchInitialToken(url)\n .then(token => {\n // 2. show message on top\n successAlert\n .getDropDown()\n .alertWithType(\n 'success',\n I18n.t('loginSuccess'),\n I18n.t('loginSuccessMessage')\n );\n\n // 3. update token in redux store\n this.props.updateToken(token);\n\n // 4. fetch information about user from server\n this.props.getUserInformation();\n\n // 5. persists token\n saveToken(token);\n })\n .catch(error =>\n errorAlert.getDropDown().alertWithType('error', 'Error', error.message)\n );\n };\n\n navigate = async url => {\n const { dispatch } = this.props;\n\n // difference for deep linking and unviversal linking\n let route;\n if (url.startsWith(ORIGIN)) {\n route = url.replace(`${ORIGIN}/`, '');\n } else {\n route = url.replace(/.*?:\\/\\//g, '');\n }\n const routeParts = route\n .split('#')[0]\n .split('/')\n .filter(x => x.length > 0);\n const routeName = routeParts[0];\n\n // a for anfrage\n if (routeName === 'a') {\n // short url with the request id\n const id = route.match(/\\/([^\\/]+)\\/?$/)[1];\n dispatch(\n NavigationActions.navigate({\n routeName: 'FoiRequestsSingle',\n params: { foiRequestId: id },\n })\n );\n }\n\n if (routeName === 'anfrage' && routeParts.length !== 5) {\n // open request (defined by slug) in app\n // TODO: currently the same request is fetched twice\n const slug = routeParts.reverse()[0];\n const res = await fetch(`${ORIGIN}/api/v1/request/?slug=${slug}`);\n const id = (await res.json()).objects[0].id;\n dispatch(\n NavigationActions.navigate({\n routeName: 'FoiRequestsSingle',\n params: { foiRequestId: id },\n })\n );\n }\n\n if (routeName === 'anfrage' && routeParts.length === 5) {\n // open an attachment in app\n const messageId = routeParts[2];\n const res = await fetch(\n `https://fragdenstaat.de/api/v1/message/${messageId}`\n );\n const message = await res.json();\n const id = message.request.split('/').reverse()[1];\n\n message.attachments.forEach(x => {\n if (x.name.toLowerCase() === routeParts[4].toLowerCase()) {\n const action1 = NavigationActions.navigate({\n routeName: 'FoiRequestsSingle',\n params: { foiRequestId: id },\n });\n // first to request, then to attachment\n dispatch(action1);\n const action2 = NavigationActions.navigate({\n routeName: 'FoiRequestsPdfViewer',\n params: { url: x.site_url, fileUrl: x.file_url },\n });\n dispatch(action2);\n }\n });\n }\n };\n\n render() {\n const {\n pastAlertMatches,\n alerts,\n hasNotificationPermission,\n searchUpdateAlertMatches,\n } = this.props;\n // background stuff\n if (hasNotificationPermission && alerts.length) {\n BackgroundFetch.configure(\n {\n minimumFetchInterval: 60, // <-- minutes (15 is minimum allowed)\n stopOnTerminate: false, // <-- Android-only,\n startOnBoot: true, // <-- Android-only,\n enableHeadless: true,\n },\n async () => {\n console.log('[js] Received background-fetch event');\n\n const data = await Promise.all(\n alerts.map(async x => {\n const response = await fetch(\n `https://fragdenstaat-alerts.app.vis.one/min/${x}`\n );\n console.log(response);\n const responseJson = await response.json();\n return { terms: x, res: responseJson };\n })\n );\n console.log(pastAlertMatches);\n data.forEach(x => {\n x.res.forEach(({ id }) => {\n // only works on request ids and not message ids.\n if (\n pastAlertMatches[x.terms] === undefined ||\n pastAlertMatches[x.terms].indexOf(id) < 0\n ) {\n localNotif(`Neuer Treffer für \"${x.terms}\"`, id);\n }\n searchUpdateAlertMatches(x.terms, id);\n });\n });\n\n console.log(data);\n\n BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);\n },\n error => {\n console.log('[js] RNBackgroundFetch failed to start', error);\n }\n );\n\n // Optional: Query the authorization status.\n BackgroundFetch.status(status => {\n switch (status) {\n case BackgroundFetch.STATUS_RESTRICTED:\n console.log('BackgroundFetch restricted');\n break;\n case BackgroundFetch.STATUS_DENIED:\n console.log('BackgroundFetch denied');\n break;\n case BackgroundFetch.STATUS_AVAILABLE:\n console.log('BackgroundFetch is enabled');\n break;\n default:\n console.log('default');\n }\n });\n }\n\n const { navigation, dispatch } = this.props;\n\n return ;\n }\n}\n\nconst mapStateToProps = state => ({\n navigation: state.navigation,\n alerts: state.search.alerts,\n pastAlertMatches: state.search.pastAlertMatches,\n hasNotificationPermission: state.settings.hasNotificationPermission,\n});\n\nconst mapDispatchToProps = dispatch => ({\n updateToken: token => dispatch(oauthUpdateToken(token)),\n redirectError: errorMessage =>\n dispatch(receiveOauthRedirectError(errorMessage)),\n getUserInformation: () => dispatch(getUserInformation()),\n searchUpdateAlertMatches: (term, id) =>\n dispatch(searchUpdateAlertMatchesAction(term, id)),\n dispatch,\n});\n\nconst AppWithNavigationState = connect(\n mapStateToProps,\n mapDispatchToProps\n)(ReduxNavigation);\n\nexport { AppWithNavigationState, navMiddleware };\n"}}},{"rowIdx":379,"cells":{"path":{"kind":"string","value":"node_modules/react-bootstrap/es/Popover.js"},"repo_name":{"kind":"string","value":"darklilium/Factigis_2"},"content":{"kind":"string","value":"import _extends from 'babel-runtime/helpers/extends';\nimport _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';\nimport _classCallCheck from 'babel-runtime/helpers/classCallCheck';\nimport _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';\nimport _inherits from 'babel-runtime/helpers/inherits';\nimport classNames from 'classnames';\nimport React from 'react';\nimport isRequiredForA11y from 'react-prop-types/lib/isRequiredForA11y';\n\nimport { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';\n\nvar propTypes = {\n /**\n * An html id attribute, necessary for accessibility\n * @type {string}\n * @required\n */\n id: isRequiredForA11y(React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number])),\n\n /**\n * Sets the direction the Popover is positioned towards.\n */\n placement: React.PropTypes.oneOf(['top', 'right', 'bottom', 'left']),\n\n /**\n * The \"top\" position value for the Popover.\n */\n positionTop: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),\n /**\n * The \"left\" position value for the Popover.\n */\n positionLeft: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),\n\n /**\n * The \"top\" position value for the Popover arrow.\n */\n arrowOffsetTop: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),\n /**\n * The \"left\" position value for the Popover arrow.\n */\n arrowOffsetLeft: React.PropTypes.oneOfType([React.PropTypes.number, React.PropTypes.string]),\n\n /**\n * Title content\n */\n title: React.PropTypes.node\n};\n\nvar defaultProps = {\n placement: 'right'\n};\n\nvar Popover = function (_React$Component) {\n _inherits(Popover, _React$Component);\n\n function Popover() {\n _classCallCheck(this, Popover);\n\n return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));\n }\n\n Popover.prototype.render = function render() {\n var _extends2;\n\n var _props = this.props,\n placement = _props.placement,\n positionTop = _props.positionTop,\n positionLeft = _props.positionLeft,\n arrowOffsetTop = _props.arrowOffsetTop,\n arrowOffsetLeft = _props.arrowOffsetLeft,\n title = _props.title,\n className = _props.className,\n style = _props.style,\n children = _props.children,\n props = _objectWithoutProperties(_props, ['placement', 'positionTop', 'positionLeft', 'arrowOffsetTop', 'arrowOffsetLeft', 'title', 'className', 'style', 'children']);\n\n var _splitBsProps = splitBsProps(props),\n bsProps = _splitBsProps[0],\n elementProps = _splitBsProps[1];\n\n var classes = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[placement] = true, _extends2));\n\n var outerStyle = _extends({\n display: 'block',\n top: positionTop,\n left: positionLeft\n }, style);\n\n var arrowStyle = {\n top: arrowOffsetTop,\n left: arrowOffsetLeft\n };\n\n return React.createElement(\n 'div',\n _extends({}, elementProps, {\n role: 'tooltip',\n className: classNames(className, classes),\n style: outerStyle\n }),\n React.createElement('div', { className: 'arrow', style: arrowStyle }),\n title && React.createElement(\n 'h3',\n { className: prefix(bsProps, 'title') },\n title\n ),\n React.createElement(\n 'div',\n { className: prefix(bsProps, 'content') },\n children\n )\n );\n };\n\n return Popover;\n}(React.Component);\n\nPopover.propTypes = propTypes;\nPopover.defaultProps = defaultProps;\n\nexport default bsClass('popover', Popover);"}}},{"rowIdx":380,"cells":{"path":{"kind":"string","value":"admin/client/App/components/Navigation/Mobile/SectionItem.js"},"repo_name":{"kind":"string","value":"benkroeger/keystone"},"content":{"kind":"string","value":"/**\n * A mobile section\n */\n\nimport React from 'react';\nimport MobileListItem from './ListItem';\nimport { Link } from 'react-router';\n\nconst MobileSectionItem = React.createClass({\n\tdisplayName: 'MobileSectionItem',\n\tpropTypes: {\n\t\tchildren: React.PropTypes.node.isRequired,\n\t\tclassName: React.PropTypes.string,\n\t\tcurrentListKey: React.PropTypes.string,\n\t\thref: React.PropTypes.string.isRequired,\n\t\tlists: React.PropTypes.array,\n\t},\n\t// Render the lists\n\trenderLists () {\n\t\tif (!this.props.lists || this.props.lists.length <= 1) return null;\n\n\t\tconst navLists = this.props.lists.map((item) => {\n\t\t\t// Get the link and the classname\n\t\t\tconst href = item.external ? item.path : `${Keystone.adminPath}/${item.path}`;\n\t\t\tconst className = (this.props.currentListKey && this.props.currentListKey === item.path) ? 'MobileNavigation__list-item is-active' : 'MobileNavigation__list-item';\n\n\t\t\treturn (\n\t\t\t\t\n\t\t\t\t\t{item.label}\n\t\t\t\t\n\t\t\t);\n\t\t});\n\n\t\treturn (\n\t\t\t
    \n\t\t\t\t{navLists}\n\t\t\t
    \n\t\t);\n\t},\n\trender () {\n\t\treturn (\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t\t{this.props.children}\n\t\t\t\t\n\t\t\t\t{this.renderLists()}\n\t\t\t
    \n\t\t);\n\t},\n});\n\nmodule.exports = MobileSectionItem;\n"}}},{"rowIdx":381,"cells":{"path":{"kind":"string","value":"client/components/ui/label.js"},"repo_name":{"kind":"string","value":"bnjbvr/kresus"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { translate as $t } from '../../helpers';\n\nclass LabelComponent extends React.Component {\n state = {\n value: null\n };\n\n handleChange = e => {\n this.setState({\n value: e.target.value\n });\n };\n\n handleFocus = event => {\n // Set the caret at the end of the text.\n let end = (event.target.value || '').length;\n event.target.selectionStart = end;\n event.target.selectionEnd = end;\n };\n\n handleKeyUp = event => {\n if (event.key === 'Enter') {\n event.target.blur();\n } else if (event.key === 'Escape') {\n let { target } = event;\n this.setState(\n {\n value: null\n },\n () => target.blur()\n );\n }\n };\n\n handleBlur = () => {\n if (this.state.value === null) {\n return;\n }\n\n let label = this.state.value.trim();\n\n // If the custom label is equal to the label, remove the custom label.\n if (label === this.props.getLabel()) {\n label = '';\n }\n\n let { customLabel } = this.props.item;\n if (label !== customLabel && (label || customLabel)) {\n this.props.setCustomLabel(label);\n }\n\n this.setState({ value: null });\n };\n\n getCustomLabel() {\n let { customLabel } = this.props.item;\n if (customLabel === null || !customLabel.trim().length) {\n return '';\n }\n return customLabel;\n }\n\n getDefaultValue() {\n let label = this.getCustomLabel();\n if (!label && this.props.displayLabelIfNoCustom) {\n label = this.props.getLabel();\n }\n return label;\n }\n\n render() {\n let label = this.state.value !== null ? this.state.value : this.getDefaultValue();\n let forceEditMode = this.props.forceEditMode ? 'force-edit-mode' : '';\n\n return (\n
    \n {label}\n \n
    \n );\n }\n}\n\nLabelComponent.propTypes /* remove-proptypes */ = {\n // The item from which to get the label.\n item: PropTypes.object.isRequired,\n\n // Whether to display the label if there is no custom label.\n displayLabelIfNoCustom: PropTypes.bool,\n\n // A function to set the custom label when modified.\n setCustomLabel: PropTypes.func.isRequired,\n\n // Force the display of the input even on small screens\n forceEditMode: PropTypes.bool,\n\n // A function that returns the displayed label.\n getLabel: PropTypes.func.isRequired\n};\n\nLabelComponent.defaultProps = {\n displayLabelIfNoCustom: true,\n forceEditMode: false\n};\n\nexport default LabelComponent;\n"}}},{"rowIdx":382,"cells":{"path":{"kind":"string","value":"src/svg-icons/av/explicit.js"},"repo_name":{"kind":"string","value":"frnk94/material-ui"},"content":{"kind":"string","value":"import React from 'react';\nimport pure from 'recompose/pure';\nimport SvgIcon from '../../SvgIcon';\n\nlet AvExplicit = (props) => (\n \n \n \n);\nAvExplicit = pure(AvExplicit);\nAvExplicit.displayName = 'AvExplicit';\nAvExplicit.muiName = 'SvgIcon';\n\nexport default AvExplicit;\n"}}},{"rowIdx":383,"cells":{"path":{"kind":"string","value":"src/components/ExplanationSelection.js"},"repo_name":{"kind":"string","value":"quintel/etmobile"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormattedMessage } from 'react-intl';\n\nimport classNames from 'classnames';\n\nimport offSvg from '../images/explanations/off.svg';\nimport onSvg from '../images/explanations/on.svg';\n\nimport offSelectedSvg from '../images/explanations/off-selected.svg';\nimport onSelectedSvg from '../images/explanations/on-selected.svg';\n\nclass ExplanationSelection extends React.Component {\n constructor() {\n super();\n\n this.state = { selected: null };\n this.choose = this.choose.bind(this);\n }\n\n selectedValue() {\n if (this.state.selected !== null) {\n return this.state.selected;\n }\n\n return this.props.selected;\n }\n\n choose(event) {\n const showExplanations = event.target.value === 'yes';\n\n this.props.onChange(showExplanations);\n\n this.setState({ selected: showExplanations });\n }\n\n render() {\n const selected = this.selectedValue();\n const yesClasses = classNames({ selected: selected === true });\n const noClasses = classNames({ selected: selected !== true });\n\n let yesImg = onSvg;\n let noImg = offSelectedSvg;\n\n if (selected) {\n yesImg = onSelectedSvg;\n noImg = offSvg;\n }\n\n return (\n
    \n \n \n \n\n
      \n
    • \n \n \n \n
    • \n
    • \n \n \n \n
    • \n
    \n
    \n );\n }\n}\n\nExplanationSelection.propTypes = {\n selected: PropTypes.bool.isRequired,\n onChange: PropTypes.func.isRequired\n};\n\nexport default ExplanationSelection;\n"}}},{"rowIdx":384,"cells":{"path":{"kind":"string","value":"src/views/Components/NavigationTree.js"},"repo_name":{"kind":"string","value":"pranked/cs2-web"},"content":{"kind":"string","value":"/**\n * Created by dom on 9/15/16.\n */\n\nimport React from 'react';\nimport { Link } from 'react-router';\n\nconst NavigationTree = React.createClass({\n propTypes: {\n items: React.PropTypes.array.isRequired\n },\n render() {\n const flatten = (item) => {\n return (\n
  • \n {item.name}\n
  • \n );\n };\n return (\n
      \n {this.props.items.map(flatten)}\n
    \n );\n }\n});\n\nexport default NavigationTree;\n"}}},{"rowIdx":385,"cells":{"path":{"kind":"string","value":"app/javascript/mastodon/features/compose/components/warning.js"},"repo_name":{"kind":"string","value":"SerCom-KC/mastodon"},"content":{"kind":"string","value":"import React from 'react';\nimport PropTypes from 'prop-types';\nimport Motion from '../../ui/util/optional_motion';\nimport spring from 'react-motion/lib/spring';\n\nexport default class Warning extends React.PureComponent {\n\n static propTypes = {\n message: PropTypes.node.isRequired,\n };\n\n render () {\n const { message } = this.props;\n\n return (\n \n {({ opacity, scaleX, scaleY }) => (\n
    \n {message}\n
    \n )}\n
    \n );\n }\n\n}\n"}}},{"rowIdx":386,"cells":{"path":{"kind":"string","value":"stalk-messenger/app/components/tabs/chats/index.js"},"repo_name":{"kind":"string","value":"JohnKim/stalk.messenger"},"content":{"kind":"string","value":"/**\n *\n * @flow\n */\n\n'use strict';\n\nimport React, { Component } from 'react';\nimport {\n View,\n StyleSheet,\n Text,\n\tTouchableOpacity,\n} from 'react-native';\n\nimport ChatCell from './ChatCell';\n\nimport { loadChats, leaveChat } from 's5-action';\nimport { S5Header, S5SwipeListView } from 's5-components';\nimport { connect } from 'react-redux';\nimport ActionButton from 'react-native-action-button';\n\nclass ChatsScreen extends Component {\n\n static propTypes = {\n chats: React.PropTypes.object.isRequired,\n messages: React.PropTypes.object.isRequired,\n user: React.PropTypes.object,\n navigator: React.PropTypes.object.isRequired,\n leaveChat: React.PropTypes.func.isRequired,\n };\n\n state = {\n listViewData: []\n };\n\n\tconstructor(props) {\n\t\tsuper(props);\n this._openAddUserView = this._openAddUserView.bind(this);\n\t}\n\n componentDidMount(){\n this.setState({\n listViewData: this.props.chats.list\n });\n }\n\n componentWillReceiveProps (nextProps) {\n if (nextProps.chats.list !== this.props.chats.list) {\n this.setState({\n listViewData: nextProps.chats.list\n });\n }\n }\n\n _onRowPress(chat) {\n this.props.navigator.push({\n chatView: true,\n chat,\n });\n }\n\n _deleteRow(secId, rowId, rowMap, chatId) {\n\n\t\trowMap[`${secId}${rowId}`].closeRow();\n this.props.leaveChat(chatId).then(() => {\n // TODO do something after deleting.\n });\n }\n\n _openAddUserView() {\n this.props.navigator.push({selectUserView: 1});\n }\n\n _renderRow(chat) {\n return (\n this._onRowPress(chat)}\n />\n )\n }\n\n render() {\n return (\n \n\n \n\n this._renderRow(data) }\n renderHiddenRow={ (data, secId, rowId, rowMap) => (\n \n \n Mark as Read\n \n this._deleteRow(secId, rowId, rowMap, data.id) }>\n Leave\n \n \n ) }\n enableEmptySections={true}\n rightOpenValue={-150}\n removeClippedSubviews={false}\n />\n\n \n \n\t );\n }\n}\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tbackgroundColor: 'white',\n\t\tflex: 1\n\t},\n\tstandalone: {\n\t\tmarginTop: 30,\n\t\tmarginBottom: 30,\n\t},\n\tstandaloneRowFront: {\n\t\talignItems: 'center',\n\t\tbackgroundColor: '#CCC',\n\t\tjustifyContent: 'center',\n\t\theight: 50,\n\t},\n\tstandaloneRowBack: {\n\t\talignItems: 'center',\n\t\tbackgroundColor: '#8BC645',\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'space-between',\n\t\tpadding: 15\n\t},\n\tbackTextWhite: {\n\t\tcolor: '#FFF'\n\t},\n\trowFront: {\n\t\talignItems: 'center',\n\t\tbackgroundColor: '#CCC',\n\t\tborderBottomColor: 'black',\n\t\tborderBottomWidth: 1,\n\t\tjustifyContent: 'center',\n\t\theight: 50,\n\t},\n\trowBack: {\n\t\talignItems: 'center',\n\t\tbackgroundColor: '#DDD',\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'space-between',\n\t\tpaddingLeft: 15,\n\t},\n\tbackRightBtn: {\n\t\talignItems: 'center',\n\t\tbottom: 0,\n\t\tjustifyContent: 'center',\n\t\tposition: 'absolute',\n\t\ttop: 0,\n\t\twidth: 75\n\t},\n\tbackRightBtnLeft: {\n\t\tbackgroundColor: 'blue',\n\t\tright: 75\n\t},\n\tbackRightBtnRight: {\n\t\tbackgroundColor: 'red',\n\t\tright: 0\n\t},\n\tcontrols: {\n\t\talignItems: 'center',\n\t\tmarginBottom: 30\n\t},\n\tswitchContainer: {\n\t\tflexDirection: 'row',\n\t\tjustifyContent: 'center',\n\t\tmarginBottom: 5\n\t},\n\tswitch: {\n\t\talignItems: 'center',\n\t\tborderWidth: 1,\n\t\tborderColor: 'black',\n\t\tpaddingVertical: 10,\n\t\twidth: 100,\n\t}\n});\n\nfunction select(store) {\n return {\n user: store.user,\n chats: store.chats,\n messages: store.messages,\n };\n}\n\nfunction actions(dispatch) {\n return {\n loadChats: () => dispatch(loadChats()), // @ TODO not used !!\n leaveChat: (chatId) => dispatch(leaveChat(chatId)),\n };\n}\n\nmodule.exports = connect(select, actions)(ChatsScreen);\n"}}},{"rowIdx":387,"cells":{"path":{"kind":"string","value":"lib/editor/components/question_editors/parts/BulkAddItemsEditorPart.js"},"repo_name":{"kind":"string","value":"jirokun/survey-designer-js"},"content":{"kind":"string","value":"/* eslint-env browser */\nimport React, { Component } from 'react';\nimport { connect } from 'react-redux';\nimport S from 'string';\nimport * as EditorActions from '../../../actions';\n\nclass BulkAddItemsEditorPart extends Component {\n constructor(props) {\n super(props);\n this.state = { inputText: '' };\n }\n\n /** 一括追加を実行する */\n handleBulkAddItems() {\n const { bulkAddItems, bulkAddSubItems, handleExecute, page, question, isTargetSubItems } = this.props;\n if (isTargetSubItems) {\n bulkAddSubItems(page.getId(), question.getId(), this.state.inputText);\n } else {\n bulkAddItems(page.getId(), question.getId(), this.state.inputText);\n }\n handleExecute();\n }\n\n /** タブを改行に置換する */\n handleClickConvertTabToLineBreak() {\n const replacedStr = this.state.inputText.replace(/\\t/g, '\\n');\n this.setState({ inputText: replacedStr });\n }\n\n /** 空行を削除する */\n handleClickDeleteEmptyLines() {\n const lines = this.state.inputText.split(/\\n/);\n const replacedStr = lines.filter(line => !S(line).isEmpty()).join('\\n');\n this.setState({ inputText: replacedStr });\n }\n\n render() {\n return (\n
    \n
    1行に1項目を指定してください。HTMLも指定可能です。
    \n
    Subsets and Splits

    No community queries yet

    The top public SQL queries from the community will appear here once available.