text
stringlengths
7
3.69M
/** * Proyect:NUHU * File: C/inicio.js * Version : 0.7 * author: Quidware.com * descr: Controlador para Contenido de inicio * */ function inicio(){ // Conectar UiSlider Doble para Tiempos var invMin= 2000000; var invMax= 3000000; var invRng= {'min': [1500000, 100000],'50%': [3000000, 200000],'max': 4000000 }; var invFrmt= { decimals: 0, prefix: '$ ' , suffix: '.&deg;&deg;', thousand: ',' }; // Si tiene vacío lo básico del perfil, pedirlo en la Bienvenida if(firebase.auth().currentUser){ firebase.database().ref('users/'+firebase.auth().currentUser.uid).once('value').then(function (rslt){ if(!rslt.val().Nombre || !rslt.val().Zona || !rslt.val().NumPxs || !rslt.val().Tel || !rslt.val().Enlace || !rslt.val().Motivo){ bienvenida(rslt.val().isAdm==1 || rslt.val().isSAdm==1,rslt.val()); } }).catch(function(error){console.warn(error.message);}); } //cargaUiSliderDbl('#invUiSlider','.input-invUiSlider-0','.input-invUiSlider-1',invMin,invMax,invRng,invFrmt).then(function(){ // Si no hay sesión iniciada, mostrar campos de registrados if(SPAPWALoaded==1) showDisconnected(); else addLoadEvent(showDisconnected); endLoad(); //}); } function showDisconnected(){ if(tst_logs)console.log("INICIO - showDisconnected()"); if(firebase.auth().currentUser){ addCssO("oculto","#inicio-registrate"); } else { remCssO("oculto","#inicio-registrate"); } } // Mostrar Bienvenida a Usuarios de primera vez function bienvenida(cls,vals){ console.log(vals); if(tst_logs)console.log("PEDIR bienvenida") // Preguntar que quiere hacer primero var chcInit =""; chcInit += "<div id=\"bienvenida\" class=\"fade over-mas modalDialog\">"; chcInit += ' <div> Bienvenido a NUHU!<br><br>Gracias por registrate. Ahora necesitamos que contestes unas preguntas adicionales:<br><br>'; chcInit += ' <form id="user_info_form" action="javascript:guardaInfoExtra()">'; if(!vals.Nombre){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="Nombre" id="Nombre" type="text" OLDplaceholder="Colaborador" class="mdl-textfield__input" required>'; chcInit += ' <label class="mdl-textfield__label" for="Nombre">Nombre de familia o persona...</label>'; chcInit += ' </div><div class="mdl-tooltip mdl-tooltip--top" data-mdl-for="Nombre">Por favor proporciona DOS APELLIDOS para evitar usuarios duplicados.</div>'; } if(!vals.Zona){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="Zona" id="Zona" type="text" list="sucursales" OLDplaceholder="Colaborador" class="mdl-textfield__input" required>'; chcInit += ' <label class="mdl-textfield__label" for="Zona">Zona...</label>'; chcInit += ' <datalist id="sucursales"><option value="Norte - Juriquilla"><option value="Central - Álamos 2da Sección"><option value="Corregidora - Mansiones del Valle"></datalist>'; chcInit += ' </div>'; } if(!vals.NumPxs){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="NumPxs" id="NumPxs" type="number" min="1" max="20" OLDplaceholder="Colaborador" class="mdl-textfield__input" required>'; chcInit += ' <label class="mdl-textfield__label" for="NumPxs"># Personas que se abastecerían</label>'; chcInit += ' </div>'; } if(!vals.Tel){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="Tel" id="Tel" type="number" OLDplaceholder="Colaborador" class="mdl-textfield__input" required>'; chcInit += ' <label class="mdl-textfield__label" for="Tel">Teléfono...</label>'; chcInit += ' </div>'; } if(!vals.Enlace){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="Enlace" id="Enlace" type="text" list="enlaces" OLDplaceholder="Colaborador" class="mdl-textfield__input" required>'; chcInit += ' <label class="mdl-textfield__label" for="Enlace">Enlace o contacto en la Cooperativa...</label>'; chcInit += ' <datalist id="enlaces"><option value="Amílcar (Chef)"><option value="Arturo"><option value="Daniel (Bacho)"><option value="Grisel"><option value="Isabel"><option value="Laura"><option value="Pancho"><option value="No conozco ningún enlace"></datalist>'; chcInit += ' </div>'; } if(!vals.Motivo){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="Motivo" id="Motivo" type="text" OLDplaceholder="Colaborador" class="mdl-textfield__input" required>'; chcInit += ' <label class="mdl-textfield__label" for="Motivo">Motivo de interés en la Cooperativa...</label>'; chcInit += ' </div>'; } if(!vals.Consideraciones){ chcInit += ' <div class="mdl-textfield mdl-js-textfield">'; chcInit += ' <textarea name="Consideraciones" id="Consideraciones" type="text" OLDplaceholder="Colaborador" class="mdl-textfield__input" rows="3"></textarea>'; chcInit += ' <label class="mdl-textfield__label" for="Consideraciones">Otras consideraciones...</label>'; chcInit += ' </div><div class="mdl-tooltip mdl-tooltip--top" data-mdl-for="Consideraciones">Cuéntanos como te enteraste de La Coope o si has llegado por invitación de algún cliente pon aquí su nombre completo y ambos recibirán un descuento en su próxima canasta.</div>'; } if(!vals.Proyectos){ chcInit += ' <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">'; chcInit += ' <input name="Proyectos" id="Proyectos" type="text" OLDplaceholder="Colaborador" class="mdl-textfield__input">'; chcInit += ' <label class="mdl-textfield__label" for="Proyectos">Proyectos Concientes?</label>'; chcInit += ' </div><div class="mdl-tooltip mdl-tooltip--top" data-mdl-for="Proyectos">¿Pertenece alguno de ustedes a algún proyecto relacionado con la alimentación ecológica y solidaria? ¿Cuál?</div>'; } chcInit += ' <div class="mdl-textfield--align-right page-content" style="margin-top:20px">'; chcInit += ' <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent">Guardar</button>'; chcInit += ' </div>'; chcInit += " </form>"; chcInit += " </div>"; chcInit += "</div>"; document.querySelector("#modalesV").innerHTML=chcInit; if(cls)clsModalShdw("#bienvenida"); location.href="#bienvenida"; if(document.querySelectorAll('#user_info_form .mdl-js-textfield').length){ componentHandler.upgradeDom(); chkDrtyVld('#user_info_form .mdl-js-textfield'); } } function guardaInfoExtra(){ var data={}; if(document.querySelector("#user_info_form #Nombre")) data.Nombre=document.querySelector("#user_info_form #Nombre").value; if(document.querySelector("#user_info_form #Zona")) data.Zona=document.querySelector("#user_info_form #Zona").value; if(document.querySelector("#user_info_form #NumPxs")) data.NumPxs=Number(document.querySelector("#user_info_form #NumPxs").value); if(document.querySelector("#user_info_form #Tel")) data.Tel=Number(document.querySelector("#user_info_form #Tel").value); if(document.querySelector("#user_info_form #Enlace")) data.Enlace=document.querySelector("#user_info_form #Enlace").value; if(document.querySelector("#user_info_form #Motivo")) data.Motivo=document.querySelector("#user_info_form #Motivo").value; if(document.querySelector("#user_info_form #Consideraciones")) data.Consideraciones=document.querySelector("#user_info_form #Consideraciones").value; if(document.querySelector("#user_info_form #Proyectos")) data.Proyectos=document.querySelector("#user_info_form #Proyectos").value; console.log("data",data); firebase.database().ref('users/'+firebase.auth().currentUser.uid).update(data).then(function(){ if(tst_logs)console.log("Saved User Info: "+firebase.auth().currentUser.email); snackBar('Información Guardada: '+firebase.auth().currentUser.email); location.href="#"; //clearForm("#edit_prod_form"); }).catch(function(error){ console.error(error.message); snackBar('NO SE GUARDO LA INFORMACIÓN'); }); location.href="#"; } //inicio();
exports.seed = function(knex, Promise) { // Deletes ALL existing entries return knex('media_content').del() .then(function () { // Inserts seed entries return knex('media_content').insert([ {id: 1, owner_id: 10000003, content:'这个世界上谁最可爱?'}, {id: 2, owner_id: 10000003, content:'化腾哥'}, {id: 3, owner_id: 10000003, content:'外星人云哥'}, {id: 4, owner_id: 10000003, content:'nick_345'}, {id: 5, owner_id: 10000003, content:'潇洒哥'}, {id: 6, owner_id: 10000003, content:'b_388359_1315747054ur40.jpg'}, ]); }); };
import { darkPurple, white } from 'kitsu/constants/colors'; export default (headerHeight = 64, marginTop = 0, extras = {}) => ({ headerStyle: { backgroundColor: darkPurple, height: headerHeight, justifyContent: 'center', }, headerTitleStyle: { color: white, fontFamily: 'OpenSans', fontWeight: 'bold', fontSize: 15, marginTop, }, ...extras, });
import _ from 'underscore'; import BaseForm from '../../../base/view/form'; import SearchModel from '../model/search'; export default class SearchForm extends BaseForm { constructor (options) { super(Object.assign({ events: { 'click button' : 'submit', 'submit' : 'submit' }, model: new SearchModel(options.data) }, options)); } submit (e) { e.preventDefault(); let errors = this.validate(); if (!errors) { _.redirect(_.getPath('user') + '/' + this.getValue('email')); } } }
const express = require('express') const transactionRouter = express.Router(); const handleAddIncome = async (req,res,db)=>{ try{ const {email,id,category,date,amount} = req.body; const data = await db.query('INSERT INTO income (id,email,date,amount,category) values($1,$2,$3,$4,$5) returning *',[id,email,date,amount,category]); res.status(201).json({ status:"success", data: data.rows[0] }) }catch(err){ res.status(400).json({ status:"failure", msg:err }) } } const handleAddExpense = async (req,res,db)=>{ try{ const {email,id,category,date,amount} = req.body; const data = await db.query('INSERT INTO expense (id,email,date,amount,category) values($1,$2,$3,$4,$5) returning *',[id,email,date,amount,category]); res.status(201).json({ status:"success", data: data.rows[0] }) }catch(err){ res.status(400).json({ status:"failure", msg:err }) } } const handleGetIncome = async (req,res,db)=>{ try{ const {email} = req.body; const data = await db.query('SELECT * FROM income WHERE email=$1',[email]); res.status(201).json({ status:"success", data: data.rows[0] }) }catch(err){ res.status(400).json({ status:"failure", msg:err }) } } const handleGetExpense = async (req,res,db)=>{ try{ const {email} = req.body; const data = await db.query('SELECT * FROM expense WHERE email=$1',[email]); res.status(201).json({ status:"success", data: data.rows[0] }) }catch(err){ res.status(400).json({ status:"failure", msg:err }) } } module.exports = { handleAddIncome, handleAddExpense, handleGetExpense, handleGetIncome }
import styled from "styled-components"; import tokens from "@paprika/tokens"; import stylers from "@paprika/stylers"; export const Instructions = styled.div` ${stylers.lineHeight(-1)} color: ${tokens.color.blackLighten20}; margin: ${tokens.space} 0 ${stylers.spacer(2)} 0; `;
/* You may use the following animals array to test your functions inside of this file. This is the same array of animals that is used in the tests. To run this file, remember that you can run `node index.js` from the command line. You will need to be in the directory where the `index.js` file is kept for the above command to work. Finally, remember that in order for you to see output on the command line, you must log something out. */ const animals = [ { kind: "Pig", count: 5 }, { kind: "Cow", count: 7 }, { kind: "Chicken", count: 11 }, { kind: "Horse", count: 1 }, { kind: "Dog", count: 2 }, { kind: "Cat", count: 2 }, ]; /** * FUNCTION DESCRIPTION * ------------------ * Adds up the `count` key of each animal in the array and returns a total. * @param {Object[]} animals - An array of animal objects. See above for the shape of the object. * @returns {number} The total of all animal counts. * * EXAMPLE * ------------------ * getTotalCount(animals); //> 28 * getTotalCount([]); //> 0 // returns 0 if the input array is empty */ function getTotalCount(animals) { // input: animals is an array of objects // output: return a number that respresents the total animal 'count' // return 0 if the array is empty // problem: how can we add up each of the 'count' key of each animal in the // solution: 1. Loop 2. += arthmetic operator // variable: declare a variable called total animal count and assign it to the default value, 0 let totalAnimalCount = 0; // loop through the animals array of objects for (let i = 0; i < animals.length; i++) { // declare a variable called animal and assign it an index from the array const animal = animals[i]; // reaasign the total animal count by assessing the count in each object totalAnimalCount += animal.count } // return the the total animal count return totalAnimalCount; } /** * FUNCTION DESCRIPTION * ------------------ * Returns the `kind` for each object from the inputted array. * @param {Object[]} animals - An array of animal objects. See above for the shape of the object. * @returns {string[]} An array of strings, where each string is a kind of animal. * * EXAMPLE * ------------------ * getAllKinds(animals); //> ["Pig", "Cow", "Chicken", "Horse", "Dog", "Cat"] * getAllKinds([]); //> [] // returns empty array if input array is empty */ function getAllKinds(animals) { // input: animals is a array of objects // output: return an array of strings where each string is a kind of animal // problem: how can we push the value of the key: kind into an empty array? // solution: 1. loop 2. .push() into an empty array // variable: declare a variable cache array and assign it an empty string let cacheArr = [] // loop through the animals array for (let i = 0; i < animals.length; i++) { // declare a variable called animal and assign it an index from the array const animal = animals[i] // push the value of the key: kind into the cache array cacheArr.push(animal.kind) } // return the array of strings return cacheArr; } /** * FUNCTION DESCRIPTION * ------------------ * Returns all objects inside the given array where the `count` of an animal is equal to or greater than the `minimum` amount. * @param {Object[]} animals - An array of animal objects. See above for the shape of the object. * @param {number} minimum - The lowest count of animals to include. * @returns {Object[]} An array of objects, which represents all animals that have a count equal to or greater than the minimum. * * EXAMPLE * ------------------ * filterByCountMinimum(animals, 5); //> [ { kind: "Pig", count: 5 }, { kind: "Cow", count: 7 }, { kind: "Chicken", count: 11 }, ]; * filterByCountMinimum([], 3); //> [] // returns empty array if input array is empty */ function filterByCountMinimum(animals, minimum) { // input: animals in an array of objects and // minimum is a number that represent the lowest count of animals to include // output: return an array of objects that have a count equal to or greater than the minimum // problem: how can I filter out the animals array to one get animals that have a count equal to or greater than the minimum // solution: 1. loop 2. >= arthmetic operator 3. if conditional statement 3. otherwise return an empty arr // declare a variable cacheArr and assign it an empty array let cacheArr = [] // loop through the animals array for (let i = 0; i < animals.length; i++) { // declare a variable called animal and assign it an index from the array const animal = animals[i] // if the animal 'count' is greater than or equal to minimum if (animal.count >= minimum) { // return the array with objects that are greater than or equal to minimum cacheArr.push(animal) } } // return the array of objects or an empty arr return cacheArr } /** * FUNCTION DESCRIPTION * ------------------ * Returns the object with the highest `count`. If more than one object shares the same highest `count`, return the first one. * @param {Object[]} animals - An array of animal objects. See above for the shape of the object. * @returns {Object} The object which represents the animal with the highest count. * * EXAMPLE * ------------------ * getMostCommonAnimal(animals); //> { kind: "Chicken", count: 11 } * getMostCommonAnimal([]); //> null // returns null if the input is empty */ function getMostCommonAnimal(animals) { // input: animals is an arr of obj // output: returns an object from animal arr that has the highest `count` // problem: how can you find the object with the higest count // solution: 1. loop 2. compare two `counts` // edge case: if the array is empty if (animals.length === 0) { // return null return null } // variable: declare a variable highest count and assign it to index 0 in the animals array let higestCount = animals[0] // loop through the animals arr for (let i = 0; i < animals.length; i++) { // declare a variable called animal and assign it an index from the array const animal = animals[i] // if highest count `count` is less than animal `count` we are looping // (comparing oranges to oranges) if (higestCount.count < animal.count) { // reassign the highest count to the animal object higestCount = animal // edge case: if more than one object have the same highest `count`, } else if (higestCount === animal.count) { // do not reaasign the highest `count` to this current animal ie continue looping continue } } // return higestCount return higestCount } // Do not change anything below this line. module.exports = { getTotalCount, getAllKinds, filterByCountMinimum, getMostCommonAnimal, };
var gulp = require('gulp'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); gulp.task('uglify', function () { return gulp.src( 'src/angular-forage.js' ).pipe( uglify() ).pipe( rename('angular-forage.min.js') ).pipe( gulp.dest('dist/') ); }); gulp.task('dist', ['uglify']);
/*! * Wpier * Copyright(c) 2006-2011 Sencha Inc. * * */ Ext.define('Gvsu.modules.orgs.controller.Main', { extend: 'Core.controller.MenuController', launcher: { text: D.t('Организации'), iconCls:'orgs', menu: { items: [ { text: D.t('Организации'), iconCls:'orgs', controller: 'Gvsu.modules.orgs.controller.Orgs' },{ text: D.t('Пользователи'), iconCls:'user-publ', controller: 'Gvsu.modules.users.controller.PublUsers' },{ text: D.t('Привязка к видам работ'), iconCls:'orgs', controller: 'Gvsu.modules.distinations.controller.SelWorks' }] } } });
import * as R from 'rodin/core'; function enforce() { } /** * set general parameters for each Particle * @constructor * * @version 0.0.1 * * @param { THREE.SpriteMaterial } [ material = new THREE.SpriteMaterial() ] - particle's material * * @param { Number } [ lifetime ] - Time till die * @param { Number } [ lifetime.value = 1000 ] - set value in milliseconds * @param { Number } [ lifetime.randomness = 100 ] - particles create in unit of time * * @param { object } [ particleSize ] - Particle's scale parameter, * if value or randomness is a number, it is scale symmetric * @param { THREE.Vector3 | Number } [ particleSize.value = new THREE.Vector3(0.05, 0.05, 0.05) ] particle scaling vector * @param { THREE.Vector3 | Number } [ particleSize.randomness = new THREE.Vector3(0.01, 0.01, 0.01) ] particle scaling vector randomising parameter * * @param { object } [ startPositionRandomness ] - Particle's position parameter by randomness * @param { Number } [ startPositionRandomness.randomness = 1 ] */ export class Particle extends R.Sculpt { constructor(material, lifetime, particleSize, startPosition) { super(new THREE.Sprite(material)); this.bornTime = R.Time.now; this.lifetime = R.utils.number.addNoise(lifetime.value, lifetime.randomness); particleSize.value = R.utils.vector3.toVector3(particleSize.value); startPosition.randomness = R.utils.vector3.toVector3(startPosition.randomness); // set particle random size this.scale.copy(R.utils.vector3.addNoise(particleSize.value, particleSize.randomness)); // set particle random position let initial = new THREE.Vector3().copy(R.utils.vector3.addNoise(new THREE.Vector3(0, 0, 0), startPosition.randomness)); this.position.copy(initial); this.initialPosition = new THREE.Vector3().copy(initial); this.on(R.CONST.UPDATE, () => { this.update(enforce); }) } update(e) { } isDead() { return R.Time.now - this.bornTime > this.lifetime; } }
'use strict'; const signUp = document.querySelector('.sign-up-htm'); const signIn = document.querySelector('.sign-in-htm'); signUp.addEventListener('submit', function(event) { event.preventDefault(); const signUpData = new FormData(signUp); let data = {}; for(const [k, v] of signUpData) { data[k] = v; } fetch('https://neto-api.herokuapp.com/signup', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then((res) => { if (200 <= res.status && res.status < 300) { return res; } throw new Error(res.statusText); }) .then((res) => { return res.json(); }) .then((data) => { if (data.error) { throw new Error(data.message); } console.log(data); event.target.querySelector('output').value = `Пользователь ${data.name} успешно зарегистрирован`; }) .catch((error) => { event.target.querySelector('output').value = error; }) }) signIn.addEventListener('submit', function(event) { event.preventDefault(); const signInData = new FormData(signIn); let data = {}; for(const [k, v] of signInData) { data[k] = v; } fetch('https://neto-api.herokuapp.com/signup', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then((res) => { if (200 <= res.status && res.status < 300) { return res; } throw new Error(res.statusText); }) .then((res) => { return res.json(); }) .then((data) => { if (data.error) { throw new Error(data.message); } console.log(data); event.target.querySelector('output').value = `Пользователь ${data.name} успешно авторизован`; }) .catch((error) => { event.target.querySelector('output').value = error; }) })
import React from "react"; import { Row } from "react-bootstrap"; class User extends React.Component { render() { return ( <Row> <h3>The user page</h3> <p> User id: </p> </Row> ); } } export default User;
const CustomError = require("../extensions/custom-error"); const chainMaker = { res: [], getLength() { return this.res.length // remove line with error and write your code here }, addLink(value = '') { this.res.push(`( ${value} )`) return this // remove line with error and write your code here }, removeLink(position) { if(position > this.res.length || !Number(position) || position !== Math.round(position)){ this.res = [] throw new Error() }else { this.res = [...this.res.slice(0,position-1), ...this.res.slice(position)] return this } // remove line with error and write your code here }, reverseChain() { this.res.reverse() return this // remove line with error and write your code here }, finishChain() { try{ return this.res.join('~~') }finally { this.res = [] } // remove line with error and write your code here } }; module.exports = chainMaker;
/** * Provides a method for getting bookmarks from localStorage */ export default class localStorageHelper { /** * @return {Array} An array of the user's bookmarks. */ getSites() { let sites = window.localStorage.getItem('sites'); if (sites === "") { console.info('Empty sites array'); return [] } return JSON.parse(sites) } putSite(site) { let currentSites = this.getSites() let newSites = [...currentSites, site] localStorage.setItem('sites', JSON.stringify(newSites)) } removeSite(key) { let currentSites = this.getSites() currentSites.splice(key, 1) localStorage.setItem('sites', JSON.stringify(currentSites)) return currentSites } replaceSites(sites) { localStorage.setItem('sites', JSON.stringify(sites.sites)) return sites.sites } getAuthToken() { return window.localStorage.getItem('gh_auth_tok') } setContributors(contributors) { return window.localStorage.setItem('gh_contributors', contributors) } getContributors() { return window.localStorage.getItem('gh_contributors') } getBackupGistId() { let ghBackupGistId = window.localStorage.getItem('gh_backup_gist_id') if (ghBackupGistId === null || ghBackupGistId === '') { return null } return ghBackupGistId } putBackupGistId(id) { return window.localStorage.setItem('gh_backup_gist_id', id) } getProfile() { return JSON.parse(window.localStorage.getItem('gh_profile')) } setProfile(profile) { return window.localStorage.setItem('gh_profile', JSON.stringify(profile)) } getColor() { return window.localStorage.getItem('color') } setColor(color) { return window.localStorage.setItem('color', color) } getTextColor() { return window.localStorage.getItem('text_color') } setTextColor(text_color) { return window.localStorage.setItem('text_color', text_color) } getBackground() { return window.localStorage.getItem('background') } setBackground(background) { return window.localStorage.setItem('background', background) } }
'use strict' const cli = require('heroku-cli-util') function getRelease (app) { return cli.heroku.request({ path: `/apps/${app}/build-metadata`, headers: {Accept: 'application/vnd.heroku+json; version=3.build-metadata'} }) } module.exports = { getURL: (app) => getRelease(app).then(release => release.repo_get_url), putURL: (app) => getRelease(app).then(release => release.repo_put_url), getCacheURL: (app) => getRelease(app).then(release => release.cache_get_url), putCacheURL: (app) => getRelease(app).then(release => release.cache_put_url) }
import React from 'react'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { getDOMNode } from '@test/testUtils'; import { testStandardProps } from '@test/commonCases'; import Navbar from '../Navbar'; import Nav from '../../Nav'; import Dropdown from '../../Dropdown'; import Whisper from '../../Whisper'; import Tooltip from '../../Tooltip'; afterEach(() => { sinon.restore(); }); describe('Navbar', () => { testStandardProps(<Navbar />); it('Should render a navbar', () => { const instance = getDOMNode(<Navbar />); assert.include(instance.className, 'rs-navbar'); }); it('Should have a `navbar-nav` className in `nav`', () => { const instance = getDOMNode( <Navbar> <Nav>1</Nav> </Navbar> ); assert.ok(instance.querySelector('.rs-nav.rs-navbar-nav')); }); context('[Deprecated] Use <Dropdown> within <Navbar>', () => { it('Should render <Dropdown> as a disclosure containing a list of items', () => { const { getByText } = render( <Navbar> <Nav> <Dropdown title="About"> <Dropdown.Item>Company</Dropdown.Item> </Dropdown> </Nav> </Navbar> ); expect(getByText('Company')).not.to.be.visible; // Clicking the button opens the disclosure userEvent.click(getByText('About')); expect(getByText('Company')).to.be.visible; }); it('Should work with submenus', () => { const { getByText } = render( <Navbar> <Nav> <Dropdown title="Menu"> <Dropdown.Menu title="Submenu"> <Dropdown.Item>Submenu item</Dropdown.Item> </Dropdown.Menu> </Dropdown> </Nav> </Navbar> ); // Opens the disclosure userEvent.click(getByText('Menu')); expect(getByText('Submenu item')).not.to.be.visible; userEvent.hover(getByText('Submenu')); expect(getByText('Submenu item')).to.be.visible; }); it('Should not get validateDOMNesting warning', () => { sinon.spy(console, 'error'); render( <Navbar> <Nav> <Dropdown title="Menu"> <Dropdown.Menu title="Submenu"> <Dropdown.Item>Submenu item</Dropdown.Item> </Dropdown.Menu> </Dropdown> </Nav> </Navbar> ); expect(console.error).not.to.have.been.calledWith(sinon.match(/Warning: validateDOMNesting/)); }); it('Should close <Dropdown> when clicking an item', () => { const { getByText } = render( <Navbar> <Nav> <Dropdown title="About"> <Dropdown.Item>Company</Dropdown.Item> </Dropdown> </Nav> </Navbar> ); // Opens the disclosure userEvent.click(getByText('About')); userEvent.click(getByText('Company')); expect(getByText('Company')).not.to.be.visible; }); it('Should close dropdown when a submenu item is clicked', () => { const { getByText } = render( <Navbar> <Nav> <Dropdown title="Menu"> <Dropdown.Menu title="Submenu"> <Dropdown.Item>Submenu item</Dropdown.Item> </Dropdown.Menu> </Dropdown> </Nav> </Navbar> ); // Opens the disclosure userEvent.click(getByText('Menu')); expect(getByText('Submenu item')).not.to.be.visible; userEvent.hover(getByText('Submenu')); userEvent.click(getByText('Submenu item')); expect(getByText('Submenu')).not.to.be.visible; }); it('Should highlight <Dropdown.Item> matching <Nav> `activeKey`', () => { const { getByTestId } = render( <Navbar> <Nav activeKey="2-1"> <Dropdown title="Dropdown"> <Dropdown.Item eventKey="2-1" data-testid="dropdown-item"> Dropdown item </Dropdown.Item> </Dropdown> </Nav> </Navbar> ); expect(getByTestId('dropdown-item')).to.have.attribute('aria-current', 'true'); }); it('Should call <Nav onSelect> with correct eventKey from <Dropdown.Item>', () => { const onSelectSpy = sinon.spy(); const { getByTestId } = render( <Navbar> <Nav activeKey="2-1" onSelect={onSelectSpy}> <Dropdown title="Dropdown" data-testid="dropdown"> <Dropdown.Item eventKey="2-1" data-testid="dropdown-item"> Dropdown item </Dropdown.Item> </Dropdown> </Nav> </Navbar> ); // Opens the dropdown userEvent.click(getByTestId('dropdown')); userEvent.click(getByTestId('dropdown-item')); expect(onSelectSpy).to.have.been.calledWith('2-1', sinon.match.any); }); }); context('Issue #2263', () => { it('Should render Tooltip at correct position', () => { // @see https://codesandbox.io/s/tooltip-in-navbar-94gxk const { getByTestId } = render( <Navbar> {/* pullRight makes the bug more obvious */} <Nav pullRight> <Whisper open trigger="hover" placement="bottom" speaker={<Tooltip data-testid="tooltip">Tooltip</Tooltip>} > <Nav.Item>Test</Nav.Item> </Whisper> </Nav> </Navbar> ); const tooltip = getByTestId('tooltip'); expect(tooltip).not.to.have.style('left', '0px').and.not.to.have.style('top', '0px'); }); }); });
import { QUERY_FOLDER } from './query' import { simplyFetchFromGraph } from "/lib/graph"; export async function getData({ query = QUERY_FOLDER, asPath, language, preview = null }) { return simplyFetchFromGraph({ query, variables: { path: asPath, language, version: preview ? 'draft' : 'published' }, }); }
import { ADD_ARTICLE, RESET_ARTICLES, DELETE_ARTICLE, EDIT_ARTICLE, EDIT_STORE } from "./action-types"; export function addArticle(payload) { return { type: ADD_ARTICLE, payload } } export function resetArticles() { return { type: RESET_ARTICLES } } export function deleteArticle(payload) { return { type: DELETE_ARTICLE, payload: payload } } export function editStore(object) { return { type: EDIT_STORE, payload: object }; } export function editArticle(object) { return { type: EDIT_ARTICLE, payload: object }; }
import Resource from './com'; const money = new Resource({ name: 'money', actions:[ {name:'getAll',method:'GET'} ] }); export default money;
import { $, enableElement, hideElement } from './utils/utils.js'; import { SELECTORS } from './constants.js'; export default class LottoView { init() { hideElement($(SELECTORS.LOTTO_LIST.SECTION)); hideElement($(SELECTORS.WINNING_NUMBER_INPUT.SECTION)); enableElement($(SELECTORS.MONEY_INPUT.INPUT)); enableElement($(SELECTORS.MONEY_INPUT.SUBMIT_BUTTON)); $(SELECTORS.MONEY_INPUT.FORM).reset(); $(SELECTORS.LOTTO_NUMBERS_INPUT.FORM).reset(); $(SELECTORS.WINNING_NUMBER_INPUT.FORM).reset(); $(SELECTORS.MONEY_INPUT.INPUT).focus(); $(SELECTORS.LOTTO_LIST.ELEMENT).remove(); } }
const allRightAnswers = {'visual': ['bicycle', 'stop-sign', 'car']}; function rightAnswers() { return allRightAnswers } export default rightAnswers
var fs = require('fs'); var formidable = require('formidable'); var pageNameValidator = require('../../client/app/js/page-name-validator'); var resolve = require('../persistence/file-resolve'); var defaults = require('./default'); /** * File uploads * @param request * @param response * @param url */ function doPost(request, response, url) { if ( ! request.authenticated ) { defaults.forbidden(response); return; } //parse a file upload var form = new formidable.IncomingForm(); form.uploadDir = '../tmp'; form.parse(request, function(err, fields, files) { if (err) { response.writeHead(200, {'content-type': 'text/plain'}); response.write('Upload failed\n\n'); response.end(); return; } try { var dir = fields.dir0; var newName = fields.fileName0; var newExt = fields.fileExt0; if (typeof newExt == 'undefined') { return; // impolite but fields are missing! } if (typeof newName == 'undefined') { return; // impolite but fields are missing! } if (typeof dir == 'undefined') { return; // impolite but fields are missing! } dir = pageNameValidator.validatePageName(dir, false); newName = pageNameValidator.validatePageName(newName, true); newExt = pageNameValidator.validatePageName(newExt, true); resolve.resolve(dir + "/" + newName + "." + newExt, true, function(fileSystemFile) { fs.rename(files.file0.path, fileSystemFile, function(err) { if (err) { console.log(err); response.writeHead(200, {'content-type': 'text/plain'}); response.write('Upload failed\n\n'); response.end(); } else { response.writeHead(200, {'content-type': 'text/plain'}); response.write('Received upload\n\n'); response.end(); } }); }); } catch(err) { console.log(err); // if file name validation fails it was a freaked Stream anyway validate the name in JS before sending response.writeHead(200, {'content-type': 'text/plain'}); response.write('Upload failed\n\n'); response.end(); } }); } exports.doPost = doPost;
const dealSchema = require('../../models/deal.model'); const mongoose = require("mongoose"); module.exports = async function newDeal(req, res, next) { const userId = mongoose.Types.ObjectId(res.locals.user._id); const deal = req.body; const groups = deal.groups.map(g => { return mongoose.Types.ObjectId(g._id); }); const dealInsert = new dealSchema({ author: userId, title: deal.title, image: deal.image, price: deal.price, startingPrice: deal.startingPrice, link: deal.link, code: deal.code, groups: groups, location: deal.location, description: deal.description, }); try { await dealInsert.save(); res.rawResponse = true; } catch (error) { console.log(error) res.rawResponse = error; } next(); };
import PageForm from './page-form'; import './page-form.less'; export default PageForm;
module.exports = { meta: { type: 'suggestion', fixable: 'code', docs: { description: 'Ensure stylesheets are preloaded', category: 'Optimizations', recommended: true, }, }, create: function (context) { const preloads = new Set() const links = new Map() return { 'Program:exit': function (node) { for (let [href, linkNode] of links.entries()) { if (!preloads.has(href)) { context.report({ node: linkNode, message: 'Stylesheet does not have an associated preload tag. This could potentially impact First paint.', fix: function (fixer) { return fixer.insertTextBefore( linkNode, `<link rel="preload" href="${href}" as="style" />` ) }, }) } } links.clear() preloads.clear() }, 'JSXOpeningElement[name.name=link][attributes.length>0]': function ( node ) { const attributes = node.attributes.filter( (attr) => attr.type === 'JSXAttribute' ) const rel = attributes.find((attr) => attr.name.name === 'rel') const relValue = rel && rel.value.value const href = attributes.find((attr) => attr.name.name === 'href') const hrefValue = href && href.value.value const media = attributes.find((attr) => attr.name.name === 'media') const mediaValue = media && media.value.value if (relValue === 'preload') { preloads.add(hrefValue) } else if (relValue === 'stylesheet' && mediaValue !== 'print') { links.set(hrefValue, node) } }, } }, }
'use strict'; var fs = require('fs'); var expect = require('chai').expect; var colPalette = require('../lib/color-map'); var data = require('../lib/buffer'); // Testing that colPalette data exists and is not void describe('colPalette', function() { it('should not be null', function() { expect(colPalette[20]).to.not.eql(null); console.log('data exists test'); }); }); // Testing that the data has changed describe('darken', function() { it('should change the data from CPalette', function() { expect(colPalette.darken[0]).to.not.eql(0); console.log('color change test'); }); });
const fulldata = require("../models/fulldata"); const NodeCache = require("node-cache"); const myCache = new NodeCache({ stdTTL: 10 }); function removeAccents(str) { return str .normalize("NFD") .replace(/[\u0300-\u036f]/g, "") .replace(/đ/g, "d") .replace(/Đ/g, "D"); } class Search { async index(req, res) { const textData = req.query.key; if (textData) { const valueSearch = { title: { $regex: new RegExp(textData, "i") }, }; const data = await fulldata.find(valueSearch); res.status(200).json(data); } else { res.status(200).json([]); } } } module.exports = new Search();
export function queryConstructor(formInputs) { let selection = ""; formInputs.map(el => { if (el.checked === true) { selection = selection + "," + el.value; return selection; } return selection; }); return selection; }
$(function(){ var map, infowindow, latlngObject; function addInfoWindowForCamera(marker, camera){ // this handles the creating and displaying the infowindow // If an infowindow is already open , it closes it before opening a new one google.maps.event.addListener(marker, "click", function(){ if(infowindow){ infowindow.close(); } infowindow = new google.maps.InfoWindow({ content: "<img src='http://www.tfl.gov.uk/tfl/livetravelnews/trafficcams/cctv/"+camera.file+"'><p>"+camera.location+"("+camera.postcode+")</p>", position: latlngObject }) map.panTo(marker.getPosition()); infowindow.open(map, marker); }) } function createMarkerForCamera(camera){ // here we define a marker object and add it to the map // then we attach an info window to the marker latlngObject = new google.maps.LatLng(camera["lat"], camera["lng"]) var marker = new google.maps.Marker({ position: latlngObject }); marker.setMap(map) addInfoWindowForCamera(marker, camera); } function mapCameras(cameras){ // this method goes through each object in the array returned by the server and delegates the creation of the marker to another method... $.each(cameras, function(i, item){ createMarkerForCamera(item) }) } function initialize(){ // This method creates the map and do an ajax call to get the cameras data var mapOptions = { zoom: 11, center: new google.maps.LatLng(51.52, -0.115) }; map = new google.maps.Map($('#map-canvas')[0], mapOptions); var cameras; $.ajax({ type: "GET", url: "http://localhost:3000/cameras.json", dataType: 'json' }).done(function(data){ mapCameras(data); }) } initialize() });
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { View, StyleSheet, ActivityIndicator, TouchableHighlight, } from 'react-native'; import { Card, Text, Icon } from 'react-native-elements'; import propTypes from 'prop-types'; import * as _ from 'lodash'; import { loadUISettings, setUISettings, } from '../../store/actions/dashboard'; import SettingGraph from './settingGraph'; import SettingTable from './settingTable'; import translate from '../../locales/language.locales' /** * * @Component * C'est le contenu principal sur le tableau de bord. */ class SettingContent extends Component { constructor(props) { super(props); this.state = { uiSettings: null, isLoading: true, }; } setContents = (content) => { let option = { chosenValues: content.chosenValues, patient: '/patients/' + content.patient.id, type: content.type, }; this.props.setUISettings(option); } static getDerivedStateFromProps(nextProps, prevState) { return { uiSettings: nextProps.uiSettings, isLoading: nextProps.isLoading, }; } componentDidMount() { this.props.loadUISettings(); } render() { const { vw, vh, isTablet, isLandScape, userId } = this.props; const { uiSettings, isLoading } = this.state; let graphs = uiSettings != null ? _.filter(uiSettings, {"type": "graph"}) : []; let tables = uiSettings != null ? _.filter(uiSettings, {"type": "table"}) : []; return( <View style={{ width: '100%', marginTop: 1*vh, paddingHorizontal: 2*vw }}> <Card containerStyle={{ borderRadius: 10, margin: 0 }}> <View style={{ position: 'relative', width: '100%', flexDirection:'row', justifyContent:'flex-start', alignItems:'center', }}> <TouchableHighlight onPress={this.props.backHandler} style={[styles.backIcon, { left: -12, height: 'auto', width: 'auto' }]}> <Icon reverse name='chevron-left' type='fontawsome' size={22} color="transparent" iconStyle={{ fontSize: 32, color: '#414141' }} /> </TouchableHighlight> <Text style={{ width: '100%', color: '#414141', marginLeft: 3 * vw, textAlign: 'center', fontSize: isTablet ? 3.4 * vw : 4.6 * vw, }}>{translate('DASHBOARD_settings')}</Text> </View> </Card> {isLoading && <View style={{ width: '100%', justifyContent: 'center' }}> <ActivityIndicator size="large" color="#898989" /> </View> } {!isLoading && <View style={{ width: '100%' }}> <SettingGraph header={translate('DASHBOARD_numericValues')} handler={this.setContents} content={graphs[0]} vw={vw} vh={vh} userId={userId} isTablet={isTablet} isLandScape={isLandScape} /> <SettingTable header={translate('DASHBOARD_otherValues')} handler={this.setContents} content={tables[0]} vw={vw} vh={vh} userId={userId} isTablet={isTablet} isLandScape={isLandScape} /> </View> } </View> ); } } /* Styles */ const styles = StyleSheet.create({ backIcon: { position: 'absolute', backgroundColor: 'transparent', overflow: 'hidden', zIndex: 10, }, }); SettingContent.propTypes = { backHandler: propTypes.func, vw: propTypes.number, vh: propTypes.number, isTablet: propTypes.bool, isLandScape: propTypes.bool, userId: propTypes.string, }; const mapStateToProps = (state, ownProps) => { return { ...state.uiSettings.toJS(), language : state.language.language }; }; export default connect( mapStateToProps, {loadUISettings, setUISettings} )(SettingContent);
/** * router.js 路由模块 * 处理路由的监听和分发 * 根据请求的方式和请求的路径设置具体处理函数 */ const express = require('express'); const router = express.Router(); const Resgiter = require('./register'); const Login = require('./login'); // const Settings = require('./settings'); const Profile = require('./profile'); const Admin = require('./admin'); const Blog = require('./blog'); const Review = require('./review'); const userMess = require('./usermess'); /** * 渲染首页 * 请求方式 get * 参数 无 */ router.get('/', Blog.findBlogList); /** * 渲染登录页面 * 请求方式get * 参数 无 */ router.get('/login', (req, res) => { res.render('login.html') }); /** * 处理登录页面 * 请求方式post * 参数 无 */ router.post('/login', Login.userLogin); /** * 渲染注册页面 * 请求方式get * 参数无 */ router.get('/resgiter', (req, res) => { res.render('resgiter.html') }); /** * 处理注册页面 * 请求方式post * 参数 Post提交的 */ router.post('/resgiter', Resgiter.createUser); /** * 处理退出请求 * 请求类型get * 请求参数无 */ router.get('/login_out', (req, res) => { // 退出登录清除session req.session.user = null; res.redirect('/'); }) /** * 渲染设置个人信息页面 * 请求方式get * 参数无 */ router.get('/settings/profile', (req, res) => { res.render('settings/profile.html', { user: req.session.user }) }); /** * 渲染设置管理信息页面 * 请求方式get * 参数无 */ router.get('/settings/admin', (req, res) => { res.render('settings/admin.html', { user: req.session.user }) }); /** * 渲染个人主页 * 请求参数get * 参数无 */ router.get('/myhome', userMess.getSiteMsg); /** * 保存修改个人信息 * 请求方式 post * 参数 post请求体 */ router.post('/profile', Profile.updateUserProfile); /** * 修改密码 * 请求类型post * 请求路径 /admin * 请求参数 无 */ router.post('/admin', Admin.updatedPassword); /** * 渲染写博客页面 * 请求方式get * 请求的路径/new */ router.get('/new', (req, res) => { res.render('homes/new.html', { user: req.session.user }); }) /** * 处理发表博客文章 */ router.post('/new', Blog.sendBlog); /** * 查看文章详情页面 * 查看评论的消息列表 */ router.get('/dest', Review.findDestAndReview); /** * 处理点赞功能 */ router.get('/clicks', Blog.updateLikeNum) /** * 发表评论 * 评论地址/comment * 请求类型 post */ router.post('/comment', Review.publishReview); /** * 查找所有的评论列表数据 */ router.get('/clist', Review.findReviewList) /** * 回复评论数据 */ router.post('/recomment', Review.reviewComment) //===========后台管理============== /** * 查看所有的文章 */ router.get('/article', userMess.findBlogs) // 导出我们的路由模块 module.exports = router;
/* jshint strict: false */ /* jshint node: true */ var path = require('path'); var pathResolution = path.resolve(__dirname, 'distribution'), resolver = { extensions: ['.js'], alias: { fdpa_resolutions: '.', fdpa: '.', '': '.' } }; var es5Config = { entry: './src/js/fusionApi_es5.js', output: { filename: 'fusionApi_es5.js', path: pathResolution }, resolve: resolver }; var es6Config = { entry: './src/js/fusionApi.js', output: { filename: 'fusionApi.js', path: pathResolution }, resolve: resolver }; module.exports = [es5Config, es6Config];
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var babelPluginFlowReactPropTypes_proptype_NodeSpec = require('./Types').babelPluginFlowReactPropTypes_proptype_NodeSpec || require('prop-types').any; function getAttrs(dom) { var align = dom.getAttribute('data-align') || dom.getAttribute('align'); if (align) { align = /(left|right|center)/.test(align) ? align : null; } return { align: align, latex: dom.getAttribute('data-latex') || null }; } var MathNodeSpec = { inline: true, attrs: { align: { default: null }, latex: { default: '' } }, group: 'inline', draggable: true, parseDOM: [{ tag: 'math[data-latex]', getAttrs: getAttrs }, { tag: 'span[data-latex]', getAttrs: getAttrs }], toDOM: function toDOM(node) { // Normally, the DOM structure of the math node is rendered by // `MathNodeView`. This method is only called when user selects a // math node and copies it, which triggers the "serialize to HTML" flow that // calles this method. var _node$attrs = node.attrs, align = _node$attrs.align, latex = _node$attrs.latex; var domAttrs = {}; if (align) { domAttrs.align = align; } if (latex) { domAttrs['data-latex'] = latex; } return ['span', domAttrs]; } }; exports.default = MathNodeSpec;
import Vue from 'vue' import VueI18n from 'vue-i18n' Vue.use(VueI18n) import fr from '@/langs/fr' import en from '@/langs/en' export const i18n = new VueI18n({ locale: 'fr', messages: { fr, en } });
import Vuex from 'vuex' import Vue from 'vue' import api from '../api/index' Vue.use(Vuex); export default new Vuex.Store({ state: { weather: {},//全部天气数据 hourly: [],//每小时 daily: [],//7天 lifes: [],//生活指数 life: {},//单个生活指数 hotcitys: [ { name: '上海市' }, { name: '北京市' }, { name: '杭州市' }, { name: '南京市' }, { name: '苏州市' }, { name: '深圳市' }, { name: '成都市' }, { name: '重庆市' }, { name: '天津市' }, { name: '武汉市' }, { name: '西安市' }, { name: '广州市' } ], ip:'',//用户的ip地址 userip: true,//取决用户位置的真假 user: '',//用户搜索的位置 usercity: ''//用户输入的位置 }, mutations: { //把所有有关天气的数据传state getWeather(state, weather) { state.weather = weather; state.hourly = state.weather.hourly; state.daily = state.weather.daily; state.lifes = state.weather.index; //给life组件的li元素绑定特定的class,还有id for (let i = 0; i < state.lifes.length; i++) { if (i === 0) { state.lifes[i].text = 'icon-kongtiao'; state.lifes[i].id = '389273974298'; } else if (i === 1) { state.lifes[i].text = 'icon-sports'; state.lifes[i].id = '109328758321'; } else if (i === 2) { state.lifes[i].text = 'icon-ziwaixian'; state.lifes[i].id = '091219384742'; } else if (i === 3) { state.lifes[i].text = 'icon-sick'; state.lifes[i].id = '019217493923'; } else if (i === 4) { state.lifes[i].text = 'icon-xiche'; state.lifes[i].id = '874928321012'; } else if (i === 5) { state.lifes[i].text = 'icon-kongqizhiyiban'; state.lifes[i].id = '495292849201'; } else if (i === 6) { state.lifes[i].text = 'icon-yifu'; state.lifes[i].id = '193843681719'; } } console.log(state.lifes); }, //监听用户点击哪个li元素,把这个li元素的数据传个state! getLife(state,lifeobj) { state.life = lifeobj; }, //改变定位的值 reverse(state) { state.userip = false; } //给life组件的li元素绑定特定的class,还有id // getImg(state) { // for(let i =0;i < state.lifes.length;i ++){ // if(i === 0){ // state.lifes[i].text = 'icon-kongtiao'; // state.lifes[i].id = '389273974298'; // }else if(i === 1){ // state.lifes[i].text = 'icon-sports'; // state.lifes[i].id = '109328758321'; // }else if(i === 2){ // state.lifes[i].text = 'icon-ziwaixian'; // state.lifes[i].id = '091219384742'; // }else if(i === 3){ // state.lifes[i].text = 'icon-sick'; // state.lifes[i].id = '019217493923'; // }else if(i === 4){ // state.lifes[i].text = 'icon-xiche'; // state.lifes[i].id = '874928321012'; // }else if(i === 5){ // state.lifes[i].text = 'icon-kongqizhiyiban'; // state.lifes[i].id = '495292849201'; // }else if(i === 6){ // state.lifes[i].text = 'icon-yifu'; // state.lifes[i].id = '193843681719'; // } // } // } // getCount(state) { // return store.state.count // } }, actions: { //ip请求 get_weather(store) { api.get(returnCitySN.cip, res => { console.log(res.data.result); store.commit('getWeather', res.data.result); }) }, //城市请求 city_weather(store) { api.getc(store.state.user, res => { // console.log('getc成功:' + res.data.result); store.commit('getWeather', res.data.result); }) } // get({ commit }) { // commit('getCount') // } } })
requirejs.config({ paths: { ace: ['https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js'] } }) $('h1').text("loading ace..."); requirejs([ 'ace/ace'], function(ace) { $('h1').text("ace loaded.") console.log(ace) ace.config.set("packaged", true) ace.config.set("basePath", require.toUrl("ace")) editor = ace.edit('editor') editor.setTheme("ace/theme/monokai") return })
import React from 'react'; import { Container, Grid, Link, Typography } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import Item from '../Products/components/Card/components/Item/Item' import listProducts from '../../assets/images/listProducts.jpg' export default function ListProducts( ) { return ( <div style={{ padding:"70px 0"}}> <Container fluid> <Typography variant="h5">title </Typography> <Grid container justify="space-around" spacing={6}> <Item link="/" size={4} display="none" image={listProducts} title="Дерматоскопы" subtitle="Better illumination. Higher colour rendering. More magnification." /> <Item link="/" size={4} display="none" title="Дерматоскопы" subtitle="Better illumination. Higher colour rendering. More magnification." /> <Item link="/" size={4} display="none" title="Дерматоскопы" subtitle="Better illumination. Higher colour rendering. More magnification." /> </Grid> </Container> <hr></hr> </div> ); };
../../../../../shared/src/generic/Pagination/index.js
/** MODULOS EXPRESS **/ let logger = require(process.cwd() + '/utils/logger.js'); //gerador de logs let express = require('express'); let Router = express.Router(); let serverMail = require('emailjs/email'); let db = require('../config/connect'); /** METODOS DO CONTROLLER **/ Router.route('/envia-mensagem/:empresa') //POST .post(function (req, res, next) { logger.info('Iniciando envio de mensagem'); if(JSON.stringify(req.body) === '{}'){ let msg = `Nenhum dado foi recebido para efetuar o envio`; logger.warn(msg); res.status(400).json(msg); }else{ //ENVIANDO EMAIL COM SENHA DE ACESSO PARA O USUARIO let server = serverMail.server.connect(db.configMail); let message = { from: `${req.body.empresa} - ${process.env.USER_EMPRESA} <${req.body.email}>`, to: `INNSERE <suporte@innsere.com.br>`, subject: `CHEFF - ${req.body.assunto}`, attachment: [{ data: ` <html><h3>Nova mensagem de ${req.body.empresa} - ${process.env.USER_EMPRESA},</h3> <p>O usuário enviou a mensagem abaixo:</p> <table border="0" width="500px"> <tr><td><strong>Empresa</strong></td></tr> <tr><td>${req.body.empresa}<br><br></td></tr> <tr><td><strong>E-mail</strong></td></tr> <tr><td>${req.body.email}<br><br></td></tr> <tr><td><strong>Telefone</strong></td></tr> <tr><td>${req.body.fone}<br><br></td></tr> <tr><td><strong>Mensagem</strong></td></tr> <tr><td>${req.body.mensagem}</td></tr> </table> </html> `, alternative: true },] }; server.send(message, function (e, message) { if (e) { let msg = `Não foi possivel enviar a mensagem!`; logger.info(msg); res.status(400).json(msg); }else { let msg = `Sua mensagem foi enviada com sucesso!`; logger.info(msg); res.status(200).json(msg); } }); } }); module.exports = Router;
import axios from 'axios' import store from './store' import { Notification } from 'element-ui' require('es6-promise').polyfill() let instance = axios.create({ baseURL: '/api', withCredentials: true }) instance.interceptors.response.use( response => { if (response.status === 200) { // Http ok if (response.data) { switch (response.data.code) { case 501: // 未登录 store.commit('logout') return Promise.reject(response.data) case 0: // SUCC return Promise.resolve(response.data) } } return response.data } else { console.log('HTTP ERROR:' + response.status + ',' + response.statusText) return Promise.reject(response) } }, err => { if (err && err.response) { switch (err.response.status) { case 400: err.message = '请求错误' break case 401: err.message = '未授权,请登录' break case 403: err.message = '拒绝访问' break case 404: err.message = '服务器返回找不到地址' break case 408: err.message = '请求超时' break case 500: err.message = '服务器内部错误' break case 501: err.message = '服务未实现' break case 502: err.message = '网关错误' break case 503: err.message = '服务不可用' break case 504: err.message = '网关超时' break case 505: err.message = 'HTTP版本不受支持' break default: } } Notification.error({ title: '请求失败', message: err.message, position: 'bottom-right' }) return Promise.reject(err) } ) export default { get: function(url, params) { return instance.get(url, { params: params }) }, post: function(url, params) { return instance.post(url, params) }, put: function(url, params) { return instance.put(url, params) }, delete: function(url) { return instance.delete(url) } }
// Use this sample to create your own voice commands intent( "What does this app do?", "What can I do here?", reply("This app can fetch you the news") ); intent("Who is Amit", (p) => { p.play("Pare mar patte"); }); intent("Start a command", (p) => { p.play({ command: "testCommand" }); }); const NEWS_API_KEY = "5df33018581b4916ba10b89c2a5502c9"; let savedArticles = []; //News By Source intent("Give me the news from $(source* (.*))", (p) => { let newsAPIUrl = `https://newsapi.org/v2/top-headlines?apiKey=${NEWS_API_KEY}`; if (p.source.value) { let formattedSource = p.source.value.toLowerCase().split(" ").join("-"); newsAPIUrl = `${newsAPIUrl}&sources=${formattedSource}`; } api.request(newsAPIUrl, (err, res, body) => { const { articles } = JSON.parse(body); if (!articles.length) { p.play("Sorry, please try searching for news from a different source"); return; } savedArticles = articles; p.play({ command: "newHeadlines", savedArticles }); p.play( `Here are the (latest|recent) news headlines from ${p.source.value}` ); p.play("Would you like me to read the headlines ?"); p.then(confirmation); }); }); //News By Source intent("What's new with $(term* (.*))", (p) => { let newsAPIUrl = `https://newsapi.org/v2/everything?apiKey=${NEWS_API_KEY}`; if (p.term.value) { newsAPIUrl = `${newsAPIUrl}&q=${p.term.value}`; } api.request(newsAPIUrl, (err, res, body) => { const { articles } = JSON.parse(body); if (!articles.length) { p.play("Sorry, please try searching for news for a different thing."); return; } savedArticles = articles; p.play({ command: "newHeadlines", savedArticles }); p.play(`This is what is going on for ${p.term.value}`); p.play("Would you like me to read the headlines ?"); p.then(confirmation); }); }); //Search by category const CATEGORIES = [ "business", "entertainment", "general", "health", "science", "sports", "football", "technology", ]; const CATEGORIES_INTENT = `${CATEGORIES.map( (category) => `${category}~${category}` ).join("|")}|`; intent(`Give me the latest $(C~ ${CATEGORIES_INTENT}) news`, (p) => { let newsAPIUrl = `https://newsapi.org/v2/top-headlines?apiKey=${NEWS_API_KEY}`; if (p.C.value) { newsAPIUrl = `${newsAPIUrl}&category=${p.C.value}&country=in`; } api.request(newsAPIUrl, (err, res, body) => { const { articles } = JSON.parse(body); if (!articles.length) { p.play("Sorry, please try searching for news for a different category."); return; } savedArticles = articles; p.play({ command: "newHeadlines", savedArticles }); p.play(`This is the latest news in the field of ${p.C.value}`); p.play("Would you like me to read the headlines ?"); p.then(confirmation); }); }); //News from India intent("Give me the latest news from India", (p) => { let newsAPIUrl = `http://newsapi.org/v2/top-headlines?country=in&apiKey=${NEWS_API_KEY}`; api.request(newsAPIUrl, (err, res, body) => { const { articles } = JSON.parse(body); if (!articles.length) { p.play("Sorry, could not find news from India"); return; } savedArticles = articles; p.play({ command: "newHeadlines", savedArticles }); p.play(`Here is the (latest|recent) news from India`); p.play("Would you like me to read the headlines ?"); p.then(confirmation); }); }); intent("(go|) back", (p) => { p.play({ command: "newHeadlines", savedArticles: [] }); }); intent("Open article number $(number* (.*))", (p) => { if (p.number.value) { p.play({ command: "open", number: p.number.value, savedArticles }); } }); const confirmation = context(() => { intent("Yes", async (p) => { for (let i = 0; i < savedArticles.length; i++) { p.play({ command: "highlight", article: savedArticles[i] }); p.play(`${savedArticles[i].title}`); } }); intent("No", (p) => { p.play("Okay, as you wish"); }); });
export const CHANGE_CURRENT_SONG = 'CHANGE_CURRENT_SONG'; export const CHANGE_CURRENT_LYRIC = 'CHANGE_CURRENT_LYRIC';
//Base import React, { Component } from 'react'; import './index.css'; class Paragraph extends Component { render() { return ( <p className={this.props.paraClass}>{this.props.content}</p> ) } } export default Paragraph;
// you should be able to import networks consisting of one vertex collection // as well as one edge collection. // vertex documents need to be imported seperatly, if you want them to // have some useful data // // http://snap.stanford.edu/data/egonets-Twitter.html // http://snap.stanford.edu/data/egonets-Facebook.html // http://snap.stanford.edu/data/egonets-Gplus.html // http://snap.stanford.edu/data/wiki-Vote.html var graph_module = require("@arangodb/general-graph"); var fs = require('fs'); module.exports = function (gname, filename) { var vColl = gname+"_vertices", eColl = gname+"_edges"; var graph; var exists = graph_module._list().indexOf(gname) != -1; if (!exists) { graph = graph_module._create(gname); db._create(vColl, {numberOfShards: 2, replicationFactor:2}); graph._addVertexCollection(vColl); db._createEdgeCollection(eColl, { numberOfShards: 2, replicationFactor: 2, shardKeys:["_vertex"], distributeShardsLike:vColl}); var rel = graph_module._relation(eColl, [vColl], [vColl]); graph._extendEdgeDefinitions(rel); } else { graph = graph_module._graph(gname); } var nodeSet = new Set(); var largeString = fs.read(filename); var lines = largeString.split("\n"); lines.map(function(line) { var parts = line.split(/\s+/); //console.log(parts); if (parts && parts.length >= 2) { if (!nodeSet.has(parts[0])) { nodeSet.add(parts[0]); graph[vColl].save({_key:parts[0], value:-1}); } if (!nodeSet.has(parts[1])) { nodeSet.add(parts[1]); graph[vColl].save({_key:parts[1], value:-1}); } graph[eColl].save(vColl+"/"+parts[0], vColl+"/"+parts[1], {_vertex:parts[0]}); } }); };
const chai= require("chai") const chaiHttp = require("chai-http"); const { response } = require("express"); const server = require("../app"); chai.should() chai.use(chaiHttp) describe("Data route test", function(){ // get / test it("test to check / ", (done)=>{ chai.request('http://localhost:3000') .get("/") .end((err, response)=>{ response.body.should.be.a("object"); response.should.have.status(200); response.body.should.have.property("status") done(); }) }) // post /data test it("test to check post of /data with data", (done)=>{ const data = { data : "any string" } chai.request('http://localhost:3000') .post("/data") .send(data) .end((err, response)=>{ response.body.should.be.a("array"); response.should.have.status(200); response.body.length.should.not.equal(0) done(); }) }) it("test to check post of /data with empty text", (done)=>{ const data = "" chai.request('http://localhost:3000') .post("/data") .send(data) .end((err, response)=>{ response.should.have.status(400); response.body.should.have.property("error") done(); }) }) // get /data testing it("test to check get of /data ", (done)=>{ chai.request('http://localhost:3000') .get("/data") .end((err, response)=>{ response.body.should.be.a("array"); response.should.have.status(200); response.body.length.should.not.equal(0); done(); }) }) // to test when no data is return it("test to check get of /data with empty data", (done)=>{ chai.request('http://localhost:3000') .get("/data") .end((err, response)=>{ response.body.should.be.a("array"); response.should.have.status(400); response.body.length.should.equal(0); done(); }) }) }) // /user api // user signup describe("user signup test", ()=>{ it("user signup successfull", (done)=>{ const crendential = { email : "babatunakinwale@yahoo.com", password: "123456789" } chai.request("http://localhost:3000") .post("/user/signup") .send(crendential) .end((err, response)=>{ response.should.have.status(200); response.body.should.have.property("session"); done() }) }) // user already exist it("user already exist", (done)=>{ const crendential = { email : "babatunakinwale@yahoo.com", password: "123456789" } chai.request("http://localhost:3000") .post("/user/signup") .send(crendential) .end((err, response)=>{ response.should.have.status(400); response.body.should.have.property("error"); done(); }) }) // entering of empty details or email without "@" and password greter than 3 characters it("user signup with empty details", (done)=>{ const crendential = { email : "", password: "" } chai.request("http://localhost:3000") .post("/user/signup") .send(crendential) .end((err, response)=>{ response.should.have.status(401); response.body.should.have.property("error"); done(); }) }) it("user signup with invalid email", (done)=>{ const crendential = { email : "adewaleesho", password: "123455" } chai.request("http://localhost:3000") .post("/user/signup") .send(crendential) .end((err, response)=>{ response.should.have.status(401); response.body.should.have.property("error"); done(); }) }) // entering of empty details or email without it("user signup with valid email but short password", (done)=>{ const crendential = { email : "adewale@roemichs.com", password: "12" } chai.request("http://localhost:3000") .post("/user/signup") .send(crendential) .end((err, response)=>{ response.should.have.status(401); response.body.should.have.property("error"); done(); }) }) }) // user login describe("user login test", ()=>{ it("sign in with correct credentials", (done)=>{ const crendential = { email : "babatunakinwale@yahoo.com", password: "123456789" } chai.request("http://localhost:3000") .post("/user/login") .send(crendential) .end((err, response)=>{ response.should.have.status(200); response.body.should.have.property("session"); done() }) }) it("login with wrong password", (done)=>{ const crendential = { email : "babatunakinwale@yahoo.com", password: "1234567" } chai.request("http://localhost:3000") .post("/user/login") .send(crendential) .end((err, response)=>{ response.should.have.status(400); response.body.should.have.property("error"); done(); }) }) it("login with wrong email", (done)=>{ const crendential = { email : "babatunakinwale@yah.com", password: "1234567" } chai.request("http://localhost:3000") .post("/user/login") .send(crendential) .end((err, response)=>{ response.should.have.status(400); response.body.should.have.property("error"); done(); }) }) // entering of empty details or email without "@" and password greter than 3 characters })
require("../common/vendor.js"), (global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/building/vr/main" ], { "0951": function(n, e, t) { function i(n) { return n && n.__esModule ? n : { default: n }; } function o(n, e) { var t = Object.keys(n); if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(n); e && (i = i.filter(function(e) { return Object.getOwnPropertyDescriptor(n, e).enumerable; })), t.push.apply(t, i); } return t; } function r(n) { for (var e = 1; e < arguments.length; e++) { var t = null != arguments[e] ? arguments[e] : {}; e % 2 ? o(Object(t), !0).forEach(function(e) { u(n, e, t[e]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(t)) : o(Object(t)).forEach(function(e) { Object.defineProperty(n, e, Object.getOwnPropertyDescriptor(t, e)); }); } return n; } function u(n, e, t) { return e in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n; } Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0; var c = t("2f62"), a = i(t("d1fa")), l = i(t("ba1b")), s = i(t("8e44")), d = (i(t("865e")), i(t("eed6"))), f = i(t("55ed")), g = i(t("0ee1")); t("371c"); var h = { mixins: [ a.default, f.default, d.default, g.default ], name: "HOUSE_VR_PREVIEW", data: function() { return { loading: !0, urls: [], tabs: [], type: "", building_id: "", title: "", excellent_consultants: [], building: {}, current_house: {} }; }, computed: r(r({}, (0, c.mapState)([ "consultantCard", "current_consultant_uid", "share_by_consultant_uid" ])), {}, { show_empty: function() { return !this.loading && !this.urls.length; }, show_disclaimer: function() { return this.building.activities && this.building.activities.indexOf("vr_disclaimer") > -1; } }), onLoad: function(n) { var e = n.building_id, t = n.title, i = n.type; n.house_id, this.building_id = e, this.title = t, this.type = i, this.getData(); }, onShareAppMessage: function() { var n = this.$root.$mp.query.building_id, e = this.title, t = this.building.name; return this.getShareInfo({ title: "【".concat(t, "】VR线上实景看房,沉浸式空间漫游~"), path: this.getSharePath("/pages/building/vr/main?title=".concat(e, "&building_id=").concat(n || "")), imageUrl: this.building.vr_resource ? this.building.vr_resource.vr_photo_url : "" }); }, methods: { getData: function() { var n = this, e = this.$root.$mp.query, t = (e.id, e.building_id), i = e.house_id, o = e.open_first, r = this.current_consultant_uid || this.share_by_consultant_uid; s.default.getBuilding(t, i, "", "", r).then(function(e) { n.building = e, n.current_house = e.current_houses.length ? e.current_houses[0] : {}; }), this.getVr().then(function(e) { o && wx.navigateTo({ url: e.items[0].vr_link }), n.urls = e.items, n.loading = !1, n.getConsultants(e.building.id); }); }, preview: function(n) { wx.previewImage({ current: this.urls[n].orginal_url, urls: this.urls.map(function(n) { return n.orginal_url; }) }); }, getConsultants: function(n) { var e = this; l.default.excellentConsultants(n).then(function(n) { e.excellent_consultants = n.slice(0, 3); }); }, goConsultants: function() { var n = this.building, e = n.id, t = n.name; wx.navigateTo({ url: "/pages/consultants/filter/main?id=".concat(e, "&name=").concat(t, "&from=VR") }); }, goVideo: function(n) { var e = this.building, t = e.id, i = e.name; wx.navigateTo({ url: "/pages/building/video/main?building_id=".concat(t, "&title=").concat(i, "&src=").concat(n) }); } }, components: { VrTip: function() { t.e("pages/building/img_preview/_vr_tip").then(function() { return resolve(t("6f5f")); }.bind(null, t)).catch(t.oe); }, TopRightShare: function() { t.e("components/views/top_right_share").then(function() { return resolve(t("73b4")); }.bind(null, t)).catch(t.oe); }, EmptyTip: function() { t.e("components/views/empty_tip").then(function() { return resolve(t("e430")); }.bind(null, t)).catch(t.oe); }, AudioAnalysis: function() { t.e("pages/building/img_preview/_audio_analysis").then(function() { return resolve(t("96b6")); }.bind(null, t)).catch(t.oe); }, CommonFooter: function() { Promise.all([ t.e("common/vendor"), t.e("pages/building/_components/_common_footer") ]).then(function() { return resolve(t("bf22")); }.bind(null, t)).catch(t.oe); }, Consultants: function() { t.e("pages/building/_components/_excellent_consultants").then(function() { return resolve(t("d91a")); }.bind(null, t)).catch(t.oe); }, LayoutItem: function() { t.e("pages/building/img_preview/_layout_item").then(function() { return resolve(t("9f91")); }.bind(null, t)).catch(t.oe); }, Disclaimer: function() { Promise.all([ t.e("common/vendor"), t.e("components/views/disclaimer") ]).then(function() { return resolve(t("db46")); }.bind(null, t)).catch(t.oe); } } }; e.default = h; }, "1e2b": function(n, e, t) { var i = t("46c1"); t.n(i).a; }, "25c5": function(n, e, t) { t.r(e); var i = t("31ab"), o = t("9a12"); for (var r in o) [ "default" ].indexOf(r) < 0 && function(n) { t.d(e, n, function() { return o[n]; }); }(r); t("1e2b"); var u = t("f0c5"), c = Object(u.a)(o.default, i.b, i.c, !1, null, "f5620ec2", null, !1, i.a, void 0); e.default = c.exports; }, "31ab": function(n, e, t) { t.d(e, "b", function() { return i; }), t.d(e, "c", function() { return o; }), t.d(e, "a", function() {}); var i = function() { var n = this; n.$createElement; n._self._c; }, o = []; }, "46c1": function(n, e, t) {}, "9a12": function(n, e, t) { t.r(e); var i = t("0951"), o = t.n(i); for (var r in i) [ "default" ].indexOf(r) < 0 && function(n) { t.d(e, n, function() { return i[n]; }); }(r); e.default = o.a; }, d485: function(n, e, t) { (function(n) { function e(n) { return n && n.__esModule ? n : { default: n }; } t("6cdc"), e(t("66fd")), n(e(t("25c5")).default); }).call(this, t("543d").createPage); } }, [ [ "d485", "common/runtime", "common/vendor", "pages/building/common/vendor" ] ] ]);
import "./Card.css"; function Apple() { return ( <div> <div className="Card" style={{ backgroundColor:"whitesmoke" }}> <div className="box1"> <p className="date">17 Sep 2020</p> <p className="amazon"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/1724px-Apple_logo_black.svg.png"/></p> </div> <div className="butt">Case Study</div> <div className="heading"> <p>Apple Gift</p> <p>Payment</p> </div> <div className="subHeading"> <p className="datee">Desktop - Mobile</p> <p className="arrow" >&#8594;</p> </div> </div> </div> ); } export default Apple;
function yindao(){ var mySwiper = new Swiper('.swiper-container',{ direction:"horizontal" }); } function swiperCtrl(){ var mySwiper = new Swiper('.swiper-container',{ onSlideChangeStart:function(swiper){ // 获取当前下标 //console.log(swiper.activeIndex); var ind=swiper.activeIndex; $(".list li").eq(ind).addClass("green").siblings().removeClass("green"); } }); } function homeCtrl($state){ $state.go("list.home") } function hotportCtrl($state,$scope,$http,$timeout){// $state.go("list.home.hotport"); $http({ url: "./data1.json" }) .success(function (data) { //console.log(data); $scope.scene = data.scene; $scope.life = data.life; $scope.Beauty = data.Beauty; //console.log($scope.life) }); //iscroll $timeout(function(){ new IScroll('.cont') },50) } angular.module("myapp") .controller("yindao",yindao) .controller("homeCtrl",homeCtrl) .controller("swiperCtrl",swiperCtrl) .controller("hotportCtrl",hotportCtrl);
import { connectHits } from 'react-instantsearch-dom'; import Hit from './SearchHit/SearchHit'; const hits = ({ hits, clicked }) => { return ( <ol> {hits.map(hit => <Hit key={hit.objectID} hit={hit} clicked={clicked} />)} </ol> ) } export default connectHits(hits);
"use strict"; var React = require('react'); ; function Content(_a) { var _b = _a.children, children = _b === void 0 ? null : _b, isVisible = _a.isVisible; return (<main> {isVisible ? children : null} </main>); } exports.__esModule = true; exports["default"] = Content;
const bodyParser = require('body-parser') const { graphqlExpress, graphiqlExpress } = require('apollo-server-express') const schema = require('Application/graphQL/schema') module.exports = (app) => { app.use('/graphql', bodyParser.json(), graphqlExpress({ schema: schema })) app.use('/graphiql', bodyParser.json(), graphiqlExpress({ endpointURL: '/graphql' })) }
import Vue from 'vue'; import Router from 'vue-router'; import Text from './components/Text.vue'; import VueCircleSlider from 'vue-circle-slider' import PrettyCheckbox from 'pretty-checkbox-vue'; Vue.use(PrettyCheckbox); Vue.use(VueCircleSlider) Vue.use(Router); export default new Router({ mode: 'history', base: process.env.BASE_URL, routes: [ { path: '/', name: 'Text', component: Text, }, ], });
import React, { Component, PropTypes } from 'react' import createMasonry from 'react-masonry-component' const Masonry = createMasonry(React) import '../scss/Entries.scss' function isIE () { var myNav = navigator.userAgent.toLowerCase() return (myNav.indexOf('msie') !== -1) ? parseInt(myNav.split('msie')[1], 10) : false } export default class Entries extends Component { static propTypes = { children: PropTypes.node } static defaultMasonryOptions = { transitionDuration: '.2s', itemSelector: '.Entry', isResizeBound: true } componentWillReceiveProps (props) { if (isIE()) { setTimeout(function () { this.refs.masonry.masonry.layout() }, 0) } else { this.refs.masonry.masonry.layout() } } render () { return <div className='Entries'> <Masonry ref='masonry' className='Entries' elementType='div' options={Entries.defaultMasonryOptions} disableImagesLoaded={false}> {this.props.children} </Masonry> </div> } }
tippy('#albums-pop', { theme: 'light-border', arrow: false, allowHTML: true, placement: 'right', touch: false, maxWidth: 550, interactive: true, interactiveBorder: 1, content: '<div class="article-component"><h1>Pop</h1><ul><li>Ariana Grande, Sweetener (2018)</li><li>Ariana Grande, thank u, next (2019)</li><li>Bruno Mars, 24K Magic (2016)</li><li>Carly Rae Jepsen, E-mo-tion (2015)</li><li>Charlie Puth, Voicenotes (2018)</li><li>Lawrence, Breakfast (2017)</li><li>Lawrence, Living Room (2018)</li><li>Taylor Swift, Red (2012)</li></ul></div>' });
const Engine = Matter.Engine; const World = Matter.World; const Bodies = Matter.Bodies; const Body = Matter.Body; var rubber var sand var iron var s1 var s2 var s3 var s4 var s5 var s5 var s6 var s7 var s8 var s9 var s10 var hammer var ground function preload() { } function setup() { createCanvas(800, 700); engine = Engine.create(); world = engine.world; //Create the Bodies Here. hammer=new Hammer(100,100,70,30) rubber=new Rubber(600,100,30) stone=new Stone(300,300,70,70) s1=new Sand(310,30,5) s2=new Sand(320,30,5) s3=new Sand(330,30,5) s4=new Sand(340,30,5) s5=new Sand(350,30,5) s6=new Sand(360,30,5) s7=new Sand(370,30,5) s8=new Sand(380,30,5) s9=new Sand(390,30,5) s10=new Sand(400,30,5) iron=new Iron(100,200,70,30) ground=new Ground(600,height,1200,20) Engine.run(engine); } function draw() { rectMode(CENTER); background(rgb(0,173,188)); rubber.display(); s1.display(); s2.display(); s3.display(); s4.display(); s5.display(); s6.display(); s7.display(); s8.display(); s9.display(); s10.display(); stone.display(); hammer.display(); ground.display(); iron.display(); drawSprites(); }
'use strict' let BaseDB = require("./basedb.js"); let master = new loki(); /** * @memberOf ElonaJS * @property {BaseDB} Music DB for BGM tracks * @property {BaseDB} Sound DB for Sound Effects * @property {BaseDB} i18n DB for internationalization * @namespace ElonaJS.Databases */ let Databases = { Music: new BaseDB("Music", ["id"], master), Sound: new BaseDB("Sound", ["id"], master), Races: new BaseDB("Races", ["id"], master), Classes: new BaseDB("Classes", ["id"], master), Skills: new BaseDB("Skills", ["id"], master), Attributes: new BaseDB("Attributes", ["id"], master), Graphics: require("./graphics.js"), Settings: require("./settings.js"), Traits: new BaseDB("Traits", ["id"], master), Misc: new BaseDB("Misc", ["tag"], master), i18n: require("./i18n.js"), loki: master } Databases.i18n.SetDB("i18n", ["id"], master); Databases.Graphics.SetDB("graphics", ["id"], master); Databases.Settings.SetDB("Settings", ["id"], master); window.i18n = Databases.i18n.Get.bind(Databases.i18n); window.i18nObj = Databases.i18n.GetObj.bind(Databases.i18n); window.Settings = Databases.Settings; /** * An asyncronous function to load game data into in-memory databases. * @memberOf ElonaJS.Databases * @name Load * @function */ Databases.Load = async function(){ let a = await Utils.File.GetJSON("./data/data.json"); UI.Menus.LoadingScreen.Message("Setting data..."); this.Music.BatchLoad(a.music); this.Sound.BatchLoad(a.sound); this.Races.BatchLoad(a.races); this.Classes.BatchLoad(a.classes); this.Skills.BatchLoad(a.skills); this.Attributes.BatchLoad(a.attributes); this.Traits.BatchLoad(a.traits); this.Settings.BatchLoad(a.settings); this.Settings.InitDefault(); this.Misc.BatchLoad(a.misc); UI.Menus.LoadingScreen.Message("Loading locale..."); await this.i18n.LoadFromJSON("./locale/en.json"); UI.Menus.LoadingScreen.Message("Loading graphics..."); await this.Graphics.BatchLoad(a.graphics); } module.exports = Databases;
/** * Created by kingson·liu on 2017/3/11. */ goceanApp.controller('QiusongPayCtrl', function ($scope, $rootScope, $state, $timeout, $stateParams, qiusongPayService, configService, localStorageService) { console.log("about QiusongPayCtrl"); var params = configService.parseQueryString(window.location.href); if (params.passportId){ params.nickName = decodeURI(params.nickName); try { params.nickName = Base64.decode(params.nickName); }catch (e){ } localStorageService.set("passport",params); } $scope.passport = localStorageService.get("passport"); var qiusongId = 0; var memberId = 0; if($stateParams.qiusongId){ qiusongId = $stateParams.qiusongId; } // 获取JSSDK configService.getJssdkInfo(window.location.href); // 隐藏右上角 configService.hideWXBtn(); function refresh(id) { if (id <= 0) return; var obj = { passportId : $scope.passport.passportId, token : $scope.passport.token, crowdFundingId : id }; qiusongPayService.getPayDetails(obj).then(function(data){ console.log(data); if ("OK" == data.status){ var qiusongDetailsDto = data.result; qiusongDetailsDto.sponsorName = Base64.decode(qiusongDetailsDto.sponsorName); init(qiusongDetailsDto); }else{ $state.go("order.qiusong"); } },function(err){ }); } function init(qiusongDetailsDto) { $scope.qiusongDetailsView = qiusongDetailsDto; if ($scope.qiusongDetailsView.status == "ING") { $scope.qiusongDetailsView.statusView = "求送中"; if ($scope.qiusongDetailsView.totalTimes >= $scope.qiusongDetailsView.memberCount){ $scope.qiusongDetailsView.statusView = "审核中"; } } else if ($scope.qiusongDetailsView.status == "SUCCESSED") { $scope.qiusongDetailsView.statusView = "已完成"; } else if ($scope.qiusongDetailsView.status == "SETTLED") { $scope.qiusongDetailsView.statusView = "已结算"; } } refresh(qiusongId); // 返回求送列表 $scope.toQiusongList = function () { $state.go("order.qiusong"); }; // H5调起微信支付 $scope.toWxPay = function (qiusongDetailsView) { var obj = { passportId : $scope.passport.passportId, token : $scope.passport.token, openid : $scope.passport.token3, device : "WEB", title : qiusongDetailsView.skuBriefDto.title + "(参与"+qiusongDetailsView.sponsorName+"的求送活动)", pr : qiusongDetailsView.pr, paid : qiusongDetailsView.unitAmount, skuId : qiusongDetailsView.skuBriefDto.id, tradeType : "JSAPI" }; qiusongPayService.toWxPay(obj).then(function(data){ if (data.result){ WeixinJSBridge.invoke('getBrandWCPayRequest',{ "appId" : data.result.appId, "timeStamp" : data.result.timeStamp+"", "nonceStr" : data.result.nonceStr, "package" : data.result.package, "signType" : "MD5", "paySign" : data.result.paySign },function(res){ if(res.err_msg == "get_brand_wcpay_request:ok"){ console.log("微信支付成功!"); var order = { passportId : $scope.passport.passportId, token : $scope.passport.token, crowdFundingId : qiusongId }; qiusongPayService.qiusongOnPaying(order).then(function(data){ if (data.status == "OK") { if (data.result == "PAID"){ $state.go('qiusongDetailsSponsor', {id : qiusongId}); }else { $state.go('order.qiusong'); } } },function(err){ }); }else if(res.err_msg == "get_brand_wcpay_request:cancel"){ console.log("用户取消支付!"); }else{ console.log("支付失败!"); } }); } },function(err){ }); } });
import notBlank from '../notBlank' test('notBlank', () => { expect(notBlank(1, 2, 3)).toBe(1) expect(notBlank(null, 2, 3)).toBe(2) expect(notBlank(null, '', 3)).toBe(3) })
import React from "react"; import ComponentB from "./ComponentB"; export const userContext = React.createContext(); function ComponetA() { return ( <div> <userContext.Provider value={"shiva"}> <ComponentB /> </userContext.Provider> </div> ); } export default ComponetA;
class Queue { constructor() { this.count = 0; this.nextKeyInLine = 0; this.storage = {}; } enqueue(value) { this.count++; this.storage[this.count] = value; } dequeue() { this.nextKeyInLine++; var temp = this.storage[this.nextKeyInLine]; delete this.storage[this.nextKeyInLine]; return temp; } size() { return Object.keys(this.storage).length; } }
import React from "react" export const InputText = ( { handleChange, handleSubmit, handleBlur, values, errors } ) => ( < form onSubmit={handleSubmit} > <input type="text" onChange={handleChange} onBlur={handleBlur} value={values.name} name="name" /> <button type="submit">Submit</button> </form > ); export const InputEmail = ( { handleChange, handleSubmit, handleBlur, values, errors } ) => ( < form onSubmit={handleSubmit} > <input type="email" onChange={handleChange} onBlur={handleBlur} value={values.name} name="email" /> <button type="submit">Submit</button> </form > );
var request = require('supertest'); var items = ['apple', 'banana', 'peach']; describe('Stack Test', () => { var server; beforeEach(() => { server = require('../server') }); afterEach(() => { server.close() }); it('Is App working?', (done) => { request(server) .get('/') .expect(200, done) }); it('Can you add an single item to the stack?', (done) => { request(server) .get('/stack/add/' + items[0]) .expect(200, done) }); it('Can you get an single item from the stack?', (done) => { request(server) .get('/stack/get') .expect(items[0], done) }) }) describe('Store Test', () => { var server; beforeEach(() => { server = require('../server'); }) afterEach(() => { server.close(); }) it('Is App working?', (done) => { request(server) .get('/') .expect(200, done) }) it('Can you add an item to the store? (without TTL)', (done) => { request(server) .get('/store/add/name-Larry') .expect(200, done) }) it('Can you get the item from the store? (without TTL)', (done) => { request(server) .get('/store/get/name') .expect('Larry', done) }) it('Can you add an item to the store? (with TTL)', (done) => { request(server) .get('/store/add/name-Larry/3') .expect(200, done) }) it('Can you get the item from the store? (before TTL)', (done) => { request(server) .get('/store/get/name') .expect('Larry', done) }) it('Can you get the item from the store? (after TTL)', (done) => { setTimeout(() => { request(server) .timeout(10000) .get('/store/get/name') .expect('Larry', done) }, 3000) }) it('Can you delete the item from the store?', (done) => { request(server) .get('/store/delete/name') .expect(200, done) }) })
(function (Function, Array) { var function_prototype = Function.prototype, isFunction = (function (TYPEOF_FUNCTION) { return function (type) { return ((typeof type == TYPEOF_FUNCTION) && (typeof type.call == TYPEOF_FUNCTION) && (typeof type.apply == TYPEOF_FUNCTION) ); }; }(typeof function_prototype)), isObject = function (type) { return (!!type && (typeof type == "object")); }, array_from = (isFunction(Array.from) && Array.from) || (function (array_prototype_slice) { return function (type) { return array_prototype_slice.call(type); }; }(Array.prototype.slice)); function extendType(SuperType, protoType) { var BaseType = this; protoType = (isObject(protoType) && protoType) || (isFunction(SuperType) && (new SuperType)); function SubType() { var type = this; if (isFunction(SuperType)) { SuperType.apply(type, arguments); } if (isFunction(BaseType)) { BaseType.apply(type, arguments); } return type; } if (protoType) { SubType.prototype = protoType; } return SubType; }/* function withTraits() { var Type = this, traitList = array_from(arguments); function composeType() { var type/ * = this* /, args = arguments; if (this instanceof composeType) { type = composeType.apply(null, args); } else if (isFunction(Type)) { type = (new Type(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9])); //type = (new Type); //traitList.unshift(Type); applyTraitList(traitList, args, type) } return type; // [Object | undefined] } return composeType; }*/ function withTraits() { var Type = this, protoType = (isFunction(Type) && (new Type)), traitList = array_from(arguments); traitList.unshift(Type); function ComposedType() { var type = this; applyTraitList(traitList, arguments, type); return type; } if (protoType) { ComposedType.prototype = protoType; } return ComposedType; } function applyTraitList(traitList, args, type) { traitList.forEach(function (Trait) { if (isFunction(Trait)) { Trait.apply(type, args); } }); } function_prototype.extendType = extendType; function_prototype.withTraits = withTraits; return Function; }(Function, Array)); /* [https://closure-compiler.appspot.com/home] - Simple - 658 byte (function(g,d){function h(a,b,c){a.forEach(function(a){e(a)&&a.apply(c,b)})}var f=g.prototype,e=function(a){return function(b){return typeof b==a&&typeof b.call==a&&typeof b.apply==a}}(typeof f),k=e(d.from)&&d.from||function(a){return function(b){return a.call(b)}}(d.prototype.slice);f.extendType=function(a,b){function c(){e(a)&&a.apply(this,arguments);e(d)&&d.apply(this,arguments);return this}var d=this;if(b=!!b&&"object"==typeof b&&b||e(a)&&new a)c.prototype=b;return c};f.withTraits=function(){function a(){h(c,arguments,this);return this}var b=e(this)&&new this,c=k(arguments);c.unshift(this);b&&(a.prototype=b);return a};return g})(Function,Array); */
app.controller('CategoriesController', ['$scope', '$q', '$timeout', '$uibModal', 'databaseService', 'orderByFilter', function($scope, $q, $timeout, $uibModal, databaseService, orderBy){ $scope.pagination = { currentPage: 1, pageMaxSize: 5, totalItems: 0, itemsPerPage: 5 }; var animationsEnabled = true; $scope.categories = []; $scope.categoriesAndSubcategories = []; $scope.isEmpty = false; $scope.alerts = [/*{ type: 'alert alert-danger', msg: 'Oh snap! Change a few things up and try submitting again.' }*/]; $scope.$watch('pagination.itemsPerPage', function(newval, oldval) { if(newval != oldval) { $scope.filterCategories(); } }); var clearOneAlert = function() { if($scope.alerts.length > 0) { $scope.alerts.splice(0, 1); } } var timeoutLength = 4000; $scope.$watch('alerts.length', function(newval, oldval){ if(newval != 0) { $timeout(clearOneAlert, timeoutLength); } }); // used for sort $scope.reverseSort = false; $scope.sortPropertyName = ''; $scope.sortBy = function(propertyName) { $scope.sortPropertyName = propertyName; $scope.reverseSort = !$scope.reverseSort; $scope.categories = orderBy($scope.categories, $scope.sortPropertyName, $scope.reverseSort); putTogetherCategoriesAndSubcategories(); $scope.filterCategories(); }; var putTogetherCategoriesAndSubcategories = function() { $scope.categoriesAndSubcategories = []; var totalItems = 0; for(var i = 0; i < $scope.categories.length; i++) { $scope.categoriesAndSubcategories.push($scope.categories[i]); totalItems++; if($scope.categories[i].subcategories) { for(var j = 0; j < $scope.categories[i].subcategories.length; j++) { $scope.categories[i].subcategories[j].isSubcategory = true; $scope.categories[i].subcategories[j].category_key = $scope.categories[i].key; $scope.categoriesAndSubcategories.push($scope.categories[i].subcategories[j]); totalItems++; } } } $scope.pagination.totalItems = totalItems; }; $scope.pageChanged = function() { $scope.filterCategories(); }; $scope.loadCategories = function(){ $scope.categories = []; $scope.categoriesAndSubcategories = []; $scope.categoryCount = databaseService.categoryCount; $scope.loadedCategories = false; var questionPromises = []; databaseService.getAllCategories().then(function(result){ if(result.length > 0){ $scope.isEmpty = false; $scope.categories = result; //$scope.pagination.totalItems = $scope.categories.length; putTogetherCategoriesAndSubcategories(); $scope.filterCategories(); } else { $scope.isEmpty = true; } $scope.loadedCategories = true; for(var i = 0; i < $scope.categories.length; i++) { questionPromises.push(databaseService.getQuestionsFromCategory($scope.categories[i].category_name)); } $q.all(questionPromises).then(function(result) { for(var i = 0; i < result.length; i++) { $scope.categories[i].questions = result[i][1].length; } var subcatQuestionPromises = []; for(var i = 0; i < $scope.categories.length; i++) { if($scope.categories[i].subcategories) { for(var j = 0; j < $scope.categories[i].subcategories.length; j++) { subcatQuestionPromises.push(databaseService.getQuestionsFromCategory($scope.categories[i].subcategories[j].category_name)); } } } $q.all(subcatQuestionPromises).then(function(subcatQuestionResult){ for(var i = 0; i < subcatQuestionResult.length; i++) { // attach to categories' subcategories the length of questions for(var j = 0; j < $scope.categories.length; j++) { if($scope.categories[j].subcategories) { for(var k = 0; k < $scope.categories[j].subcategories.length; k++) { if(subcatQuestionResult[i][0] == $scope.categories[j].subcategories[k].category_name) { $scope.categories[j].subcategories[k].questions = subcatQuestionResult[i][1].length; } } } } } }); }, function(error) { //console.log(error); }); }, function(error){ console.log(error); }); }; $scope.filterCategories = function() { $scope.filteredCategories = []; var startIndex = ($scope.pagination.currentPage-1)*$scope.pagination.itemsPerPage; for(var i = 0; i < $scope.pagination.itemsPerPage; i++) { if($scope.categoriesAndSubcategories[startIndex+i]) { $scope.filteredCategories.push($scope.categoriesAndSubcategories[startIndex+i]); } } }; $scope.openAddModal = function () { var modalInstance = $uibModal.open({ animation: animationsEnabled, component: 'addCategoryComponent', resolve: { alerts: function(){ return $scope.alerts; }, categories: function () { return $scope.categories; } } }); modalInstance.result.then(function () { // after add operation reload all categories $scope.loadCategories(); }, function () { }); }; $scope.openAddSubcategoryModal = function() { var modalInstance = $uibModal.open({ animation: animationsEnabled, component: 'addSubcategoryComponent', resolve: { alerts: function(){ return $scope.alerts; }, categories: function () { return $scope.categories; } } }); modalInstance.result.then(function () { // after add operation reload all categories $scope.loadCategories(); }, function () { }); }; $scope.openEditModal = function (key, category) { var modalInstance = $uibModal.open({ animation: animationsEnabled, component: 'editCategoryComponent', resolve: { key: function () { return key; }, category: function() { return category; }, alerts: function () { return $scope.alerts; }, categories: function () { return $scope.categories; } } }); modalInstance.result.then(function () { // after edit operation reload all categories $scope.loadCategories(); }, function () { }); }; $scope.openEditSubcategoryModal = function (key, subcategory) { var modalInstance = $uibModal.open({ animation: animationsEnabled, component: 'editSubcategoryComponent', resolve: { key: function () { return key; }, subcategory: function() { return subcategory; }, alerts: function () { return $scope.alerts; }, categories: function () { return $scope.categories; } } }); modalInstance.result.then(function () { // after edit operation reload all categories $scope.loadCategories(); }, function () { }); }; $scope.openDeleteModal = function (key, category) { var modalInstance = $uibModal.open({ animation: animationsEnabled, component: 'deleteCategoryComponent', resolve: { key: function () { return key; }, alerts: function () { return $scope.alerts; }, categories: function () { return $scope.categories; }, category: function() { return category; } } }); modalInstance.result.then(function () { // after delete operation reload all categories $scope.loadCategories(); }, function () { }); }; $scope.openDeleteSubcategoryModal = function(key, category) { var modalInstance = $uibModal.open({ animation: animationsEnabled, component: 'deleteSubcategoryComponent', resolve: { key: function () { return key; }, alerts: function () { return $scope.alerts; }, categories: function () { return $scope.categories; }, category: function() { return category; } } }); modalInstance.result.then(function () { // after delete operation reload all categories $scope.loadCategories(); }, function () { }); }; $scope.closeAlert = function(index) { $scope.alerts.splice(index, 1); }; }]);
function getPositives(ar) { for(let ind in ar){ if(ar[ind]>=0){ arrP.push(ar[ind]); } } return arrP; } var ar = [-5,10,-3,12,-9,5,90,0,1]; arrP=[]; var ar2 = getPositives(ar); console.log(getPositives(ar));
var express = require('express'); let app = express(); app.get('/', (request, response) => { console.log('what'); response.status(200).send('get'); }); app.put('/', (request, response) => { response.status(200).send('put'); }); const server = app.listen(40500, () => { console.log('HTTP server listening on port 40500') });
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; // import moment from 'moment'; // import { updateTodo } from '../features/todo'; export const todoApi = createApi({ reducerPath: 'todoApi', baseQuery: fetchBaseQuery({ baseUrl: 'http://localhost:8080/', }), tagTypes: ['Todos'], endpoints: (builder) => ({ getAllTodos: builder.mutation({ query: (username) => ({ url: `/users/${username}/todos`, }), providesTags: (result) => ( // if obtained a list of todos // subscribe to {type: 'Todos', todo.id} for each todo // also subscribe to 'Post' result ? [...result.map(({ id }) => ({ type: 'Todos', id })), 'Todos'] : ['Todos'] ), }), getTodo: builder.mutation({ query: ({ username, todoID }) => ({ url: `users/${username}/todos/${todoID}`, }), providesTags: (result, error, { todoID }) => [{ type: 'Todos', id: todoID }], }), deleteTodo: builder.mutation({ query: ({ username, todoID }) => ({ url: `/users/${username}/todos/${todoID}`, method: 'DELETE', }), invalidatesTags: (result, error, { todoID }) => [{ type: 'Todos', id: todoID }, 'Todos'], }), updateTodo: builder.mutation({ query: ({ todo }) => ({ url: `/users/${todo.username}/todos/${todo.id}`, method: 'PUT', body: todo, }), invalidatesTags: (result, error, { todo }) => [{ type: 'Todos', id: todo.id }, 'Todos'], }), addTodo: builder.mutation({ query: (todo) => ({ url: `/users/${todo.username}/todos/`, method: 'POST', body: todo, }), invalidatesTags: (result, error, todo) => [{ type: 'Todos', id: todo.id }, 'Todos'], }), }), }); export const { useGetAllTodosMutation, useGetTodoMutation, useDeleteTodoMutation, useUpdateTodoMutation, useAddTodoMutation, } = todoApi;
const mongoose = require('mongoose'); const foodItem=require('../models/foodItem'); mongoose.connect("mongodb://localhost/thumb",{useNewUrlParser: true, useUnifiedTopology: true }); const fd=[ {title:'Pizza', price: 1500,Imgurl:'https://images.pexels.com/photos/315755/pexels-photo-315755.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'}, {title:'Noodles',price: 900,Imgurl:'https://images.pexels.com/photos/2456434/pexels-photo-2456434.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940'}, {title:'White Sauce Pasta',price: 1200,Imgurl:'https://images.pexels.com/photos/1487511/pexels-photo-1487511.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'}, {title:'Red Pasta',price: 1300,Imgurl:'https://images.pexels.com/photos/1460872/pexels-photo-1460872.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'}, {title:'Burger',price: 650,Imgurl:'https://images.pexels.com/photos/1600727/pexels-photo-1600727.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'}, {title:'Salad',price: 500,Imgurl:'https://images.pexels.com/photos/1213710/pexels-photo-1213710.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'} ]; foodItem.insertMany(fd,function(err,fds){ if(err){ console.log(err); } })
var demands = [ { job: "Product Manager",//题目的类型 time: "13/07/2019", company:"AWS", salary:"20-30k", num:"100", kind:"Product Manager" }, { job: "Web Developer",//题目的类型 time: "13/07/2019", company: "SKODA", salary: "15-20k", num: "100", kind: "Web Developer" }, { job: "UI Designer",//题目的类型 time: "13/07/2019", company: "IBM", salary: "15-20k", num: "100", kind: "UI Designer" }, ] module.exports = demands
import React from 'react'; import PropTypes from 'prop-types'; import { Image, StyleSheet, ScrollView, SafeAreaView, Platform, } from 'react-native'; import { createDrawerNavigator, DrawerItems, } from 'react-navigation'; // screens import Article from './src/screens/Article'; import ArticleCover from './src/screens/ArticleCover'; import Cards from './src/screens/Cards'; import Components from './src/screens/Components'; import Login from './src/screens/Login'; import News from './src/screens/News'; import OrderConfirmed from './src/screens/OrderConfirmed'; import Presentation from './src/screens/Presentation'; import Dashboard from './src/screens/Dashboard'; import Register from './src/screens/Register'; import Registerv2 from './src/screens/Registerv2'; import Grid from './src/screens/Grid'; import RegisterConfirmCode from './src/screens/RegisterConfirmCode.js'; import ForgotPass from './src/screens/FortgortPass'; import ForgotPassConfirmCode from './src/screens/ForgotPassConfirmCode'; import theme from './src/theme'; import { Block, Icon, Text } from 'galio-framework'; const GalioDrawer = props => ( <SafeAreaView style={styles.drawer} forceInset={{ top: 'always', horizontal: 'never' }}> <Block space="between" row style={styles.header}> <Block flex={0.3}><Image source={{ uri: 'http://i.pravatar.cc/100' }} style={styles.avatar} /></Block> <Block flex style={styles.middle}> <Text size={theme.SIZES.FONT * 0.875}>Galio Framework</Text> <Text muted size={theme.SIZES.FONT * 0.875}>React Native</Text> </Block> </Block> <ScrollView> <DrawerItems {...props} /> </ScrollView> </SafeAreaView> ); const styles = StyleSheet.create({ drawer: { flex: 1, }, header: { paddingHorizontal: theme.SIZES.BASE, paddingTop: theme.SIZES.BASE * 0.6875, paddingBottom: theme.SIZES.BASE * 1.6875, borderBottomColor: '#D8D8D8', borderBottomWidth: 0.5, marginTop: Platform.OS === 'android' ? theme.SIZES.BASE * 2 : null, }, avatar: { width: theme.SIZES.BASE * 2.5, height: theme.SIZES.BASE * 2.5, borderRadius: theme.SIZES.BASE * 1.25, }, middle: { justifyContent: 'center', }, }); const MenuIcon = ({ name, family, focused }) => ( <Icon name={name} family={family} size={theme.SIZES.FONT} color={focused ? theme.COLORS.WHITE : '#5D5D5D'} /> ); MenuIcon.defaultProps = { name: null, family: null, focused: false, }; MenuIcon.propTypes = { name: PropTypes.string, family: PropTypes.string, focused: PropTypes.bool, }; const screens = { Home: { screen: Login, navigationOptions: { drawerLabel: 'Components', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, ForgotPass: { screen: ForgotPass, navigationOptions: { drawerLabel: 'ForgotPass', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, ForgotPassConfirmCode: { screen: ForgotPassConfirmCode, navigationOptions: { drawerLabel: 'ForgoPassConfirmCode', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, RegisterConfirmCode: { screen: RegisterConfirmCode, navigationOptions: { drawerLabel: 'RegisterConfirmCode', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Cards: { screen: Cards, navigationOptions: { drawerLabel: 'Cards', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Article: { screen: Article, navigationOptions: { drawerLabel: 'Article Screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, ArticleCover: { screen: ArticleCover, navigationOptions: { drawerLabel: 'Article Cover', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Dashboard: { screen: Dashboard, navigationOptions: { drawerLabel: 'Dashboard screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, News: { screen: News, navigationOptions: { drawerLabel: 'News Screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, OrderConfirmed: { screen: OrderConfirmed, navigationOptions: { drawerLabel: 'Order Confirmed', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Presentation: { screen: Presentation, navigationOptions: { drawerLabel: 'Presentation Screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Login: { screen: Login, navigationOptions: { drawerLabel: 'Login Screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Register: { screen: Register, navigationOptions: { drawerLabel: 'Register Screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Registerv2: { screen: Registerv2, navigationOptions: { drawerLabel: 'Register Screen v2', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, Grid: { screen: Grid, navigationOptions: { drawerLabel: 'Grid Screen', drawerIcon: props => <MenuIcon name="flag" family="font-awesome" focused={props.focused} />, }, }, }; const options = { contentComponent: props => <GalioDrawer {...props} />, contentOptions: { labelStyle: { fontWeight: '500', color: theme.COLORS.GREY, fontSize: theme.SIZES.FONT * 0.875, marginLeft: theme.SIZES.BASE * 0.75, }, activeLabelStyle: { color: theme.COLORS.WHITE, }, activeBackgroundColor: theme.COLORS.THEME, itemsContainerStyle: { paddingVertical: 0, }, iconContainerStyle: { marginHorizontal: 0, marginLeft: theme.SIZES.BASE * 1.65, // marginRight: theme.SIZES.BASE * 0.76, }, }, }; const GalioApp = createDrawerNavigator(screens, options); export default GalioApp;
'use strict'; angular.module('FEF-Angular-UI.appVersion', []) .directive('appVersion', ['version', function (version) { return function (scope, element) { element.text(version); } }]);
import React from "react"; const Paginate = ({ itemPerPage, totalItem, paginate }) => { const pageNumbers = []; for (let i = 1; i <= Math.ceil(totalItem / itemPerPage); i++) { pageNumbers.push(i); } return ( <Label> {pageNumbers.map(number => ( <Label.Detail key={number}> <Button onClick={() => paginate(number)}>{number}</Button> </Label.Detail> ))} </Label> ); }; export default Paginate
#!/usr/bin/env node /* eslint no-console: 0 */ 'use strict'; const fs = require('fs'); const path = require('path'); const petsPath = path.join(__dirname, 'pets.json'); const node = path.basename(process.argv[0]); const file = path.basename(process.argv[1]); const cmd = process.argv[2]; const fourth = process.argv[3]; const fifth = process.argv[4]; const sixth = process.argv[5]; const seventh = process.argv[6]; if (cmd === 'read') { fs.readFile(petsPath, 'utf8', (err, data) => { if (err) { throw err; } const pets = JSON.parse(data); if (Number.isNaN(fourth)) { console.log(pets); process.exit(); } if (fourth >= pets.length || fourth < 0) { console.error(`Usage: ${node} ${file} read INDEX`); process.exit(1); } else if (!fourth) { console.log(pets); } else { console.log(pets[fourth]); } }); } else if (cmd === 'create') { fs.readFile(petsPath, 'utf8', (readErr, data) => { if (readErr) { throw readErr; } const pets = JSON.parse(data); if (!fourth || !fifth || !sixth || isNaN(fourth)) { console.error(`Usage: ${node} ${file} ${cmd} AGE KIND NAME`); process.exit(1); } const newPet = {}; newPet.age = Number(fourth); newPet.kind = fifth; newPet.name = sixth; pets.push(newPet); const petsJSON = JSON.stringify(pets); fs.writeFile(petsPath, petsJSON, (writeErr) => { if (writeErr) { throw writeErr; } }); console.log(newPet); }); } else if (cmd === 'update') { fs.readFile(petsPath, 'utf8', (readErr, data) => { if (readErr) { throw readErr; } const pets = JSON.parse(data); if (!fourth || !fifth || !sixth || isNaN(fourth) || !seventh) { console.error(`Usage: ${node} ${file} update INDEX AGE KIND NAME`); process.exit(1); } const newPet = {}; newPet.age = Number(fifth); newPet.kind = sixth; newPet.name = seventh; pets[Number(fourth)] = newPet; const petsJSON = JSON.stringify(pets); fs.writeFile(petsPath, petsJSON, (writeErr) => { if (writeErr) { throw writeErr; } }); console.log(newPet); }); } else if (cmd === 'destroy') { fs.readFile(petsPath, 'utf8', (readErr, data) => { if (readErr) { throw readErr; } const pets = JSON.parse(data); if (!fourth || isNaN(fourth)) { console.error(`Usage: ${node} ${file} destroy INDEX`); process.exit(1); } if (pets.length < 1) { console.error('No pets to delete...'); process.exit(1); } const indeX = Number(fourth); const byebyePet = pets.splice(indeX, 1); console.log(byebyePet[0]); const petsJSON = JSON.stringify(pets); fs.writeFile(petsPath, petsJSON, (writeErr) => { if (writeErr) { throw writeErr; } }); }); } else { console.error(`Usage: ${node} ${file} [read | create | update | destroy]`); process.exit(1); }
const express = require('express') const router = express.Router() const article = require('../util/article') router.post('/write',article.insertArticle); router.get('/article',article.deleteArticle); router.get('/search',article.searchArticle); router.get('/',article.getAllArticle); module.exports = router;
var Collectible : Transform; function OnNetworkLoadedLevel() { //Instantiating player if(Network.isServer){ Network.Instantiate(Collectible, transform.position, transform.rotation, 0); } }
import { useState, useEffect } from 'react'; import { connect } from 'react-redux'; import { useRouteMatch } from 'react-router-dom'; import { useToasts } from 'react-toast-notifications'; import { getStoreById, updateStoreById } from '../../redux/actions/storesActionCreator'; import { fetchAllAdminPayment } from '../../redux/actions/adminPaymentActionCreator'; import { fetchAllAdminShipment } from '../../redux/actions/adminShipmentActionCreator'; import { createSellerPayment, fetchAllSellerPayment, deleteSellerPayment } from '../../redux/actions/sellerPaymentActionCreator'; import { createSellerShipment, fetchAllSellerShipment, deleteSellerShipment } from '../../redux/actions/sellerShipmentActionCreator'; import ModalDelete from './InfoModalDelete.component'; const Information = ({ dispatchGetStoreByIdAction, dispatchUpdateStoreAction, dispatchFetchAllAdminPaymentAction, dispatchFetchAllAdminShipmentAction, dispatchFetchAllSellerPaymentAction, dispatchFetchAllSellerShipmentAction, dispatchDeleteSellerShipment, dispatchDeleteSellerPayment, dispatchCreateSellerPayment, dispatchCreateSellerShipment, adminPayments, adminShipments, sellerPayments, sellerShipments }) => { const { params } = useRouteMatch(); const storeId = params.storeId; const { addToast } = useToasts() const [edit, setEdit] = useState({ change: false }); const [selected, setSelected] = useState(); const [name, setName] = useState(''); const [description, setDescription] = useState(''); const [address, setAddress] = useState(''); const [contact, setContact] = useState(''); //asset for payment and shipment const [bankId, setBankId] = useState(); const [bankAccountNumber, setBankAccountNumber] = useState(); const [shippingMethodId, setShippingMethodId] = useState(); const handleEdit = () => { setEdit({ ...edit, change: !edit.change }) }; useEffect(() => { dispatchFetchAllAdminPaymentAction() dispatchFetchAllAdminShipmentAction() dispatchFetchAllSellerPaymentAction(storeId) dispatchFetchAllSellerShipmentAction(storeId) dispatchGetStoreByIdAction(storeId, (data) => { setName(data.store.name); setDescription(data.store.description); setAddress(data.store.address); setContact(data.store.contact); }) }, [dispatchFetchAllAdminPaymentAction, dispatchFetchAllAdminShipmentAction, dispatchFetchAllSellerPaymentAction, dispatchFetchAllSellerShipmentAction ,dispatchGetStoreByIdAction, storeId]); const reloadPage = () => { setTimeout(() => { window.location.reload(); }, 1000) }; const handleOnSubmit = event => { reloadPage(); event.preventDefault(); const id = parseInt(storeId); const data = { id, name, description, address, contact }; dispatchUpdateStoreAction(id, data, () => { addToast('Update Store Successfully.', {appearance:'success'}); }, (message) => addToast(`Error: ${message}`, {appearance:'error'})); }; const onSubmitPayment = (event) => { event.preventDefault(); const storeId = parseInt(params.storeId) const data = {bankId, storeId, bankAccountNumber} console.log(data) dispatchCreateSellerPayment( data , () => { addToast('Create Payment Successfully.', {appearance:'success'}); setTimeout(()=> { window.location.reload(); }, 1000) }, (message) => { addToast(`Error: ${message}`, {appearance:'error'}); }); }; const onSubmitShipment = (event) => { event.preventDefault(); const storeId = parseInt(params.storeId) const data = {shippingMethodId, storeId} console.log(data) dispatchCreateSellerShipment( data , () => { addToast('Create Shipment Successfully.', {appearance:'success'}); setTimeout(()=> { window.location.reload(); }, 1000) }, (message) => { addToast(`Error: ${message}`, {appearance:'error'}); }); }; const showModalDeletePayment = (event, id) => { event.preventDefault(); setSelected(id); window.$('#modalDeletePaymentInfo').modal('show'); }; const showModalDeleteShipment = (event, id) => { event.preventDefault(); setSelected(id); window.$('#modalDeleteShipmentInfo').modal('show'); }; const handleOnDeletePayment = () => { dispatchDeleteSellerPayment(selected, () => { window.$('#modalDeletePaymentInfo').modal('hide'); addToast('Delete Payment Successfully.', {appearance:'warning'}); }, (message) => { window.$('#modalDeletePaymentInfo').modal('hide'); addToast(`Error: ${message}`, {appearance: 'error'}); }); }; const handleOnDeleteShipment = () => { dispatchDeleteSellerShipment(selected, () => { window.$('#modalDeleteShipmentInfo').modal('hide'); addToast('Delete Shipment Successfully.', {appearance:'warning'}); }, (message) => { window.$('#modalDeleteShipmentInfo').modal('hide'); addToast(`Error: ${message}`, {appearance: 'error'}); }); }; return ( <div className="con-sto mt-3 py-4"> <div className="d-flex justify-content-between info"> <h4>Store Information</h4> {!edit.change ? (<button className="px-3 my-auto edit" onClick={handleEdit}>Edit</button>) : (<button className="px-3 my-auto back" onClick={handleEdit}>Cancle</button>)} </div> <div className="px-3 mt-3"> <form onSubmit={handleOnSubmit} > <div className="d-flex"> <div className="left"> <h5>Name</h5> </div> <div className="right"> {!edit.change ? (<input type="text" placeholder="Store Name" className="form-control" value={name} disabled/>) : (<input required type="text" placeholder="Store Name" className="form-control" value={name} onChange={(e) => setName(e.target.value)} />)} </div> </div> <div className="d-flex mt-3"> <div className="left"> <h5>Contact</h5> </div> <div className="right"> {!edit.change ? (<input type="text" placeholder="Contact" className="form-control" value={contact} disabled/>) : (<input required type="text" placeholder="Contact" className="form-control" value={contact} onChange={(e) => setContact(e.target.value)} />)} </div> </div> <div className="d-flex mt-3"> <div className="left"> <h5>Description</h5> </div> <div className="right"> {!edit.change ? (<textarea type="text" placeholder="Store Description" className="form-control" value={description} disabled/>) : (<textarea required type="text" placeholder="Store Description" className="form-control" value={description} onChange={(e) => setDescription(e.target.value)} />)} </div> </div> <div className="d-flex mt-3"> <div className="left"> <h5>Address</h5> </div> <div className="right"> {!edit.change ? (<textarea type="text" placeholder="Store Address" className="form-control" value={address} disabled/>) : (<textarea required type="text" placeholder="Store Address" className="form-control" value={address} onChange={(e) => setAddress(e.target.value)} />)} </div> </div> {edit.change && (<div className="d-flex my-3"> <button className="px-3 ml-auto save" type="submit">Save</button> </div>)} </form> <div className="d-flex mt-3"> <div className="left"> <h5>Payment</h5> </div> <div className="right d-flex flex-column"> {/* LIST BANK */} {sellerPayments.map((payment)=> ( <div className="d-flex mb-2"> <input type="text" value={payment.bankName} className="form-control left" disabled/> <input type="text" value={payment.bankAccountNumber} className="form-control right ml-3" disabled/> {edit.change && (<span className="pointer ml-5" onClick={(e) => showModalDeletePayment(e, payment.id)}> <i className="fas fa-trash"/> </span>)} </div> ))} {/* ADD BANK */} {edit.change && (<form onSubmit={onSubmitPayment} className="d-flex"> <select className="form-select left" onChange={(e)=> setBankId(parseInt(e.target.value))}> <option value="">Chose Payment</option> {adminPayments.map((payment)=> ( <option value={payment.id}>{payment.bankName}</option> ))} </select> <input type="text" placeholder="Account Number" className="form-control right ml-3" onChange={(e)=> setBankAccountNumber(e.target.value)} value={bankAccountNumber}/> <button type="submit" className="px-3 save my-auto ml-4">Add</button> </form>)} </div> </div> <div className="d-flex mt-3"> <div className="left"> <h5>Shipment</h5> </div> <div className="right d-flex flex-column"> {/* LIST SHIPMENT */} {sellerShipments.map((shipment)=> ( <div className="d-flex mb-2"> <input type="text" value={shipment.shippingName} className="form-control left" disabled/> <input type="text" value={shipment.shippingCost} className="form-control right ml-3" disabled/> {edit.change && (<span className="pointer ml-5" onClick={(e) => showModalDeleteShipment(e, shipment.id)}> <i className="fas fa-trash"/> </span>)} </div> ))} {/* ADD SHIPMENT */} {edit.change && (<form className="d-flex" onSubmit={onSubmitShipment}> <select className="form-select leftRight" onChange={(e)=> setShippingMethodId(parseInt(e.target.value))}> <option value="">Chose Shipment</option> {adminShipments.map((payment)=> ( <option value={payment.id}>{payment.shippingMethodName}</option> ))} </select> <button type="submit" className="px-3 save my-auto ml-4">Add</button> </form>)} </div> </div> </div> <ModalDelete id="modalDeletePaymentInfo" handleOnDelete={handleOnDeletePayment} text="Corfirm for delete this Payment!"/> <ModalDelete id="modalDeleteShipmentInfo" handleOnDelete={handleOnDeleteShipment} text="Corfirm for delete this Shipment!"/> </div> ) } const mapStateToProps = state => ({ adminPayments: state.adminPayments, adminShipments : state.adminShipments, sellerPayments : state.sellerPayments, sellerShipments : state.sellerShipments }); const mapDispatchToProps = dispatch => ({ dispatchFetchAllAdminPaymentAction: () => dispatch(fetchAllAdminPayment()), dispatchFetchAllAdminShipmentAction: () => dispatch(fetchAllAdminShipment()), //seller payment and shipment dispatchFetchAllSellerPaymentAction: (storeId) => dispatch(fetchAllSellerPayment(storeId)), dispatchFetchAllSellerShipmentAction: (storeId) => dispatch(fetchAllSellerShipment(storeId)), dispatchCreateSellerPayment: (data, onSuccess, onError) => dispatch(createSellerPayment(data, onSuccess, onError)), dispatchCreateSellerShipment: (data, onSuccess, onError) => dispatch(createSellerShipment(data, onSuccess, onError)), dispatchDeleteSellerPayment: (id, onSuccess, onError) => dispatch(deleteSellerPayment(id, onSuccess, onError)), dispatchDeleteSellerShipment: (id, onSuccess, onError) => dispatch(deleteSellerShipment(id, onSuccess, onError)), //others dispatchGetStoreByIdAction: (storeId, onSuccess) => dispatch(getStoreById(storeId, onSuccess)), dispatchUpdateStoreAction: (id, data, onSuccess, onError) => dispatch(updateStoreById(id, data, onSuccess, onError)) }); export default connect(mapStateToProps, mapDispatchToProps)(Information);
const PageList = (totalItems, itemsPerPage, pages = []) => { const rounded = Math.ceil(totalItems / itemsPerPage); for (let i = 1; i <= rounded; i++) { pages.push(i); } return pages; }; export default PageList;
(function() { "use strict"; const APP_SERVER_KEY = "BN6oGHmUe7MPtJNrpJzWSPjm-Iy3HmRo1TuvNcKgsGuwCBYYXDjXrM8r5wvFRdZO0kEnct_TDaX4sGTdIarLrJg"; // Public Key: // BN6oGHmUe7MPtJNrpJzWSPjm-Iy3HmRo1TuvNcKgsGuwCBYYXDjXrM8r5wvFRdZO0kEnct_TDaX4sGTdIarLrJg // // Private Key: // um6cg6CWjqFo3Evs4xkejSca4BhxYfRBfiTRsCRGZy0 window.addEventListener("load", init); // let time1; // let time2; function init() { // first parameter is name of device // second parameter is the call to be made after create deviceInfo // third one is for the function to call after the second function call // createDevice("t1", null, null); // deviceLogin("t2"); // deviceInfo("t3"); // deviceDisconnect("t4"); // updateDevice("t5"); document.getElementById("notify-me").addEventListener("click", notifyMe); document.getElementById("get-location").addEventListener("click", getLocation); } async function notifyMe() { // Register Service Worker console.log("Registering service worker..."); const register = await navigator.serviceWorker.register("/service-worker.js", { scope: "/" }).then(console.error); console.log("Service Worker Registered..."); // Register Push console.log("Registering Push..."); const subscription = await register.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: urlBase64ToUint8Array(APP_SERVER_KEY) }).then(console.error); console.log("Push Registered..."); // Send Push Notification console.log("Sending Push..."); await fetch("/subscribe", { method: "POST", body: JSON.stringify(subscription), headers: { "content-type": "application/json" } }).then(console.error); console.log("Push Sent..."); } function urlBase64ToUint8Array(base64String) { const padding = "=".repeat((4 - base64String.length % 4) % 4); const base64 = (base64String + padding) .replace(/\-/g, "+") .replace(/_/g, "/"); const rawData = window.atob(base64); const outputArray = new Uint8Array(rawData.length); for (let i = 0; i < rawData.length; ++i) { outputArray[i] = rawData.charCodeAt(i); } return outputArray; } function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(pos) { position(pos); }, function(err) { // permissionDenied(err); // getLocation(); console.error(err); }, {timeout:10000}); } } function position(position) { let pos = { lat: position.coords.latitude, lng: position.coords.longitude }; console.log(pos); } function deviceDisconnect(name) { createDevice(name, connectDevice, disconnect); } function deviceInfo(name) { createDevice(name, getInfo, null); } function updateDevice(name) { createDevice(name, updateDeviceInfo, null); } function updateDeviceInfo(bearer, deviceName, nextCall) { let time1 = performance.now(); let settings = { "async": true, "crossDomain": true, "url": "https://api.bfranzen.me/device-info", "method": "PATCH", "headers": { "Content-Type": "application/json", "Authorization": bearer, // "User-Agent": "PostmanRuntime/7.11.0", // "Accept": "*/*", // "Cache-Control": "no-cache", // "Postman-Token": "266e2fc8-94a4-4c8e-8e09-a37c89790339,0fd799d6-145d-40bc-a04c-6f9954db5be8", // "Host": "api.bfranzen.me", // "accept-encoding": "gzip, deflate", // "content-length": "170", // "Connection": "keep-alive", // "cache-control": "no-cache" }, "processData": false, "data": "{\n\t\"name\": \"test_changeeeee\",\n\t\"latitude\": 333,\n\t\"longitude\": 333,\n\t\"email\": \"testingchange@changechange.com\",\n\t\"phone\": \"\",\n\t\"status\": \"\",\n\t\"oldPassword\": \"\",\n\t\"password\": \"\",\n\t\"passwordConf\": \"\"\n}" } $.ajax(settings).done(function (response) { let time2 = performance.now(); let bd = document.querySelector("body"); let p = document.createElement("p"); p.setAttribute("id", "update-time"); p.innerText = "Time to update device info is " + (time2 - time1) / 1000 + " seconds"; bd.appendChild(p); console.log(response); }); } function disconnect(data, bearer) { let time1 = performance.now() let settings = { "async": true, "crossDomain": true, "url": "https://api.bfranzen.me/disconnect", "method": "DELETE", "headers": { "Content-Type": "application/json", "Authorization": bearer // "cache-control": "no-cache", // "Postman-Token": "be187d81-5a0f-4958-b507-de958572128d" }, "processData": false, "data": data } $.ajax(settings).done(function (response) { let time2 = performance.now(); let bd = document.querySelector("body"); let p = document.createElement("p"); p.setAttribute("id", "disconnect-time"); p.innerText = "Time to disconnect is " + (time2 - time1) / 1000 + " seconds"; bd.appendChild(p); console.log(response); }); } function getInfo(bearer, deviceName, next) { let time1 = performance.now(); let settings = { "async": true, "crossDomain": true, "url": "https://api.bfranzen.me/device-info/", "method": "GET", "headers": { "Content-Type": "application/json", "Authorization": bearer }, "processData": false, "data": "{\n\t\"name\": \""+deviceName+"\",\n\t\"password\": \"1234567\",\n\t\"passwordConf\": \"1234567\"\n}" } $.ajax(settings).done(function (response) { let time2 = performance.now(); console.log(response); let bd = document.querySelector("body"); let p = document.createElement("p"); p.setAttribute("id", "getinfo-time"); p.innerText = "Getting device info took " + ((time2 - time1)/1000) + " seconds."; bd.appendChild(p); }); } // Creates a device then logs in function deviceLogin() { createDevice(connectDevice); } // Makes ajax call to the connect endpoint to connect/login to a device function connectDevice(bearer, deviceName, nextCall) { let time1 = performance.now(); let data = "{\n\t\"name\": \""+ deviceName + "\",\n\t\"latitude\": 123,\n\t\"longitude\": 234,\n\t\"email\": \"tesst@test\",\n\t\"phone\": \"12345\",\n\t\"password\": \"1234567\",\n\t\"passwordConf\": \"1234567\"\n}"; let settings = { "async": true, "crossDomain": true, "url": "https://api.bfranzen.me/connect", "method": "POST", "headers": { "Content-Type": "application/json", "Authorization": bearer // "cache-control": "no-cache", // "Postman-Token": "a666feca-010b-4179-8bf4-a23c5b4846bd" }, "processData": false, "data": data } $.ajax(settings).done(function (response) { let time2 = performance.now(); console.log(response); if (nextCall === null) { let bd = document.querySelector("body"); let p = document.createElement("p"); p.setAttribute("id", "connect-time"); p.innerText = "Logging into a device took " + ((time2 - time1)/1000) + " seconds."; bd.appendChild(p); } else { nextCall(data, bearer); } }); } // Sends ajax request to create a device, if login is true // it will use credentials to login function createDevice(name, func, nextCall) { let baseName = "timeDisconnect1"; let time1 = performance.now(); // let time2 = performance.now(); let numDevices = 1; for (let i = 0; i < numDevices; i++) { let deviceName = "updateThreeTime2"; let settings = { "async": true, "crossDomain": true, "url": "https://api.bfranzen.me/device", "method": "POST", "headers": { "Content-Type": "application/json", }, "processData": false, "data": "{\n\t\"name\": \""+ deviceName +"\",\n\t\"latitude\": 123,\n\t\"longitude\": 234,\n\t\"email\": \"tesst@test\",\n\t\"phone\": \"12345\",\n\t\"password\": \"1234567\",\n\t\"passwordConf\": \"1234567\"\n}" } let jqxhr = $.ajax(settings) jqxhr.done(function (response) { let time2 = performance.now(); console.log(response); let bearer = jqxhr.getResponseHeader("Authorization"); if (func !== null) { func(bearer, deviceName, nextCall); } else { let bd = document.querySelector("body"); let p = document.createElement("p"); p.setAttribute("id", "createdevice-time"); p.innerText = "Creating a device took " + ((time2 - time1)/1000) + " seconds."; bd.appendChild(p); } }); } } })();
const concat = require('./concat'); test('join Orin and ami to be Orinami', () => { expect(concat('Orin', 'ami')).toBe('Orinami'); });
function get_citylist(StateId){ $.post(SITE_URL + '/city/get_city_by_stateid', { StateId: StateId }, function (responsedata, status) { //var response = JSON.parse(responsedata); $('#CityId').html(responsedata); }); } $(document).ready(function (e) { $("#form_distributor_save").on('submit', (function (e) { var validate=0; var DistributorName = $('#DistributorName').val(); if ($.trim(DistributorName)=='' && validate==0) { $('#DistributorName').focus(); alertify.alert('Please enter Distributor Name.'); var validate=1; } if (!valid_alpha.test(DistributorName) && validate==0) { $('#DistributorName').focus(); alertify.alert('Please enter Distributor Name in Words.'); var validate=1; } var AssociationType = $('#AssociationType').val(); if ($.trim(AssociationType)=='' && validate==0) { $('#AssociationType').focus(); alertify.alert('Please enter Association Type.'); var validate=1; } if (!valid_alpha.test(AssociationType) && validate==0) { $('#AssociationType').focus(); alertify.alert('Please enter Association Type in Words.'); var validate=1; } var DistributorContactNo = $('#DistributorContactNo').val(); if ($.trim(DistributorContactNo)=='' && validate==0) { $('#DistributorContactNo').focus(); alertify.alert('Please enter Distributor Contact No.'); var validate=1; } if (!valid_phone_numeric.test(DistributorContactNo) && validate==0) { $('#DistributorContactNo').focus(); alertify.alert('Please enter Distributor Contact No in Numbers between 6 to 10 digit.'); var validate=1; } var DistributorEmail = $('#DistributorEmail').val(); if ($.trim(DistributorEmail)!='' && validate==0) { if (!valid_emailid.test(DistributorEmail) && validate==0) { $('#DistributorEmail').focus(); alertify.alert('Please enter Distributor Email properly.'); var validate=1; } } var DistributorAddress = $('#DistributorAddress').val(); if ($.trim(DistributorAddress)=='' && validate==0) { $('#DistributorAddress').focus(); alertify.alert('Please enter Distributor Address'); var validate=1; } var StateId = $('#StateId').val(); if ($.trim(StateId)=='' && validate==0) { $('#StateId').focus(); alertify.alert('Please select State'); var validate=1; } var CityId = $('#CityId').val(); if ($.trim(CityId)=='' && validate==0) { $('#CityId').focus(); alertify.alert('Please select City'); var validate=1; } var TotalMargins = $('#TotalMargins').val(); if ($.trim(TotalMargins)!='' && validate==0) { if (!valid_amount_numeric.test(TotalMargins) && validate==0) { $('#TotalMargins').focus(); alertify.alert('Please enter Total Margins in words or numbers or both.'); var validate=1; } } var DSAMargins = $('#DSAMargins').val(); if ($.trim(DSAMargins)!='' && validate==0) { if (!valid_amount_numeric.test(DSAMargins) && validate==0) { $('#DSAMargins').focus(); alertify.alert('Please enter DSA Margins in words or numbers or both.'); var validate=1; } } var OutgoingFreight = $('#OutgoingFreight').val(); if ($.trim(OutgoingFreight)!='' && validate==0) { if (!valid_amount_numeric.test(OutgoingFreight) && validate==0) { $('#OutgoingFreight').focus(); alertify.alert('Please enter Outgoing Freight in words or numbers or both.'); var validate=1; } } var StockiestIncentives = $('#StockiestIncentives').val(); if ($.trim(StockiestIncentives)!='' && validate==0) { if (!valid_amount_numeric.test(StockiestIncentives) && validate==0) { $('#StockiestIncentives').focus(); alertify.alert('Please enter Stockiest Incentives in words or numbers or both.'); var validate=1; } } var FieldStaffSalary = $('#FieldStaffSalary').val(); if ($.trim(FieldStaffSalary)!='' && validate==0) { if (!valid_amount_numeric.test(FieldStaffSalary) && validate==0) { $('#FieldStaffSalary').focus(); alertify.alert('Please enter Field Staff Salary in words or numbers or both.'); var validate=1; } } var FieldStaffExpenses = $('#FieldStaffExpenses').val(); if ($.trim(FieldStaffExpenses)!='' && validate==0) { if (!valid_amount_numeric.test(FieldStaffExpenses) && validate==0) { $('#FieldStaffExpenses').focus(); alertify.alert('Please enter Field Staff Expenses in words or numbers or both.'); var validate=1; } } var FieldStaffIncentives = $('#FieldStaffIncentives').val(); if ($.trim(FieldStaffIncentives)!='' && validate==0) { if (!valid_alphanumeric.test(FieldStaffIncentives) && validate==0) { $('#FieldStaffIncentives').focus(); alertify.alert('Please enter Field Staff Incentives in words or numbers or both.'); var validate=1; } } var FieldStaffPayrol = $('#FieldStaffPayrol').val(); if ($.trim(FieldStaffPayrol)!='' && validate==0) { if (!valid_alphanumeric.test(FieldStaffPayrol) && validate==0) { $('#FieldStaffPayrol').focus(); alertify.alert('Please enter Field Staff Payrol in words or numbers or both.'); var validate=1; } } var PaymentMode = $('#PaymentMode').val(); if ($.trim(PaymentMode)!='' && validate==0) { if (!valid_alphanumeric.test(PaymentMode) && validate==0) { $('#PaymentMode').focus(); alertify.alert('Please enter Payment Mode in words or numbers or both.'); var validate=1; } } var TotalSalesPerson = $('#TotalSalesPerson').val(); if ($.trim(TotalSalesPerson)!='' && validate==0) { if (!valid_alphanumeric.test(TotalSalesPerson) && validate==0) { $('#TotalSalesPerson').focus(); alertify.alert('Please enter Total Sales Person in words or numbers or both.'); var validate=1; } } if(validate==0){ $('#submit').attr('disabled','disabled'); e.preventDefault(); $.ajax({ url: SITE_URL+'/distributor/distributor_save', // Url to which the request is send type: "POST", // Type of request to be send, called as method data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values) contentType: false, // The content type used when sending data to the server. cache: false, // To unable request pages to be cached processData: false, // To send DOMDocument or non processed data file it is set to false success: function (data) // A function to be called if request succeeds { data = data.trim(); if(data) { try { var response = JSON.parse(data); if(response.status == '1') { //$('#submit').removeAttr('disabled'); alertify.alert(response.msg); window.location.href=SITE_URL+'/distributor/distributor_add'; } else { //$('#submit').removeAttr('disabled'); alertify.alert(response.msg); } } catch(e) { alertify.alert(e); // error in the above string (in this case, yes)! } } } }); } // validation ends here })); }); $(document).ready(function (e) { $("#form_distributor_update").on('submit', (function (e) { var validate=0; var DistributorName = $('#DistributorName').val(); if ($.trim(DistributorName)=='' && validate==0) { $('#DistributorName').focus(); alertify.alert('Please enter Distributor Name.'); var validate=1; } if (!valid_alpha.test(DistributorName) && validate==0) { $('#DistributorName').focus(); alertify.alert('Please enter Distributor Name in Words.'); var validate=1; } var AssociationType = $('#AssociationType').val(); if ($.trim(AssociationType)=='' && validate==0) { $('#AssociationType').focus(); alertify.alert('Please enter Association Type.'); var validate=1; } if (!valid_alpha.test(AssociationType) && validate==0) { $('#AssociationType').focus(); alertify.alert('Please enter Association Type in Words.'); var validate=1; } var DistributorContactNo = $('#DistributorContactNo').val(); if ($.trim(DistributorContactNo)=='' && validate==0) { $('#DistributorContactNo').focus(); alertify.alert('Please enter Distributor Contact No.'); var validate=1; } if (!valid_phone_numeric.test(DistributorContactNo) && validate==0) { $('#DistributorContactNo').focus(); alertify.alert('Please enter Distributor Contact No in Numbers between 6 to 10 digit.'); var validate=1; } var DistributorEmail = $('#DistributorEmail').val(); if ($.trim(DistributorEmail)!='' && validate==0) { if (!valid_emailid.test(DistributorEmail) && validate==0) { $('#DistributorEmail').focus(); alertify.alert('Please enter Distributor Email properly.'); var validate=1; } } var DistributorAddress = $('#DistributorAddress').val(); if ($.trim(DistributorAddress)=='' && validate==0) { $('#DistributorAddress').focus(); alertify.alert('Please enter Distributor Address'); var validate=1; } var StateId = $('#StateId').val(); if ($.trim(StateId)=='' && validate==0) { $('#StateId').focus(); alertify.alert('Please select State'); var validate=1; } var CityId = $('#CityId').val(); if ($.trim(CityId)=='' && validate==0) { $('#CityId').focus(); alertify.alert('Please select City'); var validate=1; } var TotalMargins = $('#TotalMargins').val(); if ($.trim(TotalMargins)!='' && validate==0) { if (!valid_amount_numeric.test(TotalMargins) && validate==0) { $('#TotalMargins').focus(); alertify.alert('Please enter Total Margins in words or numbers or both.'); var validate=1; } } var DSAMargins = $('#DSAMargins').val(); if ($.trim(DSAMargins)!='' && validate==0) { if (!valid_amount_numeric.test(DSAMargins) && validate==0) { $('#DSAMargins').focus(); alertify.alert('Please enter DSA Margins in words or numbers or both.'); var validate=1; } } var OutgoingFreight = $('#OutgoingFreight').val(); if ($.trim(OutgoingFreight)!='' && validate==0) { if (!valid_amount_numeric.test(OutgoingFreight) && validate==0) { $('#OutgoingFreight').focus(); alertify.alert('Please enter Outgoing Freight in words or numbers or both.'); var validate=1; } } var StockiestIncentives = $('#StockiestIncentives').val(); if ($.trim(StockiestIncentives)!='' && validate==0) { if (!valid_amount_numeric.test(StockiestIncentives) && validate==0) { $('#StockiestIncentives').focus(); alertify.alert('Please enter Stockiest Incentives in words or numbers or both.'); var validate=1; } } var FieldStaffSalary = $('#FieldStaffSalary').val(); if ($.trim(FieldStaffSalary)!='' && validate==0) { if (!valid_amount_numeric.test(FieldStaffSalary) && validate==0) { $('#FieldStaffSalary').focus(); alertify.alert('Please enter Field Staff Salary in words or numbers or both.'); var validate=1; } } var FieldStaffExpenses = $('#FieldStaffExpenses').val(); if ($.trim(FieldStaffExpenses)!='' && validate==0) { if (!valid_amount_numeric.test(FieldStaffExpenses) && validate==0) { $('#FieldStaffExpenses').focus(); alertify.alert('Please enter Field Staff Expenses in words or numbers or both.'); var validate=1; } } var FieldStaffIncentives = $('#FieldStaffIncentives').val(); if ($.trim(FieldStaffIncentives)!='' && validate==0) { if (!valid_alphanumeric.test(FieldStaffIncentives) && validate==0) { $('#FieldStaffIncentives').focus(); alertify.alert('Please enter Field Staff Incentives in words or numbers or both.'); var validate=1; } } var FieldStaffPayrol = $('#FieldStaffPayrol').val(); if ($.trim(FieldStaffPayrol)!='' && validate==0) { if (!valid_alphanumeric.test(FieldStaffPayrol) && validate==0) { $('#FieldStaffPayrol').focus(); alertify.alert('Please enter Field Staff Payrol in words or numbers or both.'); var validate=1; } } var PaymentMode = $('#PaymentMode').val(); if ($.trim(PaymentMode)!='' && validate==0) { if (!valid_alphanumeric.test(PaymentMode) && validate==0) { $('#PaymentMode').focus(); alertify.alert('Please enter Payment Mode in words or numbers or both.'); var validate=1; } } var TotalSalesPerson = $('#TotalSalesPerson').val(); if ($.trim(TotalSalesPerson)!='' && validate==0) { if (!valid_alphanumeric.test(TotalSalesPerson) && validate==0) { $('#TotalSalesPerson').focus(); alertify.alert('Please enter Total Sales Person in words or numbers or both.'); var validate=1; } } if(validate==0){ $('#submit').attr('disabled','disabled'); e.preventDefault(); $.ajax({ url: SITE_URL+'/distributor/distributor_update', // Url to which the request is send type: "POST", // Type of request to be send, called as method data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values) contentType: false, // The content type used when sending data to the server. cache: false, // To unable request pages to be cached processData: false, // To send DOMDocument or non processed data file it is set to false success: function (data) // A function to be called if request succeeds { data = data.trim(); if(data) { try { var response = JSON.parse(data); if(response.status == '1') { //$('#submit').removeAttr('disabled'); alertify.alert(response.msg); } else { //$('#submit').removeAttr('disabled'); alertify.alert(response.msg); } } catch(e) { alertify.alert(e); // error in the above string (in this case, yes)! } } } }); } // validation ends here })); });
myModule.service('CalcService',['$window',function($window){ console.log('Calc Service created.'); this.setClientName = function(value){ $window.localStorage.setItem('clientName', value); } this.getClientName = function(value){ return $window.localStorage.getItem('clientName', value); } this.doSquare = function(val){ return val * val; }; this.doCube = function(val){ return val * val * val; }; }]);
import React from 'react'; import {CLeftBlock} from '../components/centeredblock'; import {Section} from '../components/Section/Section'; import {LeftBlock} from '../components/Block/Block'; import {Col, Grid, Row} from 'react-flexbox-grid'; import Page from '../components/Page/Page'; import PageHeader from '../components/PageHeader/PageHeader'; type MonetaryPolicyProps = { } function MonetaryPolicy(props: MonetaryPolicyProps) { return ( <Page name='monetary-policy'> <PageHeader subHeader="Refunds for speakers">Reimbursement Policy</PageHeader> <Section> <LeftBlock header="What & How"> <p> If your presentation or a workshop is accepted, you may apply for a refund for travel and accomodation. Read below to find out if you are eligeble. </p> </LeftBlock> <LeftBlock header="How to apply"> <p> The first thing to note is that you need to <em>apply </em> for reminbursement of costs. This is necessary for our budget planning. If you require financial support, please reach out to <a href='mailto:program@soskonf.no'>program@soskonf.no</a> after your session or workshop was accepted. </p> <p> In this mail, provide an estimate of your travel expenses and the days you will be visiting Trondheim during the conference. </p> <p> Note that we refund a maximum of 1500 NOK a night for accomodation costs <strong>during</strong> the conference. We do not refund travel costs above the cost of a reasonably priced economy ticket. </p> </LeftBlock> <LeftBlock header="Confirmation & reimbursement"> <p> Applications <strong><em>must</em></strong> be confirmed explicitly via <a href='mailto:program@soskonf.no'>program@soskonf.no</a> and are only accepted prior to our conference. Reimbursements are provided after the conference. For this, we require you to send us copies of all receipts, the name of your bank and international account numbers (IBAN, BIC/SWIFT, if available). We reserve the right to decline a refund application. Speakers living in proximity to Trondheim are not eligible. </p> <p> Reimbursements are processed and payed after the conference. We will reach out to speakers who applied for reimbursement and process the payments once payment details are provided. </p> </LeftBlock> </Section> </Page> ) } export default MonetaryPolicy;
import React from "react"; import styled from "styled-components"; import Grid from "../components/Grid"; import WeatherCardInput from "../components/WeatherCardInput"; import ShowWeatherCard from "../components/WeatherCardOutput"; import AddSection from "../components/AddSectionForm"; import HeaderForm from "../components/HeaderForm"; import CardOutputFooter from "../components/CardOutputFooter"; import StyledCardOutput from "../components/StyledCardOutput"; import { getHouseholdFromStorage, setHouseholdtoStorage } from "../utils/storage"; const StyledForm = styled.form``; const GridBody = styled.div` display: flex; flex-direction: column; align-items: center; justify-content: baseline; overflow: auto; `; function AddClothingData({ history }) { const [household, setHousehold] = React.useState(getHouseholdFromStorage()); const [selectedId, setSelectedId] = React.useState(null); const [renderAddWeatherCard, setRenderAddWeatherCard] = React.useState( false ); function handleChange(event) { setHousehold({ ...household.clothing, [event.target.name]: event.target.value }); } function handleSubmit(event) { event.preventDefault(); setHouseholdtoStorage(household); history.replace("/familyMenu"); } function handleCancel() { history.push("/familyMenu"); } function showAddWeatherCard() { setRenderAddWeatherCard(true); } function hideAddWeatherCard() { setRenderAddWeatherCard(false); } function handleDelete(id) { setHousehold({ ...household, clothing: household.clothing.filter(card => card.id !== id) }); } return ( <Grid type="form"> <HeaderForm submit="submit" handleSubmit={handleSubmit} button="button" handleCancel={handleCancel} title="Clothing" /> <AddSection onClick={showAddWeatherCard} titleHeadline="Add information" /> <GridBody> <StyledForm> {renderAddWeatherCard && ( <WeatherCardInput defaultValues={ household.clothing && household.clothing.find( item => item.id === selectedId ) } household={household} setHousehold={setHousehold} onChange={handleChange} onClose={hideAddWeatherCard} /> )} {household.clothing && household.clothing.map(clothes => ( <StyledCardOutput key={clothes.id}> <ShowWeatherCard category={clothes.category} temperatur={clothes.temperatur} degree={clothes.degree} description={clothes.description} assigned={clothes.assigned} household={household} /> <CardOutputFooter onEditClick={() => { setSelectedId(clothes.id); setRenderAddWeatherCard(true); }} onDeleteClick={() => handleDelete(clothes.id) } /> </StyledCardOutput> ))} </StyledForm> </GridBody> </Grid> ); } export default AddClothingData;
const gulp = require('gulp'); const del = require('del'); const targetFolder = './bin/'; gulp.task('clean:bin', () => del([ targetFolder, ]) ); gulp.task('clean:dist', () => del([ './dist/', ]) );
/* 🤖 this file was generated by svg-to-ts*/ export const EOSIconsJob = { name: 'job', data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 16.28V11l3-3-4-4-3 3H8V6h3V2H3v4h3v6H3v4h3v5h4.28A2 2 0 0012 22a2 2 0 10-1.72-3H8v-3h3v-4H8V9h7l2 2v5.27a2 2 0 102 0zM4 5V3h6v2zm8 14a1 1 0 11-1 1 1 1 0 011-1zm-2-6v2H4v-2zm8-7.59L20.59 8 18 10.59 15.41 8zM18 19a1 1 0 111-1 1 1 0 01-1 1z"/></svg>` };
enchant(); window.onload = function() { var Rectangle = enchant.Class.create({ initialize: function(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; }, right: { get: function() { return this.x + this.width; } }, bottom: { get: function() { return this.y + this.height; } } }); var game = new Game(320, 320); game.fps = 24; game.keybind(90, 'a'); //z game.keybind(88, 'b'); //x /*var state = new Label(); state.text = "初期化中"; state.color = "#000000"; state.x = 200; state.y = 265; state.visible = true;*/ game.preload('bar001.gif','bar002.gif','chara001.gif','shot_button.png','end_score.png', 'shot.gif','enemy004.gif','map1.gif','chara002.gif','enemy_shot002.gif','enemy003.gif', 'baku001.gif','baku002.gif','enemy_shot003.gif','hantei002.gif','hantei001.gif', 'enemy005.gif','enemy007.gif','boss001.gif','hou001.gif','hou002.gif','hantei003.gif', 'baku003.gif','enemy_shot004.gif','enemy_shot005.gif','num.gif','ita.gif','bar_back.gif'); var enemys = []; //エネミーの初期設定 var shots = []; //弾の初期設定; var max_shot = 5; //弾の最大発射数 var now_shot = 0; var shot_lag = 2; //一度打った後次の弾が撃てるようになるまでのフレーム数。 var shot_frame = 0; var shot_h = 0; var shot_fra = 0; var max_shot_e = 5; //弾の最大発射数 var now_shot_e = 0; var shot_e_lag = 2; //一度打った後次の弾が撃てるようになるまでのフレーム数。 var shot_e_frame = 0; var shot_e_h = 0; var shot_e_fra = 0; var enemy_d_x var enemy_d_y var enemy_d_001_shot = 0; var enemy_d_002_shot = 0; var enemy_d_001_hp = 10; var enemy_d_002_hp = 10; var enemy_d_001_hit = 0; var enemy_d_002_hit = 0; var enemy001_d_x var enemy001_d_y var denzi001_h = 0; var denzi002_h = 0; var denzi003_h = 0; var denzi001_hit_h = 1; var denzi002_hit_h = 1; var denzi003_hit_h = 1; var now_shot_001 = 0; var now_shot_002 = 0; var now_shot_003 = 0; var now_shot_004 = 0; var now_shot_005 = 0; var hou001_shot = 20; var hou002_shot = 20; var hou003_shot = 20; var hou004_shot = 20; var hou005_shot = 30; var hou001_hp = 20; var hou002_hp = 20; var hou003_hp = 20; var hou004_hp = 20; var hou005_hp = 30; var hou001_hit = 0; var hou002_hit = 0; var hou003_hit = 0; var hou004_hit = 0; var hou005_hit = 0; var baku_hou_x var baku_hou_y var my_score_h = 0; var my_time_h = 0; var end_score_h = 0; var end_time_h = 0; var end_hp_h = 0; var end_des_h = 0; var end_total_h = 0; var end_h = 0; var end_count_h = 0; game.keybind(32, 'space'); //キーバインドの設定 game.onload = function() { var test_h = 0; var test_y = 0; var test_f = 0; var test_g = 0; var guns_h = 0; ene = new Array(10); var enemy_h = 0; var bar001 = new Bar(); bar001.image = game.assets['bar001.gif']; bar001.x = 30; bar001.y = 5; bar001.value = 150; var bar002 = new Bar(); bar002.image = game.assets['bar002.gif']; bar002.x = 30; bar002.y = 17; bar002.value = 200; var blocks = [ [38,40,37,84,85,39,38,37,36,39,40,57,54,56,41,38,57,84,85,36,41,37,54,56,38,36,40,57,41,37,38,36,41,37,36,40,57,41,40,50,51,36,56,36,39,38,57,41,40,41,39,38,57,40,84,85,55,36,39,41,56,54,55,37,40,84,85,36,55,36,39,40,57,41,57,36,39,40,57,37,38,50,51,39,40,37,38,84,85,36,55,56,38,36,55,57,41,37,38,41,50,51,36,40,54,39,40,84,85,57,36,39,41,40,55,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [41,53,96,104,102,99,104,105,102,100,52,53,99,101,98,99,97,99,100,102,103,98,99,101,96,100,102,104,99,97,98,102,99,96,103,105,100,99,97,103,96,104,52,53,99,96,97,100,102,97,96,100,102,97,98,105,99,103,104,105,52,53,99,97,98,52,39,38,36,41,55,41,53,100,101,98,52,53,96,103,97,99,104,102,97,100,101,98,96,103,100,102,104,100,101,96,102,103,103,97,98,102,104,105,99,102,103,104,101,99,96,103,104,101,98,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [57,33,-1,-1,-1,-1,-1,-1,-1,-1,32,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,65,-1,-1,-1,70,100,52,53,102,71,103,72,-1,-1,-1,32,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,48,56,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [39,81,-1,-1,-1,-1,-1,-1,-1,-1,48,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,80,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,65,-1,-1,-1,86,0,82,83,0,87,0,88,-1,-1,-1,64,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,32,37,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [40,65,-1,-1,-1,-1,-1,-1,-1,-1,82,83,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,64,49,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,64,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,48,39,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [37,49,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,66,67,-1,-1,-1,-1,66,21,18,23,67,-1,-1,-1,-1,-1,48,69,20,25,19,16,17,19,22,24,23,16,21,25,67,-1,-1,-1,32,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,64,49,-1,-1,-1,-1,-1,66,67,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,64,40,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [56,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,80,65,-1,-1,-1,-1,48,39,40,54,65,-1,-1,-1,-1,-1,82,105,96,103,104,105,99,97,100,96,103,105,99,103,83,-1,-1,-1,80,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,65,-1,-1,-1,-1,-1,64,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,80,55,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [57,33,-1,-1,-1,-1,-1,-1,-1,-1,66,67,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,49,-1,-1,-1,-1,82,99,97,98,83,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,49,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,33,-1,-1,-1,-1,-1,32,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,48,57,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [55,49,-1,-1,-1,-1,-1,-1,-1,-1,48,49,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,82,83,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,80,81,-1,-1,-1,-1,-1,80,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,66,67,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,64,39,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [35,81,-1,-1,-1,-1,-1,-1,-1,-1,32,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,82,83,-1,-1,-1,-1,-1,64,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,82,83,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,80,37,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [51,33,-1,-1,-1,-1,-1,-1,66,25,68,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,64,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,66,19,24,67,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,73,0,66,67,0,74,0,75,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,33,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,64,40,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [57,65,-1,-1,-1,-1,-1,-1,64,57,54,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,32,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,48,34,35,65,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,89,23,68,69,25,90,19,91,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,80,49,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,32,54,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [39,69,16,17,18,19,20,23,68,34,35,69,19,20,25,23,21,18,16,19,17,22,20,16,23,24,68,69,21,22,17,22,24,19,17,20,19,16,20,19,22,24,25,16,20,22,23,68,50,51,69,21,18,20,22,24,25,21,16,17,20,19,23,24,25,68,34,35,40,54,38,41,69,22,25,19,20,24,19,21,20,17,18,68,69,20,22,19,23,24,21,18,16,17,22,24,20,25,16,23,18,22,20,21,18,22,25,17,18,25,19,20,23,22,24,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [35,36,37,38,40,57,84,85,57,50,51,55,56,38,37,40,57,41,36,37,40,57,55,56,38,57,84,85,55,36,37,54,34,35,57,41,36,56,41,36,37,41,36,56,54,57,40,57,54,55,40,36,39,41,84,85,55,41,38,36,41,40,54,56,36,39,50,51,55,36,40,37,38,84,85,54,56,39,57,37,38,54,55,41,40,34,35,55,41,40,55,40,36,37,38,84,85,55,41,37,38,36,57,40,36,54,57,84,85,57,55,41,40,39,37,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1] ]; var map = new Map(16, 16); map.image = game.assets['map1.gif']; map.loadData(blocks); var my_score = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+250; ny = 10; my_score[i] = new Sprite(10,12); my_score[i].image = game.assets['num.gif']; my_score[i].x = nx; my_score[i].y = ny; my_score[i].visible = false; } var my_time = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+250; ny = 200; my_time[i] = new Sprite(10,12); my_time[i].image = game.assets['num.gif']; my_time[i].x = nx; my_time[i].y = ny; my_time[i].visible = false; } var end_score_num = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+230; ny = 68; end_score_num[i] = new Sprite(10,12); end_score_num[i].image = game.assets['num.gif']; end_score_num[i].x = nx; end_score_num[i].y = ny; end_score_num[i].visible = false; } var end_time_num = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+230; ny = 109; end_time_num[i] = new Sprite(10,12); end_time_num[i].image = game.assets['num.gif']; end_time_num[i].x = nx; end_time_num[i].y = ny; end_time_num[i].visible = false; } var end_hp_num = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+230; ny = 150; end_hp_num[i] = new Sprite(10,12); end_hp_num[i].image = game.assets['num.gif']; end_hp_num[i].x = nx; end_hp_num[i].y = ny; end_hp_num[i].visible = false; } var end_des_num = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+230; ny = 199; end_des_num[i] = new Sprite(10,12); end_des_num[i].image = game.assets['num.gif']; end_des_num[i].x = nx; end_des_num[i].y = ny; end_des_num[i].visible = false; } var end_total_num = new Array(10); for(i = 0;i<5; i++){ nx = [i]*10+230; ny = 257; end_total_num[i] = new Sprite(10,12); end_total_num[i].image = game.assets['num.gif']; end_total_num[i].x = nx; end_total_num[i].y = ny; end_total_num[i].visible = false; } var shot_button = new Sprite(79,79); shot_button.image = game.assets['shot_button.png']; shot_button.x = 225; shot_button.y = 235; shot_button.frame = 0; shot_button._element.style.opacity = 0.8; shot_button.visible = true; var score_ita = new Sprite(111,18); score_ita.image = game.assets['ita.gif']; score_ita.x = 193; score_ita.y = 7; score_ita.frame = 0; score_ita.visible = true; var time_ita = new Sprite(111,18); time_ita.image = game.assets['ita.gif']; time_ita.x = 193; time_ita.y = 197; time_ita.frame = 1; time_ita.visible = true; var bar_back = new Sprite(180,26); bar_back.image = game.assets['bar_back.gif']; bar_back.x = 2; bar_back.y = 3; bar_back.frame = 0; bar_back.visible = true; var enemy_d_001 = new Sprite(48,48); enemy_d_001.image = game.assets['enemy003.gif']; enemy_d_001.x = 33 * 16; enemy_d_001.y = 2 * 16; enemy_d_001.frame = 0; enemy_d_001.visible = true; var enemy_d_002 = new Sprite(48,48); enemy_d_002.image = game.assets['enemy003.gif']; enemy_d_002.x = 48 * 16; enemy_d_002.y = 7 * 16; enemy_d_002.frame = 0; enemy_d_002.visible = true; var boss = new Sprite(80,160); boss.image = game.assets['boss001.gif']; boss.x = 108 * 16+5; boss.y = 2 * 16; boss.frame = 0; boss.visible = true; var end_score = new Sprite(320,320); end_score.image = game.assets['end_score.png']; end_score.x = 0; end_score.y = 0; end_score.frame = 0; end_score.visible = false; var hou001 = new Sprite(15,19); hou001.image = game.assets['hou001.gif']; hou001.x = 108 * 16+5; hou001.y = 2 * 16+4; hou001.frame = 0; hou001.visible = true; var hou002 = new Sprite(15,19); hou002.image = game.assets['hou001.gif']; hou002.x = 108 * 16+5; hou002.y = 4 * 16+2; hou002.frame = 0; hou002.visible = true; var hou003 = new Sprite(15,19); hou003.image = game.assets['hou001.gif']; hou003.x = 108 * 16+5; hou003.y = 8 * 16+11; hou003.frame = 0; hou003.visible = true; var hou004 = new Sprite(15,19); hou004.image = game.assets['hou001.gif']; hou004.x = 108 * 16+5; hou004.y = 10 * 16+9; hou004.frame = 0; hou004.visible = true; var hou005 = new Sprite(44,40); hou005.image = game.assets['hou002.gif']; hou005.x = 109 * 16+9+5; hou005.y = 5 * 16+12; hou005.frame = 0; hou005.visible = true; var hou005_han = new Sprite(26,26); hou005_han.image = game.assets['hantei003.gif']; hou005_han.x = 110 * 16+11+5; hou005_han.y = 6 * 16+3; hou005_han.frame = 0; hou005_han.visible = true; /*var boss_big_shot = new Sprite(64,24); boss_big_shot.image = game.assets['enemy_shot005.gif']; boss_big_shot.x = 109 * 16+9+5; boss_big_shot.y = 5 * 16+12; boss_big_shot.frame = 0; boss_big_shot.visible = false; */ var denzi001 = new Sprite(16,96); denzi001.image = game.assets['enemy_shot003.gif']; denzi001.x = 66 * 16; denzi001.y = 4 * 16; denzi001.frame = 0; denzi001.visible = true; var denzi002 = new Sprite(16,96); denzi002.image = game.assets['enemy_shot003.gif']; denzi002.x = 69 * 16; denzi002.y = 4 * 16; denzi002.frame = 1; denzi002.visible = true; var denzi003 = new Sprite(16,96); denzi003.image = game.assets['enemy_shot003.gif']; denzi003.x = 71 * 16; denzi003.y = 4 * 16; denzi003.frame = 2; denzi003.visible = true; var denzi_han001 = new Sprite(10,96); denzi_han001.image = game.assets['hantei002.gif']; denzi_han001.x = 66 * 16+3; denzi_han001.y = 4 * 16; denzi_han001.frame = 0; denzi_han001._element.style.opacity = 0.0; denzi_han001.visible = true; var denzi_han002 = new Sprite(10,96); denzi_han002.image = game.assets['hantei002.gif']; denzi_han002.x = 69 * 16+3; denzi_han002.y = 4 * 16; denzi_han002.frame = 0; denzi_han002._element.style.opacity = 0.0; denzi_han002.visible = true; var denzi_han003 = new Sprite(10,96); denzi_han003.image = game.assets['hantei002.gif']; denzi_han003.x = 71 * 16+3; denzi_han003.y = 4 * 16; denzi_han003.frame = 0; denzi_han003._element.style.opacity = 0.0; denzi_han003.visible = true; var denzi_ene001 = new Sprite(16,16); denzi_ene001.image = game.assets['enemy005.gif']; denzi_ene001.x = 66 * 16; denzi_ene001.y = 3 * 16; denzi_ene001.frame = 0; denzi_ene001.visible = true; var denzi_ene002 = new Sprite(16,16); denzi_ene002.image = game.assets['enemy005.gif']; denzi_ene002.x = 69 * 16; denzi_ene002.y = 3 * 16; denzi_ene002.frame = 2; denzi_ene002.visible = true; var denzi_ene003 = new Sprite(16,16); denzi_ene003.image = game.assets['enemy005.gif']; denzi_ene003.x = 71 * 16; denzi_ene003.y = 3 * 16; denzi_ene003.frame = 3; denzi_ene003.visible = true; var denzi_ene004 = new Sprite(16,16); denzi_ene004.image = game.assets['enemy007.gif']; denzi_ene004.x = 66 * 16; denzi_ene004.y = 10 * 16; denzi_ene004.frame = 0; denzi_ene004.visible = true; var denzi_ene005 = new Sprite(16,16); denzi_ene005.image = game.assets['enemy007.gif']; denzi_ene005.x = 69 * 16; denzi_ene005.y = 10 * 16; denzi_ene005.frame = 2; denzi_ene005.visible = true; var denzi_ene006 = new Sprite(16,16); denzi_ene006.image = game.assets['enemy007.gif']; denzi_ene006.x = 71 * 16; denzi_ene006.y = 10 * 16; denzi_ene006.frame = 3; denzi_ene006.visible = true; var stage_boss = new Group(); var guns = new Sprite(32,32); guns.image = game.assets['chara002.gif']; guns.visible = false; var player_hantei = new Sprite(18,24); player_hantei.image = game.assets['hantei001.gif']; player_hantei.visible = true; player_hantei._element.style.opacity = 0.0; var player = new Sprite(32, 32); player.x = 64; player.y = 32; player.vx = 0; player.vy = 0; player.ax = 0; player.ay = 0; player.pose = 0; player.jumping = true; player.jumpBoost = 0; player.image = game.assets['chara001.gif']; var player_h = 0; var player_hit_h = 0; player.addEventListener('enterframe', function(e) { var friction = 0; if (this.vx > 0.3) {//速度が速いとき friction = -0.3;//減速させる } else if (this.vx > 0) { friction = -this.vx; } if (this.vx < -0.3) { friction = 0.3; } else if (this.vx < 0) { friction = -this.vx; } //if (this.jumping) { if (!game.input.up || --this.jumpBoost < 0 || bar002.value <= 20) { this.ay = 0; bar002.value += 2; if(bar002.value >= 150){ bar002.value = 150; } } if (!(game.input.up)&&this.jumping == false) { bar002.value += 10; if(bar002.value >= 150){ bar002.value = 150; } } //} else { if (game.input.up) { if(bar002.value >= 20){ this.jumpBoost = 2;//ジャンプ加速度 this.ay = -0.4;//ジャンプの高さ? bar002.value -= 3; }else{ bar002.value -=3; } } // } this.ax = 0; if (game.input.left) this.ax -= 0.5; if (game.input.right) this.ax += 0.5; if (this.ax > 0&&this.jumping == false) this.scaleX = 1;//向き if (this.ax < 0&&this.jumping == false) this.scaleX = -1;//向き(反転) guns.scaleX = this.scaleX; if(this.jumping){ if (game.frame % 3 == 0) {//歩くアニメ if(player_h < 8){ player_h = 8; } player_h++; if(player_h > 10){ player_h = 9; } //this.frame = player_h; //this.pose++; //this.pose %= 2; } //this.frame = this.pose + 9; this.frame = player_h; }else if (this.ax != 0) { if (game.frame % 3 == 0) {//歩くアニメ //this.pose++; //this.pose %= 8; if(player_h == 0||player_h >= 8){ player_h = 1; } player_h++; } //this.frame = this.pose + 1; this.frame = player_h; }else{ this.frame = 0;//止まる } this.vx += this.ax + friction;// 加速度を速度に+frictionにより減速 this.vy += this.ay + 0.25 ; // 2 is gravity this.vx = Math.min(Math.max(this.vx, -8), 8);//this.vxか-10の大きい方をとる そしてその値と10の小さい方をとる this.vy = Math.min(Math.max(this.vy, -10), 10); var dest = new Rectangle( this.x + this.vx + 5, this.y + this.vy + 3, this.width-10, this.height-3 ); this.jumping = true; if (dest.x < -stage.x) {//ステージの端に言ったら速度を0? dest.x = -stage.x; this.vx = 0; } if (dest.x > -stage.x+250) {//ステージの端に言ったら速度を0? dest.x = -stage.x+250; this.vx = 0; } while (true) { var boundary, crossing; var dx = dest.x - this.x - 5; var dy = dest.y - this.y - 3; if (dx > 0 && Math.floor(dest.right / 16) != Math.floor((dest.right - dx) / 16)) { boundary = Math.floor(dest.right / 16) * 16; crossing = (dest.right - boundary) / dx * dy + dest.y; if ((map.hitTest(boundary, crossing) && !map.hitTest(boundary-16, crossing)) || (map.hitTest(boundary, crossing + dest.height) && !map.hitTest(boundary-16, crossing + dest.height))) { this.vx = 0; dest.x = boundary - dest.width - 0.01; continue; } } else if (dx < 0 && Math.floor(dest.x / 16) != Math.floor((dest.x - dx) / 16)) { boundary = Math.floor(dest.x / 16) * 16 + 16; crossing = (boundary - dest.x) / dx * dy + dest.y; if ((map.hitTest(boundary-16, crossing) && !map.hitTest(boundary, crossing)) || (map.hitTest(boundary-16, crossing + dest.height) && !map.hitTest(boundary, crossing + dest.height))) { this.vx = 0; dest.x = boundary + 0.01; continue; } } if (dy > 0 && Math.floor(dest.bottom / 16) != Math.floor((dest.bottom - dy) / 16)) { boundary = Math.floor(dest.bottom / 16) * 16; crossing = (dest.bottom - boundary) / dy * dx + dest.x; if ((map.hitTest(crossing, boundary) && !map.hitTest(crossing, boundary-16)) || (map.hitTest(crossing + dest.width, boundary) && !map.hitTest(crossing + dest.width, boundary-16))) { this.jumping = false; this.vy = 0; dest.y = boundary - dest.height - 0.01; continue; } } else if (dy < 0 && Math.floor(dest.y / 16) != Math.floor((dest.y - dy) / 16)) { boundary = Math.floor(dest.y / 16) * 16 + 16; crossing = (boundary - dest.y) / dy * dx + dest.x; if ((map.hitTest(crossing, boundary-16) && !map.hitTest(crossing, boundary)) || (map.hitTest(crossing + dest.width, boundary-16) && !map.hitTest(crossing + dest.width, boundary))) { this.vy = 0; dest.y = boundary + 0.01; continue; } } break; } this.x = dest.x-5; this.y = dest.y-3; guns.x = this.x; guns.y = this.y; player_hantei.x = this.x+7; player_hantei.y = this.y+4; for (var i = 0; i < 5; i++) { if(player_hantei.intersect(enemys[i])&&ene[i] == 1){ if(player_hit_h == 0){ player_hit_h = 1; //ダメージの減算はココ bar001.value = bar001.value - 20; } } } if(guns_h >= 1){ guns_h++; } if(guns_h >= 5){ guns_h = 0; guns.visible = false; } //ダメージを受けた時の点滅 それに伴う無敵時間 if(player_hit_h >= 1){ if (game.frame % 4 == 0) { player_hit_h++; if(player_hit_h >= 1&&player_hit_h < 8){ this.frame = this.frame +15; }else if(player_hit_h >= 8){ this._element.style.opacity = 0.5; } if(player_hit_h >= 18){ this._element.style.opacity = 1.0; player_hit_h = 0; } } } //enemy_d_001の射程範囲 enemy_d_001.frame = 0; if(enemy_d_001_shot > 0&&enemy_d_001_hp > 0){ enemy_d_001_shot++; if(enemy_d_001_shot <= 20){ enemy_d_x = enemy_d_001.x enemy_d_y = enemy_d_001.y enemy_d_001.frame = 1; var shot_e = enemy_shot(); stage.addChild(shot_e); } if(enemy_d_001_shot >= 50){ enemy_d_001_shot = 0; } }else if(this.x >= 300&&this.y <= 60&&enemy_d_001_hp > 0){ if(this.x <= 550){ enemy_d_001_shot = 1; } } //enemy_d_002の射程範囲 enemy_d_002.frame = 0; if(enemy_d_002_shot > 0&&enemy_d_002_hp > 0){ enemy_d_002_shot++; if(enemy_d_002_shot <= 20){ enemy_d_x = enemy_d_002.x enemy_d_y = enemy_d_002.y enemy_d_002.frame = 1; var shot_e = enemy_shot(); stage.addChild(shot_e); } if(enemy_d_002_shot >= 50){ enemy_d_002_shot = 0; } }else if(this.x >= 500&&this.y >= 90&&enemy_d_002_hp > 0){ if(this.x <= 780){ enemy_d_002_shot = 1; } } //hou001の射程範囲 hou001.frame = 0; if(hou001_shot > 0&&hou001_hp > 0){ hou001_shot++; if(hou001_shot <= 20){ //enemy_d_x = enemy_d_002.x //enemy_d_y = enemy_d_002.y //enemy_d_002.frame = 1; hou001.frame = 2; var hou001shot = create_hou001_shot(); stage.addChild(hou001shot); } if(hou001_shot >= 80){ hou001_shot = 0; } }else if(this.x >= 1400&&hou001_hp > 0){ hou001_shot = 1; } //hou002の射程範囲 hou002.frame = 0; if(hou002_shot > 0&&hou002_hp > 0){ hou002_shot++; if(hou002_shot <= 20){ //enemy_d_x = enemy_d_002.x //enemy_d_y = enemy_d_002.y //enemy_d_002.frame = 1; hou002.frame = 2; var hou002shot = create_hou002_shot(); stage.addChild(hou002shot); } if(hou002_shot >= 80){ hou002_shot = 0; } }else if(this.x >= 1400&&hou002_hp > 0){ hou002_shot = 1; } //hou003の射程範囲 hou003.frame = 0; if(hou003_shot > 0&&hou003_hp > 0){ hou003_shot++; if(hou003_shot <= 20){ //enemy_d_x = enemy_d_003.x //enemy_d_y = enemy_d_003.y //enemy_d_003.frame = 1; //hou003.frame = 2; if(game.frame % 5 == 0){ var hou003shot = create_hou003_shot(); stage.addChild(hou003shot); } } if(hou003_shot >= 70){ hou003_shot = 0; } }else if(this.x >= 1400&&hou003_hp > 0){ hou003_shot = 1; } //hou004の射程範囲 hou004.frame = 0; if(hou004_shot > 0&&hou004_hp > 0){ hou004_shot++; if(hou004_shot <= 20){ //enemy_d_x = enemy_d_004.x //enemy_d_y = enemy_d_004.y //enemy_d_004.frame = 1; //hou004.frame = 2; if(game.frame % 5 == 0){ var hou004shot = create_hou004_shot(); stage_boss.addChild(hou004shot); } } if(hou004_shot >= 70){ hou004_shot = 0; } }else if(this.x >= 1400&&hou004_hp > 0){ hou004_shot = 1; } //hou005の射程範囲 //hou005.frame = 0; if(hou005_shot > 0&&hou005_hp > 0){ hou005_shot++; if(hou005_shot == 80){ var hou005shot = create_hou005_shot(); stage_boss.addChild(hou005shot); } if(hou005_shot >= 81){ hou005_shot = 0; } }else if(this.x >= 1400&&hou005_hp > 0){ hou005_shot = 1; } hou005_han.frame = 0; /*if (this.y > 320) { var score = Math.round(player.x); this.frame = 3; this.vy = -20; this.addEventListener('enterframe', function() { this.vy += 2; this.y += Math.min(Math.max(this.vy, -10), 10); if (this.y > 320) { game.end(score, score + 'mで死にました'); } }); this.removeEventListener('enterframe', arguments.callee); }*/ if(bar001.value <= 0){ bar001.visible = false; game.end(my_score_h, 'SCORE:' + my_score_h ); } }); var stage = new Group(); stage.addChild(map); stage.addChild(enemy_d_001); stage.addChild(enemy_d_002); //stage.addChild(boss_big_shot); stage.addChild(boss); stage.addChild(hou001); stage.addChild(hou002); stage.addChild(hou003); stage.addChild(hou004); stage.addChild(hou005); stage.addChild(hou005_han); stage.addChild(player); stage.addChild(guns); stage.addChild(player_hantei); stage.addChild(denzi001); stage.addChild(denzi002); stage.addChild(denzi003); stage.addChild(denzi_han001); stage.addChild(denzi_han002); stage.addChild(denzi_han003); stage.addChild(denzi_ene001); stage.addChild(denzi_ene002); stage.addChild(denzi_ene003); stage.addChild(denzi_ene004); stage.addChild(denzi_ene005); stage.addChild(denzi_ene006); stage.addEventListener('enterframe', function(e) { if (this.x > 80 - player.x/*&&this.x >= -300*/) { this.x = 80- player.x;//64後からついてくる stage_boss.x = this.x; } if (this.x < 64 - player.x&&this.x <= 0) { this.x = 64- player.x;//64後からついてくる stage_boss.x = this.x; } if(this.x <= -1500){ this.x = -1500; stage_boss.x = this.x; } //test_x = 64 - player.x; //test_y = 64 + player.x; //state.text = end_total_h+"<br>"+end_score_h+"<br>"+end_time_h+"<br>"+end_hp_h+"<br>"+end_des_h; if(game.frame %20 == 0){ my_time_h++; if(my_time_h >= 999){ my_time_h = 999; } my_time_count(); } if(end_h == 1){ end_count_h++; } if(end_count_h >= 100){ game.end(end_total_h, 'SCORE:' + end_total_h ); } //vx 今の速度  ax 加速度 }); var pad = new Pad(); pad.x = 0; pad.y = 224; game.rootScene.addChild(stage_boss); game.rootScene.addChild(stage); game.rootScene.addChild(bar_back); game.rootScene.addChild(pad); game.rootScene.addChild(bar001); game.rootScene.addChild(bar002); game.rootScene.addChild(score_ita); game.rootScene.addChild(time_ita); game.rootScene.addChild(shot_button); for(i = 0;i<5; i++){ game.rootScene.addChild(my_score[i]); } for(i = 0;i<5; i++){ game.rootScene.addChild(my_time[i]); } game.rootScene.addChild(end_score); for(i = 0;i<5; i++){ game.rootScene.addChild(end_score_num[i]); } for(i = 0;i<5; i++){ game.rootScene.addChild(end_time_num[i]); } for(i = 0;i<5; i++){ game.rootScene.addChild(end_hp_num[i]); } for(i = 0;i<5; i++){ game.rootScene.addChild(end_des_num[i]); } for(i = 0;i<5; i++){ game.rootScene.addChild(end_total_num[i]); } //game.rootScene.addChild(state); var create_enemy = function(e){ var enemy = new Sprite(24, 24); var enemy_index = enemys.length - 1; //エネミーのインデックスを作成0~ enemy.x = 250 + enemy_index * 30; //エネミーのインデックスを基準に配置箇所を設定(X座標) enemy.y = 70 /* + enemy_index * 30*/; //エネミーのインデックスを基準に配置箇所を設定(Y座標) enemy.vx = 0; enemy.vy = 0; enemy.ax = 0; enemy.ay = 0; enemy.pose = 0; enemy.jumpBoost = 0; var enemy_fra = 0; var enemy_kou = 0; enemy.image = game.assets['enemy004.gif']; enemy.addEventListener('enterframe', function(e) { var friction_e = 0; if (this.vx > 0.3) {//速度が速いとき friction_e = -0.3;//減速させる } else if (this.vx > 0) { friction_e = -this.vx; } if (this.vx < -0.3) { friction_e = 0.3; } else if (this.vx < 0) { friction_e = -this.vx; } this.ax = 0; //this.ay += 20; if(enemy_fra > 60){ enemy_fra = 0; enemy_kou = Math.floor(Math.random()*3) } if (enemy_kou == 1&&enemy_fra <= 20){ this.ax -= 0.4; }else if(enemy_kou == 2&&enemy_fra <= 20){ this.ax += 0.4; }/*else if(enemy_kou == 3&&enemy_fra <= 20){ this.jumpBoost = 30; this.ay = -20; }*/ enemy_fra++; if (game.frame % 3 == 0) {//歩くアニメ this.frame++; if(this.frame >= 3){ this.frame = 0; } } this.vx += this.ax + friction_e;// 加速度を速度に+friction_eにより減速 this.vy += this.ay + 8; // 2 is gravity this.vx = Math.min(Math.max(this.vx, -10), 10);//this.vxか-10の大きい方をとる そしてその値と10の小さい方をとる this.vy = Math.min(Math.max(this.vy, -10), 10); var dest_e = new Rectangle( this.x + this.vx + 4, this.y + this.vy + 2, this.width -4, this.height-2 ); while (true) { var boundary_e, crossing_e; var dx = dest_e.x - this.x - 4; var dy = dest_e.y - this.y - 2; if (dx > 0 && Math.floor(dest_e.right / 16) != Math.floor((dest_e.right - dx) / 16)) { boundary_e = Math.floor(dest_e.right / 16) * 16; crossing_e = (dest_e.right - boundary_e) / dx * dy + dest_e.y; if ((map.hitTest(boundary_e, crossing_e) && !map.hitTest(boundary_e-16, crossing_e)) || (map.hitTest(boundary_e, crossing_e + dest_e.height) && !map.hitTest(boundary_e-16, crossing_e + dest_e.height))) { this.vx = 0; dest_e.x = boundary_e - dest_e.width - 0.01; continue; } } else if (dx < 0 && Math.floor(dest_e.x / 16) != Math.floor((dest_e.x - dx) / 16)) { boundary_e = Math.floor(dest_e.x / 16) * 16 + 16; crossing_e = (boundary_e - dest_e.x) / dx * dy + dest_e.y; if ((map.hitTest(boundary_e-16, crossing_e) && !map.hitTest(boundary_e, crossing_e)) || (map.hitTest(boundary_e-16, crossing_e + dest_e.height) && !map.hitTest(boundary_e, crossing_e + dest_e.height))) { this.vx = 0; dest_e.x = boundary_e + 0.01; continue; } } if (dy > 0 && Math.floor(dest_e.bottom / 16) != Math.floor((dest_e.bottom - dy) / 16)) { boundary_e = Math.floor(dest_e.bottom / 16) * 16; crossing_e = (dest_e.bottom - boundary_e) / dy * dx + dest_e.x; if ((map.hitTest(crossing_e, boundary_e) && !map.hitTest(crossing_e, boundary_e-16)) || (map.hitTest(crossing_e + dest_e.width, boundary_e) && !map.hitTest(crossing_e + dest_e.width, boundary_e-16))) { this.jumping = false; this.vy = 0; dest_e.y = boundary_e - dest_e.height - 0.01; continue; } } else if (dy < 0 && Math.floor(dest_e.y / 16) != Math.floor((dest_e.y - dy) / 16)) { boundary_e = Math.floor(dest_e.y / 16) * 16 + 16; crossing_e = (boundary_e - dest_e.y) / dy * dx + dest_e.x; if ((map.hitTest(crossing_e, boundary_e-16) && !map.hitTest(crossing_e, boundary_e)) || (map.hitTest(crossing_e + dest_e.width, boundary_e-16) && !map.hitTest(crossing_e + dest_e.width, boundary_e))) { this.vy = 0; dest_e.y = boundary_e + 0.01; continue; } } break; } this.x = dest_e.x-4; this.y = dest_e.y-2; }); return enemy; } //爆発作成 var create_baku001 = function(e){ var baku001 = new Sprite(24,24); baku001.image = game.assets['baku001.gif']; baku001.frame = 0 baku001.x = enemy001_d_x; baku001.y = enemy001_d_y; baku001.addEventListener('enterframe', function(e) { this.frame++; if(this.frame >= 6){ stage.removeChild(this); this.frame = 0; } }); return baku001; } //enemy_d_001爆発 var baku_enemy_d_001 = function(e){ var baku002 = new Sprite(48,48); baku002.image = game.assets['baku002.gif']; baku002.frame = 0 baku002.x = 33 * 16; baku002.y = 2 * 16; baku002.addEventListener('enterframe', function(e) { this.frame++; if(this.frame >= 6){ stage.removeChild(this); this.frame = 0; } }); return baku002; } //enemy_d_002爆発 var baku_enemy_d_002 = function(e){ var baku003 = new Sprite(48,48); baku003.image = game.assets['baku002.gif']; baku003.frame = 0 baku003.x = 48 * 16; baku003.y = 7 * 16; baku003.addEventListener('enterframe', function(e) { this.frame++; if(this.frame >= 6){ stage.removeChild(this); this.frame = 0; } }); return baku003; } //boss爆発 var baku_boss = function(e){ var baku004 = new Sprite(48,48); baku004.image = game.assets['baku002.gif']; baku004.frame = 0 baku004.x = 110 * 16+5; baku004.y = 5 * 16+8; baku004.addEventListener('enterframe', function(e) { this.frame++; if(this.frame >= 6){ stage.removeChild(this); this.frame = 0; //クリア処理 stage.removeChild(player); end_score_h = my_score_h; end_time_h = my_time_h; end_hp_h = bar001.value; if(end_time_h <= 50){ end_time_h = 5000; }else if(end_time_h <= 60){ end_time_h = 3000; }else if(end_time_h <= 80){ end_time_h = 1000; }else if(end_time_h <= 100){ end_time_h = 500; }else{ end_time_h = 0; } if(end_hp_h == 150){ end_hp_h = 3000; }else{ end_hp_h = 0; } if(end_score_h == 7000){ end_des_h = 3000; } end_total_h = end_score_h + end_time_h + end_hp_h + end_des_h; end_score_count(); end_time_count(); end_hp_count(); end_des_count(); end_total_count(); end_score.visible = true; game.rootScene.removeChild(stage_boss); //game.rootScene.removeChild(stage); game.rootScene.removeChild(bar_back); game.rootScene.removeChild(bar001); //game.rootScene.removeChild(bar002); game.rootScene.removeChild(score_ita); game.rootScene.removeChild(time_ita); end_h = 1; //game.end(my_score_h, 'SCORE:' + my_score_h ); } }); return baku004; } //hou爆発 var baku_hou = function(e){ var baku_h = new Sprite(30,40); baku_h.image = game.assets['baku003.gif']; baku_h.frame = 0 baku_h.x = baku_hou_x; baku_h.y = baku_hou_y; baku_h.addEventListener('enterframe', function(e) { this.frame++; if(this.frame >= 6){ stage.removeChild(this); this.frame = 0; } }); return baku_h; } my_score_count = function(){ for(i = 0;i<5; i++){ my_score[i].visible = false; if(my_score_h >= 999999){ my_score_h = 999999; } if(my_score_h >= 0&&[i] == 4){ my_score[i].visible = true; my_score[i].frame = my_score_h; } if(my_score_h >= 10&&[i] == 3){ my_score[i].visible = true; my_score[i].frame = Math.floor(my_score_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(my_score_h >= 100&&[i] == 2){ my_score[i].visible = true; my_score[i].frame = Math.floor(my_score_h% 1000 / 100); } if(my_score_h >= 1000&&[i] == 1){ my_score[i].visible = true; my_score[i].frame = Math.floor(my_score_h% 10000 / 1000); } if(my_score_h >= 10000&&[i] == 0){ my_score[i].visible = true; my_score[i].frame = Math.floor(my_score_h/ 10000); } } } my_time_count = function(){ for(i = 0;i<5; i++){ my_time[i].visible = false; if(my_time_h >= 999999){ my_time_h = 999999; } if(my_time_h >= 0&&[i] == 4){ my_time[i].visible = true; my_time[i].frame = my_time_h; } if(my_time_h >= 10&&[i] == 3){ my_time[i].visible = true; my_time[i].frame = Math.floor(my_time_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(my_time_h >= 100&&[i] == 2){ my_time[i].visible = true; my_time[i].frame = Math.floor(my_time_h% 1000 / 100); } if(my_time_h >= 1000&&[i] == 1){ my_time[i].visible = true; my_time[i].frame = Math.floor(my_time_h% 10000 / 1000); } if(my_time_h >= 10000&&[i] == 0){ my_time[i].visible = true; my_time[i].frame = Math.floor(my_time_h/ 10000); } } } end_score_count = function(){ for(i = 0;i<5; i++){ end_score_num[i].visible = false; if(end_score_h >= 999999){ end_score_h = 999999; } if(end_score_h >= 0&&[i] == 4){ end_score_num[i].visible = true; end_score_num[i].frame = end_score_h; } if(end_score_h >= 10&&[i] == 3){ end_score_num[i].visible = true; end_score_num[i].frame = Math.floor(end_score_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(end_score_h >= 100&&[i] == 2){ end_score_num[i].visible = true; end_score_num[i].frame = Math.floor(end_score_h% 1000 / 100); } if(end_score_h >= 1000&&[i] == 1){ end_score_num[i].visible = true; end_score_num[i].frame = Math.floor(end_score_h% 10000 / 1000); } if(end_score_h >= 10000&&[i] == 0){ end_score_num[i].visible = true; end_score_num[i].frame = Math.floor(end_score_h/ 10000); } } } end_time_count = function(){ for(i = 0;i<5; i++){ end_time_num[i].visible = false; if(end_time_h >= 999999){ end_time_h = 999999; } if(end_time_h >= 0&&[i] == 4){ end_time_num[i].visible = true; end_time_num[i].frame = end_time_h; } if(end_time_h >= 10&&[i] == 3){ end_time_num[i].visible = true; end_time_num[i].frame = Math.floor(end_time_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(end_time_h >= 100&&[i] == 2){ end_time_num[i].visible = true; end_time_num[i].frame = Math.floor(end_time_h% 1000 / 100); } if(end_time_h >= 1000&&[i] == 1){ end_time_num[i].visible = true; end_time_num[i].frame = Math.floor(end_time_h% 10000 / 1000); } if(end_time_h >= 10000&&[i] == 0){ end_time_num[i].visible = true; end_time_num[i].frame = Math.floor(end_time_h/ 10000); } } } end_hp_count = function(){ for(i = 0;i<5; i++){ end_hp_num[i].visible = false; if(end_hp_h >= 999999){ end_hp_h = 999999; } if(end_hp_h >= 0&&[i] == 4){ end_hp_num[i].visible = true; end_hp_num[i].frame = end_hp_h; } if(end_hp_h >= 10&&[i] == 3){ end_hp_num[i].visible = true; end_hp_num[i].frame = Math.floor(end_hp_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(end_hp_h >= 100&&[i] == 2){ end_hp_num[i].visible = true; end_hp_num[i].frame = Math.floor(end_hp_h% 1000 / 100); } if(end_hp_h >= 1000&&[i] == 1){ end_hp_num[i].visible = true; end_hp_num[i].frame = Math.floor(end_hp_h% 10000 / 1000); } if(end_hp_h >= 10000&&[i] == 0){ end_hp_num[i].visible = true; end_hp_num[i].frame = Math.floor(end_hp_h/ 10000); } } } end_des_count = function(){ for(i = 0;i<5; i++){ end_des_num[i].visible = false; if(end_des_h >= 999999){ end_des_h = 999999; } if(end_des_h >= 0&&[i] == 4){ end_des_num[i].visible = true; end_des_num[i].frame = end_des_h; } if(end_des_h >= 10&&[i] == 3){ end_des_num[i].visible = true; end_des_num[i].frame = Math.floor(end_des_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(end_des_h >= 100&&[i] == 2){ end_des_num[i].visible = true; end_des_num[i].frame = Math.floor(end_des_h% 1000 / 100); } if(end_des_h >= 1000&&[i] == 1){ end_des_num[i].visible = true; end_des_num[i].frame = Math.floor(end_des_h% 10000 / 1000); } if(end_des_h >= 10000&&[i] == 0){ end_des_num[i].visible = true; end_des_num[i].frame = Math.floor(end_des_h/ 10000); } } } end_total_count = function(){ for(i = 0;i<5; i++){ end_total_num[i].visible = false; if(end_total_h >= 999999){ end_total_h = 999999; } if(end_total_h >= 0&&[i] == 4){ end_total_num[i].visible = true; end_total_num[i].frame = end_total_h; } if(end_total_h >= 10&&[i] == 3){ end_total_num[i].visible = true; end_total_num[i].frame = Math.floor(end_total_h% 100 / 10);//百の位以上を切り捨てて、十で割る。 } if(end_total_h >= 100&&[i] == 2){ end_total_num[i].visible = true; end_total_num[i].frame = Math.floor(end_total_h% 1000 / 100); } if(end_total_h >= 1000&&[i] == 1){ end_total_num[i].visible = true; end_total_num[i].frame = Math.floor(end_total_h% 10000 / 1000); } if(end_total_h >= 10000&&[i] == 0){ end_total_num[i].visible = true; end_total_num[i].frame = Math.floor(end_total_h/ 10000); } } } enemy_d_001.addEventListener('enterframe', function(e) { if(enemy_d_001_hit == 1){ this.frame = this.frame +2; enemy_d_001_hit = 0; } }); enemy_d_002.addEventListener('enterframe', function(e) { if(enemy_d_002_hit == 1){ this.frame = this.frame +2; enemy_d_002_hit = 0; } }); hou001.addEventListener('enterframe', function(e) { if(hou001_hit >= 1){ this.frame = 1; hou001_hit = 0; } }); hou002.addEventListener('enterframe', function(e) { if(hou002_hit >= 1){ this.frame = 1; hou002_hit = 0; } }); hou003.addEventListener('enterframe', function(e) { if(hou003_hit >= 1){ this.frame = 1; hou003_hit = 0; } }); hou004.addEventListener('enterframe', function(e) { if(hou004_hit >= 1){ this.frame = 1; hou004_hit = 0; } }); hou005_han.addEventListener('enterframe', function(e) { if(hou005_hit >= 1){ this.frame = 1; hou005_hit = 0; } }); denzi001.addEventListener('enterframe', function(e) { if (game.frame % 4 == 0) { this.frame++; denzi_ene001.frame++; denzi_ene004.frame++; denzi001_h++; if(this.frame >= 4){ this.frame = 0 } if(denzi001_h >= 15){ this.visible = true; denzi001_hit_h = 1; denzi001_h = 0; }else if(denzi001_h >= 8){ this.visible = false; denzi001_hit_h = 0; } if(denzi_ene001.frame >= 4){ denzi_ene001.frame = 0; denzi_ene004.frame = 0; } } if(denzi_han001.intersect(player_hantei)&&denzi001_hit_h == 1){ if(player_hit_h == 0){ player_hit_h = 1; //ダメージの減算はココ bar001.value = bar001.value - 50; } } }); denzi002.addEventListener('enterframe', function(e) { if (game.frame % 4 == 0) { this.frame++; denzi_ene002.frame++; denzi_ene005.frame++; denzi002_h++; if(this.frame >= 4){ this.frame = 0 } if(denzi002_h >= 14){ this.visible = true; denzi002_hit_h = 1; denzi002_h = 0; }else if(denzi002_h >= 7){ this.visible = false; denzi002_hit_h = 0; } if(denzi_ene002.frame >= 4){ denzi_ene002.frame = 0; denzi_ene005.frame = 0; } } if(denzi_han002.intersect(player_hantei)&&denzi002_hit_h == 1){ if(player_hit_h == 0){ player_hit_h = 1; //ダメージの減算はココ bar001.value = bar001.value - 50; } } }); denzi003.addEventListener('enterframe', function(e) { if (game.frame % 4 == 0) { this.frame++; denzi_ene003.frame++; denzi_ene006.frame++; denzi003_h++; if(this.frame >= 4){ this.frame = 0 } if(denzi003_h >= 21){ this.visible = true; denzi003_hit_h = 1; denzi003_h = 0; }else if(denzi003_h >= 15){ this.visible = false; denzi003_hit_h = 0; } if(denzi_ene003.frame >= 4){ denzi_ene003.frame = 0; denzi_ene006.frame = 0; } } if(denzi_han003.intersect(player_hantei)&&denzi003_hit_h == 1){ if(player_hit_h == 0){ player_hit_h = 1; //ダメージの減算はココ bar001.value = bar001.value - 50; } } }); //自分の弾を作成 var create_shot = function(e){ var shot = new Sprite(4, 4); shot.image = game.assets['shot.gif']; shot.frame = 0; shot_frame = game.frame; now_shot++; if(player.scaleX == 1){ shot.x = player.x + 16; shot.speed = 15; shot.scaleX = 1; }else if(player.scaleX == -1){ shot.x = player.x +12; shot.speed = -15; shot.scaleX = -1; } shot.y = player.y +14; shot.visible = false; shot.addEventListener('enterframe', function(e) { shot_fra++; /*原因未特定の残像対策*/ if(shot_fra > 1 ){ shot.visible = true; } this.x += shot.speed; if(this.x > Math.abs(stage.x) + 320){ now_shot--; stage.removeChild(this); } if(this.x < Math.abs(stage.x) -16){ now_shot--; stage.removeChild(this); } for (var i = 0; i < 5; i++) { if(this.intersect(enemys[i])&&ene[i] == 1){ enemy001_d_x = enemys[i].x; enemy001_d_y = enemys[i].y; stage.removeChild(enemys[i]); ene[i] = 0; var baku_e = create_baku001(); stage.addChild(baku_e); stage.removeChild(this); now_shot--; my_score_h += 100; my_score_count(); } } if(this.intersect(enemy_d_001)&&enemy_d_001_hp > 0){ stage.removeChild(this); now_shot--; enemy_d_001_hp--; enemy_d_001_hit = 1; if(enemy_d_001_hp == 0){ var baku_e_001 = baku_enemy_d_001(); stage.addChild(baku_e_001); stage.removeChild(enemy_d_001); my_score_h += 500; my_score_count(); } } if(this.intersect(enemy_d_002)&&enemy_d_002_hp > 0){ stage.removeChild(this); now_shot--; enemy_d_002_hp--; enemy_d_002_hit = 1; if(enemy_d_002_hp == 0){ var baku_e_002 = baku_enemy_d_002(); stage.addChild(baku_e_002); stage.removeChild(enemy_d_002); my_score_h += 500; my_score_count(); } } if(this.intersect(hou001)&&hou001_hp > 0){ stage.removeChild(this); now_shot--; hou001_hp--; hou001_hit = 1; if(hou001_hp == 0){ baku_hou_x = hou001.x-10; baku_hou_y = hou001.y-12; var baku_hou001 = baku_hou(); stage.addChild(baku_hou001); stage.removeChild(hou001); my_score_h += 800; my_score_count(); } } if(this.intersect(hou002)&&hou002_hp > 0){ stage.removeChild(this); now_shot--; hou002_hp--; hou002_hit = 1; if(hou002_hp == 0){ baku_hou_x = hou002.x-10; baku_hou_y = hou002.y-12; var baku_hou002 = baku_hou(); stage.addChild(baku_hou002); stage.removeChild(hou002); my_score_h += 800; my_score_count(); } } if(this.intersect(hou003)&&hou003_hp > 0){ stage.removeChild(this); now_shot--; hou003_hp--; hou003_hit = 1; if(hou003_hp == 0){ baku_hou_x = hou003.x-10; baku_hou_y = hou003.y-12; var baku_hou003 = baku_hou(); stage.addChild(baku_hou003); stage.removeChild(hou003); my_score_h += 800; my_score_count(); } } if(this.intersect(hou004)&&hou004_hp > 0){ stage.removeChild(this); now_shot--; hou004_hp--; hou004_hit = 1; if(hou004_hp == 0){ baku_hou_x = hou004.x-10; baku_hou_y = hou004.y-12; var baku_hou004 = baku_hou(); stage.addChild(baku_hou004); stage.removeChild(hou004); my_score_h += 800; my_score_count(); } } if(this.intersect(hou005_han)&&hou005_hp > 0){ stage.removeChild(this); now_shot--; hou005_hp--; hou005_hit = 1; if(hou005_hp == 0){ var baku_b = baku_boss(); stage.addChild(baku_b); stage.removeChild(hou005); stage.removeChild(hou005_han); my_score_h += 2300; my_score_count(); } } if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage.removeChild(this); test_h++; now_shot--; } }); return shot; } //敵の弾を作成 var enemy_shot = function(e){ var shot_e = new Sprite(10, 11); shot_e.image = game.assets['enemy_shot002.gif']; shot_e.frame = 0; //shot_e_frame = game.frame; now_shot_e++; shot_e.x = enemy_d_x -2; shot_e.y = enemy_d_y +17; shot_e.speed = -5; shot_e.visible = false; shot_e.addEventListener('enterframe', function(e) { shot_e_fra++; /*原因未特定の残像対策*/ if(shot_e_fra > 1 ){ shot_e.visible = true; } this.x += shot_e.speed; if(this.x > Math.abs(stage.x) + 320){ now_shot_e--; stage.removeChild(this); } if(this.x < Math.abs(stage.x) -16){ now_shot_e--; stage.removeChild(this); } if(this.intersect(player_hantei)){ if(player_hit_h == 0){ player_hit_h = 1; bar001.value = bar001.value - 60; } } /*for (var i = 0; i < 3; i++) { if(this.intersect(enemys[i])&&ene[i] == 1){ stage.removeChild(enemys[i]); ene[i] = 0; stage.removeChild(this); now_shot_e--; } }*/ if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage.removeChild(this); test_h++; now_shot_e--; } }); return shot_e; } //敵の弾を作成 var create_hou001_shot = function(e){ var shot_hou001 = new Sprite(10, 11); shot_hou001.image = game.assets['enemy_shot002.gif']; shot_hou001.frame = 0; //shot_e_frame = game.frame; now_shot_002++; shot_hou001.x = hou001.x - 9; shot_hou001.y = hou001.y + 4; shot_hou001.speed = -5; //shot_hou001.visible = false; shot_hou001.addEventListener('enterframe', function(e) { //shot_e_fra++; /*原因未特定の残像対策*/ //if(shot_e_fra > 1 ){ // shot_hou001.visible = true; //} this.x += shot_hou001.speed; if(this.x > Math.abs(stage.x) + 320){ now_shot_001--; stage.removeChild(this); } if(this.x < Math.abs(stage.x) -16){ now_shot_001--; stage.removeChild(this); } if(this.intersect(player_hantei)){ if(player_hit_h == 0){ player_hit_h = 1; bar001.value = bar001.value - 80; } } if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage.removeChild(this); test_h++; now_shot_001--; } }); return shot_hou001; } var create_hou002_shot = function(e){ var shot_hou002 = new Sprite(10, 11); shot_hou002.image = game.assets['enemy_shot002.gif']; shot_hou002.frame = 0; //shot_e_frame = game.frame; now_shot_002++; shot_hou002.x = hou002.x - 9; shot_hou002.y = hou002.y + 4; shot_hou002.speed = -5; //shot_hou002.visible = false; shot_hou002.addEventListener('enterframe', function(e) { //shot_e_fra++; /*原因未特定の残像対策*/ //if(shot_e_fra > 1 ){ // shot_hou002.visible = true; //} this.x += shot_hou002.speed; if(this.x > Math.abs(stage.x) + 320){ now_shot_002--; stage.removeChild(this); } if(this.x < Math.abs(stage.x) -16){ now_shot_002--; stage.removeChild(this); } if(this.intersect(player_hantei)){ if(player_hit_h == 0){ player_hit_h = 1; bar001.value = bar001.value - 80; } } if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage.removeChild(this); test_h++; now_shot_002--; } }); return shot_hou002; } var create_hou003_shot = function(e){ var shot_hou003 = new Sprite(10, 11); shot_hou003.image = game.assets['enemy_shot004.gif']; shot_hou003.frame = 0; //shot_e_frame = game.frame; now_shot_003++; shot_hou003.x = hou003.x - 9; shot_hou003.y = hou003.y + 4; shot_hou003.speed = -5; //shot_hou003.visible = false; shot_hou003.addEventListener('enterframe', function(e) { //shot_e_fra++; /*原因未特定の残像対策*/ //if(shot_e_fra > 1 ){ // shot_hou003.visible = true; //} this.x += shot_hou003.speed; if(this.x > Math.abs(stage.x) + 320){ now_shot_003--; stage.removeChild(this); } if(this.x < Math.abs(stage.x) -16){ now_shot_003--; stage.removeChild(this); } if(this.intersect(player_hantei)){ if(player_hit_h == 0){ player_hit_h = 1; bar001.value = bar001.value - 60; } } if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage.removeChild(this); test_h++; now_shot_003--; } }); return shot_hou003; } var create_hou004_shot = function(e){ var shot_hou004 = new Sprite(10, 11); shot_hou004.image = game.assets['enemy_shot004.gif']; shot_hou004.frame = 0; //shot_e_frame = game.frame; now_shot_004++; shot_hou004.x = hou004.x - 9; shot_hou004.y = hou004.y + 4; shot_hou004.speed = -5; //shot_hou004.visible = false; shot_hou004.addEventListener('enterframe', function(e) { //shot_e_fra++; /*原因未特定の残像対策*/ //if(shot_e_fra > 1 ){ // shot_hou004.visible = true; //} this.x += shot_hou004.speed; if(this.x > Math.abs(stage_boss.x) + 320){ now_shot_004--; stage_boss.removeChild(this); } if(this.x < Math.abs(stage_boss.x) -16){ now_shot_004--; stage_boss.removeChild(this); } if(this.intersect(player_hantei)){ if(player_hit_h == 0){ player_hit_h = 1; bar001.value = bar001.value - 60; } } if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage_boss.removeChild(this); test_h++; now_shot_004--; } }); return shot_hou004; } var create_hou005_shot = function(e){ var shot_hou005 = new Sprite(64,24); shot_hou005.image = game.assets['enemy_shot005.gif']; shot_hou005.frame = 0; //shot_e_frame = game.frame; now_shot_005++; shot_hou005.x = hou005.x + 10; shot_hou005.y = hou005.y + 8; shot_hou005.speed = -5; //shot_hou005.visible = false; shot_hou005.addEventListener('enterframe', function(e) { //shot_e_fra++; /*原因未特定の残像対策*/ //if(shot_e_fra > 1 ){ // shot_hou005.visible = true; //} this.x += shot_hou005.speed; if(this.x > Math.abs(stage_boss.x) + 320){ now_shot_005--; stage_boss.removeChild(this); } if(this.x < Math.abs(stage_boss.x) -66){ now_shot_005--; stage_boss.removeChild(this); } if(this.intersect(player_hantei)){ if(player_hit_h == 0){ player_hit_h = 1; bar001.value = bar001.value - 120; } } if(map.hitTest(this.x,this.y)&& map.hitTest(this.x,this.y+4)&& map.hitTest(this.x+4,this.y)&& map.hitTest(this.x+4,this.y+4)){ stage_boss.removeChild(this); test_h++; now_shot_005--; } }); return shot_hou005; } for (var i = 0; i < 5; i++) { //エネミー表示準備。3匹作成する。 var enemy = create_enemy(); ene[i] = 1; enemys.push(enemy); stage.addChild(enemy); } game.addEventListener('spacebuttondown', function() { if(shot_frame + shot_lag < game.frame){ if(max_shot > now_shot){ var shot = create_shot(); stage.addChild(shot); guns.visible = true; guns_h = 1; } } }); shot_button.addEventListener('touchend',function(e){ if(shot_frame + shot_lag < game.frame){ if(max_shot > now_shot){ var shot = create_shot(); stage.addChild(shot); guns.visible = true; guns_h = 1; } } }); game.rootScene.backgroundColor = 'rgb(63, 111, 159)'; my_score_count(); my_time_count(); }; game.start(); };
import React, { Component } from 'react'; import { ListView, GridView, GridRow, TouchableOpacity, Card, View, Subtitle, Spinner } from '@shoutem/ui'; import { connect } from 'react-redux'; import { playGenre } from './actions'; import GenreArt from './GenreArt'; import Player from './Player'; const GenreButton = connect( (state) => ({ currentlyPlaying: state.currentlyPlaying }) )(({ genre, currentlyPlaying, dispatch }) => ( <TouchableOpacity styleName="flexible" onPress={() => dispatch(playGenre(genre))}> <View> <Card styleName="flexible"> {currentlyPlaying.genre.id === genre.id ? <Player /> : <GenreArt name={genre.name} />} <Subtitle numberOfLines={1}>{genre.name}</Subtitle> </Card> </View> </TouchableOpacity> )); class Genres extends Component { renderRow(rowData, sectionId, index) { const cellViews = rowData.map((genre, id) => ( <GenreButton key={id} genre={genre} /> )); return ( <GridRow columns={2}> {cellViews} </GridRow> ) } render() { const groupedGenres = GridRow.groupByRows(this.props.genres, 2); return ( <ListView data={groupedGenres} renderRow={this.renderRow} /> ) } } export default Genres;
/*global describe, it, before, after*/ var assert = require('assert') var thunk = require('thunks')() var redis = require('../index') var client = redis.createClient(7000) var count = 50000 before(function *() { yield client.info() }) after(function *() { yield thunk.delay(1000) process.exit() }) describe('cluster test', function () { it('create 50000 keys', function *() { var task = [] var len = count while (len--) { task.push(thunk(len + '')(function *(err, res) { assert.strictEqual(err, null) assert.strictEqual((yield client.set(res, res)), 'OK') assert.strictEqual((yield client.get(res)), res) })) } yield thunk.all(task) }) it('get 50000 keys', function *() { var task = [] var len = count while (len--) { task.push(thunk(len + '')(function *(err, res) { assert.strictEqual(err, null) assert.strictEqual((yield client.get(res)), res) })) } yield thunk.all(task) }) it('transaction', function *() { for (var i = 0; i < count; i++) { var res = yield [ client.multi(i), client.set(i, i), client.get(i), client.exec(i) ] assert.strictEqual(res[0], 'OK') assert.strictEqual(res[1], 'QUEUED') assert.strictEqual(res[2], 'QUEUED') assert.strictEqual(res[3][0], 'OK') assert.strictEqual(res[3][1], i + '') } }) it('evalauto', function *() { var task = [] var len = count while (len--) addTask(len) var res = yield thunk.all(task) len = count while (len--) assert.strictEqual(res[len] + len, count - 1) function addTask (index) { task.push(function *() { var res = yield client.evalauto('return KEYS[1]', 1, index) assert.strictEqual(+res, index) return +res }) } }) it('kill a master', function *() { var task = [] var result = {} var len = 10000 client.on('warn', function (err) { console.log(err) }) thunk.delay(100)(function () { // kill the default master node client.debug('segfault')() }) while (len--) { task.push(thunk(len + '')(function *(err, res) { assert.strictEqual(err, null) return yield client.get(res) })(function (err, res) { assert.strictEqual(err, null) result[res] = true })) yield thunk.delay(5) } yield thunk.all(task) len = 10000 while (len--) assert.strictEqual(result[len], true) }) })
//アプリキー exports.apurikey = 'xxx'; exports.APURIKEY = 'APURIKEY'; /** * データベース接続情報 */ exports.DB_INFORMATION = { host: 'xxx', user: 'xxx', password: 'xxxx', database: 'xxxx', timezone: 'jst' } /** * ステータス */ exports.STATUS = 'STATUS'; exports.SUCCESS = 'SUCCESS'; exports.ERROR = 'ERROR'; exports.EMPTY = 'EMPTY'; exports.DATA = 'DATA'; exports.LOGIN = 'LOGIN'; /** * SQL_ID SELECT 0~999S */ exports.SQL_ID_0000S = 'SQL_ID_0000S'; exports.SQL_ID_0001S = 'SQL_ID_0001S'; exports.SQL_ID_0002S = 'SQL_ID_0002S'; exports.SQL_ID_0003S = 'SQL_ID_0003S'; exports.SQL_ID_0004S = 'SQL_ID_0004S'; exports.SQL_ID_0005S = 'SQL_ID_0005S'; exports.SQL_ID_0006S = 'SQL_ID_0006S'; exports.SQL_ID_0007S = 'SQL_ID_0007S'; exports.SQL_ID_0008S = 'SQL_ID_0008S'; exports.SQL_ID_0009S = 'SQL_ID_0009S'; exports.SQL_ID_0010S = 'SQL_ID_0010S'; exports.SQL_ID_0011S = 'SQL_ID_0011S'; exports.SQL_ID_0012S = 'SQL_ID_0012S'; exports.SQL_ID_0013S = 'SQL_ID_0013S'; exports.SQL_ID_0014S = 'SQL_ID_0014S'; exports.SQL_ID_0015S = 'SQL_ID_0015S'; exports.SQL_ID_0016S = 'SQL_ID_0016S'; exports.SQL_ID_0017S = 'SQL_ID_0017S'; exports.SQL_ID_0018S = 'SQL_ID_0018S'; exports.SQL_ID_0019S = 'SQL_ID_0019S'; exports.SQL_ID_0020S = 'SQL_ID_0020S'; exports.SQL_ID_0021S = 'SQL_ID_0021S'; /** * SQL_ID INSERT 1000I~1999I */ exports.SQL_ID_1000I = 'SQL_ID_1000I'; exports.SQL_ID_1001I = 'SQL_ID_1001I'; exports.SQL_ID_1002I = 'SQL_ID_1002I'; exports.SQL_ID_1003I = 'SQL_ID_1003I'; exports.SQL_ID_1004I = 'SQL_ID_1004I'; exports.SQL_ID_1005I = 'SQL_ID_1005I'; exports.SQL_ID_1006I = 'SQL_ID_1006I'; exports.SQL_ID_1007I = 'SQL_ID_1007I'; exports.SQL_ID_1008I = 'SQL_ID_1008I'; exports.SQL_ID_1009I = 'SQL_ID_1009I'; exports.SQL_ID_1010I = 'SQL_ID_1010I'; /** * SQL_ID UPDATE 2000U~2999U */ exports.SQL_ID_2000U = 'SQL_ID_2000U'; exports.SQL_ID_2001U = 'SQL_ID_2001U'; exports.SQL_ID_2002U = 'SQL_ID_2002U'; exports.SQL_ID_2003U = 'SQL_ID_2003U'; exports.SQL_ID_2004U = 'SQL_ID_2004U'; exports.SQL_ID_2005U = 'SQL_ID_2005U'; exports.SQL_ID_2006U = 'SQL_ID_2006U'; exports.SQL_ID_2007U = 'SQL_ID_2007U'; exports.SQL_ID_2008U = 'SQL_ID_2008U'; exports.SQL_ID_2009U = 'SQL_ID_2009U'; exports.SQL_ID_2010U = 'SQL_ID_2010U'; exports.SQL_ID_2011U = 'SQL_ID_2011U'; exports.SQL_ID_2012U = 'SQL_ID_2012U'; exports.SQL_ID_2013U = 'SQL_ID_2013U'; exports.SQL_ID_2014U = 'SQL_ID_2014U'; exports.SQL_ID_2015U = 'SQL_ID_2015U'; /** * SQL_ID UPDATE 3000D~3999D */ exports.SQL_ID_3000D = 'SQL_ID_3000D'; exports.SQL_ID_3001D = 'SQL_ID_3001D'; exports.SQL_ID_3002D = 'SQL_ID_3002D'; exports.SQL_ID_3003D = 'SQL_ID_3003D'; exports.SQL_ID_3004D = 'SQL_ID_3004D'; /** * (UPDATE, INSERT, DELETE) * SQL実行時の返り値 */ exports.changedRows = 'changedRows'; /** * USERテーブル */ exports.ID = 'ID'; exports.NAME = 'NAME'; exports.ICON_ID = 'ICON_ID'; exports.KINDS = 'KINDS'; exports.GR_FLAG = 'GR_FLAG'; exports.PUSH_TOKEN = 'PUSH_TOKEN'; exports.ROOM_UPPER = 'ROOM_UPPER'; exports.HOST = 'HOST'; exports.UPDATE_TIME = 'UPDATE_TIME'; exports.CREATE_TIME = 'CREATE_TIME'; exports.IVD_ID = 'IVD_ID'; exports.TMP_TOKEN = 'TMP_TOKEN'; /** * TRADEテーブル */ exports.TRADE_ID = 'TRADE_ID'; exports.SEND = 'SEND'; exports.SEND_SYSTEM = 'SEND_SYSTEM'; exports.REC = 'REC'; exports.MESSAGE = 'MESSAGE'; /** * FRIENDテーブル */ exports.ME = 'ME'; exports.DEAR = 'DEAR'; exports.UNREAD_FLAG = 'UNREAD_FLAG'; exports.PUSH_FLAG = 'PUSH_FLAG'; /** * url */ exports.page = 'page'; exports.api0 = "api0"; exports.api1 = "api1"; exports.api2 = "api2"; exports.api3 = "api3"; exports.api4 = 'api4'; exports.api5 = 'api5'; exports.api6 = 'api6'; exports.api7 = 'api7'; exports.api8 = 'api8'; exports.api9 = 'api9'; exports.api10 = 'api10'; exports.api11 = 'api11'; exports.api12 = 'api12'; exports.api13 = 'api13'; exports.api14 = 'api14'; exports.api15 = 'api15'; exports.api16 = 'api16'; exports.api17 = 'api17'; exports.api18 = 'api18'; exports.api19 = 'api19'; exports.api20 = 'api20'; exports.api21 = 'api21'; exports.api22 = 'api22'; exports.api23 = 'api23'; exports.api24 = 'api24'; exports.api25 = 'api25'; exports.talkpass = 'talkpass'; exports.friend_talkpass = 'friend_talkpass';
export const NEW_SEGMENT = 'NEW_SEGMENT'; export const NEW_MAP = 'NEW_MAP'; export const NEW_USER = 'NEW_USER';
import styled from 'styled-components'; const formFields = ` height:45px; padding:5px 15px; float:left; `; const colors = { btnText: '#fff', fieldsBg: '#1965e2' }; export const SearchWrap = styled.form ` &:after{ display:table; width:100%; height:0; clear:both; content:''; } *{ box-sizing: border-box; } `; export const Input = styled.input ` width:70%; outline:none; background:${colors.btnText}; border:1px solid ${colors.fieldsBg}; ${formFields} `; export const Button = styled.button ` width:30%; border:none; background:${colors.fieldsBg}; color:${colors.btnText}; ${formFields} `; export const WrapAutoComp = styled.div` position:relative; max-width:450px; margin:0 auto; padding:15px; `
import React from 'react'; import Search from './Components/Search' import './App.css'; function App() { return ( <div className="App"> <div className='advertisement'><p>Banner Space</p></div> <div className='second-col-wrap'> <div className='xe-logo'><img src='https://pbs.twimg.com/profile_images/461419627638042626/A2LeCqw4_400x400.png'alt="xrysi efkairia logo"/></div> <div className='body-wrap'> <p>Which place are you looking for?</p> <Search/> </div> </div> </div> ); } export default App;
var GitHubApi = require('github').GitHubApi var github = new GitHubApi(true) github.getUserApi().getFollowers('butu5', function(err,followers){ //console.log(followers.join('\n')) }) github.getUserApi().getFollowing('butu5', function(err,followers){ // console.log(followers) // console.log(followers.join('\n')) }) github.getUserApi().getWatchedRepos('butu5',function(err, repos){ console.log(repos) })
// ////////////////////////////////////////////////////////////////////////////// // / DISCLAIMER // / // / // / 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. // / // / Copyright holder is ArangoDB GmbH, Cologne, Germany // / // / @author Heiko Kernbach // / @author Lars Maier // / @author Markus Pfeiffer // / @author Copyright 2020, ArangoDB GmbH, Cologne, Germany // ////////////////////////////////////////////////////////////////////////////// const internal = require("internal"); const db = internal.db; const pregel = require("@arangodb/pregel"); const _ = require("lodash"); const examplegraphs = require("@arangodb/air/pregel-example-graphs"); const testhelpers = require("@arangodb/air/test-helpers"); const accumulators = require("@arangodb/air/accumulators"); // ee/ce check + gm selection const isEnterprise = require("internal").isEnterprise(); const graphModule = isEnterprise? require("@arangodb/smart-graph") : require("@arangodb/general-graph"); exports.single_source_shortest_paths_program = single_source_shortest_paths_program; exports.single_source_shortest_paths = single_source_shortest_paths; exports.test = test; /* `single_source_shortest_path_program` returns an AIR program that performs a single-source shortest path search, currently without path reconstruction, on all vertices in the graph starting from `startVertex`, using the cost stored in `weightAttribute` on each edge, and storing the end result in resultField as an object containing the attribute `distance` */ function single_source_shortest_paths_program( resultField, startVertexId ) { return { resultField: resultField, maxGSS: 10000, vertexAccumulators: { distance: { accumulatorType: "custom", valueType: "any", customType: "my_min", }, }, customAccumulators: { "my_min": accumulators.minAccumulator() }, phases: [ { name: "main", initProgram: [ "seq", [ "if", [ ["eq?", ["this-vertex-id"], startVertexId], ["seq", ["accum-set!", "distance", 0], true], ], [true, ["seq", ["accum-clear!", "distance"], false]], ], ], updateProgram: [ "seq", ["for-each", [["edge", ["this-outbound-edges"]]], ["send-to-accum", "distance", ["attrib-ref", ["var-ref", "edge"], "to-pregel-id"], ["+", ["accum-ref", "distance"], 1,//["attrib-ref", ["quote", "document", weightAttribute], ["var-ref", "edge"]], ]]], false, ], }, ], }; } /* `single_source_shortest_path` executes the program returned by `single_source_shortest_path_program` on the graph identified by `graphName`. */ function single_source_shortest_paths( graphName, resultField, startVertexId ) { return pregel.start( "ppa", graphName, single_source_shortest_paths_program( resultField, startVertexId ) ); } function reconstruct_path(graphSpec, from, to) { let path = [to]; while (from !== to) { let doc = db._collection(graphSpec.vname).document(to); if (doc === null || doc.SSSP.distance === null) { return []; } to = doc.SSSP.distance.sender; path.unshift(to); } return [path]; } function exec_test_shortest_path_impl(graphSpec) { // Find the ID of a vertex to start at. const [from_vertex, ...to_vertexes] = db ._query(`FOR d IN @@V SORT RAND() LIMIT 10 RETURN d._id`, {"@V": graphSpec.vname}) .toArray(); internal.print(" -- computing sssp " + from_vertex + " -> ", to_vertexes.join(", ")); testhelpers.wait_for_pregel( "Air SSSP", single_source_shortest_paths( graphSpec.name, "SSSP", from_vertex, )); for (let to_vertex of to_vertexes) { internal.print(" -- computing shortest paths using kShortestPath AQL to ", to_vertex); const shortest_paths_result = db._query(` FOR p IN OUTBOUND K_SHORTEST_PATHS @from TO @to GRAPH @graph LIMIT 1 RETURN p`, {"from": from_vertex, "to": to_vertex, "graph": graphSpec.name}) .toArray(); internal.print(" -- collecting Pregel SSSP Path to ", to_vertex); /*const found_path_result = db._query(` FOR v, e, p in 0..10000 INBOUND @to GRAPH @graph PRUNE v._id == @from || (e != null && e._from != p.vertices[-2].SSSP.distance.sender) OPTIONS {uniqueVertices: "path"} FILTER v._id == @from LIMIT 1 RETURN REVERSE(p.vertices[*]._id)`, {"from": from_vertex, "to": to_vertex, "graph": graphSpec.name}).toArray();*/ const found_path_result = reconstruct_path(graphSpec, from_vertex, to_vertex); if ((found_path_result.length !== 0) !== (shortest_paths_result.length !== 0)) { internal.print("\u001b[31mFAIL: did not agree on the existance of a shortest path to ", to_vertex, "\u001b[0m"); return false; } else if (found_path_result.length === 0) { internal.print("\u001b[32mOK : no path found to ", to_vertex, ", as expected", "\u001b[0m"); continue; } const shortest_paths = shortest_paths_result[0]; const found_path = found_path_result[0]; if (shortest_paths.vertices.length !== found_path.length) { internal.print("\u001b[32mOK : sssp path was not a shortest path, sssp: ", found_path.length, " all shortest paths: ", shortest_paths.vertices.length, "\u001b[0m"); internal.print(found_path, shortest_paths); return false; } else { internal.print("\u001b[32mOK : shortest path is ok to ", to_vertex, "\u001b[0m"); } } return true; } function exec_test_shortest_path() { let results = []; results.push(exec_test_shortest_path_impl(examplegraphs.create_line_graph("LineGraph10", 10, 1))); try { graphModule._drop("LineGraph10", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_line_graph("LineGraph100", 100, 9))); try { graphModule._drop("LineGraph100", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_line_graph("LineGraph1000", 1000, 18))); try { graphModule._drop("LineGraph1000", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_circle_graph("Circle10", 2, 1))); try { graphModule._drop("Circle10", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_circle_graph("Circle100", 4, 6))); try { graphModule._drop("Circle100", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_circle_graph("Circle1000", 8, 18))); try { graphModule._drop("Circle1000", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_complete_graph("Complete4", 10, 4))); try { graphModule._drop("Complete4", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_complete_graph("Complete10", 10, 10))); try { graphModule._drop("Complete10", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_complete_graph("Complete100", 10, 100))); try { graphModule._drop("Complete100", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_wiki_vote_graph("WikiVote", 1))); try { graphModule._drop("WikiVote", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_wiki_vote_graph("WikiVote", 9))); try { graphModule._drop("WikiVote", true); } catch (ignore) { } results.push(exec_test_shortest_path_impl(examplegraphs.create_wiki_vote_graph("WikiVote", 18))); try { graphModule._drop("WikiVote", true); } catch (ignore) { } return !results.includes(false); } function test() { return exec_test_shortest_path(); }
function addSum (a,b) { return a+b; } //console.log(addSum(1,1)); const addSumA = (a,b) => { return a + b; } //console.log(addSumA(1,2)); const showData = (a) => { return a; } //console.log(showData('DATA')); const showNewData = a => { return a; } //console.log(showNewData('NEW DATA')); const showOtherData = () => { return 'ABCD'; } //console.log(showOtherData()); const showMoreData = () => 1 + 2 + 3; //console.log(showMoreData()); const names = ['one', 'two', 'three']; for(let name in names) { // console.log(name); } for(let name of names) { // console.log(name); } //console.log(names.map(element => 'Key'+ element)); names.push('ABCD'); // console.log(names); const newNames = [...names]; //Spread Operator //console.log(newNames); const addArray = (...arguments) => arguments; //Rest Operator //console.log(addArray(1,2,3)); ///////////////////////////////////////////// ///////////////////////////////////////////// //OBJECT DISTRUCTURING const mObject = { name: 'Rahil Patel' }; const getName = ({name}) => name; // console.log(getName(mObject)); const {name} = mObject; // console.log(name); const arrayA = [1,2,3]; const [a,b,c] = arrayA; //console.log(b); //////////////////////////////////////////////// ///////////////////////////////////////////////
import ToolButton from './ToolButton'; export default ToolButton;
const merge = (leftArray, rightArray) => { let sortedArray = []; while (leftArray.length && rightArray.length) { let minimumEl; if (leftArray[0] <= rightArray[0]) { minimumEl = leftArray.shift(); } else minimumEl = rightArray.shift(); sortedArray.push(minimumEl); } if (leftArray.length) sortedArray.push(...leftArray); if (rightArray.length) sortedArray.push(...rightArray); return sortedArray; }; const mergeSort = array => { if (array.length <= 1) return array; const middle = Math.floor(array.length / 2); const leftHalf = array.slice(0, middle); const rightHalf = array.slice(middle); return merge(mergeSort(leftHalf), mergeSort(rightHalf)); }; module.exports = mergeSort;
'use strict'; describe('Tab Self test',function(){ it('点击切换选项卡',function(){ browser.get('test/e2e/testee/tab/web/self.html') .then(function(){ browser.waitForAngular(); browser.sleep(3000); }); var item=element.all(by.css(".demo1 .rdk-tab-module ul li")); //点击选项卡3 item.get(2).click(); //对应选项卡3标题 被选中为true,其余为false,内容为对应title expect(item.get(2).getAttribute("aria-selected")).toBe("true"); expect(element(by.css(".demo1 .rdk-tab-module .content")).getText()).toBe("DIV3"); expect(item.get(1).getAttribute("aria-selected")).toBe("false"); expect(item.get(0).getAttribute("aria-selected")).toBe("false"); }); it('外部控制TAB_SELECT事件传播',function(){ //TAB_SELECT事件控制选项卡的序号index 与CHANGE事件序号统一0开始 //选择第三个选项卡 element.all(by.css(".demo1 button")).get(2).click(); var item=element.all(by.css(".demo1 .rdk-tab-module ul li")); expect(item.get(2).getAttribute("aria-selected")).toBe("true"); expect(element(by.css(".demo1 .rdk-tab-module .content")).getText()).toBe("DIV3"); expect(item.get(1).getAttribute("aria-selected")).toBe("false"); expect(item.get(0).getAttribute("aria-selected")).toBe("false"); //选择第二个选项卡 element.all(by.css(".demo1 button")).get(1).click(); expect(item.get(1).getAttribute("aria-selected")).toBe("true"); expect(element(by.css(".demo1 .rdk-tab-module .content")).getText()).toBe("DIV2"); expect(item.get(0).getAttribute("aria-selected")).toBe("false"); expect(item.get(2).getAttribute("aria-selected")).toBe("false"); }); it('鼠标划过选中选项卡',function(){ var item=element.all(by.css(".demo2 .rdk-tab-module ul li")); //移动到第三个选项卡 browser.actions().mouseMove(item.get(2)).perform(); browser.sleep(300); expect(item.get(2).getAttribute("aria-selected")).toBe("true"); expect(element(by.css(".demo2 .rdk-tab-module .content")).getText()).toBe("DIV3"); expect(item.get(1).getAttribute("aria-selected")).toBe("false"); expect(item.get(0).getAttribute("aria-selected")).toBe("false"); //移动到第二个选项卡 browser.actions().mouseMove(item.get(1)).perform(); browser.sleep(300); expect(item.get(1).getAttribute("aria-selected")).toBe("true"); expect(element(by.css(".demo2 .rdk-tab-module .content")).getText()).toBe("DIV2"); expect(item.get(0).getAttribute("aria-selected")).toBe("false"); expect(item.get(2).getAttribute("aria-selected")).toBe("false"); }); it('选项卡高度属性设置height_style=content',function(){ //每个选项卡根据自身高度适应 var item=element.all(by.css(".demo3 .rdk-tab-module ul li")); item.get(0).click(); browser.sleep(500); //猜想值应该均为auto,第一个始终不是,是否是bug? expect(element(by.css(".demo3 .rdk-tab-module .content")).getCssValue("height")).toBe("42px"); item.get(1).click(); expect(element(by.css(".demo3 .rdk-tab-module .content")).getCssValue("height")).toBe("66px"); item.get(2).click(); browser.sleep(500); expect(element(by.css(".demo3 .rdk-tab-module .content")).getCssValue("height")).toBe("90px"); }); it('选项卡高度属性设置auto',function(){ //每个选项卡都是按照最高的选项卡设置高度 var item=element.all(by.css(".demo4 .rdk-tab-module ul li")); item.get(0).click(); expect(element(by.css(".demo4 .rdk-tab-module .content")).getCssValue("height")).toBe("90px"); item.get(1).click(); expect(element(by.css(".demo4 .rdk-tab-module .content")).getCssValue("height")).toBe("90px"); item.get(2).click(); expect(element(by.css(".demo4 .rdk-tab-module .content")).getCssValue("height")).toBe("90px"); }); it('选项卡高度属性设置fill',function(){ //整个rdk_tab高度根据标签定义分配,选项卡处为59px,在页面审查得知最终属于该测试块的高度仅为52px var item=element.all(by.css(".demo5 .rdk-tab-module ul li")); // item.get(0).click(); expect(element(by.css(".demo5 .rdk-tab-module .content")).getCssValue("height")).toBe("42px"); item.get(1).click(); expect(element(by.css(".demo5 .rdk-tab-module .content")).getCssValue("height")).toBe("42px"); item.get(2).click(); browser.sleep(500); expect(element(by.css(".demo5 .rdk-tab-module .content")).getCssValue("height")).toBe("42px"); }); it('设置可见选项卡 可伸缩',function(){ expect(element.all(by.css(".demo6 .rdk-tab-module ul li")).count()).toBe(3); var item=element.all(by.css(".demo6 .rdk-tab-module ul li")); item.get(2).click(); browser.sleep(500); item.get(2).click(); // 展开内容DIV3 expect(element.all(by.css(".demo6 .rdk-tab-module .content div[role='tabpanel']")).get(2).getText()).toBe("DIV3"); item.get(2).click(); browser.sleep(1000); //原本展开的div display属性为none(不存在dom中) expect(element.all(by.css(".demo6 .rdk-tab-module .content div[role='tabpanel']")).get(2).getCssValue("display")).toBe("none"); }); it('动态新增TAB页',function(){ var item = element.all(by.id("btn4add")); item.get(0).click(); browser.sleep(500); expect(element.all(by.css(".demo7 .rdk-tab-module ul li")).get(3).getText()).toBe("新增DIV"); }); it('destroy Tab页',function(){ var item = element.all(by.css(".demo8 .rdk-tab-module .ui-icon-close")); item.get(2).click(); browser.sleep(500); browser.switchTo().alert().accept(); browser.sleep(500); expect(element.all(by.css(".demo8 .rdk-tab-module ul li")).count()).toBe(2); }); it('close Tab页',function(){ var item = element.all(by.css(".demo9 .rdk-tab-module .ui-icon-close")); item.get(2).click(); browser.sleep(500); browser.switchTo().alert().accept(); browser.sleep(500); expect(element.all(by.css(".demo9 .rdk-tab-module ul li")).count()).toBe(3); expect(element.all(by.css(".demo9 .rdk-tab-module ul li")).get(2).getCssValue("display")).toBe("none"); }); it('move Tab页',function(){ var btnLeft = element(by.css(".demo10 .rdk-tab-module .fa-caret-left")); var btnRight = element(by.css(".demo10 .rdk-tab-module .fa-caret-right")); var tabs = element(by.css(".demo10 .rdk-tab-module .title")); btnRight.click(); browser.sleep(2000); expect(tabs.getCssValue("left")=="0px").toBe(false); btnLeft.click(); browser.sleep(2000); expect(tabs.getCssValue("left")).toBe("0px"); }); });
import React from 'react'; import * as ReactBootstrap from "react-bootstrap"; //Family table component gets information from search and puts in table from const resTable = () => { var getFixtures=[]; var temp; var i; console.log("cheese"); fetch('http://localhost:3000/', { method: 'get', headers: {'Content-Type': 'application/json'} }) .then(response => response.json()) .then(fixtures => { //If successfull //Get information and put in array if(fixtures.length){ for (i = 0; i < fixtures.length; i++){ temp={ homeTeam:fixtures[i][0], awayTeam:fixtures[i][1], hwc:fixtures[i][2], awc:fixtures[i][3], dc:fixtures[i][4], res:fixtures[i][5] }; getFixtures.push(temp); } } //this.setState({fixtures:fixturesRet}) }) console.log(getFixtures) //Mapping function for the table const renderFixtures = (fixtures,index)=>{ return( <tr key={index}> <td>{fixtures.homeTeam}</td> <td>{fixtures.awayTeam}</td> <td>{fixtures.hwc}</td> <td>{fixtures.awc}</td> <td>{fixtures.dc}</td> <td>{fixtures.res}</td> </tr> ) } return( <div> {getFixtures[0]} <ReactBootstrap.Table striped bordered hover size="sm" variant="dark"> <thead> <tr> <th>Home Team</th> <th>Away Team</th> <th>Home win chances</th> <th>Away win chances</th> <th>Draw chances</th> <th>Likely result</th> </tr> </thead> <tbody> {getFixtures.map(renderFixtures)} </tbody> </ReactBootstrap.Table> </div> ); } export default resTable;
import "./Login.css"; import React, { useState } from "react"; import Form from "react-bootstrap/Form"; import Button from "react-bootstrap/Button"; import { loginRequest } from "../functions/ApiRequest"; import { GetUser } from "../sections/Users"; const Login = () => { const [user_id, setUser_Id] = useState(0); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [alert, setAlert] = useState(""); const [usertype, setUsertype] = useState(""); const [feature, setFeature] = useState(""); const [isLoggedIn, setIsLoggedIn] = useState(false); function validateForm() { return username.length > 0 && password.length > 0; } async function handleSubmit(event) { event.preventDefault(); console.log("Login clicked!"); var requestData = { username: username, password: password } var res = await loginRequest(requestData); console.log(res) if (res.message === "success") { setUsertype(res.data) setUser_Id(res.user_id) setIsLoggedIn(true) } else { setAlert("Username or Password incorrect.") } } var userarea = GetUser(usertype, user_id) if (isLoggedIn === false) { return ( <div className="Login"> <Form onSubmit={handleSubmit}> <h4>Please sign in to access the H+K Knowledge Base:</h4> <Form.Group size="lg" controlId="username"> <Form.Label>Username</Form.Label> <Form.Control autoFocus type="username" value={username} onChange={(e) => setUsername(e.target.value)} /> </Form.Group> <Form.Group size="lg" controlId="password"> <Form.Label>Password</Form.Label> <Form.Control type="password" value={password} onChange={(e) => setPassword(e.target.value)} /> </Form.Group> <Button block size="lg" type="submit" disabled={!validateForm()}> Login </Button> <h5 style={{ color: "orangered", }}>{alert}</h5> <h6 style={{ color: "grey", }}>For this demo, you can login using "employee", "client" or "manager" as username and password. Login as manager to create new users, you can then also login with. </h6> </Form> </div> ) } else { return ( <div> <div>{userarea}</div> <br></br> <hr></hr> <br></br> <Button block size="lg" onClick={() => setIsLoggedIn(false)}>Logout</Button> </div> ) } }; export default Login;