text
stringlengths
7
3.69M
import React, { Component } from 'react'; import './goods.css' import Scroll from '../../common/scroll/scroll.js' class Goods extends Component { render() { return ( <div className="goods"> <Scroll className="scroll"> <div className="container"> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> <div className="item">wwww</div> </div> </Scroll> </div> ); } } export default Goods;
export { SendFundsQrReader } from './send-funds-qr-reader';
import React from 'react' const Options = ({user, setSection}) => { return ( <div> <h4>Revisión de la cuenta</h4> <div className='profile-field'> <p className='pfield-title'>Tu nombre</p> <p className='pfield-content'>{user ? user.fullName : 'Cargando...'}</p> </div> <div className='profile-field-editable'> <div className='left-fields'> <p className='pfield-title'>Correo Electrónico</p> <p className='pfield-content'>{user ? user.eMail : 'Cargando...'}</p> </div> {/* <p onClick={() => {}} className='btn-minimal-width btn-full-width profile-edit-button-blocked'>EDITAR</p> */} <p onClick={() => setSection('email')} className='btn-minimal-width btn-full-width profile-edit-button'>EDITAR</p> </div> <div className='profile-field-editable'> <div className='left-fields'> <p className='pfield-title'>Número de teléfono</p> <p className='pfield-content'>{user ? user.mobile : 'Caargando...'}</p> </div> {/* <p onClick={() => {}} className='btn-minimal-width btn-full-width profile-edit-button-blocked'>EDITAR</p> */} <p onClick={() => setSection('phone')} className='btn-minimal-width btn-full-width profile-edit-button'>EDITAR</p> </div> <div className='profile-field-editable'> <div className='left-fields'> <p className='pfield-title'>Contraseña</p> <p className='pfield-content'>******</p> </div> {/* <p onClick={() => {}} className='btn-minimal-width btn-full-width profile-edit-button'>EDITAR</p> */} <p onClick={() => setSection('password')} className='btn-minimal-width btn-full-width profile-edit-button'>EDITAR</p> </div> <div className='profile-field-editable'> <div className='left-fields'> <p className='pfield-title'>Métodos de pago</p> {/* <p className='pfield-content'>Cuenta Bancaria</p> */} </div> {/* <p onClick={() => {}} className='btn-minimal-width btn-full-width profile-edit-button-blocked'>EDITAR</p> */} <p onClick={() => setSection('payment')} className='btn-minimal-width btn-full-width profile-edit-button'>EDITAR</p> </div> {/* <hr/> <div className='profile-field'> <p className='pfield-title'>Preferencias</p> <div style={{display: 'flex'}}><input style={{marginRight: '1rem'}} type='checkbox'/><p className='pfield-content'>Recibir promociones y ofertas</p></div> </div> */} </div> ) } export default Options
// 设置日期默认为当天 // var today = new Date(); // thisYear = today.getFullYear(); // thisMonth = addZero(today.getMonth() + 1); // js存月份的时候按数组来存的 // thisDay = addZero(today.getDate()); // function addZero(num) { // if (num < 10) { // num = '0' + num; // } // return num; // } // Today = thisYear + '-' + thisMonth + '-' + thisDay; // $('#StartDate').val(Today); var DayOptionStr = ''; var $Day = $('#Day'); function setDayOption() { var TypeVal = $('#Type').val() if (TypeVal == 'Month') { DayOptionStr = ''; for (var i = 1; i <= 30; i++) { DayOptionStr += '<option>' + i + '</option>' } $Day.html(DayOptionStr) } else if (TypeVal == 'Week') { DayOptionStr = ''; for (var i = 1; i <= 5; i++) { DayOptionStr += '<option>' + i + '</option>' } $Day.html(DayOptionStr) } } setDayOption(); $('#Type').change(setDayOption); // 刚开始处理一下传递的json, 这里处理日期插件 $("#StartDate").datetimepicker({ 'minView': 2, autoclose: true, format: 'yyyy-mm-dd' }); $("#EndDate").datetimepicker({ 'minView': 2, autoclose: true, format: 'yyyy-mm-dd' }); // 后台地址: ../Library/WebInsertXmlPage.tkx?Source=Query/CalciPush $('#searchData').click(function(event) { $('form input').trigger('blur') $('#loadingAnimate').fadeIn(1000) event = window.event || event; event.preventDefault(); var formData = $("form").serializeArray(); var formDataArr = []; $.each(formData, function(index, val) { formDataArr.push(formData[index].value); }); var toBackJson = { iPushCondition: { Tcode: '', StartDate: '', EndDate: '', Type: '', Day: '', Money: '' } }; var tbAnasCondition = toBackJson.iPushCondition; tbAnasCondition.Tcode = formDataArr[0]; tbAnasCondition.StartDate = formDataArr[1] tbAnasCondition.EndDate = formDataArr[2]; tbAnasCondition.Type = formDataArr[3]; tbAnasCondition.Day = formDataArr[4]; tbAnasCondition.Money = formDataArr[5]; toBackJson = JSON.stringify(toBackJson); // console.log(toBackJson) //已经出来了需要的字符串 // 调用 ajax先去触发一下后台,让后台产生数据 var backEndUrl = '../Library/WebInsertXmlPage.tkx?Source=Query/CalciPush'; // 后台地址 // var backEndUrl = 'http://localhost/Account/Library/WebInsertXmlPage.tkx?Source=Query/CalciPush'; // 后台地址 $.ajax({ url: backEndUrl, type: 'POST', data: toBackJson, cache: false, success: function() { // 这里最后就可以调用 getAllDataAndDrawTable 来获取两个jsonp数据并绘制表格了 getAllDataAndDrawTable(); } }); }); function getAllDataAndDrawTable() { // 这里取消一下全局的 ajax缓存,防止 IE 的巨坑 $.ajaxSetup({ cache: false }); // 这里设置一个全局变量,判断是否获取了meta var alreadyGetMeta = true; var allDataUrl = '../Library/WebListXmlPage.tkx?Source=Query/CalciPush'; // var allDataUrl = 'http://localhost/Account/Library/WebListXmlPage.tkx?Source=Query/CalciPush'; // 这个这里先写死的,注意改变后面的 &_toolkit=meta 和 &_toolkit=jsonp 就行 var allData = { thData: [], tdData: [] }; allData.tdData = []; $.ajax({ url: allDataUrl + '&_toolkit=meta', // 获取meta数据 type: 'GET', cache: false, success: function(data) { if (data.Table) { var ListField = data.Table.List.Field; var tempObj; $.each(ListField, function(index, val) { tempObj = {}; tempObj.DisplayName = ListField[index].DisplayName; tempObj.NickName = ListField[index].NickName; allData.thData.push(tempObj); }); } else { alreadyGetMeta = false; } } // 第一个数据获取完了之后获取第二个具体数据 }).done(function() { $('#loadingAnimate').fadeOut(1000); // 这里用全局的 alreadyGetMeta来判断是否获取到了 meta if (alreadyGetMeta) { $.ajax({ url: allDataUrl + '&_toolkit=jsonp', type: 'GET', cache: false }) .done(function(newData) { if (newData && newData.PushData) { var PushData = newData.PushData; // 先用来绘制 3线图 var lineChartData = { ExchangeDateArr: [], ClosePriceArr: [], MySumArr: [], MyTotalArr: [] }; $.each(PushData, function(index, val) { lineChartData.ExchangeDateArr.push(val.ExchangeDate.substring(0, 10)); lineChartData.ClosePriceArr.push((+val.ClosePrice).toFixed(2)); lineChartData.MySumArr.push((+val.MySum).toFixed(2)); lineChartData.MyTotalArr.push((+val.MyTotal).toFixed(2)); }); // 到这里为止已经获取了所有需要的数据了 // 开始绘制 3线的 line 图,且必须在模态框出现后才能开始绘制,不然就不会有图像 $('#myModal').on('shown.bs.modal', function(e) { require.config({ paths: { echarts: 'echarts-2.2.7/build/dist/' } }); require(['echarts', 'echarts/chart/line'], function(ec) { var myChart = ec.init(document.getElementById('threeLineChart'), 'macarons'); var option = { title: { text: '定值模拟计算', x: 'center' }, tooltip: { trigger: 'axis', formatter: function(params) { return params[0].name + '<br/>' + params[0].seriesName + ' : ' + params[0].value + ' (元)<br/>' + params[1].seriesName + ' : ' + params[1].value + ' (元)<br/>' + params[2].seriesName + ' : ' + params[2].value + ' (元)'; } }, legend: { data: ['价格', '净值', '本金'], x: 'left' }, toolbox: { show: true, feature: { mark: { show: true }, dataView: { show: true, readOnly: false }, restore: { show: true }, saveAsImage: { show: true } } }, dataZoom: { show: true, realtime: true, start: 0, end: 100 }, xAxis: [{ type: 'category', boundaryGap: false, axisLine: { onZero: false }, data: lineChartData.ExchangeDateArr }], yAxis: [{ name: '净值和本金(元)', type: 'value' }, { name: '价格(元)', type: 'value' }], series: [{ name: '价格', type: 'line', yAxisIndex: 1, data: lineChartData.ClosePriceArr }, { name: '净值', type: 'line', data: lineChartData.MySumArr }, { name: '本金', type: 'line', data: lineChartData.MyTotalArr }] }; myChart.setOption(option) }) // 绘制 line-chart结束 }) var tempArr; var item, metaItem; // console.log(allData.thData) //这是上一个 ajax获取来的 th数据,所有的 th 都是有的 // 在具体数据获取的时候,就按 属性名 去获取 $.each(PushData, function(index, val) { tempArr = []; tempArr.push( val.ExchangeDate.substring(0, 10), (+val.ClosePrice).toFixed(2), (+val.MyAccount).toFixed(2), (+val.MySum).toFixed(2), (+val.MyTotal).toFixed(2), (+val.MyProfit).toFixed(2) ); allData.tdData.push(tempArr) }); // 再转化一下 columns 需要的格式,这部分已经完成了 var columnsData = []; var tempObj = {}; $.each(allData.thData, function(index, val) { tempObj = {}; tempObj.title = val.DisplayName || ''; tempObj.defaultContent = ''; columnsData.push(tempObj); }); // console.log('columnsData is : ' + columnsData[0].title) // 这里是处理 table 重新渲染报错的问题,解决方案 http://datatables.net/manual/tech-notes/3#destroy, 不太好用,换种方式 // 所有数据都齐全了开始绘制表格 var windowHeight = $(window).height() - 130; $("#showTable").empty().append('<table id="ccTable" class="display table-nowrap table-bordered"></table>'); var ccTable = $('#ccTable').DataTable({ info: false, paging: false, searching: false, scrollY: windowHeight + 'px', columns: columnsData, // 这里需要有列的名字, 即 th的名字 data: allData.tdData, dom: 'T<"clear">lfrtip', tableTools: { "aButtons": [{ "sExtends": "copy", "sButtonText": "复制" }, { "sExtends": "xls", "sButtonText": "导出" }], "sSwfPath": "../DataTables-1.10.7/extensions/TableTools/swf/copy_csv_xls.swf" } }); $('#showChartBtn').show() } else { $('#showTable').empty().append('<div class="alert alert-warning" style="margin-top: 100px">请修改您的计算条件</div>'); $('#showChartBtn').hide(); $('#threeLineChart').empty(); } }) } else { $('#showTable').empty().append('<div class="alert alert-warning" style="margin-top: 100px">请修改您的计算条件</div>'); $('#showChartBtn').hide(); $('#threeLineChart').empty(); } }) }
// Confettibin.member/base.js // //$ PackConfig { "sprites" : [ "base.png" ] } //$! module.exports = { id: "Confettibin.member", sprite: "base.png", sprite_format: "pt_vertcol-32", name: "confettibin", infodex: "meta.community.confettibin", sprite_creator: "Confettibin", };
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var eibd_1 = require("eibd"); var rxjs_1 = require("rxjs"); var chalk_1 = require("chalk"); var EibdController = /** @class */ (function () { function EibdController(socketPath) { var _this = this; this.opts = { host: '--socket', path: socketPath }; /// Create SocketMessage Observable this.socketsMessage$ = new rxjs_1.Observable(function (observer) { _this.socketObserver = observer; }); } /** * Main Listener FN */ EibdController.prototype.listen = function () { var _this = this; return new Promise(function (resolve) { _this.initKnxd().then(function (knxdAlive) { if (!knxdAlive) { console.log(chalk_1.red("KNXD service is not alive!")); resolve(); return; } _this.groupSocketListen(function (err, parser) { if (err) { console.log(chalk_1.red('GroupSocketListen Error', err)); } console.log(chalk_1.yellow('GroupSocketListener started')); parser.on('write', function (src, dest, type, val) { var msg = { action: 'write', datetime: new Date(), src: src, dest: dest, type: type, val: val }; _this.emitSocketObserver(msg); }); parser.on('response', function (src, dest, type, val) { var msg = { action: 'response', datetime: new Date(), src: src, dest: dest, type: type, val: val }; _this.emitSocketObserver(msg); }); parser.on('read', function (src, dest) { var msg = { action: 'read', datetime: new Date(), src: src, dest: dest, type: null, val: null }; _this.emitSocketObserver(msg); }); resolve(); }); }); }); }; /** * Emits an message to */ EibdController.prototype.emitSocketObserver = function (msg) { this.socketObserver.next(msg); }; /** * Checks if knxd is running and skips listener */ EibdController.prototype.initKnxd = function () { return new Promise(function (resolve, reject) { require('find-process')('name', 'knxd').then(function (processList) { /// Requery ProcessList to filter by bin var knxdProcess = processList.find(function (process) { return process.bin === '/usr/bin/knxd'; }); resolve(!!knxdProcess); }); }); }; /** * Start GroupSocketListen * Do not use internal conn object */ EibdController.prototype.groupSocketListen = function (callback) { var _this = this; var conn = eibd_1.Connection(); conn.socketRemote(this.opts, function (err) { if (err) { callback(err); return; } conn.openGroupSocket(0, function (parser) { callback(undefined, parser); }); }); conn.on('close', function () { //restart... setTimeout(function () { _this.groupSocketListen(callback); }, 100); }); }; /** * Basic GroupRead */ EibdController.prototype.groupRead = function (gad, callback) { var conn = eibd_1.Connection(); conn.socketRemote(this.opts, function (err) { if (err) { callback(err); return; } var address = eibd_1.str2addr(gad); conn.openTGroup(address, 0, function (err) { if (err) { callback(err); return; } var msg = eibd_1.createMessage('read'); conn.sendAPDU(msg, callback); }); }); }; /** * groupsend * Send a KNX telegram with support for read/write/response messages and DPT1, DPT2, DPT3, DPT5, DPT9 data format * Contains functionality from groupread/groupwrite/groupswrite in one cmd line application * * Arguments: host port gad action dpt value * gad = groupnumber (Ex. 1/2/34) * action = eibd action (read , write or response) * dpt = data point type for write/response (Ex. DPT1, DPT2, DPT3, DPT5, DPT9) * value = data value for write/response (Ex. true , 23 , 12.23) */ EibdController.prototype.send = function (args, callback) { var conn = eibd_1.Connection(); conn.socketRemote(this.opts, function (err) { if (err) { callback(err); return; } var address = eibd_1.str2addr(args.dest); conn.openTGroup(address, 0, function (err) { if (err) { callback(err); return; } var msg = eibd_1.createMessage(args.action, args.type, parseFloat(args.val)); conn.sendAPDU(msg, callback); }); }); }; return EibdController; }()); exports.EibdController = EibdController;
const assert = require('assert'); const { returnsThree, reciprocal } = require('../problems/number-fun.js') describe("returnsThree()", () => { it('Should return three', () => { assert.strictEqual(returnsThree(), 3) }); }); describe("reciprocal()", () => { context("When input is a number and between 1 and 1,000,000", () => { it('Should return the recipocal', () => { assert.strictEqual(reciprocal(2), 1 / 2) assert.strictEqual(reciprocal(1000), 1 / 1000) assert.strictEqual(reciprocal(575), 1 / 575) }); it('Should be between 1 and 1,000,000', () => { assert.throws(() => reciprocal(-5000000000), TypeError) assert.throws(() => reciprocal(0), TypeError) assert.throws(() => reciprocal(1000000000000), TypeError) }) }); context("When input is NaN", () => { it('Should throw a TypeError', () => { assert.throws(() => reciprocal('42'), TypeError) }); }) });
import { useEffect } from 'react'; import { connect } from 'react-redux'; import { getCountries } from '../../Actions/CountriesActions.js' function CountryCard({countries, getCountries}){ function getCountriesFunction() { getCountries(); } useEffect(() => { getCountriesFunction(); },); return ( <div> {countries.map((country) => { return ( <div> <h4>{country.id}</h4> <h4>{country.name}</h4> <h4>{country.flag}</h4> <h4>{country.continent}</h4> </div> ); })} </div> ); }; const mapStateToProps = state => { return { countries: state.countries } } const mapDispatchToProps = dispatch => { return { getCountries: countries => dispatch(getCountries(countries)), } } export default connect(mapStateToProps, mapDispatchToProps)(CountryCard);
module.exports.overview = function (req, res) { return res.status(200); } module.exports.analytics = function (req, res) { }
import React from 'react'; import { Row, Col,Card, Button, Icon, Divider, Message, Form, Select, Input, Table} from 'antd'; import {fetch} from '../../api/tools' const FormItem = Form.Item; const Option = Select.Option; const vioType = [ {key:1,name:'有违章'}, {key:2,name:'无违章'}, {key:3,name:'有可办违章'}, // {key:4,name:'有不可办违章'}, // {key:5,name:'有扣分违章'}, // {key:6,name:'有办理中违章'}, ]; const columns = [{ title: '序号', dataIndex: 'number', key: 'number', }, { title: '车牌', dataIndex: 'carNumber', key: 'carNumber', }, { title: '车架号', dataIndex: 'carCode', key: 'carCode', }, { title: '发动机号', dataIndex: 'carDriveCode', key: 'carDriveCode', }]; class TestCarNum extends React.Component { state = { activeIndex: 0, carList:[] }; handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { // console.log('Received values of form: ', values); this.fetchVioListCar(1,values.prefix, values.queryType) } }); }; onChange = (value) =>{ console.log(value); } componentDidMount(){ this.fetchVioListCar('1') } fetchVioListCar = (current,prefix='',queryType='', appKey=this.props.appKey) => { fetch('get',`/usercenter/violation/list/test?current=${current}&size=10&prefix=${prefix}&queryType=${queryType}&appKey=${appKey}`).then(res=>{ if(res.code == 0){ let carList = res.data; carList.length >0 && carList.forEach((item,index)=>{ item.number = index+1; }) this.setState({carList: carList}) }else{ Message.destroy() Message.error(res.msg) } }) } render() { const { getFieldDecorator} = this.props.form; const { carList } = this.state return ( <div> <Row type="flex" justify="space-between" align='middle' className='mb15'> <Col span={18} style={{fontSize: 14, fontWeight: 500}}> <div>测试车牌可用于测试违章查询的流程,车牌信息均为真实数据,请勿随意反复测试。</div> <div>每日限获取50条测试车牌数据。</div> <div>若产生测试订单需要退单,请联系客服:020 - 324345355。</div> </Col> {/*<Col span={6} style={{textAlign: 'right'}}>*/} {/*<Button style={{marginLeft: 30}} type='primary' >返回</Button>*/} {/*</Col>*/} </Row> <Form layout="inline" onSubmit={this.handleSubmit} > <FormItem> {getFieldDecorator('prefix', { rules: [], })( <Input style={{width: '150px'}} placeholder="请输入车牌前缀" maxLength={7} /> )} </FormItem> <FormItem> {getFieldDecorator('queryType', { rules: [], })( <Select dropdownMatchSelectWidth={false} allowClear={true} placeholder="请选择违章情况"> {vioType.map((item,index)=> <Option value={item.key} key={index}>{item.name}</Option> )} </Select> )} </FormItem> <FormItem> <Button type="primary" htmlType="submit" > 查询 </Button> </FormItem> </Form> <Table className='mt15' columns={columns} dataSource={carList} /> </div> ); } } export default Form.create()(TestCarNum);
// const discord = require('discord.js') // module.exports = discord.Structures.extend('Message', Message => { // class DiscordMesssage extends Message { // constructor() { // super() // } // send(content) { // this.channel.send(content); // } // } // return DiscordMesssage; // });
const creatingNextTrip = (trip) => { const { place, dataReceived, dateInformation } = trip; // Showing this component if an error appear if (Object.keys(dataReceived).length === 0) { loader(false); return `<div class="card blue-grey darken-1"> <div class="card-content white-text"> <span class="card-title">Sorry, something happens</span> </div> <div class="card-action"> <p class="white-text">The place you entered doesnt exist in our data base</p> <a href="#" class="error__button">Submit another place</a> </div> </div>`; // if everything okay render the api information } else { // removing the loader component loader(false); return `<div class="trip__item card blue-grey darken-1"> <article class="trip__article white-text"> <h2 class="heading-2">My trip to: <span>${place}</span></h2> <h3 class="card-title">Departing: In <span>${dateInformation.timeToTravel}</span> days</h3> <h3 class="card-title">Forecast Prediction</h3> <div class="trip__forecast"> <img src="https://www.weatherbit.io/static/img/icons/${dataReceived.forecast.icon.icon}.png" class="trip__forecast-img"/> <p>${dataReceived.forecast.temp}°C</p> </div> <button class="trip__button btn waves-effect waves-light red">Add to Favorite</button> </article> <figure class="trip__figure white-text"> <img src=${dataReceived.picture.imgURL} alt="Pixa Bay picture" class="trip__image" /> <figcaption>Pixa bay picture taken by: ${dataReceived.picture.user}</figcaption> </figure> </div>`; } }; //loader component const loader = (status) => { const $loader = document.querySelector(".preloader"); status ? $loader.classList.remove("hide") : $loader.classList.add("hide"); }; // Adding trips to favorite container const favoriteTrip = (trips) => { return trips .map((trip, index) => { const { place, dataReceived, dateInformation } = trip; return `<div class="favorite__item card" id=${index}> <div class="card-image"> <img src=${dataReceived.picture.imgURL} class="favorite__image"/> <span class="card-title">${place}</span> <a class="btn-floating halfway-fab waves-effect waves-light red" ><i class="material-icons">delete</i></a > </div> <div class="card-content"> <h3 class="card-title">Departing in <span>${dateInformation.timeToTravel}</span> days.</h3> </div> </div>`; }) .join(""); }; export { creatingNextTrip, loader, favoriteTrip };
(function () { var scriptName = "TimePicker"; function execute() { Type.registerNamespace('VitalShining.Galaxy'); VitalShining.Galaxy.TimePickerBehavior = function (element) { VitalShining.Galaxy.TimePickerBehavior.initializeBase(this, [element]); this._textbox = Sys.Extended.UI.TextBoxWrapper.get_Wrapper(element); this._enabled = true; this._button = null; this._popupMouseDown = false; this._selectedTime = null; this._selectedTimeChanging = false; this._format = 'HH:mm'; this._isOpen = false; this._cssClass = "ajax__timepicker"; this._minutesRange = 15; this._maxValue = null; this._minValue = null; this._availableFormats = [ "HH:mm", "H:m", "HH:m", "H:mm", "hh:mm tt", "h:m tt", "h:mm tt", "hh:m tt", "hh:mm t", "h:m t", "h:mm t", "hh:m t" ]; this._hours = null; this._hours_cells = null; this._hours_names = null; this._minutes = null; this._minutes_cells = null; this._minutes_names = null; this._designators = null; this._designators_cells = null; this._hours_designators = null; this._hours_designators_cells = null; this._hoursPopupBehavior = null; this._minutesPopupBehavior = null; this._designatorsPopupBehavior = null; this._blur = new Sys.Extended.UI.DeferredOperation(1, this, this.blur); this._hide = new Sys.Extended.UI.DeferredOperation(0, this, this.hide); this._popup$delegates = { mousedown: Function.createDelegate(this, this._popup_onmousedown), mouseup: Function.createDelegate(this, this._popup_onmouseup), drag: Function.createDelegate(this, this._popup_onevent), dragstart: Function.createDelegate(this, this._popup_onevent) } this._element$delegates = { change: Function.createDelegate(this, this._element_onchange), keypress: Function.createDelegate(this, this._element_onkeypress), click: Function.createDelegate(this, this._element_onclick), focus: Function.createDelegate(this, this._element_onfocus), blur: Function.createDelegate(this, this._element_onblur) } this._button$delegates = { click: Function.createDelegate(this, this._button_onclick), keypress: Function.createDelegate(this, this._button_onkeypress), blur: Function.createDelegate(this, this._button_onblur) } this._designator_cell$delegates = { mouseover: Function.createDelegate(this, this._designator_cell_onmouseover), click: Function.createDelegate(this, this._designator_cell_onclick) } this._hour_cell$delegates = { mouseover: Function.createDelegate(this, this._hour_cell_onmouseover), click: Function.createDelegate(this, this._hour_cell_onclick) } this._minute_cell$delegates = { mouseover: Function.createDelegate(this, this._minute_cell_onmouseover), click: Function.createDelegate(this, this._minute_cell_onclick) } } VitalShining.Galaxy.TimePickerBehavior.prototype = { //#region initialize & dispose initialize: function () { VitalShining.Galaxy.TimePickerBehavior.callBaseMethod(this, 'initialize'); var elt = this.get_element(); $addHandlers(elt, this._element$delegates); if (this._button) { $addHandlers(this._button, this._button$delegates); } }, dispose: function () { if (this._button) { $common.removeHandlers(this._button, this._button$delegates); this._button = null; } if (this._element$delegates) { $common.removeHandlers(this.get_element(), this._element$delegates); this._element$delegates = null; } if (this._minutesPopupBehavior) { this._minutesPopupBehavior.dispose(); this._minutesPopupBehavior = null; } if (this._hoursPopupBehavior) { this._hoursPopupBehavior.dispose(); this._hoursPopupBehavior = null; } if (this._designatorsPopupBehavior) { this._designatorsPopupBehavior.dispose(); this._designatorsPopupBehavior = null; } if (this._minutes) { for (var i = 0, l = this._minutes_cells.length; i < l; i++) { $common.removeHandlers(this._minutes_cells[i], this._minute_cell$delegates); } $common.removeElement(this._minutes); this._minutes = null; this._minutes_cells = null; this._minute_cell$delegates = null; } if (this._hours) { for (var i = 0, l = this._hours_cells.length; i < l; i++) { $common.removeHandlers(this._hours_cells[i], this._hour_cell$delegates); } $common.removeElement(this._hours); this._hours = null; this._hours_cells = null; this._hour_cell$delegates = null; } if (this._designators) { for (var i = 0, l = this._designators_cells.length; i < l; i++) { $common.removeHandlers(this._designators_cells[i], this._designator_cell$delegates); } $common.removeElement(this._designators); this._designators = null; this._designators_cells = null; this._designator_cell$delegates = null; } VitalShining.Galaxy.TimePickerBehavior.callBaseMethod(this, 'dispose'); }, //#endregion //#region properties //#region isOpen get_isOpen: function () { /// <value type="Boolean"> /// Whether the picker is open /// </value> return this._isOpen; }, //#endregion //#region enabled get_enabled: function () { /// <value type="Boolean"> /// Whether this behavior is available for the current element /// </value> return this._enabled; }, set_enabled: function (value) { if (this._enabled != value) { this._enabled = value; this.raisePropertyChanged("enabled"); } }, //#endregion //#region button get_button: function () { /// <value type="Sys.UI.DomElement"> /// The button to use to show the calendar (optional) /// </value> return this._button; }, set_button: function (value) { if (this._button != value) { if (this._button && this.get_isInitialized()) { $common.removeHandlers(this._button, this._button$delegates); } this._button = value; if (this._button && this.get_isInitialized()) { $addHandlers(this._button, this._button$delegates); } this.raisePropertyChanged("button"); } }, //#endregion //#region format get_format: function () { /// <value type="String"> /// The format to use for the date value /// </value> return this._format; }, set_format: function (value) { if (!value) { throw Error.argumentNull('format', 'The format of time picker cannot be null or empty.'); } if (Array.indexOf(this._availableFormats, value) == -1) { throw Error.argument('format', 'The format of time picker is not acceptable.'); } if (this._format != value) { this._format = value; this.raisePropertyChanged("format"); } }, //#endregion //#region selectedTime get_selectedTime: function () { /// <value type="Time"> /// The time value represented by the text box /// </value> if (this._selectedTime == null) { var value = this._textbox.get_Value(); if (value) { value = Time.parseLocale(value, this.get_format()); if (value) { this._selectedTime = value; } } } return this._selectedTime; }, set_selectedTime: function (value) { if (value && (String.isInstanceOfType(value)) && (value.length != 0)) { value = new Time(value); } if ((this._selectedTime === null && value !== null) || (this._selectedTime !== null && !this._selectedTime.equals(value))) { this._selectedTime = value; this._selectedTimeChanging = true; var text = ""; if (value) { text = value.localeFormat(this._format); } if (text != this._textbox.get_Value()) { this._textbox.set_Value(text); this._fireChanged(); } this._selectedTimeChanging = false; this.raisePropertyChanged("selectedTime"); } }, //#endregion //#region cssClass get_cssClass: function () { /// <value type="String"> /// The CSS class selector to use to change the time picker's appearance /// </value> return this._cssClass; }, set_cssClass: function (value) { if (this._cssClass != value) { if (this._cssClass && this.get_isInitialized()) { Sys.UI.DomElement.removeCssClass(this._container, this._cssClass); } this._cssClass = value; if (this._cssClass && this.get_isInitialized()) { Sys.UI.DomElement.addCssClass(this._container, this._cssClass); } this.raisePropertyChanged("cssClass"); } }, //#endregion //#region minutesRange get_minutesRange: function () { /// <value type="Number"> /// The minutes range for the time picker. /// </value> return this._minutesRange; }, set_minutesRange: function (value) { if (this._minutesRange != value) { this._minutesRange = value; this.raisePropertyChanged("minutesRange"); } }, //#endregion //#region maxValue get_maxValue: function () { return this._maxValue; }, set_maxValue: function (value) { if (value) { if (typeof (value) == 'string') { var args = [value]; Array.addRange(args, this._availableFormats); value = Time.parseLocale.apply(this, args) || Time.parseInvariant.apply(this, args); } else if (Object.getType(value) != Time) { throw Error.argument('maxValue', 'The type of maximum value must be string or time.'); } } if ((this._maxValue == null && value) || (this._maxValue && !this._maxValue.equals(value))) { this._maxValue = value; this.raisePropertyChanged("maxValue"); } }, //#endregion //#region minValue get_minValue: function () { return this._minValue; }, set_minValue: function (value) { if (value) { if (typeof (value) == 'string') { var args = [value]; Array.addRange(args, this._availableFormats); value = Time.parseLocale.apply(this, args) || Time.parseInvariant.apply(this, args); } else if (Object.getType(value) != Time) { throw Error.argument('minValue', 'The type of minimum value must be string or time.'); } } if ((this._minValue == null && value) || (this._minValue && !this._minValue.equals(value))) { this._minValue = value; this.raisePropertyChanged("minValue"); } }, //#endregion //#endregion //#endregion //#region events //#region showing add_showing: function (handler) { /// <summary> /// Adds an event handler for the <code>showiwng</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to add to the event. /// </param> /// <returns /> this.get_events().addHandler("showing", handler); }, remove_showing: function (handler) { /// <summary> /// Removes an event handler for the <code>showing</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to remove from the event. /// </param> /// <returns /> this.get_events().removeHandler("showing", handler); }, raiseShowing: function (eventArgs) { /// <summary> /// Raise the showing event /// </summary> /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> /// Event arguments for the showing event /// </param> /// <returns /> var handler = this.get_events().getHandler('showing'); if (handler) { handler(this, eventArgs); } }, //#endregion //#region shown add_shown: function (handler) { /// <summary> /// Adds an event handler for the <code>shown</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to add to the event. /// </param> /// <returns /> this.get_events().addHandler("shown", handler); }, remove_shown: function (handler) { /// <summary> /// Removes an event handler for the <code>shown</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to remove from the event. /// </param> /// <returns /> this.get_events().removeHandler("shown", handler); }, raiseShown: function () { /// <summary> /// Raise the <code>shown</code> event /// </summary> /// <returns /> var handlers = this.get_events().getHandler("shown"); if (handlers) { handlers(this, Sys.EventArgs.Empty); } }, //#endregion //#region hiding add_hiding: function (handler) { /// <summary> /// Adds an event handler for the <code>hiding</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to add to the event. /// </param> /// <returns /> this.get_events().addHandler("hiding", handler); }, remove_hiding: function (handler) { /// <summary> /// Removes an event handler for the <code>hiding</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to remove from the event. /// </param> /// <returns /> this.get_events().removeHandler("hiding", handler); }, raiseHiding: function (eventArgs) { /// <summary> /// Raise the hiding event /// </summary> /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false"> /// Event arguments for the hiding event /// </param> /// <returns /> var handler = this.get_events().getHandler('hiding'); if (handler) { handler(this, eventArgs); } }, //#endregion //#region hidden add_hidden: function (handler) { /// <summary> /// Adds an event handler for the <code>hidden</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to add to the event. /// </param> /// <returns /> this.get_events().addHandler("hidden", handler); }, remove_hidden: function (handler) { /// <summary> /// Removes an event handler for the <code>hidden</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to remove from the event. /// </param> /// <returns /> this.get_events().removeHandler("hidden", handler); }, raiseHidden: function () { /// <summary> /// Raise the <code>hidden</code> event /// </summary> /// <returns /> var handlers = this.get_events().getHandler("hidden"); if (handlers) { handlers(this, Sys.EventArgs.Empty); } }, //#endregion //#region timeSelectionChanged add_timeSelectionChanged: function (handler) { /// <summary> /// Adds an event handler for the <code>timeSelectionChanged</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to add to the event. /// </param> /// <returns /> this.get_events().addHandler("timeSelectionChanged", handler); }, remove_timeSelectionChanged: function (handler) { /// <summary> /// Removes an event handler for the <code>timeSelectionChanged</code> event. /// </summary> /// <param name="handler" type="Function"> /// The handler to remove from the event. /// </param> /// <returns /> this.get_events().removeHandler("timeSelectionChanged", handler); }, raiseTimeSelectionChanged: function () { /// <summary> /// Raise the <code>timeSelectionChanged</code> event /// </summary> /// <returns /> var handlers = this.get_events().getHandler("timeSelectionChanged"); if (handlers) { handlers(this, Sys.EventArgs.Empty); } }, //#endregion //#endregion //#region popup element event handlers _popup_onevent: function (e) { /// <summary> /// Handles the drag-start event of the popup time picker /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); e.preventDefault(); }, _popup_onmousedown: function (e) { /// <summary> /// Handles the mousedown event of the popup /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> // signal that the popup has received a mousedown event, this handles // onblur issues on browsers like FF, OP, and SF this._popupMouseDown = true; }, _popup_onmouseup: function (e) { /// <summary> /// Handles the mouseup event of the popup /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> // signal that the popup has received a mouseup event, this handles // onblur issues on browsers like FF, OP, and SF if (Sys.Browser.agent === Sys.Browser.Opera && this._blur.get_isPending()) { this._blur.cancel(); } this._popupMouseDown = false; this.focus(); }, //#endregion //#region textbox event handlers _element_onfocus: function (e) { /// <summary> /// Handles the focus event of the element /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._enabled) return; if (!this._button) { this.show(); // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; } }, _element_onblur: function (e) { /// <summary> /// Handles the blur event of the element /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._enabled) return; if (!this._button) { this.blur(); } }, _element_onchange: function (e) { /// <summary> /// Handles the change event of the element /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._selectedTimeChanging) { var text = this._textbox.get_Value(); this._selectedTime = text ? Time.parseLocale(text, this.get_format()) : null } }, _element_onkeypress: function (e) { /// <summary> /// Handles the keypress event of the element /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._enabled) return; if (!this._button && e.charCode == Sys.UI.Key.esc) { e.stopPropagation(); e.preventDefault(); this.hide(); } }, _element_onclick: function (e) { /// <summary> /// Handles the click event of the element /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._enabled) return; if (!this._button) { this.show(); // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; } }, //#endregion //#region button event handlers _button_onclick: function (e) { /// <summary> /// Handles the click event of the asociated button /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.preventDefault(); e.stopPropagation(); if (!this._enabled) return; if (!this._isOpen) { this.show(); } else { this.hide(); } this.focus(); // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; }, _button_onblur: function (e) { /// <summary> /// Handles the blur event of the button /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._enabled) return; if (!this._popupMouseDown) { this.hide(); } // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; }, _button_onkeypress: function (e) { /// <summary> /// Handles the keypress event of the element /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> if (!this._enabled) return; if (e.charCode == Sys.UI.Key.esc) { e.stopPropagation(); e.preventDefault(); this.hide(); } // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; }, //#endregion //#region cell event handlers _designator_cell_onmouseover: function (e) { /// <summary> /// Handles the mouseover event of a designator cell /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); var className = this._cssClass + "_hover"; this._clearCssClass(this._designators, className); Sys.UI.DomElement.addCssClass(e.target, className); if (this._minutes) { this._minutesPopupBehavior.hide(); } if (this._hours) { this._hoursPopupBehavior.hide(); } this._showHours(e.target.designator, e.target, false); }, _hour_cell_onmouseover: function (e) { /// <summary> /// Handles the mouseover event of an hour cell /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); var className = this._cssClass + "_hover"; this._clearCssClass(this._hours, className); Sys.UI.DomElement.addCssClass(e.target, className); if (this._minutes) { this._minutesPopupBehavior.hide(); } this._showMinutes(e.target.hours, e.target); }, _minute_cell_onmouseover: function (e) { /// <summary> /// Handles the mouseover event of a minute cell /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); var className = this._cssClass + "_hover"; this._clearCssClass(this._minutes, className); Sys.UI.DomElement.addCssClass(e.target, className); }, _designator_cell_onclick: function (e) { /// <summary> /// Handles the click event of a designator cell /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); e.preventDefault(); }, _hour_cell_onclick: function (e) { /// <summary> /// Handles the click event of an hour cell /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); e.preventDefault(); if (!this._enabled) return; if (this._minutesRange == 60) { this.set_selectedTime(new Time(e.target.hours, 0)); this._hide.post(); } }, _minute_cell_onclick: function (e) { /// <summary> /// Handles the click event of a minute cell /// </summary> /// <param name="e" type="Sys.UI.DomEvent">The arguments for the event</param> e.stopPropagation(); e.preventDefault(); if (!this._enabled) return; this.set_selectedTime(e.target.time); this._hide.post(); }, //#endregion //#region popup behaviors event handlers _popup_onhidden: function (popup, args) { /// <summary> /// Handles the hidden event of a popup behavior /// </summary> /// <param name="popup" type="Sys.Extended.UI.PopupBehavior">The popup behavior.</param> /// <param name="args" type="Sys.EventArgs">The event arguments.</param> this._clearCssClass(popup.get_element(), this._cssClass + "_hover"); }, _designators_popup_onshown: function (sender, args) { /// <summary> /// Handles the shown event of the designators popup behavior /// </summary> /// <param name="sender" type="Sys.Extended.UI.PopupBehavior">The designators popup behavior.</param> /// <param name="args" type="Sys.EventArgs">The event arguments.</param> var className = this._cssClass + "_active"; this._clearCssClass(this._designators, className); // Extract the designator from the selected time and represent it when the designator popup is shown. var time = this.get_selectedTime(); if (time) { var dtf = Sys.CultureInfo.CurrentCulture.dateTimeFormat; var designator = time.getHours() >= 12 ? dtf.PMDesignator : dtf.AMDesignator; var element = this._findDesignatorElement(designator); if (element) { Sys.UI.DomElement.addCssClass(this._findDesignatorElement(designator), className); } } }, _hours_popup_onshown: function (sender, args) { /// <summary> /// Handles the shown event of the hours popup behavior /// </summary> /// <param name="sender" type="Sys.Extended.UI.PopupBehavior">The hours popup behavior.</param> /// <param name="args" type="Sys.EventArgs">The event arguments.</param> var className = this._cssClass + "_active"; this._clearCssClass(this._hours, className); // Extract the hours from the selected time and represent it when the hours popup is shown. var time = this.get_selectedTime(); if (time) { var element = this._findHoursElement(time.getHours()); if (element) { Sys.UI.DomElement.addCssClass(element, className); } } }, _minutes_popup_onshown: function (sender, args) { /// <summary> /// Handles the shown event of the minutes popup behavior /// </summary> /// <param name="sender" type="Sys.Extended.UI.PopupBehavior">The minutes popup behavior.</param> /// <param name="args" type="Sys.EventArgs">The event arguments.</param> var className = this._cssClass + "_active"; this._clearCssClass(this._minutes, className); // Extract the minutes from the selected time and represent it when the minutes popup is shown. var time = this.get_selectedTime(); if (time) { var element = this._findMinutesElement(time); if (element) { Sys.UI.DomElement.addCssClass(element, className); } } }, //#endregion //#region build DOM elements _buildDesignators: function () { var dtf = Sys.CultureInfo.CurrentCulture.dateTimeFormat; var id = this.get_id(); var elt = this.get_element(); // Create container element for designators. this._designators = $common.createElementFromTemplate({ nodeName: "div", properties: { id: id + "_designators" }, cssClasses: [this._cssClass + "_designators"], events: this._popup$delegates }, elt.parentNode); this._designatorsPopupBehavior = $create(Sys.Extended.UI.PopupBehavior, { parentElement: elt, positioningMode: Sys.Extended.UI.PositioningMode.BottomLeft }, { hidden: Function.createDelegate(this, this._popup_onhidden), shown: Function.createDelegate(this, this._designators_popup_onshown) }, null, this._designators); this._designators_cells = []; // Create cell for AM designator Array.add(this._designators_cells, $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_cell"], properties: { id: id + "_designator_am", designator: dtf.AMDesignator, innerHTML: dtf.AMDesignator }, events: this._designator_cell$delegates }, this._designators)); // Create cell for PM designator Array.add(this._designators_cells, $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_cell"], properties: { id: id + "_designator_pm", designator: dtf.PMDesignator, innerHTML: dtf.PMDesignator }, events: this._designator_cell$delegates }, this._designators)); }, _buildHours: function () { var id = this.get_id(); // Create container element for hours this._hours = $common.createElementFromTemplate({ nodeName: "div", properties: { id: id + "_hours" }, cssClasses: [this._cssClass + "_hours"], events: this._popup$delegates }, this.get_element().parentNode); this._hoursPopupBehavior = $create(Sys.Extended.UI.PopupBehavior, { positioningMode: Sys.Extended.UI.PositioningMode.BottomLeft }, { hidden: Function.createDelegate(this, this._popup_onhidden), shown: Function.createDelegate(this, this._hours_popup_onshown) }, null, this._hours); this._hours_designators = $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_designators"], properties: { style: { cssFloat: 'left' } } }, this._hours); var dtf = Sys.CultureInfo.CurrentCulture.dateTimeFormat; this._hours_designators_cells = []; Array.add(this._hours_designators_cells, $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_cell"], properties: { designator: dtf.AMDesignator, innerHTML: dtf.AMDesignator, style: { cursor: 'default' } } }, this._hours_designators)); Array.add(this._hours_designators_cells, $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_cell"], properties: { designator: dtf.PMDesignator, innerHTML: dtf.PMDesignator, style: { cursor: 'default' } } }, this._hours_designators)); // Create cells for hours representation. this._hours_cells = []; for (var i = 0; i < 12; i++) { Array.add(this._hours_cells, $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_cell"], properties: { id: id + "_hour_" + i }, events: this._hour_cell$delegates }, this._hours)); } this._hours_names = $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_names"] }, this._hours); $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_name"], properties: { innerHTML: VitalShining.Galaxy.TimePickerResources.Hours } }, this._hours_names); }, _buildMinutes: function () { var id = this.get_id(); // Create container element of the minutes. this._minutes = $common.createElementFromTemplate({ nodeName: "div", properties: { id: id + "_minutes" }, cssClasses: [this._cssClass + "_minutes"], events: this._popup$delegates }, this.get_element().parentNode); this._minutesPopupBehavior = $create(Sys.Extended.UI.PopupBehavior, { positioningMode: Sys.Extended.UI.PositioningMode.BottomLeft }, { hidden: Function.createDelegate(this, this._popup_onhidden), shown: Function.createDelegate(this, this._minutes_popup_onshown) }, null, this._minutes); var tlen = 1; if (this._format.indexOf('mm') != -1) { tlen = 2; } // Compute the appropriate cells count per row according to the minutes range. var cells_per_row = Array.indexOf([1, 2, 3], this._minutesRange) != -1 ? 10 : this._minutesRange == 4 ? 5 : 60 / this._minutesRange; this._minutes_cells = []; for (var i = 0; i < 60; i += this._minutesRange) { // Break row to avoid too many cells in one row. if (i > 0 && (i / this._minutesRange) % cells_per_row == 0) { $common.createElementFromTemplate({ nodeName: 'br' }, this._minutes); } Array.add(this._minutes_cells, $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_cell"], properties: { id: id + "_minute_" + i, innerHTML: i.toString().length < tlen ? '0' + i : i }, events: this._minute_cell$delegates }, this._minutes)); } this._minutes_names = $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_names"] }, this._minutes); $common.createElementFromTemplate({ nodeName: "div", cssClasses: [this._cssClass + "_name"], properties: { innerHTML: VitalShining.Galaxy.TimePickerResources.Minutes } }, this._minutes_names); }, //#endregion focus: function () { if (this._button) { this._button.focus(); } else { this.get_element().focus(); } }, blur: function (force) { if (!force && Sys.Browser.agent === Sys.Browser.Opera) { this._blur.post(true); } else { if (!this._popupMouseDown) { this.hide(); } // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; } }, hide: function () { /// <summary> /// Hides the time picker /// </summary> if (this._isOpen) { var eventArgs = new Sys.CancelEventArgs(); this.raiseHiding(eventArgs); if (eventArgs.get_cancel()) { return; } var className = this._cssClass + "_hover"; if (this._minutes) { this._minutesPopupBehavior.hide(); } if (this._hours) { this._hoursPopupBehavior.hide(); } if (this._designators) { this._designatorsPopupBehavior.hide(); } this._isOpen = false; this.raiseHidden(); // make sure we clean up the flag due to issues with alert/alt-tab/etc this._popupMouseDown = false; } }, show: function () { /// <summary> /// Shows the time picker /// </summary> if (!this._isOpen) { var eventArgs = new Sys.CancelEventArgs(); this.raiseShowing(eventArgs); if (eventArgs.get_cancel()) { return; } this._isOpen = true; var dtf = Sys.CultureInfo.CurrentCulture.dateTimeFormat; var minDesignator = this._minValue && this._minValue.getHours() >= 12 ? dtf.PMDesignator : dtf.AMDesignator; var maxDesignator = this._maxValue && this._maxValue.getHours() < 12 ? dtf.AMDesignator : dtf.PMDesignator; var time = this.get_selectedTime(); if (minDesignator != maxDesignator) { this._showDesignators(); if (time) { var designator = time.getHours() >= 12 ? dtf.PMDesignator : dtf.AMDesignator; this._showHours(designator, this._findDesignatorElement(designator), false); this._showMinutes(time.getHours(), this._findHoursElement(time.getHours())); } } else { this._showHours(minDesignator, this.get_element(), this._format.indexOf('H') == -1); if (time) { this._showMinutes(time.getHours(), this._findHoursElement(time.getHours())); } } this.raiseShown(); } }, _fireChanged: function () { /// <summary> /// Attempts to fire the change event on the attached textbox /// </summary> var elt = this.get_element(); if (document.createEventObject) { elt.fireEvent("onchange"); } else if (document.createEvent) { var e = document.createEvent("HTMLEvents"); e.initEvent("change", true, true); elt.dispatchEvent(e); } }, _clearCssClass: function (row, className) { for (var i = 0; i < row.children.length; i++) { var cell = row.children[i]; if (cell.nodeType == 1) { Sys.UI.DomElement.removeCssClass(cell, className); } } }, _showDesignators: function () { if (!this._designators) { this._buildDesignators(); } this._designatorsPopupBehavior.show(); }, _showHours: function (designator, parentElement, showIndicator) { if (parentElement) { if (!this._hours) { this._buildHours(); } var dtf = Sys.CultureInfo.CurrentCulture.dateTimeFormat; var tlen = this._format.toLowerCase().indexOf('hh') == -1 ? 1 : 2; var factor = this._format.indexOf('H') == -1 ? 12 : 24; var minHours = this._minValue ? this._minValue.getHours() : 0; var maxHours = this._maxValue ? this._maxValue.getHours() : 24; for (var i = 0, l = this._hours_cells.length, hours = (designator == dtf.PMDesignator ? 12 : 0); i < l; i++, hours++) { var cell = this._hours_cells[i]; cell.hours = hours; var resolvedHours = hours % factor; cell.innerHTML = resolvedHours.toString().length < tlen ? '0' + resolvedHours : resolvedHours; } this._hoursPopupBehavior.set_parentElement(parentElement); this._hoursPopupBehavior.show(); $common.setVisible(this._hours_designators, showIndicator); if (showIndicator) { for (var i = 0, l = this._hours_designators_cells.length; i < l; i++) { var cell = this._hours_designators_cells[i]; $common.setVisible(cell, cell.designator === designator); } } for (var i = 0, l = this._hours_cells.length, hours = (designator == dtf.PMDesignator ? 12 : 0); i < l; i++, hours++) { $common.setVisible(this._hours_cells[i], hours >= minHours && hours <= maxHours); } } }, _showMinutes: function (hours, parentElement) { if (this._minutesRange < 60) { if (parentElement) { if (!this._minutes) { this._buildMinutes(); } for (var i = 0, l = this._minutes_cells.length, time = new Time(hours, 0); i < l; i++) { this._minutes_cells[i].time = time; // avoid time value overflow. if(time.getHours() < 23 || time.getMinutes() + this._minutesRange < 60){ time = time.addMinutes(this._minutesRange); } } this._minutesPopupBehavior.set_parentElement(parentElement); this._minutesPopupBehavior.show(); for (var i = 0, l = this._minutes_cells.length, time = new Time(hours, 0); i < l; i++) { $common.setVisible(this._minutes_cells[i], (!this._minValue || this._minValue.compare(time) <= 0) && (!this._maxValue || this._maxValue.compare(time) >= 0)); // avoid time value overflow. if(time.getHours() < 23 || time.getMinutes() + this._minutesRange < 60){ time = time.addMinutes(this._minutesRange); } } } } }, _findDesignatorElement: function (designator) { for (var i = 0, l = this._designators_cells.length; i < l; i++) { var cell = this._designators_cells[i]; if (cell.designator === designator) { return cell; } } return null; }, _findHoursElement: function (hours) { for (var i = 0, l = this._hours_cells.length; i < l; i++) { var cell = this._hours_cells[i]; if (cell.hours === hours) { return cell; } } return null; }, _findMinutesElement: function (time) { for (var i = 0, l = this._minutes_cells.length; i < l; i++) { var cell = this._minutes_cells[i]; if (cell.time.equals(time)) { return cell; } } return null; } } VitalShining.Galaxy.TimePickerBehavior.registerClass('VitalShining.Galaxy.TimePickerBehavior', Sys.Extended.UI.BehaviorBase); } // execute if (window.Sys && Sys.loader) { Sys.loader.registerScript(scriptName, ["Globalization", "ExtendedBase", "ExtendedCommon", "ExtendedThreading"], execute); } else { execute(); } })();
define(function () { 'user strict'; var businessValueService = function () { }; businessValueService.$inject = []; return businessValueService; });
// エラーチェックの設定(validate.min.js) $(function(){ var errorMsg_chkbox = '1つ以上選択してください'; var errorMsg_required = '値を入力してください'; var errorMsg_number = '数値を入力してください'; var errorMsg_email = 'メールアドレス形式で入力してください'; var errorMsg_equalTo = 'メールアドレスが一致しません'; $('#req_documents').validate({ errorElement:'p', rules: { 'reqdocname[]': { required: true }, name: { required: true }, kananame: { required: true }, postal_code: { required: true }, address_level1: { required: true }, address_line1: { required: true }, tel: { required: true, number: true }, email_hoge: { required: true, email: true }, email_chk: { required: true, email: true, equalTo: '#email' } }, 'course[]': { required: true }, messages: { 'reqdocname[]': { required: errorMsg_chkbox }, name: { required: errorMsg_required }, kananame: { required: errorMsg_required }, postal_code: { required: errorMsg_required }, address_level1: { required: errorMsg_required }, address_line1: { required: errorMsg_required }, tel: { required: errorMsg_required, number: errorMsg_number }, email: { required: errorMsg_required, email: errorMsg_email }, email_chk: { required: errorMsg_required, email: errorMsg_email, equalTo: errorMsg_equalTo }, 'course[]': { required: errorMsg_chkbox } }, errorPlacement: function(error, element){ if(element.attr('name')=='reqdocname[]') { error.insertAfter('.reqdocname_error'); } else if(element.attr('name')=='course[]') { error.insertAfter('.course_error'); } else if(element.attr('name')=='tel'){ error.insertAfter('.tel_error'); } else { error.insertAfter(element); } } }); });
import React from "react"; import { Route, Switch,withRouter } from "react-router-dom"; import List from './List'; import Navbar from './Navbar'; import Add from './Add'; function App() { return ( <div> <Navbar/> <Switch> <Route exact path='/' component={List} /> <Route path='/Cart' component={Add} /> </Switch> </div> ); } export default App;
const jwt = require('jsonwebtoken'); const Constants = require('../utils/constants'); const jwtSecret = Constants.jwtSecret; exports.validateToken = (req, res, next) => { if (!req.headers || !req.headers.authorization) { res.status(401).send(); } else { try { const authorization = req.headers.authorization.split(' '); if (authorization[0] === 'Bearer') { req.jwt = jwt.verify(authorization[1], jwtSecret); return next(); } res.status(401).send(); } catch (err) { res.status(403).send(err); } } return false; };
import React from "react"; import { withRouter } from "react-router"; import '../CSS/Recommend.css'; class AllRecommends extends React.Component{ render(){ return( <div className='top'> <div className='all-recommend-items-top'> <h1>今近くで人気の商品です</h1> </div> <div className='all-recommend-items'> <img src="./image/pan1.png" alt='' /> <img src="./image/pan2.png" alt='' /> <img src="./image/pan3.png" alt='' /> <img src="./image/pan4.png" alt='' /> <img src="./image/pan5.png" alt='' /> <img src="./image/pan2.png" alt='' /> <img src="./image/pan3.png" alt='' /> <img src="./image/sand.jpg" alt='' /> </div> </div> ); } } export default withRouter(AllRecommends);
import GroupColorInput from "./GroupColorInput"; export {GroupColorInput} export default GroupColorInput
const $div = document.querySelector("div"); $div.addEventListener("click", () => { let log = $div.innerText; console.log(log) })
import React, { useEffect, useState } from "react"; import axios from "axios"; import { NavLink, useHistory } from "react-router-dom"; function UserList() { const [data, setData] = useState(); const history = useHistory() const getData = () => { axios .get("http://localhost:5050/api/tutorials", {}) .then((res) => { setData(res); }) .catch((err) => { }); } useEffect(() => { getData(); }, []); // handle delete =============== const handleDelete=(id)=>{ axios.delete(`http://localhost:5050/api/tutorials/${id}`,{}).then((res)=>{ if (res) { getData(); alert(res.data.message); } }).catch((err)=>{ if(err){ alert(err) } }) } return ( <div className="App"> <h1>User</h1> <br /> <NavLink to="/add" > <button>Add</button> </NavLink> <div className=""> {data?.data.map((data) => { return ( <div style={{ display: "flex", gap: "20px", justifyContent: "center", alignItems: "center", }} key={data.id} > <h3> {data.title} </h3> <p> {data.description} </p> <button onClick={() => history.push(`/update/${data.id}`)}> Update </button> <button onClick={() => handleDelete(data.id)}>Delete</button> </div> ); })} </div> </div> ); } export default UserList;
import React from 'react'; import * as Markdown from '../index'; describe('Markdown', function() { describe('Basic Usage', function() { it('should allow rendering sections and lists and code sections', function() { const Component = () => { return ( <file name="README.md"> <source> <Markdown.Root> <Markdown.Section title="a1"> <Markdown.Section title="a2"> <Markdown.Section title="a3"> <Markdown.Section title="a4"> <Markdown.Section title="a5"> </Markdown.Section> </Markdown.Section> </Markdown.Section> </Markdown.Section> </Markdown.Section> <Markdown.Section title="b1"> <Markdown.Section title="b2"> <Markdown.Section title="b3"> <Markdown.Section title="b4"> <Markdown.Section title="b5"> </Markdown.Section> </Markdown.Section> </Markdown.Section> </Markdown.Section> </Markdown.Section> </Markdown.Root> </source> </file> ); }; const { result } = global.render(<Component/>); const contents = result.files['README.md'].contents.join(''); const expectedContents = `# a1 ## a2 ### a3 #### a4 ##### a5 # b1 ## b2 ### b3 #### b4 ##### b5 `; expect(contents).toEqual(expectedContents); }); }); });
import React from 'react' import PropTypes from 'prop-types' const Home = ({ name, num, dataList, loading, addFunc, getDataFunc }) => <div> <p>name: {name}</p> <p>num: {num}</p> <p> <button onClick={addFunc} > add number + </button> <button disabled={loading} onClick={getDataFunc} className={ loading ? 'loadingBtn' : ''} > { !loading ? 'Get Data' : 'Loading Data...' } </button> </p> <ul> { dataList.map(d => <li key={d}>{d}</li> ) } </ul> </div> Home.propTypes = { name: PropTypes.string.isRequired, num: PropTypes.number.isRequired, dataList: PropTypes.array.isRequired, loading: PropTypes.any, addFunc: PropTypes.func.isRequired, getDataFunc: PropTypes.func.isRequired, } export default Home
const initialData = { pendingAprove: false, runningAprove: false, pendingTransfer: false, runningTransfer: false, transferComplete: false, error: false } export const transferReducer = (state = {...initialData}, { type, payload }) => { switch (type) { case 'REQUEST_TRANSFER_INIT': return { ...payload } case 'REQUEST_TRANSFER_RUNNING_APROVE': return { ...payload } case 'REQUEST_TRANSFER_PENDING': return { ...payload } case 'REQUEST_TRANSFER_RUNNING': return { ...payload } case 'REQUEST_TRANSFER_COMPLETE': return { ...payload } case 'REQUEST_TRANSFER_ERROR': return { ...payload } case 'CLEAN_TRANSFER_REDUCE': return { ...payload } default: return state } }
// @depends(dna/behavior/Behavior) function nope(mech) { log.warn(`[${mech.brain.orders}] - not implemented!`) } function moveTowards(mech, target) { if (!target) return if (mech.y < target.y) mech.move.dir(_.DOWN) else if (mech.y > target.y) mech.move.dir(_.UP) else if (mech.x < target.x) mech.move.dir(_.RIGHT) else if (mech.x > target.x) mech.move.dir(_.LEFT) } function ram(mech) { const target = targetNeutral(mech) if (!target || target.dead || target.team !== 0) return null mech.status = 'ramming ' + target.title moveTowards(mech, target) mech.brain.steps ++ if (mech.brain.steps > 20) mech.brain.steps = 0 } function fire(mech) { // no fire for neutrals - they are peaceful if (mech.team <= 0) return null const foe = mech.scanner.scanForEnemy() if (foe) { // watttack!!! mech.status = 'attacking [' + foe.team + '/' + foe.name + ']' //log(`[${this.name}] ${this.status}`) mech.gun.shot(foe) return foe } else { return null } } function targetNeutral(mech) { if (mech.team <= 0) return null // must be in a team const neutral = mech.scanner.scanForNeutrals() if (neutral) { mech.brain.target = neutral } else { mech.brain.target = null } return neutral } function holdPattern(mech) { mech.brain.order('hold the ground') log(`[${mech.title}] switching to hold the ground pattern`) // TODO sfx/reporting } function takeCombatAction(mech) { return fire(mech) } function takeRamAction(mech) { const neutral = ram(mech) if (!neutral) { mech.brain.steps = 0 } return neutral } function searchAndDestroy(mech) { if (mech.steps > 0) { mech.steps -- } else { mech.steps = RND(5) mech.action = RND(5) } if (mech.action <= 3) { mech.move.dir(RND(3)) mech.status = 'walking around' } else if (mech.action === 4) { // just skip and wait } else { fire(mech) } } function holdTheGround(mech) { if (mech.steps > 0) { // move in random dir for the starters mech.steps -- mech.move.dir(RND(3)) mech.status = 'taking a holding position' } else { fire(mech) mech.status = 'holding the ground' } } function plotPath(mech, waypoint) { return mech.pathFinder.findPath(waypoint.x, waypoint.y) } function reachTarget(mech, target) { if (!target) return true const d = lib.calc.mdist(mech.x, mech.y, target.x, target.y) if (d > 3) return false // reached the target! job.report.success('reached the target', mech, target) job.mission.on('reached', mech, { target }) mech.lsfx('reached') return true } function follow(mech, patrol) { //if (!mech.brain.target) log('no target') //else log(mech.brain.target.title) let nextStep = -1 mech.brain.steps ++ if (mech.brain.steps > 5) { let target target = takeCombatAction(mech) if (!target) target = takeRamAction(mech) if (!target) { mech.brain.steps = 0 } return } // determine if there is a failed action cached if (mech.cache.retry) { mech.cache.retriesLeft -- if (mech.cache.retriesLeft < 0) { // reevaluate path! mech.cache.retry = false const path = plotPath(mech, mech.brain.target) if (path) { if (patrol) { mech.status = 'patroling path' } else { mech.status = 'following path' } } else { // unable to reach! if (!mech.brain.target) log('no target!') else log('unable to plot path to ' + mech.brain.target.title) holdPattern(mech) } } else { nextStep = mech.cache.retryMove } } if (nextStep < 0) { // get the next step from path finder nextStep = mech.pathFinder.nextStep() } if (nextStep >= 0) { // move along existing path const moved = mech.move.dir(nextStep) if (!moved) { if (!mech.cache.retry) { mech.cache.retry = true mech.cache.retryMove = nextStep mech.cache.retriesLeft = 3 } } else { mech.cache.retry = false } } else if (nextStep < -10) { const reached = reachTarget(mech, mech.pathFinder.target) if (!reached) { // reevaluate! const path = plotPath(mech, mech.brain.target) if (!path) { // unable to reach! holdPattern(mech) } } let waypoint if (patrol) { waypoint = mech.brain.ireg(mech.brain.state++) if (mech.brain.state >= 4) mech.brain.state = 0 } else { waypoint = mech.brain.firstRegVal() } if (waypoint) { const path = plotPath(mech, waypoint) if (path) { mech.brain.target = waypoint if (patrol) { mech.status = 'patroling path' } else { mech.brain.resetFirstReg() mech.status = 'following path' } } else { // unable to reach! holdPattern(mech) } } else { if (patrol) { // just skip to the next turn } else { holdPattern(mech) } } } else { // no movement provided - just skip this turn } } function followPath(mech) { follow(mech, false) } function patrolPath(mech) { follow(mech, true) } function ramNeutrals(mech) { if (!mech.brain.target) { const target = targetNeutral(mech) if (!target) { searchAndDestroy(mech) } } else { // already have target const target = mech.brain.target if (target.dead || target.team !== 0) { // forget about it - it's already dead or captured mech.brain.target = null } else { mech.status = 'ramming ' + target.title moveTowards(mech, target) mech.brain.steps ++ if (mech.brain.steps > 20) mech.brain.target = null } } } const orderActions = { 'search & destroy': searchAndDestroy, 'hold the ground': holdTheGround, 'follow path': followPath, 'patrol path': patrolPath, 'ram neutrals': ramNeutrals, 'gather parts': nope, } class Fighter extends dna.behavior.Behavior { // NOTE the behavior run in the context of platform, not the pod behave() { if (this.taken) return const orders = this.brain.getOrders() const actions = orderActions[orders] if (actions) actions(this) } }
/** * */ export default class RefCountedCache { constructor({ create, clean, defaultTimeout = 60 * 1000 }) { this.create = create; this.clean = clean; this.defaultTimeout = defaultTimeout; this.cache = {}; } get(key, { timeout } = {}, ...args) { let cached = this.cache[key]; // create if (!cached) { cached = { value: this.create(key, ...args), refs: [], cleanTimeout: undefined, timeoutMs: timeout || this.defaultTimeout, }; this.cache[key] = cached; } // always stop cleanup timeout on get() clearTimeout(cached.cleanTimeout); delete cached.cleanTimeout; // add ref const ref = new Object(); cached.refs.push(ref); return { value: cached.value, unref: () => this._unref(key, cached, ref), }; } // remove ref, setup cleanup timeout if no more refs _unref(key, cached, ref) { let index = cached.refs.indexOf(ref); // already removed if (index === -1) return; cached.refs.splice(index, 1); // setup clean timeout if (!cached.cleanTimeout && cached.refs.length === 0) { const fn = () => { this.clean(cached.value); delete this.cache[key]; }; // instant if (cached.timeoutMs <= 0) { fn(); } // delayed else { cached.cleanTimeout = setTimeout(fn, cached.timeoutMs); } } } inspect(key) { return this.cache[key]?.value; } }
/** * Notifications Widget */ import React, { Fragment, Component } from 'react'; import { withStyles } from '@material-ui/core/styles'; import SwipeableViews from 'react-swipeable-views'; import AppBar from '@material-ui/core/AppBar'; import Tabs from '@material-ui/core/Tabs'; import Tab from '@material-ui/core/Tab'; import { Scrollbars } from 'react-custom-scrollbars'; import Typography from '@material-ui/core/Typography'; // api import api from 'Api'; // intl messages import IntlMessages from 'Util/IntlMessages'; function TabContainer({ children, dir }) { return ( <Typography component="div" dir={dir} style={{ padding: 8 * 3 }}> {children} </Typography> ); } class Notifications extends Component { state = { value: 0, messages: null, notificationTypes: null, notifications: null }; componentDidMount() { this.getMessages(); this.getNotificationTypes(); this.getNotifications(); } // get messages getMessages() { api.get('messages.js') .then((response) => { this.setState({ messages: response.data }); }) .catch(error => { console.log(error); }) } // get notification types getNotificationTypes() { api.get('notificationTypes.js') .then((response) => { this.setState({ notificationTypes: response.data }); }) .catch(error => { console.log(error); }) } // get notifications getNotifications() { api.get('notifications.js') .then((response) => { this.setState({ notifications: response.data }); }) .catch(error => { console.log(error); }) } handleChange = (event, value) => { this.setState({ value }); }; handleChangeIndex = index => { this.setState({ value: index }); }; /** * Function to return notification name */ getNotificationName(notificationId) { const { notificationTypes } = this.state; if (notificationTypes) { for (const notificationType of notificationTypes) { if (notificationId === notificationType.id) { return ( <span className={`text-${notificationType.class} mr-5`}> <i className={`zmdi zmdi-${notificationType.icon}`}></i> {notificationType.Name} </span> ); } } } } render() { const { theme } = this.props; const { messages, notifications } = this.state; return ( <Fragment> <AppBar position="static" color="default"> <Tabs value={this.state.value} onChange={this.handleChange} indicatorColor="primary" textColor="primary" fullWidth > <Tab label={<IntlMessages id="widgets.recentNotifications" />} /> <Tab label={<IntlMessages id="widgets.messages" />} /> </Tabs> </AppBar> <Scrollbars className="rct-scroll" autoHeight autoHeightMin={100} autoHeightMax={375} autoHide> <SwipeableViews axis={theme.direction === 'rtl' ? 'x-reverse' : 'x'} index={this.state.value} onChangeIndex={this.handleChangeIndex}> <div className="card mb-0 notification-box"> <TabContainer dir={theme.direction}> <ul className="list-inline mb-0"> {notifications && notifications.map((notification, key) => ( <li className="d-flex justify-content-between" key={key}> <div className="align-items-start"> <p className="mb-5 message-head"> {this.getNotificationName(notification.notificationId)} {notification.date} </p> <h5 className="mb-5">{notification.userName}</h5> <p className="mb-0 text-muted">{notification.notification}</p> </div> <div className="align-items-end notify-user"> <img src={notification.userAvatar} alt="notify user" className="rounded-circle" width="50" height="50" /> </div> </li> ))} </ul> </TabContainer> </div> <div className="card mb-0 notification-box"> <TabContainer dir={theme.direction}> <ul className="list-inline mb-0"> {messages && messages.map((message, key) => ( <li className="d-flex justify-content-between" key={key}> <div className="align-items-start"> <p className="mb-5 message-head"> <span className="text-primary mr-5"> <i className="zmdi zmdi-comment-alt-text"></i> <IntlMessages id="widgets.messages" /></span> {message.date} </p> <h5 className="mb-5">{message.from.userName}</h5> <p className="mb-0 text-muted">{message.message}</p> </div> <div className="align-items-end notify-user"> <img src={message.from.userAvatar} alt="notify user" className="rounded-circle" width="50" height="50" /> </div> </li> ))} </ul> </TabContainer> </div> </SwipeableViews> </Scrollbars> </Fragment> ); } } export default withStyles(null, { withTheme: true })(Notifications);
export function updateCcDetails(details) { return { type: 'UPDATE_CC_DETAILS', payload: details, }; } export function updateFocusedField(field) { return { type: 'UPDATE_FOCUSED_FIELD', payload: field, }; } export function updateFieldError(error) { return { type: 'UPDATE_FIELD_ERROR', payload: error, }; } export function clickedSubmitButton(status) { return { type: 'CLICKED_SUBMIT_BUTTON', payload: status, }; }
// import React from 'react' import PropTypes from 'prop-types' import defaultImage from '../default-image.jpeg'; import styles from './Profile.module.css'; const Profile = ({ name, tag, location, avatar, stats}) => ( <div className={styles.profile}> <div className={styles.description}> <img src={avatar} alt={name} className={styles.avatar} width={280} /> <p className={styles.name}>{name}</p> <p className={styles.tag}>@{tag}</p> <p>{location}</p> </div> <ul className={styles.stats}> <li className={styles.item}> <span className='label'>Followers: </span> <span className={styles.quantity}>{stats.followers}</span> </li> <li className={styles.item}> <span className="label">Views: </span> <span className={styles.quantity}>{stats.views}</span> </li> <li className={styles.item}> <span className="label">Likes: </span> <span className={styles.quantity}>{stats.likes}</span> </li> </ul> </div> ) Profile.defaultProps = { avatar: defaultImage, stats: { followers: 0, views: 0, likes: 0} } Profile.propTypes = { location: PropTypes.string.isRequired, name: PropTypes.string.isRequired, tag: PropTypes.string.isRequired, stats: PropTypes.shape({ followers: PropTypes.number.isRequired, views: PropTypes.number.isRequired, liked: PropTypes.number.isRequired, }), } export default Profile;
// require('./contracts/Inbox.sol') - don't use it, it is not a JavaScript file const path = require('path'); const fs = require('fs'); const solc = require('solc'); const inboxPath = path.resolve(__dirname, 'contracts', 'Inbox.sol'); // path to current folder const source = fs.readFileSync(inboxPath, 'utf8'); var contractCompileData = solc.compile(source, 1); // console.log(contractCompileData // .contracts[':Inbox']); module.exports = contractCompileData.contracts[':Inbox'];
import pushByZIndex from '../helpers/pushByZIndex'; import { emit } from 'nodemon'; let objArr = [ { id: 1, zIndex: 1 }, { id: 2, zIndex: 4 }, { id: 3, zIndex: 6 } ]; const newObject1 = { id: 32, zIndex: 3 } const newObject2 = { id: 33, zIndex: 2 } const newObject3 = { id: 34, zIndex: 7 } const newObject4 = { id: 35, zIndex: 7 } const newObject5 = { id: 36, zIndex: 5 } pushByZIndex(objArr, newObject1); pushByZIndex(objArr, newObject2); pushByZIndex(objArr, newObject3); pushByZIndex(objArr, newObject4); pushByZIndex(objArr, newObject5); const exemple = [ { id: 1, zIndex: 1 }, { id: 33, zIndex: 2 }, { id: 32, zIndex: 3 }, { id: 2, zIndex: 4 }, { id: 36, zIndex: 5 }, { id: 3, zIndex: 6 }, { id: 35, zIndex: 7 }, { id: 34, zIndex: 7 } ]; objArr.forEach((elem, index) => { if (elem.zIndex == exemple[index].zIndex) console.log("Valid ", index); else console.log("Error attempt ", exemple[index].zIndex, " find ", elem.zIndex); });
const unitRange = 160; const baseColor = Pal.shield; const phaseColor = Color.valueOf("ffd59e"); const damApply = new Effect(11, cons(e => { Draw.color(Color.valueOf("ff0000")); Lines.stroke(e.fout() * 2); Lines.circle(e.x, e.y, 2 + e.finpow() * 7); })); const speedUp = new StatusEffect("su"); speedUp.speedMultiplier = 1.2; speedUp.reloadMultiplier = 2; speedUp.effect = Fx.none; const speedDown = new StatusEffect("sd"); speedDown.speedMultiplier = 0.6; speedDown.reloadMultiplier = 0.6; speedDown.effect = Fx.none; const unitA = extendContent(MendProjector , "unitA", { drawPlace(x, y, rotation, valid) { Drawf.circles(x * Vars.tilesize, y * Vars.tilesize, unitRange * 0.6, Pal.accent); Drawf.circles(x * Vars.tilesize, y * Vars.tilesize, unitRange, Color.valueOf("ff0000")); }, setStats(){ this.super$setStats(); this.stats.remove(Stat.repairTime); }, }); unitA.buildType = prov(() => { var applied = false; var dam = false; var timer = 0; var timeR = 0; var heatU = 0; var phaseHeatU = 0; return new JavaAdapter(MendProjector.MendBuild, { updateTile(){ phaseHeatU = Mathf.lerpDelta(phaseHeatU, Mathf.num(this.cons.optionalValid()), 0.1); var realRange = unitRange * 0.6 + phaseHeatU * this.block.phaseRangeBoost * 0.6; Units.nearby(this.team, this.x, this.y, realRange, cons(other => { other.apply(speedUp, 30); })); heatU = Mathf.lerpDelta(heatU, this.consValid() || this.cheating() ? 1 : 0, 0.08); if(this.cons.optionalValid() && this.timer.get(unitA.timerUse, unitA.useTime) && this.efficiency() > 0){ this.consume(); } timeR += heatU * this.delta(); if(timeR > (this.block.reload * 0.8)){ applied = false; Units.nearby(this.team, this.x, this.y, realRange, cons(other => { var max = other.maxHealth * 0.08; if(other.shield < max){ other.shield = Math.min((max <= 56 ? other.shield + max/5 : other.shield + max/15) + (max/12) * phaseHeatU, max); other.shieldAlpha = 1; Fx.shieldApply.at(other); applied = true; } })); if(applied){ new Effect(22, cons(e => { Draw.color(Pal.shield); Lines.stroke(e.fout() * 2); Lines.circle(e.x, e.y, 2 + e.finpow() * realRange); })).at(this.x, this.y); } timeR = 0; } timer += heatU * this.delta(); var realR = unitRange + phaseHeatU * this.block.phaseRangeBoost; if(timer > (this.block.reload)){ dam = false; Units.nearbyEnemies(this.team, this.x, this.y, realR*2, realR*2, cons(other => { if(other != null && other.within(this.x, this.y, realR)){ other.damage(120 + phaseHeatU * 100); other.apply(speedDown, 120); damApply.at(other.x, other.y); dam = true; } })); if(dam){ new Effect(22, cons(e => { Draw.color(Color.valueOf("ff0000")); Lines.stroke(e.fout() * 2); Lines.circle(e.x, e.y, 2 + e.finpow() * realR); })).at(this.x, this.y); } timer = 0; } }, drawSelect(){ var realRange = unitRange * 0.6 + phaseHeatU * this.block.phaseRangeBoost * 0.6; Drawf.circles(this.x, this.y, realRange, Pal.shield); var realR = unitRange + phaseHeatU * this.block.phaseRangeBoost; Drawf.circles(this.x, this.y, realR, Color.valueOf("ff0000")); }, draw(){ this.super$draw(); var topRegion = Core.atlas.find("btm-unitA-top"); var f = 1 - (Time.time / 100) % 1; Draw.color(baseColor, phaseColor, phaseHeatU); Draw.alpha(heatU * Mathf.absin(Time.time, 10, 1) * 0.5); Draw.rect(topRegion, this.x, this.y); Draw.alpha(1); Lines.stroke((2 * f + 0.2) * heatU); Lines.square(this.x, this.y, Math.min(1 + (1 - f) * this.block.size * Vars.tilesize / 2, this.block.size * Vars.tilesize/2)); Draw.reset(); }, write(write) { this.super$write(write); write.f(heatU); write.f(phaseHeatU); }, read(read, revision) { this.super$read(read, revision); heatU = read.f(); phaseHeatU = read.f(); }, }, unitA); }); unitA.requirements = ItemStack.with( Items.copper, 210, Items.lead, 200, Items.graphite, 135, Items.silicon, 160, Items.titanium, 100, Items.thorium, 80, Items.plastanium, 80, Items.surgeAlloy, 180 ); unitA.buildVisibility = BuildVisibility.shown; unitA.category = Category.units; unitA.consumes.power(3); unitA.buildCostMultiplier = 0.85; unitA.size = 3; unitA.reload = 240; unitA.range = unitRange; unitA.phaseBoost = 15; unitA.health = 700; unitA.consumes.item(Items.phaseFabric).boost(); exports.unitA = unitA;
const path = require('path'); const jsPath = path.resolve(__dirname, 'src/js'); module.exports = { dist: path.resolve(__dirname, 'www'), src: path.resolve(__dirname, 'src'), assets: path.resolve(__dirname, 'src/assets'), js: jsPath, jsEntryPoint: path.join(jsPath, 'app.js'), };
/** * 订单管理管理初始化 */ var SoOrder = { id: "SoOrderTable", //表格id seItem: null, //选中的条目 table: null, orderType: 0, layerIndex: -1, operationBtn: {title: '操作', field: '', formatter: renderOperation, align: 'center', class: 'W120'},//操作列按钮 viewLogBtn: {title: '查看日志', field: '', formatter: renderViewLog, align: 'center'},//查看日志按钮 }; function statusFunc(value, row, index) { if (value == "待审核") { return [//"+value+" "<a onclick=\"passStatusFunc('" + row.id + "')\">审核</a>" ].join("''") } } //function passStatusFunc(value) { // // layer.confirm('确定审核该订单', { // btn: ['是', '否'] //按钮 // }, function () { // var ajax = new $ax(Feng.ctxPath + "/soOrder/passStatus", function (data) { // layer.msg('审核成功', {icon: 1}); //// Feng.success("审核成功!"); // SoOrder.table.refresh(); // }, function (data) { // layer.msg('审核失败', {icon: 1}); //// Feng.error("审核失败!" + data.responseJSON.message + "!"); // }); // ajax.set("soOrderId", value); // ajax.start(); // }, function () { //// layer.msg('也可以这样', { //// time: 20000, //20s后自动关闭 //// btn: ['明白了', '知道了'] //// }); // return // }); // // //}; //订单详情 function aFormatter(value, row, index) { return [//"+value+" "<a onclick=\"orderDetail('" + value + "')\">" + value + "</a>" ].join("''") } /** * 订单详情页面 * @param value */ function orderDetail(value) { var index = layer.open({ type: 2, title: '订单详情', area: ['90%', '90%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/soOrder_update/' + value }); this.layerIndex = index; }; /** * 订单审核操作 * @param 订单编号 */ function checkOrder(orderCode) { layer.confirm('确定审核该订单', { btn: ['是', '否'] //按钮 }, function () { var ajax = new $ax(Feng.ctxPath + "/soOrder/passStatus", function (data) { // layer.msg('审核成功', {icon: 1}); // Feng.success("审核成功!"); SoOrder.table.refresh(); layer.open({ title: '审核提示信息', btn: ['关闭'], area: ['420px', '240px'], content: data }); }, function (data) { SoOrder.table.refresh(); layer.msg('审核失败', {icon: 2}); // Feng.error("审核失败!" + data.responseJSON.message + "!"); }); ajax.set("soOrderIds", orderCode); ajax.start(); }, function () { // layer.msg('也可以这样', { // time: 20000, //20s后自动关闭 // btn: ['明白了', '知道了'] // }); return }); } /** * 订单快递设置 * */ function carrierCode(orderCode) { // alert(orderCode) var index = layer.open({ type: 2, title: '快递设置', area: ['600px', '278px'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/customsCarry/' + orderCode }); this.layerIndex = index; } SoOrder.passStatus = function () { if (this.check() == 0) { Feng.info("请先选中表格中的某一记录!"); } else { var selectedId = $('#' + this.id).bootstrapTable('getSelections'); var ids = "" for (var i = 0; i < selectedId.length; i++) { ids = ids + selectedId[i].orderCode + "," } var ajax = new $ax(Feng.ctxPath + "/soOrder/passStatus", function (data) { // layer.msg('审核成功', {icon: 1}); // Feng.success("审核成功!"); layer.open({ title: '审核提示信息', btn: ['关闭'], area: ['420px', '240px'], content: data }); SoOrder.table.refresh(); }, function (data) { SoOrder.table.refresh(); layer.msg('审核失败', {icon: 2}); // Feng.error("审核失败!" + data.responseJSON.message + "!"); }); ajax.set("soOrderIds", ids); ajax.start(); } }; /** * 取消订单 */ //function cancelOrder(cancelType) { SoOrder.cancelOrder = function (data) { // alert(data) // return; if (this.check() == 0) { Feng.info("请先选中表格中的某一记录!"); } else { var selectedId = $('#' + this.id).bootstrapTable('getSelections'); if(selectedId.length > 1){ Feng.info("请选择一条记录进行取消处理!"); return; } // if(selectedId[0].orderStatus == 4 || selectedId[0].orderStatus == 15){ var ajax = new $ax(Feng.ctxPath + "/soOrder/cancelOrder", function (data) { layer.msg('取消成功', {icon: 1}); SoOrder.table.refresh(); }, function (data) { layer.msg('取消失败', {icon: 1}); SoOrder.table.refresh(); }); ajax.set("soOrderCode", selectedId[0].orderCode); ajax.set("cancelType", data); ajax.start(); // }else{ // Feng.info("该订单作业"+selectedId[0].orderStatus+"状态不可取消。"); // return; // } } }; /** * 订单备注操作 * @param 订单编号 */ function remarkOrder(orderCode) { var index = layer.open({ type: 2, title: '订单备注', area: ['600px', '278px'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/remark/' + orderCode }); this.layerIndex = index; } /** * 渲染操作列 * @param value * @param row * @param index * @returns {string} */ function renderOperation(value, row, index) { return [//"+value+" "<a onclick=\"orderUserDetail('" + row.orderCode + "')\">修改订单信息</a></br></br></br>" + "<a onclick=\"checkOrder('" + row.orderCode + "')\">审核</a><br><br><br>" + "<a onclick=\"carrierCode('" + row.orderCode + "')\">设置快递</a><br><br><br>" + "<a onclick=\"remarkOrder('" + row.orderCode + "')\">备注</a>" ].join("''") } /** * 渲染查看日志列 * @param value * @param row * @param index * @returns {string} */ function renderViewLog(value, row, index) { return [//"+value+" "<a onclick=\"viewLogs('" + row.orderCode + "')\">查看日志</a>" ].join("''") } /** * 日志查看操作 * @param 订单编号 */ function viewLogs(orderCode) { var index = layer.open({ type: 2, title: '查看日志', area: ['90%', '90%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOperateLog/logList/' + orderCode }); this.layerIndex = index; } /** * 修改收货信息 * @param value */ function orderUserDetail(value) { var index = layer.open({ type: 2, title: '收货信息', area: ['90%', '90%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/soOrderUserUpdate/' + value }); this.layerIndex = index; }; function orderCsRemark(value) { var index = layer.open({ type: 2, title: '备注信息', area: ['30%', '30%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/soOrderCsRemarkUpdate/' + value }); this.layerIndex = index; }; /** * 点击table顶部备注按钮 */ SoOrder.openRemarkModal = function () { if (this.check()) { remarkOrder(SoOrder.seItem.orderCode); } } /** * 点击table顶部修改收货信息按钮 */ SoOrder.orderUserDetail = function () { if (this.check() == 1) { orderUserDetail(SoOrder.seItem.orderCode); } else if (this.check() == 0) { Feng.info("请先选中表格中的某一记录!"); } else { Feng.info("只能选中表格中的一记录!"); } } SoOrder.orderCsRemark = function () { if (this.check() == 1) { orderCsRemark(SoOrder.seItem.orderCode); } else if (this.check() == 0) { Feng.info("请先选中表格中的某一记录!"); } else { Feng.info("只能选中表格中的一记录!"); } } /** * 初始化表格的列 */ SoOrder.initColumn = function () { return [ {field: 'selectItem', radio: false}, {title: '订单号', field: 'orderCode', visible: true, align: 'center', formatter: aFormatter, valign: 'middle'}, {title: '平台单号', field: 'originalCode', visible: true, align: 'center', valign: 'middle'}, {title: '渠道', field: 'orderSourceName', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '支付渠道', field: 'paymentName', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '商家', field: 'merchantId', visible: true, align: 'center', valign: 'middle', class: 'W120'}, {title: '店铺名称', field: 'shopName', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '发货仓', field: 'warehouseId', visible: true, align: 'center', valign: 'middle'}, {title: '订单来源', field: 'source', visible: true, align: 'center', valign: 'middle'}, {title: '订单状态', field: 'orderStatus', visible: true, align: 'center', valign: 'middle'}, {title: '清关状态 ', field: 'clearCustom', visible: true, align: 'center', valign: 'middle'}, {title: '下单时间', field: 'orderCreateTime', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '实付金额', field: 'accountPayable', visible: true, align: 'center', valign: 'middle'}, {title: '商品金额', field: 'productAmount', visible: true, align: 'center', valign: 'middle'}, {title: '支付渠道 ', field: 'paymentName', visible: true, align: 'center', valign: 'middle',class: 'W80'}, {title: '购买人姓名', field: 'goodReceiverName', visible: true, align: 'center', valign: 'middle'}, {title: '税费', field: 'taxFcy', visible: true, align: 'center', valign: 'middle'}, {title: '运费', field: 'orderDeliveryFee', visible: true, align: 'center', valign: 'middle'}, {title: '商家优惠', field: 'merchantDiscount', visible: true, align: 'center', valign: 'middle'}, {title: '平台优惠', field: 'platformDiscount', visible: true, align: 'center', valign: 'middle'}, {title: '支付方式 ', field: 'payServiceType', visible: true, align: 'center', valign: 'middle'}, { title: '付款时间', field: 'orderPaymentConfirmDate', visible: true, align: 'center', valign: 'middle', class: 'W80' }, {title: '交易流水号 ', field: 'thirdPartyPayNo', visible: true, align: 'center', valign: 'middle'}, {title: '买家备注', field: 'orderRemark', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '卖家备注', field: 'orderCsRemark', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '备注', field: 'paymentRemark', visible: true, align: 'center', valign: 'middle', class: 'W80'}, {title: '买家ID', field: 'buyerNick', visible: true, align: 'center', valign: 'middle'}, {title: '买家账号', field: '', visible: true, align: 'center', valign: 'middle'}, {title: '收货人姓名', field: 'goodReceiverName', visible: true, align: 'center', valign: 'middle'}, {title: '收货地址_省', field: 'goodReceiverProvince', visible: true, align: 'center', valign: 'middle'}, {title: '收货地址_市', field: 'goodReceiverCity', visible: true, align: 'center', valign: 'middle'}, {title: '收货地址_区', field: 'goodReceiverCounty', visible: true, align: 'center', valign: 'middle'}, {title: '收货地址', field: 'goodReceiverAddress', visible: true, align: 'center', valign: 'middle', class: 'W150'}, {title: '联系电话', field: 'goodReceiverMobile', visible: true, align: 'center', valign: 'middle'}, {title: '邮编', field: '', visible: true, align: 'center', valign: 'middle'}, {title: '配送方式', field: 'deliveryMethodType', visible: true, align: 'center', valign: 'middle'}, {title: '物流公司', field: 'deliverySupplierName', visible: true, align: 'center', valign: 'middle'}, {title: '物流单号', field: 'merchantExpressNbr', visible: true, align: 'center', valign: 'middle'}, {title: '购买人邮箱', field: '', visible: true, align: 'center', valign: 'middle'}, {title: '确认时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'}, {title: '结束时间', field: 'orderFinishedTime', visible: true, align: 'center', valign: 'middle'}, {title: '发票种类', field: 'orderNeedInvoice', visible: true, align: 'center', valign: 'middle'}, {title: '发票抬头', field: 'invoiceTitle', visible: true, align: 'center', valign: 'middle'}, {title: '发票内容类型', field: '', visible: true, align: 'center', valign: 'middle'}, ]; }; /** * 检查是否选中 */ SoOrder.check = function () { var selected = $('#' + this.id).bootstrapTable('getSelections'); if (selected.length == 0) { // Feng.info("请先选中表格中的某一记录!"); return 0; } else if (selected.length == 1) { SoOrder.seItem = selected[0]; return 1; } else if (selected.length > 1) { return 2; } }; /** * 点击添加订单管理 */ SoOrder.openAddSoOrder = function () { var index = layer.open({ type: 2, title: '添加订单管理', area: ['90%', '90%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/soOrder_add' }); this.layerIndex = index; }; /** * 打开查看订单管理详情 */ SoOrder.openSoOrderDetail = function () { if (this.check()) { var index = layer.open({ type: 2, title: '订单管理详情', area: ['90%', '90%'], //宽高 fix: false, //不固定 maxmin: true, content: Feng.ctxPath + '/soOrder/soOrder_update/' + SoOrder.seItem.id }); this.layerIndex = index; } }; /** * 删除订单管理 */ //SoOrder.delete = function () { // if (this.check()) { // var ajax = new $ax(Feng.ctxPath + "/soOrder/delete", function (data) { // Feng.success("删除成功!"); // SoOrder.table.refresh(); // }, function (data) { // Feng.error("删除失败!" + data.responseJSON.message + "!"); // }); // ajax.set("soOrderId", this.seItem.id); // ajax.start(); // } //}; /** * 导出订单 */ SoOrder.openExcelIn = function () { var queryData = {}; queryData['platformOrderCode'] = $("#platformOrderCodeSearch").val(); queryData['platformIdSearch'] = $("#platformIdSearch").val(); queryData['merchantIdSearch'] = $("#merchantIdSearch").val(); queryData['shopIdSearch'] = $("#shopIdSearch").val(); queryData['buyerName'] = $("#buyerName").val(); queryData['buyerNickId'] = $("#buyerNickId").val(); queryData['receiverMobile'] = $("#receiverMobile").val(); queryData['createTimeSearchBegin'] = $("#createTimeSearchBegin").val(); queryData['createTimeSearchEnd'] = $("#createTimeSearchEnd").val(); queryData['payTimeSearchBegin'] = $("#payTimeSearchBegin").val(); queryData['payTimeSearchEnd'] = $("#payTimeSearchEnd").val(); queryData['outTimeSearchBegin'] = $("#outTimeSearchBegin").val(); queryData['outTimeSearchEnd'] = $("#outTimeSearchEnd").val(); queryData['finishTimeSearchBegin'] = $("#finishTimeSearchBegin").val(); queryData['finishTimeSearchEnd'] = $("#finishTimeSearchEnd").val(); queryData['goodsName'] = $("#goodsName").val(); queryData['goodsCode'] = $("#goodsCode").val(); queryData['orderRemark'] = $("#orderRemark").val(); queryData['csRemark'] = $("#csRemark").val(); queryData['wareHouseId'] = $("#wareHouseId").val(); queryData['deliveryMethodType'] = $("#deliveryMethodType").val(); queryData['supplierId'] = $("#supplierId").val(); var ajax = new $ax(Feng.ctxPath + "/soOrder/excelTrueOut/1/" + SoOrder.orderType, function (data) { var index = layer.open({ title: 'Excel导出提示信息', btn: ['关闭'], fix: false, //不固定 maxmin: true, content: "您导出的数据已加入导出队列," + "请记好导出编号【" + data + ",可通过导出编号在" + "<font color='red'>导出任务管理</font>" + "里查询和下载导出文件。" }); // window.parent.BWarehouse.table.refresh(); // BWarehouseInfoDlg.close(); }, function (data) { Feng.error("导出失败!请联系管理员!"); }); ajax.set(queryData); ajax.start(); // SoOrder.layerIndex = index; } /** * 重置搜索条件 */ SoOrder.reset = function () { Feng.resetForm("searchForm"); SoOrder.search(); } /** * 查询订单管理列表 */ SoOrder.search = function () { var queryData = {}; queryData['platformOrderCode'] = $("#platformOrderCodeSearch").val(); queryData['platformIdSearch'] = $("#platformIdSearch").val(); queryData['merchantIdSearch'] = $("#merchantIdSearch").val(); queryData['shopIdSearch'] = $("#shopIdSearch").val(); queryData['buyerName'] = $("#buyerName").val(); queryData['buyerNickId'] = $("#buyerNickId").val(); queryData['receiverMobile'] = $("#receiverMobile").val(); queryData['createTimeSearchBegin'] = $("#createTimeSearchBegin").val(); queryData['createTimeSearchEnd'] = $("#createTimeSearchEnd").val(); queryData['payTimeSearchBegin'] = $("#payTimeSearchBegin").val(); queryData['payTimeSearchEnd'] = $("#payTimeSearchEnd").val(); queryData['outTimeSearchBegin'] = $("#outTimeSearchBegin").val(); queryData['outTimeSearchEnd'] = $("#outTimeSearchEnd").val(); queryData['finishTimeSearchBegin'] = $("#finishTimeSearchBegin").val(); queryData['finishTimeSearchEnd'] = $("#finishTimeSearchEnd").val(); queryData['goodsName'] = $("#goodsName").val(); queryData['goodsCode'] = $("#goodsCode").val(); queryData['orderRemark'] = $("#orderRemark").val(); queryData['csRemark'] = $("#csRemark").val(); queryData['wareHouseId'] = $("#wareHouseId").val(); queryData['deliveryMethodType'] = $("#deliveryMethodType").val(); queryData['supplierId'] = $("#supplierId").val(); SoOrder.table.refresh({query: queryData}); }; /** * 初始化table data */ SoOrder.initTable = function () { //获取订单类型 1 实单 ,0 虚单 var warehouseOrderType = $('#warehouseOrderType').val(); if (warehouseOrderType === '1') { //tab $('#soOrder-nav').show(); $('#soVirtualOrder-nav').hide(); //btn $('#soOrderBtn').show(); $('#soVirtualOrderBtn').hide(); //search condition 代发供应商 $('#substituteSupplier').hide(); } var defaultColunms = SoOrder.initColumn(); var tabName = window.sessionStorage.getItem("soOrder-tab"); //var orderType = 4; if (tabName) { switch (tabName) { case '全部': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); // $('#exportOrder').show(); // $('#updateAddress').show(); $('#checkOrder').show(); // $('#remarkOrder').show(); // $('#cancelOrder').hide(); // $('#cancelCheckOrder').hide(); SoOrder.orderType = 0; break; case '待审核': defaultColunms.splice(2, 0, SoOrder.operationBtn, SoOrder.viewLogBtn); $('#exportOrder').show(); $('#updateAddress').show(); $('#checkOrder').show(); $('#remarkOrder').show(); $('#cancelCheckOrder').show(); $('#cancelOrder').hide(); SoOrder.orderType = 4; break; case '挂起': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); SoOrder.orderType = 30; break; case '已取消': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); $('#cancelOrder').hide(); $('#cancelCheckOrder').hide(); SoOrder.orderType = 99; break; /*case '已审核': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); SoOrder.orderType = 8; break;*/ case '已审核清关中': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); SoOrder.orderType = 14; break; case '异常订单': defaultColunms.splice(2, 0, SoOrder.operationBtn, SoOrder.viewLogBtn); $('#updateAddress').show(); $('#checkOrder').show(); $('#remarkOrder').show(); SoOrder.orderType = 15; break; case '仓库作业': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); $('#cancelOrder').hide(); $('#cancelCheckOrder').hide(); SoOrder.orderType = 16; break; case '已发货': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); $('#cancelOrder').hide(); $('#cancelCheckOrder').hide(); SoOrder.orderType = 20; break; case '已完成': defaultColunms.splice(2, 0, SoOrder.viewLogBtn); $('#updateAddress').hide(); $('#checkOrder').hide(); $('#remarkOrder').hide(); $('#cancelOrder').hide(); $('#cancelCheckOrder').hide(); SoOrder.orderType = 35; break; } $("#soOrder-nav a[name=" + tabName + "]").tab('show'); } else { $('#soOrder-nav a:first').tab('show'); } var table = new BSTable(SoOrder.id, "/soOrder/list/1/" + SoOrder.orderType, defaultColunms); table.setPaginationType("server"); SoOrder.table = table.init(); } $(function () { SoOrder.initTable(); $('#soOrder-nav a').click(function (e) { e.preventDefault(); $(this).tab('show'); window.sessionStorage.setItem("soOrder-tab", $(this).context.innerText); setTimeout(function () { window.location.reload(true); }, 50) }); });
document.addEventListener("DOMContentLoaded", function() { var current, images, coverageFeatures, arrowLeft, arrowRight, showIcons, moveRight, moveLeft, i; showIcons = function() { for (i = coverageFeatures.length - 1; i >= 0; i--) { if (coverageFeatures[i].getAttribute('feature-image-id') - 1 === current) { coverageFeatures[i].className = coverageFeatures[i].className + ' active-popover'; } else { coverageFeatures[i].className = 'usaa-link coverage-feature'; } } }; moveLeft = function() { images[current].className = 'hidden-img'; current = current === 0 ? images.length - 1 : --current; images[current].className = 'active'; showIcons(); }; moveRight = function() { images[current].className = 'hidden-img'; current = current === images.length - 1 ? 0 : ++current; images[current].className = 'active'; showIcons(); }; current = 0; images = document.getElementById('imagesContainer').querySelectorAll('img'); coverageFeatures = document.getElementsByClassName('coverage-feature'); arrowLeft = document.getElementById('arrowLeft'); arrowRight = document.getElementById('arrowRight'); arrowLeft.addEventListener('click', moveLeft); arrowRight.addEventListener('click', moveRight); });
import React from "react"; import "./rough.css"; import { Button } from "@mui/material"; function rough() { return ( <div> <div className="detail__question"> <div className="detail__wrapper"> <div className="detail__wrapper2"> <div className="detail__wrapper3"> <div className="answer__section detail__content"> <p className="question animated dts fadeInDown"> <span className="classic__question">what does it threw</span> </p> <div className="question_image_container"> <div className="answer__container"> <button className="answer_animated animated flipInX"> <p className="answer_number">1</p> <p className="answer__text hoverAnswer"> <span className="ng_content"> answerrr</span> </p> </button> <button className="answer_animated animated flipInX"> <p className="answer_number">1</p> <p className="answer__text hoverAnswer"> <span className="ng_content"> answerrr</span> </p> </button> <button className="answer_animated animated flipInX"> <p className="answer_number">1</p> <p className="answer__text hoverAnswer"> <span className="ng_content"> answerrr</span> </p> </button> <button className="answer_animated animated flipInX"> <p className="answer_number">1</p> <p className="answer__text hoverAnswer"> <span className="ng_content"> answerrr</span> </p> </button> </div> </div> </div> </div> </div> </div> <div className="wrapper_sound__on__off"> <div className="sound__on__off"> {/* {playing ? <VolumeUpIcon /> : <VolumeOffIcon />} {toggle} */} <Button style={{ color: "var(--light)" }}>Soun On</Button> </div> </div> <div className="quiz_landing_container"> <div className="quiz_landing_info"> <div className="quiz_item_info"> <div className="inner_div"> <div className="text_large">0</div> <div className="subtext">Your Current Score</div> </div> </div> <div className="quiz_item_info"> <div className="inner_div"> <div className="text_large">0</div> <div className="subtext">Questions Remaining</div> </div> </div> <div className="quiz_item_info"> <div className="inner_div"> <div className="text_large">0</div> <div className="subtext">Points</div> </div> </div> <div className="quiz_item_info"> <div className="inner_div"> <div className="text_large">0</div> <div className="subtext">Your Best Score</div> </div> </div> <div className="quiz_item_info"> <div className="inner_div"> <div className="text_large">0</div> <div className="subtext">LeaderBoard First Place</div> </div> </div> </div> </div> </div> </div> ); } export default rough; // .detail__question { // position: relative; // width: 80%; // padding-right: 15px; // padding-left: 15px; // margin-right: auto; // margin-left: auto; // margin-top: 0; // margin: 25px auto; // } // .detail__wrapper { // position: relative; // height: 550px; // display: -webkit-box; // display: flex; // -webkit-box-orient: horizontal; // -webkit-box-direction: normal; // flex-direction: row; // -webkit-box-pack: center; // justify-content: center; // background: #000; // font-family: "Titillium Web", sans-serif; // font-size: 2em; // border-radius: 5px 5px 0 0; // overflow: hidden; // } // .detail__wrapper2 { // display: -webkit-box; // display: flex; // -webkit-box-flex: 0; // flex: 0 0 100%; // position: relative; // background-color: #333; // overflow: hidden; // -webkit-box-pack: center; // justify-content: center; // } // .detail__wrapper3 { // position: absolute; // width: 100%; // height: 100%; // z-index: 9999; // background: rgba(0, 0, 0, 0.5); // overflow: hidden; // } // .detail__content { // position: absolute; // width: 100%; // height: 100%; // z-index: 9999; // background: rgba(0, 0, 0, 0.5); // overflow: hidden; // } // .answer__section { // -webkit-box-flex: 0; // flex: 0 0 50%; // display: -webkit-box; // display: flex; // display: -webkit-flex; // -webkit-box-orient: vertical; // -webkit-box-direction: normal; // flex-direction: column; // -webkit-box-pack: center; // justify-content: center; // -webkit-box-align: center; // align-items: center; // margin: 0 auto; // -webkit-box-flex: 100%; // flex: 100%; // -webkit-box-flex: 0; // flex: 0 0 100%; // -webkit-box-pack: start; // justify-content: flex-start; // } // .quiz__info { // border-left: none; // text-align: center; // border-left: 2px solid #b3b3b3; // -webkit-box-pack: center; // justify-content: center; // } // .question { // display: -webkit-box; // display: flex; // -webkit-box-orient: vertical; // -webkit-box-direction: normal; // flex-direction: column; // -webkit-box-pack: center; // justify-content: center; // -webkit-box-align: center; // align-items: center; // text-align: center; // color: #fff; // font-size: 24px; // width: 80%; // line-height: 1em; // min-height: 55px; // margin-bottom: 20px; // margin-top: 20px; // } // .animated { // -webkit-animation-duration: 1s; // animation-duration: 1s; // -webkit-animation-fill-mode: both; // animation-fill-mode: both; // -webkit-animation-duration: 1s; // animation-duration: 1s; // -webkit-animation-fill-mode: both; // animation-fill-mode: both; // } // .dts { // -webkit-touch-callout: none; // -webkit-user-select: none; // -moz-user-select: none; // -ms-user-select: none; // user-select: none; // } // .animated { // -webkit-animation-duration: 1s; // -webkit-animation-fill-mode: both; // animation-duration: 1s; // animation-fill-mode: both; // } // .fadeInDown { // -webkit-animation-name: fadeInDown; // animation-name: fadeInDown; // } // .classic__question { // } // .question_image_container { // display: -webkit-box; // display: flex; // -webkit-box-align: center; // align-items: center; // -webkit-box-pack: center; // justify-content: center; // width: 90%; // margin-top: 20px; // } // .answer__container { // } // .answer_animated { // -webkit-animation-delay: 0s; // animation-delay: 0s; // width: 480px; // display: -webkit-box; // display: flex; // -webkit-box-align: stretch; // align-items: stretch; // font-weight: 600; // margin-bottom: 15px; // padding: 0; // border: none; // font-size: 22px; // -webkit-animation-duration: 0.5s; // animation-duration: 0.5s; // line-height: 1em; // } // .animated { // -webkit-animation-duration: 1s; // animation-duration: 1s; // -webkit-animation-fill-mode: both; // animation-fill-mode: both; // } // .animated { // -webkit-animation-duration: 1s; // animation-duration: 1s; // -webkit-animation-fill-mode: both; // animation-fill-mode: both; // } // .animated { // -webkit-animation-duration: 1s; // -webkit-animation-fill-mode: both; // animation-duration: 1s; // animation-fill-mode: both; // } // .flipInX { // -webkit-animation-name: flipInX; // -webkit-backface-visibility: visible !important; // animation-name: flipInX; // backface-visibility: visible !important; // } // button { // appearance: auto; // -webkit-writing-mode: horizontal-tb !important; // text-rendering: auto; // color: -internal-light-dark(black, white); // letter-spacing: normal; // word-spacing: normal; // line-height: normal; // text-transform: none; // text-indent: 0px; // text-shadow: none; // display: inline-block; // text-align: center; // align-items: flex-start; // cursor: default; // box-sizing: border-box; // background-color: -internal-light-dark(rgb(239, 239, 239), rgb(59, 59, 59)); // margin: 0em; // padding: 1px 6px; // border-width: 2px; // border-style: outset; // border-color: -internal-light-dark(rgb(118, 118, 118), rgb(133, 133, 133)); // border-image: initial; // } // button:disabled { // background-color: -internal-light-dark( // rgba(239, 239, 239, 0.3), // rgba(19, 1, 1, 0.3) // ); // color: -internal-light-dark(rgba(16, 16, 16, 0.3), rgba(255, 255, 255, 0.3)); // border-color: -internal-light-dark( // rgba(118, 118, 118, 0.3), // rgba(195, 195, 195, 0.3) // ); // } // .answer_number { // padding: 1.1em 1.3em; // background-color: #4d4d4d; // color: #fff; // margin-bottom: 0; // } // p { // display: block; // margin-block-start: 1em; // margin-block-end: 1em; // margin-inline-start: 0px; // margin-inline-end: 0px; // } // .answer__text { // background-color: #b3b3b3; // cursor: pointer; // text-align: left; // width: 100%; // padding: 0 0.9em; // background-color: #f2f2f2; // color: #333; // margin-bottom: 0; // display: -webkit-box; // display: flex; // -webkit-box-flex: 1; // flex: 1; // padding: 5px 10px; // } // .ng_content { // cursor: pointer; // text-align: left; // width: 100%; // padding: 0 0.9em; // background-color: #f2f2f2; // color: #333; // margin-bottom: 0; // display: -webkit-box; // display: flex; // -webkit-box-flex: 1; // flex: 1; // align-self: center; // width: 100%; // max-width: 360px; // font-size: 15px; // margin: 0 auto 10px; // } // .sound__on__off { // height: auto; // color: var(--light); // position: relative; // text-align: center; // align-items: center; // } // .wrapper_sound__on__off { // background-color: rgba(0, 0, 0, 0.8); // } // .quiz_landing_container { // border: 2px solid #b3b3b3; // border-top: none; // border-bottom-left-radius: 5px; // border-bottom-right-radius: 5px; // } // .quiz_landing_info { // display: -webkit-box; // display: flex; // width: 100%; // } // .quiz_item_info { // border-left: none; // text-align: center; // border-left: 2px solid #b3b3b3; // -webkit-box-pack: center; // justify-content: center; // -webkit-box-flex: 1; // flex: 1; // } // .inner_div { // text-align: inherit; // color: #4d4d4d; // padding: 25px 5px; // display: -webkit-box; // display: flex; // -webkit-box-orient: vertical; // -webkit-box-direction: normal; // flex-direction: column; // -webkit-box-align: center; // align-items: center; // -webkit-box-pack: center; // justify-content: center; // height: 100%; // } // .text_large { // font-size: 3em; // font-size: 4em; // color: inherit; // font-family: "Paytone One", sans-serif; // font-weight: 400; // line-height: 1em; // margin-bottom: 0.2em; // } // .subtext { // font-size: 1.5em; // color: inherit; // font-family: "Titillium Web", sans-serif; // font-weight: 400; // line-height: 1em; // word-break: break-word; // }
import React, { Component } from "react"; import { Typography, ThirdPartyGameCard, ThirdPartyProviderSelector, Button, GameCounter } from 'components'; import { connect } from "react-redux"; import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; import { getProvidersGames } from "../../lib/api/app"; import { getSkeletonColors, getApp } from "../../lib/helpers"; import { CopyText } from "../../copy"; import _ from 'lodash'; import "./index.css"; class ThirdPartyGameList extends Component { constructor(props){ super(props); this.state = { games: [], providers: [], providerId: null, isLoading: true, total: 0, quantity: 0 }; } componentDidMount(){ this.projectData(this.props); } projectData = async (props) => { const { params } = props.match; let providerId = String(params.providerGameId); this.changeProvider(providerId); const providers = getApp().casino_providers.filter(p => p.activated === true); this.setState({ providerId, providers }); } formatGames(games) { let gameList = []; games.map( p => { const url = p.api_url; const provider = p.name; const partnerId = p.partner_id; if(typeof p.list.games != "undefined") { p.list.games.map( g => { const icon = url + g.icon; const game = { id: g.id, url, partnerId, provider, icon, title: g.title } gameList.push(game); }); } }); const total = gameList.length; this.setState({ games: gameList, total }); } changeProvider = async (providerId) => { this.setState({ isLoading: true }); const games = providerId === "all" ? await getProvidersGames() : await getProvidersGames({ providerEco: providerId }); this.formatGames(games, providerId); this.setState({ isLoading: false, providerId }); } createSkeletonGames = () => { let games = [] for (let i = 0; i < 18; i++) { games.push( <div class={"col"} styleName="col"> <div styleName="root"> <div styleName="image-container dice-background-color"> <div styleName="icon"> <Skeleton width={"180"} height={"150"}/> </div> </div> <div styleName="labels"> <div styleName="title"> <Skeleton width={"120"} height={"20"}/> </div> <div styleName='info-holder'> <Skeleton width={"20"} height={"20"} circle={true}/> </div> </div> <div styleName="title"> <Skeleton width={"80"} height={"20"}/> </div> </div> </div> ); } return games; } onLoadMoreGames = quantity => { this.setState({ quantity }); } render() { const { onHandleLoginOrRegister, history, ln } = this.props; const { games, isLoading, total, quantity, providerId, providers } = this.state; return ( <div styleName="container"> { isLoading == true ? <SkeletonTheme color={ getSkeletonColors().color} highlightColor={ getSkeletonColors().highlightColor}> <div style={{opacity : '0.5'}}> <div styleName="container-small"> {this.createSkeletonGames()} </div> </div> </SkeletonTheme> : <div> <div styleName="provider"> <Typography variant="x-small-body" color="white"> Provider </Typography> <ThirdPartyProviderSelector providers={providers} providerId={providerId} onChangeProvider={this.changeProvider}/> </div> <div styleName="container-small"> {games.slice(0, quantity).map(g => { const game = { id: g.id, partnerId: g.partnerId, url: g.url, icon: g.icon, title: g.title, provider: g.provider }; return ( <ThirdPartyGameCard game={game} onHandleLoginOrRegister={onHandleLoginOrRegister} history={history}/> ) })} </div> </div> } <GameCounter total={total} label={CopyText.gameCounter[ln].DESCRIPTION} buttonLabel={CopyText.gameCounter[ln].BUTTON} factorBase={18} onMore={this.onLoadMoreGames} /> </div> ); } } function mapStateToProps(state){ return { ln : state.language }; } export default connect(mapStateToProps)(ThirdPartyGameList);
import React, { Component } from 'react'; import { StyleSheet, View, ScrollView, Text, Image, AsyncStorage, FlatList, TouchableWithoutFeedback, ActivityIndicator } from 'react-native'; import { Card, ListItem, Button } from 'react-native-elements'; import { connect } from 'react-redux'; import * as actions from '../actions'; import _values from 'lodash/values'; import { SCROLL_PADDING_BOTTOM } from 'app/config'; import { Task, NewTaskButton } from '../components'; class TaskFeedScreen extends Component { static navigationOptions = ({ navigation }) => { const { navigate } = navigation; return { title: 'Tasks', headerTitle: 'Care Visit', headerRight: ( <NewTaskButton color="black" navigate={navigate} to="NewTask" /> ), }; } componentDidMount () { const patientId = this.props.navigation.state.params ? this.props.navigation.state.params.patientId : null; this.props.fetchAndHandleTasks(patientId); //this.props.fetchAndHandlePatient(patientId); } _renderTasks = ({ item }) => { const { navigate } = this.props.navigation; return ( <Task navigate={navigate} taskId={item.id} taskTitle={item.taskTitle} /> ) } _keyExtractor = (item, index) => item.id _renderTaskFeed = (keyExtractor, cards, renderTasks) => { return ( <FlatList contentContainerStyle={styles.contentContainer} keyExtractor={keyExtractor} data={cards} renderItem={renderTasks} /> ) } render() { const isFetching = this.props.task.isFetching; const tasks = this.props.task.tasks; if (isFetching) { return ( <View style={{ flex: 1, justifyContent: 'center' }}> <ActivityIndicator size="large" /> </View> ); } return ( <View> {this._renderTaskFeed( this._keyExtractor, _values(tasks), this._renderTasks)} </View> ); } } function mapStateToProps({ task }) { return { task, } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, buttonContainer: { flexDirection: 'row', justifyContent: 'space-around', padding: 0, paddingTop: 10, }, contentContainer: { paddingBottom: SCROLL_PADDING_BOTTOM, }, }); export default connect(mapStateToProps, actions)(TaskFeedScreen);
import program from 'commander'; import fetch from 'node-fetch'; import { GRID_SERVER_URL } from '../config'; import Driver from './driver'; import Rider from './rider'; import ipfs from './ipfsWrapper'; // Print help and exit if no args provided if (!process.argv.slice(2).length) { program.help(); } let isDriver; program.version('0.0.1'); program.command('driver').action(() => { isDriver = true; console.log("I'm a driver"); }); program.command('rider').action(() => { isDriver = false; console.log("I'm a rider"); }); program.parse(process.argv); // Exit if neither a driver or a rider if (isDriver === undefined) { program.help(); } // TODO: Use actual location const gridIDPromise = fetch(`${GRID_SERVER_URL}/grid/id/1.290270/103.851959`).then((res) => res.json(), ); Promise.all([ipfs.setup(), gridIDPromise]).then(([ipfs, gridData]) => { console.log('IPFS+GRID READY', ipfs.identity.id, gridData, isDriver); const chatroom = ipfs.createChatroom(gridData.grid_id); const party = isDriver ? new Driver(chatroom) : new Rider(chatroom); party.startRepl(); }); // For debugging unhandled promise rejections process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); });
import { Menu } from 'semantic-ui-react'; import {useRouter} from 'next/router'; export default function Gnb() { // next/router의 useRouter사용하여 페이지 이동. (location.href 대신) // **** // a태그나 location.href를 쓰지 않는 이유는? // 바로 새로고침 되면서 페이지가 이동되기 때문... => 요청이 늘어남 => 퍼포먼스 저하ㅠ (spa장점 사라짐...) // 만일 리덕스로 상태관리를 하던 중이라면 다 날아갈 수도 있음 (데이터들이..) // next link를 사용하면 페이지는 그대로, 안의 내용물만 바뀜 // router에서 asPath는 실제 주소가 나오게 되고, pathname은 파일명(디렉토리포함)이 나온다. const router = useRouter(); //active효과 주기. (어떤 탭이 클릭되었는지 나타냄) let activeItem; if(router.pathname === '/') { activeItem = 'home'; }else if(router.pathname === '/about') { activeItem = 'about'; }else if(router.pathname === '/admin') { activeItem = 'admin'; } //인자값에 data는 시멘틱 ui에서 제공하는 것인데, //Menu.Item을 보면, 속성들 (name, active, onClick 등)이 있는데, data에는 이러한 속성들의 정보가 들어가 있음. //그래서 아래와 같이 data.name은 아래 Menu.Item의 name이 불려짐. function goLink(e, data) { if(data.name === 'home') { router.push('/'); } else if(data.name === 'about') { router.push('/about'); } } return ( <Menu inverted> <Menu.Item name='home' active={activeItem === 'home'} onClick={goLink} /> <Menu.Item name='about' active={activeItem === 'about'} onClick={goLink} /> <Menu.Item name='Contact Us' active={activeItem === 'contact'} onClick={() => { router.push('/contact'); }} /> <Menu.Item name='admin' active={activeItem === 'admin'} onClick={() => { router.push('/admin'); }} /> </Menu> ) };
app.controller("paginaInicialController", function ($scope, emprestimoService) { obterDadosEmprestimo(); var sh1 = new StorageHelp(); var dadosUser = sh1.Login_Get(); dadosUser = JSON.parse(dadosUser); $scope.PreAprovado = dadosUser.flgPreAprovado == 'True' ? 'S' : 'N'; $scope.status = null; $scope.valorTomador = null; $scope.sequencialRenda = null; $scope.numeroRendas = null; $scope.dataVencimentoPre = null; $scope.nomeCliente = dadosUser.applications; $scope.hideDiv = function () { $(this).hide(); } function obterDadosEmprestimo() { var sh1 = new StorageHelp(); var u = new Util(); $('#content').loadmask(""); var dadosUser = sh1.Login_Get(); dadosUser = JSON.parse(dadosUser); var temEmprestimo = false; var emprestimos = emprestimoService.obterDadosEmprestimo(dadosUser.id_user, dadosUser.token, u.GetUrlApi() + 'Emprestimo/DadosEmprestimo'); emprestimos.then(function (_emprestimo) { if (_emprestimo.data != null) { var emprestimo = _emprestimo.data; if (Object.keys(emprestimo).length == 0) { $('.modal-aviso').modal('show'); $('.results').html('Realize o seu empréstimo online de segunda a sexta-feira, das 8h às 22h e aos sábados, das 8h às 15h.'); return; } $scope.nomeCliente = emprestimo[0].nomeCliente; $scope.limiteTotalValor = emprestimo[0].limiteTotalValor; temEmprestimo = true; } else { temEmprestimo = false; } var statusProposta = emprestimoService.obterStatusProposta(dadosUser.id_user, dadosUser.token, u.getPlatform(), u.getVersion(), u.GetUrlApi() + 'Emprestimo/StatusProposta'); statusProposta.then(function (_statusProposta) { console.dir(_statusProposta); if (_statusProposta.data.Error.length == 0) { $scope.status = _statusProposta.data.StatusProposta; $scope.valorTomador = "R$" + formatarReal(parseFloat(_statusProposta.data.ValorTomador).toFixed(2)); $scope.sequencialRenda = _statusProposta.data.SequencialRenda; $scope.numeroRendas = _statusProposta.data.NumeroRendas; if (_statusProposta.data.DataVencimentoPre != null) $scope.dataVencimentoPre = u.parseddmmyyyy(_statusProposta.data.DataVencimentoPre.split('T')[0]); } if (!temEmprestimo) { $scope.PreAprovado = 'N'; } else { $scope.PreAprovado = dadosUser.flgPreAprovado == "True" ? 'S' : 'N'; } $('#content').unloadmask(""); }); }, function err() { $('#content').unloadmask(""); $scope.PreAprovado = "N"; }); } $scope.temPreAprovado = function () { return $scope.PreAprovado; }; $scope.redirectValorSuperior = function (sequencialRenda) { var objNovoValor = { sequencialRenda: sequencialRenda, codCliente: dadosUser.codCliente, perfilCliente: 2 } sh1.ObjNovoValor_Set(objNovoValor); location.href = "pagina-emprestimo-upload.html"; } $scope.redirectNovaRenda = function () { var sh1 = new StorageHelp(); var dadosUser = sh1.Login_Get(); dadosUser = JSON.parse(dadosUser); var ObjRenda = { codCliente: dadosUser.codCliente, perfilCliente: 3 } sh1.ObjRenda_Set(ObjRenda); location.href = "pagina-renda-upload.html"; } function formatarReal(valor) { var temp = valor + ''; temp = temp.replace(/\D/g, ''); temp = temp.replace(/(\d)(\d{11})$/, "$1.$2"); temp = temp.replace(/(\d)(\d{8})$/, "$1.$2"); temp = temp.replace(/(\d)(\d{5})$/, "$1.$2"); temp = temp.replace(/(\d)(\d{2})$/, "$1,$2"); return temp; } });
import React from "react"; import profile from "../../assets/My-Images/profile.png"; // reactstrap components import { Container, } from "reactstrap"; // core components import Header from "components/Headers/Header.js"; import "./style.scss"; //import Image "../.."; const Analytics = () => { return ( <> <Header /> {/* Page content */} <Container className="mt--7" fluid> {/* Table */} {/* <Row> <div className="col"> <Card className="shadow"> <CardHeader className="border-0"> <h3 className="mb-0">Card Analytics User</h3> </CardHeader> </Card> </div> </Row> */} <br /> <div style={{ margin: "100px" }}></div> <ul className="caard-list"> <li className="caard caard1"> <a className="caard-image" href="/#" target="_blank" style={{ backgroundImage: "url(" + // "https://image.freepik.com/free-vector/gradient-network-connection-background_23-2148865392.jpg" + "https://image.freepik.com/free-vector/dots-connection-lines-digital-background_23-2148821703.jpg" + ")", height: "444px ", }} > <img src="/#" alt="Psychopomp" /> <h2>SET UP YOUR DOMAIN</h2> <p> Get lorem10 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ultricies eu nulla vel dapibus.{" "} </p> <h3>SET UP YOUR DOMAIN</h3> </a> </li> <li className="caard caard2"> <a className="caard-image" href="#/" target="_blank" style={{ backgroundImage: "url(" + "https://image.freepik.com/free-vector/global-network-futuristic-technology_53876-97389.jpg" + ")", // height: "70px", top: "0", backgroundSize: "800px", backgroundRepeat: "no-repeat", height: "10px" }} > {/* to fix the enchore problem */} . </a> <a className="caard-description" href="/#" target="_blank" style={{ height: "187px", }} > <h2>Customise your own design</h2> <p style={{ color: "black" }}> Choose your own lqn akjna akna kann s aokqk aqkqk kqkna nso </p> <h3>Store Design</h3> </a> </li> <li className="caard caard3" style={{ backgroundColor: "white", }} > <a className="caard-image3 image_profile" href="/#" target="_blank" style={{ // backgroundImage: // "url(" + // "https://image.freepik.com/free-photo/medium-shot-happy-man-smiling_23-2148221808.jpg" + // ")", // height: "70px", top: "0", // backgroundColor: "white", backgroundSize: "200px", borderRadius: "25px", backgroundRepeat: "no-repeat", height: "10px", }} > <div className="wrapper"> <img src={profile} alt="profile" /> </div> <div> <p style={{ color: "black", position: "relative", left: "15px", top: "-90px", fontWeight: "900", }} > My Own Profile </p> </div> </a> <a className="caard-description" href="/#" target="_blank" style={{ height: "187px", position: "relative", top: "80px", }} > <div style={{ display: "flex", justifyContent: "space-around", borderRadius: "60%", }} > <button className="CancelBtn">Cancel</button> <button className="PlansBtn">Plans</button> </div> </a> </li> </ul> </Container> </> ); }; export default Analytics;
const productBusiness = require('../business/product-business'); const mongoose = require('mongoose'); const User = mongoose.model('user'); class ProductController { constructor(req, res) { this.req = req; this.res = res; } async exec(business) { try { let result = await business(); if (Buffer.isBuffer(result)) { this.res.set({'Content-Type': 'image/gif'}); this.res.end(result); } else { this.res.json(result); } } catch (e) { this.res.json({ error: e.message }) } } static async getAllProducts() { return await productBusiness.getAllProducts(); } async getProductImage() { return await productBusiness.getImage(this.req.params.id); } async getProductsByType() { return await productBusiness.getProductsByType(parseInt(this.req.params.type)); } async getProductsByProducer() { return await productBusiness.getProductsByProducer(this.req.params.producer); } async createProduct() { if (this.req.user.role !== 0) { throw new Error('Not authorization'); } return await productBusiness.createProduct(this.req.body, this.req.file); } async updateProduct() { if (this.req.user.role !== 0) { throw new Error('Not authorization'); } return await productBusiness.updateProduct(this.req.params.id, this.req.body, this.req.file); } static async getBestSellers() { return await productBusiness.getBestSellers(); } async getProductsByKeyword() { return await productBusiness.getProductsByKeyword(this.req.params.keyword); } async likeProduct() { let product = await productBusiness.getProductById(this.req.body.id); if (product) { this.req.user.favoriteProducts.push(product); await this.req.user.save(); } return product; } async unlikeProduct() { let product = await productBusiness.getProductById(this.req.body.id); if (product) { this.req.user = await User.findOneAndUpdate( { username: this.req.user.username }, { $pull: { favoriteProducts: product._id } }, { new: true }) .populate({ path: 'favoriteProducts', select: '_id', model: 'product' }); } return product; } async getFavoriteProducts() { return this.req.user.favoriteProducts; } } module.exports.getAllProducts = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(ProductController.getAllProducts); }; module.exports.getProductImage = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.getProductImage.bind(controller)); }; module.exports.getProductsByType = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.getProductsByType.bind(controller)); }; module.exports.getProductsByProducer = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.getProductsByProducer.bind(controller)); }; module.exports.createProduct = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.createProduct.bind(controller)); }; module.exports.updateProduct = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.updateProduct.bind(controller)); }; module.exports.getBestSellers = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(ProductController.getBestSellers); }; module.exports.getProductsByKeyword = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.getProductsByKeyword.bind(controller)); }; module.exports.likeProduct = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.likeProduct.bind(controller)); }; module.exports.unlikeProduct = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.unlikeProduct.bind(controller)); }; module.exports.getFavoriteProducts = async (req, res) => { let controller = new ProductController(req, res); await controller.exec(controller.getFavoriteProducts.bind(controller)); };
import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import { SketchPicker } from 'react-color'; import Button from './Button'; import NativeCheckbox from './NativeCheckbox'; import iconsShape from './shapes/iconsShape'; import languageShape from './shapes/languageShape'; class TreeNode extends React.Component { static propTypes = { checked: PropTypes.number.isRequired, disabled: PropTypes.bool.isRequired, expandDisabled: PropTypes.bool.isRequired, expanded: PropTypes.bool.isRequired, icons: iconsShape.isRequired, isLeaf: PropTypes.bool.isRequired, isParent: PropTypes.bool.isRequired, label: PropTypes.node.isRequired, lang: languageShape.isRequired, optimisticToggle: PropTypes.bool.isRequired, showNodeIcon: PropTypes.bool.isRequired, treeId: PropTypes.string.isRequired, updateNodeColor: PropTypes.func.isRequired, value: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]).isRequired, onCheck: PropTypes.func.isRequired, onExpand: PropTypes.func.isRequired, barSize: PropTypes.arrayOf(PropTypes.bool), children: PropTypes.node, className: PropTypes.string, expandOnClick: PropTypes.bool, icon: PropTypes.node, nodeColor: PropTypes.string, showCheckbox: PropTypes.bool, size: PropTypes.arrayOf(PropTypes.bool), title: PropTypes.string, onClick: PropTypes.func, }; static defaultProps = { children: null, className: null, expandOnClick: false, barSize: null, size: null, nodeColor: null, icon: null, showCheckbox: true, title: null, onClick: () => {}, }; constructor(props) { super(props); const nodeColor = this.props; console.log(nodeColor); this.state = { isHidden: true, iconColor: '', }; this.onCheck = this.onCheck.bind(this); this.onClick = this.onClick.bind(this); this.onExpand = this.onExpand.bind(this); this.setWrapperRef = this.setWrapperRef.bind(this); this.handleClickOutside = this.handleClickOutside.bind(this); } componentDidMount() { document.addEventListener('mousedown', this.handleClickOutside); } componentWillUnmount() { document.removeEventListener('mousedown', this.handleClickOutside); } onCheck() { let isChecked = false; // Toggle off state to checked if (this.props.checked === 0) { isChecked = true; } // Toggle partial state based on cascade model if (this.props.checked === 2) { isChecked = this.props.optimisticToggle; } this.props.onCheck({ value: this.props.value, checked: isChecked, }); } onClick() { const { checked, expandOnClick, isParent, optimisticToggle, value, onClick, } = this.props; let isChecked = false; if (checked === 1) { isChecked = true; } // Get partial state based on cascade model if (checked === 2) { isChecked = optimisticToggle; } // Auto expand if enabled if (isParent && expandOnClick) { this.onExpand(); } onClick({ value, checked: isChecked }); } onExpand() { const { expanded, value, onExpand } = this.props; onExpand({ value, expanded: !expanded }); } setWrapperRef(node) { this.wrapperRef = node; } handleChangeComplete = (color) => { const { isLeaf } = this.props; this.setState({ iconColor: color.hex }); if (!isLeaf) { this.props.updateNodeColor(color.hex); } }; handleClickOutside(event) { const { isHidden } = this.state; if (this.wrapperRef && !this.wrapperRef.contains(event.target)) { this.setState({ isHidden: isHidden === true ? isHidden : !isHidden }); } } renderCollapseButton() { const { expandDisabled, isLeaf, lang, } = this.props; if (isLeaf) { return ( <span className="rct-collapse"> <span className="rct-icon" /> </span> ); } return ( <Button className="rct-collapse rct-collapse-btn" disabled={expandDisabled} title={lang.toggle} onClick={this.onExpand} > {this.renderCollapseIcon()} </Button> ); } renderColorIcon() { const { isHidden, iconColor } = this.state; const { nodeColor } = this.props; const style1 = { color: iconColor === '' ? nodeColor : iconColor, }; return ( <div className="colorSelector" ref={this.setWrapperRef}> <span className="rct-icon rct-icon-color" style={style1} onClick={() => this.setState({ isHidden: !isHidden })} onKeyPress={() => this.setState({ isHidden: !isHidden })} role="button" tabIndex={0} /> {!isHidden && <SketchPicker onChangeComplete={this.handleChangeComplete} />} </div> ); } renderCollapseIcon() { const { expanded, icons: { expandClose, expandOpen } } = this.props; if (!expanded) { return expandClose; } return expandOpen; } renderCheckboxIcon() { const { checked, nodeColor } = this.props; const { iconColor } = this.state; const btnStyle = { color: iconColor === '' ? nodeColor : iconColor, }; if (checked === 0) { return (<span className="rct-icon rct-icon-uncheck" />); } if (checked === 1) { return (<span className="rct-icon rct-icon-check" style={btnStyle} />); } return (<span className="rct-icon rct-icon-half-check" style={btnStyle} />); } renderNodeIcon() { const { expanded, icon, icons: { leaf, parentClose, parentOpen }, isLeaf, } = this.props; if (icon !== null) { return icon; } if (isLeaf) { return leaf; } if (!expanded) { return parentClose; } return parentOpen; } renderBareLabel(children) { const { onClick, title } = this.props; const clickable = onClick.toString() !== TreeNode.defaultProps.onClick.toString(); return ( <span className="rct-bare-label" title={title}> {clickable ? ( <span className="rct-node-clickable" onClick={this.onClick} onKeyPress={this.onClick} role="button" tabIndex={0} > {children} </span> ) : children} </span> ); } renderBarChart() { const { barSize, nodeColor } = this.props; const { iconColor } = this.state; const rectStyle = { fill: 'rgb(65,85,181,0.1)', }; const rectStyle2 = { fill: iconColor === '' ? nodeColor : iconColor, }; return ( <span className="bars"> <svg width={150} height={10}> <rect width={150} height={10} style={rectStyle} /> <rect width={barSize * 150} height={10} style={rectStyle2} /> </svg> </span> ); } renderCheckboxLabel(children) { const { checked, disabled, label, title, treeId, value, onClick, isLeaf, } = this.props; const clickable = onClick.toString() !== TreeNode.defaultProps.onClick.toString(); const inputId = `${treeId}-${String(value).split(' ').join('_')}`; const render = [( <label key={0} htmlFor={inputId} title={title}> <NativeCheckbox checked={checked === 1} disabled={disabled} id={inputId} indeterminate={checked === 2} onChange={this.onCheck} /> <span className="rct-checkbox"> {this.renderCheckboxIcon()} </span> <span> {!clickable ? children : null} {!isLeaf ? null : <div className="barDiv">{this.renderBarChart()}</div>} </span> </label> )]; if (clickable) { render.push(( <span key={1} className="rct-node-clickable" onClick={this.onClick} onKeyPress={this.onClick} role="link" tabIndex={0} > {children} </span> )); } return render; } renderLabel() { const { label, showCheckbox, showNodeIcon, isLeaf, size, } = this.props; const style1 = { top: 0, }; const style2 = { paddingTop: '4px', }; const labelChildren = [ showNodeIcon ? ( <span key={0} className="rct-node-icon"> {this.renderNodeIcon()} </span> ) : null, <span key={1} className="rct-title" style={!isLeaf ? style2 : style1}> {label} {`(${size})`} </span>, ]; if (!showCheckbox) { return this.renderBareLabel(labelChildren); } return this.renderCheckboxLabel(labelChildren); } renderChildren() { if (!this.props.expanded) { return null; } return this.props.children; } render() { const { className, disabled, expanded, isLeaf, } = this.props; const nodeClass = classNames({ 'rct-node': true, 'rct-node-leaf': isLeaf, 'rct-node-parent': !isLeaf, 'rct-node-expanded': !isLeaf && expanded, 'rct-node-collapsed': !isLeaf && !expanded, 'rct-disabled': disabled, }, className); return ( <li className={nodeClass}> <span className="rct-text"> {this.renderLabel()} {this.renderColorIcon()} {this.renderCollapseButton()} </span> {this.renderChildren()} </li> ); } } export default TreeNode;
export const priceDispaly = (price)=>{ return price + ' €' }
"use strict" import axios from 'axios'; import whilst from 'async/whilst'; import waterfall from 'async/waterfall'; export function getAllUsers(sortOpt, filterOpt){ let endpoint = "/api/user"; if(sortOpt){ endpoint += '?sort='+encodeURIComponent(sortOpt); } else { endpoint += '?sort=joindate_desc'; } if(filterOpt !== undefined){ endpoint += '&filter='+encodeURIComponent(filterOpt); } console.log(endpoint); return (dispatch)=>{ axios.get(endpoint) .then(response=>{ dispatch({type:"GET_ALL_USERS", payload:response.data.data}) }) .catch(err=>{ dispatch({type:"GET_ALL_USERS_REJECTED", payload: err}) }) } } export function updateFilterOpt(filterOpt){ return dispatch=>{ dispatch({type:"UPDATE_FILTER_OPT", payload: filterOpt}); } } export function updateSortOpt(sortOpt){ return dispatch=>{ dispatch({type:"UPDATE_SORT_OPT", payload: sortOpt}); } } export function getUniqueValues(){ return dispatch => { axios.get('/api/valuelist') .then(res=>{ dispatch({type:"GET_UNIQUE_VALUES", payload:res.data}) }) .catch(err=>{ dispatch({type:"GET_UNIQUE_VALUES_REJECTED", payload: err}) }) } } export function getUserCount(){ return (dispatch)=>{ dispatch({type:"GET_USER_COUNT"}) } } export function toggleMemberships(membership, targetNumber, totalDuration){ return dispatch =>{ let userCount, difference; let userIds = []; let index = 0; waterfall([ (cb) => { axios.get('/api/lateststats') .then(res => { userCount = res.data[0][`membership_eq_${membership}`]; dispatch({type:"TOGGLE_MEM_START"}); cb(null) }) .catch(err => { dispatch({type:"TOGGLE_MEM_ERROR"}); console.log(err); }) }, (cb) => { difference = targetNumber - userCount; axios.get(`/api/user?filter=membership_ne_${membership}&sort=age_desc&limit=${difference}`) .then(res => { userIds = res.data.data.map(x => x.id); // store list of ids to convert cb(null); }) .catch(err => { dispatch({type:"TOGGLE_MEM_ERROR"}); console.log(err); }) } ], (err, res) => { console.log(`got ids of ${difference} users to process. Starting conversion.`) whilst( () => { //truth test: until userCount reaches the target number return userCount < targetNumber }, (callback) => { setTimeout(() => { let id = userIds[index]; axios.post(`/api/user/${id}`, { 'membership': membership }) .then(res => { console.log(`updated ${id}'s membership to ${membership}`); }) .catch(err => { dispatch({type:"TOGGLE_MEM_ERROR"}); console.log(err); }); userCount++; index++; callback(); }, totalDuration / difference); }, (err, res) => { //result if (err) { console.log(err); dispatch({type:"TOGGLE_MEM_ERROR"}); } console.log(`conversion complete`) dispatch({type:"TOGGLE_MEM_SUCCESS", payload: membership}); }) }) } }
import React from 'react'; import {connect} from 'react-redux'; const Track = ({track})=> <div> {track.name}</div>; const mapStateToProps = (state,ownProps)=>{ return { track: state.tracks.find(track=>track.id+'' === ownProps.params.id) } } export default connect(mapStateToProps)(Track);
import React, { Component } from 'react'; import "./w3.css"; import './App.css'; import IdeaFeed from './components/IdeaFeed'; import IdeaCard from './components/Card/Card' import NewPost from './components/NewPost'; import SortBar from './components/SortBar'; import Login from './components/Login'; import Helmet from 'react-helmet'; import Button from '@material-ui/core/Button'; import Icon from '@material-ui/core/Icon'; import IconButton from '@material-ui/core/IconButton'; import PropTypes from 'prop-types'; import BackgroundImage from './components/BackgroundImage'; class App extends Component { constructor(props) { super(props); this.handleChange = this.handleChange.bind(this) this.handleLogin = this.handleLogin.bind(this) this.state = { query: null, isLoggedIn: false, user: "", } } handleChange = (event) => { this.setState({ query: event.target.value }); } handleLogin = (func) => { console.log(this.state.isLoggedIn); if (this.state.isLoggedIn === false) { fetch('/api/whoami') .then(results => { return results.json(); }).then(data => { if (data["user"]) { localStorage.clear(); this.setState({isLoggedIn: true}); func(); return true; } else { localStorage.setItem('login', true); window.location.assign('/login'); console.log("AFTER ASSIGN"); //this.setState({isLoggedIn: !this.state.isLoggedIn}) func(); return false; } }) .catch(err => { console.log("BATO err: " + err); localStorage.setItem('login', true); window.location.assign('/login'); return false; }); } else { func(); return true; } func(); } componentDidMount() { fetch('/api/whoami') .then(results => { return results.json(); }).then(data => { console.log("user: " + data["user"]); this.setState({user: data["user"]}); }); } render() { console.log("Should only appear once"); let login = this.state.isLoggedIn; console.log(login); if(!this.state.isLoggedIn) { if(localStorage.getItem('login')) { login = true; } } else { login = true; } console.log("LOG: " + login); console.log("STATE " + this.state.isLoggedIn); localStorage.clear(); return ( <div className="App"> <Helmet> </Helmet> {/* TOP BAR */} <div> <div className="w3-bar w3-white w3-wide w3-padding w3-card w3-large"> <a href="/login" className="w3-bar-item w3-button">Tiger<b>TEAMS</b></a> <div className="w3-bar-item w3-hide-small w3-right"> <Login className="w3-bar-item w3-hide-small w3-right" user={this.state.user} isLoggedInFunc={this.handleLogin} isLoggedIn={login}/> </div> <form className="w3-bar-item search-container center"> <input id="search" type="text" id="search-bar" placeholder="..." onChange={this.handleChange}/> <a href="#"><img className="search-icon" src="http://www.endlessicons.com/wp-content/uploads/2012/12/search-icon.png"/></a> </form> </div> </div> <IdeaFeed query={this.state.query} isLoggedInFunc={this.handleLogin} user={this.state.user}/> </div> ); } } export default App;
import { useState } from "react"; import { Box, Container, useBreakpointValue } from "@chakra-ui/react"; import Header from "./Header.jsx"; import Sidebar from "./Sidebar.jsx"; import { useAuth } from "../../../contexts/AuthProvider.js"; import AuthBanner from "../../Auth/AuthBanner"; const smVariant = { navigation: "drawer", navigationButton: true }; const mdVariant = { navigation: "sidebar", navigationButton: false }; export default function Layout({ children, onOpen }) { const [isSidebarOpen, setSidebarOpen] = useState(false); const variants = useBreakpointValue({ base: smVariant, md: mdVariant }); const { isAuth } = useAuth(); const toggleSidebar = () => setSidebarOpen(!isSidebarOpen); return ( <> {isAuth && ( <> <Sidebar variant={variants?.navigation} isOpen={isSidebarOpen} onClose={toggleSidebar} /> <Box ml={!variants?.navigationButton && "250px"}> <Header onOpen={onOpen} showSidebarButton={variants?.navigationButton} onShowSidebar={toggleSidebar} /> <Box pos="relative">{children}</Box> </Box> </> )} {!isAuth && <AuthBanner />} </> ); }
// pages/categroy/categroy.js import Categroy from './categroy-model.js' const categroy = new Categroy() Page({ data: { baseUrl: categroy.baseUrl, navSel:0, nav: ['面食', '煎档', '烧烤', '酒水','特色菜'], typeInfo:[] }, onLoad: function (options) { console.log('typeInfo',this.data.typeInfo) this.getInfoByType(1) }, sel(e){ let index = categroy.getDataSet(e, 'index') this.setData({navSel:index}) this.getInfoByType(index + 1) }, getInfoByType(id) { let typeInfo = wx.getStorageSync('typeInfo') console.log(typeInfo) if (typeInfo) { //typeifno 存在 let exit = this.isExit(id) if (exit == -1) { console.log('数据不存在') categroy.axios('GET', `/api/home/goodsByType?type=${id}`) .then((res) => { let data = wx.getStorageSync('typeInfo') data.push(res) this.setData({ typeInfo: data }) wx.setStorageSync('typeInfo', data) }) } else { console.log('数据存在') let data = wx.getStorageSync('typeInfo')[exit] console.log(data) } } else { let typeInfo = [] let name = this.data.nav[id - 1] let temp = null; categroy.axios('GET', `/api/home/goodsByType?type=${id}`) .then((res) => { temp = res console.log(temp) typeInfo.push(temp) wx.setStorageSync('typeInfo', typeInfo) let data = wx.getStorageSync('typeInfo') this.setData({ typeInfo:data }) }) } }, // 判断类别在缓存中是否存在 isExit(id) { // -1 到缓存长度 -1 表示不存在 0 ,1,2 数据存在并且返回下标 let index = -1 let name = this.data.nav[id - 1] let typeInfo = wx.getStorageSync('typeInfo') typeInfo.map((item, idx) => { if (name == item.name) { //存在 index = idx } }) return index } })
import axios from '@/utils/http' // import { mergeUrl } from '../base' export default { ENTER_INFO_DATA: window.REQ_URL, // (mergeUrl('get_infoList')), // 获取企业信息数据 getEnterpriseInfo (params) { Log.i('请求地址:', this.ENTER_INFO_DATA) return axios.get(this.ENTER_INFO_DATA, { params }) } }
var AppPot = AppPotSDK.getService({ url: 'http://trial.apppot.net/apppot/', appId: 'testapp', appKey: '89a10c6842c7426b8fbd46b710c8a0bd', appVersion: '1.0.0', companyId: 114, groupId: 470 }); var navi; ons.ready(function() { navi = document.getElementById('navi'); document.getElementById('userName').value = "ncdctest2017090501"; document.getElementById('password').value = "k2tlinm8"; }); var customerData; function login() { var userName = document.getElementById('userName').value; var password = document.getElementById('password').value; AppPot.LocalAuthenticator.login(userName, password) .then(() => { console.log("Logined."); navi.pushPage('list.html').then(getCustomerList); }) .catch((error) => { alert('ログインに失敗しました'); }); } function getCustomerList() { AppPot.Gateway.get("customer-db", "CustomerCompany", null, null, null) .then((response) => { console.log(JSON.stringify(response)); var list = document.getElementById('customerList'); list.innerHTML = ''; customerData = response.CustomerCompany || []; customerData.forEach((customer, index) => { var template = '<ons-list-item modifier="chevron" onclick="showCustomerData(' + index + ')">' + customer.companyName + '</ons-list-item>'; ons.createElement(template, { append: list }); }); }); } function showCustomerData(index) { AppPot.Gateway.get("customer-db", "CustomerCompany", null, null, null) .then((response) => { navi.pushPage('detail.html') .then((page) => { page.querySelector('[name="companyName"]>div').textContent = customerData[index].companyName; page.querySelector('[name="companyNameKana"]>div').textContent = customerData[index].companyNameKana; page.querySelector('[name="zipCode"]>div').textContent = customerData[index].zipCode; page.querySelector('[name="address"]>div').textContent = customerData[index].address; page.querySelector('[name="phoneNumber"]>div').innerHTML = '<a href="tel:' + customerData[index].phoneNumber + '">' + customerData[index].phoneNumber + '</a>'; }); }); } function addCustomerData() { navi.pushPage('regist.html'); } function regist() { var requestJson = { "companyId" : "0001", "companyName" : document.getElementById('companyName').value, "companyNameKana" : document.getElementById('companyNameKana').value, "zipCode" : document.getElementById('zipCode').value, "address" : document.getElementById('address').value, "phoneNumber" : document.getElementById('phoneNumber').value } AppPot.Gateway.post("customer-db", "CustomerCompany", null, requestJson, null) .then((response) => { console.log(response); alert("登録しました"); navi.popPage().then(getCustomerList); }); }
$(document).ready(function() { $('.xedit').editable(); });
import React from "react"; class UserList extends React.Component { constructor(props) { super(props); } render() { console.log("props from app", this.props.user) return (<div className="user"> <img className="image" src={this.props.user.avatar_url}></img> <p>Name: {this.props.user.name}</p> <p>Bio: {this.props.user.bio}</p> <p>Location: {this.props.user.location}</p> </div>) } } export default UserList;
import React from 'react'; import PropTypes from 'prop-types'; import DayPicker from 'react-day-picker'; import styled from 'styled-components'; import { margin } from 'styled-system'; import { createPropTypes } from '@styled-system/prop-types'; import { pick } from '@styled-system/props'; import { omit } from '../../helpers/props'; import Navbar from './Navbar'; import Caption from './Caption'; import Weekday from './Weekday'; import renderDay from './Day'; import { wrapper } from './styles'; export const Wrapper = styled.div` ${margin} ${wrapper} `; const DatePicker = React.forwardRef(function DatePicker(props, ref) { const systemProps = pick(props); const componentProps = omit(props, margin.propNames); return ( <Wrapper ref={ref} {...systemProps} data-id="datepicker" numberOfMonths={props.numberOfMonths}> <DayPicker captionElement={Caption} weekdayElement={Weekday} renderDay={renderDay} navbarElement={Navbar} {...componentProps} /> </Wrapper> ); }); DatePicker.displayName = 'DatePicker'; DatePicker.propTypes = { ...DayPicker.propTypes, numberOfMonths: PropTypes.oneOf([1, 2]), ...createPropTypes(margin.propNames), }; DatePicker.defaultProps = { fixedWeeks: false, enableOutsideDaysClick: false, numberOfMonths: 2, showOutsideDays: false, }; export default DatePicker;
require('colors'); function assert(truth, msg) { if (!truth) { throw new Error(('Fail: '.red) + (msg || '').yellow); } else { console.log(('Pass: '.green) + (msg || '').yellow); } }; function deepEqual(actual, expected, msg) { var isEqual = true; if (actual.length !== expected.length) { assert(false, msg); return; } actual.forEach(function (el, i) { isEqual &= el === expected[i]; }); if (!isEqual) { msg += ('\nactual: ' + actual.toString()).bgRed.white.bold; msg += ('\nexpected: ' + expected.toString()).bgGreen.white.bold; } assert(isEqual, msg); }; module.exports = function () { if (arguments.length === 3) { deepEqual.apply(null, arguments); return; } assert.apply(null, arguments); };
import ArrayIterator from './ArrayIterator' import { append, call, clone, compose as c, last, map, prop, reduce, reduced, } from 'ramda' // Group = RecursiveRepeatableArray = { count: Number, repeat: Group[] } // Cursor = { index, repeat }[] // A path to the position of the element // to be returned by the next call to next // @example // const group = { repeat: [1, { repeat: [2, 3] }] } // const value = iterator(group).goto([{ index: 1 }, { index: 0 }]).next() // // value === 2 /** * Iterates over a group * @kind Group group -> Iterator iterator */ export default ({ count = 1, repeat = [] }) => { let iterator let stack = [ArrayIterator({ count, repeat })] let cursor = [] const getCursor = () => cursor = map(c(call, prop('cursor')))(stack) const pop = () => ((stack.pop() , iterator.next())) const push = value => ((stack.push(ArrayIterator(value)), iterator.next())) return (iterator = { /** * Returns cursor * @kind () => Cursor cursor */ cursor: () => clone(cursor), /** * Resets iterator * @kind () -> Iterator iterator */ reset: () => ((iterator.goto(), iterator)), /** * Moves cursor * @kind Cursor cursor -> Iterator iterator */ goto: (cursor = [])=> (( // Redo corresponding stack stack = c( prop('stack'), reduce( ( { stack, current }, cursor, iterator = ArrayIterator(current).goto(cursor), index = iterator.cursor().index ) => current.repeat ? ({ stack: append(iterator)(stack), // append array iterator moved to the given index & repeat current: current.repeat[index], // new current is indexth child of old current }) : reduced({ stack, current }), // cannot go further { stack: [], current: { count, repeat } } ) )(cursor.length ? cursor : [{}]), // Refresh cursor getCursor(), // Return iterator iterator )), /** * Returns current value in group, * and move cursor to next value * @kind () -> Object { value, done } */ next: () => { const it = last(stack) if (!it) return { done: true } let { value, done } = it.next() const recursive = value && value.count && value.repeat return done ? pop() : recursive ? push(value) : ((getCursor(), { value })) }, }) }
var searchData= [ ['middle_5fclick',['MIDDLE_CLICK',['../class_lua_api_engine.html#a1602caa62234d29ccea61ffcc1bdee88a5fffe4e5bd96431c20794b5a44b016e6',1,'LuaApiEngine']]], ['middle_5fdown',['MIDDLE_DOWN',['../class_lua_api_engine.html#a1602caa62234d29ccea61ffcc1bdee88a385c76f8600da0a4d03e33ea8da7b40c',1,'LuaApiEngine']]], ['middle_5fup',['MIDDLE_UP',['../class_lua_api_engine.html#a1602caa62234d29ccea61ffcc1bdee88a8c9d233330d2e6bc8ca45afd350711cd',1,'LuaApiEngine']]], ['move_5fto',['MOVE_TO',['../class_lua_api_engine.html#a1602caa62234d29ccea61ffcc1bdee88a8ab24a807f2be2a1d5d9d5c449393f6f',1,'LuaApiEngine']]] ];
export default { /** * Инициализировать всплывающий блок / тултип * @param el * @param value */ bind(el, {value}) { window.M.Tooltip.init(el, {html:value}) }, /** * Удалить инициализированные тултипы * @param el */ unbind(el) { const tooltip = window.M.Tooltip.getInstance(el) if (tooltip && tooltip.destroy) { tooltip.destroy() } } }
import React from "react"; import "./style.css"; export default function Navbar({setPage}) { const getPage = page => { setPage(page); } return ( <nav> <a href="#menu" onClick={()=> getPage("menu")}>Our Menu</a> <a href="#about" onClick={()=> getPage("about")}>About Us</a> <a href="#enemies" onClick={()=> getPage("enemies")}>Evil Plans</a> <a href="#catering" onClick={()=> getPage("catering")}>Catering</a> <a href="#contact" onClick={()=> getPage("contact")}>Get in touch</a> </nav> ) }
import React from 'react'; import { StyleSheet, Text, View, StatusBar, ListView } from 'react-native'; import { Container, Content, Header, Form, Input, Item, Button, Label, Icon, List, ListItem } from 'native-base'; import * as firebase from 'firebase'; import Apikeys from './src/constants/AppKeys'; const data = []; export default class App extends React.Component { constructor(props){ super(props); //initialize firebase if (!firebase.apps.length) { firebase.initializeApp(Apikeys.FirebaseConfig); } // data source this.ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); // State of app this.state = { listViewData: data, newTask: "" } } componentDidMount(){ var that = this firebase.database().ref('tasks').on('child_added', function (data){ var newData = [...that.state.listViewData] newData.push(data) that.setState({listViewData: newData}) }) } addRow(data) { var key = firebase.database().ref('tasks').push().key firebase.database().ref('tasks').child(key).set({ name: data }) } async deleteRow(secId, rowId, rowMap, data) { await firebase.database().ref('tasks/'+data.key).set(null) rowMap[`${secId}${rowId}`].props.closeRow(); var newData = [...this.state.listViewData]; newData.splice(rowId, 1); this.setState({ listViewData: newData }); } showInformation() { } render() { return ( <Container style={styles.container}> <Header style={{marginTop: StatusBar.currentHeight}}> <Content> <Item> <Input onChangeText={(newTask) => this.setState({ newTask })} placeholder="Add Task" /> <Button onPress={() => this.addRow(this.state.newTask)}> <Icon name="add" /> </Button> </Item> </Content> </Header> <Content> <List enableEmptySections dataSource={this.ds.cloneWithRows(this.state.listViewData)} renderRow={data=> <ListItem> <Text style={{ marginLeft: 10}}>{data.val().name}</Text> </ListItem> } renderLeftHiddenRow={data=> <Button full onPress={() => this.addRow(data)}> <Icon name="information-circle" /> </Button> } renderRightHiddenRow={(data, secId, rowId, rowMap) => <Button full danger onPress={() => this.deleteRow(secId, rowId, rowMap, data)}> <Icon name="trash" /> </Button> } leftOpenValue={75} rightOpenValue={-75} /> </Content> </Container> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, });
import React from 'react'; import s from './ButtonsBlock.module.css' import Button from "../../Button/Button"; import {connect} from "react-redux"; import {setValues} from "../../redux/reduser"; const ButtonsBlock = (props) => { return ( <div className={s.container}> <Button onClickFunction={props.setValues} isDisabled={props.isDisabled} title='set'/> </div> ); }; const mapStateToProps = (state) => { return { isDisabled: state.isDisableSet } }; const connectedButtonsBlock = connect(mapStateToProps, {setValues})(ButtonsBlock); export default connectedButtonsBlock;
import { Router } from "@reach/router" import React from "react" import AdminRoute from "../../components/aws/AdminRoute" import PrivateRoute from "../../components/aws/PrivateRoute" import Layout from "../../components/layout" import Orders from "./orders" import Profile from "./profile" const App = ({ location }) => { return ( <Layout location={location} title={"Страница Пользователя"}> <Router> <PrivateRoute path="/user/profile" component={Profile} /> <AdminRoute path="/user/orders" component={Orders} /> </Router> </Layout> ) } export default App
import React from 'react'; import { BrowserRouter as Router, Switch, Route, HashRouter } from "react-router-dom"; import { hashHistory } from 'react-router'; import './App.css'; import Signup from './Components/Signup'; import Home from './Components/Home'; import Login from './Components/Login'; import ForgotPassword from './Components/ForgotPassword'; import PostItem from './Components/PostItem'; // import 'bootstrap/dist/css/bootstrap.css' class App extends React.Component { render() { return ( <div className="App bg-black"> <HashRouter> <Switch> <Route path="/" exact component={Home} ></Route> <Route path="/signup" component={Signup} ></Route> <Route path="/login" component={Login} ></Route> <Route path="/post/:id" component={PostItem} ></Route> <Route path="/forgotpassword" component={ForgotPassword} ></Route> </Switch> </HashRouter> </div> ); } } export default App;
Grailbird.data.tweets_2012_08 = [ { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "win8", "indices" : [ 65, 70 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "240979246078623744", "text" : "People who prefer the start menu to the start screen confuse me. #win8", "id" : 240979246078623744, "created_at" : "2012-08-30 01:08:24 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 40, 45 ] } ], "urls" : [ { "indices" : [ 19, 39 ], "url" : "http:\/\/t.co\/Bre4VFA6", "expanded_url" : "http:\/\/www.ludumdare.com\/compo\/ludum-dare-24\/?action=rate&uid=6228", "display_url" : "ludumdare.com\/compo\/ludum-da\u2026" } ] }, "geo" : { }, "id_str" : "240093215800315904", "text" : "TimeLapse is up! \nhttp:\/\/t.co\/Bre4VFA6 #ld48\nWhat a great Ludum Dare! I can't wait to play everyone elses entries.", "id" : 240093215800315904, "created_at" : "2012-08-27 14:27:38 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Jared Kells", "screen_name" : "jkells", "indices" : [ 0, 7 ], "id_str" : "12671432", "id" : 12671432 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "in_reply_to_status_id_str" : "239573122783801344", "geo" : { }, "id_str" : "240073199222661120", "in_reply_to_user_id" : 12671432, "text" : "@jkells Thanks man", "id" : 240073199222661120, "in_reply_to_status_id" : 239573122783801344, "created_at" : "2012-08-27 13:08:05 +0000", "in_reply_to_screen_name" : "jkells", "in_reply_to_user_id_str" : "12671432", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 135, 140 ] } ], "urls" : [ { "indices" : [ 43, 63 ], "url" : "http:\/\/t.co\/Bre4VFA6", "expanded_url" : "http:\/\/www.ludumdare.com\/compo\/ludum-dare-24\/?action=rate&uid=6228", "display_url" : "ludumdare.com\/compo\/ludum-da\u2026" } ] }, "geo" : { }, "id_str" : "240073072412082176", "text" : "Well it's finished! Play \"Tree\" here -&gt; http:\/\/t.co\/Bre4VFA6 I had so many ideas, but reduced scope alot due to time. But I'm happy #ld48", "id" : 240073072412082176, "created_at" : "2012-08-27 13:07:35 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Stu Wallinger", "screen_name" : "StuWallinger", "indices" : [ 3, 16 ], "id_str" : "44550872", "id" : 44550872 } ], "media" : [ ], "hashtags" : [ { "text" : "LD48", "indices" : [ 139, 140 ] } ], "urls" : [ { "indices" : [ 139, 140 ], "url" : "http:\/\/t.co\/pkTtqe2V", "expanded_url" : "http:\/\/www.ludumdare.com\/compo\/ludum-dare-24\/?action=preview&uid=8098", "display_url" : "ludumdare.com\/compo\/ludum-da\u2026" } ] }, "geo" : { }, "id_str" : "239958718136086529", "text" : "RT @StuWallinger: Didn't get to put everything I wanted into it but it'll be a great starting point for me to continue on with.\n\nhttp:\/\/ ...", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "LD48", "indices" : [ 132, 137 ] } ], "urls" : [ { "indices" : [ 111, 131 ], "url" : "http:\/\/t.co\/pkTtqe2V", "expanded_url" : "http:\/\/www.ludumdare.com\/compo\/ludum-dare-24\/?action=preview&uid=8098", "display_url" : "ludumdare.com\/compo\/ludum-da\u2026" } ] }, "geo" : { }, "id_str" : "239956541938221057", "text" : "Didn't get to put everything I wanted into it but it'll be a great starting point for me to continue on with.\n\nhttp:\/\/t.co\/pkTtqe2V #LD48", "id" : 239956541938221057, "created_at" : "2012-08-27 05:24:32 +0000", "user" : { "name" : "Stu Wallinger", "screen_name" : "StuWallinger", "protected" : false, "id_str" : "44550872", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/1887424499\/LogoGuy_normal.png", "id" : 44550872, "verified" : false } }, "id" : 239958718136086529, "created_at" : "2012-08-27 05:33:11 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 33, 38 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239889643556962305", "text" : "I'm going to upload what I have. #ld48", "id" : 239889643556962305, "created_at" : "2012-08-27 00:58:42 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 36, 41 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239887958373711872", "text" : "God damn it this game is so broken! #ld48", "id" : 239887958373711872, "created_at" : "2012-08-27 00:52:00 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 53, 58 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239820138638098432", "text" : "Oh man it was hard to not get out of bed! I'm back! #ld48", "id" : 239820138638098432, "created_at" : "2012-08-26 20:22:31 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 121, 126 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239783811079098368", "text" : "Taking a short rest. 2 hours. Giving me 5 hours to finish this thing. It's a risk as it's not yet in a playable state. #ld48 Zzzzzzzzz", "id" : 239783811079098368, "created_at" : "2012-08-26 17:58:10 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 111, 116 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239778066413518848", "text" : "I think I'll put in some tweening just for fade in and fade outs. My gui needs a lot of work but I am hopeful #ld48", "id" : 239778066413518848, "created_at" : "2012-08-26 17:35:20 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/239774548487200769\/photo\/1", "indices" : [ 37, 57 ], "url" : "http:\/\/t.co\/XW1iansT", "media_url" : "http:\/\/pbs.twimg.com\/media\/A1PZrnUCYAAyG_J.png", "id_str" : "239774548491395072", "id" : 239774548491395072, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/A1PZrnUCYAAyG_J.png", "sizes" : [ { "h" : 600, "resize" : "fit", "w" : 800 }, { "h" : 255, "resize" : "fit", "w" : 340 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 450, "resize" : "fit", "w" : 600 }, { "h" : 600, "resize" : "fit", "w" : 800 } ], "display_url" : "pic.twitter.com\/XW1iansT" } ], "hashtags" : [ { "text" : "ld48", "indices" : [ 31, 36 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239774548487200769", "text" : "Title Screen is coming a long. #ld48 http:\/\/t.co\/XW1iansT", "id" : 239774548487200769, "created_at" : "2012-08-26 17:21:22 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 128, 133 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239771139352711169", "text" : "Now it feels smooth, with a max branch length! I've had another bug since the first few hours in. Gonna try and fix that now. #ld48", "id" : 239771139352711169, "created_at" : "2012-08-26 17:07:49 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 29, 34 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239770690352451584", "text" : "YES! I am a golden trig god! #ld48", "id" : 239770690352451584, "created_at" : "2012-08-26 17:06:01 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 83, 88 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239765696156934144", "text" : "I can't wait until I'm the trig master that I need to be to do these jams quickly. #ld48", "id" : 239765696156934144, "created_at" : "2012-08-26 16:46:11 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 121, 126 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239763638439788545", "text" : "When I don't limit the length of branches it flows so much better!\nBut then people could make really un-treelike trees. #ld48", "id" : 239763638439788545, "created_at" : "2012-08-26 16:38:00 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 100, 105 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239758401448579072", "text" : "Keep running into stupid problems. Just going to refactor for an hour before adding anything else. #ld48", "id" : 239758401448579072, "created_at" : "2012-08-26 16:17:12 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/239739720005984256\/photo\/1", "indices" : [ 28, 48 ], "url" : "http:\/\/t.co\/R2MEL3Go", "media_url" : "http:\/\/pbs.twimg.com\/media\/A1O6AVJCIAAIrd7.png", "id_str" : "239739720018567168", "id" : 239739720018567168, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/A1O6AVJCIAAIrd7.png", "sizes" : [ { "h" : 375, "resize" : "fit", "w" : 515 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 375, "resize" : "fit", "w" : 515 }, { "h" : 375, "resize" : "fit", "w" : 515 }, { "h" : 247, "resize" : "fit", "w" : 340 } ], "display_url" : "pic.twitter.com\/R2MEL3Go" } ], "hashtags" : [ { "text" : "ld48", "indices" : [ 19, 24 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239739720005984256", "text" : "It's getting late. #ld48 :) http:\/\/t.co\/R2MEL3Go", "id" : 239739720005984256, "created_at" : "2012-08-26 15:02:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 84, 89 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239724473916473344", "text" : "Had a sweet acoustic riff for my game. But when I made it an mp3, it wouldn't loop #ld48", "id" : 239724473916473344, "created_at" : "2012-08-26 14:02:23 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 53, 58 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239662053021868032", "text" : "Photoshopping leaves. And hopefully some fruit too! #ld48", "id" : 239662053021868032, "created_at" : "2012-08-26 09:54:20 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 131, 136 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239627627554562048", "text" : "I like the look of the tree now. Dynamically created graphics are really fun.\nI'm wondering whether I will even use Photoshop now #ld48", "id" : 239627627554562048, "created_at" : "2012-08-26 07:37:33 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 110, 115 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239587640301740033", "text" : "Woah! I hadn't used Photoshop CS6 Before.\nHope it isn't so unfamiliar that I can't figure out simple things. #ld48", "id" : 239587640301740033, "created_at" : "2012-08-26 04:58:39 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/239572887076474880\/photo\/1", "indices" : [ 20, 40 ], "url" : "http:\/\/t.co\/xVTt5sh4", "media_url" : "http:\/\/pbs.twimg.com\/media\/A1MiRYBCEAEbHkL.png", "id_str" : "239572887080669185", "id" : 239572887080669185, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/A1MiRYBCEAEbHkL.png", "sizes" : [ { "h" : 599, "resize" : "fit", "w" : 800 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 254, "resize" : "fit", "w" : 340 }, { "h" : 449, "resize" : "fit", "w" : 600 }, { "h" : 599, "resize" : "fit", "w" : 800 } ], "display_url" : "pic.twitter.com\/xVTt5sh4" } ], "hashtags" : [ { "text" : "ld48", "indices" : [ 14, 19 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239572887076474880", "text" : "Getting there #ld48 http:\/\/t.co\/xVTt5sh4", "id" : 239572887076474880, "created_at" : "2012-08-26 04:00:02 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 34, 39 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239566322126700546", "text" : "Got some bugs identified already! #ld48", "id" : 239566322126700546, "created_at" : "2012-08-26 03:33:56 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 128, 133 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239565831837720576", "text" : "Okay! Going well. Can now create branches! Downloading PhotoShop Trial and borrowing my flatmates mac for sound effects! Yes! #ld48", "id" : 239565831837720576, "created_at" : "2012-08-26 03:31:59 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 115, 120 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239551409199144961", "text" : "I think I'm going to need to download and install the Photoshop trial. It would just make the game so much nicer #ld48", "id" : 239551409199144961, "created_at" : "2012-08-26 02:34:41 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 78, 83 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239523665660751874", "text" : "Gonna go get some breakfast, some sun and some thoughts. Then right back into #ld48", "id" : 239523665660751874, "created_at" : "2012-08-26 00:44:26 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 16, 21 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239522462264590337", "text" : "I'm awake again #ld48 Running out of time. Today will be muy productivo!", "id" : 239522462264590337, "created_at" : "2012-08-26 00:39:39 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 15, 20 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239369028769021952", "text" : "Going to sleep #ld48", "id" : 239369028769021952, "created_at" : "2012-08-25 14:29:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Jakob Hillerstr\u00F6m", "screen_name" : "zuric", "indices" : [ 0, 6 ], "id_str" : "18479424", "id" : 18479424 }, { "name" : "Jakob Hillerstr\u00F6m", "screen_name" : "zuric", "indices" : [ 37, 43 ], "id_str" : "18479424", "id" : 18479424 } ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/zuric\/status\/239357922268819457\/photo\/1", "indices" : [ 60, 80 ], "url" : "http:\/\/t.co\/dcyymBdc", "media_url" : "http:\/\/pbs.twimg.com\/media\/A1JewxuCMAAAcl3.jpg", "id_str" : "239357922277208064", "id" : 239357922277208064, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/A1JewxuCMAAAcl3.jpg", "sizes" : [ { "h" : 257, "resize" : "fit", "w" : 340 }, { "h" : 454, "resize" : "fit", "w" : 600 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 591, "resize" : "fit", "w" : 781 }, { "h" : 591, "resize" : "fit", "w" : 781 } ], "display_url" : "pic.twitter.com\/dcyymBdc" } ], "hashtags" : [ { "text" : "LD48", "indices" : [ 45, 50 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239360987948523520", "in_reply_to_user_id" : 18479424, "text" : "@zuric Nice work man. I like it! RT @zuric: #LD48 progress http:\/\/t.co\/dcyymBdc", "id" : 239360987948523520, "created_at" : "2012-08-25 13:58:01 +0000", "in_reply_to_screen_name" : "zuric", "in_reply_to_user_id_str" : "18479424", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "as3", "indices" : [ 42, 46 ] }, { "text" : "ld48", "indices" : [ 130, 135 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239360295087247361", "text" : "I've got a strange side affect to do with #as3 localToGlobal bs. I know how to fix it I think. Just gotta work through it all. #ld48", "id" : 239360295087247361, "created_at" : "2012-08-25 13:55:16 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 81, 86 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239350788336545792", "text" : "I'm gonna have a jam on guitar. Running out of energy, hopefully it wakes me up #ld48", "id" : 239350788336545792, "created_at" : "2012-08-25 13:17:29 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ { "expanded_url" : "http:\/\/twitter.com\/james_a_forbes\/status\/239311044437233664\/photo\/1", "indices" : [ 80, 100 ], "url" : "http:\/\/t.co\/Raie7x2v", "media_url" : "http:\/\/pbs.twimg.com\/media\/A1I0IILCUAAX8gr.png", "id_str" : "239311044441427968", "id" : 239311044441427968, "media_url_https" : "https:\/\/pbs.twimg.com\/media\/A1I0IILCUAAX8gr.png", "sizes" : [ { "h" : 602, "resize" : "fit", "w" : 800 }, { "h" : 255, "resize" : "fit", "w" : 340 }, { "h" : 150, "resize" : "crop", "w" : 150 }, { "h" : 451, "resize" : "fit", "w" : 600 }, { "h" : 602, "resize" : "fit", "w" : 800 } ], "display_url" : "pic.twitter.com\/Raie7x2v" } ], "hashtags" : [ { "text" : "ld48", "indices" : [ 74, 79 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239311044437233664", "text" : "The beginnings of a tree! Don't try and tell me you're not impressed haha #ld48 http:\/\/t.co\/Raie7x2v", "id" : 239311044437233664, "created_at" : "2012-08-25 10:39:34 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 83, 88 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239302131734179840", "text" : "I'm so glad I started using git gui the other day. It has been really helpful for #ld48 in terms of taking risks without losing code.", "id" : 239302131734179840, "created_at" : "2012-08-25 10:04:08 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 115, 120 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239292287199371264", "text" : "I want to post a screenshot of my game so far. But it is just two lines on the screen. But they are pretty cool! #ld48", "id" : 239292287199371264, "created_at" : "2012-08-25 09:25:01 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 116, 121 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239251310094999552", "text" : "Making slow but steady progress. You can click and drag to adjust the branch. And you can select and deselect it. #ld48", "id" : 239251310094999552, "created_at" : "2012-08-25 06:42:12 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 91, 96 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239235738359713792", "text" : "Looking through the posts on LudumDare, so exciting to see so much variety and creativity! #ld48", "id" : 239235738359713792, "created_at" : "2012-08-25 05:40:19 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 120, 125 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239217380998385664", "text" : "I've got an idea to do with trees. I don't have photoshop installed I'll have to generate all the graphics dynamically. #ld48 Scary", "id" : 239217380998385664, "created_at" : "2012-08-25 04:27:22 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 65, 70 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239211307260329985", "text" : "Feeling less confident about my initial idea. Chevy is the man. #ld48", "id" : 239211307260329985, "created_at" : "2012-08-25 04:03:14 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Chevy Ray", "screen_name" : "ChevyRay", "indices" : [ 0, 9 ], "id_str" : "55472734", "id" : 55472734 } ], "media" : [ ], "hashtags" : [ { "text" : "ld48", "indices" : [ 113, 118 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239194182244257793", "in_reply_to_user_id" : 55472734, "text" : "@ChevyRay says to turf your first idea. I can see the logic there. But if you like your idea, I say go for it. #ld48", "id" : 239194182244257793, "created_at" : "2012-08-25 02:55:11 +0000", "in_reply_to_screen_name" : "ChevyRay", "in_reply_to_user_id_str" : "55472734", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Phil Hassey", "screen_name" : "philhassey", "indices" : [ 3, 14 ], "id_str" : "19695915", "id" : 19695915 } ], "media" : [ ], "hashtags" : [ { "text" : "LD48", "indices" : [ 105, 110 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239151804057788417", "text" : "RT @philhassey: We estimate that LD#24 will have more games created than the NES+SNES catalogs combined. #LD48", "retweeted_status" : { "source" : "\u003Ca href=\"http:\/\/www.echofon.com\/\" rel=\"nofollow\"\u003EEchofon\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "LD48", "indices" : [ 89, 94 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "239085569307717632", "text" : "We estimate that LD#24 will have more games created than the NES+SNES catalogs combined. #LD48", "id" : 239085569307717632, "created_at" : "2012-08-24 19:43:36 +0000", "user" : { "name" : "Phil Hassey", "screen_name" : "philhassey", "protected" : false, "id_str" : "19695915", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/532962717645033472\/8OPrIcc0_normal.png", "id" : 19695915, "verified" : false } }, "id" : 239151804057788417, "created_at" : "2012-08-25 00:06:47 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "235902069213642752", "text" : "I am so enamoured with a Java Class I just wrote that duplicates as3 trace() functionality. So much nicer!", "id" : 235902069213642752, "created_at" : "2012-08-16 00:53:30 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ { "name" : "Ocean Leaves", "screen_name" : "oceanleavesband", "indices" : [ 67, 83 ], "id_str" : "206542186", "id" : 206542186 } ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "234859662644764673", "text" : "Having a jam tonight with my magical maple lovin' musician brother @oceanleavesband!", "id" : 234859662644764673, "created_at" : "2012-08-13 03:51:21 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "234604846878162945", "text" : "It works! But the playback is coming out super fast. Sounds like R2D2", "id" : 234604846878162945, "created_at" : "2012-08-12 10:58:48 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETwitter Web Client\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "as3", "indices" : [ 92, 96 ] }, { "text" : "java", "indices" : [ 120, 125 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "234574940190416896", "text" : "Gonna have a crack at programming a really simple sound recorder app. I'll try doing it in #as3 but might end up using #java.", "id" : 234574940190416896, "created_at" : "2012-08-12 08:59:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "recording", "indices" : [ 32, 42 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "234487361793306624", "text" : "Guitar overdubs are the go then\r#recording", "id" : 234487361793306624, "created_at" : "2012-08-12 03:11:58 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ { "text" : "recording", "indices" : [ 64, 74 ] } ], "urls" : [ ] }, "geo" : { }, "id_str" : "234484005955858432", "text" : "Trying to add harmonies to Green Light. Nothing seems to fit. #recording", "id" : 234484005955858432, "created_at" : "2012-08-12 02:58:38 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } }, { "source" : "\u003Ca href=\"http:\/\/www.twitter.com\" rel=\"nofollow\"\u003ETwitter for Windows Phone\u003C\/a\u003E", "entities" : { "user_mentions" : [ ], "media" : [ ], "hashtags" : [ ], "urls" : [ ] }, "geo" : { }, "id_str" : "234088531646115840", "text" : "Restringing my songwriting nylon. These strings are too good for this beat up old thing.", "id" : 234088531646115840, "created_at" : "2012-08-11 00:47:09 +0000", "user" : { "name" : "James Forbes", "screen_name" : "james_a_forbes", "protected" : false, "id_str" : "16025792", "profile_image_url_https" : "https:\/\/pbs.twimg.com\/profile_images\/571253075579396096\/_csqQudw_normal.jpeg", "id" : 16025792, "verified" : false } } ]
const User = require('../../models/user'); const save = (req, res) => { User.findByIdAndUpdate( req.body.userId, {$push: {savedPosts: req.body.postId}}, { new: true } ).exec((err, result)=>{ if(err){ return res.status(400).json({ error: err }) } else { res.json(result); } }); } const unsave = (req, res) => { User.findByIdAndUpdate( req.body.userId, {$pull: {savedPosts: req.body.postId}}, { new: true } ).exec((err, result)=>{ if(err){ return res.status(400).json({ error: err }) } else { res.json(result); } }); } module.exports = { save, unsave };
import React from 'react'; const Navigation = (props) => { return( <div className = "Navigation flex justify-end"> <p className = "f4 underline link dim pa3 pointer white" onClick={props.handleAuth} >Sign out</p> </div> ) } export default Navigation;
enchant(); window.onload = function() { var game = new Game(800, 360); game.fps = 20; //使用する音声のプレロード game.preload('sound/bgmRacing.mp3'); //使用する画像のプレロード game.preload('./img/sheetMaru.png'); game.preload('./img/sheetDanpy.png'); game.preload('./img/sheetRabin.png'); game.preload('./img/sheetSammy.png'); game.preload('./img/sheetSyldra.png'); game.preload('./img/sheetPiyoliita.png'); game.preload('./img/sheetMeruro.png'); var course = new Sprite(800, 100); var start = new Sprite(20, 100); var goal = new Sprite(20, 100); var maru = new Sprite(24, 24); var danpy = new Sprite(24, 24); var rabin = new Sprite(24, 24); var sammy = new Sprite(24, 24); var syldra = new Sprite(24, 24); var piyoliita = new Sprite(24, 24); var meruro = new Sprite(24, 24); var winnerName1 ="b"; var winnerName2 =""; var winnerName3 =""; game.onload = function() { maru.image = game.assets['./img/sheetMaru.png']; danpy.image = game.assets['./img/sheetDanpy.png']; rabin.image = game.assets['./img/sheetRabin.png']; sammy.image = game.assets['./img/sheetSammy.png']; syldra.image = game.assets['./img/sheetSyldra.png']; piyoliita.image = game.assets['./img/sheetPiyoliita.png']; meruro.image = game.assets['./img/sheetMeruro.png']; // 【シーン】タイトル開始■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ var hello = new Label("だぁ~び~セブン"); hello.x = 10; hello.y = 10; game.rootScene.backgroundColor = "#FFFFFF"; game.rootScene.addChild(hello); // 【シーン】タイトル終了■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // 【シーン】選択開始■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ var selecting = new Scene(); var MsgWhoWin = new Label("誰が1位になるかな?"); MsgWhoWin.x = 10; MsgWhoWin.y = 10; selecting.backgroundColor = "#eee8aa"; selecting.addChild(MsgWhoWin); // 【シーン】選択終了■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // 【シーン】レース開始■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ var racing = new Scene(); //BGMの再生 //スプライトシートの使用領域を指定 //画像/初期フレーム/描写位置を指定 //スタートライン start.x = 25; start.y = 25; start.backgroundColor = "rgba(102,255,153, 1)"; //ゴールライン goal.x = 750; goal.y = 25; goal.backgroundColor = "rgba(102,255,153, 1)"; //レースコース course.x = 25; course.y = 25; course.backgroundColor = "rgba(232, 174, 67, 1)"; //まる maru.frame = 4; maru.x = 25; maru.y = 30; //ダンピィ danpy.frame = 4; danpy.x = 25; danpy.y = 40; //ラビン rabin.frame = 4; rabin.x = 25; rabin.y = 50; //サミー sammy.frame = 4; sammy.x = 25; sammy.y = 60; //シルドラ syldra.frame = 4; syldra.x = 25; syldra.y = 70; //ピヨリータ piyoliita.frame = 4; piyoliita.x = 25; piyoliita.y = 80; //メルロ meruro.frame = 4; meruro.x = 25; meruro.y = 90; //コースの描写 racing.addChild(course); //スタートラインの描写 racing.addChild(start); //ゴールラインの描写 racing.addChild(goal); //各キャラクターの描写 racing.addChild(maru); racing.addChild(danpy); racing.addChild(rabin); racing.addChild(sammy); racing.addChild(syldra); racing.addChild(piyoliita); racing.addChild(meruro); //背景色の指定 racing.backgroundColor = '#7ecef4'; //その他変数 var i = 0; var maxSpeed = 4; var goalLine = 750; var order = new Array(); var order_i = 0; // シーンに「毎フレーム実行イベント」を追加します。 racing.addEventListener(Event.ENTER_FRAME, function() { if(i>250){ maxSpeed = 8; }; if(maru.frame!=0){ maru.x += Math.floor(Math.random () * maxSpeed); if(maru.frame==4){maru.frame=5}else{maru.frame=4}; }; if(maru.x >=goalLine&&maru.frame!=0){maru.frame=0;order[order_i]="イヌのマル";order_i++;}; if(danpy.frame!=0){ danpy.x += Math.floor(Math.random () * maxSpeed); if(danpy.frame==4){danpy.frame=5}else{danpy.frame=4}; }; if(danpy.x >=goalLine&&danpy.frame!=0){danpy.frame=0;order[order_i]="パンダのダンピィ";order_i++;}; if(rabin.frame!=0){ rabin.x += Math.floor(Math.random () * maxSpeed); if(rabin.frame==4){rabin.frame=5}else{rabin.frame=4}; }; if(rabin.x >=goalLine&&rabin.frame!=0){rabin.frame=0;order[order_i]="ウサギのラビン";order_i++;}; if(sammy.frame!=0){ sammy.x += Math.floor(Math.random () * maxSpeed); if(sammy.frame==4){sammy.frame=5}else{sammy.frame=4}; }; if(sammy.x >=goalLine&&sammy.frame!=0){sammy.frame=0;order[order_i]="ハムスターのサミィー";order_i++;}; if(syldra.frame!=0){ syldra.x += Math.floor(Math.random () * maxSpeed); if(syldra.frame==4){syldra.frame=5}else{syldra.frame=4}; }; if(syldra.x >=goalLine&&syldra.frame!=0){syldra.frame=0;order[order_i]="ドラゴンのシルドラ";order_i++;}; if(piyoliita.frame!=0){ piyoliita.x += Math.floor(Math.random () * maxSpeed); if(piyoliita.frame==4){piyoliita.frame=5}else{piyoliita.frame=4}; }; if(piyoliita.x >=goalLine&&piyoliita.frame!=0){piyoliita.frame=0;order[order_i]="ヒヨコのピヨリータ";order_i++;}; if(meruro.frame!=0){ meruro.x += Math.floor(Math.random () * maxSpeed); if(meruro.frame==4){meruro.frame=5}else{meruro.frame=4}; }; if(meruro.x >=goalLine&&meruro.frame!=0){meruro.frame=0;order[order_i]="ヒツジのメルロ";order_i++;}; if(order_i==6){ game.rootScene.winnerName1 = order[0]; game.rootScene.winnerName2 = order[1]; game.rootScene.winnerName3 = order[2]; } i++; }); // 【シーン】レース開始■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // 三つ目のシーン var result = new Scene(); result.backgroundColor = "#99FF99"; var labelResultMsg = new Label("結果発表!"); labelResultMsg.x = 10; labelResultMsg.y = 10; result.addChild(labelResultMsg); var labelWinnerName = new Label(winnerName1); labelResultMsg.x = 10; labelResultMsg.y = 30; result.addChild(labelWinnerName); // ルートシーンをタッチした時の処理 game.rootScene.addEventListener('touchstart', function() { game.pushScene(selecting); }); // ルートシーンをタッチした時の処理 selecting.addEventListener('touchstart', function() { game.replaceScene(racing); //var bgm = game.assets['sound/bgmRacing.mp3']; //bgm.play(); }); // 二つ目のシーンをタッチした時の処理 racing.addEventListener('touchstart', function() { game.replaceScene(result); //bgm.stop(); }); // 三つ目のシーンをタッチした時の処理 result.addEventListener('touchstart', function() { game.popScene(); }); }; game.start(); }
import React from 'react'; import { FormGroup, Input } from 'reactstrap'; class FilterByCity extends React.Component { render() { return ( <FormGroup> <Input type="select" name="filterCombo" id="filterCombo" onChange = {this.props.onchange}> <option>Filter By City</option> <option id = "Bangalore">City : Bangalore</option> <option id = "Mumbai">City : Mumbai</option> <option id = "Delhi">City : Delhi</option> </Input> </FormGroup> ) } } export default FilterByCity;
const test = require("ava"); const fs = require("fs"); const rimraf = require("rimraf"); const build = require(".."); const OUTPUT = "test/tmp/fragments/"; rimraf.sync(OUTPUT); test("render fragments", async (t) => { return new Promise((resolve, reject) => { build({ silent: true, output: OUTPUT, components: "test/fixtures/components3.json", onComplete: () => { t.true( fs.existsSync("test/tmp/fragments/component-1.html"), "component1 HTML exists" ); t.true( fs.existsSync("test/tmp/fragments/component-1.json"), "component1 JSON exists" ); t.true( fs.existsSync("test/tmp/fragments/component-2.html"), "component2 HTML exists" ); t.true( fs.existsSync("test/tmp/fragments/component-2.json"), "component2 JSON exists" ); t.true( fs.existsSync("test/tmp/fragments/component-3.html"), "component3 HTML exists" ); t.true( fs.existsSync("test/tmp/fragments/component-3.json"), "component3 JSON exists" ); resolve(); }, }); }); });
var $is_active = false; $(document).ready(function(){ $('#header .menu').click(function(){ var $top = $('#header .top-dash'); var $bottom = $('#header .bottom-dash'); if($is_active){ $($top).css({ 'position' : 'relative', 'transform' : 'rotateZ(0deg)' }); var $bottom_mt = $($bottom).css('margin-top'); $($bottom).css({ 'margin-top' : '8px', 'position' : 'relative', 'transform' : 'rotateZ(0deg)' }); $is_active = false; } else { $($top).css({ 'position' : 'relative', 'transform' : 'rotateZ(45deg)' }); var $bottom_mt = $($bottom).css('margin-top'); $($bottom).css({ 'margin-top' : '-1px', 'position' : 'relative', 'transform' : 'rotateZ(-45deg)' }); $is_active = true; } }); });
import React from 'react'; import { shallow } from 'enzyme'; import toJson from 'enzyme-to-json'; import CreateBabyPage from './CreateBabyPage'; import { HamburgerProvider } from '../../Contexts/HamburgerContext'; describe(`CreateBabyPage component`, () => { it(`renders page without crashing`, () => { const wrapper = shallow( <HamburgerProvider> <CreateBabyPage /> </HamburgerProvider> ) expect(toJson(wrapper)).toMatchSnapshot() }); })
/** @typedef {import('./lib/enum').STATE} STATE */ /** * @callback Resolver * @param {function} onFulfilled * @param {function} onRejected */ const {PENDING, FULFILLED, REJECTED} = require('./lib/enum'); const { isFn, isPromiseLike, isArray, isEmpty, isNil, isPending, isResolved, isRejected, isFulfilled, deferCall } = require('./lib/util'); /** * @class * @constructor * @param {Resolver} [fn] */ class P { constructor(fn) { /**@type {STATE} */ this._state = PENDING; /**@type {any} */ this._value = null; /**@type {Array<Object.<STATE,function>>}*/ this._subscribers = []; if (isFn(fn)) { try { fn(transition(this, FULFILLED), transition(this, REJECTED)); } catch (err) { const reason = err && err.message; transition(this, REJECTED)(reason); } } } /** * @param {function} onFulfilled * @param {function} onRejected * @return {P} */ then(onFulfilled, onRejected) { if (isPending(this)) { const subscriber = {}; subscriber[FULFILLED] = onFulfilled; subscriber[REJECTED] = onRejected; this._subscribers.push(subscriber); return this; } if (isFulfilled(this) && isFn(onFulfilled)) { return call(onFulfilled, this._value); } if (isFulfilled(this) && !isFn(onFulfilled)) { return new P(f => f(this._value)); } if (isRejected(this) && isFn(onRejected)) { return call(onRejected, this._value); } if (isRejected(this) && !isFn(onRejected)) { return new P((f, r) => r(this._value)); } } /** * @param {function} onRejected * @return {P} */ catch(onRejected) { return this.then(null, onRejected); } /** * @param {any} value * @return {P} */ static resolve(value) { return new P(f => f(value)); } /** * @param {any} reason * @return {P} */ static reject(reason) { return new P((_, r) => r(reason)); } /** * @param {Array<P>} promises * @return {P} */ static race(promises) { promises = [].concat(promises).filter(x => !isNil(x)); promises = promises.filter(x => !isNil(x)); if (isEmpty(promises)) { return new P(); } return new P((resolve, reject) => { for (let i = 0, len = promises.length; i < len; i++) { let val = promises[i]; if (!isPromiseLike(val)) { resolve(val); return; } val.then(resolve, reject); } }); } /** * @param {Array<P>} promises * @return {P} */ static all(promises) { if (isArray(promises) && isEmpty(promises)) { return new P(f => f()); } return new P((resolve, reject) => { const values = []; const count = promises.length; promises.forEach((p, index) => { if (isPromiseLike(p)) { p.then(val => { values[index] = val; tryResolve(values, count, resolve); }, reject); return; } values[index] = p; tryResolve(values, count, resolve); }); }); } }; /** * @param {Array<any>} values, * @param {number} count * @param {function} resolver */ function tryResolve(values, count, resolver) { if(values.length === count) { resolver(values) } } /** * @param {function} fn * @param {any} value */ function call(fn, value) { let resolve; let reject; let promise = new P(function(f, r) { resolve = f; reject = r; }); let wrapped = () => { let result; try { result = fn.call(null, value); } catch (err) { let reason = err && err.message ? err.message : err; reject.call(promise, reason); } if(result instanceof P) { } else { resolve.call(promise, result); } }; deferCall(wrapped); return promise; } /** * @param {P} p * @param {STATE} state */ function transition(p, state){ return function(val) { if(isResolved(p)) { return; } if(val === p) { transition(p, REJECTED)(new TypeError('Chaining cycle detected for promise')) return; } if (isPromiseLike(val)) { try { val.then( x => transition(p, FULFILLED)(x), x => transition(p, REJECTED)(x) ); } catch (err) { let reason = err && err.message ? err.message : err; transition(p, REJECTED)(reason); } return; } p._value = val; p._state = state; notifySubscribers(p); } } /** * @param {P} p promise */ function notifySubscribers(p) { p._subscribers.forEach(subscriber => { const key = p._state.val; const callback = subscriber[key]; if(isFn(callback)) { call(callback, p._value); } }); p._subscribers.length = 0; } module.exports = P;
import React from 'react'; class TitleBar extends React.Component { render() { return ( <div> <h2>UK Top 20 Songs</h2> <select onChange={this.props.handleSelectChange}> <option value={this.props.allSongsUrl} >All Songs</option> <option value='https://itunes.apple.com/gb/rss/topsongs/limit=20/genre=21/json' >Rock</option> <option value='https://itunes.apple.com/gb/rss/topsongs/limit=20/genre=17/json' >Dance</option> <option value='https://itunes.apple.com/gb/rss/topsongs/limit=20/genre=6/json' >Country</option> </select> </div> ); }; }; export default TitleBar;
var express = require('express'); //加载模板 var swig = require('swig'); //加载数据库模块 var mongoose = require('mongoose'); //加载body-parser,用来处理post提交过来的数据 var bodyParser = require('body-parser'); //加载cookie模块 var cookies = require('cookies'); var app = express(); var User = require('./models/User'); //静态文件托管 //当用户访问过以public开始 那么直接返回对应的————dirname+'/public' app.use('/public',express.static(__dirname+'/public')); //配置模板应用 //定义当前应用所用的模板引擎 app.engine('html',swig.renderFile); //设置模板文件存放的目录 app.set('views','./views'); //注册使用模板 app.set('view engine','html'); //开发取消缓存 swig.setDefaults({cache: false}); //bodyparser 设置 app.use( bodyParser.urlencoded({extended: true})); //cookies设置 保存到对象 request对象中 app.use( function(req, res, next){ req.cookies = new cookies( req , res); // console.log(req.cookies.get('userInfo')); // 解析登录信息 req.userInfo = {}; if( req.cookies.get('userInfo') ){ try { req.userInfo = JSON.parse( req.cookies.get('userInfo')) //获取当前用户类型 User.findById(req.userInfo._id).then(function(userInfo){ req.userInfo.isAdmin = Boolean(userInfo.isAdmin); next(); }) } catch (e) { console.log(e) next(); } }else { next(); } } ) //根据不同的功能划分模块 app.use('/admin',require('./routers/admin')); app.use('/api',require('./routers/api')); app.use('/',require('./routers/main')); //监听http请求 //开启数据库 mongoose.connect('mongodb://localhost:27017/blog',function(err){ if(err){ console.log('数据库连接失败') }else { console.log('数据库连接成功') app.listen(8081,function(){ console.log('loacalhost 8081') }); } });
'use strict'; const path = require('path') module.exports = appInfo => { const config = {}; // should change to your own config.keys = appInfo.name + '_1494437964854_8291'; config.security = { csrf: { enable: false, }, ctoken: { enable: false } } // 获取 SSID.token config.middleware = ['authorization'] config.authorization = { cookieName: 'SSID', secret: 'Kevin-wh0-is-a-sb-guy-and-fOuber-is-a-very-awes0me-man', duration: 24 * 60 * 60 * 1000 * 3 // 3 day } // should change to your own config.keys = appInfo.name + '_1494437964854_8291'; config.static = { prefix: '/assets/', dir: path.join(appInfo.baseDir, 'app/public/assets') } // add your config here return config; }; exports.io = () => { return { init: {}, // passed to engine.io namespace: { '/': { connectionMiddleware: [], packetMiddleware: [], }, }, redis: { host: '127.0.0.1', port: 6379 } }; }
'use strict'; const express = require('express'); const { validarJWT } = require('../../middlewares/validar-jwt') // user const eventControlllerValidate = require('../controllers/auth/validate_users/validate.controllers'); const login = require('../controllers/auth/login/login.controller'); const create = require('../controllers/auth/register/register.controller'); const deleteUser = require('../controllers/auth/delete/delete_user.controllers'); const token = require('../controllers/auth/token_validate/token_validate.controller'); //Sucursal const sucursal = require('../controllers/branch_office/branch-office.controller'); //Tipo Documento const typeDocument = require('../controllers/auth/type_document/type-document.controllers'); // PersonMAST const personm = require('../controllers/person_m/person.controllers'); //Especialidades const specialty= require('../controllers/specialty/specialty.controller'); const medico= require('../controllers/doctor/doctor.controller'); const correlativo= require('../controllers/auth/correlativo_idpersona/correlativo.controllers'); const terminos= require('../controllers/privacy_policies/privacy-policies.controller'); //history const citas= require('../controllers/quotes/quotes.controllers'); // mail password const mailpass= require('../controllers/mail/mail.controllers'); // Message const message= require('../controllers/message/message.controllers'); //logo niubiz const logsNiubiz= require('../controllers/niubiz/niubiz.controllers'); //cuotas afiliado const dues= require('../controllers/dues/dues.controlles'); //DATES FOR DOCTOS const dates= require('../controllers/dates/dates.controllers'); //PREIO CITA const precio= require('../controllers/precio_cita/precioCita.controllers'); //cobranza const cobrnaza= require('../controllers/cobranza/cobranza.controllers'); //sitedss const siteds= require('../controllers/siteds/login/sited-login.comtrollers'); //PORTAL WEB const cie10= require('../portal_controllers/cie10/cie10.Controllers'); const horario= require('../portal_controllers/horario_medico/horario.controllers'); const slider= require('../portal_controllers/slider/slider.controllers'); const mail= require('../portal_controllers/form_contacto/contacto.controllers'); const birthay= require('../portal_controllers/birthay/birthay.comtrollers'); const { createReclamo} = require("../portal_controllers/portal_reclamo/portal.controllers"); const router = express.Router(); // user router.post('/login', login.login); router.get('/validate/:document', eventControlllerValidate.getEventValidateUser); router.get('/validateuser/:document', eventControlllerValidate.getEventValidateUserCitas); //correlativo get id persona router.get('/correlativo', correlativo.getEventCorrelativo); //correlativo update personarouter.put('/correlativo', correlativo.updateCorrelativo); //create user router.post('/create', create.createUser); //create user persona router.post('/create/persona', create.createPersona); //delete user router.delete('/user/:usuario', deleteUser.deleteUser); // generar token router.post('/generateToken', token.generateToken); //decodifcar token router.get('/decode/:tokenvalidate', token.decifrarToken); // validar usuario router.get('/validatechangepassword/:persona', token.getValidateChangePassword); // resulta password router.get('/passwordresult/:usuario', token.getValidatePasswordResultMail); // update password router.post('/uppassword',token.updatePassword); // update state password change router.post('/updatestate',token.updateChangePasswordSate); // PersonMAST router.get('/person/:document', personm.getPersonM); // update PersonMAST router.put('/person',validarJWT, personm.updatePersona); //Sucursal router.get('/sucursal',validarJWT, sucursal.getSucursal); //Tipo documento router.get('/typedocument', typeDocument.getTypeDocument); //especialidades router.get('/specialty/:sucursal',validarJWT,specialty.getSpecialty); //Lista medicos router.get('/doctors',validarJWT,medico.getListMedico); //Medico por especialidad router.get('/doctorspecialty/:sucursal/:codigo',validarJWT,medico.getMedicoEspecialidad); // horarios medicos router.post('/doctorshorario',validarJWT,medico.getHorarioMedicoEspecialidad); router.get('/listdoctorfechahora/:idespecialidad/:fecha/:sucursal',validarJWT,medico.getHorarioMedicoFechaHora); // lista de citas router.get('/historyQuotes/:idPaciente',validarJWT,citas.getHistorialCitas); // lista de reserva de citas router.get('/bookings/:fecha/:idPaciente',validarJWT,citas.getCitasReservadas); //registro de cita router.post('/appointment',validarJWT,citas.registerAppointment); //anular cita router.post('/canceldate',validarJWT,citas.calcelDate); //terminos y condiciones router.get('/termsconditions',terminos.getTerminosCondiciones); // mail router.post('/mailcitas',mailpass.sendMailCitas); router.post('/mailnewacount',mailpass.sendNewAcountUserPassword); router.post('/maillinkvalidate',mailpass.sendValidateMailLinkPassword); router.post('/mailupdatepassword',mailpass.sendMailPasswordChangeNew); // Message router.get('/message',message.getMessage); // slider message router.get('/infomessage',message.getSliderMessage); // Message router.post('/logsniubiz',validarJWT,logsNiubiz.registerLogNiubiz); //cuotas de afiliados // pagados router.get('/coutospaid/:documento',validarJWT,dues.getCoutosPaid); // pendientes router.get('/coutospending/:documento',validarJWT,dues.getCoutosPending); //DATES DOCTOS //ALL DATES router.get('/datesall/:idEspecialidad/:sede',validarJWT,dates.getAllDateDoctors); //ONE DATE router.get('/dateone/:idMedico/:idEspecialidad/:sede',validarJWT,dates.getOneDateDoctors); //Precio cita router.get('/price/:sede/:tipoPaciente/:idTipoPrograma',validarJWT,precio.getPrecioCita); //COBRANZA CITAS router.post('/cobranza',validarJWT,cobrnaza.cobranza); //siteds router.post('/loginsited',siteds.loginSiteds); //PORTAL WEB router.get('/cie10',cie10.getCIE10); router.get('/horario',horario.getHorarioM); router.post('/horario',horario.getHorarioList); router.post('/horario/dhorario',horario.getHorarioListM); router.get('/slider/emergenciaLima',slider.getEmergenciaLima); router.get('/slider/quirurgicoLima',slider.getQuirurgicoLima); router.get('/slider/ambulatorioLima',slider.getAmbulatorioLima); router.get('/slider/emergenciaChorrillos',slider.getEmergenciaChorrillos); router.get('/slider/quirurgicoChorrillos',slider.getQuirurgicoChorrillos); router.get('/slider/ambulatorioChorrillos',slider.getAmbulatorioChorrillos); router.get('/slider/emergenciaSurco',slider.getEmergenciaSurco); router.get('/slider/quirurgicoSurco',slider.getQuirurgicoSurco); router.get('/slider/ambulatorioSurco',slider.getAmbulatorioSurco); router.post('/mailcontacto',mail.sendMailContacto); router.post('/mailcontacto/portalweb',mail.sendMailPortalWeb); router.post('/mail/validtoken',mail.validateToken); router.post('/birthday',birthay.getBirthay); router.post('/portal',createReclamo); module.exports = { routes: router }
var browserify = require('browserify'); gulp = require('gulp'); gulp.task('browserify', function() { var b = browserify(); b.add('./public/js/app.js'); return b.bundle() .on('success', gutil.log.bind(gutil, 'Browserify Rebundled')) .on('error', gutil.log.bind(gutil, 'Browserify Error: in browserify gulp task')) .pipe(source('index.js')) .pipe(gulp.dest('./public/js')); }); // var gulp = require('gulp'); // var browserify = require('gulp-browserify'); // // // // var scripts = [ // 'public/js/app.js', // 'public/js/**/*.js', // '' // ]; // // Basic usage // gulp.task('scripts', function() { // // Single entry point to browserify // gulp.src('public/js/app.js') // .pipe(browserify({ // insertGlobals : true, // debug : !gulp.env.production // })) // .pipe(gulp.dest('./build/js')); // });
import React, {useState, useEffect} from 'react'; import {StyleSheet, FlatList, View, Text} from 'react-native'; import {getApi} from '../helpers/getApi'; import Movie from '../components/Movie'; const Movies = () => { const [movieData, setMovieData] = useState([]); let isMounted = false; useEffect(() => { getApi(movieData, setMovieData, isMounted); }, []); console.log(movieData); console.log('****'); return ( <> <Text style={{ fontSize: 20, alignSelf: 'center', margin: 10, color: 'black', }}> Movie Production Companies </Text> <FlatList style={{textAlign: 'center'}} keyExtractor={item => item.id.toString()} data={movieData} renderItem={({item}) => ( <Movie name={item.name} counttry={item.origin_country} logo={item.logo_path} /> )} /> </> ); }; export default Movies;
/*eslint-env node*/ /*eslint-disable*/ var path = require( "path" ); var os = require( "os" ); var fs = require( "fs" ); var cpy = require( "cpy" ); var watch = require( "watch" ); var yargs = require( "yargs" ); var pkg = require( "./package.json" ); var WebPackOnBuild = require( "on-build-webpack" ); var name = pkg.name; var qname = name; var qnamejs = qname + ".js"; var srcDir = path.resolve( __dirname, "src" ); var entry = path.resolve( srcDir, qnamejs ); var output = path.resolve( __dirname, "dist" ); var qdirpath = [os.homedir(), "Qlik", "Sense", "Extensions", qname]; if( os.platform() === "win32" ) { qdirpath.splice( 1, 0, "Documents" ); } var qdir = path.resolve.apply( path, qdirpath ); var isWatching = yargs.argv.watch; if (!fs.existsSync(output)) { fs.mkdirSync(output); } fs.writeFileSync(path.resolve(output, `${qname}.qext`), JSON.stringify({ name: "Mekaarogram", description: pkg.description, author: pkg.author, type: 'visualization', version: pkg.version, preview: "assets/mekaarogram.png", homepage: pkg.homepage }, null, 2)); function onBuild() { cpy( [ qname + ".qext", "*.wbl", "external/*.*", "assets/*.png", "css/*.ttf" ], output, { cwd: srcDir, parents: true } ).then( function() { cpy( ["./**/*.*"], qdir, { cwd: output, parents: true } ); } ); } // if( false ) { // console.log( "is watching" ); // watch.watchTree( "./node_modules/@qlik/picasso/dist/", function( fn ) { // console.log( "detected" ); // onBuild(); // } ); // } var config = { entry: entry, output: { path: output, filename: qnamejs, libraryTarget: "amd" }, module: { loaders: [{ test: /\.js$/, loader: "babel-loader", query: { presets: ["es2015"] } }, { test: /\.scss$/, loader: "css-loader?-url!sass-loader" }, { test: /\.html$/, loader: "svg-inline" }] }, externals: [{ // "default-view": "objects.extension/default-view", // "pivot-api": "objects.backend-api/pivot-api", // "selection-toolbar": "objects.extension/default-selection-toolbar", // "tooltip-service": "objects.views/charts/tooltip/chart-tooltip-service", // "object-conversion": "objects.extension/object-conversion", "translator": "translator", "components": "client.property-panel/components/components", "require": "require", "qvangular": "qvangular", "jquery": "jquery", "color": "general.utils/color", "state": "client.utils/state", "touche": "touche", "d3": "./external/d3" }], plugins: [ new WebPackOnBuild( onBuild ) ] }; module.exports = config;
import React from 'react'; import PropTypes from 'prop-types'; import { CheckBox } from '@sparkpost/matchbox-icons'; import { deprecate } from '../../helpers/propTypes'; import { Box } from '../Box'; import { HelpText } from '../HelpText'; import { StyledLink } from './styles'; const Action = React.forwardRef(function Action(props, userRef) { const { content, children, disabled, helpText, is = 'link', selected, ...action } = props; const linkContent = React.useMemo(() => { return ( <Box as="span" alignItems="flex-start" display="flex"> <Box as="span" flex="1" fontSize="300" lineHeight="300"> {content || children} </Box> {selected && ( <Box as="span" color="blue.700"> <CheckBox size={20} /> </Box> )} {helpText && <HelpText>{helpText}</HelpText>} </Box> ); }, [content, selected, helpText]); const isAttributes = is === 'checkbox' ? { role: 'checkbox', 'aria-checked': !!selected, tabIndex: '0' } : {}; return ( <StyledLink as={is === 'button' ? 'button' : null} type={is === 'button' ? 'button' : null} disabled={disabled} isType={is} ref={userRef} {...isAttributes} {...action} > {linkContent} </StyledLink> ); }); Action.displayName = 'ActionList.Action'; Action.propTypes = { content: PropTypes.node, children: PropTypes.node, disabled: PropTypes.bool, /** * Same as hover styles. * Can be used for wrappers that manage focus within the menu, eg downshift */ highlighted: PropTypes.bool, is: PropTypes.oneOf(['link', 'button', 'checkbox']), selected: deprecate(PropTypes.bool, 'Use the checkbox component instead'), helpText: PropTypes.string, }; export default Action;
const path = require("path"); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ProgressBarPlugin = require('progress-bar-webpack-plugin'); const webpack = require('webpack'); const config = { context: path.resolve(__dirname,'src'), entry: { app:'./js/index.js', // vendor: './src/assets/js/vendors.js' }, output: { filename: 'bundle.js', path: path.resolve(__dirname,'dist') }, devServer: { contentBase: path.resolve(__dirname,"./dist"), compress: true, port: 12000, stats: 'errors-only', open: true }, stats: { // copied from `'minimal'` all: true, modules: true, maxModules: 0, errors: true, warnings: true, // our additional options moduleTrace: true, errorDetails: true }, devtool: 'inline-source-map', module:{ rules: [ {test: /\.js$/, include: /src/, exclude: /node_modules/, use: { loader: "babel-loader", }}, { test: /\.js$/, exclude: /node_modules/, use: ['eslint-loader'] }, {test: /\.html$/,use: ['html-loader']}, { test: /\.css$/, use: [MiniCssExtractPlugin.loader,'css-loader'], //options: { // you can specify a publicPath here // by default it uses publicPath in webpackOptions.output //publicPath: '../', // hmr: process.env.NODE_ENV === 'development', //}, } ] }, plugins:[ new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional filename: '[name].css', chunkFilename: '[id].css', }), new HtmlWebpackPlugin({hash: true, title: 'React - Webauthn Demo', myPageHeader: 'Webauthn Demo', template: './html/index.htmlt', chunks: ['vendor', 'shared', 'app'], path: path.join(__dirname, "../../dist/"), filename: 'index.html' }), new ProgressBarPlugin(), new webpack.DefinePlugin({ 'WEBAUTHN_SERVER_URL':JSON.stringify("http://localhost"), 'WEBAUTHN_SERVER_PORT':JSON.stringify("8080"), 'DEFAULT_USER_EMAIL':JSON.stringify('johndoe@blabla.org') }) ] };//webpack.js.org/configuration/dev-server/#devserver-stats- module.exports = config;
/* * @Description: 包车租车 * @Author: 彭善智 * @LastEditors: 彭善智 * @Date: 2019-04-24 18:26:49 * @LastEditTime: 2019-05-30 15:24:22 */ import { isEmpty } from 'utils/common' const state = { startCity: "", //城市ID startCityName:"", //城市名称 startAddress:"", //详细地点 startDate:"", //开始时间 endDate:"", //结束时间 adultNum:0, //成人数量 childNum:0, //儿童数量 bagNum:0, //行李数量 addCarList: "", //选择的车辆信息 travelInfor: "", //行程信息 guideType: "", //导游类型 guideInfo: "", //导游信息 orderid: "", //订单ID } const getters = { //订单价格 orderPrice: function (state, getters, rootState) { let price = 0; for (const orderCar of Object.values(state.travelInfor)) { //酒店 for (const hotelInfo of Object.values(orderCar.hotelInforDetails)) { price += parseFloat(hotelInfo.price) * parseInt(hotelInfo.num); } } // 车辆 for (const car of Object.values(state.addCarList)) { price += parseFloat(car.carPrice); } //导游 if (state.guideInfo) { price += parseFloat(state.guideInfo.price) * getters.dayNum || 0; } //保险 price += ((rootState.order.insurance? rootState.order.insurance.price * (state.childNum + state.adultNum) : 0)); return price; }, //选择的行程天数 dayNum(state){ let dayNum = '' if(!isEmpty (state.endDate) && !isEmpty (state.startDate)){ dayNum = parseInt((new Date(state.endDate).getTime() - new Date(state.startDate)) / (24 * 60 * 60 * 1000)) + 1 } return dayNum; }, } const mutations = { //改变state的值 stateChange(state, opt){ console.log({...state}) Object.keys({...state}).forEach(k1 => { Object.keys({...opt}).forEach(k2 => { if(k1 == k2){ state[k1] = opt[k2] } }); }); console.log({...state}) console.log({...opt}); } } const actions = { } export default { namespaced: true, state, getters, mutations, actions }
services .service('ConsultaSrv', ['$translate', 'AccountManager', 'Consulta', 'Persona', 'Especialidad', 'ConsultaAgenda', 'ConsultaEspera', 'ConsultaCancelar', function ($translate, AccountManager, Consulta, Persona, Especialidad, ConsultaAgenda, ConsultaEspera, ConsultaCancelar) { var p = AccountManager.lsGetPaciente(); function consultasHistorial() { var paciente = AccountManager.lsGetPaciente(); return Persona.history({ personaId: paciente.id }).$promise; } function consultasAgendadas() { return Persona.consultasagendadas({id: p.id}).$promise; } function consultasUnconfirmed() { return Persona.consultasunconfirmed({id: p.id}).$promise; } function consultasEspera() { return Persona.consultasespera({id: p.id}).$promise; } function consultasCanceladas() { return ConsultaCancelar.find({ filter: { where: { pacienteId: p.id }, include: { relation: 'consulta', scope: { include: ['especialidad', 'local', 'medico'] } } } }) .$promise .then(function (consultas) { return _.map(consultas, function (c) { return c.consulta }); }); } function consultasEspecialidad(esp) { var params = {patient: p.id, lang: $translate.use()}; var filter = {where: {especialidadId: esp}}; return Consulta.search(params, filter).$promise .then(function (res) { console.log(res); return res.appointments; }); } function consultaId(id) { return Consulta.findOne({ filter: { where: { id: id }, include: ['especialidad', 'medico', 'local', 'pacientes', 'espera'] } }).$promise; } function consultaAgendaId(id) { return ConsultaAgenda.findOne({ filter: { where: { consultaId: id, pacienteId: p.id }, include: { relation: 'consulta', scope: { include: ['especialidad', 'medico', 'local'] } } } }).$promise .then(function (ca) { var c = ca.consulta; c.turno = ca.turno; return c; }); } function consultaAgendaById(id) { return ConsultaAgenda.findOne({ filter: { where: { id: id }, include: { relation: 'consulta', scope: { include: ['especialidad', 'medico', 'local'] } } } }).$promise .then(function (ca) { var c = ca.consulta; c.turno = ca.turno; return c; }); } function consultaTurnos(id) { return Consulta.turnoslibres({id: id}).$promise; } function agendarConsulta(data) { return Persona.consultas.create({id: p.id}, data).$promise; } function esperaConsulta(consultaId) { var data = { pacienteId: p.id, consultaId: consultaId }; return Persona.espera.create({id: p.id}, data).$promise; } function cancelarConsulta(consulta) { return Persona.canceladas.create({id: p.id}, {consultaId: consulta}).$promise; } function esperaCancelar(esperaId) { return Persona.espera.destroyById({id: p.id, fk: esperaId}).$promise; } function confirmar(id) { return ConsultaAgenda.update({where: {id: id}}, {confirmada: true}).$promise; } function findSpecialties(){ return Especialidad.find().$promise; } return { consultasAgendadas: consultasAgendadas, consultasUnconfirmed: consultasUnconfirmed, consultasCanceladas: consultasCanceladas, consultasEspera: consultasEspera, consultasEspecialidad: consultasEspecialidad, consultaId: consultaId, turnosLibres: consultaTurnos, agendarConsulta: agendarConsulta, esperaConsulta: esperaConsulta, cancelarConsulta: cancelarConsulta, consultaAgendaId: consultaAgendaId, consultasHistorial: consultasHistorial, esperaCancelar: esperaCancelar, confirmar: confirmar, findSpecialties: findSpecialties, consultaAgendaById: consultaAgendaById } }]);
class DOMNodeCollection { constructor(arr) { this.arr = arr; } html(text) { if (text === undefined) return this.arr[0].innerHTML; this.arr.forEach(el => el.innerHTML = text); } empty() { this.html(''); } append(arg) { this.arr.forEach(el => { if (typeof arg === 'string') { // String el.innerHTML += arg; } else if (arg instanceof HTMLElement) { // HTMLElement el.innerHTML += arg.outerHTML; } else { // Collection for (let i = 0; i < arg.length; i++) { // set outerHTML of arg[i] to innerHTML of el el.innerHTML += arg[i].outerHTML; } } }); } attr() { let args = arguments; if(args.length === 1){ let el = this.arr[0]; return el.attributes[args[0]].value; }else{ this.arr.forEach(el => el.attributes[args[0]].value = args[1]); } } addClass() {} removeClass() {} } // this.arr.append('<p>test</p>'); module.exports = DOMNodeCollection;
"use strict"; const investorLink = document.querySelector(".js-investor"); const entrepreneurLink = document.querySelector(".js-entrepreneur"); const entrepreneurList = document.querySelector(".js-entrepreneurServiceList"); const investorList = document.querySelector(".js-investorServiceList"); const showInvestor = (e) => { e.preventDefault(); investorList.style.transform = "translateX(0)"; entrepreneurList.style.transform = "translateX(100%)"; if (window.innerWidth >= 769 && window.innerWidth <= 1439) { investorList.style.transform = "translateX(0)"; entrepreneurList.style.transform = "translate3d(130%, -137%, 0)"; } }; const shownEtrepreneur = (e) => { e.preventDefault(); investorList.style.transform = "translateX(-200%)"; entrepreneurList.style.transform = "translateX(-100%)"; if (window.innerWidth >= 769 && window.innerWidth <= 1439) { investorList.style.transform = "translateX(-200%)"; entrepreneurList.style.transform = "translate3d(0, -137%, 0)"; } }; investorLink.addEventListener("click", showInvestor); entrepreneurLink.addEventListener("click", shownEtrepreneur);
'use strict'; const globby = require('globby'); const fs = require('fs'); const readFileAsync = filePath => new Promise((resolve, reject) => { fs.readFile(filePath, { encoding: 'UTF-8' }, (err, buffer) => { if (err) { reject(err); } resolve(buffer); }); }); module.exports = class FileSpellChecker { constructor(spellChecker) { this.spellChecker = spellChecker; } getFilePath(filePath) { if (fs.lstatSync(filePath).isDirectory()) { return `${filePath}/**/*.js`; } else if (filePath.endsWith('.js')) { return filePath; } else { throw new Error(`Could not find path ${filePath}`); } } async checkFile(filePath) { const text = await readFileAsync(filePath); this.spellChecker.checkText(text); } async checkFiles(path) { const globbyPath = this.getFilePath(path); const files = await globby([globbyPath, `!${path}/node_modules/**/*.js`]); const promiseArray = files.map(file => this.checkFile(file)); await Promise.all(promiseArray); } };
/** * 邮箱 * @param {*} s */ export function isEmail (s) { return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s) } /** * 手机号码 * @param {*} s */ export function isMobile (s) { return /^1[0-9]{10}$/.test(s) } /** * 精确手机号码 * @param {*} s */ export function isNicetyMobile(s) { return /^(1(([38]\d)|(4[57])|(5[0-35-9])|66|(7[0135-8])|(9[89]))\d{8})$/.test(s) } /** * 电话号码 * @param {*} s */ export function isPhone (s) { return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s) } /** * 精确电话号码 * @param {*} s */ export function isNicetyPhone(s) { return /^((0\d{2,3}[ -]?)?[2-9]\d{6,7})$/.test(s) } /** * URL地址 * @param {*} s */ export function isURL (s) { return /^http[s]?:\/\/.*/.test(s) } /** * 网址校验 * @param {*} s */ export function isFURL(s){ return /^(https?:\/\/)?.+\..+/.test(s) } /** * 整数 * @param {*} s */ export function isInteger (s) { return /^\d+$/.test(s) } /** * 数字,含小数 * @param {*} s */ export function isNumber (s) { return /^\d+(\.\d+)?$/.test(s) } /** * 数字,含小数(含负数) * @param {*} s */ export function isFNumber (s) { return /^[+-]?\d+(\.\d+)?$/.test(s) } /** * 身份证验证 * @param {*} s */ export function isCardId (s){ // return /^[1-9][0-7]\d{4}((19\d{2}(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(19\d{2}(0[13578]|1[02])31)|(19\d{2}02(0[1-9]|1\d|2[0-8]))|(19([13579][26]|[2468][048]|0[48])0229))\d{3}(\d|X|x)?$/.test(s) return /^[1-9][0-7]\d{4}(((19|20|21)\d{2}(((0[13578]|1[02])(0[1-9]|([12]\d)|3[0-1]))|(02([01]\d|2[0-8]))|((0[469]|11)([0-2]\d|30))))|(((19(09|17|28|47))|(20(04|23|42|99))|(21(37|86)))0229))\d{3}(\d|X|x)$/.test(s) } /** * 统一社会信用代码简单校验 * @param {*} s */ export function isCrtcode (s){ return /^[1-9ANY][1-59]\d{6}[0-9A-Z]{10}$/.test(s) } /** * 银行卡号简单校验(16位、17位、19) * @param {*} s */ export function isBackId (s){ return /^\d{16}(\d(\d{2})?)?$/.test(s) } /** * 邮编 * @param {*} s */ export function isPostcode (s){ return /^\d{6}$/.test(s) } /** * 比例:[0-100](含小数) * @param {*} this_ */ export function isScale(s) { return /^(\d?\d(\.\d*)?|100)$/.test(s) } /** * 验证tabs下的各个form */ /* export function validatorForm(this_ , tabs , cb) { let valids = [] let names = [] for (let i in tabs) { const vali = this_.$refs[tabs[i].componentName][0].sumbitValidate() console.log('valid ' , tabs[i].tabName , this_.$refs[tabs[i].componentName][0].validateState , vali) if(vali && typeof vali == 'object') { valids.push(vali); names.push(tabs[i].tabName) } else if(vali == false){ valids.push(new Promise((resolve, reject)=>{ if(vali) { resolve(vali) ; } else { reject(vali) ; } }) ) names.push(tabs[i].tabName) // break; } // console.log('valid ' , tabs[i].tabName , this_.$refs[tabs[i].componentName][0].validateState , vali) // 获取校验结果 /!* if (!this.$refs[this.tabs[i].componentName][0].validateState) { return }*!/ } console.log('valids' , valids , valids.length) if(!valids || valids.length == 0) { console.log('执行操作') cb() return ; } console.log('valids' , valids) for(var i in valids) { console.log(i , valids[i] , names[i]) } let valid_primase = async (v , index)=>{ let p = new Promise(function(resolve, reject){ v.then((d )=>{ console.log('valiate data : ' + index , d) if(d == null || d == false) { this_.$notify({ title: '提示', offset: 100, message: '请确保[' + names[index] + ']页面内容填写完整', position: 'bottom-right' }); reject(false) } else { resolve(true) } }).catch((e )=>{ // console.log('error' ,index,names[index], e) setTimeout(function(){ this_.$notify({ title: '提示', offset: 100, type:'error', message: '请确保[' + names[index] + ']页面内容填写完整', position: 'bottom-right' }); } , index * 50) reject(false) }) }) return p ; } let fun = ()=>{ let f ; for(var i in valids) { const index = i ; if(i == 0) { f = valid_primase(valids[index] , index); } else { const f_ = valid_primase(valids[index] , index); f = f.then( function(dat){ return f_ }) } } f.then(function(data){ console.log('data@@@' , data) if(data && data == true) { console.log('执行操作') cb() } else { } }) return f; } fun(); return ; /!*for(var i in valids) { console.log(i + ' : ' , valids[i]) const index = i ; valids[i].then((d )=>{ console.log('valiate data : ' + i , d) if(!d) { this_.$notify({ title: '提示', offset: 100, message: '请确保[' + names[index] + ']页面内容填写完整', position: 'bottom-right' }); } }).catch((e )=>{ console.log('error' ,index, e) setTimeout(function(){ this_.$notify({ title: '提示', offset: 100, type:'error', message: '请确保[' + names[index] + ']页面内容填写完整', position: 'bottom-right' }); } , index * 10) }) } *!/ /!* Promise.all(valids).then(data=>{ console.log('valiate data : ' , data) let result = true ; for(let i in data) { result &= data[i]; console.log( i , tabs[i].tabName , data[i]) if(!result) { this_.$alert("请确保11[" + tabs[i].tabName + "]页面内容填写完整", "提示", { confirmButtonText: "确定" }); return ; } } if(result) { console.log('执行操作') callback() } else { console.log('验证没通过 不执行操作') } }) .catch(e=>{ console.log('error' , e) }) *!/ } export function validatorFormA(this_ , tabs , cb) { let valids = [] let names = [] for (let i in tabs) { const vali = this_.$refs[tabs[i].componentName].sumbitValidate() if(vali && typeof vali == 'object') { valids.push(vali); names.push(tabs[i].tabName) } else if(vali == false){ valids.push(new Promise((resolve, reject)=>{ if(vali) { resolve(vali) ; } else { reject(vali) ; } }) ) names.push(tabs[i].tabName) // break; } } if(!valids || valids.length == 0) { cb() return ; } for(var i in valids) { } let valid_primase = async (v , index)=>{ let p = new Promise(function(resolve, reject){ v.then((d )=>{ if(d == null || d == false) { this_.$notify({ title: '提示', offset: 100, message: '请确保[' + names[index] + ']页面内容填写完整', position: 'bottom-right' }); reject(false) } else { resolve(true) } }).catch((e )=>{ setTimeout(function(){ this_.$notify({ title: '提示', offset: 100, type:'error', message: '请确保[' + names[index] + ']页面内容填写完整', position: 'bottom-right' }); } , index * 50) reject(false) }) }) return p ; } let fun = ()=>{ let f ; for(var i in valids) { const index = i ; if(i == 0) { f = valid_primase(valids[index] , index); } else { const f_ = valid_primase(valids[index] , index); f = f.then( function(dat){ return f_ }) } } f.then(function(data){ if(data && data == true) { cb() } else { } }) return f; } fun(); return ; }*/
import {ValidationError, RenderInstruction} from 'aurelia-validation'; export class ValidationRenderer { render(instruction) { console.log(instruction); for (let {error, elements} of instruction.unrender) { for (let element of elements) { this.remove(element, error); } } for (let {error, elements} of instruction.render) { for (let element of elements) { this.add(element, error); } } } add(element, error) { element.classList.add('has-error'); // add error div const message = document.createElement('div'); message.className = 'validation-message-div'; message.textContent = error.message; message.id = `validation-message-${error.id}`; element.parentNode.insertBefore(message, element.nextSibling); } remove(element, error) { // remove error div const message = element.parentElement.querySelector(`#validation-message-${error.id}`); if (message) { element.parentElement.removeChild(message); element.classList.remove('has-error'); } } }
console.log('Hare Krishna'); // object literal syntax const circle = { radius: 1, location: { x: 1, y: 1 }, draw: function () { console.log('draw'); } } // factory function function createCircle(radius) { return { radius, location: { x: 1, y: 1 }, draw: function () { console.log('draw'); } } } console.log('old method 1'); circle.draw() console.log('new method ') const cir=createCircle(3); cir.draw(); // Constructor function function Circle(radius){ this.radius=radius; this.draw=()=>{ console.log('draw'); } } const c=new Circle(4); c.draw(); console.log(Circle.name); const c2=new Function('radius',` this.radius=radius; this.draw=()=>{ console.log('draw'); }`) let x={}; // let x =new Object();
import React from 'react'; import * as THREE from 'three'; import ReactDOM from 'react-dom'; import sinon from 'sinon'; import chai from 'chai'; const { expect } = chai; module.exports = (type) => { describe('Shapes', () => { const { testDiv, React3, mockConsole } = require('../utils/initContainer')(type); let shapeGeometryStub = null; afterEach(() => { if (shapeGeometryStub) { shapeGeometryStub.restore(); shapeGeometryStub = null; } }); it('Should set shapes from props', () => { const rectLength = 120; const rectWidth = 40; const rectShape = new THREE.Shape(); rectShape.moveTo(0, 0); rectShape.lineTo(0, rectWidth); rectShape.lineTo(rectLength, rectWidth); rectShape.lineTo(rectLength, 0); rectShape.lineTo(0, 0); const shapes = [ rectShape, ]; const OriginalShapeGeometry = THREE.ShapeGeometry; const spy = sinon.spy(); class ShapeGeometryMock extends OriginalShapeGeometry { constructor(inputShapes, options) { super(inputShapes, options); spy(inputShapes, options); } } shapeGeometryStub = sinon.stub(THREE, 'ShapeGeometry', ShapeGeometryMock); mockConsole.expectThreeLog(); ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry shapes={shapes} /> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); sinon.assert.calledOnce(spy); expect(spy.lastCall.args[0][0], 'Shapes should be passed to the constructor of ShapeGeometry').to.equal(shapes[0]); }); it('Should set shapes from children', () => { const rectLength = 120; const rectWidth = 40; const OriginalShapeGeometry = THREE.ShapeGeometry; const shapeGeometrySpy = sinon.spy(); const shapeRef = sinon.spy(); class ShapeGeometryMock extends OriginalShapeGeometry { constructor(shapes, options) { super(shapes, options); shapeGeometrySpy(shapes, options); } } shapeGeometryStub = sinon.stub(THREE, 'ShapeGeometry', ShapeGeometryMock); mockConsole.expectThreeLog(); ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry> <shape ref={shapeRef}> <moveTo x={0} y={0} /> <lineTo x={0} y={rectWidth} /> <lineTo x={rectLength} y={rectWidth} /> <lineTo x={rectLength} y={0} /> <lineTo x={0} y={0} /> </shape> </shapeGeometry> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); // the constructor gets called only once and should have the shape in it sinon.assert.calledOnce(shapeGeometrySpy); expect(shapeGeometrySpy.firstCall.args[0].length).to.equal(1); const shape = shapeGeometrySpy.firstCall.args[0][0]; expect(shapeRef.lastCall.args[0]).to.equal(shape); expect(shape.curves.length).to.equal(4); expect(shape.curves[0].v1.x).to.equal(0); expect(shape.curves[0].v1.y).to.equal(0); expect(shape.curves[0].v2.x).to.equal(0); expect(shape.curves[0].v2.y).to.equal(rectWidth); expect(shape.curves[1].v1.x).to.equal(0); expect(shape.curves[1].v1.y).to.equal(rectWidth); expect(shape.curves[1].v2.x).to.equal(rectLength); expect(shape.curves[1].v2.y).to.equal(rectWidth); expect(shape.curves[2].v1.x).to.equal(rectLength); expect(shape.curves[2].v1.y).to.equal(rectWidth); expect(shape.curves[2].v2.x).to.equal(rectLength); expect(shape.curves[2].v2.y).to.equal(0); expect(shape.curves[3].v1.x).to.equal(rectLength); expect(shape.curves[3].v1.y).to.equal(0); expect(shape.curves[3].v2.x).to.equal(0); expect(shape.curves[3].v2.y).to.equal(0); }); it('Should set options from props', () => { const OriginalShapeGeometry = THREE.ShapeGeometry; const spy = sinon.spy(); class ShapeGeometryMock extends OriginalShapeGeometry { constructor(shapes, options) { super(shapes, options); spy(shapes, options); } } shapeGeometryStub = sinon.stub(THREE, 'ShapeGeometry', ShapeGeometryMock); mockConsole.expectThreeLog(); ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry curveSegments={1} material={2} /> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); sinon.assert.calledOnce(spy); expect(spy.firstCall.args[1].curveSegments).to.equal(1); expect(spy.firstCall.args[1].material).to.equal(2); ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry curveSegments={3} material={4} /> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); sinon.assert.calledTwice(spy); expect(spy.lastCall.args[1].curveSegments).to.equal(3); expect(spy.lastCall.args[1].material).to.equal(4); }); it('Should update shapes from children', () => { const rectLength = 120; const rectWidth = 40; const OriginalShapeGeometry = THREE.ShapeGeometry; const shapeGeometrySpy = sinon.spy(); const shapeRef = sinon.spy(); const secondShapeRef = sinon.spy(); class ShapeGeometryMock extends OriginalShapeGeometry { constructor(shapes, options) { super(shapes, options); shapeGeometrySpy(shapes, options); } } shapeGeometryStub = sinon.stub(THREE, 'ShapeGeometry', ShapeGeometryMock); mockConsole.expectThreeLog(); ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry> <shape ref={shapeRef} key="a"> <moveTo x={0} y={0} /> <lineTo x={0} y={rectWidth} /> <lineTo x={rectLength} y={rectWidth} /> <lineTo x={rectLength} y={0} /> <lineTo x={0} y={0} /> </shape> </shapeGeometry> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); // the constructor gets called only once and should have the shape in it sinon.assert.calledOnce(shapeGeometrySpy); expect(shapeGeometrySpy.firstCall.args[0].length).to.equal(1); let shape = shapeGeometrySpy.firstCall.args[0][0]; expect(shapeRef.lastCall.args[0]).to.equal(shape); ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry> <shape ref={shapeRef} key="a"> <moveTo x={0} y={0} /> <lineTo x={10} y={10 + (rectWidth * 5)} /> <lineTo x={10 + (rectLength * 10)} y={10 + rectWidth} /> </shape> <shape ref={secondShapeRef} key="b"> <moveTo x={10} y={10} /> <lineTo x={10} y={10 + (rectWidth * 5)} /> <lineTo x={10 + (rectLength * 10)} y={10 + rectWidth} /> <lineTo x={10 + rectLength} y={10} /> <lineTo x={10} y={10} /> </shape> </shapeGeometry> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); expect(shapeRef.callCount).to.equal(3); // mount, unmount, ref cleanup, and remount expect(shapeRef.getCall(0).args[0]).not.to.be.null(); expect(shapeRef.getCall(1).args[0]).to.be.null(); shape = shapeRef.getCall(2).args[0]; expect(shape).not.to.be.null(); expect(shape.curves.length).to.equal(2); expect(shape.curves[0].v1.x).to.equal(0); expect(shape.curves[0].v1.y).to.equal(0); expect(shape.curves[0].v2.x).to.equal(10); expect(shape.curves[0].v2.y).to.equal(10 + (rectWidth * 5)); expect(secondShapeRef.callCount).to.equal(2); // mount, remount ReactDOM.render((<React3 width={800} height={600} mainCamera="mainCamera" forceManualRender onManualRenderTriggerCreated={() => { }} > <scene> <mesh> <shapeGeometry> <shape ref={secondShapeRef} key="b"> <moveTo x={10} y={10} /> <lineTo x={10} y={10 + (rectWidth * 5)} /> <lineTo x={10 + (rectLength * 10)} y={10 + rectWidth} /> <lineTo x={10 + rectLength} y={10} /> <lineTo x={10} y={10} /> </shape> <shape ref={shapeRef} key="a"> <moveTo x={0} y={0} /> <lineTo x={0} y={rectWidth * 5} /> <lineTo x={rectLength * 10} y={rectWidth} /> <lineTo x={rectLength} y={0} /> <lineTo x={0} y={0} /> </shape> </shapeGeometry> <meshBasicMaterial /> </mesh> </scene> </React3>), testDiv); expect(shapeRef.callCount).to.equal(5); // ref cleanup, remount expect(shapeRef.getCall(3).args[0]).to.be.null(); expect(shapeRef.getCall(4).args[0]).not.to.be.null(); shape = shapeRef.getCall(4).args[0]; expect(shape).not.to.be.null(); expect(shape.curves.length).to.equal(4); expect(shape.curves[0].v1.x).to.equal(0); expect(shape.curves[0].v1.y).to.equal(0); expect(shape.curves[0].v2.x).to.equal(0); expect(shape.curves[0].v2.y).to.equal(rectWidth * 5); expect(shape.curves[1].v2.x).to.equal(rectLength * 10); expect(shape.curves[1].v2.y).to.equal(rectWidth); expect(shape.curves[2].v2.x).to.equal(rectLength); expect(shape.curves[2].v2.y).to.equal(0); expect(shape.curves[3].v2.x).to.equal(0); expect(shape.curves[3].v2.y).to.equal(0); expect(secondShapeRef.callCount).to.equal(4); // ref cleanup, remount expect(secondShapeRef.getCall(2).args[0]).to.be.null(); expect(secondShapeRef.getCall(3).args[0]).not.to.be.null(); }); }); };
const psp = document.querySelector(".psp"); const xbox = document.querySelector(".xbox"); const container = document.querySelector(".container"); psp.addEventListener("mouseenter", () => container.classList.add("hover-psp")); xbox.addEventListener("mouseenter", () => container.classList.add("hover-xbox") ); psp.addEventListener("mouseleave", () => container.classList.remove("hover-psp") ); xbox.addEventListener("mouseleave", () => container.classList.remove("hover-xbox") );
const express = require('express'); const app = require('./app'); const server = app.listen(app.get('port'), () => { console.log(`Running on port ${server.address().port}`); });
angular .module('app.AccountOverViewCtrl', []) .controller('AccountOverViewCtrl', AccountOverViewCtrl); function AccountOverViewCtrl($scope, $timeout, account) { $scope.user = account.user; activate(); function activate() { updateAccountScope(account.user); account.userChange.promise.then(undefined, undefined, updateAccountScope); } function updateAccountScope(user) { $timeout(function () { // avoid existing digest $scope.user = account.user; }); } }
/* * @Description: 变量定义 * @version: 0.1.0 * @Author: wsw * @LastEditors: wsw * @Date: 2019-04-24 15:30:54 * @LastEditTime: 2019-04-26 13:42:28 */ export default { configLoaded: false, mapLoaded: false, map: null, mapConfig: null, layerTreeConfig: null, panel: null, baseServiceUrl: '' }
// node destructuring-object.js \\ const fish = { name: 'hilsha', weight: '3kg', price: '4000', color: 'bright-silver', availability: 'river', speciality: 'very-tasty' } /* const name = fish.name; const color = fish.color; const weight = fish.weight; const price = fish.price; const availability = fish.availability; const speciality = fish.speciality; console.log(name); console.log(color); console.log(price); */ /* const {name, price, weight} = fish; console.log(name, price, weight); */ //Object under object const company = { name: 'addidas', //An object property’s value can be another object product: { shoe:'sports', jersey:'national-teams', deodrant: 'players', other: //Object under object { tracksuit: 'winter', watch: 'waterproof', waterbottle: 'hygienic' }, }, location: 'USA', hr: 'David Beckham', //An object property’s value can be another object, another array topSellYears: [2018, 2019, 2020, 2021] } // const deodrant = company.product.deodrant; const {shoe, jersey, deodrant} = company.product; const {watch, waterbottle} = company.product.other; const {topSellYears} = company; console.log(shoe, jersey, deodrant, topSellYears); console.log(watch, waterbottle);
/** * Created by Hafeez on 9/23/2016. */ var notifier = require('node-notifier'), util = require('gulp-util'); function messages() { return { logMessage: logMessage, handleNotification: handleNotification }; function handleNotification(message) { notifier.notify({ title: 'BREAKING NEWS . . . ', icon: (__dirname + '/../notifieravatar.png'), // Absolute path to Icon sound: true, wait: true, message: message.toString() }, function(err, res) { if(res) { //logMessage('Response = ' + res); } }); if (typeof this.emit === 'function') this.emit('end'); } function logMessage(msg) { if (typeof(msg) === 'object') { for (var item in msg) { if (msg.hasOwnProperty(item)) { print(msg[item]); } } } else { print(msg); } function print(msg) { var messageString = '*************************'; util.log(messageString, util.colors.blue(msg), messageString); util.beep(); } } } module.exports = messages;
// Must also include jsgl.js var jsglscene = (function () { var self = { // Camera affine matrix. camera_mat: function () { return camera_mat; }, // Projection affine matrix. proj_mat: function () { return proj_mat; }, objects: [], whiteout_alpha: 1, subdivide_factor: 10.0, nonadaptive_depth: 0, clip_z: false, min_z: 0.1 }; var bisect = function (p0, p1) { return { x: (p0.x + p1.x) / 2, y: (p0.y + p1.y) / 2, z: (p0.z + p1.z) / 2, u: (p0.u + p1.u) / 2, v: (p0.v + p1.v) / 2 }; }; var drawPerspectiveTriUnclippedSub = function (c3d, image, v0, tv0, v1, tv1, v2, tv2, depth_count) { var edgelen01 = Math.abs(tv0.x - tv1.x) + Math.abs(tv0.y - tv1.y); var edgelen12 = Math.abs(tv1.x - tv2.x) + Math.abs(tv1.y - tv2.y); var edgelen20 = Math.abs(tv2.x - tv0.x) + Math.abs(tv2.y - tv0.y); var zdepth01 = Math.abs(v0.z - v1.z); var zdepth12 = Math.abs(v1.z - v2.z); var zdepth20 = Math.abs(v2.z - v0.z); var subdiv = ((edgelen01 * zdepth01 > self.subdivide_factor) ? 1 : 0) + ((edgelen12 * zdepth12 > self.subdivide_factor) ? 2 : 0) + ((edgelen20 * zdepth20 > self.subdivide_factor) ? 4 : 0); if (depth_count) { depth_count--; subdiv = depth_count == 0 ? 0 : 7; } switch (subdiv) { case 0: // No subdivide. jsgl.drawTriangle(c3d.canvas_ctx_, image, tv0.x, tv0.y, tv1.x, tv1.y, tv2.x, tv2.y, v0.u, v0.v, v1.u, v1.v, v2.u, v2.v); break; case 1: // split along v01-v2 var v01 = bisect(v0, v1); var tv01 = jsgl.projectPoint(v01); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v01, tv01, v2, tv2); drawPerspectiveTriUnclippedSub(c3d, image, v01, tv01, v1, tv1, v2, tv2); break; case 2: // split along v0-v12 var v12 = bisect(v1, v2); var tv12 = jsgl.projectPoint(v12); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v1, tv1, v12, tv12); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v12, tv12, v2, tv2); break; case 3: // split along v01-v12 var v01 = bisect(v0, v1); var tv01 = jsgl.projectPoint(v01); var v12 = bisect(v1, v2); var tv12 = jsgl.projectPoint(v12); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v01, tv01, v12, tv12); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v12, tv12, v2, tv2); drawPerspectiveTriUnclippedSub(c3d, image, v01, tv01, v1, tv1, v12, tv12); break; case 4: // split along v1-v20 var v20 = bisect(v2, v0); var tv20 = jsgl.projectPoint(v20); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v1, tv1, v20, tv20); drawPerspectiveTriUnclippedSub(c3d, image, v1, tv1, v2, tv2, v20, tv20); break; case 5: // split along v01-v20 var v01 = bisect(v0, v1); var tv01 = jsgl.projectPoint(v01); var v20 = bisect(v2, v0); var tv20 = jsgl.projectPoint(v20); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v01, tv01, v20, tv20); drawPerspectiveTriUnclippedSub(c3d, image, v1, tv1, v2, tv2, v01, tv01); drawPerspectiveTriUnclippedSub(c3d, image, v2, tv2, v20, tv20, v01, tv01); break; case 6: // split along v12-v20 var v12 = bisect(v1, v2); var tv12 = jsgl.projectPoint(v12); var v20 = bisect(v2, v0); var tv20 = jsgl.projectPoint(v20); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v1, tv1, v20, tv20); drawPerspectiveTriUnclippedSub(c3d, image, v1, tv1, v12, tv12, v20, tv20); drawPerspectiveTriUnclippedSub(c3d, image, v12, tv12, v2, tv2, v20, tv20); break; default: case 7: var v01 = bisect(v0, v1); var tv01 = jsgl.projectPoint(v01); var v12 = bisect(v1, v2); var tv12 = jsgl.projectPoint(v12); var v20 = bisect(v2, v0); var tv20 = jsgl.projectPoint(v20); drawPerspectiveTriUnclippedSub(c3d, image, v0, tv0, v01, tv01, v20, tv20, depth_count); drawPerspectiveTriUnclippedSub(c3d, image, v1, tv1, v12, tv12, v01, tv01, depth_count); drawPerspectiveTriUnclippedSub(c3d, image, v2, tv2, v20, tv20, v12, tv12, depth_count); drawPerspectiveTriUnclippedSub(c3d, image, v01, tv01, v12, tv12, v20, tv20, depth_count); break; } return; }; self.drawPerspectiveTriUnclipped = function (c3d, image, v0, v1, v2, depth_count) { drawPerspectiveTriUnclippedSub( c3d, image, v0, jsgl.projectPoint(v0), v1, jsgl.projectPoint(v1), v2, jsgl.projectPoint(v2), depth_count); }; // Draw a perspective-corrected textured triangle, subdividing as // necessary for clipping and texture mapping. // // Unconventional clipping -- recursively subdivide, and drop whole tris on // the wrong side of z clip plane. self.drawPerspectiveTri = function (c3d, image, v0, v1, v2, depth_count) { var clip = ((v0.z < self.min_z) ? 1 : 0) + ((v1.z < self.min_z) ? 2 : 0) + ((v2.z < self.min_z) ? 4 : 0); if (clip == 0) { // No verts need clipping. self.drawPerspectiveTriUnclipped(c3d, image, v0, v1, v2, depth_count); return; } else if (clip == 7) { // All verts are behind the near plane; don't draw. return; } // Also clip if behind the guard band. // Prevents endless clipping recursion. var min_z2 = self.min_z * 1.02; var clip2 = ((v0.z < min_z2) ? 1 : 0) + ((v1.z < min_z2) ? 2 : 0) + ((v2.z < min_z2) ? 4 : 0); if (clip2 == 7) { // All verts are behind the guard band, don't recurse. return; } // Subdivide depending on which vertexex were clipped. if (depth_count) depth_count--; switch (clip) { case 1: var v01 = bisect(v0, v1); var v20 = bisect(v2, v0); drawPerspectiveTri(c3d, image, v01, v1, v2); drawPerspectiveTri(c3d, image, v01, v2, v20); drawPerspectiveTri(c3d, image, v0, v01, v20); break; case 2: var v01 = bisect(v0, v1); var v12 = bisect(v1, v2); drawPerspectiveTri(c3d, image, v0, v01, v12); drawPerspectiveTri(c3d, image, v0, v12, v2); drawPerspectiveTri(c3d, image, v1, v12, v01); break; case 3: var v12 = bisect(v1, v2); var v20 = bisect(v2, v0); drawPerspectiveTri(c3d, image, v2, v20, v12); drawPerspectiveTri(c3d, image, v0, v1, v12); drawPerspectiveTri(c3d, image, v0, v12, v20); break; case 4: var v12 = bisect(v1, v2); var v20 = bisect(v2, v0); drawPerspectiveTri(c3d, image, v0, v1, v12); drawPerspectiveTri(c3d, image, v0, v12, v20); drawPerspectiveTri(c3d, image, v12, v2, v20); break; case 5: var v01 = bisect(v0, v1); var v12 = bisect(v1, v2); drawPerspectiveTri(c3d, image, v1, v12, v01); drawPerspectiveTri(c3d, image, v0, v01, v12); drawPerspectiveTri(c3d, image, v0, v12, v2); break; case 6: var v01 = bisect(v0, v1); var v20 = bisect(v2, v0); drawPerspectiveTri(c3d, image, v0, v01, v20); drawPerspectiveTri(c3d, image, v01, v1, v2); drawPerspectiveTri(c3d, image, v01, v2, v20); break; } }; self.rotateObject = function (object, xangle, yangle, zangle) { // Rotate xyz independently. var mat = new jsgl.AffineMatrix( Math.cos(yangle) * Math.cos(zangle), -Math.cos(xangle) * Math.sin(zangle) + Math.sin(xangle) * Math.sin(yangle) * Math.cos(zangle), Math.sin(xangle) * Math.sin(zangle) + Math.cos(xangle) * Math.sin(yangle) * Math.cos(xangle), 0, Math.cos(yangle) * Math.sin(zangle), Math.cos(xangle) * Math.cos(zangle) + Math.sin(xangle) * Math.sin(yangle) * Math.sin(zangle), -Math.sin(xangle) * Math.cos(zangle) + Math.cos(xangle) * Math.sin(yangle) * Math.sin(zangle), 0, -Math.sin(yangle), Math.sin(xangle) * Math.cos(yangle), Math.cos(xangle) * Math.cos(yangle), 0 ); object.matrix = jsgl.multiplyAffine(mat, object.matrix); jsgl.orthonormalizeRotation(object.matrix); }; self.rotateObjectAxis = function (object, scaled_axis) { var angle = Math.min(Math.asin(Math.sqrt(jsgl.dotProduct(scaled_axis, scaled_axis))), Math.PI / 8); var mat = { e0: cos*cos, e4: -cos*sin + sin*sin*cos, e8: sin*sin + cos*sin*cos, e12: 0, e1: cos*sin, e5: cos*cos + sin*sin*sin, e9: -sin*cos + cos*sin*sin, e13: 0, e2: -sin, e6: sin*cos, e10: cos*cos, e14: 0 }; object.matrix = jsgl.multiplyAffine(mat, object.matrix); jsgl.orthonormalizeRotation(object.matrix); }; self.setOrientation = function (distance) { self.camera_mat = jsgl.makeOrientationAffine( { x: 0, y: 0, z: distance }, { x: 0, y: 0, z: -1 }, { x: 0, y: 1, z: 0 } ); }; self.setProjection = function (canvas_width, canvas_height, fov_radians) { self.proj_mat = jsgl.makeWindowProjection(canvas_width, canvas_height, fov_radians); }; return self; })();
Page({ data: { }, onLoad() { wx.createSelectorQuery().select('#nodes').boundingClientRect(function(rect){ rect.id // 节点的ID rect.dataset // 节点的dataset rect.left // 节点的左边界坐标 rect.right // 节点的右边界坐标 rect.top // 节点的上边界坐标 rect.bottom // 节点的下边界坐标 rect.width // 节点的宽度 rect.height // 节点的高度 }).exec() wx.createSelectorQuery().select('#nodes').fields({ dataset: true, size: true, scrollOffset: true, properties: ['scrollX', 'scrollY'], computedStyle: ['margin', 'backgroundColor'] },function(res){ console.log(res) }).exec() wx.createSelectorQuery().selectViewport().scrollOffset(function(res){ res.id // 节点的ID res.dataset // 节点的dataset res.scrollLeft // 节点的水平滚动位置 res.scrollTop // 节点的竖直滚动位置 console.log(res) }).exec() }, onShow:function(){ var query=wx.createSelectorQuery() query.select('#viewport').boundingClientRect() query.exec(function(res){ console.log(res[0],'resss') }) } })
import * as brush from "./brush.js" import * as document from "./document.js" import * as layer from "./layer.js" import * as ui from "./ui.js" import * as command from "./command.js" //============================================================================ export { ui }; export { layer }; export { document }; export { brush }; export { command };