text
stringlengths 7
3.69M
|
|---|
/**
* @author Kunal Pareek (kunalp@outlook.in)
* @desc Express app setup
*/
const express = require('express')
const morgan = require('morgan')
const bodyParser = require('body-parser')
const winston = require('./logger/index')
const cors = require('cors')
var app = express()
app.use(cors())
app.use(morgan('combined', { stream: winston.stream }))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use('/v1', require('./api/routes'))
module.exports = app
|
//index.js
//获取应用实例
// const app = getApp()
import axios from "../../util/axios.js"
Page({
data: {
recommendList: [], // 为你精心推荐
bannerList: [], // 轮播图数据
// rankingList: [], //
// rankingList2: [], //
// rankingList3: [] //
},
// 跳转每日推荐
meirituijian() {
wx.navigateTo({
url: '/pages/meirituijan/meirituijan',
})
},
onLoad: function() {
// 获取为你精心推荐数据
let result = axios("personalized");
result.then((res) => {
this.setData({
recommendList: res.result
})
})
// 获取轮播图数据
let result2 = axios("banner?type=2");
result2.then((res) => {
this.setData({
bannerList: res.banners
})
})
// 排行榜数据
const topArr = [1, 6, 8];
let count = 0;
let rankingList = [];
while (count < topArr.length) {
let result3 = axios("top/list", {
idx: topArr[count++]
});
result3.then((res) => {
let obj = {
name: res.playlist.name,
tracks: res.playlist.tracks
};
rankingList.push(obj)
this.setData({
rankingList
})
})
}
},
})
|
/* 🤖 this file was generated by svg-to-ts*/
export const EOSIconsTvOff = {
name: 'tv_off',
data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M1 3.54l1.53 1.53C1.65 5.28 1 6.06 1 7v12c0 1.1.9 2 2 2h15.46l2 2 1.26-1.27L2.27 2.27 1 3.54zM3 19V7h1.46l12 12H3zM21 5h-7.58l3.29-3.3L16 1l-4 4-4-4-.7.7L10.58 5H7.52l2 2H21v11.48l1.65 1.65c.22-.32.35-.71.35-1.13V7c0-1.11-.89-2-2-2z"/></svg>`
};
|
const assertEqual = (actual, expected) => {
if (actual === expected) {
console.log(`Assertion ✅: ${actual} === ${expected}`);
} else {
console.log(`Assertion ❌: ${actual} !== ${expected}`);
}
};
const findKey = (restaurants, callback) => {
for (const restaurant in restaurants) {
if (callback(restaurants[restaurant])) return restaurant;
// console.log(restaurants[restaurant].stars);
}
return undefined;
};
// console.log(
assertEqual(
findKey({
"Blue Hill": { stars: 1 },
"Akaleri": { stars: 3 },
"noma": { stars: 2 },
"elBulli": { stars: 3 },
"Ora": { stars: 2 },
"Akelarre": { stars: 3 }
}, x => x.stars === 2) // => "noma"
// );
, 'noma')
|
/* This file is the entry point for all js files */
/* Bootstrap v4.0 */
// import 'bootstrap';
/* You can also import bootstrap modules individually */
// import 'bootstrap/js/dist/util';
// import 'bootstrap/js/dist/dropdown';
// ...
import Jarallax from './libs/jarallax.min.js';
import JarallaxElement from './libs/jarallax-element.min.js';
import Slick from './libs/slick.min.js';
import Modals from './modals';
import Ajax from './libs/ajax';
import Blog from './blog';
$(document).ready(function() {
// Non-Bootstrap nav
var mainNav = $('#main-nav'),
menuLink = $('.menu-item a');
$('#menu-toggle').on('click', function() {
$(mainNav).toggleClass('active');
});
$('#menu-close, section, footer', menuLink).on('click', function() {
$(mainNav).removeClass('active');
});
$('#menu-close', menuLink).on('focus', function() {
$(mainNav).addClass('active');
});
$('#menu-close', menuLink).on('focusout', function() {
$(mainNav).removeClass('active');
});
});
if ($('#hero-slider').length > 0) {
var Prev = '<a role="button" href="#" class="arrow prev"><</a>',
Next = '<a role="button" href="#" class="arrow next">></a>';
$('#hero-slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 3500,
dots: false,
prevArrow: Prev,
nextArrow: Next,
infinite: true,
speed: 1000,
// fade: true
});
}
if ($('#hero .slick-initialized').length > 0) {
$('#hero-slider .slide').addClass('show');
}
// Set up new ajax submit for each form
$('form').each(function() {
var self = $(this);
const ajax = new Ajax(self);
ajax.run();
});
window.scrollToElement = function(elTrigger, elTarget, offsetMobile, offset) {
var offsetCond = $(window).width() < 1024 ? offsetMobile : offset;
$(elTrigger).on('click',function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: ( ($(elTarget).offset().top + offsetCond))
}, 1500);
});
// FOR LANDING PAGES:
// Reset nav hrefs for pages that are not the home page
// This sends links to the home page and then scrolls to element there
if (window.location.pathname !== '/') {
$(elTrigger).attr('href', '/' + elTarget);
}
}
var fadeIns =[].slice.call(document.querySelectorAll(".fade-in, .fade"));
var lazyItems =[].slice.call(document.querySelectorAll(".lazy"));
if ("IntersectionObserver" in window) {
// Trigger fade in elements
let fadeInsObserver = new IntersectionObserver((entries) => {
entries.forEach(function(entry) {
let fadeItem = entry.target;
if (entry.isIntersecting) {
window.requestAnimationFrame(function () {
// Run scroll functions
fadeItem.classList.add("visible");
});
}
});
});
fadeIns.forEach(function(item) {
fadeInsObserver.observe(item);
});
// Trigger lazy load items
let lazyItemObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(function(entry) {
if (entry.isIntersecting) {
let lazyItem = entry.target;
if (lazyItem.hasAttribute('src')) {
lazyItem.src = lazyItem.dataset.src;
}
if (lazyItem.hasAttribute('srcset')) {
lazyItem.srcset = lazyItem.dataset.srcset;
}
lazyItem.classList.remove("lazy");
lazyItem.classList.add("lazy-active");
lazyItemObserver.unobserve(lazyItem);
}
});
});
lazyItems.forEach(function(item) {
lazyItemObserver.observe(item);
});
} else {
// Possibly fall back to a more compatible method here
}
|
var sampleSteps = function() {
var ptor;
this.Before(function (callback) {
browser.ignoreSynchronization = true;
//expect($('#login_field').waitReady()).toBeTruthy();
//browser.manage().timeouts().pageLoadTimeout(40000);
callback();
});
this.Given(/^this is the first sample$/, function (callback) {
// http://assertselenium.com/2013/02/22/handling-iframes-using-webdriver/
ptor = protractor.getInstance();
ptor.get('/#').then(function(){
//ptor.getTitle().then(function(val){
// console.log(val);
//});
ptor.findElement(protractor.By.css('.wellcomePlayer')).then(function(el) {
callback();
}, function(){
callback.fail("wellcomePlayer div not found");
});
});
});
this.Given(/^this is the second sample$/, function (callback) {
this.greetings("everybody", callback);
});
};
module.exports = sampleSteps;
|
class Command {
constructor(bot, data) {
this.bot = bot;
this.name = data.name;
this.aliases = data.aliases || [];
this.category = data.category || "Main";
this.usage = data.usage || this.name;
this.description = data.description;
this.example = data.example;
this.cooldown = data.cooldown;
}
}
module.exports = Command;
|
function processData(input) {
var arr = input.split('\n');//each line into array
var s = []; //strings array
var r = []; //reversed strings array
var sn = ''; //string n
var rn = ''; //reverse string n
for(i=1;i<arr.length;i++){ //fill the string arrays
s.push(arr[i]);
r.push(arr[i].split('').reverse().join(''));
sn = s[s.length-1]; //the most recent item in the array, essentially what just got pushed above.
rn = r[r.length-1]; //ditto for the reverse strings array
var x = 0;
while(x < sn.length-1){
if(Math.abs((sn.charCodeAt(x+1) - sn.charCodeAt(x))) != Math.abs((rn.charCodeAt(x+1) - rn.charCodeAt(x)))){
console.log('Not Funny');
break;
}else if(x<sn.length-2){
x++;
}else {
console.log('Funny');
break;
}
}
}
}
|
import React, { useState } from "react";
import styled from "styled-components";
import "./style.scss";
/***** COMPONENTS *****/
import Infos from "../../../components/molecules/Infos";
/***** ASSETS *****/
import frameRichard from "../../../assets/img/chap_1/part_3/c1p3_frame_richard.png";
import richard from "../../../assets/img/chap_1/part_3/c1p3_richard.png";
import coinQueen from "../../../assets/img/chap_1/part_3/c1p3_coin_queen.png";
import coinWagon from "../../../assets/img/chap_1/part_3/c1p3_coin_wagon.png";
const Richard = ({ partData }) => {
const [isAnimated, setIsAnimated] = useState(false);
return (
<Container className={isAnimated ? "isAnimated hasNet" : "hasNet"}>
<img src={frameRichard} alt="" />
<img src={richard} alt="" className="richard" />
<div className="scene">
<div className="coin">
<div className="coin__card">
<img
src={coinQueen}
alt="coin-queen"
className="coin__side coin__side--queen"
/>
<img
src={coinWagon}
alt="coin-wagon"
className="coin__side coin__side--wagon"
/>
</div>
</div>
</div>
{partData && (
<Infos
setIsAnimated={setIsAnimated}
title={partData[2]?.cards[0].title}
content={partData[2]?.cards[0].content}
top="15"
left="55"
leftCard="100"
bottomCard="20"
/>
)}
</Container>
);
};
const Container = styled.div`
position: relative;
width: 35%;
height: fit-content;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr;
animation: enterIn .5s ease-out;
img {
filter: grayscale(1);
transform: rotate(5deg);
}
&.isAnimated {
z-index: 10;
img {
filter: grayscale(0);
}
.coin__card {
width: 70px;
height: 70px;
transform: rotateY(180deg);
}
.richard {
transform: scale(3);
transition: all 0.5s linear;
}
.coin {
animation: flipping 1s forwards;
}
}
img {
width: 100%;
grid-column: 1;
grid-row: 1;
}
.coin {
grid-column: 1;
grid-row: 1;
width: 5%;
height: auto;
position: absolute;
bottom: 40%;
left: 62%;
img {
width: 100%;
}
}
.coin {
perspective: 500px;
perspective-origin: 100px 100px;
}
.coin__card {
position: relative;
transform-style: preserve-3d;
width: 20px;
height: 20px;
transition: transform 1.5s;
}
.coin__side {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.coin__side--wagon {
transform: rotateY(180deg);
}
`;
export default Richard;
|
import Service from './apiService';
import listImages from '../template/list-images';
import ref from './ref';
import alert from './alert';
import observ from './observ'
// import isBtnVisible from './handlers'
function render (curentValue) {
Service.takeImag(curentValue).then(renderListCards);
}
function renderListCards(arr){
// Service.length(arr)
// isBtnVisible(arr);
const markup = listImages(arr);
ref.galleryRef.insertAdjacentHTML('beforeend', markup);
scrollFilter (arr)
}
function scrollFilter (arr){
if(arr.length >= 12){
observ(render)
}
if(arr.length >= 1 && arr.length < 12) {
alert.imageFinished()
}
if(arr.length === 0){
alert.imageNotFind()
}
}
// function observ() {
// const options = {
// rootMargin: '0px',
// threshold: 1.0
// }
// function callback(entries, observer) {
// entries.forEach(entry => {
// if (entry.isIntersecting) {
// console.log('entry', entry);
// render()
// }
// });
// };
// const elementToObserve = document.querySelector('.list-img:last-child');
// const observer = new IntersectionObserver(callback, options);
// observer.observe(elementToObserve);
// }
export default render
|
var x=10;
var y=1;
var speed=round(random(1,10));
var frogx = 107;
var frogy = 243;
var frogspeed = round(random(1,10));
var rabbitx = 18;
var rabbity = 266;
var rabbitspeed = round(random(1,10));
draw = function() {
noStroke();
background(255, 255, 255);
//neck
fill(122, 15, 15);
rect(x+85, y+81, 30, 40);
//head
ellipse(x+100,y+57,85,100);
//leftdimple
fill(255, 255, 255);
ellipse(x+55, y+97, 32, 66);
//rightdimple
fill(255, 255, 255);
ellipse(x+145, y+97, 32, 66);
//hat
fill(196, 178, 196);
arc(x+100, y+31, 72, 78, 184, 361);
//rightshoulder
fill(204, 49, 194);
quad(x+205, y+160, x+166, y+126, x+111, y+112, x+83, y+160);
//leftshoulder
fill(204, 49, 194);
quad(x+116, y+160, x+89, y+113, x+30, y+129, x-13, y+163);
//lefteye
fill(0, 0, 0);
ellipse(x+79, y+52, 10, 10);
//righteye
fill(0, 0, 0);
ellipse(x+117, y+52, 10, 10);
//mouth
fill(255, 255, 255);
arc(x+100, y+80, 36, 26, -2, 175);
line(111, 97, 118, 112);
//nose
fill(122, 15, 15);
stroke(0, 0, 0);
strokeWeight(2);
bezier(x+96, y+64, x+133, y+67, x+87, y+83, x+96, y+69);
//duragline
strokeWeight(5);
stroke(0, 0, 0);
line(x+134, y+30, x+66, y+31);
//namebadge
color(166, 61, 166);
text('O.M.', x+126, y+132, 94, 159);
//break
x = x + speed;
//frog
noStroke();
fill(30, 204, 91); // a nice froggy green!
//break
ellipse(frogx, frogy, 200, 100); // face
ellipse(frogx - 50, frogy - 50, 40, 40); // left eye socket
ellipse(frogx + 50, frogy - 50, 40, 40); // right eye socket
//break
fill(255, 255, 255); // for the whites of the eyes!
ellipse(frogx - 50, frogy - 50, 30, 30); // left eyeball
ellipse(frogx + 50, frogy - 50, 30, 30); // right eyeball
//break
fill(0, 0, 0);
rect(frogx+49,frogy-56,10,10); //righteye
rect(frogx-55,frogy-48,10,10); //lefeye
//mouth
fill(0, 0, 0);
ellipse(frogx, frogy, 137, 60);
//break
frogx = frogx + frogspeed;
//rabbit
noFill();
stroke(0, 0, 0);
var eyesize = 33;
ellipse(rabbitx+50, rabbity-30, 60, 120); // left ear
ellipse(rabbitx+140, rabbity-30, 60, 120); // right ear
fill(255, 255, 255);
ellipse(rabbitx+100, rabbity+70, 150, 150); // face
fill(0, 0, 0);
ellipse(rabbitx+70, rabbity+50, eyesize, eyesize); // left eye
ellipse(rabbitx+130, rabbity+50, eyesize, eyesize); // right eye
line(rabbitx+50, rabbity+100, rabbitx+150, rabbity+100); // mouth
var teeth = 27;
noFill();
rect(rabbitx+85, rabbity+100, 15, teeth); // left tooth
rect(rabbitx+100, rabbity+100, 15, teeth); // right tooth
rabbitx = rabbitx + rabbitspeed;
};
|
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps')
const cssmin = require('gulp-cssmin');
//const imagemin = require('gulp-imagemin');
//const replace = require('gulp-replace');
const autoprefixer = require('gulp-autoprefixer')
//const rename = require("gulp-rename");
// const svgSprite = require('gulp-svg-sprite');
gulp.task('default', function () {
// test
});
gulp.task('sass', function () {
return gulp.src('sass/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'expanded' }).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('css/'))
//for production to extrant minified version
.pipe(cssmin())
.pipe(rename({ extname: '.min.css' }))
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('css/'))
;
});
gulp.task('sass:watch', function () {
gulp.watch('sass/**/*.scss', ['sass']);
});
// deploy tasks
gulp.task('deploy', ['DeployCss']);
gulp.task('DeployCss', function () {
return gulp.src('css/**/*.css')
.pipe(cssmin())
.pipe(gulp.dest('./css/'));
});
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { View } from 'react-native';
import { Text } from 'react-native-elements';
import { DotIndicator } from 'react-native-indicators';
import LinearGradient from 'react-native-linear-gradient';
import QuestHeader from '../../../components/commons/questHeader';
import LandScapeListActivity from './list-activity';
import ActivityBoard from '../activity-board';
import ActivityQuestion from '../activity-question'
import {
loadFreeActivities,
getFreeActivity,
getActivity,
} from '../../../store/actions/freeActivity';
import propTypes from 'prop-types';
class ActivityLandScape extends Component {
constructor(props) {
super(props);
this.state = {
isLoading: false,
activities: null,
activity: null,
events: null,
activityStage: 0,
};
}
openActivity = (id) => {
this.props.getFreeActivity({id});
}
openPlaning = (link) => {
this.props.getActivity({link});
}
sendActivity = () => {
this.props.loadFreeActivities();
}
static getDerivedStateFromProps(nextProps, prevState) {
return {
isLoading: nextProps.isLoading,
activities: nextProps.activities,
activityStage: nextProps.activityStage,
activity: nextProps.activity,
events: nextProps.events,
};
}
render() {
const { vw, vh, isTablet, isLandScape } = this.props;
const {
isLoading,
activities,
events,
activityStage,
activity,
} = this.state;
const activeColor = ['#31c5d2', '#3b62ab'];
const fv = isLandScape ? vh : vw;
let activityName = activity ? activity.activity.name : '';
let iconName = activityStage == 0 ? 'liste' : 'sommeil';
let iconTitle = activityStage == 0 ? 'Liste de mes activités' : activityName;
let width = activityStage == 0 ? 5.08 * fv : 8.7 * fv;
let height = activityStage == 0 ? 6.75 * fv : 6.75 * fv;
return(
<View style={{ width: '100%', paddingVertical: 2 * fv, flex: 1 }}>
<QuestHeader
title={iconTitle}
iconName={iconName}
iconWidth={width}
iconHeight={height}
vw={vw}
vh={vh}
isLandScape={isLandScape}
isTablet={isTablet}
/>
{isLoading && <DotIndicator size={16} /> }
{!isLoading && activityStage === 0 &&
<View style={{
width: '100%',
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-start',
paddingHorizontal: 2 * vh,
}}>
<View style={{
flex: 0.2,
flexDirection: 'column',
justifyContent: 'flex-start',
alignItems: 'center',
}}>
<View style={{
flex: 0,
marginTop: 1 * vh,
backgroundColor: 'transparent',
width: '100%',
}}>
<LinearGradient
colors={activeColor}
start={{x: 0.0, y: 1.0}} end={{x: 1.0, y: 1.0}}
style={{
width: '100%',
borderRadius: 5,
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems:'center',
}}
>
<Text style={{
color: '#fff',
fontSize: 3.4 * vh,
paddingVertical: 1 * vh,
paddingLeft: 1 * vh,
}}>Agenda</Text>
</LinearGradient>
</View>
<LandScapeListActivity
vw={vw}
vh={vh}
isTablet={isTablet}
isLandScape={isLandScape}
activities={activities}
openActivity={this.openActivity} />
</View>
<View style={{ flex: 0.8, justifyContent: 'flex-start', paddingLeft: 1 * vh }}>
<ActivityBoard
vw={vw}
vh={vh}
isTablet={isTablet}
isLandScape={isLandScape}
defaultPlan={events}
openPlaning={this.openPlaning} />
</View>
</View>
}
{!isLoading && activityStage === 1 &&
<ActivityQuestion
vw={vw}
vh={vh}
isTablet={isTablet}
isLandScape={isLandScape}
sendActivity={this.sendActivity} />
}
</View>
);
}
}
ActivityLandScape.propTypes = {
vw: propTypes.number,
vh: propTypes.number,
isTablet: propTypes.bool,
isLandScape: propTypes.bool,
};
const mapStateToProps = (state, ownProps) => {
return {
...state.freeActivities.toJS(),
events: {
...state.activities.toJS(),
},
};
};
export default connect(
mapStateToProps,
{loadFreeActivities, getFreeActivity, getActivity}
)(ActivityLandScape);
|
const puppeteer = require('puppeteer')
const startBrowser = async ()=>{
let browser;
try{
console.log("Openning browser....")
browser = await puppeteer.launch({
args: ['--no-sandbox'],
'ignoreHTTPSErrors': true
})
}catch(error){
console.log("Could not create a browser instance => : ",error)
}
return browser
}
module.exports = {
startBrowser
}
|
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const Help_1 = __importDefault(require("./Help"));
//定义辅助类函数
class ZtMeta {
constructor(client) {
this._client = client;
}
listTables(database, options, callback) {
if (options.withColumns === undefined) {
options.withColumns = false;
}
if (options.withPrimaryKey === undefined) {
options.withPrimaryKey = false;
}
const bb = () => __awaiter(this, void 0, void 0, function* () {
try {
let tables = yield Help_1.default.getTable(this._client, database);
// console.log("now print the options",options,(options as listTableOptions).withColumns);
for (let i = 0; i < tables.length; i++) {
if (options.withColumns)
tables[i].columns = yield Help_1.default.getColumns(this._client, database, tables[i].table_name, false);
if (options.withPrimaryKey)
tables[i].primary_key = yield Help_1.default.getprimaryKey(this._client, database, tables[i].table_name);
}
callback(null, tables, null, "ok");
}
catch (err) {
callback(err, null, err.sql, "failed");
}
});
let aa = bb().then().catch();
}
listColumns(database, table, options, callback) {
if (options === undefined || options === {}) {
options = {
withPrimaryKey: true
};
}
Help_1.default.getColumns(this._client, database, table, options.withPrimaryKey)
.then(res => {
callback(null, res, undefined, 'ok');
})
.catch((err) => {
callback(err, null, err.sql, 'failed!');
});
}
findPrimaryKey(database, table, callback) {
Help_1.default.getprimaryKey(this._client, database, table)
.then(res => {
callback(null, res, null, "ok");
})
.catch((err) => {
callback(err, null, err.sql, "failed");
});
}
/***/
listDatabases(config, callback) {
if (config === {}) {
config = {
withSystemDataBases: true
};
}
Help_1.default.getDbs(this._client, config.withSystemDataBases)
.then(res => {
callback(null, res, "ok");
})
.catch((err) => {
callback(err, null, "failed");
});
}
showVersion(callback) {
Help_1.default.getVersion(this._client)
.then(res => {
callback(null, res, 'ok');
})
.catch((err) => {
callback(err, null, "failed");
});
}
}
module.exports = ZtMeta;
|
define(function(require, exports, module) {
var global = require('../../lib/global/global');
var request = require('../../lib/http/request');
var bodyParse = require('../../lib/http/bodyParse');
var template = require('../../lib/template/template');
var arg = require('../../fnc/arg.js');
var inputTip = require('../../fnc/inputTip.js');
var globalFnDo = require('../../lib/module/globalFnDo');
var saveData =require('../../lib/dom/saveData.js');
var share = require('../../lib/share/createShare.js');
function CaseDetail()
{
this.sType = this.judePage();
this.urlData = bodyParse();
this.getDataUrl = this.sType == 'scheme' ? '/index.php/view/scheme/info' : '/index.php/view/room/info';
this.productUrl = '/index.php/view/room/bill';
this.dataId = this.urlData ? (this.sType == 'scheme' ? this.urlData.sid : this.urlData.rid) : '';
this.param = this.sType == 'scheme' ? {sid: this.dataId} : {rid: this.dataId};
this.tplDetailId = this.sType == 'scheme' ? 'scheme_detail' : 'room_detail';
this.tplFlashId = 'case_flash';
this.tplProId = 'case_product';
this.tplArgId = 'arg';
this.oFlash = $('[script-role = case_flash]');
this.oDetail = $('[script-role = detail_main]');
this.oProduct = $('[script-role = product_wrap]');
this.oArgWrap = $('[script-role = arg_wrap]');
this.sinWidth = '';
this.sumWidth = '';
this.fail = null;
}
CaseDetail.prototype = {
constructor: CaseDetail,
init: function()
{
this.showDetail();
},
showDetail: function()
{
var _this = this;
this.load(this.getDataUrl, this.param, function(data){
// showFlash
_this.render(_this.oFlash, _this.tplFlashId, data.data);
//showDetail
_this.render(_this.oDetail, _this.tplDetailId, data.data);
data.data.rid = data.data.rid || _this.dataId;
data.data.type = _this.sType;
saveData(_this.oDetail, data.data);
//arg
_this.render(_this.oArgWrap, _this.tplArgId, {});
//room图片展示
if(_this.sType == 'room')
{
var oUl,
oLeft,
oRight;
oUl = $('[script-role = room_list_wrap]');
oLeft = $('[script-role = room_left_btn]');
oRight = $('[script-role = room_right_btn]');
_this.roll(oUl, oLeft, oRight, 'room_list');
}
//showPin
_this.showPin();
//showProduct
_this.showProductList(data.data.rid);
//showPinLun
_this.showPinLun();
//share
share($('[script-role = share_wrap]').get(0), data.data.room_thinking);
});
},
changeRoom: function(name, dec)
{
var oName = $('[script-role = room_name]');
var oThink = $('[script-role = room_thinking]');
oName.html(name);
oThink.html(dec);
},
showProductList: function(rid)
{
var _this = this;
var oUl,
oLeft,
oRight;
this.load(this.productUrl, {rid: rid}, function(data){
_this.render(_this.oProduct, _this.tplProId, data.data);
oUl = $('[script-role = product_roll_wrap]');
oLeft = $('[script-role = product_left_btn]');
oRight = $('[script-role = product_right_btn]');
_this.roll(oUl, oLeft, oRight, 'product_roll_list');
_this.oProduct.show();
});
this.fail = function()
{
this.oProduct.hide();
};
},
roll: function(oUl, oLeft, oRight, listName)
{
var aList,
num;
aList = oUl.find('[script-role = '+ listName +']');
num = aList.length;
this.sinWidth = aList.eq(0).outerWidth(true);
this.sumWidth = num * this.sinWidth;
oUl.css({width: this.sumWidth});
oUl.attr('iNow', '0');
this.clickChange(oUl, oLeft, oRight, this.sinWidth, this.sumWidth, listName);
},
tab: function(oUl, n, dis)
{
oUl.stop().animate({left: n * dis});
},
clickChange: function(oUl, oLeft, oRight, sinWidth, sumWidth, listName)
{
var n,
num,
_this,
max;
num = oUl.find('[script-role = '+ listName +']').length;
_this = this;
max = Math.floor((sumWidth - oUl.parent().width())/sinWidth);
if(max <= 0)
{
oLeft.hide();
oRight.hide();
}
oLeft.on('click', function(){
n = oUl.attr('iNow');
n ++ ;
if(n > max) n = max;
oUl.attr('iNow', n);
_this.tab(oUl, -n ,sinWidth);
});
oRight.on('click', function(){
n = oUl.attr('iNow');
n -- ;
if(n < 0) n = 0;
oUl.attr('iNow', n);
_this.tab(oUl, -n ,sinWidth);
});
},
showPin: function()
{
var oPinText = $('[script-role = pin_text]');
var oPin = $('[script-role = pin]');
var nWidth = oPinText.outerWidth(true) - oPin.outerWidth(true);
oPinText.css({marginLeft: -(nWidth/2)});
},
showPinLun: function()
{
var oSendBtn = $('[script-role = pinlun_btn]');
var oArea = $('[script-role = pinlun_textarea]');
var oListWrap = $('[script-role = pinlun_wrap]');
var oLoadMore = $('[script-role = pinlun_more]');
var oNum = $('[script-role = pinlun_num]');
var oTip = $('[script-role = pinlun_tip]');
var getUrl = this.sType == 'scheme' ? '/index.php/view/scheme/getdiscu' : '/index.php/view/room/getdiscu';
var pinLunUrl = this.sType == 'scheme' ? '/index.php/posts/scheme/adddiscu' : '/index.php/posts/room/adddiscu';
var replyUrl = this.sType == 'scheme' ? '/index.php/posts/scheme/addreply' : '/index.php/posts/room/addreply';
var data = {};
this.sType == 'scheme' ? data.sid = this.dataId : data.rid = this.dataId;
oInputTip = new inputTip({
oArea : oArea,
oTip : oTip
});
oArguments = new arg({
oSendBtn : oSendBtn,
oLoadMore : oLoadMore,
oListWrap : oListWrap,
sUrl: getUrl,
answerUrl: pinLunUrl,
replyUrl: replyUrl,
param: data,
answerParam: data,
oArea : oArea,
articalId : 638,
oNum: oNum,
down: function()
{
oInputTip.clear();
}
});
oArguments.init();
oInputTip.init();
},
load: function(url, param, callBack)
{
var _this = this;
request({
url: url,
data: param,
async: false,
sucDo: function(data)
{
callBack && callBack(data);
},
noDataDo: function(msg)
{
_this.fail && _this.fail();
}
});
},
render: function(oWrap, tplId, data)
{
var html = template.render(tplId, data);
//var orgHtml = oWrap.html();
oWrap.html(html);
},
judePage: function()
{
var type;
type = window.location.href.indexOf('scheme') !=-1 ? 'scheme' : 'room';
return type;
}
};
var oDetail = new CaseDetail();
oDetail.init();
window.getFlashData = function(value)
{
if(oDetail.first)
{
var sName,
sDec,
sId,
arr;
arr = value.split(':');
sId = arr[0];
sName = arr[1];
sDec = arr[2];
oDetail.changeRoom(sName, sDec);
oDetail.showProductList(sId);
}
oDetail.first = true;
}
var pageDo = new globalFnDo({
oWrap : $('[script-role = detail_main]'),
listName: 'detail_main'
});
pageDo.init();
});
|
/* Anything that you are doing by using mouse or else is event.*/
function btnclicked (){
console.log ("My Button clicked.");
}
|
import React, {Component} from 'react';
import {NavigationContainer} from '@react-navigation/native';
import ValidationFormik from '../Validation/ValidationFormik';
import StackRoot from './StackRoot';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
const Tab = createBottomTabNavigator();
export default class RootNavigator extends Component {
render() {
return (
<NavigationContainer>
<StackRoot />
</NavigationContainer>
);
}
}
|
import React from 'react';
import RichTextEditor from 'react-rte';
const TodoListItemEditView = props => {
let dateFix = '';
if (props.dateInput) dateFix = props.dateInput.substring(0, 10);
return (
<div>
<div className="row justify-content-sm-center">
<form className="col-sm-8" onSubmit={event => props.onSave(event)}>
<input
className="todoItem list-group-item col-sm-12"
type="text"
style={{
textDecoration: props.completed ? 'line-through' : 'none'
}}
value={props.textInputValue}
onChange={props.onTextChange} // update state on change
/>
</form>
</div>
<div className="row justify-content-center input-group">
<input
className="form-control col-3 mt-2"
id="date"
type="date"
value={dateFix}
onChange={props.onDateChange}
/>
<span className="input-group-addon mt-2" id="basic-addon2">
Due Date
</span>
</div>
<div className="row justify-content-center mt-2">
<span className="btn">Selected Tag:</span>
<select
className="form-control col-2"
onChange={props.onTagChange}
value={props.tagInput}>
<option value="">None</option>
<option value="School">School</option>
<option value="Work">Work</option>
<option value="Home">Home</option>
{props.userCustomTags.map(tag => {
return (
<option key={tag} value={tag}>
{tag}
</option>
);
})}
</select>
<button
type="button"
className="btn btn-warning mx-2"
data-toggle="modal"
data-target="#customTag">
Create Custom Tag
</button>
<div id="customTag" className="modal fade" role="dialog">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-body">
<form>
<div className="form-group">
<label className="form-control-label">
New Custom Tag:
</label>
<input
className="form-control"
value={props.customTagInput}
onChange={props.onCustomTagChange}
id="tag-text"
/>
</div>
<button
type="submit"
className="btn btn-success mx-2 float-right"
data-dismiss="modal"
onClick={props.onCustomTagSubmit}>
Create
</button>
<button
type="button"
className="btn btn-secondary float-right"
data-dismiss="modal">
Close
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div className="row justify-content-sm-center mt-2">
<span className="">Add Comment Below:</span>
</div>
<div className="row justify-content-sm-center">
<RichTextEditor
className="my-1 col-md-6 "
value={props.richTextValue}
onChange={props.onRichTextEditorChange}
/>
</div>
<div className="row justify-content-sm-center mt-2">
<form
id="frmUploader"
encType="multipart/form-data"
onSubmit={event => props.onFileSubmit(event)}>
<input type="file" name="photo" onChange={props.onFileChange} />
<input
className="btn btn-success"
value="Upload"
type="submit"
onClick={event => props.onFileSubmit(event)}
/>
</form>
</div>
<div className="form-group row justify-content-sm-center">
<small id="fileHelp" className="form-text text-muted">
Upload a photo above to be attached to this todo item.
</small>
</div>
<div className="row justify-content-sm-center">
<button
className="col-sm-2 btn btn-item btn-success"
onClick={props.onSave}>
Save
</button>
<button
className="col-sm-2 btn btn-item btn-danger"
onClick={props.delete} /*ask CW about onClick={()=> callMethod() }*/>
Delete
</button>
</div>
</div>
);
};
export default TodoListItemEditView;
|
require.config({
shim: {
'input-mask': ['jquery']
},
paths: {
'input-mask': 'static/plugins/input-mask/js/jquery.mask.min'
}
});
require(['input-mask', 'jquery'], function(mask, $){
$(document).ready(function(){
$.applyDataMask('[data-mask]');
});
});
|
/**
* Created by xuwusheng on 15/11/16.
*
* 4pl Grid thead配置
* check:true //使用checkbox 注(选中后对象中增加pl4GridCheckbox.checked:true)
* checkAll:true //使用全选功能
* field:’id’ //字段名(用于绑定)
* name:’序号’ //表头标题名
* link:{
* url:’/aaa/{id}’ //a标签跳转 {id}为参数 (与click只存在一个)
* click:’test’ //点击事件方法 参数test(index(当前索引),item(当前对象))
* }
* input:true //使用input 注(不设置默认普通文本)
* type:text //与input一起使用 注(type:operate为操作项将不绑定field,与按钮配合使用,type:pl4GridCount表示序号列将会自动累加数字)
* buttons:[{
* text:’收货’, //显示文本
* call:’tackGoods’, //点击事件 参数tackGoods(index(当前索引),item(当前对象))
* type:’link button’ //类型 link:a标签 button:按钮
* state:'checkstorage', //跳转路由 注(只有当后台传回按钮数据op.butType=link 才会跳转)
* openModal:'#myModal', //打开模态框id
* style:’’ //设置样式
* }] //启用按钮 与type:operate配合使用 可多个按钮
* style:’width:10px’ //设置样式
* verify:{min:0,max:'field',field:'count'} //验证 {min:0|'field'(最小值或根据字段判断),max:10|'field'(最大值或根据字段判断),field:字段名}
*
*/
'use strict';
define(['../../../app'], function (app) {
app.factory('TakeGoods', ['$http','$q','$filter','HOST',function ($http,$q,$filter,HOST) {
return {
getThead: function () {
return [
{name:'序号',type:'pl4GridCount'},
{field:'taskId',name:'业务单号'},
{field:'orderID',name:'客户单号'},
{field:'fhTime',name:'发货日期'},
{field:'customerName',name:'客户'},
{field:'orderTypeName',name:'业务类型'},
{field:'chuhGoodCount',name:'应收数量'},
{field:'name11',name:'操作',type:'operate',style:'width:108px;',buttons:[{text:'打印',btnType:'btn',call:'print'},{text:'收货',btnType:'link',state:'checkstorage'}]}]//{text:'货位',call:'goodsAlloCall',openModal:'#goodsAlloModal'},{text:'确认',call:'enterGoodsAllo'}
},
getThead2: function () {
return [
{name:'序号',type:'pl4GridCount'},
{field:'taskId',name:'业务单号',link:{url:'#/main/takegoodsconfirm/{taskId}',click:'test'}},
{field:'orderID',name:'客户单号'},
{field:'fhTime',name:'发货日期'},
{field:'customerName',name:'客户'},
{field:'orderTypeName',name:'业务类型'},
{field:'chuhGoodCount',name:'应收数量'},
{field:'inDiffCount',name:'差异数量'},
{field:'name11',name:'操作',type:'operate',style:'width:108px;',buttons:[{text:'打印',btnType:'btn',call:'print'},{text:'查看',btnType:'link',state:'takegoodsconfirm'}]}]//{text:'货位',call:'goodsAlloCall',openModal:'#goodsAlloModal'},{text:'确认',call:'enterGoodsAllo'}
},
getSearch: function () {
var deferred=$q.defer();
$http.post(HOST+'/ckTaskIn/getDicLists',{})
.success(function (data) {
deferred.resolve(data);
})
.error(function (e) {
deferred.reject('error:'+e);
});
return deferred.promise;
},
getDataTable: function (data) {
//将parm转换成json字符串
data.param=$filter('json')(data.param);
var deferred=$q.defer();
$http.post(HOST+'/ckTaskIn/ckTaskInList',data)
.success(function (data) {
deferred.resolve(data);
})
.error(function (e) {
deferred.reject('error:'+e);
});
return deferred.promise;
}
}
}]);
});
|
import React from "react";
import classes from "./AttributeFilters.css";
import * as data from "../../../shared/data";
const attributeFilters = props => {
const attributes = data.ATTRIBUTES.map(attribute => (
<img
key={attribute}
className={
classes.Icon +
(props.attributes.includes(attribute) ? " " + classes.Active : "")
}
src={process.env.PUBLIC_URL + "/img/" + attribute + "_symbol.png"}
alt={attribute}
onClick={() => {
if (props.attributes.includes(attribute)) {
props.removeAttributeFilter(attribute);
} else {
props.addAttributeFilter(attribute);
}
}}
/>
));
return <React.Fragment>{attributes}</React.Fragment>;
};
export default attributeFilters;
|
/**
* Created by humengtao on 2016/12/1.
*/
class Game {
constructor(el, opt, cb) {
this.el = el;
// 包括所有block对象的数组
this.blocks = [];
// 值为空的block对象的数组
this.emptyBlocks = [];
this.isListenKeyPress = false;
this.score = 0;
if (!localStorage.getItem('2048record')) {
localStorage.setItem('2048record', 0);
}
this.record=localStorage.getItem('2048record');
// 默认options
this.defaults = {
// 定义空白格颜色
emptyColor: '#eeeeee',
// 定义从 2 到 2048 的颜色
blockColor_2: '#2e6da4',
blockColor_4: '#31b0d5',
blockColor_8: '#eea236',
blockColor_16: '#f0ad4e',
blockColor_32: '#c9302c',
blockColor_64: '#337ab7',
blockColor_128: '#398439',
blockColor_256: '#449d44',
blockColor_512: '#269abc',
blockColor_1024: '#ac2925',
blockColor_2048: '#2c2c2c',
// width:500px,height:500px
size: 500,
// 有些结束自动重新开始自动重新开始
autoRestart: true
};
// 限制最小的size为250
opt.size = (opt.size < 250) ? 250 : opt.size;
// 定义options
this.options = $.extend({}, this.defaults, opt);
// 接收用户输入的
this.cb = cb;
// merge callback
this.callback = () => {
((!!cb) ? cb : () => {
})(this.cb);
// 游戏结束后判断 autoRestart 参数
if (this.options.autoRestart) {
this.init();
}
}
}
// 初始化(复位)
init() {
this.el.html('');
this.blocks = [];
this.emptyBlocks = [];
this.score = 0;
this.record = localStorage.getItem('2048record');
this.start();
}
start() {
for (let i = 0; i < 16; i++) {
// 初始化16个block对像,并把 isEmpty 设置为 true
this.blocks.push(new Block('', i, true));
this.emptyBlocks.push(new Block('', i, true));
// 容器加入16个div映射
this.el.append('<div class="block" id="block' + i + '" data-position=' + i + '>').css({
width: this.options.size + 'px',
height: this.options.size + 'px',
});
}
$('.block').css({
margin: 0,
padding: 10 + 'px',
width: ((this.options.size / 4) - 23) + 'px',
height: ((this.options.size / 4) - 23) + 'px',
float: 'left',
color: '#fff',
borderWidth: 1 + 'px',
borderColor: '#fff',
borderStyle: 'double',
fontSize: (((this.options.size / 4) - 23) / 2) + 'px',
lineHeight: ((this.options.size / 4) - 23) + 'px',
textAlign: 'center',
transition: 0.4 + 's',
borderRadius: 10 + '%',
backgroundColor: this.options.emptyColor,
});
// 渲染页面
this.loadHtml();
// 启动键盘事件监听
if (!this.isListenKeyPress) {
this.moveListener();
}
}
moveListener() {
let _this = this;
let rowAll = [];
$(document).keypress((e) => {
// 检测按下键的charCode
switch (e.charCode) {
case 119:
rowAll = _this.getArrByFormat('column', 'asc');
break;
case 115:
rowAll = _this.getArrByFormat('column', 'desc');
break;
case 100:
rowAll = _this.getArrByFormat('row', 'desc');
break;
case 97:
rowAll = _this.getArrByFormat('row', 'asc');
break;
default:
return false;
}
// 开始移动
_this.move(rowAll);
// 移动完成产生新的block
_this.newBlock();
// 渲染页面
_this.loadHtml();
});
_this.isListenKeyPress = true;
}
move(rowAll) {
let _this = this;
rowAll.map((el, index) => {
// 标记位,表示有值且不能合并的 block 个数
let count = 0;
for (let i = 1; i < 4; i++) {
for (let j = i; j > count; j--) {
if (el[j - 1].value == 0) {
el[j - 1].value = el[j].value;
el[j].value = 0;
} else if (el[j].value != 0 && el[j - 1].value != 0) {
if (el[j].value == el[j - 1].value) {
el[j - 1].value *= 2;
el[j].value = 0;
_this.score += 222 * el[j - 1].value;
}
// 每合并成功或者失败以后 count++
count++;
}
_this.setValue(el[j].value, el[j].position);
_this.setValue(el[j - 1].value, el[j - 1].position);
}
}
});
}
// 根据输入参数将16个block 按行或列,顺序和倒序分为四个数组
getArrByFormat(direction, order) {
// 获取所有block
let arr = this.getAllBlocks();
// 建立四个数组分别承载每 行/列 的block
let row1 = [];
let row2 = [];
let row3 = [];
let row4 = [];
// rowAll用于承载格式化后的 row1 ,row2, row3, row4
let rowAll = [];
switch (direction) {
// 按行进行格式化
case 'row':
arr.map((el) => {
if (el.position >= 0 && el.position <= 3) {
row1.push(el)
}
else if (el.position >= 4 && el.position <= 7) {
row2.push(el)
}
else if (el.position >= 8 && el.position <= 11) {
row3.push(el)
}
else if (el.position >= 12 && el.position <= 15) {
row4.push(el)
}
});
switch (order) {
case 'asc':
break;
case 'desc':
row1.reverse();
row2.reverse();
row3.reverse();
row4.reverse();
break;
}
break;
// 按列进行格式化
case 'column':
arr.map((el) => {
if (el.position % 4 == 0) {
row1.push(el)
}
else if (el.position % 4 == 1) {
row2.push(el)
}
else if (el.position % 4 == 2) {
row3.push(el)
}
else if (el.position % 4 == 3) {
row4.push(el)
}
});
switch (order) {
case 'asc':
break;
case 'desc':
row1.reverse();
row2.reverse();
row3.reverse();
row4.reverse();
break;
}
break;
default:
break;
}
rowAll.push(row1, row2, row3, row4);
return rowAll;
}
getAllBlocks() {
let arr = [];
this.blocks.map((el) => {
arr.push(el);
});
return arr;
}
newBlock() {
if (this.emptyBlocks.length < 2) {
this.createBlock();
} else {
for (let i = 0; i < 2; i++) {
this.createBlock();
}
}
}
createBlock() {
// 刷新 emptyBlocks 数组(因为再方块移动后产生了变化,必须刷新)
this.freshEmptyBlocks();
// 产生随机数,最大不能超过emptyBlocks 数组的长度
let randomPosition = ~~(Math.random() * (this.emptyBlocks.length));
// 设置新block的初始值
this.setValue([2, 2, 4][~~(Math.random() * 3)], this.emptyBlocks[randomPosition].position);
// 再次刷新 emptyBlocks(因为产生了变化,必须刷新);
this.freshEmptyBlocks();
}
freshEmptyBlocks() {
let _this = this;
this.emptyBlocks = [];
this.blocks.map((el) => {
if (el.value == 0) {
el.value = '';
}
if (el.isEmpty == true) {
_this.emptyBlocks.push(el);
}
});
}
loadHtml() {
let _this = this;
$('.block').map((index) => {
let bgColor = _this.blocks[index].bgColor;
$('.block:nth-child(' + (index + 1) + ')').css('backgroundColor', bgColor).html(_this.blocks[index].value);
});
$('.score span').text(this.score);
$('.record span').text((this.score > this.record) ? this.score : this.record);
if (this.score > this.record)
localStorage.setItem('2048record', this.score);
// 当没有空block 进行判断游戏是否结束
if (this.emptyBlocks.length == 0) {
if (this.isEnd()) {
setTimeout(() => {
_this.callback();
}, 500);
}
}
}
setValue(value, index) {
this.blocks[index].value = value;
if (value == 0) {
this.blocks[index].bgColor = this.options.emptyColor;
this.blocks[index].isEmpty = true;
} else {
switch (value) {
case 2:
this.blocks[index].bgColor = this.options.blockColor_2;
break;
case 4:
this.blocks[index].bgColor = this.options.blockColor_4;
break;
case 8:
this.blocks[index].bgColor = this.options.blockColor_8;
break;
case 16:
this.blocks[index].bgColor = this.options.blockColor_16;
break;
case 32:
this.blocks[index].bgColor = this.options.blockColor_32;
break;
case 64:
this.blocks[index].bgColor = this.options.blockColor_64;
break;
case 128:
this.blocks[index].bgColor = this.options.blockColor_128;
break;
case 256:
this.blocks[index].bgColor = this.options.blockColor_256;
break;
case 512:
this.blocks[index].bgColor = this.options.blockColor_512;
break;
case 1024:
this.blocks[index].bgColor = this.options.blockColor_1024;
break;
case 2048:
this.blocks[index].bgColor = this.options.blockColor_2048;
break;
}
this.blocks[index].isEmpty = false;
}
}
isEnd() {
let arr = this.getAllBlocks();
let isEnd = true;
arr.map((el, index) => {
if (!!arr[index + 1]) {
if (arr[index].value == arr[index + 1].value) {
isEnd = false;
}
}
if (!!arr[index - 1]) {
if (arr[index].value == arr[index - 1].value) {
isEnd = false;
}
}
if (!!arr[index + 4]) {
if (arr[index].value == arr[index + 4].value) {
isEnd = false;
}
}
if (!!arr[index - 4]) {
if (arr[index].value == arr[index - 4].value) {
isEnd = false;
}
}
});
return isEnd;
}
}
class Block {
constructor(value, position, isEmpty) {
this.value = value;
this.position = position;
this.isEmpty = isEmpty;
this.bgColor = null;
}
}
(function ($) {
let initGame = '';
$.fn.game = function (option, callback) {
if (!!initGame) {
initGame.init();
} else {
initGame = new Game(this, option, callback);
initGame.init();
}
return this;
};
})(jQuery);
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var resetHistory = exports.resetHistory = function resetHistory() {
return {
type: 'RESET_HISTORY'
};
};
var navigateTo = exports.navigateTo = function navigateTo(routeName, params) {
return {
type: 'NAVIGATE_TO',
route: {
name: routeName,
params: params
}
};
};
var transiteTo = exports.transiteTo = function transiteTo(routeName, params) {
return {
type: 'TRANSITE_TO',
route: {
name: routeName,
params: params
}
};
};
var goBack = exports.goBack = function goBack() {
return {
type: 'GO_BACK'
};
};
var goTo = exports.goTo = function goTo(routeName, params) {
return {
type: 'GO_TO',
route: {
name: routeName,
params: params
}
};
};
|
/*
* GET home page.
*/
exports.login = function(req, res){
res.render('user/login');
};
exports.document = function(req, res){
res.render('document/index');
};
exports.partials = function (req, res) {
var name = req.params.name;
res.render('partials/' + name);
};
|
import React from 'react'
import whiteLogo from '../../assets/images/whiteLogo.svg'
import './styles.css'
function HorizontalLogo(){
return(
<div id="horizontal-logo-container">
<img src={whiteLogo}/>
<h1>Jo<b>Bee</b></h1>
</div>
);
}
export default HorizontalLogo;
|
import React, { Component } from 'react';
import { Button,Col,Row} from 'antd';
import './header.css';
class Header extends Component {
render() {
return (
<header className="header">
<Row>
<Col span={18} offset={2}>
<Col span={6}><img src={require('../img/logo.png')} alt="#"/></Col>
<Col span={6}><h1>餐厅大师</h1></Col>
<Col span={12}>
<ul>
<li>
<a href="#">登录</a>
</li>
<li>
<a href="#">注册</a>
</li>
<li>
<a href="#">收藏</a>
</li>
<li>
<a href="#">首页</a>
</li>
</ul>
</Col>
</Col>
</Row>
</header>
);
}
}
export default Header;
|
/**
* 物流信息
*/
import React, { Component, PureComponent } from 'react';
import {
StyleSheet,
Dimensions,
Text,
View,
Image,
ScrollView,
TouchableOpacity,
} from 'react-native';
import { connect } from 'rn-dva';
import moment from 'moment';
import CommonStyles from '../../../common/Styles';
import Header from '../../../components/Header';
import Content from '../../../components/ContentItem';
import { fetchlogisticsQuery } from '../../../config/Apis/order';
import NavigatorService from '../../../common/NavigatorService';
import { POST_COMPANY_MAP } from '../../../const/order';
const { width, height } = Dimensions.get('window');
const wuliucar = require('../../../images/shopOrder/wuliucar.png');
function getwidth(val) {
return width * val / 375;
}
export default class LogisticsInform extends Component {
state = {
data: {},
}
componentDidMount() {
const { orderId } = this.props.navigation.state.params;
// console.log('params',this.props.navigation.state.params)
const param = {
orderId,
orderType: 'NORMAL',
xkModule: 'shop',
logisticsType: 'MUSER',
};
fetchlogisticsQuery(param).then((res) => {
this.setState({
data: res,
});
}).catch(err => {
console.log(err)
});
}
renderLog = () => {
const { data } = this.state;
if (data.list) {
return data.list.map((item, index) => {
if (index === 0) {
return (
<View style={styles.logsItem}>
<View style={styles.icoroundcontent}>
<View style={styles.iconround} />
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Image source={wuliucar} style={{ marginRight: 10 }} />
{
data.isSign == 1 ? (
<Text style={styles.c2f12}>已签收</Text>
) : (
<Text style={styles.c2f12}>运输中</Text>
)
}
</View>
<Text style={styles.c9f12}>{item.location}</Text>
<Text style={styles.c9f12}>{moment(item.time * 1000).format('YYYY-MM-DD HH:mm')}</Text>
</View>
</View>
);
}
return (
<View style={styles.logsItem}>
<View style={styles.icoroundcontent}>
<View style={styles.iconround} />
<Text style={styles.c9f12}>{item.location}</Text>
<Text style={styles.c9f12}>{moment(item.time * 1000).format('YYYY-MM-DD HH:mm')}</Text>
</View>
</View>
);
});
}
return null;
}
render() {
const { navigation } = this.props;
const { data } = this.state;
const { page } = navigation.state.params || {};
return (
<View style={styles.container}>
<Header
navigation={navigation}
title="物流信息"
leftView={(
<TouchableOpacity
style={[styles.headerItem, styles.left]}
onPress={() => {
if (page === 'entry') {
const route = NavigatorService.findRouteByRouteName('ChooseStream');
route && route.params.callback && route.params.callback(); // 更新数据
console.log(route);
NavigatorService.popToRouteName('GoodsTakeOut');
} else {
navigation.goBack();
}
}}
>
<Image style={styles.backStyle} source={require('../../../images/header/back.png')} />
</TouchableOpacity>
)}
/>
<ScrollView contentContainerStyle={{
flex: 1, width, alignItems: 'center', justifyContent: 'flex-start',
}}
>
<Content style={styles.topontent}>
<Text style={styles.c2f14}>
{`快递公司:${POST_COMPANY_MAP.get(data.companyName)}`}
</Text>
<Text style={styles.c2f14}>
{`快递单号:${data.number}`}
</Text>
</Content>
{
data.list && (
<Content style={styles.bottomcontent}>
{
this.renderLog()
}
</Content>
)
}
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
...CommonStyles.containerWithoutPadding,
alignItems: 'center',
},
c2f14: {
color: '#222222',
fontSize: 14,
},
c2f12: {
color: '#222222',
fontSize: 12,
},
c9f12: {
color: '#999999',
fontSize: 12,
},
topontent: {
width: getwidth(355),
height: 73,
justifyContent: 'space-around',
paddingHorizontal: 15,
},
bottomcontent: {
width: getwidth(355),
maxHeight: height - 100,
paddingVertical: 20,
},
logsItem: {
width: getwidth(355),
height: 65,
paddingHorizontal: 12,
},
icoroundcontent: {
borderLeftColor: '#D8D8D8',
borderLeftWidth: 1,
height: '100%',
paddingHorizontal: 15,
},
iconround: {
backgroundColor: '#4A90FA',
width: 10,
height: 10,
borderRadius: 10,
position: 'absolute',
left: -5,
top: -5,
},
headerItem: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
height: '100%',
},
left: {
width: 50,
},
backStyle: {
tintColor: 'white',
},
});
|
import React from "react";
import "./OutputPhoto.css";
function FaceOutline({ faceBox }) {
return (
<div
className="FaceOutline"
style={{
top: faceBox.topBorder,
left: faceBox.leftBorder,
height: faceBox.heightFace,
width: faceBox.widthFace
}}
></div>
);
}
export default FaceOutline;
|
var socket = io();
var locationButton = $('#send-location');
var leaveRoomButton = $('#leave-room')
var params = $.deparam(window.location.search);
function scrollToBottom () {
// Selectors
var messages = $('#messages')
var newMessage = messages.children('li:last-child')
// Heights
var clientHeight = messages.prop('clientHeight');
var scrollTop = messages.prop('scrollTop');
var scrollHeight = messages.prop('scrollHeight');
var newMessageHeight = newMessage.innerHeight();
var lastMesageHeight = newMessage.prev().innerHeight();
if (clientHeight + scrollTop + newMessageHeight + lastMesageHeight >= scrollHeight) {
messages.scrollTop(scrollHeight);
}
}
// CLIENT CONNNECTED TO SERVER
socket.on('connect', function () {
socket.emit('join', params, function (err) {
if (err) {
alert(err);
window.location.href="/chat"
} else {
console.log('no error');
}
})
});
// ___________________________
// CLIENT DISCONNECTED TO SERVER
socket.on('disconnect', function() {
console.log('disconnected from server')
});
// ___________________________
// JQUERY EVENTS:
// LISTENERS:
// ___________________________
// USER IN OUT LISTENER
socket.on('userInOut', function(message) {
var formattedDateTime = moment(message.createdAt).format('MMM Do, YYYY, h:mm a')
var template = $('#user-join-message-template').html();
var html = Mustache.render(template, {
createdAt: formattedDateTime,
text: message.text
});
$('[data=new-user]').append(html);
});
// ___________________________
// NEW MESSAGE LISTENER
socket.on('newMessage', function(message) {
var formattedDateTime = moment(message.createdAt).format('MMM Do, YYYY, h:mm a')
var template = $('#message-template').html();
var html = Mustache.render(template, {
from: message.from,
text: message.text,
createdAt: formattedDateTime
});
$('#messages').append(html);
scrollToBottom();
});
// NEW LOCATION MESSAGE LISTENER
socket.on('newLocationMessage', function(message) {
var formattedDateTime = moment(message.createdAt).format('MMM Do, YYYY, h:mm a')
var template = $('#location-message-template').html();
var html = Mustache.render(template, {
from: params['display-name'],
createdAt: formattedDateTime,
url: message.url
})
$('#messages').append(html);
scrollToBottom();
});
// ___________________________
// SUBMIT MESSAGE HANDLER
$('#message-form').on('submit', function(e) {
e.preventDefault();
var messageTextBox = $('[name=message]')
socket.emit('createMessage', {
from: params['display-name'],
text: messageTextBox.val(),
room: params['room-name']
}, function (data) {
messageTextBox.val('')
console.log(data);
});
});
// ___________________________
// SEND LOCATION CLICK HANDLER
locationButton.on('click', function() {
if (!navigator.geolocation) {
return alert('Geolocation not supported by your browser');
}
locationButton.attr('disabled', 'disabled').text('Sending Location...');
navigator.geolocation.getCurrentPosition(function (position) {
locationButton.prop('disabled', false).text('Send Location');
socket.emit('createLocationMessage', {
latitude: position.coords.latitude,
longitude: position.coords.longitude,
room: params['room-name']
}, function(data) {
console.log(data);
})
}, function() {
locationButton.prop('disabled', false);
alert('unable to fetch location').text('Send Location');
});
});
// ___________________________
// LEAVE ROOM CLICK HANDLER
leaveRoomButton.on('click', function() {
window.location.href="/chat"
socket.emit('leaveRoom', params)
});
|
var AppServices = angular.module('AppServices', []);
AppServices.service('Phone', function($http){
this.query=function(){
return $http({
method:'Get',
url:'phones/phones.json'
})
};
this.querydetail=function(id){
/* return $http({
method:'Get',
url:'phones/motorola-xoom.json'
}) */
/* return $http.get('phones/motorola-xoom.json'); */
var url='phones/'+id+'.json';
return $http.get(url);
};
});
|
/**
* Created by zhuo on 2017/9/11.
*/
class Entity {
constructor(name) {
name = name || "你爸爸";
this.name = name;
}
effectFrom(item, src) {
console.info(this.name + ' effected from item ' + item.name + ' by ' + src.name);
}
wearEquipment(item, src) {
console.info(this.name + ' wear equipment ' + item.name);
}
}
class LiveObject extends Entity{
constructor(name,mh,pp,mp,pd,md,speed){
super(name);
this.maxHealth = mh || 9999999;
this.health = this.maxHealth;
this.pysicPower = pp || 0;
this.magicPower = mp || 0;
this.pysicDefense = pd || 0;
this.magicDefense = md || 0;
this.speed = speed || 0;
}
subProperty(mh, pp, mp, pd, md) {
this.maxHealth -= mh || 0;
this.pysicPower -= pp || 0;
this.magicPower -= mp || 0;
this.pysicDefense -= pd || 0;
this.magicDefense -= md || 0;
}
addProperty(mh, pp, mp, pd, md) {
this.maxHealth += mh || 0;
this.pysicPower += pp || 0;
this.magicPower += mp || 0;
this.pysicDefense += pd || 0;
this.magicDefense += md || 0;
}
effectFromItem(item){
// this.addProperty(item.maxHealth,item.pysicPower,item.magicPower,
// item.pysicDefense,item.magicDamage);
//道具生效
if(item.effective){
item.effective(this);
}
}
healthChange(damage) {
damage = damage || 0;
this.health -= damage;
if(this.health > this.maxHealth){
this.health = this.maxHealth;
}
// console.info('Life health changed! ' + this.health);
//log
// fightState.addLog(this.name+'受到了'+damage+'点伤害');
}
damageFrom(pysicDamage,magicDamage,realDamage){
pysicDamage = pysicDamage || 0;
magicDamage = magicDamage || 0;
realDamage = realDamage || 0;
if (pysicDamage > 0) {//如果是伤害道具
pysicDamage = pysicDamage - this.pysicDefense;
if(pysicDamage < 0)pysicDamage = 0;
}
if (magicDamage > 0) {//如果是伤害道具
magicDamage = magicDamage - this.magicDefense;
if(magicDamage < 0)magicDamage =0;
}
// console.log('物理伤害结算后'+pysicDamage+' 魔法伤害结算后:'+magicDamage);
var sum = pysicDamage+magicDamage+realDamage;
fightState.addLog(this.name+'受到了'+sum+'点伤害');
this.healthChange(sum);
}
}
|
const sequelize = require('../database/db').sequelize;
const initModels = require('./init-models').initModels;
const UserRoles = require('./UserRoles');
const models = initModels(sequelize);
module.exports.Physician = models.Physician;
module.exports.User = models.User;
module.exports.Patient = models.Patient;
module.exports.Secretary = models.Secretary;
module.exports.Admin = models.Admin;
module.exports.FirstVisit = models.FirstVisit;
module.exports.HasBledStage = models.HasBledStage;
module.exports.Cha2ds2vascScore = models.Cha2ds2vascScore;
module.exports.WarfarinWeekDosage = models.WarfarinWeekDosage;
module.exports.DrugInfo = models.DrugInfo;
module.exports.WarfarinDosageRecord = models.WarfarinDosageRecord;
module.exports.PatientMedicationRecord = models.PatientMedicationRecord
module.exports.Visit = models.Visit;
module.exports.VisitAppointment = models.VisitAppointment;
module.exports.Place = models.Place;
module.exports.UserPlace = models.UserPlace;
module.exports.PatientToPhysicianMessage = models.PatientToPhysicianMessage
module.exports.PhysicianToPatientMessage = models.PhysicianToPatientMessage
module.exports.DomainNameTable = models.DomainNameTable;
module.exports.UserRoles = UserRoles;
|
import {
home, about, rules, game,
} from './src/view/html';
import { addToMain } from './src/helpers/functions';
import './style.scss';
import { promise } from './src/promise-of-unity';
// import $ from 'jquery';
// import axios from 'axios';
const btnHome = document.getElementById('btn-home');
btnHome.addEventListener('click', (e) => {
e.preventDefault();
addToMain(home);
document.getElementById('game-container').style.display = 'none';
});
const btnAbout = document.getElementById('btn-about');
btnAbout.addEventListener('click', (e) => {
e.preventDefault();
addToMain(about);
document.getElementById('game-container').style.display = 'none';
});
const btnRules = document.getElementById('btn-rules');
btnRules.addEventListener('click', (e) => {
e.preventDefault();
addToMain(rules);
document.getElementById('game-container').style.display = 'none';
});
const btnPlay = document.getElementById('btn-play');
btnPlay.addEventListener('click', (e) => {
e.preventDefault();
addToMain('');
document.getElementById('game-container').style.display = 'block';
promise();
});
const score = 0;
// si le score recu est plus grand que le score du webgl, tu mets le nouveau score dans le localstorage (HIGHSCORE), un seul highscore.
// boucle for
// bonus : array qui contient pour chaque partie le score (fait de pouvoir identifier une partie a instant T genre date) + score (objets)
// json stringify pour mettre dans local storage puis json.parse pour
|
//JavaScript Framework 2.0 Code
try{
Type.registerNamespace('com.yonyou.rc.MainViewController');
com.yonyou.rc.MainViewController = function() {
com.yonyou.rc.MainViewController.initializeBase(this);
this.initialize();
}
function com$yonyou$rc$MainViewController$initialize(){
//you can programing by $ctx API
//get the context data through $ctx.get()
//set the context data through $ctx.push(json)
//set the field of the context through $ctx.put(fieldName, fieldValue)
//get the parameter of the context through $ctx.param(parameterName)
//Demo Code:
// var str = $ctx.getString(); //获取当前Context对应的字符串
// alert($ctx.getString()) //alert当前Context对应的字符串
// var json = $ctx.getJSONObject(); //获取当前Context,返回值为json
// json["x"] = "a"; //为当前json增加字段
// json["y"] = []; //为当前json增加数组
// $ctx.push(json); //设置context,并自动调用数据绑定
//
// put方法需手动调用databind()
// var x = $ctx.get("x"); //获取x字段值
// $ctx.put("x", "b"); //设置x字段值
// $ctx.put("x", "b"); //设置x字段值
// $ctx.databind(); //调用数据绑定才能将修改的字段绑定到控件上
// var p1 = $param.getString("p1"); //获取参数p2的值,返回一个字符串
// var p2 = $param.getJSONObject("p2"); //获取参数p3的值,返回一个JSON对象
// var p3 = $param.getJSONArray("p3"); //获取参数p1的值,返回一个数组
//your initialize code below...
}
function com$yonyou$rc$MainViewController$evaljs(js){
eval(js)
}
function com$yonyou$rc$MainViewController$loadlist(sender, args){
$js.hideLoadingBar();
$js.showLoadingBar();
_$sys.callAction('loadlist');
}
function com$yonyou$rc$MainViewController$onItemClick(sender, args){
var row = $id("listviewdefine0").get("row");
row = stringToJSON(row);
var pk_informer = row.pk_informer;
$view.open({
"viewid" : "com.yonyou.rc.ClaimDetail",//目标页面(首字母大写)全名,
"isKeep" : "true",//保留当前页面不关闭
"pk_informer" : pk_informer,
"selectedrow" : row,
"from" : "mainview",
"callback":"openDetailCallBack()"//回调的JS方法
});
}
function openDetailCallBack(){
var from = $param.getString("from");
if ("detailpage" == from){
$js.showLoadingBar();
_$sys.callAction('loadlist');
}
}
function com$yonyou$rc$MainViewController$handleexception(sender,args){
$js.hideLoadingBar();
}
function com$yonyou$rc$MainViewController$loadlistcallback(sender,args){
$js.hideLoadingBar();
/*var json = $ctx.getJSONObject();
var length = json.releasedefjsonlist.length;
if(typeof(length) != "undefined" && length != 0){
$badge.showBadge({
"target" : "tabbaritem0",//要显示角标的目标控件的id
"text" : length,//角标显示的内容
"position" : "topright"//显示在target控件的位置 topright | topleft | bottomright | bottomleft
})
}*/
}
com.yonyou.rc.MainViewController.prototype = {
onItemClick : com$yonyou$rc$MainViewController$onItemClick,
loadlist : com$yonyou$rc$MainViewController$loadlist,
initialize : com$yonyou$rc$MainViewController$initialize,
evaljs : com$yonyou$rc$MainViewController$evaljs,
handleexception : com$yonyou$rc$MainViewController$handleexception,
loadlistcallback : com$yonyou$rc$MainViewController$loadlistcallback
};
com.yonyou.rc.MainViewController.registerClass('com.yonyou.rc.MainViewController',UMP.UI.Mvc.Controller);
}catch(e){$e(e);}
|
(function(){
/*可为参数*/
var HorB=$(document.documentElement);
var title=$(".wraptitle .title");
var floatArea=$(".wraptitle .floatArea");
var fa=$(".floatArea .part2 a");
var pa=$(".previewCatalog dd a");
/*左侧章节点击效果类名*/
var tmpa = $(".template1 .article .side .previewCatalog dl dd a");
var changedStyle = "";
if (tmpa != undefined && tmpa.eq(0)[0] != undefined) {
var a = tmpa.eq(0)[0].className;
var arr = a.split(" ");
changedStyle = arr[1];
}
/*浮动条显隐*/
$(window).scroll(function()
{
var sTop=document.documentElement.scrollTop || document.body.scrollTop;
if(HorB.width()>1046)
{
if(sTop>=350)
{
title.css("visibility","hidden");
floatArea.slideDown(200);
}
if(sTop<350)
{
title.css("visibility","visible");
floatArea.slideUp(200);
}
}
})
/*浮动章节跳动事件*/
fa.click(function()
{
var index=fa.index(this);
syncStyle(index)
})
/*左侧固定章节跳动*/
pa.click(function()
{
var index=pa.index(this);
syncStyle(index)
})
/*浮动章节跳动事件*/
function syncStyle(index)
{
pa.removeClass(changedStyle);
pa.eq(index).addClass(changedStyle);
fa.removeClass("current");
fa.eq(index).addClass("current");
ChapterPos(index);
}
/*章节定位到顶部一定位置函数*/
function ChapterPos(index)
{
var obj=$(".chapter").eq(index).offset();
/*标准模式与兼容模式*/
if(document.body.scrollTop)
{
$(document.body).animate({scrollTop:obj.top-90},200);
}
else
{
$(document.documentElement).animate({scrollTop:obj.top-90},200);
}
}
/*目录简介显隐*/
//$(".paragraph .chapter .item .title").click(function()
//{
// //var vitem = $(this).parent().siblings();
// //var vchapter = $(this).parent().parent().siblings();
// //$.each(vitem, function (index, element) {
// // element.find(".frame").hide();
// //});
// //$.each(vchapter, function (index, element) {
// // element.find(".frame").hide();
// //});
// //$(this).siblings().slideToggle(200);
// $(this).siblings(".paragraph .chapter .item .frame").slideToggle(200);
//})
/*目录简介显隐*/
var itemx = $(".template1 .article .catalog .paragraph .chapter .item");
var frame = itemx.children(".frame");
var time = 200;
itemx.click(function () {
//if ($(this).children(".frame").css("display") != "block") {
// frame.slideUp(time);
// $(this).children(".frame").slideDown(time);
//}
//点击当前文章标题,如果是展开,再点击则关闭,如果是关闭,则展开
frame.slideUp(time);
if ($(this).children(".frame").css("display") != "block") {
$(this).children(".frame").slideDown(time);
}
else {
$(this).children(".frame").slideUp(time);
}
})
/*窗口大小变动浮动显隐*/
$(window).resize(function()
{
var sTop=document.documentElement.scrollTop || document.body.scrollTop;
if(HorB.width()<=1046)
{
title.css("visibility","visible");
floatArea.css("display","none");
}
else
{
if(sTop>=350)
{
title.css("visibility","hidden");
floatArea.css("display","block");
}
else
{
title.css("visibility","visible");
floatArea.css("display","none");
}
}
})
/*左侧简介显示更多*/
/*左侧简介显示更多*/
var content = $(".template1 .article .side .intro .content");
var backToMore = $(".template1 .article .side .intro .back");
var more = $(".template1 .article .side .intro .more");
more.css({ "display": "none" });
if (content.height() > 200) {
content.addClass("limitedHeight");
more.css({ "display": "block" });
}
more.click(function()
{
if(content.hasClass("limitedHeight"))
{
content.removeClass("limitedHeight");
$(this).css("display","none");
backToMore.css("display","block")
}
})
$(".template1 .article .side .intro .back").click(function()
{
content.addClass("limitedHeight");
$(this).css("display","none");
more.css("display","block");
})
})()
|
var struct_mikkeo_1_1_colour_1_1_h_s_b_color =
[
[ "HSBColor", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#a4fe4468cc6e9dd7181ad8c0f315e5189", null ],
[ "HSBColor", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#ad46e388d1b4d4b45a759372aed0a8176", null ],
[ "HSBColor", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#a1e407d5c5f321c8c046ac3e531d6de04", null ],
[ "ToColor", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#a30f3f03503bc620f7bc7e37f783bfee4", null ],
[ "ToString", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#ae7a646ab139656af3ca05056c4d90c3a", null ],
[ "a", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#a9042c66e979e55cd1b6e04e64470e468", null ],
[ "b", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#afed08c1798d410979a8fbef3787384e5", null ],
[ "h", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#a02a8b048ad3e20a748c5caa27d11273e", null ],
[ "s", "struct_mikkeo_1_1_colour_1_1_h_s_b_color.html#ab7d0e76376413147a3d5b26f8ed5da1a", null ]
];
|
import Tone from "tone";
export const createLoop = callback => {
var loop = new Tone.Loop(callback, "8n").toMaster().start(0);
};
export const createArp = (gin, store, sequence, pattern) => {
var arp = new Tone.Pattern(callback, sequence, pattern || "downUp").toMaster().start(0);
arp.pattern = pattern || "downUp";
};
|
const fs = require('fs')
const config = require('../../config.json')
const storage = require('../../util/storage.js')
exports.normal = function (bot, message, skipMessage) {
const cookieAccessors = storage.cookieAccessors
if (!config.advanced || config.advanced.restrictCookies !== true || !config.advanced.restrictCookies) return message.channel.send(`Cannot disallow cookies if config \`restrictCookies\` is not set to \`true\`/\`1\`.`)
const content = message.content.split(' ')
if (content.length !== 2) return message.channel.send(`The proper syntax to allow cookies for a user is \`${config.botSettings.prefix}disallowcookies <userID>\`.`)
const userID = content[1]
const user = bot.users.get(userID)
const username = user.username
for (var index in cookieAccessors.ids) {
if (cookieAccessors.ids[index] === userID) {
cookieAccessors.ids.splice(index, 1)
try {
fs.writeFileSync('./settings/cookieAccessors.json', JSON.stringify(cookieAccessors, null, 2))
if (!skipMessage) message.channel.send(`User ID \`${userID}\` (${user ? username : 'User not found in bot user list.'}) removed from cookie accessor list.`)
console.log(`Bot Controller: User ID ${userID} (${user ? username : 'User not found in bot user list.'}) removed from cookie accessor list by (${message.author.id}, ${message.author.username}).`)
return true
} catch (e) {
console.log(`Bot Controller: Unable to write to file cookieAccessors for command disallowcookies: `, e.message || e)
message.channel.send(`Unable to write to file cookieAccessors for command disallowcookies.`, e.message || e)
}
}
}
message.channel.send(`Cannot remove. User ID \`${userID}\` was not found in list of cookie accessors.`)
}
exports.sharded = function (bot, message, Manager) {
if (exports.normal(bot, message, true) !== true) return
if (!config.advanced || config.advanced.restrictCookies !== true || !config.advanced.restrictCookies) return message.channel.send(`Cannot disallow cookies if config \`restrictCookies\` is not set to \`true\`/\`1\`.`)
const content = message.content.split(' ')
if (content.length !== 2) return message.channel.send(`The proper syntax to allow cookies for a user is \`${config.botSettings.prefix}disallowcookies <userID>\`.`)
const userID = content[1]
bot.shard.broadcastEval(`
const appDir = require('path').dirname(require.main.filename);
const cookieAccessors = require(appDir + '/util/storage.js').cookieAccessors;
for (var index in cookieAccessors.ids) {
if (cookieAccessors.ids[index] === '${userID}') {
cookieAccessors.ids.splice(index, 1);
break;
}
}
`).then(results => {
message.channel.send(`User ID \`${userID}\` removed from cookie accessor list.`)
}).catch(err => console.log(`Bot Controller: Unable to eval update cookieAccessors after disallowcookies. `, err.message || err))
}
|
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { click, fillIn, render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import contributors from '../../../fixtures/contributors';
import contributions from '../../../fixtures/contributions';
module('Integration | Component | contribution-list', function(hooks) {
setupRenderingTest(hooks);
test('it renders all contributions', async function(assert) {
this.set('fixtures', contributions);
await render(hbs`{{contribution-list contributions=fixtures}}`);
assert.equal(this.element.querySelectorAll('li').length, 9);
});
test('it renders filtered contributions', async function(assert) {
let kredits = this.owner.lookup('service:kredits');
kredits.set('contributors', contributors);
this.set('fixtures', contributions);
await render(hbs`{{contribution-list contributions=fixtures showQuickFilter=true}}`);
await fillIn('.filter-contributor select', '1');
assert.equal(this.element.querySelectorAll('li').length, 5, 'select contributor');
await click('.filter-contribution-size input');
assert.equal(this.element.querySelectorAll('li').length, 4, 'hide small contributions');
await fillIn('.filter-contribution-kind select', 'dev');
assert.equal(this.element.querySelectorAll('li').length, 1, 'select kind');
});
});
|
import React, { useCallback } from 'react';
import clsx from 'clsx'
import theme from "../../Theme"
import history from '../AppRouter/createHistory';
import { logout } from "../../redux/actions/authActions/authActions";
import { useSelector, useDispatch } from 'react-redux';
import { TOGGLE_DRAWER } from '../../redux/actions/uiActions/uiActionTypes';
import { AppBar, Toolbar, Typography, Button, IconButton } from '@material-ui/core';
import MenuIcon from '@material-ui/icons/Menu';
const useStyles = theme;
export const Header = () => {
const classes = useStyles();
const dispatch = useDispatch();
const isOpen = useSelector(state => state.UI.drawerIsOpen);
const toggleDrawer = useCallback(() => dispatch({ type: TOGGLE_DRAWER }), [dispatch])
const logoutAction = () => {
if (isOpen) {
toggleDrawer();
}
logout(dispatch);
history.push("/");
};
return (
<AppBar position="absolute" className={clsx(classes.appBar, isOpen && classes.appBarShift)}>
<Toolbar>
<IconButton
edge="start"
color="inherit"
aria-label="Open drawer"
onClick={toggleDrawer}
className={clsx(classes.menuButton, isOpen && classes.menuButtonHidden)}
>
<MenuIcon />
</IconButton>
<Typography
component="h1"
variant="subtitle2"
color="inherit"
noWrap
className={classes.title}>
Overwatch SR Tracker
</Typography>
<Button
onClick={logoutAction}
className={clsx("", isOpen && classes.menuButtonHidden)}
variant={"contained"}
color={"secondary"}
size={"small"}>
Logout
</Button>
</Toolbar>
</AppBar>
)
};
export default Header;
|
const { h } = require('hyperapp')
import Toast from './Toast.js'
const ToastContainer = module.exports = ({toasts, actions}) => <div className='toast-container'>
{toasts.map((t) => <Toast text={t.text} style={t.style} actions={actions} />)}
</div>
|
var Modeler = require("../Modeler.js");
var className = 'Typedemographicscontact';
var Typedemographicscontact = function(json, parentObj) {
parentObj = parentObj || this;
// Class property definitions here:
Modeler.extend(className, {
email: {
type: "Typedemographicsemail",
wsdlDefinition: {
minOccurs: 0,
maxOccurs: "unbounded",
name: "email",
type: "tns:demographicsemail",
"s:annotation": {
"s:documentation": "Specific Email details for Applicant"
}
},
mask: Modeler.GET | Modeler.SET | Modeler.ARRAY,
required: false
},
telephone: {
type: "Typedemographicstelephone",
wsdlDefinition: {
minOccurs: 0,
maxOccurs: "unbounded",
name: "telephone",
type: "tns:demographicstelephone",
"s:annotation": {
"s:documentation": "Specific Telephone details for Applicant"
}
},
mask: Modeler.GET | Modeler.SET | Modeler.ARRAY,
required: false
}
}, parentObj, json);
};
module.exports = Typedemographicscontact;
Modeler.register(Typedemographicscontact, "Typedemographicscontact");
|
import React, { Component } from 'react';
import { connect } from 'react-redux'
import { Actions} from 'react-native-router-flux';
import { Text, View, ScrollView, KeyboardAvoidingView, Alert, TouchableOpacity} from 'react-native';
import Modal from 'react-native-modal'; // 2.4.0
const a = require('../../constants/action');
const r = require('../../constants/require');
const constant = require('../../constants/constant');
const styles = r.CSS.styles;
class Room extends Component {
constructor(props) {
super(props);
this.props.dispatch(
{
type: a.BASIC_TAB_SET_PAGE,
data: 1
}
);
if (this.props.basic_tab.child == false) {
Actions.LOADING();
r.SOCKET.api13();
} else {
this.props.dispatch(
{
type: a.BASIC_TAB_SET_CHILD,
data: false
}
);
this.props.dispatch(
{
type: a.ROOM_MODAL_INIT,
}
);
}
}
/**
* 部屋をつくる
*/
modal_submit = () => {
const name = this.props.room.modal_textinput;
if(name.length == 0){
Alert.alert('部屋名が未入力です');
return;
}
const data = {
NAME: this.props.room.modal_textinput,
ROOM_UPPER: this.props.room.modal_pulldown,
};
r.SOCKET.api2(data);
this.props.dispatch(
{
type: a.ROOM_MODAL_INIT,
}
);
Actions.LOADING();
}
/**
* 入室
*/
entering_button (id) {
Alert.alert(
'Alert',
'入室しますか?',
[
{text: 'いいえ',
onPress: () => {
},
style: 'cancel'
},
{text: 'はい',
onPress: () => {
Actions.LOADING();
const data = {
DEAR : id
};
r.SOCKET.api4(data);
}
}
],
{ cancelable: false }
);
}
/**
* render
*/
render() {
const data = this.props.room.data[1];
let html = [];
if (data != constant.EMPTY) {
html = r.ROOM_PRODUCT.room_list(data, this);
}
const modal_html = r.ROOM_PRODUCT.modal_html(this);
return (
<KeyboardAvoidingView behavior="padding" style={styles.keybord}>
<View style={styles.root}>
<ScrollView contentContainerStyle={{ flexGrow: 1}}>
<View style={styles.basic_box}>
<TouchableOpacity
style={styles.room_create}
onPress={
() =>
this.props.dispatch(
{
type: a.ROOM_MODAL_VISIBLE,
}
)
}
>
<View>
<Text>部屋をつくる</Text>
</View>
</TouchableOpacity>
</View>
<Text>{'\n'}</Text>
<Modal
isVisible={this.props.room.modal_content === 1}
animationIn={'slideInLeft'}
animationOut={'slideOutRight'}
>
{modal_html}
</Modal>
{html}
</ScrollView>
</View>
</KeyboardAvoidingView>
);
}
}
export default connect(
(store) => (store),
)(Room)
|
import React from 'react';
export default class todo extends React.Component {
constructor(props){
super(props);
this.state = {
listShow: "All"
}
}
render(){
return(
<div>
<label htmlFor="all">All</label>
<input type="radio" name="filter" id="all" onClick={() => this.setState({listShow: "All"})}/>
<label htmlFor="complete">Complete</label>
<input type="radio" name="filter" id="complete" onClick={() => this.setState({listShow: "Complete"})}/>
<label htmlFor="nocomplete">No Completed</label>
<input type="radio" name="filter" id="notcomplete" onClick={() => this.setState({listShow: "Nocomplete"})}/>
</div>
)
}
}
|
//This is example of synchronus programming.
var fs = require("fs");
/*
var data = fs.readFileSync('input.txt');
console.log(data.toString());
console.log("This is synchronus programming.");
*/
var callme=function (err, data) {
if (err) return console.error(err);
console.log(data.toString());
};
fs.readFile('input.txt',callme);
console.log("There is something unusual here,and that is because of asynchronus programming.");
|
const API_ENDPOINT = 'http://144.91.105.44/~ruta/api/'
// http://ruta.hnhp.website/route/api/s
export {
API_ENDPOINT
}
|
$(document).on('turbolinks:load', function() {
var select = function(start) {
//console.log(start.format('YYYY-MM-DD'));
//var select_day = start.format('YYYY-MM-DD').to_s;
/*$.ajax({
type: "POST",
url: "/balances/event",
dataType: 'json',
data: {
day: start.format('YYYY-MM-DD')
}
});*/
//calendar.fullCalendar('unselect');
};
$('#calendar').fullCalendar({
selectable: true,
ignoreTimezone: false,
select: select,
events: 'event.json',
eventClick: function(event) {
var id = event.id
var show_url = "/balances/"+id
location.href = show_url;
}
});
});
$(document).on('turbolinks:load', function() {
//Default
$('#datepicker-default .date').datepicker({
format: "yyyy-mm-dd",
language: 'ja'
});
});
//$('#calendar').fullCalendar {
//lang: 'ja'
//dayClick: function(date) {
//day = moment( data ).format( 'YYYY/MM/DD' )
//alert('Clicked on: ' + date.format());
//}
//}
|
/* 🤖 this file was generated by svg-to-ts*/
export const EOSIconsBranch = {
name: 'branch',
data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 5a3 3 0 10-4 2.816V11H7V7.816a3 3 0 10-2 0v8.368a3 3 0 102 0V13h10a2 2 0 002-2V7.816A2.991 2.991 0 0021 5z"/></svg>`
};
|
const { app } = require('electron');
const express = require('express');
const Main = require('./electron/Main');
const Config = require('./electron/Config');
const Global = require('./electron/Global');
const Tray = require('./electron/Tray');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let webServer;
let main;
let tray;
const singleInstance = app.makeSingleInstance(() => {
// Someone tried to run a second instance, we should focus our window.
if (main.window && (!main.window.isVisible() || main.window.isMinimized() || !main.window.isFocused()))
main.window.show();
})
if (singleInstance)
app.quit();
app.on('ready', () => {
if (!Global.debug) {
webServer = express();
webServer.use(express.static(__dirname + '/build'));
webServer.listen(Config.get('global.port'));
}
main = Main();
tray = Tray(main);
Global.register('main', main);
main.window.loadURL(`${Global.host}/index.html`);
});
app.on('will-quit', () => {
main.window.removeAllListeners();
})
|
module.exports = {
preset: 'jest-preset-angular',
roots: ['<rootDir>/src'],
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.html$',
astTransformers: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer'
]
}
}
};
|
class Converter {
constructor(name, table) {
this.name = name
this.table = table
}
canConvert(dimension1, dimension2) {
return this.table[dimension1] && this.table[dimension2]
}
convert(value, givenUnit, requestedUnit) {
const standardUnit = value * this.table[givenUnit]
return standardUnit / this.table[requestedUnit]
}
}
module.exports = Converter
|
import {changeFetch} from "./Users-reducer";
import {profileAPI} from "../../Api/api";
let initialState = {
posts: [{'message': 'Hello'}, {'message': 'Hi'}],
profile: null,
status: ''
}
const addPostReducer = (state = initialState, action) => {
switch (action.type) {
case 'ADD_POST': {
let stateCopy = {
...state,
posts:[...state.posts]
}
stateCopy.posts.push({
'message': action.message
})
return stateCopy
}
case 'SET_USER_PROFILE': {
return {
...state,
profile:action.profile
}
}
case 'SET_STATUS': {
return {
...state,
status:action.status
}
}
default:
return state
}
}
export const setUserProfile = (profile) => {
return {
type: 'SET_USER_PROFILE',
profile
}
}
export const addPost = (text) => {
return {
type: 'ADD_POST',
message: text
}
}
export const setStatus = (status) => {
return {
type:'SET_STATUS',
status
}
}
export const getProfileThunkCreator = (id) => {
return (dispatch) => {
if (id) {
dispatch(changeFetch(false))
profileAPI.getProfile(id)
.then(data => {
dispatch(setUserProfile(data))
})
}
}
}
export const getStatusThunkCreator = (id) => {
return (dispatch) => {
profileAPI.getStatus(id).then(data => {
dispatch(setStatus(data))
})
}
}
export const updateStatusThunkCreator = (st) => (dispatch) => {
profileAPI.updateStatus(st).then(response => {
dispatch(setStatus(st))
})
}
export default addPostReducer
|
const { INTERNAL_SERVER_ERROR, NOT_FOUND } = require('http-status-codes');
const auth = require('./common/auth');
const AuthError = require('passport/lib/errors/authenticationerror');
const config = require('./config');
const cors = require('cors');
const express = require('express');
const { HttpError } = require('http-errors');
const router = require('./router');
const { sequelize } = require('./common/database');
// eslint-disable-next-line require-sort/require-sort
require('express-async-errors');
const app = express();
app.use(express.json());
app.use(cors());
app.use(auth.initialize());
app.use(config.apiPath, router);
app.use((err, req, res, next) => {
if ((err instanceof HttpError) || (err instanceof AuthError)) {
return res.status(err.status).send(err.message);
}
res.status(INTERNAL_SERVER_ERROR).end();
console.log({ req, err }, '🚨 Internal Error:', err.message);
});
app.use((req, res, next) => res.status(NOT_FOUND).end());
sequelize.sync()
.then(() => {
app.listen(config.port, console.log(`Server started on port ${config.port}`));
});
|
function checkCookie()
{
jQuery.ajax({
'url':'/admin/maintenance/checkCookie',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#bypass').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#bypass').html(data);
},
'error':function(){
$('#bypass').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
}
function generateCookie()
{
jQuery.ajax({
'url':'/admin/maintenance/generateCookie',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#bypass').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#bypass').html(data);
},
'error':function(){
$('#bypass').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
setTimeout( function() { checkMaintenance(); }, 500);
}
function updateCookie()
{
jQuery.ajax({
'url':'/admin/maintenance/updateCookie',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#bypass').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#bypass').html(data);
},
'error':function(){
$('#bypass').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
setTimeout( function() { checkMaintenance(); }, 500);
}
function destroyCookie()
{
jQuery.ajax({
'url':'/admin/maintenance/destroyCookie',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#bypass').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#bypass').html(data);
},
'error':function(){
$('#bypass').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
setTimeout( function() { checkMaintenance(); }, 500);
}
function checkMaintenance()
{
jQuery.ajax({
'url':'/admin/maintenance/checkMaintenance',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#maintenance').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#maintenance').html(data);
},
'error':function(){
$('#maintenance').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
}
function enableMaintenance()
{
jQuery.ajax({
'url':'/admin/maintenance/enableMaintenance',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#maintenance').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#maintenance').html(data);
},
'error':function(){
$('#maintenance').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
setTimeout( function() { checkCookie(); }, 500);
}
function disableMaintenance()
{
jQuery.ajax({
'url':'/admin/maintenance/disableMaintenance',
'type':'GET',
'datatype':'json',
'beforeSend':function(data){
$('#maintenance').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#maintenance').html(data);
},
'error':function(){
$('#maintenance').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
setTimeout( function() { checkCookie(); }, 500);
}
function schedule()
{
jQuery.ajax({
'url':'/admin/maintenance/scheduleMaintenance',
'type':'GET',
'data':$('#schedule-form').serialize(),
'datatype':'json',
'beforeSend':function(data){
$('#maintenanceSchedule').html('<div style="text-align:center;"><h1><i class="fa fa-spinner fa-spin fa-4x"></i></h1></div>');
},
'success':function(data){
$('#maintenanceSchedule').html(data);
},
'error':function(){
$('#maintenanceSchedule').html('Something went wrong, please refresh the page and try again.');
},
'cache':false,
});
}
|
var Contact = Backbone.Model.extend({
urlRoot : function(){ return '/api/contact_leads/';},
parse : function(response){
if(response.status && response.status.code == 1000){
return response.data;
}
return response;
},
validate: function(attrs) {}
});
Views.ContactView = Views.BaseView.extend({
events : {
"click #submit-btn" : "onSubmit",
"click #reset-btn" : "render",
},
initialize : function(){
this.$el = $("#contact-form-container");
this.model = new Contact();
this._super('initialize');
this.loadTemplate('contact');
this.model.bind('error', this.error, this);
this.model.bind('sync', this.synced, this);
eventBus.on('close_view', this.close, this );
},
init : function(){
this.render();
this.name = this.$('#name');
this.email = this.$('#email');
this.message = this.$('#message');
this.alert = this.$('#contact-alert');
this.submitBtn = this.$('#submit-btn');
this.resetBtn = this.$('#reset-btn');
},
render : function(){
this.$el.html(this.template());
},
close : function(){
this._super('close');
},
error : function(model, error){
if(error.status == 500){
var data = $.parseJSON(error.responseText);
this.showError(data.message);
}else if(error.statusText != undefined){
this.showError(error.statusText);
}else{
this.showError(error);
}
},
synced : function(model, response){
this.showSuccess("Your message has been registered. We will revert back at the earliest");
this.$('form').hide();
},
showError : function(msg){
this.enable();
this.alert.find('.alert').removeClass('alert-success');
this.alert.find('.alert').addClass('alert-error');
this.alert.find('.alert').html(msg);
this.alert.show();
},
showSuccess : function(msg){
this.enable();
this.alert.find('.alert').removeClass('alert-error');
this.alert.find('.alert').addClass('alert-success');
this.alert.find('.alert').html(msg);
this.alert.show();
},
disable : function(){
this.$el.find('input').prop('disabled' , true);
this.$el.find('textarea').prop('disabled' , true);
this.$el.find('a').prop('disabled' , true);
},
enable : function(){
this.$el.find('input').prop('disabled' , false);
this.$el.find('textarea').prop('disabled' , false);
this.$el.find('a').prop('disabled' , false);
},
onSubmit : function(){
this.disable();
this.model.set('name', this.name.val(), {silent : true});
this.model.set('email', this.email.val(), {silent : true});
this.model.set('message', this.message.val(), {silent : true});
this.model.save();
},
});
|
import React from 'react';
import {DefaultSeo} from 'next-seo';
function MyApp({Component, pageProps}) {
return <Component {...pageProps} />;
}
export default MyApp;
|
import styled from 'styled-components';
import { NavLink } from 'react-router-dom';
import { BackgroundVegTable } from '../api/images';
// Images
const mainImageUrl = BackgroundVegTable;
// Bar
export const BarWrapper = styled.div`
background: ${(props) => props.theme.modalTransparentGrey};
display: flex;
justify-content: space-around;
overflow: scroll;
position: absolute;
width: 100%;
`;
export const LinkTo = styled(NavLink)`
align-items: center;
color: white;
cursor: pointer;
display: flex;
font-size: ${(props) => props.theme.primaryFontSize};
padding: ${(props) => props.theme.primaryPadding};
text-decoration: none;
:hover {
cursor: pointer;
font-weight: bold;
opacity: 1.5;
transform: scale(1.1);
transition: transform 0.3s;
}
`;
// General
export const ContentWrapper = styled.div`
margin: ${(props) => props.theme.primaryPadding};
`;
export const Paper = styled.div`
background: ${(props) => props.theme.modalTransparentGrey};
border-radius: ${(props) => props.theme.smallPadding};
color: ${(props) => props.theme.primaryBoxShadow};
display: flex;
flex-direction: column;
height: fit-content;
justify-content: center;
margin: ${(props) => props.theme.sideCardPadding};
padding: ${(props) => props.theme.primaryPadding};
`;
export const PageWrapper = styled.div`
align-items: start;
background: url(${mainImageUrl});
background-repeat: no-repeat;
background-size: cover;
display: flex;
height: 100vh;
justify-content: start;
overflow: scroll;
padding: ${(props) => props.theme.secondaryPadding};
`;
export const RowWrapper = styled.div`
align-items: center;
display: flex;
justify-content: space-between;
`;
export const HowerWrapper = styled.div`
:hover {
cursor: pointer;
font-weight: bold;
opacity: 1.5;
transform: scale(1.3);
transition: transform 0.3s;
}
:active {
color: black;
transform: scale(1.8);
transition: transform 1s;
}
`;
|
var searchData=
[
['end',['END',['../Io_8h.html#a29fd18bed01c4d836c7ebfe73a125c3f',1,'Io.h']]],
['enter',['ENTER',['../Io_8h.html#af4bced5cf8ed55746d4b5d34f9a0fe39',1,'Io.h']]],
['eof',['EOF',['../Vfs_8h.html#a59adc4c82490d23754cd39c2fb99b0da',1,'Vfs.h']]],
['esc',['ESC',['../Io_8h.html#a4af1b6159e447ba72652bb7fcdfa726e',1,'Io.h']]]
];
|
import Cookies from "js-cookie";
const SupportKey='supportKey';
export function getSupport() {
return Cookies.get(SupportKey)
}
export function setSupport(isSupport) {
return Cookies.set(SupportKey, isSupport,{ expires: 3 })
}
export function setCookie(key,value,expires) {
return Cookies.set(key, value,{ expires: expires})
}
export function getCookie(key) {
return Cookies.get(key)
}
|
/*global ODSA */
"use strict";
// Pre-order traversal slideshow
$(document).ready(function () {
var av_name = "GenTreePreTravCON";
var config = ODSA.UTILS.loadConfig({"av_name": av_name}),
interpret = config.interpreter, // get the interpreter
code = config.code; // get the code object
var av = new JSAV(av_name);
var pseudo = av.code(code);
var temp1;
var gt = av.ds.tree({visible: true, nodegap: 35});
gt.root('R');
var rt = gt.root();
var a = gt.newNode('A');
var b = gt.newNode('B');
var c = gt.newNode('C');
var d = gt.newNode('D');
var e = gt.newNode('E');
var f = gt.newNode('F');
rt.addChild(a);
rt.addChild(b);
b.addChild(f);
a.addChild(c);
a.addChild(d);
a.addChild(e);
gt.layout();
var rt1 = av.pointer("rt", rt, {anchor: "left top", top: -10});
// Slide 1
pseudo.setCurrentLine("processNode");
av.umsg("Preorder traversals start by processing the root node.");
av.displayInit();
// Slide 2
rt.addClass("thicknode");
pseudo.setCurrentLine("checkLeaf");
av.step();
// Slide 3
pseudo.setCurrentLine("leftChild");
av.step();
// Slide 4
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 5
av.umsg("Next we visit the left most child");
pseudo.setCurrentLine("processChild");
av.step();
// Slide 6
av.umsg("This node is processed next, and is treated as the root of a new subtree.");
rt.addClass("processing");
a.addClass("thicknode");
pseudo.setCurrentLine("processNode");
rt1.target(a);
av.step();
// Slide 7
pseudo.setCurrentLine("checkLeaf");
av.step();
// Slide 8
pseudo.setCurrentLine("leftChild");
av.step();
// Slide 9
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 10
av.umsg("Next we visit the left most child");
pseudo.setCurrentLine("processChild");
av.step();
// Slide 11
av.umsg("This node is processed next, and is treated as the root of a new subtree.");
pseudo.setCurrentLine("processNode");
a.addClass("processing");
c.addClass("thicknode");
rt1.target(c);
av.step();
// Slide 12
pseudo.setCurrentLine("checkLeaf");
av.umsg("Since this is a leaf, we pop back to the parent");
av.step();
// Slide 13
pseudo.setCurrentLine("checkLeaf");
a.removeClass("processing");
rt1.target(a);
av.step();
// Slide 14
av.umsg("Continue Examining the left children.");
pseudo.setCurrentLine("getNextSibling");
av.step();
// Slide 15
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 16
pseudo.setCurrentLine("processChild");
av.step();
// Slide 17
rt1.target(d);
a.addClass("processing");
d.addClass("thicknode");
pseudo.setCurrentLine("processNode");
av.step();
// Slide 18
pseudo.setCurrentLine("checkLeaf");
av.step();
// Slide 19
av.umsg("Since this is a leaf, we pop back to the parent");
a.removeClass("processing");
rt1.target(a);
pseudo.setCurrentLine("getNextSibling");
av.step();
// Slide 20
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 21
pseudo.setCurrentLine("processChild");
av.step();
// Slide 22
av.umsg("Visit the next child of node A.");
a.addClass("processing");
e.addClass("thicknode");
rt1.target(e, {anchor: "right top"});
pseudo.setCurrentLine("processNode");
av.step();
// Slide 23
pseudo.setCurrentLine("checkLeaf");
av.step();
// Slide 24
av.umsg("Since this is a leaf, pop rcursion back to the parent");
a.removeClass("processing");
rt1.target(a);
pseudo.setCurrentLine("getNextSibling");
av.step();
// Slide 25
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 26
av.umsg("There are no children left to be processed.");
av.step();
// Slide 27
pseudo.setCurrentLine("getNextSibling");
av.umsg("Pop recursionback to the parent node.");
rt1.target(rt);
rt.removeClass("processing");
av.step();
// Slide 28
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 29
pseudo.setCurrentLine("processChild");
av.step();
// Slide 30
rt1.target(b);
rt.addClass("processing");
b.addClass("thicknode");
pseudo.setCurrentLine("processNode");
av.step();
// Slide 31
pseudo.setCurrentLine("checkLeaf");
av.step();
// Slide 32
av.umsg("Continue Examining the left children.");
pseudo.setCurrentLine("leftChild");
av.step();
// Slide 33
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 34
pseudo.setCurrentLine("processChild");
av.step();
// Slide 35
rt1.target(f);
b.addClass("processing");
f.addClass("thicknode");
pseudo.setCurrentLine("processNode");
av.step();
// Slide 36
pseudo.setCurrentLine("checkLeaf");
av.step();
// Slide 37
av.umsg("There are no children left to be processed.");
av.step();
// Slide 38
pseudo.setCurrentLine("getNextSibling");
b.removeClass("processing");
av.umsg("Pop recursion to the parent node.");
rt1.target(b);
av.step();
// Slide 39
pseudo.setCurrentLine("checkNull");
av.step();
// Slide 40
av.umsg("There are no children left to be processed.");
av.step();
// Slide 41
rt1.target(rt);
rt.removeClass("processing");
pseudo.setCurrentLine("end");
av.recorded();
});
|
import moduleRouters from './router'
import modulesStores from './store'
export default (Vue, store, router) => { // eslint-disable-line
router.addRoutes([moduleRouters()])
store.registerModule('module1', modulesStores())
}
|
// Set heights
$(function() {
var $window = $(window),
$titles = $('h1, h2'),
$section = $('.section').last(),
$contact = $('#contact'),
minH = 800;
$window.bind(
'resize.layout',
function( e )
{
var newH = $window.height();
if ( newH < minH )
{
newH = minH;
}
$section.css( 'minHeight', newH - 120 );
$titles.css( 'marginTop', ( newH / 2 ) - 225 );
}
).trigger( 'resize.layout' );
});
// Animate backgroundcolor
$(function() {
var $window = $(window),
$html = ( $.browser.webkit ) ? $( 'body' ) : $( 'html' ),
$page = $('#page'),
$phone = $('#phone'),
sections = ['examples', 'contact', 'events', 'options', 'usage', 'home'];
$window.bind(
'scroll.layout',
function( e )
{
var st = $html.scrollTop();
for ( var a = 0, l = sections.length; a < l; a++ )
{
var id = sections[ a ];
if ( st > $('#' + id).offset().top - 250)
{
if ( !$page.hasClass( id ) )
{
$page.removeAttr( 'class' );
$page.addClass( id );
}
break;
}
}
}
).trigger( 'scroll.layout' );
});
// Scroll through page
$(function() {
var $html = $('html, body');
$('a[href^="#"]').bind(
'click.layout',
function( e )
{
e.preventDefault();
$html.animate({
scrollTop: $($(this).attr( 'href' )).offset().top
}, 500);
}
);
});
// Email link
$(function() {
$('#email').attr( 'href', 'mailto:info@frebsite.nl' );
});
|
class Main extends HTMLElement{
constructor(){
super();
this.switcher;
$(this).on("change","order-select",function(){
var order=$(this).attr("order")+"-"+$(this).attr("flipped");
$("main-container").find(".post-wrapper").remove();
$("main-container").find("regular-post").remove();
var url=$("main-container").attr("url");
$.post(url,{order:order},function(d) {
var json=JSON.parse(d);
for(var i=0;i<json.length;i++)
$("main-container").append("<regular-post>"+JSON.stringify(json[i])+"</regular-post>");
});
});
$(this).on("append",function(){
var json=JSON.parse($(this).text());
for(var i=0;i<json.length;i++)
$("main-container").append("<regular-post>"+JSON.stringify(json[i])+"</regular-post>");
})
}
connectedCallback() {
this.switcher=$(this).attr("switcher");
this.user_profile=$(this).attr("puser");
this.current_user=$(this).attr("cuser");
this.friend=$(this).attr("friend");
this.follow=$(this).attr("follow");
this.username=$(this).attr("username");
this.name=$(this).attr("name");
this.picture=$(this).attr("picture");
this.tab=$(this).attr("tab");
this.membersince=$(this).attr("membersince");
this.birthday=$(this).attr("birthday");
var top="", url='geters/postsload.php';
var data={};
if(this.switcher!=""&& typeof this.switcher!=='undefined'){
top = `
<main-sort ${(typeof $(this).attr("order")!="undefined"&&$(this).attr("order")!="")?"order='"+$(this).attr("order")+"'":""}${(typeof $(this).attr("flipped")!="undefined"&&$(this).attr("flipped")!="")?"flipped='"+$(this).attr("flipped")+"'":""}></main-sort>
<div id="main-wall-switcher">
<div id="wall-button" class='${(this.switcher=="wall")?"selected":""}' onClick="window.location='mainchanger.php?choice=wall';">
MY WALL
</div><div id="all-posts-button" class='${(this.switcher=="all")?"selected":""}' onClick="window.location='mainchanger.php?choice=all';">
ALL POSTS
</div>
</div>`;
}else if(this.user_profile!==""&& typeof this.user_profile!=="undefined"){//for profiles only
$(this).addClass("white");
var button="";//either edit profile or follow and friend buttons
if(this.current_user===this.user_profile){
button=`<div id="profile-edit-button"><p class='text'>Edit Profile</p></div>`;
}else if(this.current_user!=""){
var friend="";
if (this.friend=="received request") {
friend= `<div id='friend-button'>
<p class='text'>Accept Friend Request</p>
</div>`;
}else if(this.friend=="pending"){
friend= `<div id='friend-button'>
<p class='text'>Friend Request Sent</p>
</div>`;
}else if(this.friend=="1"){
friend= `<div id='friend-button'>
<p class='text'>Friend</p>
</div>`;
}else{
friend= `<div id='friend-button'>
<p class='text'>Add Friend</p>
</div>`;
}
var follow="";
if(follow=="1"){
follow= `<div id='follow-button'>
<p class='text'>Following</p>
</div>`;
}else{
follow= `<div id='follow-button'>
<p class='text'>Follow</p>
</div>`;
}
button=`${friend}${follow}`;
}
var select=0;
url="/ShareOn/geters/profile_posts.php";
if(this.tab=="collections"){
select=1;
url="/ShareOn/geters/collectionLoad.php";
}else if(this.tab=="friends"){
select=2;
url="/ShareOn/geters/profile_friends.php";
}else if(this.tab=="followers"){
select=3;
url="/ShareOn/geters/profile_followers.php";
}else if(this.tab=="info"){
select=4;
url="/ShareOn/geters/profile_friends.php";
}
// timeSince(300000030));
top=`<div id="top-profile-container">
<div id="profile-picture"><img src="${(this.picture!==""&&typeof this.picture!=="undefined")?this.picture:""}"/></div>
<div id="name-container">
<p id="profile-name">${(this.name!==""&&typeof this.name!=="undefined")?this.name:""}</p>
</div>
<div id="profile-info">
<div id="profile-username"><p>@</p>${(this.username!==""&&typeof this.username!=="undefined")?this.username:""}</div>
<div id="profile-member-since"> Member since: ${(this.membersince!==""&&typeof this.membersince!=="undefined")?timeSince(this.membersince):""}</div>
<div id="profile-birthday"> Birthday: ${(this.birthday!==""&&typeof this.birthday!=="undefined")?this.birthday:""}</div>
</div>
<div id="infobox"></div>
<div id="highlight-post">
<div class="highlighted-post"></div>
<div class="highlighted-post"></div>
<div class="highlighted-post"></div>
<div class="highlighted-post"></div>
<div class="highlighted-post"></div>
</div>
${button}
<div id="profile-selector-container">
<div class="profile-selector${(select==0)?' isclick':''}" data="posts">
<p class="text">Posts</p>
</div>
<div class="profile-selector${(select==1)?' isclick':''}" data="collections">
<p class="text">Collections</p>
</div>
<div class="profile-selector${(select==2)?' isclick':''}" data="friends">
<p class="text">Friends</p>
</div>
<div class="profile-selector${(select==3)?' isclick':''}" data="followers">
<p class="text">Followers</p>
</div>
<div class="profile-selector${(select==4)?' isclick':''}" data="info">
<p class="text">Info</p>
</div>
</div>
</div>`;
data['username']=(this.username!==""&&typeof this.username!=="undefined")?this.username:"";
}
if(top!=""){
this.innerHTML=top;
$(this).attr("url",url);
$.post(url,data,function(d) {
var json=JSON.parse(d);
for(var i=0;i<json.length;i++)
$("main-container").append("<regular-post>"+JSON.stringify(json[i])+"</regular-post>");
});
}else if($(this).text()!=""){
$(this).trigger("append");
}
}
}
window.customElements.define("main-container",Main);
class Sort extends HTMLElement{
constructor(){
super();
}
connectedCallback() {
this.innerHTML=`
<more-sort></more-sort><order-select ${(typeof $(this).attr("order")!="undefined"&&$(this).attr("order")!="")?"order='"+$(this).attr("order")+"'":""}${(typeof $(this).attr("flipped")!="undefined"&&$(this).attr("flipped")!="")?"flipped='"+$(this).attr("flipped")+"'":""}></order-select>`;
}
}
window.customElements.define("main-sort",Sort);
class MoreSort extends HTMLElement{
constructor(){
super();
$(this).on('click',function(){
if($(this).hasClass("clicked")){
$(this).removeClass("clicked");
$(this).parent().find("sort-options").remove();
$(this).parent().css("margin-bottom","0px");
}else{
var th=$(this);
th.addClass("clicked");
th.addClass("wait");
th.parent().css("margin-bottom","30px");
th.parent().append(`<sort-options></sort-options>`);
setTimeout(function(){ th.removeClass("wait"); }, 100);
}
});
}
connectedCallback() {
this.innerHTML=`
<img src='/ShareOn/icons/sort.png'/>SORT`;
}
}
window.customElements.define("more-sort",MoreSort);
class SortOptions extends HTMLElement{
constructor(){
super();
}
connectedCallback() {
this.innerHTML=`
<sort-option></sort-option>
<sort-option></sort-option>
<sort-option></sort-option>
<sort-option></sort-option>
`;
}
}
window.customElements.define("sort-options",SortOptions);
class SortOption extends HTMLElement{
constructor(){
super();
}
connectedCallback() {
this.innerHTML=`
<img height='100%'src='/ShareOn/icons/1sort.png'/>
`;
}
}
window.customElements.define("sort-option",SortOption);
$(document).on("click",function(){
if($("more-sort.clicked").length>0&&!$("more-sort.clicked").hasClass("wait")){
$("more-sort.clicked").removeClass("clicked");
$("sort-options").remove();
$("main-sort").css("margin-bottom","0px");
}
});
|
////////////////////////////////////////////////////////// global variables
var canvas = document.getElementById("snow");
var context = canvas.getContext("2d");
var nsnows = [];
var fsnows = [];
var msnows = [];
var character;
var spawn1, spawn2, spawn3;
var windSpeed = 0;
var mouseX = canvas.width / 2;
////////////////////////////////////////////////////////// initializations
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
generateNearSnow(10);
generateMidSnow(50);
generateFarSnow(100);
generateCharacter();
////////////////////////////////////////////////////////// initiating functions
var trackMouse = function(event) {
mouseX = event.pageX;
}; canvas.addEventListener("mousemove", trackMouse);
function generateMidSnow(snowCount) {
for (var i = 0; i < snowCount; i++) {
msnows.push(new midSnow());
};
}
function generateNearSnow(snowCount) {
for (var i = 0; i < snowCount; i++) {
nsnows.push(new nearSnow());
};
}
function generateFarSnow(snowCount) {
for (var i = 0; i < snowCount; i++) {
fsnows.push(new farSnow());
};
}
function generateCharacter(){
character = new Character();
}
////////////////////////////////////////////////////////// main function : World
function World() {
clearCanvas();
drawArea();
updateWind();
spawn1 = spawn2 = spawn3 = 0;
for (var i = 0; i < fsnows.length; i++) {
fsnows[i].update().draw();
if (fsnows[i].spawn) {
spawn3++;
fsnows[i].spawn = false;
};
};
for (var i = 0; i < msnows.length; i++) {
msnows[i].update().draw();
if (msnows[i].spawn) {
spawn2++;
msnows[i].spawn = false;
};
};
drawCharacter();
for (var i = 0; i < nsnows.length; i++) {
nsnows[i].update().draw();
if (nsnows[i].spawn) {
spawn1++;
nsnows[i].spawn = false;
};
};
spawnSnow();
}
////////////////////////////////////////////////////////// support functions
function spawnSnow() {
for (var i = 0; i < spawn1 && nsnows.length < 100; i++) {
nsnows.push(new nearSnow());
};
for (var i = 0; i < spawn2 && msnows.length < 800; i++) {
msnows.push(new midSnow());
};
for (var i = 0; i < spawn3 && fsnows.length < 900; i++) {
fsnows.push(new farSnow());
};
}
function drawCharacter() {
character.drawBody();
character.drawHood();
character.drawLeftCoat();
character.drawRightCoat();
character.drawCollar();
character.drawLines();
}
function drawArea() {
context.beginPath();
context.moveTo(0, canvas.height);
context.lineTo(0, canvas.height - 220);context.lineTo(50, canvas.height - 215);
context.lineTo(200, canvas.height - 220);context.lineTo(230, canvas.height - 210);
context.lineTo(250, canvas.height - 210);context.lineTo(255, canvas.height - 215);
context.lineTo(300, canvas.height - 220);context.lineTo(330, canvas.height - 205);
context.lineTo(350, canvas.height - 205);context.lineTo(400, canvas.height - 220);
context.lineTo(500, canvas.height - 215);context.lineTo(800, canvas.height - 205);
context.lineTo(950, canvas.height - 240);context.lineTo(990, canvas.height - 230);
context.lineTo(1100, canvas.height - 220);context.lineTo(1200, canvas.height - 225);
context.lineTo(1250, canvas.height - 215);context.lineTo(1300, canvas.height - 235);
context.lineTo(canvas.width, canvas.height - 225);
context.lineTo(canvas.width, canvas.height);
context.fillStyle = "#c1c1c1";
context.strokeStyle = "#cccccc";
context.closePath();
context.fill();
context.stroke();
context.beginPath();
context.moveTo(0, canvas.height);
context.lineTo(0, canvas.height - 205);context.lineTo(100, canvas.height - 210);
context.lineTo(125, canvas.height - 205);context.lineTo(175, canvas.height - 210);
context.lineTo(200, canvas.height - 200);context.lineTo(250, canvas.height - 200);
context.lineTo(270, canvas.height - 185);context.lineTo(400, canvas.height - 195);
context.lineTo(550, canvas.height - 185);context.lineTo(600, canvas.height - 200);
context.lineTo(800, canvas.height - 200);context.lineTo(900, canvas.height - 205);
context.lineTo(950, canvas.height - 190);context.lineTo(1100, canvas.height - 205);
context.lineTo(canvas.width, canvas.height - 195);
context.lineTo(canvas.width, canvas.height);
context.fillStyle = "#cccccc";
context.strokeStyle = "#dddddd";
context.closePath();
context.fill();
context.stroke();
}
function clearCanvas() {
context.fillStyle = "#aabaa9";context.fillRect(0, 0, canvas.width, canvas.height);
}
function randomBetween(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
function updateWind() {
windSpeed = (((canvas.width/2) - mouseX) * (-1)) / 50;
}
////////////////////////////////////////////////////////// Objects
function nearSnow() {
this.x = randomBetween(0, canvas.width);
this.y = randomBetween(0, canvas.height);
this.radius = randomBetween(2,4);
this.spawn = false;
this.catched = false;
this.melt = 0;
this.move = function() {
this.y += 1;
this.x += windSpeed;
}
this.respawn = function() {
this.catched = false;
this.radius = randomBetween(2,4);
this.spawn = true;
this.melt = 0;
this.x = randomBetween(0, canvas.width);
this.y = randomBetween(0, canvas.height-500);
}
this.update = function() {
if (!this.catched) {
this.move();
if (randomBetween(1,25) == 1) {
if (this.x >= canvas.width/2-52 && this.x <= canvas.width/2-52+85 &&
this.y >= canvas.height/3+45 && this.y <= canvas.height/3+45+215) {
this.catched = true;
};
if (Math.sqrt(
Math.abs(this.x-canvas.width/2-3)*Math.abs(this.x-canvas.width/2-3) +
Math.abs(this.y-canvas.height/3)*Math.abs(this.y-canvas.height/3)
) < 48) {
this.catched = true;
};
if (Math.sqrt(
Math.abs(this.x-canvas.width/2+7)*Math.abs(this.x-canvas.width/2+7) +
Math.abs(this.y-canvas.height/3-15)*Math.abs(this.y-canvas.height/3-15)
) < 30) {
this.catched = false;
};
};
if (this.y >= canvas.height) {
this.respawn();
};
if (this.x < 0) {
this.x = canvas.width;
this.radius = randomBetween(2,4);
};
if (this.x > canvas.width) {
this.x = 0;
this.radius = randomBetween(2,4);
};
};
if (this.catched) {
this.melt++;
if (this.melt >= 500) {
this.radius -= 0.05;
};
if (this.radius <= 0) {
this.respawn();
};
};
return this;
}
this.draw = function() {
context.beginPath();
context.arc(this.x, this.y, this.radius, 2 * Math.PI, false);
context.fillStyle = "rgba(255, 255, 255, 1)";
context.fill();
return this;
}
}
function midSnow() {
this.x = randomBetween(0, canvas.width);
this.y = randomBetween(0, canvas.height);
this.radius = randomBetween(1,3);
this.spawn = false;
this.catched = false;
this.melt = 0;
this.move = function() {
this.y += 0.7;
this.x += (windSpeed * 3) / 7;
}
this.respawn = function(){
this.catched = false;
this.melt = 0;
this.spawn = true;
this.x = randomBetween(0, canvas.width);
this.y = randomBetween(0, canvas.height-500);
this.radius = randomBetween(1,3);
}
this.update = function() {
if (!this.catched) {
this.move();
if (this.y > canvas.height - 200 && randomBetween(0, 100) == 1) {
this.catched = true;
};
if (this.x < 0) {
this.x = canvas.width;
this.radius = randomBetween(1,3);
};
if (this.x > canvas.width) {
this.x = 0;
this.radius = randomBetween(1,3);
};
if (this.y > canvas.height) {
this.respawn();
};
};
if (this.catched) {
if (this.melt < 600) {
this.melt++;
};
if (this.melt >= 600) {
this.radius-=0.1;
};
if (this.radius <= 0) {
this.respawn();
};
};
return this;
}
this.draw = function() {
context.beginPath();
context.arc(this.x, this.y, this.radius, 2 * Math.PI, false);
context.fillStyle = "rgba(255, 255, 255, 1)";
context.fill();
return this;
}
}
function farSnow() {
this.x = randomBetween(0, canvas.width);
this.y = randomBetween(0, canvas.height-200);
this.radius = randomBetween(1,2);
this.spawn = false;
this.move = function() {
this.y += 0.4;
this.x += windSpeed / 5;
}
this.update = function() {
this.move();
if (this.y > canvas.height - 200) {
this.y = 0;
this.radius = randomBetween(1,2);
this.spawn = true;
};
if (this.x < 0) {
this.x = canvas.width;
this.radius = randomBetween(1,2);
};
if (this.x > canvas.width) {
this.x = 0;
this.radius = randomBetween(1,2);
};
return this;
}
this.draw = function() {
context.beginPath();
context.arc(this.x, this.y, this.radius, 2 * Math.PI, false);
context.fillStyle = "rgba(255, 255, 255, 1)";
context.fill();
return this;
}
}
function Character() {
this.x = canvas.width / 2;
this.y = canvas.height / 4;
this.drawHood = function() {
context.beginPath();
context.moveTo(this.x, this.y);
context.lineTo(this.x-29, this.y+16);context.lineTo(this.x-44, this.y+36);
context.lineTo(this.x-55, this.y+70);context.lineTo(this.x-45, this.y+90);
context.lineTo(this.x-13, this.y+106);context.lineTo(this.x-35, this.y+85);
context.lineTo(this.x-35, this.y+75);context.lineTo(this.x-10, this.y+45);
context.lineTo(this.x+5, this.y+50);context.lineTo(this.x+20, this.y+65);
context.lineTo(this.x+30, this.y+85);context.lineTo(this.x-5, this.y+110);
context.lineTo(this.x+38, this.y+93);context.lineTo(this.x+47, this.y+70);
context.lineTo(this.x+40, this.y+35);
context.fillStyle = "rgba(200, 200, 200, 1)";
context.strokeStyle = "#ffffff";
context.fill();
context.closePath();
context.stroke();
}
this.drawBody = function() {
context.beginPath();
context.moveTo(this.x, this.y);
context.lineTo(this.x-29, this.y+16);context.lineTo(this.x-44, this.y+36);
context.lineTo(this.x-55, this.y+70);context.lineTo(this.x-45, this.y+90);
context.lineTo(this.x-5, this.y+110);context.lineTo(this.x+38, this.y+93);
context.lineTo(this.x+47, this.y+70);context.lineTo(this.x+40, this.y+35);
context.moveTo(this.x-5, this.y+160);
context.lineTo(this.x-30, this.y+165);context.lineTo(this.x-75, this.y+140);
context.lineTo(this.x-45, this.y+100);context.lineTo(this.x-5, this.y+110);
context.lineTo(this.x+38, this.y+98);context.lineTo(this.x+55, this.y+140);
context.lineTo(this.x+20, this.y+160);
context.moveTo(this.x-5, this.y+150);context.lineTo(this.x-30, this.y+280);
context.lineTo(this.x-10, this.y+420);context.lineTo(this.x-7, this.y+422);
context.lineTo(this.x-4, this.y+420);context.lineTo(this.x+15, this.y+280);
context.fillStyle = "rgba(120, 120, 120, 1)";
context.strokeStyle = "#666666";
context.fill();
context.closePath();
context.stroke();
}
this.drawLeftCoat = function() {
context.beginPath();
context.moveTo(this.x-5, this.y+145);
context.lineTo(this.x-23, this.y+260);context.lineTo(this.x-10, this.y+345);
context.lineTo(this.x-50, this.y+320);context.lineTo(this.x-60, this.y+210);
context.lineTo(this.x-45, this.y+130);context.lineTo(this.x-37, this.y+125);
context.fillStyle = "rgba(200, 200, 200, 1)";
context.strokeStyle = "#ffffff";
context.fill();
context.closePath();
context.stroke();
}
this.drawRightCoat = function() {
context.beginPath();
context.moveTo(this.x-5, this.y+145);
context.lineTo(this.x+15, this.y+280);context.lineTo(this.x-10, this.y+345);
context.lineTo(this.x+33, this.y+325);context.lineTo(this.x+35, this.y+270);
context.lineTo(this.x+38, this.y+210);context.lineTo(this.x+30, this.y+130);
context.lineTo(this.x+25, this.y+125);
context.fillStyle = "rgba(200, 200, 200, 1)";
context.strokeStyle = "#ffffff";
context.fill();
context.closePath();
context.stroke();
}
this.drawCollar = function() {
context.beginPath();
context.moveTo(this.x-5, this.y+140);
context.lineTo(this.x-43, this.y+120);context.lineTo(this.x-75, this.y+140);
context.lineTo(this.x-46, this.y+102);context.lineTo(this.x-15, this.y+112);
context.lineTo(this.x-4, this.y+138);context.lineTo(this.x+5, this.y+112);
context.lineTo(this.x+38, this.y+100);context.lineTo(this.x+55, this.y+140);
context.lineTo(this.x+30, this.y+120);
context.fillStyle = "rgba(200, 200, 200, 1)";
context.strokeStyle = "#ffffff";
context.fill();
context.closePath();
context.stroke();
}
this.drawLines = function() {
context.beginPath();
{
context.moveTo(this.x+15, this.y+40);
context.lineTo(this.x, this.y);context.lineTo(this.x-11, this.y+30);
context.lineTo(this.x-10, this.y+45);context.lineTo(this.x-29, this.y+16);
context.lineTo(this.x-40, this.y+40);context.moveTo(this.x-40, this.y+40);
context.lineTo(this.x-10, this.y+45);context.lineTo(this.x-35, this.y+60);
context.lineTo(this.x-45, this.y+90);context.moveTo(this.x-44, this.y+36);
context.lineTo(this.x-40, this.y+40);context.lineTo(this.x-35, this.y+60);
context.lineTo(this.x-55, this.y+70);context.moveTo(this.x+40, this.y+35);
context.lineTo(this.x+15, this.y+40);context.lineTo(this.x+5, this.y+50);
context.moveTo(this.x+40, this.y+35);context.lineTo(this.x+37, this.y+58);
context.lineTo(this.x+30, this.y+85);context.lineTo(this.x+28, this.y+65);
context.lineTo(this.x+15, this.y+40);context.lineTo(this.x-11, this.y+30);
context.moveTo(this.x+37, this.y+58);context.lineTo(this.x+47, this.y+70);
context.lineTo(this.x+30, this.y+85);context.lineTo(this.x+27, this.y+98);
context.moveTo(this.x+27, this.y+97);context.lineTo(this.x+15, this.y+95);
context.lineTo(this.x+10, this.y+104);context.moveTo(this.x-35, this.y+75);
context.lineTo(this.x-42, this.y+78);context.moveTo(this.x-28, this.y+92);
context.lineTo(this.x-45, this.y+90);
}
{
context.moveTo(this.x-5, this.y+140);
context.lineTo(this.x-18, this.y+120);context.lineTo(this.x-35, this.y+105);
context.lineTo(this.x-43, this.y+120);context.lineTo(this.x-53, this.y+110);
context.moveTo(this.x-53, this.y+110);context.lineTo(this.x-59, this.y+130);
context.moveTo(this.x-23, this.y+130);context.lineTo(this.x-18, this.y+119);
context.lineTo(this.x-30, this.y+127);context.moveTo(this.x-5, this.y+140);
context.lineTo(this.x+10, this.y+120);context.lineTo(this.x+38, this.y+100);
context.moveTo(this.x+38, this.y+100);context.lineTo(this.x+40, this.y+117);
context.lineTo(this.x+30, this.y+121);context.moveTo(this.x+40, this.y+118);
context.lineTo(this.x+50, this.y+129);context.moveTo(this.x+30, this.y+121);
context.lineTo(this.x+10, this.y+120);context.lineTo(this.x+12, this.y+130);
}
{
context.moveTo(this.x-5, this.y+145);
context.lineTo(this.x+23, this.y+135);context.lineTo(this.x+25, this.y+125);
context.moveTo(this.x+31, this.y+131);context.lineTo(this.x+23, this.y+135);
context.lineTo(this.x+5, this.y+165);context.lineTo(this.x+15, this.y+170);
context.lineTo(this.x+23, this.y+175);context.lineTo(this.x+15, this.y+149);
context.lineTo(this.x+27, this.y+153);context.moveTo(this.x+32, this.y+150);
context.lineTo(this.x+27, this.y+153);context.lineTo(this.x+34, this.y+175);
context.lineTo(this.x+24, this.y+193);context.lineTo(this.x+30, this.y+208);
context.lineTo(this.x+15, this.y+225);context.lineTo(this.x+27, this.y+253);
context.lineTo(this.x+27, this.y+250);context.lineTo(this.x+10, this.y+245);
context.lineTo(this.x+20, this.y+235);context.lineTo(this.x+30, this.y+240);
context.moveTo(this.x+28, this.y+283);context.lineTo(this.x+15, this.y+280);
context.lineTo(this.x+27, this.y+253);context.moveTo(this.x+15, this.y+225);
context.lineTo(this.x+5, this.y+217);context.lineTo(this.x+30, this.y+208);
context.lineTo(this.x+36, this.y+230);context.lineTo(this.x+30, this.y+240);
context.lineTo(this.x+35, this.y+253);context.lineTo(this.x+28, this.y+280);
context.lineTo(this.x+33, this.y+294);context.lineTo(this.x+13, this.y+310);
context.lineTo(this.x+28, this.y+284);context.moveTo(this.x+13, this.y+310);
context.lineTo(this.x+20, this.y+320);context.lineTo(this.x+33, this.y+325);
context.moveTo(this.x+13, this.y+310);context.lineTo(this.x+10, this.y+295);
context.moveTo(this.x+20, this.y+320);context.lineTo(this.x+10, this.y+335);
context.lineTo(this.x-5, this.y+330);context.lineTo(this.x+17, this.y+316);
context.lineTo(this.x+34, this.y+313);context.moveTo(this.x-5, this.y+145);
context.lineTo(this.x+12, this.y+180);context.lineTo(this.x+2, this.y+190);
context.lineTo(this.x+24, this.y+191);context.lineTo(this.x+37, this.y+200);
context.moveTo(this.x+15, this.y+200);context.lineTo(this.x+6, this.y+216);
}
{
context.moveTo(this.x-60, this.y+210);
context.lineTo(this.x-23, this.y+260);context.lineTo(this.x-33, this.y+200);
context.lineTo(this.x-31, this.y+180);context.lineTo(this.x-60, this.y+210);
context.moveTo(this.x-5, this.y+145);context.lineTo(this.x-25, this.y+150);
context.lineTo(this.x-45, this.y+130);context.lineTo(this.x-5, this.y+145);
context.lineTo(this.x-25, this.y+165);context.lineTo(this.x-25, this.y+150);
context.lineTo(this.x-45, this.y+165);context.lineTo(this.x-50, this.y+155);
context.moveTo(this.x-45, this.y+165);context.lineTo(this.x-60, this.y+210);
context.moveTo(this.x-31, this.y+180);context.lineTo(this.x-45, this.y+165);
context.lineTo(this.x-25, this.y+166);context.lineTo(this.x-10, this.y+175);
context.lineTo(this.x-31, this.y+180);context.lineTo(this.x-15, this.y+205);
context.lineTo(this.x-33, this.y+200);context.lineTo(this.x-40, this.y+220);
context.lineTo(this.x-23, this.y+260);context.lineTo(this.x-55, this.y+265);
context.lineTo(this.x-39, this.y+240);context.moveTo(this.x-40, this.y+220);
context.lineTo(this.x-60, this.y+210);context.moveTo(this.x-55, this.y+265);
context.lineTo(this.x-40, this.y+290);context.moveTo(this.x-23, this.y+260);
context.lineTo(this.x-40, this.y+290);context.lineTo(this.x-50, this.y+320);
context.moveTo(this.x-50, this.y+320);context.lineTo(this.x-30, this.y+310);
context.lineTo(this.x-23, this.y+260);context.moveTo(this.x-30, this.y+310);
context.lineTo(this.x-23, this.y+336);context.lineTo(this.x-16, this.y+310);
context.lineTo(this.x-30, this.y+310);
}
context.fillStyle = "rgba(190, 200, 200, 1)";
context.strokeStyle = "#eeeeee";
context.fill();
context.stroke();
}
}
////////////////////////////////////////////////////////// Interval loop
setInterval(World, 20);
|
import React from "react"
import styled, { keyframes } from "styled-components"
import { Link } from "gatsby"
const moveInLeft = keyframes`
0%{
opacity: 0;
transform: translateX(-10rem);
}
80%{
transform: translateX(1rem);
}
100%{
opacity: 1;
transform: translate(0);
}
`
const moveInRight = keyframes`
0%{
opacity: 0;
transform: translateX(10rem);
}
80%{
transform: translateX(-1rem);
}
100%{
opacity: 1;
transform: translate(0);
}
`
const Container = styled.div`
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
align-items: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 60%;
width: 100%;
padding: 10rem;
@media only screen and (max-width: 56.25em) {
padding: 5rem;
}
@media only screen and (max-width: 41em) {
padding: 3rem;
top: 50%;
align-content: center;
}
`
const NavLink = styled(Link)`
color: #efefef;
text-decoration: none;
text-transform: uppercase;
`
const Header = styled.span`
grid-column: 1 / -1;
width: 70%;
@media only screen and (max-width: 41em) {
width: 100%;
}
`
const Primary = styled.h2`
font-family: "Playfair Display", serif;
font-weight: 700;
font-size: 5rem;
line-height: 1.2;
animation: ${moveInLeft} 1s ease-out;
margin-bottom: 3rem;
@media only screen and (max-width: 41em) {
font-size: 2.6rem;
}
`
const Secondary = styled.h3`
font-family: "Playfair Display", serif;
font-weight: 400;
font-size: 2.7rem;
line-height: 1.3;
animation: ${moveInRight} 1s ease-out;
@media only screen and (max-width: 41em) {
font-size: 1.8rem;
}
`
const CTA = styled(Link)`
justify-self: center;
text-align: center;
color: #202020;
background-color: #efefef;
text-decoration: none;
padding: 1.5rem 3rem;
border: 1px solid #efefef;
font-size: 2.2rem;
border-radius: 50px;
transition: all 0.3s;
margin: 5rem 2rem;
&:hover {
background: transparent;
color: #efefef;
}
@media only screen and (max-width: 56.25em) {
font-size: 1.6rem;
}
@media only screen and (max-width: 41em) {
padding: 1rem 2rem;
grid-column: 1 / -1;
font-size: 1.4rem;
margin: 2rem 0;
}
`
const Landing = () => (
<Container>
<Header>
<Primary>
KnoGeo’s Patented Platform for Visualizing Real Estate Data in 3D
</Primary>
<Secondary>
Powering commercial and residential real estate offices and agents to
better analysis, presentation, and understanding
</Secondary>
</Header>
<CTA to="/residential">Explore KnoGeo Residential</CTA>
<CTA to="/commercial">Explore KnoGeo Commercial</CTA>
</Container>
)
export default Landing
|
function s(nums) {
let num = Number(nums[0]);
console.log(num * 2);
}
|
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Link } from 'react-router-dom';
import { withRouter } from 'react-router';
import axios from 'axios';
import '../../../public/css/catalogue.css';
class Catalogue extends Component {
constructor(props) {
super(props);
this.state = {
categories: [],
products_category: [],
isOffer: false,
};
}
componentDidMount() {
this.getAllCategories();
this.getProductsByCategory();
this.isOffer();
this.getOffers();
}
isOffer() {
axios.get('/api/product/thereIsAOffer')
.then(response => this.setState({ isOffer: response.data.data }))
.catch(error => console.log(error));
}
getOffers() {
if(this.props.match.params.idCategory == 'offers') {
axios.get('/api/product/productsOffer')
.then(response => this.setState({ products_category: response.data.data }))
.catch(error => console.log(error.response.data));
}
}
getAllCategories() {
axios.get('/api/category')
.then(response => this.setState({ categories: response.data.data }))
.catch(error => console.log(error.response.data))
}
getProductsByCategory() {
axios.get(`/api/product/byCategory/${this.props.match.params.idCategory}`)
.then( response => this.setState({ products_category: response.data.data }))
.catch( error => console.log(error.response.data));
}
isActiveCategory(id) {
return this.props.match.params.idCategory == id ? 'active-category' : '';
}
createCategoryMenu() {
return this.state.categories.map( category => (
<a href={`/catalogue/${category.id}`}>
<div className={`mt-3 mb-3 ${this.isActiveCategory(category.id)} category-menu`}>
{category.category_name}
</div>
</a>
));
}
showOffer(product) {
if (product.offer && product.offer_title !== null) {
return (
<div className="offer-content">
<span className="offer-title-catalogue">{product.offer_title}</span>
</div>
);
}
return undefined
}
showPrice(product) {
if (product.offer && product.offer_price !== null) {
return (
<div className="col-6">
<span style={{ fontSize: '17px', color: 'grey', position: 'absolute', transform: 'translate(5px, -14px)' }}>Antes</span>
<strike style={{color:'red'}}><span style={{ fontSize: '27px'}}>{product.price}$</span></strike>
<span style={{ fontSize: '17px', color: 'grey', position: 'absolute', transform: 'translate(111px, -14px)' }}>Ahora</span>
<span style={{ fontSize: '27px', color: 'black', position: 'absolute', transform: 'translate(107px, 1px)' }}>{product.offer_price}$</span>
</div>
);
}
return (
<span style={{ fontSize: '27px'}}>{product.price}$</span>
);
}
createIfExistOffer() {
if (this.state.isOffer) {
return (
<a href="/catalogue/offers">
<div className={`mt-3 mb-3 ${this.isActiveCategory("offers")} category-menu`}>
Promociones
</div>
</a>
);
}
}
createProducts() {
if(this.state.products_category.length === 0) {
return (
<div className="col align-self-center justify-content-center d-flex mb-5 notProducts">No tenemos ningun producto cargado aún.</div>
);
}
return this.state.products_category.map( product => (
<div className="text-center pr-0 mb-5 mr-3 ml-4">
<Link to={`/product/${product.id}`} title={product.title}>
<div className="container-product-catalogue pt-5">
{this.showOffer(product)}
<div className="container image-container-product" style={{ minWidth:'225px', minHeight:'309px'}}>
<img src={product.image_url} alt="" className="rounded image-product" style={{ width:'100%', height:'100%'}} />
</div>
<h4 className="title-card-product">
{product.title}
</h4>
<div>
<hr data-hook="product-item-line-between-name-and-price" class="linear" aria-hidden="true" />
</div>
{this.showPrice(product)}
</div>
</Link>
</div>
));
}
render() {
return (
<div className="container-fluid" >
<div className="d-flex justify-content-center mb-5 mt-5">
<h1> <span style={{ color: '#F1622c', fontSize: '54px' }}>CATALOGO</span></h1>
</div>
<div className="row">
<div className="col-12 col-lg-2 text-center">
<div className="wrapper-categories mb-5">
<h3 className="pt-4" style={{ fontSize: '34px', color: 'blue' }}>Categorias</h3>
<div className="mt-4 pb-4">
{this.createCategoryMenu()}
{this.createIfExistOffer()}
</div>
</div>
</div>
<div className="col-12 col-lg-10 pr-0 mr-0 row d-flex justify-content-center">
{this.createProducts()}
</div>
</div>
<i class="fas fa-chevron-circle-up icon-up d-lg-none" onClick={() => window.scroll({top:140, left:0, behavior: 'smooth'})}></i>
<div className="social-bar">
<a href="https://wa.me/5491162743761?text=Hola%20Nala%20queria%20realizar%20una%20consulta" target="_blank" className="icon-social" style={{ background: '#25d366'}}><i className="fab fa-whatsapp"></i></a>
<a href="https://www.instagram.com/nalaquilmes/?fbclid=IwAR3Zy-k9ihYTBbi3DurzfMn8s_xQGcYcIZ0HOJ68knEjGVg4xVWybmd4kik" target="_blank" className="icon-social instagram" ><i className="fab fa-instagram"></i></a>
<a href="https://www.facebook.com/Nala-Quilmes-1096349540445839/?ref=br_rs" target="_blank" className="icon-social" style={{ background: '#2E406E'}}><i className="fab fa-facebook-square"></i></a>
</div>
</div>
);
}
}
export default withRouter(Catalogue)
if (document.getElementById('catalogue')) {
ReactDOM.render(<Catalogue />, document.getElementById('catalogue'));
}
|
import {
createArrayType,
createMapType,
createPrimitiveType,
createType,
primitiveTypes
} from './type'
import config from './config'
import createCollectionDS from './collectionDS'
import createRecordDS from './recordDS'
import http from './http'
const Reforma = {}
primitiveTypes.forEach((primitiveTypeName) => {
Object.defineProperty(Reforma, primitiveTypeName, {
value: createPrimitiveType(primitiveTypeName)
})
})
Object.defineProperty(Reforma, 'arrayOf', {
value: function (valueType) {
return createArrayType(valueType)
}
})
Object.defineProperty(Reforma, 'mapOf', {
value: function (keyType, valueType) {
return createMapType(keyType, valueType)
}
})
Object.defineProperty(Reforma, 'createType', {
value: createType
})
Object.defineProperty(Reforma, 'config', {
value: config
})
Object.defineProperty(Reforma, 'http', {
value: http
})
Object.defineProperty(Reforma, 'createCollectionDS', {
value: createCollectionDS
})
Object.defineProperty(Reforma, 'createRecordDS', {
value: createRecordDS
})
export default Reforma
|
// JavaScript - Node v6.11.0
Test.assertEquals(getASCII('A'), 65);
Test.assertEquals(getASCII(' '), 32);
Test.assertEquals(getASCII('!'), 33);
|
import React from "react";
import "./Button.scss";
function Button({ type, onClick, children, variant }) {
if (!variant) {
variant = "outline";
}
return (
<button type={type} onClick={onClick} className={`button ${variant}`}>
{children}
</button>
);
}
export default Button;
|
var express = require('express');
var router = express.Router();
var JWToken = require('./auth');
router.all('*', function(req, res, next){
if(req.method === 'OPTIONS'){
next();
}else{
if( (req.method !== 'POST' && req.url === '/api/v1/users') ||
(req.url !== '/' && req.url !== '/api/v1/users/auth' && req.url !== '/api/v1/token' && req.url !== '/api/v1/users' && req.url !== '/api/v1/assets' &&
req.url !== '/api/v1/users/username' && req.url !== '/api/v1/lookup/country' && req.url !== '/api/v1/lookup/country/en' && req.url !== '/api/v1/lookup/category' && req.url !== '/api/v1/lookup/rol' &&
req.url !== '/api/v1/users/recover/test' && req.url !== '/api/v1/comic/uploadpdf' && req.url !== '/api/v1/comic/uploadthumbnail') ){
let token = (req.method === 'POST' || req.method === 'PUT') ? req.body.token : req.query.token
JWToken.verifyJWTToken(token).then((decodedToken) => {
req.user = decodedToken.data
next();
}).catch((err) => {
res.status(400).json({message: "Invalid auth token provided."});
});
}else{
next();
}
}
});
router.post('/api/v1/token', function(req, res, next){
if(typeof req.body != 'undefined' && typeof req.body.username != 'undefined' && typeof req.body.refreshToken != 'undefined'){
let token = JWToken.refreshJWToken(req, res, {
"username": req.body.username,
"refreshToken": req.body.refreshToken
}).then((token) => {
res.json({"status": 200, "error": null, "response": token});
}).catch((err) => {
res.status(400).json({message: "Invalid refresh token provided."});
})
}else{
res.json({"status": 500, "error": "incomplete parameters"});
}
});
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'CCTool API' });
});
module.exports = router;
|
window.addEventListener('load',()=>{
fetchPage();
registerSW();
});
async function fetchPage()
{
const res = fetch(topHeadlineUrl);
const json = await res.json();
const main = document.querySelector("main");
console.log("Page Fetch")
}
async function registerSW()
{
// console.log("Page Fetch")
if('serviceWorker' in navigator)
{
try{
await navigator.serviceWorker.register('service-worker.js');
}
catch(e)
{
console.log('SW Reg Failed')
}
}
}
|
import "../../Styles/HomePageStyle/BannerInfo.css"
// import BuyProduct from "./Banner/BuyProduct";
import { Link } from "react-router-dom";
// import { useState } from "react";
// import useAuth from '../../Auth/useAuth';
import {getProductBuyAction} from '../../redux/itemBuyDucks'
import { useDispatch } from "react-redux";
const BannerInfo = ({item}) => {
const dispatch = useDispatch()
// const auth = useAuth()
// const handleProduct = (itemProductBuy) => {
// auth.changeProduct(itemProductBuy)
// }
// getProductBuyAction
console.log(item)
return (
<div className="BannerInfo">
<div className="DescriptionBanner">
<h3>{item.DESCRIPCION}</h3>
<p>
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</p>
<Link to="/compraproducto"><button
onClick={dispatch(getProductBuyAction(item))}
> comprar producto </button></Link>
</div>
<div className="ImgBanner">
hola
{/* <img src={infoBannerdata.url} alt="ImgBanner"></img> */}
</div>
</div>
);
};
export default BannerInfo;
|
'use strict';
app.controller('fileUploadCtrl', function($scope, $location, $http) {
$http({
method: 'GET',
url: '/files'
}).then(function successCallback(files) {
$scope.directory_files = files.data;
console.log(files.data);
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
});
|
var baseDao = require('../daos/baseDao');
function createProduct(product, callback){
baseDao.create(product, "products", function(err, result){
if(err){
callback(err, null);
return;
}
callback(null, result);
return;
});
}
function getProductById(productId, callback){
baseDao.getById(productId, "products", function(err, result){
if(err){
callback(err, null);
return;
}
callback(null, result);
return;
});
}
function getProducts(callback){
baseDao.find("products", function(err, result){
if(err){
callback(err, null);
return;
}
callback(null, result);
return;
})
}
function updateProductById(productId, record, callback){
baseDao.updateById(productId, record, "products", function(err, result){
if(err){
callback(err, null);
return;
}
callback(null, result);
return;
});
}
function removeProductById(productId, callback){
baseDao.removeProductById(productId, "products", function(err, result){
if(err){
callback(err, null);
return;
}
callback(null, result);
return;
});
}
module.exports.createProduct = createProduct;
module.exports.getProductById = getProductById;
module.exports.getProducts = getProducts;
module.exports.updateProductById = updateProductById;
module.exports.removeProductById = removeProductById;
|
var dog, happyDog, database, foods, foodStock, currentHour, currentMinute;
var dogImg, happyDogImg, foodImg;
var hr, mn, sc;
var feedButton;
var addFood;
var food;
var col;
var foodArray = [];
function preload() {
dogImg = loadImage('images/dogImg.png');
happyDogImg = loadImage('images/dogImg1.png');
foodImg = loadImage('images/food.png');
}
function setup() {
createCanvas(800,600);
col = color(239, 95, 95);
feedButton = createButton('CLICK TO FEED THE DOG');
feedButton.position(400, 75);
feedButton.style('background-color', col);
feedButton.size(110, 110);
addFood = createButton('ADD FOOD');
addFood.position(600, 75);
addFood.style('background-color', col);
addFood.size(110, 110);
database = firebase.database();
dog = createSprite(600, 315, 200, 200);
dog.addImage(dogImg);
dog.scale = 0.30;
currentHour = hr;
currentMinute = mn;
database.ref('food').on('value', function(data){
foodStock = data.val();
})
}
function draw() {
background("grey");
textSize(10);
if(hr != undefined && feedButton.mousePressed()) {
push();
fill("black");
textSize(20);
textStyle(BOLD);
text("LAST FEED "+hr +":" + mn, 375, 80);
pop();
}
fill("black");
text(mouseX + "," + mouseY, 10, 10);
if(foodStock === 0) {
dog.addImage(dogImg);
}
feedButton.mousePressed(() =>{
console.log("insideIf");
dog.addImage(happyDogImg);
hr = hour();
mn = minute();
updateHour();
updateMinute();
if(foodStock != 0) {
writeStock(foodStock);
}
})
addFood.mousePressed(() =>{
addStocks(foodStock);
})
if(foodStock != undefined) {
textSize(20);
textStyle(BOLD);
text("FOOD REMAINING : "+foodStock,375,40);
}
hr = hour();
mn = minute();
sc = second();
text("CURRENT TIME "+ hr + ";" + mn + ";" + sc, 500, 500);
drawSprites();
}
function writeStock(x) {
if(x <= 0) {
x = 0;
}
else{
x = x-1;
}
database.ref('/').update({
food:x
})
}
function addStocks(y) {
if(30 <= y) {
y = 30
}
else {
y += 1
}
database.ref('/').update({
food:y
})
}
function updateHour(z) {
z = hr
database.ref('/').update({
hour:hr
})
}
function updateMinute(q) {
q = mn
database.ref('/').update({
minute:q
})
}
|
import React from "react";
import { Home } from "./views/home.js";
import injectContext from "./store/appContext";
//create your first component
const Layout = () => {
//the basename is used when your project is published in a subdirectory and not in the root of the domain
// you can set the basename on the .env file located at the root of this project, E.g: BASENAME=/react-hello-webapp/
const basename = process.env.BASENAME || "";
return (
<>
<Home />
</>
);
};
export default injectContext(Layout);
|
/*
Indexer.js
Adil Rafaa
Andrew Fischer
Andrew Kim
*/
var fs=require('fs');
var docFolder='Html';
var jsonFile='html_files.json';
var indexFile='index.json';
var url=require('url');
// Initial checking
if(process.argv.length<5)
{
console.log('I need doc folder, json file, index folder');
console.log('Using defaults...');
}
else
{
docFolder=process.argv[2]; // Html
jsonFile=process.argv[3]; // html_files.json
indexFile=process.argv[4]; // index.json
}
var startTime=new Date();
var docs=JSON.parse(fs.readFileSync(jsonFile));
var tRank=[],tRankIds={ },tRankId,numTRank=0;
var terms=[],termIds={ },termId,numTerms=0;
var docId,numDocs=0;
var contents;
var hrefs,i;
var currentURL;
//A map to keep track of ingoing and outgoing
var mURLS={ };
var urlToId={ };
for(docId=0;docs.hasOwnProperty(docId);++docId)
{
urlToId[docs[docId].url]=docId;
mURLS[docId]={ingoing:[],outgoing:[],rank:1};
}
for(docId=0;docs.hasOwnProperty(docId);++docId)
{
// Read doc
contents=fs.readFileSync(docFolder+'/'+docs[docId].file).toString();
//url.resolve('http://example.com/', '/one')
currentURL=docs[docId].url;
//Get all of the links or hrefs
hrefs=contents.split(/href=(?:"|')/i).slice(1);
for(i=hrefs.length-1;i>=0;--i)
{
hrefs[i]=hrefs[i].split(/(?:"|')/);
if(hrefs[i].length<2)
{ // If we didn't find a last quote
hrefs=hrefs.slice(0,i).concat(hrefs.slice(i+1));
continue;
}
hrefs[i]=hrefs[i][0];
if(!hrefs[i]||hrefs[i].slice(0,1)==='#' || hrefs[i].slice(0,7)==='mailto:')
{ // Reject some URLs
hrefs=hrefs.slice(0,i).concat(hrefs.slice(i+1));
continue;
}
//console.log("RESOLVING\n" + currentURL + " ==="+hrefs[i]);
hrefs[i]=url.resolve(currentURL, hrefs[i]);
}
//console.log(hrefs);
mURLS[docId].outgoing=hrefs;
for(i=hrefs.length-1;i>=0;--i)
{
//[docs[docId].url]
if(urlToId.hasOwnProperty(hrefs[i]))
{
mURLS[urlToId[hrefs[i]]].ingoing.push(currentURL);
}
}
//console.log("Passed-----");
// Clean / tokenize data
contents=contents.replace(/[\r\n]/g,' '); // Remove newlines
contents=contents.replace(/<[^>]+>/g,' '); // XML tags
contents=contents.toLowerCase();
contents=contents.replace(/'/g,''); // Collapse contractions (can't --> cant)
contents=contents.replace(/[^a-z0-9]+/g,' '); // Remove non-alphanumeric characters
contents=contents.replace(/[ ]+/g,' '); // Collapse whitespace
contents=contents.trim(); // Remove all whitespace on ends
// Add data to index
docs[docId].terms=[];
docs[docId].tf={ };
contents=contents.split(' ');
for(var i=0,tmp={ };i<contents.length;++i)
{
if(termIds.hasOwnProperty(contents[i]))
{ // Already seen term
termId=termIds[contents[i]];
if(!tmp.hasOwnProperty(docId))
{
tmp[docId]=true;
terms[termId].d.push({id:docId});
}
}
else
{ // Haven't seen term
termId=terms.length;
terms.push({t:contents[i],d:[{id:docId}]});
termIds[contents[i]]=termId;
}
docs[docId].terms.push(termId);
if(docs[docId].tf.hasOwnProperty(termId))
{
++docs[docId].tf[termId];
}
else
{
docs[docId].tf[termId]=1;
}
}
}
//console.log("Passed LOOP-----");
numDocs=docId;
// Compute td-idf
var idf,tf;
for(termId=0;termId<terms.length;++termId)
{
// idf
idf=Math.log(numDocs/terms[termId].d.length);
if(idf<0)
console.log(terms[termId].d.length);
// tf
for(var i=0;i<terms[termId].d.length;++i)
{
tf=docs[terms[termId].d[i].id].tf[termId];
terms[termId].d[i].tfidf=tf*idf;
}
}
numTerms=termId;
var index=JSON.stringify({terms:terms,docs:docs,termIds:termIds})
var totalTime=(new Date())-startTime;
// Print stats
console.log('1. Number of documents: '+numDocs);
console.log('2. Number of unique words: '+numTerms);
console.log('3. Index: '+indexFile);
console.log('4. Size of index: '+(index.length/1024).toFixed(1)+' KB');
console.log('5. Time spent to create index: '+(totalTime/1000).toFixed(1)+' seconds');
// Write index to file
fs.writeFileSync(indexFile,index);
/*
PR(A) = (1-d) + d (PR(T1)/C(T1) + ... + PR(Tn)/C(Tn))
where
PR(A) is the PageRank of page A,
PR(Ti) is the PageRank of pages Ti which link to page A,
C(Ti) is the number of outbound links on page Ti and
d is a damping factor which can be set between 0 and 1.
*/
var d= 0.85; //This is a good dampening from research
var totalCoeff=0; //This is the ...PR(T1)/C(T1) + ... + PR(Tn)/C(Tn)
var tIngoing;
//Now do terms
/*
'32937':
{ ingoing:
[ 'http://www.ics.uci.edu/~eppstein/pix/candystore/index.html',
'http://www.ics.uci.edu/~eppstein/pix/candystore/Rae.html',
'http://www.ics.uci.edu/~eppstein/pix/candystore/Lunchtime.html' ],
outgoing:
[ 'http://www.ics.uci.edu/~eppstein/pix/candystore/Lunchtime.html',
'http://www.ics.uci.edu/~eppstein/pix/candystore/index.html',
'http://www.ics.uci.edu/~eppstein/pix/candystore/Rae.html' ],
rank: 1 },
*/
var totalTime=(new Date());
console.log("Starting Page Rankings Iteration: 1...");
for(docId=0;docs.hasOwnProperty(docId);++docId)
{
//mURLS[urlToId[hrefs[i]]].ingoing
totalCoeff=0;
tIngoing=mURLS[docId].ingoing;
for(var A=0; A<tIngoing.length;++A)
{
totalCoeff+=mURLS[urlToId[tIngoing[A]]].rank/mURLS[urlToId[tIngoing[A]]].outgoing.length;
//tIngoing[]
}
mURLS[docId].rank=(1-d)+d*totalCoeff;
//console.log(docs[docId].url);
}
var totalTime=(new Date())-totalTime;
console.log('Current Time Inbetween: '+(totalTime/1000).toFixed(1)+' seconds');
var totalTime=(new Date());
console.log("Starting Page Rankings Iteration: 2...");
for(docId=0;docs.hasOwnProperty(docId);++docId)
{
//mURLS[urlToId[hrefs[i]]].ingoing
totalCoeff=0;
tIngoing=mURLS[docId].ingoing;
for(var A=0; A<tIngoing.length;++A)
{
totalCoeff+=mURLS[urlToId[tIngoing[A]]].rank/mURLS[urlToId[tIngoing[A]]].outgoing.length;
//tIngoing[]
}
mURLS[docId].rank=(1-d)+d*totalCoeff;
//console.log(docs[docId].url);
}
console.log('Current Time Inbetween: '+(totalTime/1000).toFixed(1)+' seconds');
var totalTime=(new Date());
var the_ranks=JSON.stringify(mURLS);
fs.writeFileSync('out.json',the_ranks);
var totalTime=(new Date())-startTime;
console.log('Finished. Total Run Time:' +(totalTime/1000).toFixed(1)+' seconds');
|
import React, { Component } from 'react';
class Promotions extends Component {
render() {
return (
<div className="panel panel-default well nopadding-bottom" >
<div className="panel-header">
<p className="s1 cond w400 col-005 nomargin-bottom nopadding-bottom" >Promoción del mes</p>
</div>
<div className="panel-body">
<img src="https://www.montepiedad.com.mx/storage/bnr-promo-mm.jpg" className="img-responsive" alt="Promo" />
</div>
<div className="panel-footer text-right nopadding">
<a className="btn btn-flat btn-default" href="https://tienda.montepiedad.com.mx/" target="_blank">Ir a la tienda<div className="ripple-container"></div></a>
<a className="btn btn-flat btn-warning" href="https://www.montepiedad.com.mx/portal/tienda-monte-sucursal.html" target="_blank">Ver todas las promociones<div className="ripple-container"></div></a>
</div>
</div>
)
}
}
export default Promotions;
|
function getFirstSelector(selector){
return document.querySelector(selector);
}
function nestedTarget(){
return document.getElementsByClassName('target')[0];
}
function deepestChild(){
const grandDiv = document.getElementById('grand-node');
const divs = grandDiv.querySelectorAll('div');
return divs[divs.length-1];
}
function increaseRankBy(n) {
const rankedLi = document.querySelectorAll('ul.ranked-list li')
let i = 0;
for (i = 0; i < rankedLi.length; i++ ) {
rankedLi[i].textContent = parseInt(rankedLi[i].textContent, 10) + n
}
}
|
//1. write a program which shows the counter after each second.
// let count = 0;
// counter = () =>{
// count++;
// console.log(count);
// }
// setInterval(counter,1000);
// 2. write a function which takes your name and displays the greeting with your name
// let name = prompt("What's your Name?")
// let greeting = (a) =>{
// console.log(`Welcome ${a}!
// How are You?`);
// }
// greeting(name);
// 3. write a function(arrow function) which takes two values and return its sum as a result
// let val1 = +prompt('Your 1st Value is:');
// let val2 = +prompt('Your 2nd Value is:');
// let sum = (a,b) =>{
// sumUp = `Your values are ${a} & ${b}
// and Sum is ${a+b}`
// return sumUp;
// }
// let result = sum(val1,val2);
// console.log(result);
//4. write a function(arrow function) which takes a number and multiply it with 0.5 and return the new value. print the new value outside the function
// let num = +prompt("Enter a number");
// let myFunction = (a) => num*0.5;
// let result = myFunction(num);
// console.log(result);
//5. print simple array of [1,2,3,4,5] with the help of array map funtion
// const arr = [1,2,3,4,5];
// arr.map((i) => console.log(i));
// 6. let arr = [{id:1,name:"abc"},{id:1,name:"efg"},{id:2,name:"hij"},{id:3,name:"xyz"}]
// iterate the given array through map function and print the name and id
// let arr = [{id:1,name:"abc"},{id:2,name:"efg"},{id:3,name:"hij"},{id:4,name:"xyz"}]
// arr.map((i) => console.log(`id: ${i.id}
// name:${i.name}`));
|
import React from "react";
import "./App.css";
import Homepage from "./components/Homepage/Homepage";
import About from "./pages/About/About";
import Login from "./components/Login/Login";
import Profile from "./pages/Profile"
import JavaScriptProjects from "./pages/JavaScriptProjects";
import ReactProjects from "./pages/ReactProjects";
import AlgProjects from "./pages/AlgProjects";
import Contact from "./pages/Contact/Contact";
// import CompletedProjects from "./pages/CompletedProjects";
// import ProjectForm from "./components/ProjectForm/index";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import 'bootstrap/dist/css/bootstrap.min.css';
import Footer from './components/Footer/Footer';
function App() {
return (
<Router>
<Switch>
<Route exact path="/" component={Homepage} />
<Route exact path="/about" component={About} />
<Route exact path="/login" component={Login} />
<Route exact path="/profile" component={Profile} />
<Route exact path="/jsprojects/" component={JavaScriptProjects} />
<Route exact path="/reactprojects/" component={ReactProjects} />
<Route exact path="/algprojects/" component={AlgProjects} />
<Route exact path="/contact" component={Contact} />
</Switch>
{/* </div> */}
<Footer />
</Router>
);
}
export default App;
|
OperacionesManager.module("ContratoApp", function(ContratoApp, OperacionesManager, Backbone, Marionette, $, _){
ContratoApp.Router = Marionette.AppRouter.extend({
appRoutes: {
"crear-contrato": "crearContrato",
"contratos/:codigo": "detalleContrato",
"contratos/:codigo/editar": "editarContrato",
"contratos/:codigo/ampliaciones/crear": "crearAmpliacion",
"contratos/:codigo/ampliaciones": "listaAmpliaciones",
"contratos/:codigo/abonos/crear": "crearAbono",
"contratos/:codigo/abonos": "listaAbonos",
"contratos/:codigo/aumentos/crear": "crearAumento",
"contratos/:codigo/aumentos": "listaAumentos",
"contratos/:codigo/disoluciones/crear": "crearDisolucion",
"contratos/:codigo/disoluciones": "listaDisoluciones",
}
});
var API = {
crearContrato: function() {
ContratoApp.Crear.Controller.crear();
},
detalleContrato: function(codigo) {
ContratoApp.Detalle.Controller.detalle(codigo);
},
editarContrato: function(codigo) {
ContratoApp.Editar.Controller.editar(codigo);
},
crearAmpliacion: function(codigo) {
ContratoApp.Ampliacion.Controller.crear(codigo);
},
listaAmpliaciones: function(codigo) {
ContratoApp.Ampliacion.Controller.listar(codigo);
},
crearAbono: function(codigo) {
ContratoApp.Abono.Controller.crear(codigo);
},
listaAbonos: function(codigo) {
ContratoApp.Abono.Controller.listar(codigo);
},
crearAumento: function(codigo) {
ContratoApp.Aumento.Controller.crear(codigo);
},
listaAumentos: function(codigo) {
ContratoApp.Aumento.Controller.listar(codigo);
},
crearDisolucion: function(codigo) {
ContratoApp.Disolucion.Controller.crear(codigo);
},
listaDisoluciones: function(codigo) {
ContratoApp.Disolucion.Controller.listar(codigo);
}
};
OperacionesManager.on("contrato:crear", function(){
OperacionesManager.navigate("crear-contrato");
API.crearContrato();
});
OperacionesManager.on("contrato:detalle", function(codigo){
OperacionesManager.navigate("contratos/" + codigo);
API.detalleContrato(codigo);
});
OperacionesManager.on("contrato:editar", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/editar");
API.editarContrato(codigo);
});
OperacionesManager.on("ampliacion:crear", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/ampliaciones/crear");
API.crearAmpliacion(codigo);
});
OperacionesManager.on("ampliacion:lista", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/ampliaciones");
API.listaAmpliaciones(codigo);
});
OperacionesManager.on("abono:crear", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/abonos/crear");
API.crearAbono(codigo);
});
OperacionesManager.on("abono:lista", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/abonos");
API.listaAbonos(codigo);
});
OperacionesManager.on("aumento:crear", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/aumentos/crear");
API.crearAumento(codigo);
});
OperacionesManager.on("aumento:lista", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/aumentos");
API.listaAumentos(codigo);
});
OperacionesManager.on("disolucion:crear", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/disoluciones/crear");
API.crearDisolucion(codigo);
});
OperacionesManager.on("disolucion:lista", function(codigo){
OperacionesManager.navigate("contratos/" + codigo + "/disoluciones");
API.listaDisoluciones(codigo);
});
ContratoApp.on("start", function(){
new ContratoApp.Router({
controller: API
})
});
});
|
"use strict";
var _ = require("lodash");
// Given a search string, find the values that have a given prefix.
function getQueriesWithPrefix(queryString, prefix) {
function hasPrefix(query) {
var parts = query.split(":");
return parts[0] === prefix && parts[1];
}
function getValue(query) {
return query.split(":")[1];
}
var queries = queryString.split(" ");
var queriesWithPrefix = _.filter(queries, hasPrefix);
return _.map(queriesWithPrefix, getValue);
}
module.exports = {
getQueriesWithPrefix: getQueriesWithPrefix
}
|
/* eslint-disable @next/next/no-img-element */
import React from "react";
import styles from "../../../styles/PizzaCard.module.css";
import Link from "next/link";
function PizzaCard({ key, data }) {
return (
<div className={styles.cardContainer} key={key}>
<Link href={`/pizza/${data._id}`}>
<img src={data.image} alt="pizza" width={260} height={260} />
</Link>
<h1 className={styles.pizzaTitle}>{data.title}</h1>
<span className={styles.pizzaPrice}>${data.prices[0]}</span>
<p className={styles.pizzaDesc}>{data.desc}</p>
</div>
);
}
export default PizzaCard;
|
import axios from 'axios'
//Types
const ALL_LAUNCHES = 'ALL LAUNCHES'
//action creators
export const getLaunches = launchData => ({
type: ALL_LAUNCHES, launchData
})
//thunks
export const loadLaunches = () => {
return dispatch => {
return axios.get('https://api.spacexdata.com/v3/launches/')
.then(res => res.data)
.then(launches => {
launches.reverse();
return dispatch(getLaunches(launches))
})
.catch(err => console.error(err))
}
}
//reducer
const launchReducer = (state = [], action) => {
switch(action.type){
case ALL_LAUNCHES:
return [ ...state, ...action.launchData]
default:
return state
}
}
export default launchReducer
|
$(function() {
$('.message').click(function() {
$(this).fadeOut('slow');
});
$('[data-toggle="popover"]').popover();
$('[data-toggle="tooltip"]').tooltip();
});
function getFormDataAsJson($form) {
var data = {};
$form.serializeArray().map(function(x){data[x.name] = x.value;});
return data;
}
|
"use strict";require(["controller"],function(i){console.log("main init started"),i.init()});
|
// pages/chat/chat.js
Page({
/**
* 页面的初始数据
*/
data: {
message:[],
input:"",
inputHeight:"30px",
btnVisibility:"collapse"
},
upload(){
if(this.data.input.length > 0){
wx.showLoading({
title: '上传中.....',
mask:"true",
});
wx.cloud.callFunction({
name:"textSecu",
data:{
content:this.data.input
}
}).then(res=>{
if(res.result.errCode ===0){
wx.cloud.callFunction({
name:"addChat",
data:{
content:this.data.input
}
}).then(res=>{
this.setData({
input:""
});
let db = wx.cloud.database();
let length = this.data.message.length;
db.collection("chat").skip(length).limit(10).get().then(res=>{
let newArray = this.data.message.concat(res.data);
this.setData({message:newArray});
}).catch(err=>console.log(err));
wx.hideLoading();
wx.showToast({
title: '上传成功',
duration: 1300,
icon:"success"
});
}).catch(err=>{
wx.hideLoading();
wx.showToast({
title: '上传失败',
duration: 1900,
icon:"none"
});
});
}else{
wx.hideLoading();
wx.showToast({
title: '上传失败,上传内容有违规信息',
duration: 1800,
icon:"none"
});
}
});
}else{
wx.showToast({
title: '输入内容不能为空',
duration: 1800,
icon:"none"
})
}
},
getSmall(){this.setData({
inputHeight:"30px",
btnVisibility:"collapse"
})},
getLarge(){
this.setData({
inputHeight:"100px",
btnVisibility:"visible"
})
},
chatInput(e){
this.setData({
input:e.detail.value
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let db = wx.cloud.database();
db.collection("chat").limit(10).get().then(res=>{
this.setData({message:res.data});
}).catch(err=>console.log(err));
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let db = wx.cloud.database();
let length = this.data.message.length;
db.collection("chat").skip(length).limit(10).get().then(res=>{
let newArray = this.data.message.concat(res.data);
this.setData({message:newArray});
}).catch(err=>console.log(err));
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
|
// pages/teacherThinking/teacherThinking.js
Page({
/**
* 页面的初始数据
*/
data: {
commentList:
[{
name: '1111',
comment: '1111大帅b',
isLike: false,
imgUrl: '../image/personal1.png',
dataid: 0
}, {
name: '111',
comment: '11大帅b',
isLike: false,
imgUrl: '../image/personal1.png',
dataid: 1
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.getStorage({
key: 'openid',
fail: () => { wx.redirectTo({ url: '../index/index', }) },
})
},
giveAgree: function (e) {
let commentId = e.currentTarget.dataset.id
let commentList = this.data.commentList
commentList[commentId].isLike = true
this.setData({
'commentList': commentList
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
|
/**
* Created by anna on 07.10.16.
*/
import React, { Component } from 'react';
import { View, Text, StyleSheet, Image } from 'react-native';
import { Bubbles, DoubleBounce, Bars, Pulse } from 'react-native-loader';
const Loader = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Bars size={10} color='#8e44ad' />
</View>
);
}
});
var styles = StyleSheet.create({
loader: {
flex: 1,
justifyContent: 'center'
}
});
module.exports = Loader;
|
var1=16;
var2=4;
var3=var1+var2;
console.log(var3);
|
import React from 'react'
function Contact() {
return (
<div>
<h3>Get In Touch</h3>
<p>We would love to hear from you.</p>
<form>
<label>Name:</label>
<input type="text" name='fullname' />
<br></br>
<label>Email Adress:</label>
<input type="email" name='email' />
<br></br>
<label>Message:</label>
<input type="text" name='msg' />
<br></br>
<button>Submit</button>
</form>
</div>
)
}
export default Contact
|
var dat2;
var dat3;
function getData()
{
<<<<<<< HEAD
const chart = new Chart(tsctx, options);
=======
$.ajax({
type: "GET",
url: "/ReadmissionAnalyzer/tes/testdat.csv",
dataType: "text",
success: function(data) {
//console.log(data.text) ;
coordinates=preprocess(data);
xvalues=coordinates[0];
yvalues=coordinates[1];
console.log("\nI am here "+xvalues[0]+"\t"+xvalues[1]);
const tsctx = document.getElementById('time_series_chart').getContext('2d');
const tsdata = {
// Labels should be Date objects
//labels: [new Date(2017, 08, 16), new Date(2017, 08, 17), new Date(2017, 08, 18)],
labels: xvalues,
datasets: [{
fill: false,
label: 'Readmissions',
//data: [280, 250, 340],
data:yvalues,
borderColor: '#fe8b36',
backgroundColor: '#fe8b36',
lineTension: 0,
}]
}
const options = {
type: 'line',
data: tsdata,
options: {
fill: false,
responsive: true,
scales: {
xAxes: [{
type: 'time',
display: true,
scaleLabel: {
display: true,
labelString: "Date",
}
}],
yAxes: [{
ticks: {
beginAtZero: true,
},
display: true,
scaleLabel: {
display: true,
labelString: "Readmissions",
}
}]
}
}
}
const chart = new Chart(tsctx, options);
},
error:function(err){console.log(err)},
});
// array of objects
$.ajax({
type: "GET",
url: "./tes/testdata.csv",
dataType: "text",
success: function(data) { dat3 = $.csv.toObjects(data);
}
});
>>>>>>> 2c9679d99206b19865f73459fa8e0ae6ae1c3d39
}
function preprocess(data)
{
dat2 = $.csv.toArrays(data);
resstr='';
tuple=[]
code="<Br>{}"
<<<<<<< HEAD
/*var i=1;
flag=0
for (var row in dat3)
{
if((i+=1)>4)
{
flag=2;
break;
}
for (var item in dat3[row])
{
// if(flag==2)break;
console.log("bitches get stitches\n<br>")//tuple=str(dat2[ind]).split()
}
//for (var col in dat2[row]);
//code=code+dat2[row][col]+"<br>{}"
}
elem=dat2[1].toString()
elem=elem.split('')
console.log("Check"+elem[0][1])*/
//================
=======
>>>>>>> 2c9679d99206b19865f73459fa8e0ae6ae1c3d39
empty = "";
html = "<table>";
counter=0
xvalues=[]
yvalues=[]
for(i = 0; i < dat2.length; i++){
html += "<tr>";
if(i==0)continue;
counter=0;
for(j = 0; j < dat2[i].length; j++){
if(counter==0)
xvalues.push(dat2[i][j]);
if(counter==1)
yvalues.push(dat2[i][j])
html +="<td>"+dat2[i][j]+"</td>";
if(dat2[i][j].trim() == ""){
empty += "cell "+i+" "+j+" is empty";
empty += "<br />";
}
counter=counter+1;
}
html += "</tr>";
}
//============================
tuple=dat2[0].toString().split(" ")
<<<<<<< HEAD
drawchart(xvalues,yvalues);
=======
//drawchart(xvalues,yvalues);
>>>>>>> 2c9679d99206b19865f73459fa8e0ae6ae1c3d39
console.log(xvalues[0]+"$ "+xvalues[1]+"$"+xvalues[2])
/*$('#map').html( 'Length of dat2 is ' + dat2.length + '<br>' +
'Length of dat3 is ' + dat3.length + '<br>' +
'Is dat0 equal to dat2: ' + _.isEqual(dat0, dat2)+ '<br>' +
'Is dat1 equal to dat3: ' + _.isEqual(dat1, dat3)+'\n dat2 xvalues <br>'+html+"<br>end")*/
<<<<<<< HEAD
=======
return [xvalues,yvalues];
}
$(document).ready(function() {
});
function tryutton()
{
alert("here")
>>>>>>> 2c9679d99206b19865f73459fa8e0ae6ae1c3d39
const tsctx = document.getElementById('time_series_chart').getContext('2d');
const tsdata = {
// Labels should be Date objects
//labels: [new Date(2017, 08, 16), new Date(2017, 08, 17), new Date(2017, 08, 18)],
labels: xvalues,
datasets: [{
fill: false,
label: 'Readmissions',
//data: [280, 250, 340],
data:yvalues,
borderColor: '#fe8b36',
backgroundColor: '#fe8b36',
lineTension: 0,
}]
}
const options = {
type: 'line',
data: tsdata,
options: {
fill: false,
responsive: true,
scales: {
xAxes: [{
type: 'time',
display: true,
scaleLabel: {
display: true,
labelString: "Date",
}
}],
yAxes: [{
ticks: {
beginAtZero: true,
},
display: true,
scaleLabel: {
display: true,
labelString: "Readmissions",
}
}]
}
}
}
<<<<<<< HEAD
}
$(document).ready(function() {
$.ajax({
type: "GET",
url: "/ReadmissionAnalyzer/tes/testdat.csv",
dataType: "text",
success: function(data) {
//console.log(data.text) ;
preprocess(data)
},
error:function(err){console.log(err)},
});
// array of objects
$.ajax({
type: "GET",
url: "./tes/testdata.csv",
dataType: "text",
success: function(data) { dat3 = $.csv.toObjects(data);
}
});
});
=======
const chart = new Chart(tsctx, options);
}
>>>>>>> 2c9679d99206b19865f73459fa8e0ae6ae1c3d39
//}); // end document ready
|
$(function(){
//菜单
$("#click").click(function () {
if($(".menu-iul").css("display") == "none"){
$("#none").css("display","block");
}else{
$("#none").css("display","none");
}
event.stopPropagation();
$(this).find(".menu-iul").toggle();
return false;
})
var toggle = true;
$(".ico_15").click(function () {
if(toggle){
$(this).css('background-image','url(images/menu1_15.png)');
toggle = false;
}else {
$(this).css('background-image','url(images/menu_15.png)');
toggle = true;
}
})
})
|
let mymap = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(mymap);
let containers;
let containerMarkers = L.markerClusterGroup();
const socket = io.connect('https://iot-smart-garbage-container.herokuapp.com')
//const socket = io.connect('http://localhost:3000')
socket.on('getcontainers', data =>
{
containers = new Map(JSON.parse(data));
console.log(containers);
render();
})
socket.on('update_containers', data =>
{
container = JSON.parse(data);
containers.set(container.id, container);
console.log(containers);
render();
})
socket.on('delete_container', data =>
{
container = JSON.parse(data);
containers.delete(container);
console.log(containers);
render();
})
function render()
{
containerMarkers.clearLayers();
containers.forEach((element, key, map) =>
{
let marker = L.marker([element.longitude, element.latitude], {icon: containerIcon});
marker.on('click', (e) =>
{
getInfoViewPanel(element);
})
//marker.bindPopup(`<b>fullness:</b><br>${element.fullness}.`).openPopup();
containerMarkers.addLayer(marker);
});
mymap.addLayer(containerMarkers);
}
// let marker = L.marker([51.5, -0.09]).addTo(mymap);
function getInfoViewPanel(container)
{
let panel = document.getElementById("myForm");
panel.innerHTML =
`<form class="form-container">
<h1>Container ID:<br> ${container.id}</h1>
<label><b>fullness:</b></label>
<label>${container.fullness}</label>
<p>
<label><b>latitude:</b></label>
<label>${container.latitude}<br></label>
<label><b>longitude:</b></label>
<label>${container.longitude}<br></label>
</p>
</form>`;
panel.style.display = "block";
}
const containerIcon = L.icon({
iconUrl: "assets/images/container.svg",
iconSize: [40, 40], // size of the icon
});
// let circle = L.circle([51.508, -0.11], {
// color: 'red',
// fillColor: '#f03',
// fillOpacity: 0.5,
// radius: 500
// }).addTo(mymap);
// var polygon = L.polygon([
// [51.509, -0.08],
// [51.503, -0.06],
// [51.51, -0.047]
// ]).addTo(mymap);
// marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();
// circle.bindPopup("I am a circle.");
// polygon.bindPopup("I am a polygon.");
|
/**
* Represents a view.
* @class navigationView
*
* Use the get keyword to make our methods serve as getters for a property.
* This means they will be accessible as properties, but defined as methods,
* retaining compatibility with any existing references if you're converting existing code.
*
* @author
*/
import App from '../../app';
import Helpers from '../../utils/helpers';
let $ = App.$;
// Creates a new view class object
class navigationView extends App.ComponentView {
// options property
get _options() {
return {
activeClass: 'is-active',
scrollClass: 'isnt-scrollable'
}
}
// set options
set _options(opts) {
this.options = opts;
}
/**
* Events property
*/
get events() {
}
initialize(obj) {
this._options = Helpers.defaults(obj.options || {}, this._options);
this.offset = App.settings.height;
this.bindEvents();
}
/**
* Bind all events
*/
bindEvents() {
App.Vent.on(App.Events.navigationToggle, this.toggleNavigation.bind(this))
}
// Renders the view's template to the UI
render() {
this.$el.css({
top: this.offset
});
// Maintains chainability
return this;
}
toggleNavigation(e) {
if (e && e.preventDefault) e.preventDefault();
this.$el.toggleClass(this.options.activeClass);
$('body').toggleClass(this.options.scrollClass);
}
}
// Returns the view class
export default navigationView;
|
import React from 'react';
import './itemBar.css';
import chatIcon from '../assets/chatIcon.png';
import addFriend from '../assets/addFriend.png';
import getOut from '../assets/getOut.png';
export default class ItemBar extends React.Component{
render(){
var classActive = this.props.active === 'true' ? 'active' : '';
var icon = this.props.nameIcon === 'chat' ? chatIcon : this.props.nameIcon === 'addFriend' ? addFriend : getOut;
return(
<div className={"item "+classActive} {...this.props}>
<img src={icon} />
</div>
);
}
}
|
/* jshint globalstrict:false, strict:false, maxlen: 200 */
/* global assertEqual, assertTrue, assertNotEqual, arango */
// //////////////////////////////////////////////////////////////////////////////
// / DISCLAIMER
// /
// / Copyright 2021 ArangoDB GmbH, Cologne, Germany
// /
// / Licensed under the Apache License, Version 2.0 (the "License")
// / you may not use this file except in compliance with the License.
// / You may obtain a copy of the License at
// /
// / http://www.apache.org/licenses/LICENSE-2.0
// /
// / Unless required by applicable law or agreed to in writing, software
// / distributed under the License is distributed on an "AS IS" BASIS,
// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// / See the License for the specific language governing permissions and
// / limitations under the License.
// /
// / @author Max Neunhoeffer
// //////////////////////////////////////////////////////////////////////////////
const jsunity = require('jsunity');
function getMetric(name) {
let res = arango.GET_RAW( '/_admin/metrics/v2');
if (res.code !== 200) {
throw "error fetching metric";
}
let re = new RegExp("^" + name);
let matches = res.body.split('\n').filter((line) => !line.match(/^#/)).filter((line) => line.match(re));
if (!matches.length) {
throw "Metric " + name + " not found";
}
return Number(matches[0].replace(/^.* (\d+)$/, '$1'));
}
function checkMetricsMoveSuite() {
'use strict';
return {
testByProtocol: function () {
// Note that this test is "-noncluster", since in the cluster
// all sorts of requests constantly arrive and we can never be
// sure that nothing happens. In a single server, this is OK,
// only our own requests should arrive at the server.
let http1ReqCount = getMetric("arangodb_request_body_size_http1_count");
let http1ReqSum = getMetric("arangodb_request_body_size_http1_sum");
let http2ReqCount = getMetric("arangodb_request_body_size_http2_count");
let http2ReqSum = getMetric("arangodb_request_body_size_http2_sum");
let vstReqCount = getMetric("arangodb_request_body_size_vst_count");
let vstReqSum = getMetric("arangodb_request_body_size_vst_sum");
// Do a few requests:
for (let i = 0; i < 10; ++i) {
let res = arango.GET_RAW("/_api/version");
assertEqual(200, res.code);
}
// Note that GET requests do not have bodies, so they do not move
// the sum of the histogram. So let's do a PUT just for good measure:
let logging = arango.GET("/_admin/log/level");
let res = arango.PUT_RAW("/_admin/log/level", logging);
assertEqual(200, res.code);
// And get the values again:
let http1ReqCount2 = getMetric("arangodb_request_body_size_http1_count");
let http1ReqSum2 = getMetric("arangodb_request_body_size_http1_sum");
let http2ReqCount2 = getMetric("arangodb_request_body_size_http2_count");
let http2ReqSum2 = getMetric("arangodb_request_body_size_http2_sum");
let vstReqCount2 = getMetric("arangodb_request_body_size_vst_count");
let vstReqSum2 = getMetric("arangodb_request_body_size_vst_sum");
if (arango.protocol() === "vst") {
assertNotEqual(vstReqCount, vstReqCount2);
assertNotEqual(vstReqSum, vstReqSum2);
} else {
assertEqual(vstReqCount, vstReqCount2);
assertEqual(vstReqSum, vstReqSum2);
}
if (arango.protocol() === "http") {
assertNotEqual(http1ReqCount, http1ReqCount2);
assertNotEqual(http1ReqSum, http1ReqSum2);
} else {
assertEqual(http1ReqCount, http1ReqCount2);
assertEqual(http1ReqSum, http1ReqSum2);
}
if (arango.protocol() === "http2") {
assertNotEqual(http2ReqCount, http2ReqCount2);
assertNotEqual(http2ReqSum, http2ReqSum2);
} else {
assertEqual(http2ReqCount, http2ReqCount2);
assertEqual(http2ReqSum, http2ReqSum2);
}
},
testConnectionCountByProtocol: function () {
let http2ConnCount = getMetric("arangodb_http2_connections_total");
let vstConnCount = getMetric("arangodb_vst_connections_total");
// I have not found a reliable way to trigger a new connection from
// `arangosh`. `arango.reconnect` does not work since it is caching
// connections and the request timeout is not honoured for HTTP/2
// and VST by fuerte. The idle timeout runs into an assertion failure.
// Therefore, we must be content here to check that the connection
// count is non-zero for the currently underlying protocol:
if (arango.protocol() === "http2") {
assertNotEqual(0, http2ConnCount);
} else if (arango.protocol() === "vst") {
assertNotEqual(0, vstConnCount);
}
},
};
}
jsunity.run(checkMetricsMoveSuite);
return jsunity.done();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.