text
stringlengths
7
3.69M
var btns=document.getElementsByTagName('button'); var cat=document.getElementsByClassName('cat')[0]; for(i=0;i<btns.length;i++) { console.log(btns[i]); btns[i].addEventListener('click',()=>{ cat.classList.add('blue-eyes'); cat.classList.remove('blue-eyes'); }); }
/*Detecting buttons and tell it to do something const button = document.getElementById("see-review"); button.addEventListener("click", function () { const review = document.getElementById("review"); if (review.classList.contains('d-none')) { review.classList.remove('d-none'); button.textContent = 'CLOSE REVIEW' } else { review.classList.add('d-none'); button.textContent = 'SEE REVIEW' } }); */ /* stylling a html element const header = document.getElementById('message') // To use css that uses the ' - ' use de camelCase format header.style.fontFamily = 'Arial' header.style.color = '#FFF' header.style.fontWeight = '100' */ /* Working with built-in objects (Date, Math, String, Number) let now = new Date(); // showMessage( now.toDateString()) showMessage(Math.abs(-4.5)) */ /* Passing a object inside a function, the function have free acess about every propertie and method of the object let person = { name: "Matheus", age: 32, partTime: false, }; function incrementAge(alala) { alala.age++; } // pass the reference to the method incrementAge( person ); showMessage(person.age); */ /* Passing a function inside a object that we common call method let person = { name: "Matheus", age: 32, partTime: false, // show info is actully a function but is called method becouse is into a object showInfo: function (realAge) { showMessage(this.name + " is " + realAge); }, }; person.showInfo(20);*/ /* Object with symbol and properties let mySymbol = Symbol(); let person = { name: "Matheus", age: 32, partTime: false, [mySymbol]: 'secretInformation' }; person['age'] = 44; showMessage(person.age); */
import axios from 'axios' var instance = axios.create({ baseURL: '/admin', withCredentials: true, headers: { 'Content-Type': 'application/json;charset=utf-8' }, // timeout:20000 }); export default instance;
import { action, computed, thunk, thunkOn } from 'easy-peasy' import { getOrder, getOrderId, removeOrder, updateOrder } from 'Services/order' const orderAdmin = { orders: [], orderDetail: {}, page: 1, count: computed((state) => state.orders.length), loading: false, loadingOrderDetail: false, setLoading: action((state, payload) => { state.loading = payload }), setLoadingOrderDetail: action((state, payload) => { state.loadingOrderDetail = payload }), setOrder: action((state, payload) => { state.orders = payload state.loading = false }), setOrderDetail: action((state, payload) => { state.orderDetail = payload state.loadingOrderDetail = false }), setPage: action((state, payload) => { state.page = payload }), getAllOrders: thunk(async (actions, payload, { getState }) => { actions.setLoading(true) const page = getState().page try { const { data } = await getOrder(page) actions.setOrder(data) actions.setLoading(false) } catch (error) { actions.setLoading(false) } }), getOrderDetail: thunk(async (actions, id) => { actions.setLoadingOrderDetail(true) try { const { data } = await getOrderId(id) actions.setOrderDetail(data) } catch (error) { actions.setOrderDetail({}) } }), deleteOrder: thunk(async (actions, { id, fnCallback }) => { actions.setLoading(true) try { await removeOrder(id) await actions.getAllOrders() if (fnCallback) { fnCallback(true) } actions.setLoading(false) } catch (error) { actions.setLoading(false) if (fnCallback) { fnCallback(false) } } }), editOrder: thunk(async (actions, { data, fnCallback }) => { actions.setLoading(true) try { await updateOrder(data.id, data) await actions.getAllOrders() actions.setLoading(false) if (fnCallback) { fnCallback(true) } } catch (error) { actions.setLoading(false) if (fnCallback) { fnCallback(true) } } }), getOrderPage: thunkOn( (actions) => [actions.setPage], async (actions, payload, { getState }) => { actions.setLoading(true) const page = getState().page try { const { data } = await getOrder(page) actions.getAllOrders(data) } catch (error) { actions.getAllOrders([]) } } ), } export default orderAdmin
const { app, ipcMain, BrowserWindow } = require('electron') var express = require('express') var ex_app = express() var server = require('http').createServer(ex_app) var request = require('request') const fs = require('fs') const path = require('path') global.ips = [] app.on('ready', () => { // Create the browser window. global.win = new BrowserWindow({ width: 980, height: 760 }) global.win.loadURL(`file://${__dirname}/app/index.html`) //global.win.webContents.openDevTools() global.win.on('closed', () => { global.win = null }) }) app.on('window-all-closed', () => { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } }) app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (global.win === null) { createWindow() } }) ipcMain.on('getIP', (event, arg) => { event.returnValue = global.serverIP }) ipcMain.on('getCode', (event, arg) => { var s = String(fs.readFileSync(path.join(__dirname, 'TIVA-IOT-Arduino', 'TIVA-IOT-Arduino.ino'))) var prev = s.substring(0, s.indexOf('server(') + 7) s = s.substring(s.indexOf('server(') + 7) var after = s.substring(s.indexOf(')')) var ip = global.serverIP.split(".").join(', ') event.returnValue = (prev + ip + after) }) require('./server')(ex_app) ex_app.set('port', process.env.PORT || 3000); server.listen(ex_app.get('port'), function() { console.log("Started server on port " + ex_app.get('port') + " on IP(s) :"); var os = require('os'); var ifaces = os.networkInterfaces(); Object.keys(ifaces).forEach(function(ifname) { var alias = 0; ifaces[ifname].forEach(function(iface) { if ('IPv4' !== iface.family || iface.internal !== false) { // skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses return; } if (alias >= 1) { // this single interface has multiple ipv4 addresses console.log(ifname + ':' + alias, iface.address); } else { // this interface has only one ipv4 adress console.log(iface.address); global.serverIP = iface.address; } ++alias; }); }); });
/* eslint-disable react/require-default-props */ /* eslint-disable react/forbid-prop-types */ import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; import Icon from '../../../icon/Icon'; import IconsStore from '../../IconsStore'; import { FieldContainer, FieldLabel, FieldValue, ListContainer, SearchInput, LabelValueContainer, IsRequiredNote, DisableOverLay, TooltipContainer, TooltipMessage, Container, } from './DropDown.style'; import { dropDownListToggler, renderDropDownList, renderSelectedOptions, dropDownListTogglerBySearchOptions, } from './DropDown.helper'; const DropDown = ({ ...props }) => { const { fieldLabel, fieldValue, searchable, selectFirst, multipleSelection, options, extendDropDownStyle, extendFieldText, icon, iconSize, onChanges, onSearch, isRequired, extendDropDownList, extendDropDownListItem, onClickIconAction, componentName, isDisabled, language, showTooltip, isValid, placeHolder, fontSize, } = props; const [optionList, setOptionList] = useState(options); // for List View const [searchedOptionList, setSearchedOptionList] = useState(options); // for List View const [selectedOptions, setSelectOption] = useState([]); // for selected items const [typedValue, setTypedValue] = useState(''); const toggleDropDowns = () => { const dropDowns = document.querySelectorAll('div[class^="dropdown"]'); const anotherDropDownsLabels = []; // Get all onther dropdown other than the current clicked one dropDowns.forEach(dropDown => { const dropDownClassName = Array.from(dropDown.classList).filter(className => className.includes('dropdown-'), ); if (dropDownClassName[0] !== `dropdown-${componentName}`) { anotherDropDownsLabels.push(dropDownClassName[0]); } }); // Close opened lists of all onther dropdowns anotherDropDownsLabels.forEach(dropDown => { const label = dropDown.split('-')[1]; const list = document.getElementById(`dropdown-list-${label}`); if (list) list.style.display = 'none'; }); }; useEffect( () => { if (options && options.length) { if (selectFirst) { setSelectOption([options[0]]); } if (!_.isEqual(options, searchedOptionList)) { setSearchedOptionList(options); setOptionList(options); } // if (searchable) // dropDownListTogglerBySearchOptions(optionList, `dropdown-list-${componentName}`); } else { setOptionList(options); setSearchedOptionList(options); } }, [options], ); const onItemSelect = (option, index) => { if (multipleSelection) { if (option.isChecked) { const filteredSelectedOptions = selectedOptions.filter( selectedOption => selectedOption.key !== option.key, ); setSelectOption(filteredSelectedOptions); } else { selectedOptions.push(option); setSelectOption(selectedOptions); } options[index] = { ...option, isChecked: !option.isChecked, }; setOptionList(options); if (onChanges) onChanges(selectedOptions); } else { if (searchable) setTypedValue(option.fieldValue); setSelectOption([option]); if (onChanges) { onChanges(option.value); } dropDownListToggler(optionList, `dropdown-list-${componentName}`); } }; useEffect( () => { if (fieldValue !== undefined && optionList && optionList.length) { const filteredOption = optionList.filter(option => option.value === fieldValue); if (filteredOption && filteredOption[0]) { setTypedValue(filteredOption[0].fieldValue); setSelectOption(filteredOption); } } else { const list = document.getElementById(`dropdown-list-${componentName}`); list.style.display = 'none'; setTypedValue(''); setSelectOption([]); setSearchedOptionList(options); } }, [fieldValue, optionList], ); const onSearchInList = value => { onChanges(undefined); if (value) { const serachResult = optionList.filter(option => String(option.fieldValue) .toLowerCase() .includes(String(value).toLowerCase()), ); setSearchedOptionList(serachResult); dropDownListTogglerBySearchOptions(serachResult, `dropdown-list-${componentName}`); } else { setSearchedOptionList(options); } setTypedValue(value); setTimeout(() => { if (onSearch) onSearch(value); }, 1000); }; const isFieldValueRendered = !searchable && selectedOptions.length > 0; const isInputFieldRendered = searchable; const getTooltipMessage = () => { if (showTooltip && fieldValue) { return renderSelectedOptions(selectedOptions, multipleSelection); } return false; }; const onFieldClick = () => { // setFocus(true); if (searchable) { if (document.getElementById(`input-container-${componentName}`)) { document.getElementById(`input-container-${componentName}`).focus(); } } toggleDropDowns(); dropDownListToggler(optionList, `dropdown-list-${componentName}`); }; const listListenerHandler = event => { const myElementToCheckIfClicksAreInsideOf = document.querySelector(`#${componentName}`); if (!myElementToCheckIfClicksAreInsideOf.contains(event.target)) { const list = document.getElementById(`dropdown-list-${componentName}`); list.style.display = 'none'; } }; const addListener = () => { document.body.addEventListener('click', listListenerHandler, true); }; const removeListener = () => { document.body.removeEventListener('click', listListenerHandler, true); }; useEffect(() => { addListener(); return () => { removeListener(); }; }, []); return ( <Container className={`dropdown dropdown-${componentName}`} id={componentName}> <DisableOverLay isDisabled={isDisabled} /> {getTooltipMessage() && ( <TooltipContainer language={language}> <TooltipMessage>{getTooltipMessage()}</TooltipMessage> </TooltipContainer> )} <FieldContainer isValid={isValid} isDimmed={false} extendDropDownStyle={extendDropDownStyle}> <LabelValueContainer style={{ width: '90%' }} onClick={() => { if ((options && options.length) || searchable) onFieldClick(); }} > {fieldLabel && ( <FieldLabel isValueSelected={searchable || selectedOptions.length}> {fieldLabel} {isRequired && <IsRequiredNote>*</IsRequiredNote>} </FieldLabel> )} {isFieldValueRendered ? ( <FieldValue fontSize={fontSize} extendFieldText={extendFieldText}> {renderSelectedOptions(selectedOptions, multipleSelection)} </FieldValue> ) : ( <FieldValue isPlaceHolder fontSize={fontSize} extendFieldText={extendFieldText}> {placeHolder} </FieldValue> )} {isInputFieldRendered && ( <SearchInput extendFieldText={extendFieldText} autoComplete="off" id={`input-container-${componentName}`} type="text" value={typedValue} onChange={e => { onSearchInList(e.target.value); }} /> )} </LabelValueContainer> {icon && ( <Icon className="icon" onClick={() => { if (onClickIconAction) { onClickIconAction(); } else { onFieldClick(); } }} icon={IconsStore.getIcon(icon)} width={iconSize} /> )} </FieldContainer> <div id={`dropdown-list-${componentName}`} style={{ display: 'none', position: 'relative' }}> <ListContainer fontSize={fontSize} extendDropDownList={extendDropDownList}> {renderDropDownList( searchedOptionList, multipleSelection, onItemSelect, { extendDropDownListItem, }, language, )} </ListContainer> </div> </Container> ); }; DropDown.propTypes = { showTooltip: PropTypes.bool, fieldValue: PropTypes.string, fieldLabel: PropTypes.string, icon: PropTypes.string, searchable: PropTypes.bool, selectFirst: PropTypes.bool, multipleSelection: PropTypes.bool, options: PropTypes.array, onChanges: PropTypes.func, iconSize: PropTypes.number, extendDropDownStyle: PropTypes.string, onSearch: PropTypes.func, isHorizontallySorted: PropTypes.bool, isRequired: PropTypes.bool, extendDropDownList: PropTypes.array, extendDropDownListItem: PropTypes.string, onClickIconAction: PropTypes.func, componentName: PropTypes.string, isDisabled: PropTypes.bool, language: PropTypes.string, isValid: PropTypes.bool, placeHolder: PropTypes.string, fontSize: PropTypes.number, extendFieldText: PropTypes.array, }; export default DropDown;
'use strict'; const joi = require('joi'); /** * Результат проверки. * * @typedef {Object} ValidationResult * @property {Boolean} isValid * @property {String} [message] */ /** * Проверяет запрос на соответствие схемам. * * @param {express.Request} req * @param {Object} schemas * @returns {ValidationResult} */ module.exports = function (req, schemas) { let result = validate(req.params, schemas.params); if (!result.isValid) { return result; } result = validate(req.query, schemas.query); if (!result.isValid) { return result; } result = validate(req.body, schemas.body); if (!result.isValid) { return result; } return validate(req.headers, schemas.headers); }; function validate(value, schema) { if (!value || !schema) { return {isValid: true}; } const result = joi.validate(value, schema, {allowUnknown: true}); if (result.error) { return { isValid: false, message: result.error.details[0].message }; } return {isValid: true}; }
const DataTypes = require("sequelize"); const sequelize = require("../config/sequelize"); const Comment = sequelize.define('Comment', { description: { type: DataTypes.STRING, allowNull: false } }, { // timestamps: false }); Comment.associate = function(models){ Comment.belongsTo(models.User, {as: 'commentUser' }); Comment.belongsTo(models.Product, { }); } module.exports = Comment;
$(document).ready(function() { // Добавление класса для мобильного if ($('.small-cart-table tr').length) { $('.small-cart-icon').addClass('small-cart-icon--open'); } else { $('.small-cart-icon').removeClass('small-cart-icon--open'); } // Заполнение корзины аяксом $('body').on('click', '.addToCart', function() { var productId = $(this).data('item-id'); transferEffect(productId, $(this), '.product-wrapper'); if ($(this).parents('.property-form').length) { var request = $(this).parents('.property-form').formSerialize(); } else { var request = 'inCartProductId=' + $(this).data('item-id') + "&amount_input=1"; } $.ajax({ type: "POST", url: mgBaseDir + "/cart", data: "updateCart=1&" + request, dataType: "json", cache: false, success: function(response) { $('.j-modal__cart').addClass('j-modal__cart--open'); $('.small-cart-icon').addClass('small-cart-icon--open'); if ('success' == response.status) { dataSmalCart = ''; response.data.dataCart.forEach(printSmalCartData); $('.small-cart-table').html(dataSmalCart); $('.total .total-sum strong').text(response.data.cart_price_wc); $('.pricesht').text(response.data.cart_price); $('.countsht').text(response.data.cart_count); } } }); return false; }); // Удаление вещи из корзины аяксом $('body').on('click', '.deleteItemFromCart', function() { var $this = $(this); var itemId = $this.data('delete-item-id'); var property = $this.data('property'); var $vari = $this.data('variant'); $.ajax({ type: "POST", url: mgBaseDir + "/cart", data: { action: "cart", // название действия в пользовательском класса Ajaxuser delFromCart: 1, itemId: itemId, property: property, variantId: $vari }, dataType: "json", cache: false, success: function(response) { if ('success' == response.status) { var table = $('.deleteItemFromCart[data-property="' + property + '"][data-delete-item-id="' + itemId + '"]').parents('table'); $('.deleteItemFromCart[data-property="' + property + '"][data-delete-item-id="' + itemId + '"]').parents('tr').remove(); var i = 1; table.find('.index').each(function() { $(this).text(i++); }); $('.total-sum strong').text(response.data.cart_price_wc); response.data.cart_price = response.data.cart_price ? response.data.cart_price : 0; response.data.cart_count = response.data.cart_count ? response.data.cart_count : 0; $('.pricesht').text(response.data.cart_price); $('.countsht').text(response.data.cart_count); $('.cart-table .total-sum-cell strong').text(response.data.cart_price_wc); if ($('.small-cart-table tbody tr').length == 0) { $('.j-modal__cart').removeClass('j-modal__cart--open'); $('.small-cart-icon').removeClass('small-cart-icon--open'); $('.product-cart').hide(); $('.empty-cart-block').show(); $('.payment-option').remove(); }; } } }); return false; }); // Cтроит содержимое маленькой корзины в выпадащем блоке function printSmalCartData(element, index, array) { dataSmalCart += '<tr>\ <td class="j-modal__cart__img">\ <a href="' + mgBaseDir + '/' + ((element.category_url || element.category_url == '') ? element.category_url : 'catalog/') + element.product_url + '"><img src="' + element.image_url_new + '" alt="' + element.title + '" alt="" /></a>\ </td>\ <td class="j-modal__cart__name">\ <ul class="small-cart-list">\ <li><a href="' + mgBaseDir + '/' + ((element.category_url || element.category_url == '') ? element.category_url : 'catalog/') + element.product_url + '">' + element.title + '</a><span class="property">' + element.property_html + '</span></li>\ <li class="qty">К-во: ' + element.countInCart + ' <span>&nbsp; Сумма: ' + element.priceInCart + '</span></li>\ </ul>\ </td>\ <td class="j-modal__cart__remove"><a href="#" class="deleteItemFromCart" title="Удалить" data-delete-item-id="' + element.id + '" data-property="' + element.property + '">&#215;</a></td>\ </tr>'; } });
import ContentConsumer from '../../ctrl-react-content-consumer' import PropTypes from 'prop-types' import React from 'react' import ReactDOM from 'react-dom' import ReactTestUtils from 'react-dom/test-utils' import {checkChild} from '../lib/utilities' const CONTENT = { articles: [ {body: `He's the reason for the teardrops on my guitar`}, {body: `The only thing that keeps me wishing on a wishing star`}, {body: `He's the song in the car I keep singing, don't know why I do`}, ], globalElements: { nav: [ { href: '/home', label: 'Home', }, { href: '/about', label: 'About', }, ], page: { buttons: { back: 'Back Button', }, }, }, } class Nav extends ContentConsumer { render() { const items = this.getContent().map((item, index) => { return <li key={index}><a href={item.href}>{item.label}</a></li> }) return ( <nav> <ul> {items} </ul> </nav> ) } } class Article extends ContentConsumer { render() { return ( <p ref={(c) => { this.body = c }}> {this.getContent('body')} </p> ) } } class Page extends ContentConsumer { render() { return ( <div> {this.props.children} <button ref={(c) => { this.backButton = c }}>{this.getContent('buttons.back')}</button> </div> ) } } class Container extends ContentConsumer { render() { const article = this.props.article return ( <div ref={(c) => { this.node = c }}> <Nav content={this.getContent('globalElements.nav')}/> <Page content={this.getContent('globalElements.page')}> <Article content={ this.getContent(`articles.${article}`) }/> </Page> </div> ) } static propTypes = { article: PropTypes.number, content: PropTypes.object, } } let container let currentArticle = 0 beforeEach(() => { container = ReactTestUtils.renderIntoDocument( <Container article={currentArticle} content={CONTENT} />, ) }) afterEach(() => { ReactDOM.unmountComponentAtNode(container.node.parentNode) currentArticle++ }) CONTENT.articles.forEach((articleContent) => { test('should render components', () => { checkChild(container, Page, (page) => { expect(page.backButton.innerHTML) .toBe(CONTENT.globalElements.page.buttons.back) }) checkChild(container, Article, (article) => { expect(article.body.innerHTML) .toBe(articleContent.body) }) }) })
const bouncyness = 0.007; (function() { AFRAME.registerComponent( 'tokens', { init: function() { }, tick: function (time, delta) { var self = this; const tokens = window.tokens; const initialSetup = !tokens.find(token => token.obj && window.BATscene.contains(token.obj)); for(let i = 0; i < tokens.length; i++) { const token = tokens[i]; if(token.dead) { if(token.obj && token.obj.parentNode) { token.obj.parentNode.removeChild(token.obj); } continue; } if(!token.obj || !window.BATscene.contains(token.obj)) { // token genesis const obj = document.createElement('a-sphere'); obj.setAttribute('color', 'hsl('+~~(Math.random()*255)+', 70%, 50%)'); obj.setAttribute('radius', '0.5'); window.BATscene.appendChild(obj); const latestStage = token.life[initialSetup ? token.life.length -1 : 0]; const modelElement = window.BATViewer.get('elementRegistry').get(latestStage.activityId); const position = { x: modelElement.y * globalScaleFactor + modelElement.height / 2 * globalScaleFactor, y: .75, z: -modelElement.x * globalScaleFactor - modelElement.width / 2 * globalScaleFactor }; const pos = obj.getAttribute('position'); pos.x = position.x; pos.y = position.y; pos.z = position.z; obj.setAttribute('position', pos); token.obj = obj; token.speed = 0.03; token.currentStage = initialSetup ? token.life.length -1 : 0; token.currentResidence = modelElement; token.targetPosition = [{ x: modelElement.y * globalScaleFactor + Math.random() * modelElement.height * globalScaleFactor, z: -modelElement.x * globalScaleFactor - Math.random() * modelElement.width * globalScaleFactor }]; token.bounceCycle = Math.random() * 2 * Math.PI; } while(token.currentStage < token.life.length - 1) { if(token.speed === 0.03) { token.targetPosition.length = 0; } if(token.newPositionTimeout) { window.clearTimeout(token.newPositionTimeout); token.newPositionTimeout = null; } token.speed = .7; token.currentStage++; const targetActivity = token.life[token.currentStage].activityId; const sequenceFlow = token.currentResidence.outgoing.find(connection => { return connection.businessObject.targetRef.id === targetActivity; }); if(sequenceFlow) { token.targetPosition.push({ x: token.currentResidence.y * globalScaleFactor + .5 * token.currentResidence.height * globalScaleFactor, z: -token.currentResidence.x * globalScaleFactor - .5 * token.currentResidence.width * globalScaleFactor }); sequenceFlow.waypoints.forEach(({x,y}) => { token.targetPosition.push({ x: y * globalScaleFactor, z: -x * globalScaleFactor }); }); token.currentResidence = window.BATViewer.get('elementRegistry').get(targetActivity); token.targetPosition.push({ x: token.currentResidence.y * globalScaleFactor + .5 * token.currentResidence.height * globalScaleFactor, z: -token.currentResidence.x * globalScaleFactor - .5 * token.currentResidence.width * globalScaleFactor }); } else { console.log('could not find connection to next activity'); debugger; } } const pos = token.obj.getAttribute('position'); if(pos) { pos.y = .75 + .5 * Math.sin(token.bounceCycle); token.bounceCycle += delta * bouncyness; token.bounceCycle %= Math.PI * 2; // move token closer to its target position if(token.targetPosition[0]) { const vector = [ token.targetPosition[0].x - pos.x, token.targetPosition[0].z - pos.z ]; // normalize and apply movement speed const vectorLength = Math.sqrt(vector[0] ** 2 + vector[1] ** 2); vector[0] *= token.speed / vectorLength; vector[1] *= token.speed / vectorLength; pos.x += vector[0]; pos.z += vector[1]; if(vectorLength < token.speed) { // targetPosition reached pos.x = token.targetPosition[0].x; pos.z = token.targetPosition[0].z; token.targetPosition.shift(); } } token.obj.setAttribute('position', pos); if(token.targetPosition.length === 0 && !token.newPositionTimeout) { // set a new targetposition to avoid idling around token.newPositionTimeout = setTimeout(() => { token.speed = 0.03; token.targetPosition.push({ x: token.currentResidence.y * globalScaleFactor + Math.random() * token.currentResidence.height * globalScaleFactor, z: -token.currentResidence.x * globalScaleFactor - Math.random() * token.currentResidence.width * globalScaleFactor }); token.newPositionTimeout = null; }, 1500); } } } } }); })();
eserver = require('express'); const product_class = require('./services/products') productRouter = require('./apis/product').productRouter; cartRouter = require('./apis/cart_api').cartRouter; server = eserver() const parser = require('body-parser'); server.use(parser.json()); const cors = require('cors'); server.use(cors()); product_class.add_all_products_once() server.get('/status',(req,reep)=>{ reep.status(200).json({ message:"hit success" }) }) server.use('/products',productRouter); server.use('/cart',cartRouter); server.listen(8800,()=>{ console.log("server started"); });
import React, { Component } from "react"; export default class Comp3 extends Component { render() { return ( <div style={{ backgroundColor: "blue", height: "100%" }}> <h1>Comp3...</h1> </div> ); } }
const { generateFieldMask, applyFieldMask } = require('./lib/fieldmask'); module.exports.generateFieldMask = generateFieldMask; module.exports.applyFieldMask = applyFieldMask;
export { TransactionHistoryPage } from './transaction-history';
function getChildWithClassname(parent, classname) { if (!parent) { return false; } for (var i = 0; i < parent.childNodes.length; i++) { if (parent.childNodes[i].className == classname) { return parent.childNodes[i]; break; } } } export default getChildWithClassname;
// ==UserScript== // @name Zhihu Auto Dark Mode // @name:zh-CN 知乎自动切换深色模式 // @namespace http://tampermonkey.net/ // @version 0.1 // @description Turn on/off dark mode automatically in zhihu.com based on the color scheme of OS. // @description:zh-CN 根据系统配色自动开启/关闭 zhihu.com 的深色模式 // @author Jiachen Chen // @match *://*.zhihu.com/* // ==/UserScript== (function () { "use strict"; const currentTheme = document .getElementsByTagName("html")[0] .getAttribute("data-theme"); if ( window.matchMedia && window.matchMedia("(prefers-color-scheme: light)").matches ) { if (currentTheme === "dark") { window.location.replace("?theme=light"); } } window .matchMedia("(prefers-color-scheme: light)") .addEventListener("change", (e) => { if (currentTheme === "dark") { window.location.replace("?theme=light"); } }); if ( window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ) { if (currentTheme === "light") { window.location.replace("?theme=dark"); } } window .matchMedia("(prefers-color-scheme: dark)") .addEventListener("change", (e) => { if (currentTheme === "light") { window.location.replace("?theme=dark"); } }); })();
/** * Created by Tran Tien on 14/02/2017. */ var Waste = require('../../app/models/status.js'); var UserPost = require('../../app/models/user.js'); var Hastag = require('../../app/models/hastag.js'); function getNewFeed(id_user,follower,skip,callback) { var requestedWastes = []; if(follower.length>0) { for (var i = 0, len = follower.length; i < len; i++) { requestedWastes.push({userId: follower[i].userId}); } } requestedWastes.push({userId: id_user}); Waste.find({$and: [{$or: requestedWastes},{ group_id : { $exists: false }},{ write_wall : { $exists: false }}]}) .sort({date: -1}).skip(skip).limit(10) .exec(function(err, allWastes){ callback(err,allWastes); }); } function getNewFeedMe(id,skip,callback) { Waste.find({$or:[{$and: [{"userId":id},{group_id : {$exists: false}},{ write_wall : { $exists: false }}]},{id_write_wall:id}]}) .sort({date: -1}).skip(skip).limit(10) .exec(function(err, allWastes){ callback(err,allWastes); }); } function getNewFeedMeImage(id,skip,callback) { Waste.find({$and: [{"userId":id},{group_id : {$exists: false}},{image : {$ne: [] }},{ write_wall : { $exists: false }} ]}) .sort({date: -1}).skip(skip).limit(12) .exec(function(err, allWastes){ callback(err,allWastes); }); } function getNewFeedGroup(id,skip,callback) { Waste.find({"group_id":id}) .sort({date: -1}).skip(skip).limit(10) .exec(function(err, allWastes){ callback(err,allWastes); }); } function getStatusPost(id,callback) { Waste.findOne({"_id":id}) .sort({date: -1}) .exec(function(err, allWastes){ callback(err,allWastes); }); } function getUserPostStatus(id,callback) { UserPost.findOne({"_id":id}) .sort({date: -1}) .exec(function(err, allWastes){ callback(err,allWastes); }); } function getDateTime() { var date = new Date(); var hour = date.getHours(); hour = (hour < 10 ? "0" : "") + hour; var min = date.getMinutes(); min = (min < 10 ? "0" : "") + min; var sec = date.getSeconds(); sec = (sec < 10 ? "0" : "") + sec; var year = date.getFullYear(); var month = date.getMonth() + 1; month = (month < 10 ? "0" : "") + month; var day = date.getDate(); day = (day < 10 ? "0" : "") + day; return hour + min + sec + day + month +year; } function DeleteStatus(id,id_user) { Waste.remove({$and: [{'_id':id},{'userId':id_user}]}).exec(function(err, allWastes){ }); } function CountUser(callback) { UserPost.count({},function (err, count) { callback(err,count); }); } function InsertHasTag(tag,id,callback) { Hastag.findOne({'tag':tag }, function (err, data) { if(data !== null){ var hastag = data.data; hastag.push(id); data.data = hastag; data.save(function () { }); }else { var hastag = new Hastag(); hastag.tag = tag; hastag.data = [id]; hastag.save(function () { }); } }); } function GetHasTag(listtag,skip,callback) { var arr = []; if(listtag !== null && listtag.length>0){ for (var $i = 0;$i<listtag.length; $i++ ){ arr.push({_id :listtag[$i]}); } } if(arr.length>0){ Waste.find({$or :arr}).sort({date: -1}).skip(skip).limit(10).exec(function (err, data) { callback(err,data); }); }else { callback(null,null); } } module.exports.getNewFeedMe = getNewFeedMe; module.exports.getNewFeed = getNewFeed; module.exports.getStatusPost = getStatusPost; module.exports.getUserPostStatus = getUserPostStatus; module.exports.getNewFeedGroup = getNewFeedGroup; module.exports.getNewFeedMeImage = getNewFeedMeImage; module.exports.getDateTime = getDateTime; module.exports.DeleteStatus = DeleteStatus; module.exports.CountUser = CountUser; module.exports.InsertHasTag = InsertHasTag; module.exports.GetHasTag = GetHasTag;
/* * ---------------------------------------------------------------------- * VueJS + Buefy handler for displaying toast and snackbar notifications * API: https://buefy.github.io/#/documentation/toast * depends on VueJS and Buefy (and Bulma) * * inspired by JACurtis notifiation.blade.php/LaraFlash Package * https://gist.github.com/jacurtis/9fa687e8f7512bb197decce7ffc30091 * * ---------------------------------------------------------------------- */ // Import options for granular application. // Remember: Bulma and Buefy _notices styles are also neccessary. // import Vue from 'vue'; // import Snackbar from 'buefy/src/components/snackbar' // Vue.prototype.$snackbar = Snackbar // import Toast from 'buefy/src/components/toast' // Vue.prototype.$toast = Toast; /** * * Shows notification (toast or snackbar). * * @use notify.{method_here}(params...) * * -------------------------------------------------------- * * @method (accepts msg only) simple | primary | success | danger | warning | link | info | light * @method toast * * @param {str} msg Message text. * @param {str} typ Type (color) of the toast. Optional. * @param {int} dur Visibility in miliseconds. Optional. * @param {str} pos Position toast appear. Optional. * * -------------------------------------------------------- * * @method snackbar * * @param {str} msg Message text. * @param {obj} opt Snackbar options. Optional. * * @param {int} duration Visibility in miliseconds. * @param {str} position Position toast appear. * @param {str} type Type (color) of the toast. * @param {str} actionText Snackbar's button text. * * @param {func} func Callback function. Optional. * * -------------------------------------------------------- * * @return void * */ let notify = new Vue({ methods: { open(msg) { this.toast(msg) }, primary(msg) { this.toast(msg, 'primary'); }, info(msg) { this.toast(msg, 'info'); }, success(msg) { this.toast(msg, 'success'); }, warning(msg) { this.toast(msg, 'warning'); }, danger(msg) { this.toast(msg, 'danger'); }, link(msg) { this.toast(msg, 'link'); }, light(msg) { this.toast(msg, 'light'); }, toast(msg, typ = 'dark', dur = 3500, pos = 'top') { this.$toast.open({ type: `is-${typ}`, message: msg, position: `is-${pos}`, duration: dur, }); }, snackbar(msg, opt = {}, func) { let defaults = { position: 'is-bottom-left', duration: 5000, type: 'is-success', actionText: null }; let options = Object.assign({}, defaults, opt); this.$snackbar.open({ type: options.type, message: msg, position: options.position, duration: options.duration, actionText: options.actionText, onAction: () => { if ( typeof func === 'function' ) func(); } }) } }, created() { // this.success( 'notify.toast(\'It works!\')' ); } }); window.notify = notify;
var EBE_TopSwitchView = function(holderEl,el){ if( el.length == 0 ){return;} var i; var index = 0; var isInit = false; var timer = -1; var ulEl = el.find("ul"); var liEl = el.find("li"); var liCount = liEl.length; var liWidth = 0; var liHeight = 0; var navPanelEl = $("<div class='withchNavPanel'></div>") ; var arrowEls = el.find(".arrow"); el.after( navPanelEl); var navBtnEl; if( liCount > 1 ){ var firstLiEl = liEl.eq(0); var lastLiEl = liEl.eq( liCount-1 ); firstLiEl.before( lastLiEl.clone() ); lastLiEl.after( firstLiEl.clone() ); liEl = ulEl.children("li"); for(i=0;i<liCount;i++){ $("<a href='javascript:;'>&nbsp;</a>").appendTo(navPanelEl); } navBtnEl = navPanelEl.find("a"); navBtnEl.click( navLiClickHandler ); arrowEls.show().click(function(){ if( ulEl.is(":animated") ){return;} animaPosByDirection( arrowEls.index(this) == 0 ?-1:1); }); } function updateSize(){ if( !isInit || el.length == 0 ){return;} clearTimeout( timer ); ulEl.stop(); liWidth = holderEl.width(); var allHeigth = holderEl.height(); liHeight = allHeigth ; el.height(allHeigth); ulEl.width( liWidth * (liCount +2 ) ).height(liHeight); liEl.width(liWidth).height(liHeight); if( liCount < 2){return;} setPosByIndex(index); animaPosByAuto(); } function setPosByIndex(val){ index = val; ulEl.css("left", -(1+ index%liCount) * liWidth ); navBtnEl.removeClass("selected"); navBtnEl.eq(index).addClass("selected"); } function navLiClickHandler(){ if( ulEl.is(":animated") ){return;} var tIndex = navBtnEl.index(this); if( index == tIndex ){return;} animaPosByIndex( index,tIndex); } function animaPosByIndex(startIndex,endIndex){ clearTimeout(timer); ulEl.stop(); index = endIndex; navBtnEl.removeClass("selected"); navBtnEl.eq(index).addClass("selected"); var curX = parseInt( ulEl.css("left") ); ulEl.animate({"left": curX - (endIndex-startIndex)* liWidth },500* Math.abs(endIndex-startIndex),function(){ ulEl.css("left", -(1 + index%liCount) * liWidth ); animaPosByAuto(); }); } function animaPosByDirection(direction){ clearTimeout(timer); ulEl.stop(); var curX = parseInt( ulEl.css("left") ) - direction*liWidth; index -= direction; if( index < 0 ){ index = liCount-1; } if( index >= liCount){ index = 0; } ulEl.animate({"left": curX },500,function(){ ulEl.css("left", -(1 + index%liCount) * liWidth ); setPosByIndex(index); animaPosByAuto(); }); } function animaPosByAuto(){ clearTimeout(timer); ulEl.stop(); timer = setTimeout(function(){ index = (index+1) % liCount; navBtnEl.removeClass("selected"); navBtnEl.eq( index ).addClass("selected"); var curX = parseInt( ulEl.css("left") ); ulEl.animate({"left": curX - liWidth },500,function(){ ulEl.css("left", -(1 + index%liCount) * liWidth ); animaPosByAuto(); }); },5000); } $(window).resize(function(){ updateSize(); }); if( holderEl.prop("complete") ){ isInit = true; updateSize(); }else{ holderEl.load(function(){ isInit = true; updateSize(); }); } }; var EBE_PopManager = function(){ var winEl = $(window); var el = $(".header .popBlock"); var bgEl = el.find(".holder"); var ulEl = el.find(".border ul"); var itemImgEl = ulEl.find("li a img:eq(0)"); if( itemImgEl.length == 0 ){return;} var loadedCount = 0; function sizeResizeHandler(){ var bgHeight = bgEl.height(); var itemHeight = itemImgEl.height(); ulEl.css("marginTop",(bgHeight - itemHeight)/2 - 5); } function loadCompleteHandler(){ loadedCount++; if(loadedCount==2){ sizeResizeHandler();} } if( bgEl.prop("complete") ){ loadCompleteHandler(); }else{ bgEl[0].onload = loadCompleteHandler; } if( itemImgEl.prop("complete") ){ loadCompleteHandler(); }else{ itemImgEl[0].onload = loadCompleteHandler; } winEl.resize(sizeResizeHandler); var timer = -1; var isOpen = false; var isPopOver = false; var popBtnEl = $(".header .mainNavBar .checked"); popBtnEl.mouseenter(function(){ if(isOpen){return;} el.addClass("show"); isOpen = true; }).mouseleave(function(){ clearTimeout(timer); timer = setTimeout(function() { if(isPopOver){return;} isOpen = false; el.removeClass("show"); }, 50); }); el.mouseenter(function(){ isPopOver = true; }).mouseleave(function(){ isPopOver = false; isOpen = false; el.removeClass("show"); }); }; $(function(){ new EBE_TopSwitchView( $(".header .top_switchPlaceholder"),$(".topSwitchViewBlock") ); new EBE_PopManager(); });
// Some function used in this section will be used in other section. // This is one of the possible way to share them between sessions. let R4A = {}; { let n = 5; // the array with the progress bars & the PromiseGUI let pbs = []; let pguis = []; for(let i = 0; i < n; i++){ pbs[i] = new ProgressBar('ProgressBar' + i); pbs[i].resolvePercent = 90; pbs[i].errorPercent = 0; //pbs[i].isSynchronous = true; tools.append2Demo(pbs[i], 'tdR4AC2'); pguis[i] = new PromiseGUI(1); tools.prepend(pguis[i].$td, pbs[i].$tr); } // The 'Promise' that 'controls' all the other 'Promises' let pguiAll = new PromiseGUI(n); tools.prepend(pguiAll.$td, pbs[0].$tr); // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // // The callbacks used by the 'Promise.all' R4A.resolve = function(pguiAll, folders, btn){ try{ folders.forEach((folder) => { folder.pgui.resolved(); folder.pgui.fulfilled(); }); pguiAll.resolved(); tools.highlight.resolved(btn); } catch(jse){ // this catch stops the chaining of the error to the function 'R4A-catch' window.console.promise.log.catch(jse); } } // The first progressBar that reject, stops the 'race' R4A.reject = function(pguiAll, folder, btn){ try{ folder.pgui.rejected(); folder.pgui.fulfilled(); pguiAll.rejected(); window.console.promise.log.reject(folder.result.id); // As soon a 'ProgressBar' rejects, The 'PromiseAll' stops listening the other 'Promise' // That means, this stop is an option. It is up to developer write it, based on what he/she // needs to do. tools.stop(pbs); tools.highlight.rejected(btn); } catch(jse){ window.console.promise.log.catch(jse); } } R4A.finally = function(pguiAll, btn){ window.console.promise.log.finally(); tools.enableBtns(btn); pguiAll.fulfilled(); } R4A.catch = function(error, pguiAll){ window.console.promise.log.catch(error); } // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // function btnR4AAll_onclick(btn){ debugger; console.clear(); tools.disableBtns(btn); tools.highlight.clear(btn); tools.reset(pguis); pguiAll.reset(); let promises = []; for(let i = 0; i < pbs.length; i++){ // closure needs to be managed in that way, in a 'for loop' let pb = pbs[i]; let pgui = pguis[i]; // every promise is configurated to manage its own 'ProgressBar' promises[i] = new Promise(function(resolve, reject) { try{ let _resolve = function(result){ let folder = {result: result, pgui: pgui}; resolve(folder); } let _reject = function(result){ let folder = {result: result, pgui: pgui}; reject(folder); } pb.start(_resolve, _reject); } catch(jse){ window.console.promise.log.catch(jse); let rejectionResult = pb.getRejectionResult(jse); let folder = {result: rejectionResult, pgui: pgui}; // this ensures '_reject' will always receive the correct // type parameter, and all the info it needs. reject(folder); } }) } // The new promise does not controls the 'ProgressBar', instead it controls an array // of 'promises' like an orchestra conductor. // Now we have 2 levels of 'Promise': it's a little bit more complex, but the concepts // are all the same! let promiseAll = Promise.all(promises); // and now we can use the 'promise' in the way we learned promiseAll.then( folder => R4A.resolve(pguiAll, folder), folder => R4A.reject (pguiAll, folder) ) .finally(() => R4A.finally(pguiAll, btn)) .catch((error) => R4A.catch (error, pguiAll)); } }
// @desc this is the 'store setiings' componenent // @author Sylvia Onwukwe import React from "react"; import NavPills from "../../components/NavPills/NavPills"; import Subscribers from "../../containers/Admin/Subscribers"; import SendNewsletter from "./NewsLetter/newsletters"; import ContactForm from "./ContactForm/contactForm"; import SupportTicket from "./SupportTicket/supportTicket"; class AdminMessage extends React.Component { state = {}; render() { return ( <NavPills color="primary" tabs={[ { tabButton: "All Subscribers", tabContent: ( <Subscribers /> ), }, { tabButton: "Newsletters", tabContent: ( <SendNewsletter /> ), }, { tabButton: "Contact Form", tabContent: ( <ContactForm /> ), }, { tabButton: "Support Tickets", tabContent: ( <SupportTicket /> ), }, ]} /> ); } } export default AdminMessage;
import User from "../models/User"; export const createUser = async (req, res) => { res.json('Creating User'); }; export const getUsers = async (req, res) => { const user = await User.find(); return res.status(200).json(user); };
import { React, useState, useRef, useCallback, useEffect } from 'react'; import { Form, Button } from 'react-bootstrap' import DayPicker, { DateUtils } from "react-day-picker"; import { axios_non_auth_instance } from '..'; import ReactCrop from 'react-image-crop' const SignUpForm = () => { const [dates, setDates] = useState([]); const [errors, setErrors] = useState([]); const [role, setRole] = useState(''); const [submitted, setSubmitted] = useState(false); const [bestSubjects, setBestSubjects] = useState([]); const [problemSubjects, setProblemSubjects] = useState([]); const requiredFields = { "role": "Role required. ", "full_name": "Full Name required. ", "username": "Username required. ", "password": "Password required. ", "us_phone_number": "Phone required. ", "duplicate": "This user already exists." } const [isCropping, setIsCropping] = useState(false) const [upImg, setUpImg] = useState({ img: null, name: null }); const imgRef = useRef(null); const previewCanvasRef = useRef(null); const [crop, setCrop] = useState({ unit: "%", width: 30, aspect: 3 / 3 }); const [completedCrop, setCompletedCrop] = useState(null); const onSelectFile = (e) => { if (e.target.files && e.target.files.length > 0) { if (e.target.files[0].size > 1500000) { alert("File is too big!"); e.target.value = ""; } else { setIsCropping(true); const reader = new FileReader(); reader.addEventListener("load", () => setUpImg({ name: e.target.files[0].name, img: reader.result })); reader.readAsDataURL(e.target.files[0]); } } }; const onLoad = useCallback((img) => { imgRef.current = img; }, []); const getCroppedImg = (canvas, fileName) => { if (!completedCrop || !canvas) { return; } return new Promise((resolve, reject) => { canvas.toBlob( (blob) => { if (blob) { blob.name = fileName; resolve(blob); } else { reject("Error making img blob") } }, "image/png", 1 ); }); } useEffect(() => { if (!completedCrop || !previewCanvasRef.current || !imgRef.current) { return; } const image = imgRef.current; const canvas = previewCanvasRef.current; const crop = completedCrop; const scaleX = image.naturalWidth / image.width; const scaleY = image.naturalHeight / image.height; const ctx = canvas.getContext("2d"); const pixelRatio = window.devicePixelRatio; canvas.width = crop.width * pixelRatio * scaleX; canvas.height = crop.height * pixelRatio * scaleY; ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); ctx.imageSmoothingQuality = "high"; ctx.drawImage( image, crop.x * scaleX, crop.y * scaleY, crop.width * scaleX, crop.height * scaleY, 0, 0, crop.width * scaleX, crop.height * scaleY ); }, [completedCrop]); const handleSubmit = (e) => { e.preventDefault(); errorChecker(e); window.scrollTo(0, 0) if (errors.length === 0) { const email = e.target.email.value; const full_name = e.target.full_name.value; const username = e.target.username.value; const password = e.target.password.value; const biography = e.target.biography ? e.target.biography.value : ''; const us_phone_number = e.target.us_phone_number.value; const meeting_link = e.target.meeting_link ? e.target.meeting_link.value : ' '; const profile_picture = e.target.profile_picture.files[0]; const bodyFormData = new FormData(); bodyFormData.append("email", email); bodyFormData.append('full_name', full_name); bodyFormData.append('password', password); bodyFormData.append('us_phone_number', us_phone_number); bodyFormData.append('biography', biography) bodyFormData.append('roles', role) bodyFormData.append('username', username.toLowerCase()); bodyFormData.append('availability', dates.map((date) => { return date.getMonth() + 1 + "/" + date.getDate() + "/" + date.getFullYear(); })); if (profile_picture) { bodyFormData.append('profile_picture', profile_picture); } if (role.includes("tutor")) { bodyFormData.append('meeting_link', meeting_link); bodyFormData.append('tutor_subjects', bestSubjects); } if (role.includes("student")) { bodyFormData.append('problem_subjects', problemSubjects); } if (completedCrop && !isCropping) { getCroppedImg(previewCanvasRef.current, upImg.name) .then((res) => { bodyFormData.append("profile_picture", res, upImg.name); }) } axios_non_auth_instance.post('/user/sign_up', bodyFormData) .then(function (response) { console.log(response.data) if (response.data.toLowerCase().includes("duplicate")) { setErrors([...errorList, "duplicate"]) } else { setErrors([]) setSubmitted(true) } }) .catch(function (error) { console.log(error) }); } } const updateRole = (e) => { setRole(e.target.value) } const errorChecker = (e) => { if (!role && errors.indexOf("role") === -1) { setErrors([...errors, "role"]) } if (!e.target.email.value && errors.indexOf("email") === -1) { setErrors([...errors, "email"]) } if (!e.target.full_name.value && errors.indexOf("full_name") === -1) { setErrors([...errors, "full_name"]) } if (!e.target.username.value && errors.indexOf("username") === -1) { setErrors([...errors, "username"]) } if (!e.target.us_phone_number.value && errors.indexOf("us_phone_number") === -1) { setErrors([...errors, "us_phone_number"]) } if (e.target.us_phone_number.value && e.target.email.value && e.target.username.value && e.target.full_name.value && role) { setErrors([]) } } const handleDayClick = (day, { selected }) => { const arr = [...dates]; if (selected) { const selectedIndex = arr.findIndex(selectedDay => DateUtils.isSameDay(selectedDay, day) ); arr.splice(selectedIndex, 1); setDates(arr); } else { setDates([...dates, day]); } } const conditionalSubjectType = () => { let returnedTypes = []; const tutor = ( <div> <Form.Group controlId="conditional"> <Form.Group controlId="meeting_link"> <Form.Label>*Meeting Link</Form.Label> <Form.Control type="text" /> </Form.Group> <Form.Group controlId="subjects"> <Form.Label>Best Subjects</Form.Label> {subjects(false)} </Form.Group> </Form.Group> </div> ) const student = (<Form.Group controlId="problem_subjects"> <Form.Label>Problem Subjects</Form.Label> {subjects(true)} </Form.Group>) if (role.includes("tutor")) { returnedTypes.push(tutor); } if (role.includes("student")) { returnedTypes.push(student); } return returnedTypes; } const conditionalCheck = (problem) => { let onCheckChange; if (!problem) { onCheckChange = (e) => { if (bestSubjects.includes(e.target.value)) { setBestSubjects(bestSubjects.filter(element => element !== e.target.value)); console.log(bestSubjects); } else { setBestSubjects([...bestSubjects, e.target.value]) console.log(bestSubjects); } } } else { onCheckChange = (e) => { if (problemSubjects.includes(e.target.value)) { setProblemSubjects(problemSubjects.filter(element => element !== e.target.value)); } else { setProblemSubjects([...problemSubjects, e.target.value]); } } } return onCheckChange; } const subjects = (problem) => { let id = problem ? "problem" : "best" return ( <div> <Form.Group controlId={`math ${id}`}> <Form.Check type="checkbox" value="Math" label="Math" onChange={conditionalCheck(problem)} /> </Form.Group> <Form.Group controlId={`physics ${id}`}> <Form.Check type="checkbox" value="Physics" label="Physics" onChange={conditionalCheck(problem)} /> </Form.Group> <Form.Group controlId={`chemistry ${id}`}> <Form.Check type="checkbox" value="Chemistry" label="Chemistry" onChange={conditionalCheck(problem)} /> </Form.Group> <Form.Group controlId={`biology ${id}`}> <Form.Check type="checkbox" value="Biology" label="Biology" onChange={conditionalCheck(problem)} /> </Form.Group> <Form.Group controlId={`english ${id}`}> <Form.Check type="checkbox" value="English" label="English" onChange={conditionalCheck(problem)} /> </Form.Group> <Form.Group controlId={`history ${id}`}> <Form.Check type="checkbox" value="History" label="History" onChange={conditionalCheck(problem)} /> </Form.Group> <Form.Group controlId={`compsci ${id}`}> <Form.Check type="checkbox" value="Computer Science" label="Computer Science" onChange={conditionalCheck(problem)} /> </Form.Group> </div> ) } const errorList = errors.map((errorCode) => ( <p className="form-error" key={errorCode}>{requiredFields[errorCode]}</p>) ) return ( <div className="form-comp"> <h1>Sign Up</h1> {errorList} {submitted && errors.length === 0 ? <span className="form-text">Please check your email to finish activating your account.</span> : null} <Form onSubmit={handleSubmit}> <Form.Group controlId="email"> <Form.Label>Email address</Form.Label> <Form.Control name="email" type="email" required /> </Form.Group> <Form.Group controlId="full_name"> <Form.Label>Full Name</Form.Label> <Form.Control name="full_name" type="text" required /> </Form.Group> <Form.Group controlId="username"> <Form.Label>Username</Form.Label> <Form.Control name="username" type="text" required /> </Form.Group> <Form.Group controlId="password"> <Form.Label>Password</Form.Label> <Form.Control name="password" type="password" required /> </Form.Group> <Form.Group controlId="us_phone_number"> <Form.Label>Phone Number</Form.Label> <p>Format: XXX-XXX-XXXX</p> <Form.Control name="us_phone_number" type="tel" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" required /> </Form.Group> <Form.Group controlId="biography"> <Form.Label>Tell us about yourself! If you want to put your phone number and email here so other members can contact you, please do so, but know they will be public.</Form.Label> <Form.Control name="biography" as="textarea" rows={3} /> </Form.Group> {conditionalSubjectType()} <Form.Group controlId="role"> <Form.Check inline value="tutor" name="role" checked={role === "tutor"} label="Tutor" type="radio" id="tutor" onClick={updateRole} required /> <Form.Check inline value="student" name="role" checked={role === "student"} label="Student" type="radio" id="student" onClick={updateRole} required /> <Form.Check inline value="student,tutor" name="role" checked={role === "student,tutor"} label="Both" type="radio" id="both" onClick={updateRole} required /> </Form.Group> <Form.Group> <Form.Label>Profile Picture</Form.Label> <Form.Control onChange={onSelectFile} type="file" accept=".jpg,.png,.jpeg" name="profile_picture" /> <ReactCrop src={upImg.img} onImageLoaded={onLoad} crop={crop} onChange={(c) => setCrop(c)} onComplete={(c) => setCompletedCrop(c)} disabled={!isCropping} /> <canvas ref={previewCanvasRef} style={{ width: Math.round(completedCrop?.width ?? 0), height: Math.round(completedCrop?.height ?? 0) }} /> <div>{isCropping && <Button onClick={() => { setIsCropping(!isCropping) }}>Crop</Button>}</div> </Form.Group> <Form.Group controlId="availability"> <Form.Label>*Availability</Form.Label> <DayPicker className="calendar" disabledDays={{ before: new Date() }} format="MM/DD/YYYY" name="availability" onDayClick={handleDayClick} selectedDays={dates} /> </Form.Group> <Button variant="primary" type="submit"> Submit </Button> </Form> </div>); } export default SignUpForm;
import React, { Component } from 'react'; class Toggler extends Component { constructor(props) { super(props); this.state = { onButton: false, }; } changedText = () => { this.setState({ onButton: !this.state.onButton, }); }; render() { return ( <button className="toggler" onClick={this.changedText}> {this.state.onButton ? 'On' : 'Off'} </button> ); } } export default Toggler;
export default class BookmarkService { constructor(bookmarkUri) { this.validateAuthentication = function (request) { return request.then(r => { if (r.status === 401) { return Promise.reject() } else { return r } }) }; this.bookmarkUri = bookmarkUri this.user = {token: null}; } setAuthentication(user) { this.user = user; console.assert(this.user.token && this.user.token.length > 0); return Promise.resolve() } search(searchQuery) { const context = { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' + this.user.token } }; const params = {}; if (searchQuery.query !== null && searchQuery.query.trim() !== '') { params ['query'] = searchQuery.query } if (searchQuery.errors !== null) { params ['errors'] = searchQuery.errors } if (searchQuery.start !== null) { params['start'] = searchQuery.start.getTime() } if (searchQuery.stop !== null) { params['stop'] = searchQuery.stop.getTime() } // console.log(searchQuery.start, ' until ', searchQuery.stop) const queryParams = [] for (let k in params) { queryParams.push(k + '=' + params [k]) } ///console.info(queryParams) return this.validateAuthentication(fetch(this.bookmarkUri + `bookmarks/search?${queryParams.join('&')}`, context)) .then(response => { const json = response.json(); console.debug(json) return json; }) } delete(id) { const context = { method: 'DELETE', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' + this.user.token } }; return this.validateAuthentication(fetch(this.bookmarkUri + 'bookmarks/' + id, context)) // .catch(() => console.error('something went wrong when deleting a request.')); } save(bookmark) { const encodedBookmarkId = bookmark.bookmarkId; /*encodeURIComponent*/ const json = { command: 'update', href: bookmark.href, description: bookmark.description.trim(), tags: bookmark.tags.join(',') }; const context = { method: 'PUT', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer ' + this.user.token }, body: JSON.stringify(json) }; return this.validateAuthentication( fetch(this.bookmarkUri + 'bookmarks/' + encodedBookmarkId, context)); } }
import React from 'react'; import './style.sass'; export class Counter extends React.Component { constructor (props) { super (props); this.state = { status: false, startValue: this.props.startValue, } } increaseCounter = () => { this.setState( (state) => { return { ...this.state, startValue: state.startValue +1 } }); }; componentDidMount() { console.log("counter mounted"); } componentDidUpdate(prevVal, newVal) { console.log("counter updated ", prevVal, newVal); } componentWillUnmount() { console.log("counter unmount"); } render() { return ( <div className="counter"> <div className="counterValue"> {this.state.startValue} </div> <button onClick={this.increaseCounter}> + </button> </div> ) } }
import React, { useEffect } from 'react'; import { useSelector } from 'react-redux'; import { useDispatch } from 'react-redux'; import { Link, useHistory } from 'react-router-dom'; import { listData } from '../store/list/action'; import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; import { updateData } from '../store/edit/action'; const staticData = [{id:"1",Name:"Daniel",gender :"Male",phone :"9845655555",email:"daniel@gmail.com",pin:"600226",city:"chennai"}, {id:"2",Name:"Kavi",gender :"Female",phone :"7925655555",email:"kavi@gmail.com",pin:"270126",city:"chennai"},{id:"3",Name:"Ram",gender :"Male",phone :"9325655555",email:"ram@gmail.com",pin:"750126",city:"chennai"},{id:"4",Name:"John",gender :"Male",phone :"2345655555",email:"john@gmail.com",pin:"600126",city:"chennai"}] export default function UserList(){ const dispatch = useDispatch() let history = useHistory(); let userlistdata = useSelector(s=>s.userlist) useEffect(()=>{ let localeData = JSON.parse(localStorage.getItem("userDatags")) if(localeData && localeData.length !== 0) { dispatch(listData(localeData)) } else { dispatch(listData(staticData)) localStorage.setItem("userDatags",JSON.stringify(staticData)) } },[]) const reorder = (list, startIndex, endIndex) => { console.log(list,startIndex,endIndex) const result = Array.from(list.data); const [removed] = result.splice(startIndex, 1); result.splice(endIndex, 0, removed); return result; }; const onDragEnd =(result)=>{ if (!result.destination) { return; } const items = reorder( userlistdata, result.source.index, result.destination.index ); dispatch(listData(items)) localStorage.setItem("userDatags",JSON.stringify(items)) } const deleteRow =(e,deleteId) =>{ e.preventDefault() let existArray = userlistdata.data.filter((value)=> value.id !== deleteId) dispatch(listData(existArray)) localStorage.setItem("userDatags",JSON.stringify(existArray)) alert("Successfully deleted a user!"); } const editDetail =(editData) =>{ dispatch(updateData(editData)) history.push("/create-user") } return( <div className="wrapper"> <div className="page-wrapper"> <div className="header flex"> <h3>User list</h3> <Link to="/create-user" > <i className="fas fa-plus"></i> Create user</Link> </div> <DragDropContext onDragEnd={onDragEnd} > <Droppable droppableId="droppable"> {(provided, snapshot) => ( <div {...provided.droppableProps} ref={provided.innerRef} // style={getListStyle(snapshot.isDraggingOver)} > <> <div className="table-responsive height-responsive"> <table className="table"> <thead> <tr> <th>Name</th> <th>Gender </th> <th>Email </th> {/* <th>Role</th> */} <th className="text-center">Delete </th> </tr> </thead> <tbody> {userlistdata && userlistdata.data && userlistdata.data.map((value,index)=>( <Draggable key={value.id} draggableId={value.id} index={index}> {(provided, snapshot) => ( <tr ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps} > {/* <tr key={index} > */} {/* // ref={provided.innerRef} // {...provided.draggableProps} // {...provided.dragHandleProps} */} <td className="width-30" onClick={e=> editDetail(value)}> <strong> {value.Name}</strong> </td> <td className="width-30">{value.gender}</td> <td>{value.email}</td> <td className="text-center"> <a href="#" onClick={e=>deleteRow(e,value.id)}> <img src="img/trash.svg"/> </a> </td> {/* </tr> */} </tr> )} </Draggable> ))} </tbody> </table> </div> </></div>)} {/* {userlistdata && userlistdata.data && userlistdata.data.map((value,index)=>( <Draggable key={index} draggableId={index} index={index}> <tr key={index}> <td className="width-30"> <strong> {value.Name}</strong> </td> <td className="width-30">{value.gender}</td> <td>{value.email}</td> <td className="text-center"> <a href="javascript:void(0)"> <img src="img/trash.svg"/> </a> </td> </tr> </Draggable> ))} */} </Droppable> </DragDropContext> </div> {/* </div> */} </div> ) }
var data = new Array(); var type = new Array(); type = [ [12,25,19,44], [12,38,26,56], [12,25,2,61], ] type.forEach(function(item,i) { data[i] = [ { value: item[0], color:"#8cc63f", }, { value : item[1], color : "#d7df21", }, { value : item[2], color : "#00aeef", }, { value : item[3], color : "#eeeeee", }, ] k=i+1; var myLine = new Chart(document.getElementById("canvas"+k).getContext("2d")).Doughnut(data[i]); });
(function(angular) { 'use strict'; // Referencia para o nosso app var app = angular.module('app'); // Cria o controlador de autenticação app.controller('AuthController', ['$scope', 'User', function($scope, User) { // Redireciona para a página autenticada if (User.getAuthenticated()) { window.location = 'profile.html'; } // Faz login do usuário this.verify = function() { // Login via email e senha var data = { email : $scope.login.email, password : $scope.login.password }; // Procura usuário no banco de dados var user = User.find(data) || false; // Se o usuário existir, autentica if (user) { User.setAuthenticated(user); window.location = 'profile.html'; } // Caso o contrário, exibe mensagem de erro else { // TODO alert('Email ou senha incorretos!'); } } // Faz cadastro do usuário this.create = function() { // Dados necessários var data = { id : 'u_' + Math.floor(Date.now() / 1000), name : $scope.create.name, email : $scope.create.email, password : $scope.create.password, followers: [], following: [], groups: [] }; // Verifica se o email existe var exists = User.find({ email : $scope.create.email }) || false; // Caso já exista, exibe mensagem de erro if (exists) { // TODO alert('Email já existe!'); } // Cria o usuário e autentica else { var user = new User(data); user.save(); User.setAuthenticated(user); window.location = 'profile.html'; } } }]); })(window.angular);
import React, { Component } from 'react'; import './App.css'; import CategoryList from '../components/CategoryList'; import Header from '../components/Header'; import SelectionList from './SelectionList'; import NavBar from '../components/NavBar'; //App container class App extends Component { constructor(props) { super(props); //default categories and default selected category (none) this.state = { categories: ["films", "people", "planets", "species", "starships", "vehicles"], selectedCategory: '', } this.onCategoryClickChange = this.onCategoryClickChange.bind(this); // this.navBarClick = this.navBarClick.bind(this); this.navBarHome = this.navBarHome.bind(this); // this.onClick = this.onClick.bind(this); // this.loadCards = this.loadCards.bind(this); } //event handler for category selection onCategoryClickChange(event) { let newCategory = event.target.alt // console.log(newCategory) this.setState({selectedCategory: newCategory}) } //default values for component mounting componentDidMount() { this.setState({ categories: ["films", "people", "planets", "species", "starships", "vehicles"], selectedCategory: '' }) } //navbar behaviour // navBarClick(event) { // const newCategory = event.target.title; // this.setState({ // selectedCategory: newCategory // }) // console.log(`${newCategory} NAVBAR BUTTON HAS BEEN CLICKED, CURRENT SELECTED CATEGORY: ${this.state.selectedCategory}`); // } //navbar home button behaviour navBarHome() { this.setState({ categories: ["films", "people", "planets", "species", "starships", "vehicles"], selectedCategory: '', }) } render() { //if no category has been selected if (this.state.selectedCategory === '') { return( <div className="tc"> <Header /> <NavBar onItemClick={this.navBarClick} onHomeClick={this.navBarHome} /> {/* Category List shows an item list of the every category */} <CategoryList categories={this.state.categories} cards={this.state.cards} clickedFunction={this.onCategoryClickChange} selectedCategory={this.state.selectedCategory} searchfield={this.state.searchfield} /> </div> ) // If a category has been selected } else { return( <div className="tc"> <NavBar onItemClick={this.navBarClick} onHomeClick={this.navBarHome} /> {/* Selection List shows a list of all the items belonging to the selected category */} <SelectionList cards={this.state.cards} clickedFunction={this.onCategoryClickChange} selectedCategory={this.state.selectedCategory} searchfield={this.state.searchfield} /> </div> ) } } } export default App;
/** * === page === * * created at: Tue Jun 27 2017 18:27:29 GMT+0800 (CST) */ import articles from 'data/article' import AsyncComponent from 'modules/AsyncComponent' const articleList = MY_ARTICLE_DATA import { React, Page } from 'zola' export default class Index extends Page { render () { const renderComp = 'input' return ( <div> <ul> { articleList.map((article,index) =>{ return ( <li key={index}> <a href={`#/article${article.path}`}> {article.title} </a> </li> ) }) } </ul> <AsyncComponent comFn={articles[0].component()}/> </div> ) } }
import Vue from 'vue'; import VueRouter from 'vue-router'; // Components. import ViewNotFound from '../src/components/ViewNotFound.vue'; import Signup from '../src/components/Signup.vue'; import Login from '../src/components/Login.vue'; import Post from '../src/components/Post.vue'; import AuthorProfile from '../src/components/AuthorProfile.vue'; import About from '../src/components/About.vue'; import TermsOfServiceModal from '../src/components/TermsOfServiceModal.vue'; import Articles from '../src/components/Articles.vue'; import Contact from '../src/components/Contact.vue'; Vue.use(VueRouter); // Some information about querySelector for the commentID: // https://stackoverflow.com/questions/37270787/uncaught-syntaxerror-failed-to-execute-queryselector-on-document const routes = [ { path: '*', component: ViewNotFound }, { path: '/', redirect: '/articles' }, { path: '/articles', component: Articles }, { path: '/about', component: About }, { path: '/contact', component: Contact }, { path: '/terms', component: TermsOfServiceModal }, { path: '/signup', component: Signup, beforeEnter: (to, from, next) => { return store.state.isLoggedIn ? next({ path: '/' }) : next(); } }, { path: '/login', component: Login, beforeEnter: (to, from, next) => { return store.state.isLoggedIn ? next({ path: '/' }) : next(); } }, { path: '/posts/:postId', component: Post, props: (route) => ({ postId: route.params.postId, startingCommentLevel: 0 }) }, { path: '/my-profile', component: AuthorProfile, beforeEnter: (to, from, next) => { return store.state.isLoggedIn ? next() : next({ path: '/login?redirect=/my-profile' }); } }, { path: '/authors/:authorId', component: AuthorProfile } ]; const router = new VueRouter({ // https://router.vuejs.org/api/#mode // https://stackoverflow.com/questions/34623833/how-to-remove-hashbang-from-url // mode: 'history', routes }); export default router;
/** * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { isArray, isObject, merge, clone, isFunction, isBoolean, isNumber, isValid } from '../utils/typeChecks' import { defaultStyleOptions } from './options/styleOptions' import technicalIndicatorCalcParams from './technicalindicator/technicalIndicatorCalcParams' import { formatValue } from '../utils/format' import { createNewTechnicalIndicator, createTechnicalIndicators } from './technicalindicator/technicalIndicatorControl' import { DEV } from '../utils/env' export const InvalidateLevel = { NONE: 0, GRAPHIC_MARK: 1, FLOAT_LAYER: 2, MAIN: 3, FULL: 4 } export const GraphicMarkType = { NONE: 'none', HORIZONTAL_STRAIGHT_LINE: 'horizontalStraightLine', VERTICAL_STRAIGHT_LINE: 'verticalStraightLine', STRAIGHT_LINE: 'straightLine', HORIZONTAL_RAY_LINE: 'horizontalRayLine', VERTICAL_RAY_LINE: 'verticalRayLine', RAY_LINE: 'rayLine', HORIZONTAL_SEGMENT_LINE: 'horizontalSegmentLine', VERTICAL_SEGMENT_LINE: 'verticalSegmentLine', SEGMENT_LINE: 'segmentLine', PRICE_LINE: 'priceLine', PRICE_CHANNEL_LINE: 'priceChannelLine', PARALLEL_STRAIGHT_LINE: 'parallelStraightLine', FIBONACCI_LINE: 'fibonacciLine' } const MAX_DATA_SPACE = 30 const MIN_DATA_SPACE = 3 export default class ChartData { constructor (styleOptions, invalidateHandler) { // 刷新持有者 this._invalidateHandler = invalidateHandler // 样式配置 this._styleOptions = clone(defaultStyleOptions) merge(this._styleOptions, styleOptions) // 技术指标计算参数集合 this._technicalIndicatorCalcParams = clone(technicalIndicatorCalcParams) // 所有技术指标类集合 this._technicalIndicators = createTechnicalIndicators() // 价格精度 this._pricePrecision = 2 // 数量精度 this._volumePrecision = 0 this._dateTimeFormat = new Intl.DateTimeFormat( 'en', { hour12: false, year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' } ) // 数据源 this._dataList = [] // 是否在加载中 this._loading = true // 加载更多回调 this._loadMoreCallback = null // 还有更多 this._more = true // 可见区域数据占用的空间 this._totalDataSpace = 0 // 每一条数据的空间 this._dataSpace = 6 // bar的空间 this._barSpace = this._calcBarSpace() // 向右偏移的数量 this._offsetRightBarCount = 50 / this._dataSpace // 左边最小可见bar的个数 this._leftMinVisibleBarCount = 2 // 右边最小可见bar的个数 this._rightMinVisibleBarCount = 2 // 开始绘制的索引 this._from = 0 // 结束的索引 this._to = 0 // 十字光标位置 this._crossHairPoint = null // 标识十字光标在哪个pane this._crossHairPaneTag = null // 用来记录开始拖拽时向右偏移的数量 this._preOffsetRightBarCount = 0 // 当前绘制的标记图形的类型 this._graphicMarkType = GraphicMarkType.NONE // 标记图形点 this._graphicMarkPoint = null // 拖拽标记图形标记 this._dragGraphicMarkFlag = false // 绘图标记数据 this._graphicMarkDatas = { // 水平直线 horizontalStraightLine: [], // 垂直直线 verticalStraightLine: [], // 直线 straightLine: [], // 水平射线 horizontalRayLine: [], // 垂直射线 verticalRayLine: [], // 射线 rayLine: [], // 水平线段 horizontalSegmentLine: [], // 垂直线段 verticalSegmentLine: [], // 线段 segmentLine: [], // 价格线 priceLine: [], // 平行直线 parallelStraightLine: [], // 价格通道线 priceChannelLine: [], // 斐波那契线 fibonacciLine: [] } } /** * 加载更多持有者 * @private */ _loadMoreHandler () { // 有更多并且没有在加载则去加载更多 if (this._more && !this._loading && this._loadMoreCallback && isFunction(this._loadMoreCallback)) { this._loading = true this._loadMoreCallback(formatValue(this._dataList[0], 'timestamp')) } } /** * 计算一条柱子的空间 * @returns {number} * @private */ _calcBarSpace () { const rateBarSpace = Math.floor(this._dataSpace * 0.8) const floorBarSpace = Math.floor(this._dataSpace) const optimalBarSpace = Math.min(rateBarSpace, floorBarSpace - 1) return Math.max(1, optimalBarSpace) } /** * 内部用来设置一条数据的空间 * @param dataSpace * @returns {boolean} * @private */ _innerSetDataSpace (dataSpace) { if (!dataSpace || dataSpace < MIN_DATA_SPACE || dataSpace > MAX_DATA_SPACE || this._dataSpace === dataSpace) { return false } this._dataSpace = dataSpace this._barSpace = this._calcBarSpace() return true } /** * 获取样式配置 */ styleOptions () { return this._styleOptions } /** * 设置样式配置 * @param options */ applyStyleOptions (options) { merge(this._styleOptions, options) } /** * 获取技术指标计算参数结合 * @returns {function(Array<string>, string, string): Promise} */ technicalIndicatorCalcParams () { return this._technicalIndicatorCalcParams } /** * 根据指标类型获取指标类 * @param technicalIndicatorType */ technicalIndicator (technicalIndicatorType) { return this._technicalIndicators[technicalIndicatorType] } /** * 价格精度 * @returns {number} */ pricePrecision () { return this._pricePrecision } /** * 数量精度 * @returns {number} */ volumePrecision () { return this._volumePrecision } /** * 获取时间格式化 * @returns {Intl.DateTimeFormat | Intl.DateTimeFormat} */ dateTimeFormat () { return this._dateTimeFormat } /** * 设置时区 * @param timezone */ setTimezone (timezone) { let dateTimeFormat try { dateTimeFormat = new Intl.DateTimeFormat( 'en', { hour12: false, timeZone: timezone, year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' } ) } catch (e) { if (DEV) { console.warn(e.message) } } if (dateTimeFormat) { this._dateTimeFormat = dateTimeFormat } } /** * 获取时区 * @returns {null} */ timezone () { return this._dateTimeFormat.resolvedOptions().timeZone } /** * 加载精度 * @param pricePrecision * @param volumePrecision */ applyPrecision (pricePrecision, volumePrecision) { if (isValid(pricePrecision) && isNumber(pricePrecision) && pricePrecision >= 0) { this._pricePrecision = pricePrecision } if (isValid(volumePrecision) && isNumber(volumePrecision) && volumePrecision >= 0) { this._volumePrecision = volumePrecision } } /** * 获取数据源 * @returns {[]|*[]} */ dataList () { return this._dataList } /** * 清空数据源 */ clearDataList () { this._more = true this._loading = true this._dataList = [] this._from = 0 this._to = 0 } /** * 添加数据 * @param data * @param pos * @param more */ addData (data, pos, more) { if (isObject(data)) { if (isArray(data)) { this._loading = false this._more = isBoolean(more) ? more : true this._dataList = data.concat(this._dataList) this.adjustOffsetBarCount() } else { const dataSize = this._dataList.length if (pos >= dataSize) { this._dataList.push(data) if (this._offsetRightBarCount < 0) { this._offsetRightBarCount -= 1 } this.adjustOffsetBarCount() } else { this._dataList[pos] = data } } } } /** * 获取一条数据的空间 * @returns {number} */ dataSpace () { return this._dataSpace } /** * 获取绘制一条数据的空间(不包括bar之间的间隙) * @returns {*} */ barSpace () { return this._barSpace } /** * 获取向右偏移的bar的数量 * @returns {number} */ offsetRightBarCount () { return this._offsetRightBarCount } /** * 设置一条数据的空间 * @param dataSpace */ setDataSpace (dataSpace) { if (this._innerSetDataSpace(dataSpace)) { this.adjustOffsetBarCount() this._invalidateHandler() } } /** * 设置可见区域数据占用的总空间 * @param totalSpace */ setTotalDataSpace (totalSpace) { if (this._totalDataSpace === totalSpace) { return } this._totalDataSpace = totalSpace this.adjustOffsetBarCount() } /** * 设置右边可以偏移的空间 * @param space */ setOffsetRightSpace (space) { this._offsetRightBarCount = space / this._dataSpace this.adjustOffsetBarCount() } /** * 设置左边可见的最小bar数量 * @param barCount */ setLeftMinVisibleBarCount (barCount) { if (isNumber(barCount) && barCount > 0) { this._leftMinVisibleBarCount = Math.ceil(barCount) } } /** * 设置右边可见的最小bar数量 * @param barCount */ setRightMinVisibleBarCount (barCount) { if (isNumber(barCount) && barCount > 0) { this._rightMinVisibleBarCount = Math.ceil(barCount) } } /** * 获取数据绘制起点 * @returns {number} */ from () { return this._from } /** * 获取数据绘制终点 * @returns {number} */ to () { return this._to } /** * 获取十字光标点 * @returns {null} */ crossHairPoint () { return this._crossHairPoint } /** * 获取十字光标点所在的pane的标识 * @returns {null} */ crossHairPaneTag () { return this._crossHairPaneTag } /** * 设置十字光标点所在的pane的标识 * @param tag */ setCrossHairPaneTag (tag) { this._crossHairPaneTag = tag this._invalidateHandler(InvalidateLevel.FLOAT_LAYER) } /** * 设置十字光标点 * @param point */ setCrossHairPoint (point) { this._crossHairPoint = point } /** * 开始滚动 */ startScroll () { this._preOffsetRightBarCount = this._offsetRightBarCount } /** * 滚动 * @param distance */ scroll (distance) { const distanceBarCount = distance / this._dataSpace this._offsetRightBarCount = this._preOffsetRightBarCount - distanceBarCount this.adjustOffsetBarCount() if (distanceBarCount > 0 && this._from === 0) { this._loadMoreHandler() } this._invalidateHandler() } /** * x转换成浮点数的位置 * @param x * @returns {number} */ coordinateToFloatIndex (x) { const dataSize = this._dataList.length const deltaFromRight = (this._totalDataSpace - x) / this._dataSpace const index = dataSize + this._offsetRightBarCount - deltaFromRight return Math.round(index * 1000000) / 1000000 } /** * 缩放 * @param scale * @param point */ zoom (scale, point) { const floatIndexAtZoomPoint = this.coordinateToFloatIndex(point.x) const dataSpace = this._dataSpace + scale * (this._dataSpace / 10) if (this._innerSetDataSpace(dataSpace)) { this._offsetRightBarCount += (floatIndexAtZoomPoint - this.coordinateToFloatIndex(point.x)) this.adjustOffsetBarCount() this._invalidateHandler() } } /** * 调整向右偏移bar的个数 * @private */ adjustOffsetBarCount () { const dataSize = this._dataList.length const barLength = this._totalDataSpace / this._dataSpace const difBarCount = 1 - this._barSpace / 2 / this._dataSpace const maxRightOffsetBarCount = barLength - Math.min(this._leftMinVisibleBarCount, dataSize) + difBarCount if (this._offsetRightBarCount > maxRightOffsetBarCount) { this._offsetRightBarCount = maxRightOffsetBarCount } const minRightOffsetBarCount = -dataSize + 1 + Math.min(this._rightMinVisibleBarCount, dataSize) - difBarCount if (this._offsetRightBarCount < minRightOffsetBarCount) { this._offsetRightBarCount = minRightOffsetBarCount } this._to = Math.round(this._offsetRightBarCount + dataSize) this._from = Math.floor(this._to - barLength) - 1 if (this._to > dataSize) { this._to = dataSize } if (this._from < 0) { this._from = 0 } } /** * 获取图形标记类型 * @returns {string} */ graphicMarkType () { return this._graphicMarkType } /** * 设置图形标记类型 * @param graphicMarkType */ setGraphicMarkType (graphicMarkType) { this._graphicMarkType = graphicMarkType } /** * 获取图形标记拖拽标记 * @returns {boolean} */ dragGraphicMarkFlag () { return this._dragGraphicMarkFlag } /** * 设置图形标记拖拽标记 * @param flag */ setDragGraphicMarkFlag (flag) { this._dragGraphicMarkFlag = flag } /** * 获取图形标记开始的点 * @returns {null} */ graphicMarkPoint () { return this._graphicMarkPoint } /** * 设置图形标记开始的点 * @param point */ setGraphicMarkPoint (point) { this._graphicMarkPoint = point } /** * 获取图形标记的数据 * @returns {{straightLine: [], verticalRayLine: [], rayLine: [], segmentLine: [], horizontalRayLine: [], horizontalSegmentLine: [], fibonacciLine: [], verticalStraightLine: [], priceChannelLine: [], priceLine: [], verticalSegmentLine: [], horizontalStraightLine: [], parallelStraightLine: []}} */ graphicMarkData () { return clone(this._graphicMarkDatas) } /** * 设置图形标记的数据 * @param datas */ setGraphicMarkData (datas) { const shouldInvalidate = this.shouldInvalidateGraphicMark() this._graphicMarkDatas = clone(datas) if (shouldInvalidate) { this._invalidateHandler(InvalidateLevel.GRAPHIC_MARK) } else { if (this.shouldInvalidateGraphicMark()) { this._invalidateHandler(InvalidateLevel.GRAPHIC_MARK) } } } /** * 设置加载更多 * @param callback */ loadMore (callback) { this._loadMoreCallback = callback } /** * 是否需要刷新图形标记层 * @returns {boolean} */ shouldInvalidateGraphicMark () { if (this._graphicMarkType !== GraphicMarkType.NONE) { return true } for (const graphicMarkKey in this._graphicMarkDatas) { if (this._graphicMarkDatas[graphicMarkKey].length > 0) { return true } } return false } /** * 添加一个自定义指标 * @param technicalIndicatorInfo */ addCustomTechnicalIndicator (technicalIndicatorInfo) { const NewTechnicalIndicator = createNewTechnicalIndicator(technicalIndicatorInfo) if (NewTechnicalIndicator) { const name = technicalIndicatorInfo.name // 将计算参数,放入参数集合 this._technicalIndicatorCalcParams[name] = technicalIndicatorInfo.calcParams || [] // 将生成的新的指标类放入集合 this._technicalIndicators[name] = NewTechnicalIndicator } } /** * 计算指标 * @param pane */ calcTechnicalIndicator (pane) { Promise.resolve().then( _ => { const technicalIndicator = pane.technicalIndicator() if (technicalIndicator) { technicalIndicator.setCalcParams(this._technicalIndicatorCalcParams[technicalIndicator.name]) if (technicalIndicator.isPriceTechnicalIndicator) { technicalIndicator.precision = this._pricePrecision } else if (technicalIndicator.isVolumeTechnicalIndicator) { technicalIndicator.precision = this._volumePrecision } technicalIndicator.result = technicalIndicator.calcTechnicalIndicator(this._dataList, technicalIndicator.calcParams) || [] } pane.invalidate(InvalidateLevel.FULL) } ) } }
/** * 1.获取用户的收货地址 * 1.绑定点击事件 * 2.调用小程序内置api 获取用户的收货地址 * 2.获取用户对小程序所授予获取地址的权限状态 scope * 1.假设用户点击获取收获地址的提示框 确定(scope值为true)authSetting scope.address * 2.假设用户点击获取收货地址的提示框 取消(scope 值为 false) * 3.将地址存入到缓存当中方便当前应用和其它应用查看 * 2.页面加载完毕 * 0.onload show * 1.获取本地存储中的地址数据 * 2.把数据设置给data中的一个变量 * 3.onshow * 0.回到了商品详情页面 在第一次添加商品的时候 手动添加了属性 * 1.num * 2.checked * 1.获取缓存中的购物车数组 * 2.把购物车数据填充到data当中 4.全选的实现 1.onshow, 获取到缓存当中的购物车数组 2.根据购物车中的商品数据 所有的商品都被选中 checked=true 全选就被选中 3.空数组调用了every的方法,返回值为true,所以会出现购物车为空但是也是全选的情况 5.总价格和总数量 1.都需要商品被选中 我们才拿它来计算 2.获取购物车数组 3.遍历 4.判断商品是否被选中 5.总价格+=商品的单价*商品的数量 6.总数量+=商品的数量 6.商品选中 1.绑定change事件 2.获取到被修改的商品对象 3.商品对象的选中状态 取反 4.重新填充回data和缓存当中 5.重新计算全选,总价格 总数量等 7.全选和反选 1.全选复选框绑定事件change 2.获取data中的全选变量 allckecked 3.直接取反 allChecked=!allChecked 4.遍历购物车数组,让里面的购物车商品选中状态跟随allChecked改变而改变 5.把购物车数组和allChecked重新设置回data 把购物车重新设置回缓存中 8.商品数量的编辑 1.“+”,“-”按钮,绑定同一个点击事件 区分的关键 自定义属性 1."+" "+1" 2."-" "-1" 2.传递被点击的商品id goods_id 3.获取data中的购物车数组 来获取需要被修改的商品对象 4.当购物车数量为1且用户继续操作数量减一时,弹窗是否要删除 1.确定——直接删除 2.取消——什么都不做 4.直接修改商品对象的数量 num 5.把cart数组 重新设置回缓存和data当中 9.点击结算 1.有没有收货地址信息 2.判断用户有没有选购商品 3.结果以上的验证 跳转到支付页面 */ import { getSetting,chooseAddress,openSetting,showModal,showToast } from "../../utils/asyncWx.js"; Page({ data:{ address:{}, cart:[], allChecked:false, totalPrice:0, totalNum:0 }, onShow(){ //1.获取缓存当中的收获地址 const address=wx.getStorageSync('address'); //1.获取缓存当中的数据 const cart=wx.getStorageSync('cart')||[]; // //1.计算全选 // //every数组方法 会遍历 会接收一个回调函数 那么 每一个回调函数都返回true,那么every方法返回值为true // //只要有一个回调函数返回了false,那么不再循环执行,直接返回false this.setData({address}); this.setCart(cart); }, //点击 收货地址 async handleChooseAddress(){ try { //1.获取权限状态 const res1=await getSetting(); const scopeAddress=res1.authSetting["scope.address"]; //2判断权限状态 if(scopeAddress===false){ //3诱导用户打开授权页面 await openSetting(); } let address=await chooseAddress(); address.all=address.provinceName+address.cityName+address.countyName+address.detailInfo; //4存入到缓存当中 wx.setStorageSync('address', address); } catch (error) { console.log(error); } }, //商品的选中 handleItemChange(e){ //1.获取被修改的商品id const goods_id=e.currentTarget.dataset.id; // console.log(goods_id); //2,获取购物车数组 let {cart}=this.data; //3.找到被修改的商品对象 let index=cart.findIndex(v=>v.goods_id===goods_id); //4.选中状态取反 cart[index].checked=!cart[index].checked; this.setCart(cart); }, //设置购物车状态的同时 重新计算 底部工具栏的数据 全选 总价格 购买的数量 setCart(cart){ let allChecked=true; //1.总价格 总数量 let totalPrice=0; let totalNum=0; cart.forEach(v=>{ if(v.checked){ totalPrice+=v.num*v.goods_price; totalNum+=v.num; }else{ allChecked=false; } }) //判断数组是否为空 allChecked=cart.length!=0?allChecked:false; this.setData({ cart, totalPrice, totalNum, allChecked }); wx.setStorageSync('cart', cart); }, //商品全选功能 handleItemAllCheck(){ //1.获取data中的数据 let {cart,allChecked}=this.data; //2.修改值 allChecked=!allChecked; //3.循环修改cart数组中的商品选中状态 cart.forEach(v=>v.checked=allChecked); //4.把修改后的值填回data或者缓存当中 this.setCart(cart); }, //商品数量编辑功能 async handleItemNumEdit(e){ //1.获取传递过来的参数 const {operation,id}=e.currentTarget.dataset; //2.获取购物车数组 let {cart}=this.data; //3.找到需要修改的商品的索引 const index=cart.findIndex(v=>v.goods_id===id); //4.判断是否要执行删除 if(cart[index].num===1&&operation===-1){ //弹窗提示 const res=await showModal({content:"你是否要删除这个宝贝"}); if(res.confirm){ cart.splice(index,1); this.setCart(cart); } }else{ //4.进行修改数据 cart[index].num+=operation; //5.设置回缓存和data当中 this.setCart(cart); } }, //点击结算功能 async hanndlePay(){ //1.判断收货地址 const {address,totalNum}=this.data; if(!address.userName){ await showToast({title:"您还没有选择收货地址"}); return; } //2.判断用户有没有选购商品 if(totalNum===0){ await showToast({title:"您还没有选购商品"}); return ; } //3.跳转到支付页面 wx.navigateTo({ url: '/pages/pay/index', }) } })
import React, { Component } from 'react' import * as S from './TelaUsuarioStyle' class TelaUsuario extends Component { constructor(props){ super(props) this.state={ usuario:{ nome:'',celular:'',email:''}, } this.OnHandleChange=this.OnHandleChange.bind(this) this.OnHandleSubmit=this.OnHandleSubmit.bind(this) } OnHandleChange(e){ const {name ,value}=e.target this.setState({usuario:{...this.state.usuario,[name]:value } }) } OnHandleSubmit(e){ e.preventDefault(); const id=Math.floor(Math.random() * 1000) const usuario={...this.state.usuario,id} alert('Você foi Cadastrado') this.setState({usuario:{ nome:'',email:'',celular:'' }}) this.props.adicionarUsuario(usuario) } render() { return ( <> <S.TelaLogin > <div className="login" > <div className="login-container" > <div className="titulo--container" > <h1>Cadastre-se</h1></div> <form className="form" onSubmit={this.OnHandleSubmit} > <label for="fname" ></label> <input type="text" name="nome" className="input" placeholder="Nome" value={this.state.usuario.nome} onChange={this.OnHandleChange} required ></input> <span className="form__input" ></span> <label for="fname" ></label> <input type="email" name="email" className="input" placeholder="Email" onChange={this.OnHandleChange} value={this.state.usuario.email} ></input> <span className="form__input" ></span> <label for="fname" ></label> <input type="number" name="celular" className="input" placeholder="Celular" onChange={this.OnHandleChange} value={this.state.usuario.celular} ></input> <span className="form__input" ></span> <button className="button__Confirm" type="submit" >Reservar Vaga</button> </form> </div> </div> </S.TelaLogin> </> ) } } export default TelaUsuario;
const path = require('path'), _ = require('lodash'); module.exports = function (config) { let args = process.argv.slice(_.findIndex(process.argv, a => path.resolve(__dirname, a) === __filename) + 1); global.args = {}; for (let arg of args) { if (arg.indexOf('=') !== -1) { let parts = arg.split('='); let key = parts[0]; key = _.camelCase(key); let value = parts[1]; if (value && (value[0]==='[' || value[0] === '{')){ try { //value = value.replace(/'/g, '"'); value = JSON.parse(value); } catch(exp){ console.error('bad json'); } } if (!isNaN(value)){ value = +value; } if (value === 'false' || value === 'true'){ value = (value !== 'false'); } _.set(config, key, value); } else { global.args[arg] = true; } } _.each(process.env, function(value, key){ key = _.camelCase(key); if (config.hasOwnProperty(key)){ if (value && (value[0] === '{' || value[0] === '[')){ try { value = JSON.parse(value); } catch(exp){ console.log('error parsing config: ' + key + ', value: ' + value); } config[key] = value; } else if (value === 'false' || value === 'true'){ config[key] = value === 'true'; } else { if (!isNaN(value)){ value = +value; } config[key] = value; } } }); }
// Require the framework and instantiate it const fastify = require('fastify')({logger: true}) fastify.register(require('fastify-cors'), { origin: /.*/, allowedHeaders: ['Origin', 'X-Requested-With', 'Accept', 'Content-Type', 'Authorization'], methods: ['GET', 'PUT', 'PATCH', 'POST', 'DELETE', 'OPTIONS'] }); // Declare a route fastify.post('/', async (request, reply) => { const body = request.body return { id: Math.random().toString(16).replace('.', ''), name: body.name, age: body.age } }) // Run the server! const start = async () => { try { await fastify.listen(3000) fastify.log.info(`server listening on ${fastify.server.address().port}`) } catch (err) { fastify.log.error(err) process.exit(1) } } start()
const axios = require('axios'); const getGeocode = (address) => { return new Promise((resolve, reject) => { axios.get('https://maps.googleapis.com/maps/api/geocode/json', { params: { address, }, }) .then(response => { if (response.data.status === 'ZERO_RESULTS') { reject(Error('Unable to find that address.')); } else if (response.data.status === 'OK') { const geoInfo = { address: response.data.results[0].formatted_address, lat: response.data.results[0].geometry.location.lat, lng: response.data.results[0].geometry.location.lng, }; resolve(geoInfo); } }) .catch(error => { reject(Error('Unable to connect to google servers.')); }); }); }; module.exports = { getGeocode, };
import React, { useContext } from "react"; import { MenuItem, Select, Typography } from "@material-ui/core"; import FormControl from "@material-ui/core/FormControl"; import { withStyles, makeStyles } from "@material-ui/core/styles"; import CourseContext from "../../context/course/courseContext"; const StyledSelect = withStyles({ root: { width: "18rem", padding: "0.2rem", paddingLeft: "1rem", }, select: { backgroundColor: "#ffffff", "&:focus": { backgroundColor: "#ffffff", }, }, })(Select); const useStyles = makeStyles((theme) => ({ university: { display: "flex", flexDirection: "row", }, currentUni: { margin: "0.5rem", marginBottom: "1rem", fontSize: "0.9em", color: "#504F4F", }, select: { margin: "0.3rem", height: "1.7em", }, })); const options = require('../../common/universitiesList.json'); const Filter = () => { const classes = useStyles(); const courseContext = useContext(CourseContext); const handleSelectChange = (event) => { const option = options.find(ele => { return ele.universityID === event.target.value }) courseContext.dispatch({ type: "SET_CURRENT_UNIVERSITY", payload: option, }); }; return ( <div> <div className={classes.university}> <Typography className={classes.currentUni}> Current University: </Typography> <FormControl> <StyledSelect className={classes.select} variant="outlined" //defaultValue={courseContext.currentUniversity} value={courseContext.currentUniversity.universityID} onChange={handleSelectChange} > {options.map((option, index) => <MenuItem key={index} value={option.universityID}> {option.universityName} </MenuItem> )} </StyledSelect> </FormControl> </div> </div> ); }; export default Filter;
/** * Created by Administrator on 2017/1/6. */ /*Bootlint Bootlint 是 Bootstrap 官方所支持的 HTML 检测工具。在使用了 Bootstrap 的页面上(没有对 Bootstrap 做修改和扩展的情况下), 它能自动检查某些常见的 HTML 错误。纯粹的 Bootstrap 组件需要固定的 DOM 结构。Bootlint 就能检测你的页面上的这些“纯粹”的 Bootstrap 组件是否符合 Bootstrap 的 HTML 结构规则。建议将 Bootlint 加入到你的开发工具中, 这样就能帮你在项目开发中避免一些简单的错误影响你的开发进度。*/ (function () { var s = document.createElement("script"); s.onload = function () { bootlint.showLintReportForCurrentDocument([]); }; s.src = "js/bootlint.js"; document.body.appendChild(s) })()
var searchData= [ ['desktop',['desktop',['../class_screen_saver.html#a02d489a9a5ff5777d0aa29f8552efe35',1,'ScreenSaver']]], ['detachactionbutton',['DetachActionButton',['../struct_calendar_tools.html#a4c4ae188d97622a4da7b1b0c47f7629d',1,'CalendarTools']]], ['detachmenu',['DetachMenu',['../struct_calendar_tools.html#a09210d97a0a3aaf912aaa2389a076ff3',1,'CalendarTools']]], ['downbutton',['DownButton',['../struct_calendar_tools.html#a9a5b20ba0477c0debcf109039d929eb0',1,'CalendarTools']]] ];
({ getAttachmentRecords: function (component, event, helper) { let filterApplied = component.get("v.isFilterApplied"); let currentUsertimeZone = $A.get("$Locale.timezone"); let recId = component.get("v.recordId"); if(recId){ helper.callServer( component, "c.getAttachmentList", function (result) { if (result) { component.set('v.mycolumns', [ {label: 'Name', fieldName: 'Name', initialWidth: 180, type: 'text', sortable: true}, { label: 'Date/Time', fieldName: 'createdDateTime', initialWidth: 120, type: 'date', typeAttributes: { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", timeZone: currentUsertimeZone, hour12: "false" }, sortable: true }, {label: 'Size', fieldName: 'size', initialWidth: 75, type: 'text'}, { label: 'Action', type: 'button', initialWidth: 140, typeAttributes: { iconName: {fieldName: 'actionIcon'}, label: {fieldName: 'attachmentAction'}, name: {fieldName: 'attachmentAction'}, title: {fieldName: 'attachmentAction'}, value: {fieldName: 'attachmentAction'}, } } ]); component.set("v.attachmentList", result); } }, { caseId: recId, isFilterApplied: filterApplied } ); } }, //Open file openFileHandler: function (row, component, event, helper) { let selectedRow = row; if (selectedRow) { let recId = selectedRow.Id; $A.get('e.lightning:openFiles').fire({ recordIds: [recId] }); } }, //Open custom attachment in dailog box openAttachmentHandler: function (row, component, event, helper) { let selectedRow = row; if (selectedRow) { let recId = selectedRow.Id; let actType = selectedRow.attachmentAction; let modalSize= 'slds-modal_large'; if (recId) { if(actType==='Download'){ modalSize='slds-modal_small'; } $A.createComponents( [ ["c:CustomAttachmentViewer", { recordId: recId, actionType: actType }] ], function (components, status) { if (status === "SUCCESS") { component.find("attachmentModalId").showCustomModal({ body: components, showCloseButton: true, cssClass: modalSize, }).then(function (overlay) { if (actType === 'Download') { setTimeout(function () { //close the dropdown after 3 seconds overlay.close(); }, 8000); } }); } else { console.log(status); } } ); } } }, // To sort column sortData: function (component, fieldName, sortDirection) { let data = component.get("v.attachmentList"); let reverse = sortDirection !== 'asc'; data.sort(this.sortBy(fieldName, reverse)); component.set("v.attachmentList", data); }, // To sort column sortBy: function (field, reverse, primer) { let key = primer ? function (x) { return primer(x[field]) } : function (x) { return x[field] }; reverse = !reverse ? 1 : -1; return function (a, b) { return a = key(a), b = key(b), reverse * ((a > b) - (b > a)); } }, //Selected Row selectedRowHelper: function (component, event, helper) { let selectedItems = []; let selectedFiles = []; let selectedRows = event.getParam('selectedRows'); if (selectedRows.length > 0) { component.set("v.isDisabled", false); } else { component.set("v.isDisabled", true); } for (let i = 0; i < selectedRows.length; i++) { if (selectedRows[i].type === 'Attachment') { let sel = selectedRows[i].Id; selectedItems.push(sel); } else if (selectedRows[i].type === 'File') { let file = selectedRows[i].Id; selectedFiles.push(file); } } component.set("v.selectedFiles", selectedFiles); component.set("v.selectedAttachments", selectedItems); }, //Remove selected attachment from list deleteSelectedAttachment: function (component, event, helper) { let attIds = component.get("v.selectedAttachments"); let recId = component.get("v.recordId"); let fId = component.get("v.selectedFiles"); helper.callServer( component, "c.removeAttachments", function (result) { this.successToast(component, "Successfully removed from list"); this.getAttachmentRecords(component, event, helper); }, { caseId: recId, fileIds: fId, attachIds: attIds } ); }, //To show success toast successToast: function (component, successMessage) { component.find('notifLib').showToast({ "title": "", "message": successMessage, "variant": "success" }); } })
!function (e) { var t = e.amkit; t || (t = e.amkit = {}); var n = t.entry; n || (n = t.entry = {}), n.getScript || (n.getScript = function () { var e = /loaded|complete/, t = document.getElementsByTagName("head")[0] || document.documentElement, n = t.getElementsByTagName("base")[0]; return function (a, r, s) { function o() { i.onload = i.onerror = i.onreadystatechange = null, t.removeChild(i), i = null, r && r() } var i = document.createElement("script"); "onload"in i ? i.onerror = i.onload = o : i.onreadystatechange = function () { e.test(i.readyState) && o() }, i.async = !0, i.src = a, s && (i.id = s), n ? t.insertBefore(i, n) : t.appendChild(i) } }()), n.run || (n.run = function () { function e() { var e, n, a, r, s = document.getElementsByTagName("script"), o = []; for (a = 0, r = s.length; r > a; a++)e = s[a], e.src && e.src.toLowerCase().indexOf("amkit/entry") >= 0 && (n = e.getAttribute("data-entry"), n && t.push(n.toLowerCase()), o.push(e)); for (a = 0, r = o.length; r > a; a++)e = o[a], e.parentNode && e.parentNode.removeChild(e); o = e = s = null } var t = []; return function () { e(); for (var n; n = t.shift();)seajs.use(n) } }()), e.seajs ? (!seajs.define && e.define && (seajs.define = e.define), seajs.args || n.run()) : !function () { function t(e) { return function () { return r.push(e, arguments), a } } var a, r = []; e.seajs = a = { args: r, define: t(0), config: t(1), use: t(2) }, n.getScript("http://assets.dwstatic.com/b=amkit/seajs&f=2.2.0/sea.js,2.2.0/ex.js,seajs-style/1.0.2/seajs-style.js&nm&20150507", n.run, "seajsnode") }() }(this);
import usersModel from '../../models/usersModel.js' import passport from 'koa-passport' // паспорт напрямую с базой не работает passport.serializeUser(function (user, done) { done(null, user._id); }); passport.deserializeUser(function (id, done) { usersModel.findById(id, (err, user) => { if (err) done(err, null); else done(null, user); }); });
/* Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be valid. Try to do this in one pass. */ var ListNode = function(val) { this.val = val; this.next = null; }; var removeNthFromEnd = function(head, n) { if (head === null) { return null; } var result = new ListNode(0); result.next = head; var slowNode = result; var fastNode = result; for (var i = 0; i <= n; i++) { fastNode = fastNode.next; } while (fastNode !== null) { slowNode = slowNode.next; fastNode = fastNode.next; } slowNode.next = slowNode.next.next; return result.next; }; var testNode = new ListNode(1); testNode.next = new ListNode(2); // testNode.next.next = new ListNode(3); // testNode.next.next.next = new ListNode(4); // testNode.next.next.next.next = new ListNode(5); console.log(removeNthFromEnd(testNode, 1));
// var Table = function (id, product_name, price, stock_quantity){ // this.id=id, // this.product_name= product_name, // this.price= price // this.stock_quantity= stock_quantity // } // module.exports= Table; var mysql = require("mysql"); var inquirer = require("inquirer"); var Table = require("cli-table"); var con = mysql.createConnection({ host: "localhost", user: "root", password: "LMR0305", database: "bamazon", }); con.connect(function(err) { if (err) throw err; console.log("connected as id: " + connection.threadId); }); function inventory() { con.query('SELECT * FROM Products', function(err, res) { if (err) { console.log(err); } var invTable = new Table({ head: ["id", "product_name","department_name", "stock_quantity", "price"], colWidths: [10, 25, 25, 10, 14], }); for (i = 0; i < res.length; i++) { invTable.push([ res[i].item_id, res[i].product_name, res[i].department_name, res[i].price, res[i].stock_quantity, ]); } console.log(invTable.toString()); updates(); }); } function updates(){ inquirer.prompt([ { name: "action", type: "list", message: "How would you like to manage current inventory:", choices: ["Restock Iventory", "Add New Product", "Remove Existing Product"] }, ]) .then(function(answers) { switch (answers.action) { case "Restock Iventory": restock(); break; case "Add New Product": add(); break; case "Remove Existing Product": remove(); break; } }) } function restock(){ inquirer .prompt([ { name: "id", type: "input", message: "Please enter the Id of the item you'd like to restock", }, { name: "quantity", type: "input", message: "What is the quantity of the item you'd like to restock", }, ]).then(function(answer){ }) }
const array = [1, 2, 3]; export const isES6 = () => console.log(...array); export const bobby = { name: 'Bobby', age: 18 };
/** * @file Tree.js * @author zhangzhe(zhangzhe@baidu.com) */ import {DataTypes, defineComponent} from 'san'; import _ from 'lodash'; import TreeNode from './TreeNode'; import {create} from './util'; const cx = create('ui-tree'); /* eslint-disable */ const template = `<div class="{{mainClass}}"> <ui-tree-node s-if="datasource.value" value="{{datasource.value}}" text="{{datasource.text}}" level="{{0}}" children="{{datasource.children}}" expand-all="{{expandAll}}" multi="{{multi}}" edit="{=edit=}" tree-value="{{value}}" active-value="{{activeValue}}" /> </div>`; /* eslint-enable */ function getParentKeyByNode(datasource, node) { let parentNodeKey = 'datasource'; let tempNode = datasource; for (let i = 1; i < node.parents.length; i++) { const index = _.findIndex(tempNode.children, n => n.value === node.parents[i]); tempNode = tempNode.children[index]; parentNodeKey += `.children[${index}]`; } return parentNodeKey; } export default defineComponent({ template, components: { 'ui-tree-node': TreeNode }, computed: { mainClass() { const skin = this.data.get('skin'); const klass = [cx(), cx('x'), cx(`skin-${skin}`)]; return klass; } }, initData() { return { skin: 'arrow', // 皮肤 arrow|block|folder expandAll: false, // 完全展开所有节点,默认只展开根节点 multi: false, // 是否支持多选 value: [], // 如果multi等于true,表示选中的节点集合,否则表示最新点击的叶子节点 activeValue: '', // 最新被点击的叶子节点value edit: false // 是否可以编辑 }; }, messages: { expand(evt) { const node = evt.value; this.fire('expand', {node}); }, collapse(evt) { const node = evt.value; this.fire('collapse', {node}); }, select(evt) { const node = evt.value; this.data.push('value', node.value); this.fire('select', { node, value: this.data.get('value') }); }, unselect(evt) { const node = evt.value; this.data.remove('value', node.value); this.fire('unselect', { node, value: this.data.get('value') }); }, click(evt) { const node = evt.value; // 点击了某个叶子节点 if (!this.data.get('multi')) { this.data.set('value', node.value); } this.data.set('activeValue', node.value); this.fire('click', {node}); }, creating(evt) { const parentNode = evt.value; this.createNode(parentNode); }, delete(evt) { const node = evt.value; this.deleteNode(node); this.fire('delete', {node}); }, confirm(evt) { const node = evt.value; // 更新状态 this.resetNode(node); const eventName = !node.value ? 'create' : 'update'; // 注意:如果是新添加的节点,为避免一些未知错误,在后端实际创建好之后,需要再把实际的value赋到这个节点的value上 this.fire(eventName, {node}); }, cancelEdit(evt) { // 取消创建或编辑 const node = evt.value; // 如果是添加的取消,则还需要把这个节点删除 if (!node.value) { this.deleteNode(node); } } }, dataTypes: { /** * Tree 的数据源,每一项的格式如下: * <pre><code>{ * value: string, (所有节点的value MUST唯一) * text: string, * children?: array (如果有儿子,则有这个字段) * }</code></pre> */ datasource: DataTypes.object, /** * Tree 的皮肤 arrow|block|folder * * @default 'arrow' */ skin: DataTypes.string, /** * 是否完全展开所有节点,默认只展开根节点 * * @default false */ expandAll: DataTypes.bool, /** * 是否支持多选 * * @default false */ multi: DataTypes.bool, /** * 如果multi等于true,表示选中的节点集合 * 如果multi等于false,则表示最近点击的叶子节点 */ value: DataTypes.any, /** * 是否支持编辑(增删改) * * @default false */ edit: DataTypes.bool }, deleteNode(node) { const datasource = this.data.get('datasource'); if (node.level === 0) { // 整个树都删掉 this.data.set('datasource', {}); } else { let parentNodeKey = getParentKeyByNode(datasource, node); const tempNode = this.data.get(`${parentNodeKey}`); // 获取要删除的节点index const lastIndex = _.findIndex(tempNode.children, n => n.value === node.value); this.data.removeAt(`${parentNodeKey}.children`, lastIndex); } }, createNode(parentNode) { const datasource = this.data.get('datasource'); let parentNodeKey = getParentKeyByNode(datasource, parentNode); const tempNode = this.data.get(`${parentNodeKey}`); if (parentNode.level !== 0) { const lastIndex = _.findIndex(tempNode.children, n => n.value === parentNode.value); parentNodeKey += `.children[${lastIndex}]`; } // 添加新的子节点 if (!this.data.get(`${parentNodeKey}.children`)) { this.data.set(`${parentNodeKey}.children`, []); } this.data.push(`${parentNodeKey}.children`, {value: '', text: '', isUpdating: true}); }, resetNode(node) { const datasource = this.data.get('datasource'); let parentNodeKey = getParentKeyByNode(datasource, node); const tempNode = this.data.get(`${parentNodeKey}`); if (node.level !== 0) { const lastIndex = _.findIndex(tempNode.children, n => n.value === node.value); parentNodeKey += `.children[${lastIndex}]`; } if (this.data.get(`${parentNodeKey}`)) { this.data.set(`${parentNodeKey}.isUpdating`, false); this.data.set(`${parentNodeKey}.text`, node.text); if (!this.data.get(`${parentNodeKey}.value`)) { // 做个假的“value“ const mockValue = node.parents[node.parents.length - 1] + '_child-' + tempNode.children.length; this.data.set(`${parentNodeKey}.value`, mockValue); } } } });
'use strict' const mongoose = require('mongoose'); const moment = require('moment'); const config = require('../../config'); const Simcard = require('./simcard'); mongoose.Promise = global.Promise; let RechargeHistorySchema = new mongoose.Schema({ _simcardId: { type: mongoose.Schema.Types.ObjectId, ref: 'Simcard' }, simcardNo: { type: String, index: true }, time: Date, //充值时间 fee: Number, //充值金额,整数,单位分 grant: Number, //赠送费用 payStatusCode: Number, //支付状态代码,整数,0为待支付,1为支付成功 wxPayOrderNo: { type: String, index: true } //微信支付订单号 }); /** * 用户充值,创建充值记录 * * 先根据号码找到号码账户,再创建交费记录,最后返回刚刚生成的微信支付订单号 * * @param {string} simcardNo 充值号码 * @param {number} rechargeFee 充值金额 * * @return {string} 新微信支付订单号 * * @date 2016-5-14 * @date 2016-6-30 * @date 2016-7-13 * @date 2016-7-14 */ RechargeHistorySchema.statics.createNew = function(newRechargeHistory) { return this.create(newRechargeHistory); } /** * 用户充值成功,修改充值记录状态 * * 先根据微信支付单号找到交费记录,返回号码id * * @param {string} wxPayOrderNo 微信支付单号 * * @return {mongoose.model} 充值记录 * * @date 2016-5-17 * @date 2016-7-13 * @date 2016-7-14 */ RechargeHistorySchema.statics.updatePayStatus = function(wxPayOrderNo) { return this.findOneAndUpdate( { 'wxPayOrderNo': wxPayOrderNo }, { '$set': { 'payStatusCode': config.payStatusCodeDef.paid }} ) .exec(); } /** * 查询半小时内是否有充值记录 * * 绑定时查询该号码半小时内是否有金额不少于10元的充值记录 * * @param {string} simcardNo 号码 * @param {string} timePoint 时间点 * * @return {mongoose.model} 30分钟内的某次缴费记录 * * @date 2016-6-26 * @date 2016-7-14 */ RechargeHistorySchema.statics.findRecent = function(simcardNo, timePoint) { return this.findOne({ 'simcardNo': simcardNo, 'time': { '$gte': timePoint }, 'payStatusCode': config.payStatusCodeDef.paid, 'fee': { '$gte': 1000 }} ).exec(); } /** * 查询历史充值记录 * * 根据号码和起始、截止时间查询历史充值记录 * * @param {string} simcardNo 号码 * @param {string} startDate 起始时间 * @param {string} endDate 截止时间 * * @return {array} 历史充值记录 * * @date 2016-7-5 * @date 2016-7-13 * @date 2016-7-14 */ RechargeHistorySchema.statics.findByDate = function(simcardNo, startDate, endDate) { return this.find({ 'simcardNo': simcardNo, 'time': { '$gte': startDate, '$lte': endDate }, 'payStatusCode': config.payStatusCodeDef.paid }, 'fee grant time').exec(); } /** * 根据微信订单号码查询充值记录 * * @param {string} 微信支付订单号 * * @returns {mongoose.model} * * @date 2016-8-19 */ RechargeHistorySchema.statics.findByWxPayOrderNo = function(wxPayOrderNo) { return this.findOne({ 'wxPayOrderNo': wxPayOrderNo }, 'payStatusCode').exec(); } module.exports = mongoose.model('RechargeHistory', RechargeHistorySchema);
import api from './api'; import i18n from './i18n'; import lang from './langCodes'; import parseResponse from './parseResponse'; export { api, i18n, lang, parseResponse };
import React, { useEffect, useState } from "react"; import { NavLink } from "react-router-dom"; import logo from "./image/Plabon Express.jpg"; import "./Navbar.css"; const Navbar = () => { const [scrolled, setScrolled] = useState(false); const handleScroll = () => { const offset = window.scrollY; if (offset > 91) { setScrolled(true); } else { setScrolled(false); } }; useEffect(() => { window.addEventListener("scroll", handleScroll); }); let navbarClasses = [""]; if (scrolled) { navbarClasses.push("scrolled"); } // className="navbar fixed-top" return ( <div className={`fixed-top navbar ${navbarClasses.join(" ")}`}> <nav className="navbar-expand-lg navbar-dark container"> <NavLink className="navbar-brand" to="/"> <img className="logo" src={logo} alt="" /> </NavLink> <button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" > <span className="navbar-toggler-icon"></span> </button> <div className="collapse navbar-collapse " id="navbarSupportedContent"> <ul className="navbar-nav ml-auto"> <li className="nav-item"> <NavLink className="nav-link nav-text mr-3 mt-2" to="/home"> Home </NavLink> </li> {/* <li className="nav-item"> */} {/* <NavLink className="nav-link nav-text mr-3 mt-2" to="/home"> */} {/* <Link to="to-service">Service</Link> */} {/* service */} {/* </NavLink> */} {/* </li> */} {/* <li className="nav-item"> <NavLink className="nav-link nav-text mr-3 mt-2" to="/ServicePage" > Service </NavLink> </li> */} <li class="nav-item dropdown mr-3 mt-2 active"> <NavLink class="nav-link nav-text dropdown-toggle service-main-text" to="/transport" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" > Service </NavLink> <div class="dropdown-menu dropDown-box" aria-labelledby="navbarDropdownMenuLink" > <NavLink class="dropdown-item dropDown-text" to="/transport"> Transport </NavLink> <NavLink class="dropdown-item dropDown-text" to="/privateCar"> PrivateCar </NavLink> <NavLink class="dropdown-item dropDown-text" to="/ambulance"> Ambulance </NavLink> <NavLink class="dropdown-item dropDown-text" to="/cargo"> Cargo </NavLink> <NavLink class="dropdown-item dropDown-text" to="/shipping"> Shipping </NavLink> <NavLink class="dropdown-item dropDown-text" to="/excavator"> Excavator </NavLink> <NavLink class="dropdown-item dropDown-text" to="/Bulldozer"> Bulldozer </NavLink> </div> </li> <li className="nav-item"> <NavLink className="nav-link nav-text mr-3 mt-2" to="/about"> About Us </NavLink> </li> <li className="nav-item"> <NavLink className="nav-link nav-text mr-3 mt-2" to="/contact"> Contact Us </NavLink> </li> <li className="nav-item"> <NavLink className="nav-link" to="/termsAndCondition"> <button className="nav-btn">Terms & Condition</button> </NavLink> </li> </ul> </div> </nav> </div> ); }; export default Navbar;
import React from 'react' import {Drawer as MUIDrawer, ListItem, List, ListItemIcon, ListItemText } from "@material-ui/core"; import { makeStyles } from "@material-ui/core"; import { withRouter } from "react-router-dom"; import DashboardIcon from '@material-ui/icons/Dashboard'; import ListIcon from '@material-ui/icons/List'; const useStyles = makeStyles({ drawer: { width: "190px", } }) const Drawer = (props) => { const {history} = props; const classes = useStyles(); const itemList = [{ text: "Dashboard", icon: <DashboardIcon/>, onClick: ()=> history.push('/') }, { text: "Task", icon: <ListIcon/>, onClick: ()=> history.push("/task")} ]; return ( <MUIDrawer variant="permanent" className={classes.drawer}> <List> Menu {itemList.map((item, index) => { const {text, icon, onClick} = item; return ( <ListItem button key={text} onClick={onClick}> {icon && <ListItemIcon>{icon}</ListItemIcon>} {/* <ListItemIcon>{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}</ListItemIcon> */} <ListItemText primary={text} /> </ListItem> )})} </List> </MUIDrawer> ) } export default withRouter(Drawer)
const fs = require("fs") exports.index = async (req, res,next) => { if(!req.installScript){ next() return } res.render('install/index',{}); } exports.install = async(req,res,next) => { if(!req.installScript){ next() return } //read env file const filePath = req.SQLFILE // const obj = Object.fromEntries(new URLSearchParams(req.body.data)); // let purchase_code = obj['purchase_code']; fs.readFile(filePath, { encoding: 'utf8' }, function (err, data) { if (!err) { req.getConnection(function (err, connection) { if(!req.query.cronData){ connection.query(data,function(err,results,fields) { if(!err){ req.installScript = false process.env['installScript'] = false res.send({status:1}) } else res.send({status:0,error:err}) }) } }) }else{ res.send({status:0}) } }) }
[{"locale": "es"}, {"key": "2135", "mappings": {"default": {"default": "alef"}}, "category": "Lo"}, { "key": "2136", "mappings": {"default": {"default": "bet"}}, "category": "Lo" }, {"key": "2137", "mappings": {"default": {"default": "guímel"}}, "category": "Lo"}, { "key": "2138", "mappings": {"default": {"default": "dálet"}}, "category": "Lo" }]
$(document).ready(function() { console.log("Page has loaded...") // ----------------------------------- DECLARE VAROABLES &&& FUNCTIONS------------------------------------------------ var searchTermArray = ["Superman", "Batman", "Wonderwoman", "Poison Ivy"]; var searchTerm = ""; var searchTermNum = ""; function createGifButton (searchArray, gifClass, searchNo, gifPostArea) { // $("#gifArea").empty(); $(gifPostArea).empty(); for (var i = 0; i < searchArray.length; i++) { var button = $("<button>"); button.addClass(gifClass); button.attr("data-type", searchArray[i]); //this assigns an attribue called 'data-type' with a value that ==== the value of the current index in the sesarchTermArray, which in this case is a superhero name (ie. batman). button.attr("data-num", searchNo) button.text(searchArray[i]); //this displays the value (in this case === a superhero name) of the item in the area. $(gifPostArea).append(button); } }; function clear() { $("#searchBox").val(""); $("#gifAmount").val(""); $("#searchedGif").empty(); searchTermArray = []; } // ----------------------------------- RUN APP ------------------------------------------------ createGifButton(searchTermArray, "searchedGif", searchTermNum, "#searchedGif"); $("#searchBox").on("click", function() { //This resets the search box each time someone clicks inside it! $("#searchBox").val(""); $("#gifAmount").val(""); }); $("#clearButton").on("click", function() { //This is the reset button value. clear(); $("#gifDiplayHeader").text("GIFs IN ACTION!!"); $("#gifArea").html("<div id='gifArea'>You haven't entered any GIFS! <br/> Use the buttons above to have a 'GIFtastic' time!!"); }); $("#gifSearchButton").on("click", function() { event.preventDefault(); searchTerm = $("#searchBox").val(); console.log(searchTerm); searchTermNum = $("#gifAmount").val(); console.log(searchTermNum); if (searchTermNum <= 0) { alert("You must select a positive integer. The more GIFs the merrier!"); clear(); return; } searchTermArray.push(searchTerm); console.log(searchTermArray); createGifButton(searchTermArray, "searchedGif", searchTermNum, "#searchedGif"); console.log($(".searchedGif").data("type")); //Why does this NOT console log ALL the buttons with the class ".searchedGIF"???, &&& Why does it only ALWAYS list the first search data (title/num) info?! console.log($(".searchedGif").data("num")); // The same as above! // var searchId = button.id; //Would / Could htis be a way to updatethe previous request to the most recent GIF search , and thsu corect its functioning. // console.log(button.id); $("#gifDiplayHeader").text("GIFs IN ACTION!!"); $("#gifArea").text("Click on the GIF button(s) above to reveal the power of your GIF!"); return false; //!!!!!!!!Don't need this fearture because, not useing a input element wieht a submit type/prop NOW,---> using button. CORRECT??!!!!!!!******** }); //----------------------------------- Starting point for api interface.. getting and displaying the GIFs!!!!!!-------------------------------- $(document).on("click", ".searchedGif", function () { // $(".searchedGif").on("click", function(){ //!!!CANNOT USE THIS SET-UP BECAUSE THE CLASS ".SEARCHEDGIF" WAS DYNAMICALLY CREATED WITH JQUERY!!!!! event.preventDefault(); console.log("I am running."); $("#gifArea").empty(); var gifTypeValue = $(this).data("type"); var gifTypeNum = $(this).data("num"); console.log($(this).data("type")); //should match previous console.log($(this).data("num")); //!!!!should match previous ---> THIS IS UNDEFINED...?? WHY???!!!!!************ var rating = "PG-13" || "PG" || "G"; //setting the rating parameters (?? -> parameters? correct term? ??) WHY DO SOME Y ratings pass through??!! var apiKey = "c543e1e3482945068cddd1abaf372398"; var url = "https://api.giphy.com/v1/gifs/search?api_key=" + apiKey + "&q=" + gifTypeValue + "&limit=" + gifTypeNum + "&rating=" + rating + "&lang=en"; console.log("URL= " + url); $.ajax({ url: url, method: "GET" }) .done(function(result) { console.log("This is the result:" + result); // review the result for QA console.log("URL: " + url + "IS working..."); $("#gifDiplayHeader").text("GIFs IN ACTION - " + gifTypeValue + ("!!")); //Change the tite to include a mention to the current search for (var j = 0; j < result.data.length; j++) { //(*IT IS CRUTIAL TO REMEBER TO PUT RESULT.DATA.LENGTH as we are cylcing thefour the RESULT'S // DATA info, and not an array called results with many types of names/values!!!*) var gifDisplayDiv = $("<div class='gifResult'>"); //creating div in which to place the GIF displays --> will append this to the gifArea! var gifRating = result.data[j].rating; //adding rating to display alongside: 1) step one is grab value of rating var p = $("<p>").text("Rating: " + gifRating); //2) step two is place that value into a <p>tag. var animated = result.data[j].images.fixed_height.url; var still = result.data[j].images.fixed_height_still.url; var image = $("<img>"); image.attr("src", still); //setting the initial IMG Source to a STILL image image.attr("data-still", still); //reference the url for the still GIF image.attr("data-animated", animated); //reference the url for the animated image.attr("data-state", "still"); //Setting the current status to "still" --> this is GIF default state image.addClass("finalGifImage");//CREATE a class for the gifDisplayDiv.append(p); gifDisplayDiv.append(image); $("#gifArea").append(gifDisplayDiv); }; }).fail(function(err) { throw err; }); var clearDisplay = $("<button>"); clearDisplay.addClass("clearDisplay"); clearDisplay.text("Out of sight, out of mind."); $("#gifArea").prepend(clearDisplay); $(".clearDisplay").on("click", function() { //clears the displayed GIFs $("#gifArea").empty(); console.log(clearDisplay.val()); $("#gifDiplayHeader").text("GIFs IN ACTION!!"); $("#gifArea").text("Click on the GIF button(s) above to reveal the power of your GIF!"); }); });//submit event listener & api $(document).on("click",".finalGifImage", function() { //IF THE BUTTON IS STILLL --> ANIMIATE IT. (THIS MUST BE OUTSIDE THE ORINIGAL Submit Event Handler, as it could be accessed outside just clicking sumbit, what if click another opeed search Gif tab.. then no submit button accesed.) event.preventDefault(); var state = $(this).attr("data-state"); if(state == "still"){ $(this).attr("src", $(this).data("animated")); $(this).attr("data-state", "animated"); } else { $(this).attr("src", $(this).data("still")); $(this).attr("data-state", "still"); } }); }); //end of js file. // ------------- Personal Qs&Memo Section-------------------- // $("#gifArea").text(JSON.stringify(result)); //Clarify when use this terminology... //difference between "$(document).ready(function() { ....});" AND "$(fucntion({ ..... });" ???!!! --> these both wait to trigger the JS file until the page is loaded, correct?
import React, { Component } from 'react'; import {Upload,Button,Icon, Divider} from 'antd'; class Statistics extends Component { constructor(props){ super(props); } onclick = () => { var path = { pathname:'/index/edit/111', state:{name:1,id:2}, } this.props.history.push(path); } upAction = (file)=> { return new Promise(function(resolve,reject){ console.log(file); resolve(222); // reject(false); }) } fileUp = ()=>{ console.log(111) } onFileChange = (info)=>{ console.log(info) } beforeUp = (file,flist) => { console.log('before',file,flist); return false; } render () { var data = this.props.location.state; var test = ( <Upload onChange={this.onFileChange} beforeUpload={this.beforeUp}> <Button> <Icon type="upload" /> Click to Upload </Button> </Upload> ); return ( /* <div>statistics{this.props.match.params.taskId} <button onClick={this.onclick}>btn</button> {data?(data.id+data.name):''} {test} </div> */ <div>敬请期待</div> ) } } export default Statistics;
import React from "react" import { View, Image, ImageBackground, TouchableOpacity, Text, Button, Switch, TextInput, StyleSheet, ScrollView } from "react-native" import Icon from "react-native-vector-icons/FontAwesome" import { CheckBox } from "react-native-elements" import { connect } from "react-redux" import { widthPercentageToDP as wp, heightPercentageToDP as hp } from "react-native-responsive-screen" import { getNavigationScreen } from "@screens" export class Blank extends React.Component { constructor(props) { super(props) this.state = {} } render = () => ( <ScrollView contentContainerStyle={{ flexGrow: 1 }} style={styles.ScrollView_1} > <View style={styles.View_2} /> <View style={styles.View_1225_6223}> <View style={styles.View_I1225_6223_568_4142} /> <View style={styles.View_I1225_6223_568_4143}> <View style={styles.View_I1225_6223_568_4144}> <View style={styles.View_I1225_6223_1223_6279}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/a636/473e/3a5f8dc8f3daeb624edca11722474ecd" }} style={styles.ImageBackground_I1225_6223_1223_6279_280_5910} /> </View> </View> <View style={styles.View_I1225_6223_568_4149}> <View style={styles.View_I1225_6223_568_4150}> <View style={styles.View_I1225_6223_568_4151}> <Text style={styles.Text_I1225_6223_568_4151}>Shopping</Text> </View> <View style={styles.View_I1225_6223_568_4152}> <Text style={styles.Text_I1225_6223_568_4152}> Buy some grocery </Text> </View> </View> <View style={styles.View_I1225_6223_568_4153}> <View style={styles.View_I1225_6223_568_4154}> <Text style={styles.Text_I1225_6223_568_4154}>- $120</Text> </View> <View style={styles.View_I1225_6223_568_4155}> <Text style={styles.Text_I1225_6223_568_4155}>10:00 AM</Text> </View> </View> </View> </View> </View> <View style={styles.View_1225_6224}> <View style={styles.View_I1225_6224_568_4142} /> <View style={styles.View_I1225_6224_568_4143}> <View style={styles.View_I1225_6224_568_4144}> <View style={styles.View_I1225_6224_1223_6279}> <View style={styles.View_I1225_6224_1223_6279_280_6314}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/8c38/1624/bb2f26ed49ab625512dc7f1393145eb0" }} style={styles.ImageBackground_I1225_6224_1223_6279_280_6315} /> </View> </View> </View> <View style={styles.View_I1225_6224_568_4149}> <View style={styles.View_I1225_6224_568_4150}> <View style={styles.View_I1225_6224_568_4151}> <Text style={styles.Text_I1225_6224_568_4151}> Subscription </Text> </View> <View style={styles.View_I1225_6224_568_4152}> <Text style={styles.Text_I1225_6224_568_4152}> Disney+ Annual.. </Text> </View> </View> <View style={styles.View_I1225_6224_568_4153}> <View style={styles.View_I1225_6224_568_4154}> <Text style={styles.Text_I1225_6224_568_4154}>- $80</Text> </View> <View style={styles.View_I1225_6224_568_4155}> <Text style={styles.Text_I1225_6224_568_4155}>03:30 PM</Text> </View> </View> </View> </View> </View> <View style={styles.View_1225_6225}> <View style={styles.View_I1225_6225_568_4142} /> <View style={styles.View_I1225_6225_568_4143}> <View style={styles.View_I1225_6225_568_4144}> <View style={styles.View_I1225_6225_1223_6279}> <View style={styles.View_I1225_6225_1223_6279_280_7557}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/963f/c856/3ff87e89e5a2fa3327b6bc92fac54f84" }} style={styles.ImageBackground_I1225_6225_1223_6279_280_7558} /> </View> </View> </View> <View style={styles.View_I1225_6225_568_4149}> <View style={styles.View_I1225_6225_568_4150}> <View style={styles.View_I1225_6225_568_4151}> <Text style={styles.Text_I1225_6225_568_4151}>Food</Text> </View> <View style={styles.View_I1225_6225_568_4152}> <Text style={styles.Text_I1225_6225_568_4152}>Buy a ramen</Text> </View> </View> <View style={styles.View_I1225_6225_568_4153}> <View style={styles.View_I1225_6225_568_4154}> <Text style={styles.Text_I1225_6225_568_4154}>- $32</Text> </View> <View style={styles.View_I1225_6225_568_4155}> <Text style={styles.Text_I1225_6225_568_4155}>07:30 PM</Text> </View> </View> </View> </View> </View> <View style={styles.View_827_4246} /> <View style={styles.View_827_4249}> <Text style={styles.Text_827_4249}>Account Balance</Text> </View> <View style={styles.View_827_4250}> <Text style={styles.Text_827_4250}>$9400</Text> </View> <View style={styles.View_827_4251}> <View style={styles.View_827_4252}> <View style={styles.View_827_4253} /> </View> <View style={styles.View_827_4254}> <Text style={styles.Text_827_4254}>Expenses</Text> </View> <View style={styles.View_827_4255}> <Text style={styles.Text_827_4255}>$1200</Text> </View> <View style={styles.View_827_4256}> <View style={styles.View_827_4257} /> <View style={styles.View_827_4258}> <View style={styles.View_1271_5524}> <View style={styles.View_I1271_5524_280_6224}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/ede8/4dd2/cd045dae44e5a5f94e11f37934ae6211" }} style={styles.ImageBackground_I1271_5524_280_6225} /> </View> </View> </View> </View> </View> <View style={styles.View_827_4264}> <View style={styles.View_827_4265}> <View style={styles.View_827_4266} /> </View> <View style={styles.View_827_4267}> <Text style={styles.Text_827_4267}>Income</Text> </View> <View style={styles.View_827_4268}> <Text style={styles.Text_827_4268}>$5000</Text> </View> <View style={styles.View_827_4269}> <View style={styles.View_827_4270} /> <View style={styles.View_827_4271}> <View style={styles.View_1271_5530}> <View style={styles.View_I1271_5530_280_6230}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/1830/9497/fd2bb85d69a0ec9f30f207ce5df99295" }} style={styles.ImageBackground_I1271_5530_280_6231} /> </View> </View> </View> </View> </View> <View style={styles.View_827_4291}> <View style={styles.View_I827_4291_654_82}> <View style={styles.View_I827_4291_654_628}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/1365/287a/4cfba30473faff8301d8eafdb2a5279e" }} style={styles.ImageBackground_I827_4291_654_628_654_592} /> </View> <View style={styles.View_I827_4291_804_5593}> <View style={styles.View_I827_4291_804_5593_804_5087}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/346a/8895/7026d6b2bfef0f7e490b61956f506ffb" }} style={ styles.ImageBackground_I827_4291_804_5593_804_5087_280_5102 } /> </View> <View style={styles.View_I827_4291_804_5593_804_5088}> <Text style={styles.Text_I827_4291_804_5593_804_5088}> October </Text> </View> </View> <View style={styles.View_I827_4291_654_78}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/51e9/afcf/afcab324fd3830db459aec504233a1e2" }} style={styles.ImageBackground_I827_4291_654_78_280_5844} /> </View> </View> </View> <View style={styles.View_827_4292}> <View style={styles.View_I827_4292_660_53}> <View style={styles.View_I827_4292_660_54}> <Text style={styles.Text_I827_4292_660_54}>Recent Transaction</Text> </View> <View style={styles.View_I827_4292_804_5549}> <View style={styles.View_I827_4292_804_5549_802_4396}> <Text style={styles.Text_I827_4292_804_5549_802_4396}> See All </Text> </View> </View> </View> </View> <View style={styles.View_827_4293}> <View style={styles.View_I827_4293_654_687}> <View style={styles.View_I827_4293_654_686}> <Text style={styles.Text_I827_4293_654_686}>Spend Frequency</Text> </View> </View> </View> <View style={styles.View_827_4294}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/38f6/3187/f9ff402c75c848df6a0daee73ba38e45" }} style={styles.ImageBackground_I827_4294_670_24} /> </View> <View style={styles.View_827_4295}> <View style={styles.View_I827_4295_655_3042}> <View style={styles.View_I827_4295_655_3043}> <Text style={styles.Text_I827_4295_655_3043}>Today</Text> </View> </View> <View style={styles.View_I827_4295_655_3044}> <View style={styles.View_I827_4295_655_3045}> <Text style={styles.Text_I827_4295_655_3045}>Week</Text> </View> </View> <View style={styles.View_I827_4295_655_3046}> <View style={styles.View_I827_4295_655_3047}> <Text style={styles.Text_I827_4295_655_3047}>Month</Text> </View> </View> <View style={styles.View_I827_4295_655_3048}> <View style={styles.View_I827_4295_655_3049}> <Text style={styles.Text_I827_4295_655_3049}>Year</Text> </View> </View> </View> <View style={styles.View_1297_4511} /> <View style={styles.View_827_4298}> <View style={styles.View_I827_4298_816_137}> <View style={styles.View_I827_4298_816_138}> <Text style={styles.Text_I827_4298_816_138}>9:41</Text> </View> </View> <View style={styles.View_I827_4298_816_139}> <View style={styles.View_I827_4298_816_140}> <View style={styles.View_I827_4298_816_141}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/42fe/75df/eee86effef9007e53d20453d65f0d730" }} style={styles.ImageBackground_I827_4298_816_142} /> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/323b/7a56/3bd8d761d4d553ed17394f5c34643bfe" }} style={styles.ImageBackground_I827_4298_816_145} /> </View> <View style={styles.View_I827_4298_816_146} /> </View> <View style={styles.View_I827_4298_816_147}> <View style={styles.View_I827_4298_816_148} /> <View style={styles.View_I827_4298_816_149} /> <View style={styles.View_I827_4298_816_150} /> <View style={styles.View_I827_4298_816_151} /> </View> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/6a2b/c9ca/21b52f3f9fca9a68ca91e9ed4afad110" }} style={styles.ImageBackground_I827_4298_816_152} /> </View> </View> <View style={styles.View_827_4300}> <View style={styles.View_I827_4300_217_6977} /> </View> <View style={styles.View_827_4443}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/a913/04d9/36c18cdd9010d2bedcc05f0674813e0f" }} style={styles.ImageBackground_827_4444} /> <View style={styles.View_827_4445}> <View style={styles.View_I827_4445_280_6203}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/efe1/a3db/c162068159659e5d3bea2877946e4cc6" }} style={styles.ImageBackground_I827_4445_280_6204} /> </View> </View> </View> <View style={styles.View_827_4446}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/dc15/3118/6a4d150959cc71576eb78f06c0377257" }} style={styles.ImageBackground_827_4447} /> <View style={styles.View_827_4448}> <View style={styles.View_I827_4448_280_6224}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/aa48/1aad/c814ce02a4bb5520b7a93beeb54199b8" }} style={styles.ImageBackground_I827_4448_280_6225} /> </View> </View> </View> <View style={styles.View_827_4449}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/255a/46d1/8725011ad6d9c5c55a4f494d777ec6c7" }} style={styles.ImageBackground_827_4450} /> <View style={styles.View_827_4451}> <View style={styles.View_I827_4451_280_6230}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/993d/c984/487d7c3ba367eea7d84e8671f88de122" }} style={styles.ImageBackground_I827_4451_280_6231} /> </View> </View> </View> <View style={styles.View_1297_4478}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/cadd/9346/032c6ba778522c15cdc2c9ea9b70f742" }} style={styles.ImageBackground_1297_4479} /> <View style={styles.View_1297_4481}> <View style={styles.View_1297_4482}> <Text style={styles.Text_1297_4482}>Home</Text> </View> <View style={styles.View_1297_4483}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/2458/2f15/582052e5a95287f2495f4e2cf1e2f814" }} style={styles.ImageBackground_I1297_4483_280_7756} /> </View> </View> <View style={styles.View_1297_4484}> <View style={styles.View_1297_4485}> <Text style={styles.Text_1297_4485}>Transaction</Text> </View> <View style={styles.View_1297_4486}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/03e9/c4b7/2f8eab8111b737e86c022c8fa260e6a0" }} style={styles.ImageBackground_I1297_4486_280_6351} /> </View> </View> <View style={styles.View_1297_4487}> <View style={styles.View_1297_4488}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/1cf0/1789/f1518d7b557d985cb58bc81e2d7f1810" }} style={styles.ImageBackground_I1297_4488_280_5924} /> </View> <View style={styles.View_1297_4489}> <Text style={styles.Text_1297_4489}>Profile</Text> </View> </View> <View style={styles.View_1297_4490}> <View style={styles.View_1297_4491}> <View style={styles.View_I1297_4491_280_6276}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/694b/75aa/412ab94c8bc610721ef176f4d2e63e31" }} style={styles.ImageBackground_I1297_4491_280_6277} /> </View> </View> <View style={styles.View_1297_4492}> <Text style={styles.Text_1297_4492}>Budget</Text> </View> </View> <View style={styles.View_1297_4493}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/c170/2c1c/853410c7f49fe2ad0f15c8bea3adb5fd" }} style={styles.ImageBackground_1297_4494} /> <View style={styles.View_1297_4495}> <ImageBackground source={{ uri: "https://s3-us-west-2.amazonaws.com/figma-alpha-api/img/a743/c156/50c02dc23baeb7ea8aa9eb3f0cb62884" }} style={styles.ImageBackground_I1297_4495_280_7677} /> </View> </View> </View> </ScrollView> ) } const styles = StyleSheet.create({ ScrollView_1: { backgroundColor: "rgba(255, 255, 255, 1)" }, View_2: { height: hp("144%") }, View_1225_6223: { width: wp("90%"), minWidth: wp("90%"), height: hp("12%"), minHeight: hp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("89%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6223_568_4142: { flexGrow: 1, width: wp("90%"), height: hp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 252, 252, 1)" }, View_I1225_6223_568_4143: { flexGrow: 1, width: wp("81%"), height: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6223_568_4144: { width: wp("16%"), minWidth: wp("16%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 238, 212, 1)" }, View_I1225_6223_1223_6279: { width: wp("11%"), minWidth: wp("11%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I1225_6223_1223_6279_280_5910: { flexGrow: 1, width: wp("8%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, View_I1225_6223_568_4149: { width: wp("62%"), minWidth: wp("62%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("18%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6223_568_4150: { width: wp("30%"), minWidth: wp("30%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6223_568_4151: { width: wp("19%"), minWidth: wp("19%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I1225_6223_568_4151: { color: "rgba(41, 43, 45, 1)", fontSize: 13, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6223_568_4152: { width: wp("30%"), minWidth: wp("30%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("5%"), justifyContent: "flex-start" }, Text_I1225_6223_568_4152: { color: "rgba(145, 145, 159, 1)", fontSize: 10, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6223_568_4153: { width: wp("16%"), minWidth: wp("16%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("46%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6223_568_4154: { width: wp("14%"), minWidth: wp("14%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I1225_6223_568_4154: { color: "rgba(253, 60, 74, 1)", fontSize: 13, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6223_568_4155: { width: wp("16%"), minWidth: wp("16%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("5%"), justifyContent: "flex-start" }, Text_I1225_6223_568_4155: { color: "rgba(145, 145, 159, 1)", fontSize: 10, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1225_6224: { width: wp("90%"), minWidth: wp("90%"), height: hp("12%"), minHeight: hp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("102%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6224_568_4142: { flexGrow: 1, width: wp("90%"), height: hp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 252, 252, 1)" }, View_I1225_6224_568_4143: { flexGrow: 1, width: wp("81%"), height: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6224_568_4144: { width: wp("16%"), minWidth: wp("16%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(238, 229, 255, 1)" }, View_I1225_6224_1223_6279: { width: wp("11%"), minWidth: wp("11%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I1225_6224_1223_6279_280_6314: { flexGrow: 1, width: wp("8%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%") }, ImageBackground_I1225_6224_1223_6279_280_6315: { width: wp("8%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_I1225_6224_568_4149: { width: wp("62%"), minWidth: wp("62%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("18%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6224_568_4150: { width: wp("28%"), minWidth: wp("28%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6224_568_4151: { width: wp("26%"), minWidth: wp("26%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I1225_6224_568_4151: { color: "rgba(41, 43, 45, 1)", fontSize: 13, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6224_568_4152: { width: wp("28%"), minWidth: wp("28%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("5%"), justifyContent: "flex-start" }, Text_I1225_6224_568_4152: { color: "rgba(145, 145, 159, 1)", fontSize: 10, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6224_568_4153: { width: wp("16%"), minWidth: wp("16%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("46%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6224_568_4154: { width: wp("11%"), minWidth: wp("11%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I1225_6224_568_4154: { color: "rgba(253, 60, 74, 1)", fontSize: 13, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6224_568_4155: { width: wp("16%"), minWidth: wp("16%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("5%"), justifyContent: "flex-start" }, Text_I1225_6224_568_4155: { color: "rgba(145, 145, 159, 1)", fontSize: 10, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1225_6225: { width: wp("90%"), minWidth: wp("90%"), height: hp("12%"), minHeight: hp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("116%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6225_568_4142: { flexGrow: 1, width: wp("90%"), height: hp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 252, 252, 1)" }, View_I1225_6225_568_4143: { flexGrow: 1, width: wp("81%"), height: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6225_568_4144: { width: wp("16%"), minWidth: wp("16%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(253, 213, 215, 1)" }, View_I1225_6225_1223_6279: { width: wp("11%"), minWidth: wp("11%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I1225_6225_1223_6279_280_7557: { flexGrow: 1, width: wp("7%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%") }, ImageBackground_I1225_6225_1223_6279_280_7558: { width: wp("7%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_I1225_6225_568_4149: { width: wp("62%"), minWidth: wp("62%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("18%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6225_568_4150: { width: wp("21%"), minWidth: wp("21%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6225_568_4151: { width: wp("10%"), minWidth: wp("10%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I1225_6225_568_4151: { color: "rgba(41, 43, 45, 1)", fontSize: 13, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6225_568_4152: { width: wp("21%"), minWidth: wp("21%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("5%"), justifyContent: "flex-start" }, Text_I1225_6225_568_4152: { color: "rgba(145, 145, 159, 1)", fontSize: 10, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6225_568_4153: { width: wp("16%"), minWidth: wp("16%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("46%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I1225_6225_568_4154: { width: wp("11%"), minWidth: wp("11%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I1225_6225_568_4154: { color: "rgba(253, 60, 74, 1)", fontSize: 13, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I1225_6225_568_4155: { width: wp("16%"), minWidth: wp("16%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("5%"), justifyContent: "flex-start" }, Text_I1225_6225_568_4155: { color: "rgba(145, 145, 159, 1)", fontSize: 10, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4246: { width: wp("100%"), minWidth: wp("100%"), height: hp("43%"), minHeight: hp("43%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), borderTopLeftRadius: 0, borderTopRightRadius: 0, borderBottomLeftRadius: 32, borderBottomRightRadius: 32 }, View_827_4249: { width: wp("30%"), minWidth: wp("30%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("35%"), top: hp("15%"), justifyContent: "flex-start" }, Text_827_4249: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4250: { width: wp("87%"), minWidth: wp("87%"), minHeight: hp("7%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("18%"), justifyContent: "flex-start" }, Text_827_4250: { color: "rgba(22, 23, 25, 1)", fontSize: 32, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4251: { width: wp("44%"), minWidth: wp("44%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("52%"), top: hp("29%") }, View_827_4252: { width: wp("44%"), minWidth: wp("44%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_827_4253: { width: wp("44%"), minWidth: wp("44%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(253, 60, 74, 1)" }, View_827_4254: { width: wp("17%"), minWidth: wp("17%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("19%"), top: hp("2%"), justifyContent: "flex-start" }, Text_827_4254: { color: "rgba(252, 252, 252, 1)", fontSize: 11, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4255: { width: wp("18%"), minWidth: wp("18%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("19%"), top: hp("5%"), justifyContent: "flex-start" }, Text_827_4255: { color: "rgba(252, 252, 252, 1)", fontSize: 18, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4256: { width: wp("13%"), minWidth: wp("13%"), height: hp("7%"), minHeight: hp("7%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("2%") }, View_827_4257: { width: wp("13%"), minWidth: wp("13%"), height: hp("7%"), minHeight: hp("7%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 252, 252, 1)" }, View_827_4258: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_1271_5524: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I1271_5524_280_6224: { flexGrow: 1, width: wp("6%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%") }, ImageBackground_I1271_5524_280_6225: { width: wp("6%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_827_4264: { width: wp("44%"), minWidth: wp("44%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("29%") }, View_827_4265: { width: wp("44%"), minWidth: wp("44%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_827_4266: { width: wp("44%"), minWidth: wp("44%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 168, 107, 1)" }, View_827_4267: { width: wp("13%"), minWidth: wp("13%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("20%"), top: hp("2%"), justifyContent: "flex-start" }, Text_827_4267: { color: "rgba(252, 252, 252, 1)", fontSize: 11, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4268: { width: wp("19%"), minWidth: wp("19%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("20%"), top: hp("5%"), justifyContent: "flex-start" }, Text_827_4268: { color: "rgba(252, 252, 252, 1)", fontSize: 18, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4269: { width: wp("13%"), minWidth: wp("13%"), height: hp("7%"), minHeight: hp("7%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("2%") }, View_827_4270: { width: wp("13%"), minWidth: wp("13%"), height: hp("7%"), minHeight: hp("7%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 252, 252, 1)" }, View_827_4271: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_1271_5530: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I1271_5530_280_6230: { flexGrow: 1, width: wp("6%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%") }, ImageBackground_I1271_5530_280_6231: { width: wp("6%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_827_4291: { width: wp("100%"), minWidth: wp("100%"), height: hp("9%"), minHeight: hp("9%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("6%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4291_654_82: { flexGrow: 1, width: wp("91%"), height: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4291_654_628: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)" }, ImageBackground_I827_4291_654_628_654_592: { flexGrow: 1, width: wp("9%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_I827_4291_804_5593: { width: wp("29%"), minWidth: wp("29%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("31%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4291_804_5593_804_5087: { flexGrow: 1, width: wp("6%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I827_4291_804_5593_804_5087_280_5102: { flexGrow: 1, width: wp("4%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, View_I827_4291_804_5593_804_5088: { flexGrow: 1, width: wp("15%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("10%"), top: hp("2%"), justifyContent: "center" }, Text_I827_4291_804_5593_804_5088: { color: "rgba(33, 35, 37, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I827_4291_654_78: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("83%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I827_4291_654_78_280_5844: { flexGrow: 1, width: wp("5%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("0%") }, View_827_4292: { width: wp("100%"), minWidth: wp("100%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("81%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I827_4292_660_53: { flexGrow: 1, width: wp("96%"), height: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4292_660_54: { width: wp("68%"), minWidth: wp("68%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), justifyContent: "center" }, Text_I827_4292_660_54: { color: "rgba(41, 43, 45, 1)", fontSize: 14, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I827_4292_804_5549: { width: wp("21%"), minWidth: wp("21%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("73%"), top: hp("1%"), backgroundColor: "rgba(238, 229, 255, 1)" }, View_I827_4292_804_5549_802_4396: { flexGrow: 1, width: wp("12%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("1%"), justifyContent: "center" }, Text_I827_4292_804_5549_802_4396: { color: "rgba(127, 61, 255, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4293: { width: wp("100%"), minWidth: wp("100%"), height: hp("7%"), minHeight: hp("7%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("43%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I827_4293_654_687: { flexGrow: 1, width: wp("96%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4293_654_686: { width: wp("41%"), minWidth: wp("41%"), minHeight: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I827_4293_654_686: { color: "rgba(13, 14, 15, 1)", fontSize: 14, fontWeight: "400", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_827_4294: { width: wp("100%"), minWidth: wp("100%"), height: hp("25%"), minHeight: hp("25%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("49%"), backgroundColor: "rgba(0, 0, 0, 0)" }, ImageBackground_I827_4294_670_24: { flexGrow: 1, width: wp("100%"), height: hp("23%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("2%") }, View_827_4295: { width: wp("92%"), minWidth: wp("92%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("76%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4295_655_3042: { flexGrow: 1, width: wp("24%"), height: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(252, 238, 212, 1)" }, View_I827_4295_655_3043: { width: wp("11%"), minWidth: wp("11%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%"), justifyContent: "center" }, Text_I827_4295_655_3043: { color: "rgba(252, 172, 18, 1)", fontSize: 11, fontWeight: "700", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I827_4295_655_3044: { flexGrow: 1, width: wp("23%"), height: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("24%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4295_655_3045: { width: wp("10%"), minWidth: wp("10%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%"), justifyContent: "center" }, Text_I827_4295_655_3045: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I827_4295_655_3046: { flexGrow: 1, width: wp("25%"), height: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("47%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4295_655_3047: { width: wp("12%"), minWidth: wp("12%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%"), justifyContent: "center" }, Text_I827_4295_655_3047: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "center", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_I827_4295_655_3048: { flexGrow: 1, width: wp("21%"), height: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("71%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4295_655_3049: { width: wp("8%"), minWidth: wp("8%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%"), justifyContent: "flex-start" }, Text_I827_4295_655_3049: { color: "rgba(145, 145, 159, 1)", fontSize: 11, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1297_4511: { width: wp("100%"), minWidth: wp("100%"), height: hp("144%"), minHeight: hp("144%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_827_4298: { width: wp("100%"), minWidth: wp("100%"), height: hp("6%"), minHeight: hp("6%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), backgroundColor: "rgba(0, 0, 0, 0)" }, View_I827_4298_816_137: { flexGrow: 1, width: wp("14%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), top: hp("2%") }, View_I827_4298_816_138: { width: wp("14%"), minWidth: wp("14%"), minHeight: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%"), justifyContent: "flex-start" }, Text_I827_4298_816_138: { color: "rgba(22, 23, 25, 1)", fontSize: 12, fontWeight: "400", textAlign: "center", fontStyle: "normal", letterSpacing: -0.16500000655651093, textTransform: "none" }, View_I827_4298_816_139: { flexGrow: 1, width: wp("18%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("78%"), top: hp("2%") }, View_I827_4298_816_140: { width: wp("7%"), minWidth: wp("7%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("11%"), top: hp("0%") }, View_I827_4298_816_141: { width: wp("7%"), height: hp("2%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, ImageBackground_I827_4298_816_142: { width: wp("6%"), minWidth: wp("6%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, ImageBackground_I827_4298_816_145: { width: wp("0%"), minWidth: wp("0%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("1%") }, View_I827_4298_816_146: { width: wp("5%"), minWidth: wp("5%"), height: hp("1%"), minHeight: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%"), backgroundColor: "rgba(22, 23, 25, 1)", borderColor: "rgba(76, 217, 100, 1)", borderWidth: 1 }, View_I827_4298_816_147: { width: wp("5%"), height: hp("1%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_I827_4298_816_148: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("1%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I827_4298_816_149: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I827_4298_816_150: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("0%"), backgroundColor: "rgba(255, 255, 255, 1)" }, View_I827_4298_816_151: { width: wp("1%"), minWidth: wp("1%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("4%"), top: hp("0%"), backgroundColor: "rgba(255, 255, 255, 1)" }, ImageBackground_I827_4298_816_152: { width: wp("4%"), minWidth: wp("4%"), height: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("6%"), top: hp("0%") }, View_827_4300: { width: wp("100%"), minWidth: wp("100%"), height: hp("5%"), minHeight: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("139%"), backgroundColor: "rgba(252, 252, 252, 1)" }, View_I827_4300_217_6977: { flexGrow: 1, width: wp("36%"), height: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("32%"), top: hp("3%"), backgroundColor: "rgba(0, 0, 0, 1)" }, View_827_4443: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("42%"), top: hp("110%") }, ImageBackground_827_4444: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_827_4445: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I827_4445_280_6203: { flexGrow: 1, width: wp("6%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, ImageBackground_I827_4445_280_6204: { width: wp("6%"), height: hp("3%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_827_4446: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("60%"), top: hp("119%") }, ImageBackground_827_4447: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_827_4448: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I827_4448_280_6224: { flexGrow: 1, width: wp("6%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%") }, ImageBackground_I827_4448_280_6225: { width: wp("6%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_827_4449: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("23%"), top: hp("119%") }, ImageBackground_827_4450: { width: wp("15%"), minWidth: wp("15%"), height: hp("8%"), minHeight: hp("8%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("0%") }, View_827_4451: { width: wp("9%"), minWidth: wp("9%"), height: hp("4%"), minHeight: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("2%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I827_4451_280_6230: { flexGrow: 1, width: wp("6%"), height: hp("4%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("0%") }, ImageBackground_I827_4451_280_6231: { width: wp("6%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_1297_4478: { width: wp("100%"), minWidth: wp("100%"), height: hp("11%"), minHeight: hp("11%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), top: hp("129%"), backgroundColor: "rgba(0, 0, 0, 0)" }, ImageBackground_1297_4479: { width: wp("100%"), height: hp("10%"), top: hp("1%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_1297_4481: { width: wp("9%"), height: hp("7%"), top: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("7%") }, View_1297_4482: { width: wp("8%"), top: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), justifyContent: "flex-start" }, Text_1297_4482: { color: "rgba(127, 61, 255, 1)", fontSize: 8, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1297_4483: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I1297_4483_280_7756: { flexGrow: 1, width: wp("6%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, View_1297_4484: { width: wp("15%"), height: hp("7%"), top: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("22%") }, View_1297_4485: { width: wp("15%"), top: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), justifyContent: "flex-start" }, Text_1297_4485: { color: "rgba(198, 198, 198, 1)", fontSize: 8, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1297_4486: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I1297_4486_280_6351: { flexGrow: 1, width: wp("7%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, View_1297_4487: { width: wp("9%"), height: hp("7%"), top: hp("2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("84%") }, View_1297_4488: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I1297_4488_280_5924: { flexGrow: 1, width: wp("5%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("2%"), top: hp("1%") }, View_1297_4489: { width: wp("8%"), top: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), justifyContent: "flex-start" }, Text_1297_4489: { color: "rgba(198, 198, 198, 1)", fontSize: 8, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1297_4490: { width: wp("9%"), height: hp("7%"), top: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("65%") }, View_1297_4491: { width: wp("9%"), height: hp("4%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, View_I1297_4491_280_6276: { flexGrow: 1, width: wp("6%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("1%"), top: hp("1%") }, ImageBackground_I1297_4491_280_6277: { width: wp("6%"), height: hp("3%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_1297_4492: { width: wp("9%"), top: hp("5%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%"), justifyContent: "flex-start" }, Text_1297_4492: { color: "rgba(198, 198, 198, 1)", fontSize: 8, fontWeight: "500", textAlign: "left", fontStyle: "normal", letterSpacing: 0, textTransform: "none" }, View_1297_4493: { width: wp("21%"), height: hp("11%"), top: hp("-2%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("39%") }, ImageBackground_1297_4494: { width: wp("21%"), height: hp("11%"), top: hp("0%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("0%") }, View_1297_4495: { width: wp("11%"), height: hp("5%"), top: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("5%"), backgroundColor: "rgba(0, 0, 0, 0)", overflow: "hidden" }, ImageBackground_I1297_4495_280_7677: { flexGrow: 1, width: wp("5%"), height: hp("3%"), marginLeft: 0, marginTop: 0, position: "absolute", left: wp("3%"), top: hp("1%") } }) const mapStateToProps = state => { return {} } const mapDispatchToProps = () => { return {} } export default connect(mapStateToProps, mapDispatchToProps)(Blank)
function username() { let name = document.getElementById('usrnme').value; let regEx = /[A-Z]\w{5,7}\d/g; let result = regEx.test(name); var matched; if (result) { matched = 'Matched'; } else { matched = 'Username must start with a capital letter, must be 5-8 letters long and must end with a number'; } // return matched; // console.log(matched); var shw = document.getElementById('show'); shw.innerText = matched; } function password() { let pswd = document.getElementById('pswd').value; let cpswd = document.getElementById('cpswd').value; var confirm; if (cpswd === pswd) { confirm = 'Password Confirmed'; } else { confirm = 'Wrong Password'; } // console.log(confirm); var mcpswd = document.getElementById('mcpswd'); mcpswd.innerText = confirm; }
const MongoClient = require('mongodb').MongoClient; const performance = require('performance'); const results = performance.runBenchmarks(); let collection; MongoClient.connect('mongodb://localhost/').then((client) => { const db = client.db('ivydatabase'); collection = db.collection('attractions'); }) const getById = async function getById(id, callback) { // collection.find().hint({ id }).limit(1).toArray() await collection.find({ id:id }).toArray() .then((data) => { callback(null, data) }) .catch((err) => { callback(err, null) }) } function getRandomNumBetween(min, max) { return Math.floor(Math.random() * ((max - min) + min)); } async function testingMongo() { let totalTime = 0; for (let i = 0; i < 10; i += 1) { const num = getRandomNumBetween(1, 10000000) const t0 = performance.now(); await getById(num) const t1 = performance.now(); const time = t1 - t0 totalTime += time } console.log(totalTime/10) } testingMongo()
/* WHAT IS THIS? This module demonstrates simple uses of Botkit's `hears` handler functions. In these examples, Botkit is configured to listen for certain phrases, and then respond immediately with a single line response. */ module.exports = function(controller) { controller.hears(['cheese'], 'direct_message,direct_mention', function(bot, message) { bot.createConversation(message, function(err, convo) { // create a path for when a user says YES convo.addMessage({ text: 'You said yes! How wonderful.', },'yes_thread'); // create a path for when a user says NO convo.addMessage({ text: 'You said no, that is too bad.', },'no_thread'); // create a path where neither option was matched // this message has an action field, which directs botkit to go back to the `default` thread after sending this message. convo.addMessage({ text: 'Sorry I did not understand.', action: 'default', },'bad_response'); // Create a yes/no question in the default thread... convo.ask('Do you like cheese?', [ { pattern: 'yes', callback: function(response, convo) { convo.changeTopic('yes_thread'); }, }, { pattern: 'no', callback: function(response, convo) { convo.changeTopic('no_thread'); }, }, { default: true, callback: function(response, convo) { convo.changeTopic('bad_response'); }, } ]); convo.activate(); }); }); };
var should = require( 'should' ); var argp = require( '../' ); describe( 'parse all test', function () { it( 'parse to true in -', function () { var result = argp( [ '-a','ab', '-b','', '-c','d', '--e','fg', '-hij','kf','k3f', ] ); result.a.should.equal( 'ab' ); result.b.should.equal( 'true' ); result.c.should.equal( 'd' ); result.e.should.equal( 'fg' ); result.h.should.equal( 'ij' ); } ); } );
import React from 'react' import { render } from '@testing-library/react' import user from '@testing-library/user-event' import Todo from './Todo' import RenderTodos from './RenderTodos' describe('<Todo />', () => { const mockTodo = { id: 1, todo: 'test todo' } it('should render a todo object', () => { const { getByTestId } = render(<Todo todo={mockTodo} />) const ItemName = getByTestId('itemName') expect(ItemName).toHaveTextContent(mockTodo.todo) }) it('should display the previous state in the edit input ', () => { const { getByText, getByPlaceholderText } = render(<Todo todo={mockTodo} />) const EditBtn = getByText(/edit/i) user.click(EditBtn) const UpdateInput = getByPlaceholderText(mockTodo.todo) expect(UpdateInput).toBeInTheDocument() }) it('should update the todo via the edit input', () => { const { getByText, getByPlaceholderText } = render(<Todo todo={mockTodo} />) const EditBtn = getByText(/edit/i) user.click(EditBtn) const UpdateInput = getByPlaceholderText(mockTodo.todo) user.type(UpdateInput, 'updated todo') expect(UpdateInput).toHaveValue('updated todo') }) describe('Edit/Delete todos', () => { const mockUpdateTodo = jest.fn() const mockDeleteTodo = jest.fn() const mockTodo = [{ id: 1, todo: 'wash up' }] it('should save an updated todo ', () => { const { getByText, getByTestId } = render( <RenderTodos updateTodo={mockUpdateTodo} deleteTodo={mockDeleteTodo} todos={mockTodo} /> ) const EditBtn = getByText(/edit/i) user.click(EditBtn) const UpdateInput = getByTestId('updateInput') user.click(UpdateInput) user.type(UpdateInput, 'updated todo') const saveEdit = getByTestId('saveEdits') user.click(saveEdit) expect(mockUpdateTodo).toHaveBeenCalled() expect(mockUpdateTodo).toHaveBeenCalledTimes(1) }) it('should delete a todo ', () => { const { getByTestId } = render( <RenderTodos updateTodo={mockUpdateTodo} deleteTodo={mockDeleteTodo} todos={mockTodo} /> ) const DeleteBtn = getByTestId('itemRemove') user.click(DeleteBtn) expect(mockDeleteTodo).toHaveBeenCalled() expect(mockDeleteTodo).toHaveBeenCalledTimes(1) }) }) })
$(function() { //自定义密码校验规则 $.validator.addMethod("password", function(value, element, params) { //5~10位数字和字母的组合 var pwd = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,10}$/; return this.optional(element) || pwd.test(value); }, $.validator.format("密码必须是5~10位数字和字母的组合")); //自定义不等于校验规则 $.validator.addMethod("notEqualTo", function(value, element, params) { return value!=params; }, $.validator.format("输入必须不为0")); });
import React, { useState } from 'react'; import plus from '../../img/icons/plus.png'; import minus from '../../img/icons/minus.png'; import classes from './ProjectDropdown.module.scss'; const ProjectDropdown = ({ dropdown: { title, text } }) => { const [isDroppedDown, setIsDroppedDown] = useState(false); const [isSelected, setIsSelected] = useState(false); return ( <div className={classes.container}> <div className={classes.dropdownContainer} style={ isSelected ? { border: '1px solid whitesmoke' } : { border: '1px solid transparent' } } onClick={() => setIsDroppedDown(!isDroppedDown)} onTouchStart={() => setIsSelected(true)} onMouseEnter={() => setIsSelected(true)} onMouseLeave={() => setIsSelected(false)} onTouchEnd={() => setIsSelected(false)} > <h2 className={classes.dropdownTitle}>{title}</h2> <img className={classes.dropdownIcon} src={isDroppedDown ? minus : plus} alt={isDroppedDown ? 'Minus' : 'Plis'} /> </div> <p className={classes.dropdownText} style={{ visibility: isDroppedDown ? 'visible' : 'hidden', display: isDroppedDown ? 'block' : 'none', }} > {text} </p> </div> ); }; export default ProjectDropdown;
/* In relational databases such as SQL, the data are stored in many 'tables' in a database, and some fields of each table has a connection to another table. This is called a 'foreign key.' These tables are conncted in such a way to prevent flooding one table with too much data. Also, when using SQL syntax, you must explicitly mention which fields you are inputting, and therefore having too many fields in one table makes it harder to query each time. Unlike SQL, noSQL databases are non relational, and take the form of a javascript object. Each 'field' is represented as a key in noSQL and therefore it is easier to query the fields and input data without having to mention which fields will be inputted each time. It is easier to put in data to non-relational databases because of this reason, but it is also easier to lose data because data can be anywhere! There are pros and cons to each type of database and it is important to know what suits my needs :) */
const { BinarySearchTree } = require('../challenges/tree/Tree'); describe('binary search tree recursive implementation', () => { it('should have a constructor function that creates a BST with a null root if no arguments are passed', () => { const testTree = new BinarySearchTree(); expect(testTree.root).toEqual(null); }); it('should have a constructor function that creates a BST with a root node if a value is passed', () => { const testTree = new BinarySearchTree(1); expect(testTree.root.value).toEqual(1); }); it('can add a left and right child to a single root node', () => { const testTree = new BinarySearchTree(); testTree.add(1); testTree.add(2); testTree.add(3); testTree.add(0.5); expect(testTree.root.value).toEqual(1); expect(testTree.root.left.value).toEqual(0.5); expect(testTree.root.right.value).toEqual(2); expect(testTree.root.right.right.value).toEqual(3); }); it('can successfully return a collection from a preorder traversal', () => { const testTree = new BinarySearchTree(); testTree.add(1); testTree.add(2); testTree.add(3); testTree.add(0.5); const testArray = testTree.preOrder(testTree.root); expect(testArray).toEqual([1, 0.5, 2, 3]); }); it('can successfully return a collection from an inorder traversal', () => { const testTree = new BinarySearchTree(); testTree.add(1); testTree.add(2); testTree.add(3); testTree.add(0.5); const testArray = testTree.inOrder(testTree.root); expect(testArray).toEqual([0.5, 1, 2, 3]); }); it('can successfully return a collection from a postorder traversal', () => { const testTree = new BinarySearchTree(); testTree.add(1); testTree.add(2); testTree.add(3); testTree.add(0.5); const testArray = testTree.postOrder(testTree.root); expect(testArray).toEqual([0.5, 2, 3, 1]); }); });
import styled from 'styled-components' import SecondButton from '../SecondButton' import PrimaryButton from '../PrimaryButton' import authFetch from '../../utils/authFetch' import { SERVER_URL } from '../../Constants/api' import { useDispatch } from 'react-redux' import { receiveMessage, showToast } from '../../features/appSlice' import { useSocketContext } from '../../context/socket-context' const SendImgDialog = ({images,setImages,conv_id,token}) => { const dispatch = useDispatch() const socket = useSocketContext() const handleSubmit = async e =>{ e.preventDefault() images.forEach(async image => { const formData = new FormData() formData.set('img',image) const resp = await authFetch(SERVER_URL+'upload/message/'+conv_id,token,'POST',formData,false).catch(err => console.error(err)) if(resp.success){ const msg = { content: resp.data, type: 'image', conv_id } socket.emit('messages:create',msg,res=>{ if(res.success){ dispatch(receiveMessage(res.data)) setImages(null) }else{ dispatch(showToast({message:res.message})) } }) }else{ dispatch(showToast({message:resp.message})) } }); } return ( <StyledOverlay> <StyledDialog onSubmit={handleSubmit}> <ImagesContainer> {images.map(img=> <ImageItem img={img}/>)} </ImagesContainer> <ButtonsWrapper> <SecondButton type="button" onClick={()=>setImages(null)}>Cancel</SecondButton> <PrimaryButton style={{ fontSize: '.95rem' }}>send</PrimaryButton> </ButtonsWrapper> </StyledDialog> </StyledOverlay> ) } const ImageItem = ({img}) =>{ return ( <StyledImage> <img src={URL.createObjectURL(img)} alt="img"/> <p>{img.name}</p> </StyledImage> ) } const StyledOverlay = styled.div` position: absolute; inset:0; background-color: rgba(22,22,22,.5); display:grid; place-items: center; ` const StyledDialog = styled.form` background-color:var(--bg); border-radius: 12px; width: max(50%,350px); padding: 12px ` const ImagesContainer = styled.div` display:flex; flex-direction: column; max-height: 50vh; overflow-y: auto; ` const StyledImage = styled.div` display: flex; margin: .5rem; align-items: center; border-radius: 12px; overflow: hidden; background-color: var(--bg-card); gap: 1rem; flex-shrink: 0; img{ height: 7.5rem; width: 7.5rem; object-fit: cover; } ` const ButtonsWrapper = styled.div` display:flex; justify-content: space-between; margin-top: 12px; ` export default SendImgDialog
import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import ApiMaster from "./api/ApiMaster"; import 'bootstrap/dist/js/bootstrap.min' import 'bootstrap/dist/css/bootstrap.min.css' import 'bootstrap-vue/dist/bootstrap-vue.css' import 'bootstrap-vue/dist/bootstrap-vue' import {BootstrapVue, IconsPlugin} from 'bootstrap-vue' import Vuesax from 'vuesax' import 'vuesax/dist/vuesax.css' //Vuesax styles import 'leaflet/dist/leaflet.css'; import 'leaflet' import 'mapbox-gl/dist/mapbox-gl.css' import 'mapbox-gl' import 'mapbox-gl-leaflet' import 'leaflet.markercluster/dist/MarkerCluster.css' import 'leaflet.markercluster/dist/MarkerCluster.Default.css' import 'leaflet.markercluster' import 'leaflet.markercluster.freezable' import 'leaflet-ant-path' import smoothscroll from 'smoothscroll-polyfill'; import 'leaflet.gridlayer.googlemutant' import 'pretty-checkbox/src/pretty-checkbox.scss'; import 'flag-icon-css/css/flag-icon.min.css'; import VueApexCharts from 'vue-apexcharts'; import i18n from './i18n'; import 'moment/locale/vi.js'; import 'moment/locale/en-gb.js'; import moment from 'moment'; import LStorageUtils from "./utils/LStorageUtils"; import ICountUp from 'vue-countup-v2'; import { Datetime } from 'vue-datetime' import 'vue-datetime/dist/vue-datetime.css' import { Settings } from 'luxon' import '@/assets/scss/style.scss'; Settings.defaultLocale = LStorageUtils.getDefaultLanguage() || 'vi'; moment.locale(LStorageUtils.getDefaultLanguage() || 'vi'); Vue.component('datetime', Datetime); Vue.use(Vuesax); Vue.use(VueApexCharts); Vue.component('apexchart', VueApexCharts); Vue.component('iCountUp', ICountUp); Vue.use(BootstrapVue); Vue.use(IconsPlugin); Vue.config.productionTip = false; Vue.config.devtools = true; // kick off the polyfill! smoothscroll.polyfill(); window.__forceSmoothScrollPolyfill__ = true; ApiMaster.configAxios(); export default new Vue({ i18n, router, store, render: h => h(App) }).$mount('#app');
import "antd/lib/input/style/css"; import Input from "antd/lib/input"; export default Input;
(function(global, $) { "use strict"; var LCC = global.LCC || {}; LCC.MaxCharacters = LCC.MaxCharacters || {}; LCC.MaxCharacters.setMaxCharacters = function (element, maxlimit) { var new_length = element.val().length; if (new_length >= maxlimit) { element.val(element.val().substring(0, maxlimit)); new_length = maxlimit; } return (maxlimit - new_length) + ' characters left'; } global.LCC = LCC; })(window, jQuery);
import mongoose from 'mongoose' const db = async () => { try { const conn = await mongoose.connect( 'mongodb://localhost:27017/contactapp', { useNewUrlParser: true, useFindAndModify: true, useCreateIndex: true, useUnifiedTopology: true, } ) console.log(`${conn.connection.host} connected`) } catch (error) { console.error(`error:${error.message}`) process.exit(1) } } export default db
import {BigNumber} from 'bignumber.js'; import moment from 'moment'; import _ from 'lodash'; export default { getInfo(_this) { var me = this; window.addEventListener('load', function() { me.init(_this); me.getEmployeeList(_this); }); // todo 路由切换做单独判断 // me.init(_this); }, /** * [init] 初始化页面进行默认 * * @author 花夏 liubiao@itoxs.com * @param {Object} _this [传入的当前对象] */ init(_this) { this.self = _this; let Payroll = _this.Payroll; let web3 = _this.web3; let PayrollInstance; // _this.info = []; Payroll.deployed().then((instance) => { PayrollInstance = instance; _this.info.push({ name: '合约地址', value: PayrollInstance.address }); return this; }).then((result) => { PayrollInstance.addFund.call().then((res) => { _this.info.push({ name: '合约剩余总额 / ETH', value: web3.fromWei(new BigNumber(res).toNumber()), isAddFund: true }); }); return this; }).then((result) => { PayrollInstance.getPayTimes.call().then((res) => { _this.info.push({ name: '剩余最多支付次数 / 次', value: new BigNumber(res).toNumber() }); }); return this; }); }, /** * [addFund] 添加金额到合约地址里 * * @author 花夏 liubiao@itoxs.com * @param {Number} value [添加的eth数量] * @param {Object} _this [调用对象] */ addFund(value, _this) { var me = this; let Payroll = me.self.Payroll; let web3 = me.self.web3; Payroll.deployed().then((instance) => { instance.addFund(_.assign({ from: me.self.account, value: web3.toWei(value) }, _this.GAS)).then(() => { setTimeout(() => { self.location.reload(); }, 1000); }); return this; }); }, /** * [addEmpolyee] 添加一个员工 * * @author 花夏 liubiao@itoxs.com * @param {String} address [员工地址] * @param {Number} salary [员工月薪] * @param {Object} _this [调用的当前对象] */ addEmpolyee(address, salary, _this) { let Payroll = _this.Payroll; Payroll.deployed().then((instance) => { instance.addEmployee(address, salary, _.assign({ from: _this.account }, _this.GAS)).then(() => { setTimeout(() => { self.location.reload(); }, 1000); }); return this; }); }, /** * [getEmployeeList] 获取所有员工列表 * * @author 花夏 liubiao@itoxs.com * @param {Object} _this [调用的当前对象] */ getEmployeeList(_this) { let Payroll = _this.Payroll; let web3 = _this.web3; Payroll.deployed().then((instance) => { instance.checkInfo.call().then((res) => { _this.balance = web3.fromWei(new BigNumber(res[0]).toNumber()); _this.runTimes = new BigNumber(res[1]).toNumber(); _this.employeeCount = new BigNumber(res[2]).toNumber(); return _this; }).then((result) => { let employeeCount = result.employeeCount; var employeesListArr = []; for (var i = 0; i < employeeCount; i++) { employeesListArr.push(instance.checkEmployee.call(i)); } return employeesListArr; }).then((res) => { Promise.all(res).then(values => { let employees = values.map(value => ({ address: value[0], salary: web3.fromWei(new BigNumber(value[1]).toNumber()), lastPayDay: moment(new Date(new BigNumber(value[2]).toNumber()) * 1000).format('LLLL') })); _this.employeeData = employees; }); }); return this; }); }, /** * [changePaymentAddress] 更换员工地址 * * @author 花夏 liubiao@itoxs.com * @param {String} initialAds [原始地址] * @param {String} address [新地址] * @param {Number} index [下标] * @param {Object} _this [传入的对象] */ changePaymentAddress(initialAds, address, index, _this) { let Payroll = _this.Payroll; Payroll.deployed().then((instance) => { instance.changePaymentAddress(initialAds, address, index, _.assign({ from: _this.account }, _this.GAS)); return instance; }); }, // todo 不是owner // Error: VM Exception while processing transaction: invalid opcode updateEmployeeSalary(address, tempSalary, _this) { let Payroll = _this.Payroll; Payroll.deployed().then((instance) => { instance.updateEmployeeMsg(address, +tempSalary, _.assign({ from: _this.account }, _this.GAS)); return instance; }); }, delEmployee(address, _this) { let Payroll = _this.Payroll; Payroll.deployed().then((instance) => { instance.removeEmployee(address, _.assign({ from: _this.account }, _this.GAS)).then((res) => { _this.delModal = false; }); return instance; }); } };
import React from 'react'; import './style.scss'; export const Gallery = ({ imagesUrls }) => { return imagesUrls ? ( <div className='gallery'> {imagesUrls.map((image) => ( <div key={image}> <img src={image} alt={image} /> </div> ))} </div> ) : null; };
const express=require('express') const cors=require('cors') const bodyParser=require('body-parser') const mongoose=require('mongoose') const app=express() // app.get('/',(req,res)=>{ // res.send('<h1>Hello I am a Node Server Running on PORT 4444</h1>') // }) const DB='mongodb+srv://shobuj:shobuj@cluster0.wvbuv.mongodb.net/weatherdata?retryWrites=true&w=majority' mongoose.connect(DB,{ useNewUrlParser:true, // useCreateIndex:true, useUnifiedTopology:true //useFindAndModify:false }).then(()=>{ console.log('connection successful') }).catch((err)=>console.log('not connected')) app.use(cors()) app.use(express.static('public')) app.use(bodyParser.urlencoded({extended:false})) app.use(bodyParser.json()) app.use('/api/History',require('./api/route')) const PORT=process.env.PORT || 4447 app.listen(PORT,()=>{ console.log('App is running on PORT '+PORT) })
const initialState = 'all'; const wavelength = (state = initialState) => state; export default wavelength;
import 'date-fns'; import React from 'react'; import Grid from '@material-ui/core/Grid'; import DateFnsUtils from '@date-io/date-fns'; //npm i --save date-fns@next @date-io/date-fns import { MuiPickersUtilsProvider, KeyboardTimePicker, KeyboardDatePicker, } from '@material-ui/pickers'; //npm i @material-ui/pickers export default function TimePicker(props) { const nowTime = new Date (); const startTime = props.startTime || nowTime; const [selectedDate, setSelectedDate] = React.useState(startTime); React.useEffect( () => { if (props.startTime ) { setSelectedDate(startTime); } }, [props.startTime, startTime]) const handleDateChange = date => { setSelectedDate(date); props.onChange(date); }; return ( <MuiPickersUtilsProvider utils={DateFnsUtils}> <Grid container justify="center"> <KeyboardDatePicker margin="normal" id="date-picker-dialog" label="Chọn ngày" format="MM/dd/yyyy" value={selectedDate} onChange={handleDateChange} KeyboardButtonProps={{ 'aria-label': 'change date', }} /> <KeyboardTimePicker margin="normal" id="time-picker" label="Chọn giờ" value={selectedDate} onChange={handleDateChange} KeyboardButtonProps={{ 'aria-label': 'change time', }} /> </Grid> </MuiPickersUtilsProvider> ); }
export const firebaseConfig = { apiKey: "AIzaSyB0P9moF_oBRXIat2DHEOg4gA3J4yTDGoM", authDomain: "find-differences-d9e3a.firebaseapp.com", databaseURL: "https://find-differences-d9e3a.firebaseio.com", projectId: "find-differences-d9e3a", storageBucket: "find-differences-d9e3a.appspot.com", messagingSenderId: "984652922244", appId: "1:984652922244:web:74a1d87d0eecc8afabf1d1", measurementId: "G-Y7BXK4S2LG" };
import React from "react"; import Section from './Section'; import Section2 from './Section2'; function Main(){ return (<div> {/* Sections provide with content for the main page */} <Section /> <Section2 /> </div>); } export default Main;
'use-strict'; var rootPath = require('rfr'); var AppPath = rootPath('/app/appConfig'); var role = AppPath('/model/userRoleModel'); var Manager = AppPath('/server/dataAccess/entityManager'); var Exception = AppPath('/exceptions/baseException').Exception; var tableKeyGenerator = AppPath('/server/modelUtility/tableKyeGenerator'); var saveRole = function(json){ var entity = new role(json); var promise = tableKeyGenerator.GetNextId(role.PrimaryKey); promise.then(function(id){ entity.userID = id; Manager.Save(entity); }) .catch(function(error){ throw Exception(2,'roleManager',error,null,'Save'); }) }; var fetchRole = function(condition,fields,options){ var entity = new role(); var promise = Manager.Fetch(entity,condition,fields,options); promise.then(function(entityJson){ return entityJson; }) .catch(function(error){ throw Exception(2,'roleManager',error,null,'Fetch'); }) }; var fetchRoleById = function(id,fields,options){ var entity = new role(); var promise = Manager.FetchById(entity,id,fields,options); promise.then(function(entityJson){ return entityJson; }) .catch(function(error){ throw Exception(2,'roleManager',error,null,'FetchByID'); }) }; var updateRole = function(whereData,setData){ var entity = new role(); var promise = Manager.Update(entity,whereData,setData); promise.then(function(entityJson){ return entityJson; }) .catch(function(error){ throw Exception(2,'roleManager',error,null,'Update'); }) }; var deleteRole = function(key){ var entity = new role(); var promise = Manager.Delete(entity,key); promise.then(function(result){ return result; }) .catch(function(error){ throw Exception(2,'roleManager',error,null,'Delete'); }) }; module.exports = { SaveRole : saveRole, FetchRole : fetchRole, FetchRoleById : fetchRoleById, UpdateRole : updateRole, DeleteRole : deleteRole }
import { strings } from './Strings'; describe('Testing strings', () => { const supportedLanguages = ['en', 'fr']; supportedLanguages.forEach((language) => { const otherLanguages = Object.keys(strings).filter(element => element !== language); otherLanguages.forEach((anotherLanguage) => { Object.keys(strings[language]).forEach((key) => { it('Should have same key', () => { // We don't test for the value, since they wouldn't be equals in most cases expect(strings[anotherLanguage][key]).toBeTruthy(); }); }); }); }); });
import React, { useState, useEffect } from "react"; import Demo from "./Demo"; import {BarChart, Bar, Cell, XAxis, YAxis, CartesianGrid, Tooltip, Legend} from "recharts"; class ResultsGraph extends React.Component { state = { data: [ {name: 'Page A', uv: 0.2, pv: 2400, amt: 2400}, {name: 'Page B', uv: 0.01, pv: 1398, amt: 2210}, {name: 'Page C', uv: 0.1, pv: 9800, amt: 2290} ], activeIndex: 0, } handleClick(data, index) { this.setState({ activeIndex: index, }); } render () { const { activeIndex } = this.state; let pred_vals = this.props.evidences.pred_vals console.log('pred:', pred_vals) let data =[] for(let i = 0; i < pred_vals.length; i++) { data.push({'uv': pred_vals[i]}) } console.log('data:', data) // const activeItem = data[activeIndex]; const colors = ['#66BB6A', '#FF7043', '#FFEE58'] return ( <div> <BarChart width={250} height={150} data={data}> <Bar dataKey='uv' onClick={this.handleClick}> { data.map((entry, index) => ( <Cell cursor="pointer" fill={colors[index]} key={`cell-${index}`}/> )) } </Bar> </BarChart> </div> ); } } export default ResultsGraph;
import React from 'react' import ghost_mirrors from '../../images/paintings/ghost_mirrors.jpg' import PaintingsComponent from "../../components/paintings_component"; const Megadoodle = () => ( <PaintingsComponent image={ghost_mirrors} title={'Megadoodle'}> <p>Ball point pen on paper</p> </PaintingsComponent> ) export default Megadoodle
import * as types from "./actionTypes"; export const closeSlide = () => { return { type: types.CLOSE_SLIDE, }; }; export const setArticle = (article) => { return { type: types.SET_ARTICLE, article: article }; };
import '../iconfont/iconfont.css'; import React, { Component, PropTypes } from 'react'; const Iconfont = ({ type }) => { return ( <i className={'anticon iconfont icon-'+type}> </i> ); }; export default Iconfont;
$(function () { $.get('/wip/forms/accountInfo.php/?id=1', function (data) { var result = JSON.parse(data); $('#firstNameField').val(result['FIRST_NAME']); $('#lastNameField').val(result['LAST_NAME']); $('#emailField').val(result['USERNAME']); $('#studentField').val(result['STUDENT_ID']); }); }); $(function () { $("#submitPwReset").click(function (e) { $.post('/wip/secure/passwordReset.php/', { userId: $('#userID').val(), oldPw: $('#oldPassword').val(), newPw: $('#newPassword').val(), confirmPw: $('#confirmPassword').val() }).done(function (data) { var pwResult = JSON.parse(data); if (pwResult == "success") { document.getElementById("notifications").style.display = "block"; document.getElementById("notifications").innerHTML = "Successfully changed password!" setTimeout(function () { document.getElementById("notifications").style.display = "none"; document.getElementById("notifications").innerHTML = ""; }, 5000) } if (pwResult == "fail") { document.getElementById("notifications").style.display = "block"; document.getElementById("notifications").innerHTML = "Failed. Either you typed your old password incorrectly, your passwords don't match, or you did not meet password requirements."; setTimeout(function () { document.getElementById("notifications").style.display = "none"; document.getElementById("notifications").innerHTML = ""; }, 5000) } e.preventDefault(); e.stopPropagation(); return false; }); }); });
const playList = [ { title: 'Aqua Caelestis', src: '../assets/sounds/play-0.mp3' }, { title: 'Ennio Morricone', src: '../assets/sounds/play-1.mp3' }, { title: 'River Flows In You', src: '../assets/sounds/play-2.mp3' }, { title: 'Summer Wind', src: '../assets/sounds/play-3.mp3' }, ]; JSON.stringify(playList); export { playList };
import React, { Component } from 'react'; import logo from '../assets/logos.svg'; import '../assets/main.css'; import { connect } from "react-redux" import { change_page_action } from "../redux/actions/syncActions/myActions" import search_action from "../redux/actions/asyncActions/searchAction" import Cafe from "../assets/cafe.png" import Cocoa from "../assets/cocoa.png" import Miel from "../assets/miel.png" import Madera from "../assets/madera.png" import Cara from "../assets/cara.png" import Herbo from "../assets/herbo.png" class Search extends Component { constructor(props) { super(props); this.state = { value: "" } } componentDidMount() { } componentWillUnmount() { } render() { return ( <div style={{ paddingTop: "100px", color: "white" }}> <br></br> <div style={{ paddingTop: "100px", WebkitTextStroke: "0.7px black", fontSize: "2.4rem", lineHeight: "40px" }}> Buy authentic, socially responsible and <p /> 100% organic, blockchain validated products. </div> <div className="footerElement"> <div style={{ fontSize: "1.5rem" }}> Categories </div> <div className="box" style={{ fontSize: "1.5rem" }}> <div onMouseOut={() => document.getElementById("selectorCoffee").style.borderStyle = "none"} onMouseOver={() => document.getElementById("selectorCoffee").style.borderStyle = "solid"} onClick={ () => { this.props.search_action("coffee") this.props.change_page_action(1) } } style={{ margin: "10px" }}> <img id="selectorCoffee" style={{ borderRadius: "25px 25px 25px 25px", borderWidth: "5px" }} alt="logo" width="180px" src={Cafe}></img> <div> Coffee </div> </div> <div> </div> <div onMouseOut={() => document.getElementById("selectorHoney").style.borderStyle = "none"} onMouseOver={() => document.getElementById("selectorHoney").style.borderStyle = "solid"} onClick={ () => { this.props.search_action("honey") this.props.change_page_action(1) } } style={{ margin: "10px" }}> <img id="selectorHoney" style={{ borderRadius: "25px 25px 25px 25px", borderWidth: "5px" }} alt="logo" width="180px" src={Miel}></img> <div> Honey </div> </div> <div onMouseOut={() => document.getElementById("selectorChoco").style.borderStyle = "none"} onMouseOver={() => document.getElementById("selectorChoco").style.borderStyle = "solid"} onClick={ () => { this.props.search_action("cacao") this.props.change_page_action(1) } } style={{ margin: "10px" }}> <img id="selectorChoco" style={{ borderRadius: "25px 25px 25px 25px", borderWidth: "5px" }} alt="logo" width="180px" src={Cocoa}></img> <div> Cacao </div> </div> <div onMouseOut={() => document.getElementById("selectorArt").style.borderStyle = "none"} onMouseOver={() => document.getElementById("selectorArt").style.borderStyle = "solid"} onClick={ () => { this.props.search_action("handicraft") this.props.change_page_action(1) } } style={{ margin: "10px" }}> <img id="selectorArt" style={{ borderRadius: "25px 25px 25px 25px", borderWidth: "5px" }} alt="logo" width="180px" src={Madera}></img> <div> Handicrafts </div> </div> <div onMouseOut={() => document.getElementById("selectorBeauty").style.borderStyle = "none"} onMouseOver={() => document.getElementById("selectorBeauty").style.borderStyle = "solid"} onClick={ () => { this.props.search_action("beauty") this.props.change_page_action(1) } } style={{ margin: "10px" }}> <img id="selectorBeauty" style={{ borderRadius: "25px 25px 25px 25px", borderWidth: "5px" }} alt="logo" width="180px" src={Cara}></img> <div style={{ lineHeight: "24px" }}> Beauty </div> </div> <div onMouseOut={() => document.getElementById("selectorHerb").style.borderStyle = "none"} onMouseOver={() => document.getElementById("selectorHerb").style.borderStyle = "solid"} onClick={ () => { this.props.search_action("herbalism") this.props.change_page_action(1) } } style={{ margin: "10px" }}> <img id="selectorHerb" style={{ borderRadius: "25px 25px 25px 25px", borderWidth: "5px" }} alt="logo" width="180px" src={Herbo}></img> <div style={{ lineHeight: "24px" }}> Herbalism </div> </div> </div> </div> </div> ); } } const mapDispatchToProps = { change_page_action, search_action } export default connect(null, mapDispatchToProps)(Search);
function solve(arr) { console.log(arr[arr.length - 1]); } solve(['One', '"Two', '-']);
import React, { Component } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import { toggleTodo, removeTodo, addTodo, filterTodo } from "../actions/index"; import { filters } from "../const/filters"; class Index extends Component { constructor(props) { super(props); this.onKeypress = this.onKeypress.bind(this); } onKeypress(event) { if (event.keyCode === 13) { this.props.addTodo(this.newTodo.value); this.newTodo.value = ""; } } render() { return ( <div> <div>Общее количество:{this.props.length}</div> <div> {Object.keys(filters).map(key => ( <label> <input type="radio" name="filter" checked={key === this.props.filter ? "checked" : null} onClick={this.props.filterTodo.bind(this, key)} /> {filters[key].name} </label> ))} </div> {Object.keys(this.props.todos).map((id) => { return ( <div key={id}> <span onClick={this.props.toggleTodo.bind(this, id)}> <input type="checkbox" checked={this.props.todos[id].isCompleted ? "checked" : ""} className="checkbox" /> {this.props.todos[id].text} </span> (<a href="#" onClick={this.props.removeTodo.bind(this, id)}> Убрать </a>) </div> )})} <div> <input type="text" ref={newTodo => (this.newTodo = newTodo)} onKeyDown={this.onKeypress} /> </div> </div> ); } } Index.propTypes = { todos: PropTypes.arrayOf( PropTypes.shape({ text: PropTypes.string, isCompleted: PropTypes.bool }) ), filter: PropTypes.oneOf(["ALL", "UNCOMPLETED", "COMPLETED"]), length: PropTypes.number }; const mapStateToProps = state => { const filteredTodo = {}; for (let key in state.todos) { if (filters[state.filter].do(state.todos[key])) { filteredTodo[key] = state.todos[key]; } } return { todos: filteredTodo, filter: state.filter, length: state.todos.length }; }; const mapDispatchToProps = { toggleTodo, removeTodo, addTodo, filterTodo }; export default connect(mapStateToProps, mapDispatchToProps)(Index);
(function(){ angular.module('app.data').service('dataService',DataService); DataService.$inject=['$http','$q']; function DataService($http,$q){ this.saveData=saveData; this.getData=getData; //save data to the database function saveData(url,data){ console.log(data); var deferred=$q.defer(); $http({ method:'POST', url:url, data:data }).then(function(result){ deferred.resolve(result.data); },function(error){ deferred.error(error); }) return deferred.promise; } // get all data from the database function getData(url){ console.log(url) var deferred=$q.defer(); $http({ method:'GET', url:url }).then(function(result){ console.log(result.data) deferred.resolve(result.data); },function(error){ console.log(error) deferred.error(error); }); return deferred.promise; } } }())
'use strict'; // Include Gulp & Tools We'll Use var gulp = require('gulp'); var $ = require('gulp-load-plugins')(); var runSequence = require('run-sequence'); var browserSync = require('browser-sync'); var reload = browserSync.reload; var plumber = require('gulp-plumber'); var AUTOPREFIXER_BROWSERS = [ 'ie >= 10', 'ie_mob >= 10', 'ff >= 30', 'chrome >= 34', 'safari >= 7', 'opera >= 23', 'ios >= 7', 'android >= 4.4', 'bb >= 10' ]; // Automatically Prefix CSS gulp.task('css', function () { return gulp.src('app/assets/css/**/*.css') .pipe($.autoprefixer(AUTOPREFIXER_BROWSERS)) .pipe(gulp.dest('app/assets/css')); }); // Compile Any Other Sass Files You Added (src/styl) gulp.task('scss', function () { return gulp.src(['src/styl/**/*.scss']) .pipe(plumber()) .pipe($.rubySass({ style: 'expanded', precision: 10, loadPath: ['src/styl'] })) .pipe($.autoprefixer(AUTOPREFIXER_BROWSERS)) .pipe(gulp.dest('app/assets/css')) .pipe(reload({stream: true})); }); // Compile Any Other Stylus Files You Added (src/styl) gulp.task('stylus', function() { return gulp.src(['src/styl/**/*.styl', '!src/styl/_module/**/*.styl']) .pipe(plumber()) .pipe($.stylus()) .pipe($.autoprefixer(AUTOPREFIXER_BROWSERS)) .pipe(gulp.dest('app/assets/css')) .pipe(reload({stream: true})); }); // Compile Any Other Coffee Files You Added (src/coffee) gulp.task('coffee', function() { return gulp.src('src/coffee/**/*.coffee') .pipe(plumber()) .pipe($.coffee()) .pipe(gulp.dest('app/assets/js')) .pipe(reload({stream: true})); }); // Compile Any Other Jade Files You Added (src/jade) gulp.task('jade', function() { return gulp.src(['src/jade/**/*.jade', '!src/jade/_layout/**/*.jade']) .pipe(plumber()) .pipe($.jade({pretty: true})) .pipe(gulp.dest('app/')) .pipe(reload({stream: true})); }); // Watch Files For Changes & Reload gulp.task('default', function () { browserSync.init(null, { server: { baseDir: ['app'] }, notify: false, host: 'localhost' }); gulp.watch(['src/styl/**/*.scss'], ['scss']); gulp.watch(['src/styl/**/*.styl'], ['stylus']); gulp.watch(['src/coffee/**/*.coffee'], ['coffee']); gulp.watch(['src/jade/**/*.jade'], ['jade']); });
var fs = require('fs'); fs.rename('arquivo1.txt', 'arquivoNovo.txt', function (err) { if (err) throw err; });
module.exports = { fundsList: [ { key: 'DIVDUR', name: 'Afer Diversifié Durable', }, { key: 'SFER', name: 'Afer Sfer', }, { key: 'ACEURO', name: 'Afer Actions Euro', }, { key: 'ACMOND', name: 'Afer Actions Monde', }, { key: 'AMERIQ', name: 'Afer Actions Amérique', }, { key: 'EMERGE', name: 'Afer Marchés Emergents', }, { key: 'PATRIM', name: 'Afer Patrimoine', }, { key: 'ACPME', name: 'Afer Actions PME', }, { key: 'CONVER', name: 'Afer Convertibles', }, { key: 'MONDEN', name: 'Afer Obligations Monde Entreprises', }, { key: 'IMMO', name: 'Afer Immo', }, { key: 'AO2017', name: 'Afer Objectif 2017', }, ], }
const mongoose = require('mongoose') // 定义Schema const UserSchema = new mongoose.Schema({ id: { type: 'Number', required: true }, phone: { type: 'String', required: true }, password: { type: 'String', required: true }, nickname: { type: 'String' // 用户名 }, sex: { type: 'Number' // 0-未知 1 - 男 2 - 女 }, email: { type: 'String' // 邮箱地址 }, birthday: { type: 'String' // 生日 }, avatar: { type: 'String' // 头像 }, createAt: { type: Date, dafault: Date.now() }, updateAt: { type: Date, dafault: Date.now() } }) // 定义Model const UserModel = mongoose.model('User', UserSchema) // 暴露接口 module.exports = UserModel
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Light = require("./Light"); const lightSettingsResource = require("./lightSettingsResource"); SupRuntime.registerPlugin("Light", Light); SupRuntime.registerResource("lightSettings", lightSettingsResource);
import React, { Component } from 'react'; import { View, ScrollView, Text, ListView } from 'react-native'; import { connect } from 'react-redux'; import RocketSeatActions from '../Redux/RocketSeatRedux'; import { RocketSeatSelectors } from '../Redux/RocketSeatRedux'; import styles from './Styles/RocketSeatListStyle'; class RocketSeatList extends Component { constructor(props) { super(props); } componentDidMount() { this.props.listProducts(); } parseDataSource(data) { const rowHasChanged = (r1, r2) => r1 !== r2; const ds = new ListView.DataSource({ rowHasChanged }); return ds.cloneWithRows(data); } renderItem(rowData) { return ( <View> <Text>{rowData.title}</Text> <Text style={styles.label}>{rowData.description}</Text> </View> ); } render() { return ( <ScrollView style={styles.container}> <ListView dataSource={this.parseDataSource(this.props.docs)} renderRow={this.renderItem} enableEmptySections /> </ScrollView> ); } } const mapStateToProps = state => { return { docs: RocketSeatSelectors.getPayload(state) }; }; const mapDispatchToProps = dispatch => { return { listProducts: () => dispatch(RocketSeatActions.rocketSeatRequest()) }; }; export default connect( mapStateToProps, mapDispatchToProps )(RocketSeatList);
// IBM Watson image recognition var request = require('request'); function toBuffer(ab) { var buffer = new Buffer(ab.byteLength); var view = new Uint8Array(ab); for (var i = 0; i < buffer.length; ++i) { buffer[i] = view[i]; } return buffer; } function getTags(imageURL, imageID, completion) { try { request.get({ url: imageURL, encoding: null }, function(err, res, body){ if (err) console.error(err); var req = request.post({ auth: { user: '738d4720-4a4e-4df4-80e9-721602ed1a72', pass: '2lgDXFABO35I', sendImmediately: true }, url: 'https://gateway.watsonplatform.net/visual-recognition-beta/api/v2/classify?version=2015-12-02', method: 'POST', formData: { images_file: new Buffer(body, 'binary') } }, function(error2, res2, body2) { if (!error2) { console.log("Watson API success: " + JSON.stringify(body2)); if (body.code == "200") completion(null, [ { classes: [_.map(body.images.scores, function(a) { return a.name })] } ]); else completion([{ classes: [] }]); } else completion([{ classes: [] }]); } ); }); } catch (e) { console.error(e); } } exports.getTags = getTags
import { render } from 'react-dom'; import { Provider } from 'react-redux'; import h from 'react-hyperscript'; import { Router, browserHistory } from 'react-router'; import { syncHistoryWithStore } from 'react-router-redux'; import store from './store'; import routes from './routes'; // import { App } from './app/components';` import * as dataActions from './data/actions'; import './styles/index.scss'; //alon green was here const rootElement = document.querySelector('#app-root'); // Create an enhanced history that syncs navigation events with the store const history = syncHistoryWithStore(browserHistory, store); store.dispatch(dataActions.initialized()); render( h(Provider, { store }, h(Router, { history, routes }) // was h(App) ), rootElement );
// Constructor function State(numberOfRehersals, condition, conditionProbability, playerName, maxTime, lagn) { this.numberOfRehersals = numberOfRehersals; this.maxTime = maxTime; this.numberOfAnswers = 8; this.condition = condition; this.keyPresses = new Array(numberOfRehersals); this.score = 0; this.playerName = playerName; this.lagn = lagn; this.startTime = new Date(); this.endTime = "fim"; this.currentRehersal = 1; this.currentAnswer = 0; if(!conditionProbability){ this.conditionProbability = 0; } else { this.conditionProbability = conditionProbability; } for (var i = 0; i < this.numberOfRehersals; i++) { this.keyPresses[i] = new Array(this.numberOfAnswers); } this.scoreByRehersal = new Array(this.numberOfRehersals); for (var i = 0; i < this.numberOfRehersals; i++) { this.scoreByRehersal[i] = false; } } State.prototype.getPlayerName = function () { return this.playerName; }; State.prototype.setPlayerName = function (name) { this.playerName = name; }; State.prototype.setEndTime = function () { this.endTime = new Date(); }; State.prototype.getScore = function () { return this.score; }; State.prototype.incrementScore = function () { this.score++; this.scoreByRehersal[this.currentRehersal-1] = true; }; State.prototype.getCurrentRehersal = function () { return this.currentRehersal; }; State.prototype.resetAnswer = function () { this.currentAnswer = 0; }; State.prototype.getCurrentAnswer = function () { return this.currentAnswer; }; State.prototype.nextRehersal = function () { this.currentRehersal++; }; State.prototype.nextAnswer = function () { this.currentAnswer++; }; // class methods State.prototype.logKeyPress = function (key) { this.keyPresses[this.currentRehersal - 1][this.currentAnswer] = key; }; State.prototype.toString = function () { return this.keyPresses; }; State.prototype.checkCondition = function () { if (this.condition == 'I') { return this.checkCondition1(this.currentRehersal); } if (this.condition == 'II') { return this.checkCondition2(this.currentRehersal); } if (this.condition == 'III') { return this.checkCondition3(this.currentRehersal); } }; State.prototype.checkConditionWithBounds = function (min,max) { rehersal = this.currentRehersal - 1; if (rehersal < this.lagn) { return false; } var rehersals = []; for (var i = 0; i <= this.lagn; i++) { var rehersalData = this.keyPresses[rehersal - i]; rehersalData = rehersalData.slice(min,max+1); rehersals.unshift(rehersalData); console.log("Ensaio a comparar " + (rehersal - i)); console.log(rehersalData); console.log(rehersals); }; var result = checkAllDifferent(rehersals); console.log("Resultado: " + result); return result; }; State.prototype.checkConditionWithBoundsOld = function (min,max) { rehersal = this.currentRehersal; if (rehersal <= 4) { return false; } console.log("Ensaio " + rehersal); var fstRehersalData = this.keyPresses[rehersal-5]; var fst = fstRehersalData.slice(min,max+1); console.log("Ensaio a comparar " + (rehersal - 5)); console.log(fst); var sndRehersalData = this.keyPresses[rehersal-4]; var snd = sndRehersalData.slice(min,max+1); console.log("Ensaio a comparar " + (rehersal - 4)); console.log(snd); var thrdRehersalData = this.keyPresses[rehersal-3]; var thrd = thrdRehersalData.slice(min,max+1); console.log("Ensaio a comparar " + (rehersal - 3)); console.log(thrd); var fourthRehersalData = this.keyPresses[rehersal-2]; var fourth = fourthRehersalData.slice(min,max+1); console.log("Ensaio a comparar " + (rehersal - 2)); console.log(fourth); var fifthRehersalData = this.keyPresses[rehersal-1]; var fifth = fifthRehersalData.slice(min,max+1); console.log("Ensaio a comparar " + (rehersal - 1)); console.log(fifth); var result = checkAllDifferent([fst, snd, thrd, fourth, fifth]); console.log("Resultado: " + result); return result; }; State.prototype.checkCondition1 = function () { return this.checkConditionWithBounds(0,3); /* rehersal = this.currentRehersal; if (rehersal <= 4) { return false; } var fst = [this.keyPresses[rehersal - 2][0], this.keyPresses[rehersal - 2][1], this.keyPresses[rehersal - 2][2], this.keyPresses[rehersal - 2][3]]; var snd = [this.keyPresses[rehersal - 3][0], this.keyPresses[rehersal - 3][1], this.keyPresses[rehersal - 3][2], this.keyPresses[rehersal - 3][3]]; var thrd = [this.keyPresses[rehersal - 4][0], this.keyPresses[rehersal - 4][1], this.keyPresses[rehersal - 4][2], this.keyPresses[rehersal - 4][3]]; var fourth = [this.keyPresses[rehersal - 5][0], this.keyPresses[rehersal - 5][1], this.keyPresses[rehersal - 5][2], this.keyPresses[rehersal - 5][3]]; return !(fst.equals(snd) && snd.equals(thrd) && thrd.equals(fourth)); */ }; State.prototype.checkCondition2 = function () { return this.checkConditionWithBounds(4,7); /* rehersal = this.currentRehersal; if (rehersal <= 4) { return false; } var fst = [this.keyPresses[rehersal - 2][4], this.keyPresses[rehersal - 2][5], this.keyPresses[rehersal - 2][6], this.keyPresses[rehersal - 2][7]]; var snd = [this.keyPresses[rehersal - 3][4], this.keyPresses[rehersal - 3][5], this.keyPresses[rehersal - 3][6], this.keyPresses[rehersal - 3][7]]; var thrd = [this.keyPresses[rehersal - 4][4], this.keyPresses[rehersal - 4][5], this.keyPresses[rehersal - 4][6], this.keyPresses[rehersal - 4][7]]; var fourth = [this.keyPresses[rehersal - 5][4], this.keyPresses[rehersal - 5][5], this.keyPresses[rehersal - 5][6], this.keyPresses[rehersal - 5][7]]; return !(fst.equals(snd) && snd.equals(thrd) && thrd.equals(fourth)); */ }; State.prototype.checkCondition3 = function () { var randomInt = getRandomInt(1,100); //console.log('Probability: ' + this.conditionProbability + ' Random int: ' + randomInt); if(randomInt <= this.conditionProbability * 100){ return true; } else { return false; } }; State.prototype.exportToCsv = function(filename) { var csvFile = this.generateCSV(); var blob = new Blob([csvFile], { type: 'text/csv;charset=utf-8;' }); if (navigator.msSaveBlob) { // IE 10+ navigator.msSaveBlob(blob, filename); } else { var link = document.createElement("a"); if (link.download !== undefined) { // feature detection // Browsers that support HTML5 download attribute var url = URL.createObjectURL(blob); link.setAttribute("href", url); link.setAttribute("download", filename); link.style.visibility = 'hidden'; document.body.appendChild(link); link.click(); document.body.removeChild(link); } } } State.prototype.generateCSV = function(){ var header = 'ensaio,condicao,probabilidade,participante,hora inicio,hora fim,numero de ensaios,lagn,resposta 1,resposta 2,resposta 3,resposta 4,resposta 5,resposta 6,resposta 7,resposta 8,pontuou\n'; var ac = header; for(i=0; i<this.numberOfRehersals;i++){ ac+=(i+1) + ',' + this.condition + ',' + this.conditionProbability + ',' + this.playerName + ',' + this.startTime.toTimeString() + ',' + this.endTime.toTimeString() + ',' + this.numberOfRehersals + ',' + this.lagn + ',' + this.keyPresses[i][0] + ',' + this.keyPresses[i][1] + ',' + this.keyPresses[i][2] + ',' + this.keyPresses[i][3] + ',' + this.keyPresses[i][4] + ',' + this.keyPresses[i][5] + ',' + this.keyPresses[i][6] + ',' + this.keyPresses[i][7] + ',' + this.scoreByRehersal[i] + "\n"; } return ac; } function checkAllDifferent(values){ var ac = new Set(); for(i=0; i<values.length; i++){ var str = values[i].toString(); ac.add(str); } if(ac.size == values.length){ return true; } else { return false; } } /** * Returns a random integer between min (inclusive) and max (inclusive) * Using Math.round() will give you a non-uniform distribution! */ function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }