text stringlengths 7 3.69M |
|---|
var context_8h =
[
[ "Context", "structContext.html", "structContext" ],
[ "EventContext", "structEventContext.html", "structEventContext" ],
[ "NotifyContext", "context_8h.html#a4b12137da3b4327ecfe951e545f36d4c", [
[ "NT_CONTEXT_OPEN", "context_8h.html#a4b12137da3b4327ecfe951e545f36d4ca551ca75b292371bbc41245b44edb1bee", null ],
[ "NT_CONTEXT_CLOSE", "context_8h.html#a4b12137da3b4327ecfe951e545f36d4ca5d764aae39090c6c93e268d40d2237c6", null ]
] ],
[ "ctx_free", "context_8h.html#a438aad8b9b9193a15648a4f1f8039cfb", null ],
[ "ctx_mailbox_observer", "context_8h.html#ae00c71eb34e06ec9e34fa63aeb38824f", null ],
[ "ctx_new", "context_8h.html#a277306cf26d4e75052d80cc100cbdbab", null ],
[ "ctx_update", "context_8h.html#a9388581d0baec70c2962fdb99fd1a35c", null ],
[ "ctx_has_limit", "context_8h.html#addeed4e3ed0c2c32b80d97831bfadcf3", null ],
[ "message_is_tagged", "context_8h.html#aab50b1725a8314f589d3bbfb1edaa0d2", null ],
[ "mutt_get_virt_email", "context_8h.html#a0882b6875e05115e47a09836c63b5bf9", null ],
[ "el_add_tagged", "context_8h.html#a543e45c288497e953332f7f20c761caf", null ]
]; |
import React, {Component} from 'react';
import Message from './Message.jsx';
/* iterates over [{messages} either Messages or Notifications]
rendering each to display container */
class MessageList extends Component {
render() {
let messageDetails = this.props.messages.map(details =>
<Message
key={details.id}
name={details.username}
content={details.content}
type={details.type}
/>
)
return (
<main className="messages">
{ messageDetails }
</main>
)
}
}
export default MessageList;
// eliminates validation errors on props (replaces react proptypes)
MessageList.propTypes = {
messages: function(obj) {
if(typeof obj === 'object') return null;
throw Error(`MessageList is expecting an object but got ${typeof obj}`);
},
}
|
/**
* Created by wen on 2016/8/16.
*/
import React, { PropTypes,Component } from 'react';
import ClassName from 'classnames';
import {TextArea,LocalButton,Toast} from "../../../components";
import s from './BMmodifyEmail.css';
import history from '../../../core/history';
import {clientFetch} from "../../../utils/clientFetch"
class BMmodifyEmail extends Component {
constructor(props) {
super(props);
this.state = {
code:"",
isToast:false,
ToastMsg:"",
isBtn:true,
mobileCode:"",
};
this.data={
localBtn: {
btnText1: "取消",
btnText2: "提交",
btnCB1: ()=> {
history.go(-1);
},
btnCB2: ()=> {
let param;
let value = this.refs.nickname.getValue().state ? this.refs.nickname.getValue() : this.matchValue(this.refs.nickname.getValue());
param = {account_name:this.GetQueryString("account_name"),email:value.val};
value.state &&clientFetch("/member/modifyinfo",param).then(res=>{
if( res.code === 200){
this.showToast({msg:"修改成功"})
setTimeout(()=>{
history.go(-1);
},2000)
}else{
this.showToast({msg:res.msg||"修改失败"});
}
})
},
btnStyle: ["bg1", "fz2", "color2"],
border:true,
},
}
}
GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
}
static contextTypes = {
insertCss: PropTypes.func.isRequired,
setTitle: PropTypes.func.isRequired,
setState: PropTypes.func,
showLoad: PropTypes.func,
clearLoad: PropTypes.func,
};
componentWillMount() {
const { insertCss,setTitle } = this.context;
this.removeCss = insertCss(s);
setTitle("修改邮箱");
}
componentDidMount() {
this.context.clearLoad();
}
componentWillUnmount() {
this.removeCss()
}
showToast(opt){
console.log(opt);
this.setState({
isToast:false,
})
setTimeout(()=>{
this.setState({
isToast:true,
ToastMsg:opt.msg
})
},100)
return opt;
}
matchValue(opt){
for(var o in opt){
if(!opt[o].state){
return this.showToast(opt);
}
}
return true;
}
render() {
return (
<div className={s.modifyNickname}>
{this.state.isToast && <Toast showText={this.state.ToastMsg} />}
<LocalButton {...this.data.localBtn} />
<TextArea ref="nickname" validaType={['required',"email"]} placeholder="请输入邮箱地址" />
</div>
);
}
}
export default BMmodifyEmail;
|
const express = require('express');
const http = require('http');
// Basic calculator API
function add(n1, n2) {
return n1 + n2;
}
// REST calculator API
function caclServer(port, isStartedCB) {
const app = express();
app.get('/api/calc/add/:n1/:n2', (req, res) => {
const n1 = Number(req.params.n1);
const n2 = Number(req.params.n2);
res.send(200, add(n1, n2));
});
let server = http.createServer(app)
setTimeout(() => {
server.listen(port, () => {
isStartedCB(server);
})
}, 2000)
};
module.exports = {
add,
caclServer
} |
const Deployer = require( './index.js' )
const d = new Deployer( {
host: 'httpbin.org',
service: '/status/401'
} )
d.deploy( )
|
var { TextureLoader, JSONLoader, Mesh, MeshStandardMaterial, Vector2 } = require('./three.js');
var texLoader = new TextureLoader();
var jsonLoader = new JSONLoader();
var loadTexture = url => new Promise( resolve => texLoader.load( url, resolve ) );
var loadJSON = url => new Promise( resolve => jsonLoader.load( url, resolve ) );
module.exports = envMap => Promise.all([
loadJSON('./static/geometry.json'),
loadTexture('./static/diffuse.jpg'),
loadTexture('./static/normal.png'),
// loadTexture('./assets/roughness.jpg')
]).then( ([ geometry, map, normalMap/*, roughnessMap */ ]) => {
return new Mesh( geometry, new MeshStandardMaterial({
envMap,
normalMap,
normalScale: new Vector2( .6, 0 ),
map,
// roughnessMap,
roughness: 0,
metalness: 1
}));
})
// var { TextureLoader, Geometry, Mesh, MeshStandardMaterial, Vector2 } = require('./three.js');
// var FBXLoader = require('three-fbx-loader');
// var texLoader = new TextureLoader();
// var fbxLoader = new FBXLoader();
// var loadModel = url => new Promise( resolve => fbxLoader.load( url, resolve ) );
// var loadTexture = url => new Promise( resolve => texLoader.load( url, resolve ) );
// var flipFace = face => {
// var tmp = face.a;
// face.a = face.c;
// face.c = tmp;
// }
// var flipUV = uvs => {
// var tmp = uvs[ 0 ];
// uvs[ 0 ] = uvs[ 2 ];
// uvs[ 2 ] = tmp;
// }
// var flipNormals = geometry => {
// geometry.faces.forEach( flipFace );
// geometry.faceVertexUvs[ 0 ].forEach( flipUV );
// }
// var precision = x => Number( x.toPrecision( 4 ) );
// module.exports = envMap => Promise.all([
// loadModel('./assets/phone1.fbx'),
// loadTexture('./assets/diffuse.jpg'),
// loadTexture('./assets/normal.jpg'),
// loadTexture('./assets/roughness.jpg')
// ]).then( ([ model, map, normalMap, roughnessMap ]) => {
// var obj = model.children.find( o => o.type === 'Mesh' );
// var geometry = new Geometry().fromBufferGeometry( obj.geometry );
// // geometry.rotateX( );
// geometry.mergeVertices();
// flipNormals( geometry );
// geometry.computeFaceNormals();
// geometry.computeVertexNormals();
// return new Mesh( geometry, new MeshStandardMaterial({
// envMap,
// normalMap,
// normalScale: new Vector2( .6, 0 ),
// map,
// // roughnessMap,
// roughness: 0,
// metalness: 1
// }));
// }) |
import './RcChatContent.scss';
import React, { Component } from 'react';
import Avatar from 'material-ui/Avatar';
import RcChatBubble from '../rc-chat-bubble/RcChatBubble.jsx';
import { List, ListItem } from 'material-ui/List';
import Subheader from 'material-ui/Subheader';
import IconButton from 'material-ui/IconButton';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import { grey400, darkBlack, lightBlack } from 'material-ui/styles/colors';
import Divider from 'material-ui/Divider';
import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert';
import { observer, inject } from 'mobx-react';
import RightIconMenu from './right-icon-menu/RightIconMenu';
import RcVideo from '../rc-video/RcVideo';
import { Switch, Route, Link } from 'react-router-dom';
@inject('stores') @observer
export default class RcChatContent extends Component {
constructor(props) {
super(props);
this.eventHandler = this.eventHandler.bind(this);
}
eventHandler(evt) {
evt.preventDefault();
}
componentDidMount() {}
render() {
let url = "https://placeimg.com/640/480";
const pix = ['tech', 'nature', 'people', 'architecture', 'animals'];
const {filteredChatMessages, chatMessages} = this.props.stores.chatStore
return (
<div className="rc-chat-content-container">
<h1>Convo</h1>
<div className="content-list">
<ul>
{chatMessages.entries().map((chat, id) => {
const {msg} = chat[1];
return (
<li key={id}>
<div className="chat-bubble-container">
<span className="left-avatar">
<Avatar src={`${url}/${pix[Math.floor(Math.random() * pix.length)]}`} />
</span>
<div>
<div>{msg.user}</div>
<div>{msg.group}</div>
</div>
<div className="chat-msg"><h3>{msg.msg}</h3></div>
<div className='flex-spacer'></div>
<span className="right-menu">
<RightIconMenu chat={msg}/>
</span>
</div>
</li>
)
}).reverse()}
</ul>
</div>
</div>
)
}
}
|
const {Network, WalletClient} = require('bcoin.js');
const { validateWalletConfig } = require('../utils/validation/validators')
function initializeWalletClient(config){
const walletConfigValidation = validateWalletConfig(config);
if(walletConfigValidation){
throw new Error(Object.values(walletConfigValidation)[0]);
}
const id = config.walletId;
const token = config.walletToken;
const network = Network.get(config.walletNetwork);
const walletClientOptions = {
host: config.walletHost,
network: network.type,
port: network.walletPort,
apiKey: config.walletApiKey,
token: config.walletToken,
ssl: true
};
const walletClient = new WalletClient(walletClientOptions);
const wallet = walletClient.wallet(id, token);
return {wallet, walletClient};
}
module.exports = initializeWalletClient; |
//Menu
let menuIcon = document.querySelector(".menuIcon");
let nav = document.querySelector(".overlay-menu");
menuIcon.onclick = () => {
menuIcon.classList.toggle("toggle");
if (nav.style.transform != "translateX(0%)") {
nav.style.transform = "translateX(0%)";
nav.style.transition = "transform 0.2s ease-out";
} else {
nav.style.transform = "translateX(-100%)";
nav.style.transition = "transform 0.2s ease-out";
}
};
window.onresize = () => {
if (
window.matchMedia("(min-width: 576px)").matches &&
nav.style.transform === "translateX(0%)"
) {
nav.style.transform = "translateX(-100%)";
nav.style.transition = "transform 0.2s ease-out";
menuIcon.classList.toggle("toggle");
}
};
window.onclick = event => {
if (event.target.classList[0] == "overlay_bg") {
nav.style.transform = "translateX(-100%)";
nav.style.transition = "transform 0.2s ease-out";
menuIcon.classList.toggle("toggle");
}
};
window.onscroll = () => {
if (window.pageYOffset >= 100) {
return document
.querySelector(".nav_logo")
.classList.add("nav_logo--white", "animated", "fadeInDown");
}
if (window.pageYOffset <= 100) {
return document
.querySelector(".nav_logo")
.classList.remove("nav_logo--white", "animated", "fadeInDown");
}
};
var prevButton = '<button type="button" data-role="none" class="slick-prev" aria-label="prev"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" version="1.1"><path fill="#FFFFFF" d="M 16,16.46 11.415,11.875 16,7.29 14.585,5.875 l -6,6 6,6 z" /></svg></button>',
nextButton = '<button type="button" data-role="none" class="slick-next" aria-label="next"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#FFFFFF" d="M8.585 16.46l4.585-4.585-4.585-4.585 1.415-1.415 6 6-6 6z"></path></svg></button>';
$('.single-item').slick({
infinite: true,
dots: true,
// autoplay: true,
autoplaySpeed: 4000,
speed: 1000,
cssEase: 'ease-in-out',
prevArrow: prevButton,
nextArrow: nextButton
});
$('.quote-container').mousedown(function(){
$('.single-item').addClass('dragging');
});
$('.quote-container').mouseup(function(){
$('.single-item').removeClass('dragging');
});
|
const fs = require('fs')
const path = require('path')
const nconf = require('nconf')
const webpack = require('webpack')
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const packageJson = require('./package.json')
nconf.env()
.defaults(require('./config.json'))
module.exports = {
entry: {
main: './src/index.jsx',
vendor: Object.keys(packageJson.dependencies).filter(name => [
'bootstrap'
].indexOf(name) === -1)
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.min.js'
},
module: {
loaders: [{
test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel', query: {
presets: ['es2015-native-modules', 'stage-1', 'react']
}
}, {
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
'style?sourceMap', [
// 'css?sourceMap',
'css?sourceMap&modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
'resolve-url',
'sass?sourceMap'])
}, {
test: /\.(otf|eot|svg|ttf|woff2?)/, loader: 'file'
}, {
test: /\.png$/, loader: 'url-loader?mimetype=image/png'
}]
},
plugins: [
new ExtractTextPlugin('style.min.css', {allChunks: true}),
new CommonsChunkPlugin({name: 'vendor', filename: 'vendor.min.js'}),
new webpack.DefinePlugin({
'USE_HTML5_HISTORY': nconf.get('USE_HTML5_HISTORY'),
'STORAGE_KEY': JSON.stringify(nconf.get('STORAGE_KEY')),
'process.env.NODE_ENV': JSON.stringify(nconf.get('NODE_ENV'))
}),
new HtmlWebpackPlugin({
template: './src/index.ejs',
favicon: './src/img/favicon.ico',
inject: false,
minify: {
collapseWhitespace: true,
preserveLineBreaks: true
}
})
],
devtool: 'cheap-module-source-map'
}
|
// redis handling |
import React, {Fragment} from 'react'
import MovieDetail from "./MovieDetail";
import {connect} from 'react-redux';
import {getCurrentMovie, getGenres, getRating, Reviews, getReviews, setReviews, Name, Text, setRating, ClearFields, MovieId} from '../../redux/HomeReducer'
import {withRouter} from "react-router-dom";
import Header from "../Header/Header";
import {MovieApi} from "../../api/api"
class MovieDetailContainer extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
this.props.getCurrentMovie(this.props.match.params.pk)
this.props.getRating(this.props.match.params.pk)
this.props.getGenres()
//this.props.Reviews(this.props.currentMovie.reviews)
this.props.getReviews(this.props.match.params.pk)
}
/*componentDidUpdate(prevProps, prevState, snapshot) {
if(prevProps.getReviews !== this.props.getReviews){
this.props.getReviews(this.props.match.params.pk)
}
}*/
render() {
return <>
{this.props.isFetching == false ? <Fragment>
<Header genres={this.props.genres}
isFetching={this.props.isFetching}/>
<MovieDetail movie={this.props.movie}
isFetching={this.props.isFetching}
currentMovie={this.props.currentMovie}
getRating={this.props.getRating}
rating={this.props.rating}
setReviews={this.props.setReviews}
getReviews={this.props.getReviews}
reviews={this.props.reviews}
pk={this.props.match.params.pk}
Name={this.props.Name}
Text={this.props.Text}
nameReviews={this.props.nameReviews}
textReviews={this.props.textReviews}
ClearFields={this.props.ClearFields}
setRating={this.props.setRating}
star={this.props.star}
MovieId={this.props.MovieId}
movieId={this.props.movieId}
/>
</Fragment>
:<div>loading...</div>}
</>
}
}
let mapStateToProps = (state) => {
return {
movie: state.homePage.movie,
currentMovie: state.homePage.currentMovie,
isFetching: state.homePage.isFetching,
genres: state.homePage.genres,
rating: state.homePage.rating,
reviews: state.homePage.reviews,
nameReviews: state.homePage.name,
textReviews: state.homePage.text,
star: state.homePage.star,
movieId: state.homePage.movieId
}
}
export default withRouter( connect(mapStateToProps,
{getCurrentMovie, MovieId, getGenres, getRating, getReviews, Reviews, setReviews,Name, Text, ClearFields, setRating})(MovieDetailContainer)); |
import anime from "animejs";
function writeOnMockup() {
var elements = document.getElementsByClassName("mock-text");
var elementsArray = Array.from(elements);
var elStyles = elementsArray.map(item => {
var style = window.getComputedStyle(item);
return style.getPropertyValue("width");
});
var timeline = anime.timeline();
timeline
.add({
targets: elements[1],
opacity: [0, 1],
width: ["0px", elStyles[1]],
delay: 1000,
easing: "easeOutExpo"
})
.add({
targets: elements[2],
opacity: [0, 1],
width: ["0px", elStyles[2]],
easing: "easeOutExpo"
})
.add({
targets: elements[3],
opacity: [0, 1],
width: ["0px", elStyles[3]],
easing: "easeOutExpo"
})
.add({
targets: elements[4],
opacity: [0, 1],
width: ["0px", elStyles[4]],
easing: "easeOutExpo"
})
.add({
targets: elements[5],
opacity: [0, 1],
width: ["0px", elStyles[5]],
easing: "easeOutExpo"
})
.add({
targets: elements[6],
opacity: [0, 1],
width: ["0px", elStyles[6]],
easing: "easeOutExpo"
});
}
export function animNavbar() {
anime({
targets: ".navbar a",
color: "#333",
borderColor:"#55cdf2"
});
}
export function animMockupWebsite() {
anime({
targets: ".mockup-website",
translateY: [-800, 0],
opacity: [0, 1],
easing: "easeInOutQuart"
});
writeOnMockup();
}
|
const promise = require('bluebird')
const options = { promiseLib: promise }
const pgp = require('pg-promise')(options)
const connectionString = 'postgres://localhost:5432/http_auth'
const db = pgp(connectionString)
const insertUser = (email, password) => {
return db.one('INSERT INTO users (email, password) VALUES ($1,$2) RETURNING email', [email, password])
}
const checkUserPassword = (email) => {
return db.one('SELECT password FROM users WHERE email=$1', [email])
}
const checkUserEmail = (email) => {
return db.one('SELECT email FROM users WHERE email=$1', [email])
}
module.exports = {
insertUser,
checkUserPassword,
checkUserEmail
}
|
var todelete = ds.Webuser.query('ID > 84');
todelete.remove();
|
$(document).ready(function() {
$('.fade').hover(
function(){
$(this).find('.caption').stop().fadeTo('slow',0.8);
},
function(){
$(this).find('.caption').stop().fadeTo('slow',0);
});
});
|
$(document).ready(function(){
$('.lightbox_trigger').click(function(prevent) {
prevent.preventDefault()
var image_href = $(this).attr("data-img");
if ($('#lightbox').length > 0) {
$('#content').html('<p>hi</p>');
$('#lightbox').show("fast")
}
else {
var lightbox = '<div id="lightbox">' + '<p>Click to close</p>' + '<h1>The secret is .. click here to see the super duper message</h1>' + '</div>'
$('body').append(lightbox)
}
})
$('#lightbox').live('click', function() {
$('#lightbox').hide();
})
}) |
import React, { PureComponent } from 'react'
import moment from 'moment'
import './index.css'
export class Article extends PureComponent {
render () {
const { description, title, publishedAt } = this.props
return (
<div className='rn-Article'>
<ArticleRow title='Title:' value={title} />
<ArticleRow
title='Published at:'
value={publishedAt ? moment(publishedAt).format('DD.MM.YYYY HH:mm Z') : null}
/>
<ArticleRow title='Description:' value={description} />
</div>
)
}
}
const ArticleRow = ({ title, value }) => {
return (
<div className='rn-ArticleRow'>
<div className='rn-ArticleRow-title'>{title}</div>
<div className='rn-ArticleRow-value'>{value}</div>
</div>
)
}
|
import { useState, useEffect } from 'react'
import Search from './searchbar'
import SerieList from './SerieList'
export default function App() {
const [seriesData, setSeriesData] = useState([])
useEffect(() => {
fetch('http://localhost:4000/rest/shows')
.then(response => response.json())
.then(data => setSeriesData(data))
}, [])
return (
<div>
<div><Search/></div>
<SerieList series={seriesData} />
</div>
)
} |
import request from '@/utils/request'
import { urlFinance } from '@/api/commUrl'
const url = urlFinance
// const url = 'http://qa.oss.womaoapp.com/fwas-finance-admin/sys/'
const findSettlement = url + 'settlement/findSettlementRelation'
const findOrder = url + 'settlement/findOrderId'
const openInvoice = url + 'settlement/openInvoiceInfo'
const findInvoice = url + 'settlement/findInvoiceRes'
// 查询结算单关系
export function findSettlementRelationApi(params) {
return request({
url: findSettlement,
method: 'post',
data: params
})
}
// 查询结算单对应主订单信息
export function findOrderIdApi(params) {
return request({
url: findOrder,
method: 'post',
data: params
})
}
// 查询开票信息
export function openInvoiceInfoApi(params) {
return request({
url: openInvoice,
method: 'post',
data: params
})
}
// 查询开票信息
export function findInvoiceResApi(params) {
return request({
url: findInvoice,
method: 'post',
data: params
})
}
|
export const deepDiveContent = [
{
id: 0,
content: `Steeped in innovation, education and craftsmanship.`,
},
{
id: 1,
content: `With a passion to embrace change, and a relentless focus.`,
},
{
id: 2,
content: `To deliver beautifully simple solutions to the institutional execution community.`,
},
{
id: 3,
content: `With incredible performance … however they define it.`,
},
{
id: 4,
content: `With Dash, you know.`,
},
];
|
tasks.todos.views.helpers.ErrorHandler = (function (views) {
var ErrorHandler = views.helpers.ExtendedView.extend({
className: 'err-handler animated bounceOutUp',
template: JST['templates/error-handler'],
events: {
'click .close': 'close'
},
render: function (err) {
this.$el.html(this.template);
this.increase();
this.$alert.append(err);
this.$alerter.html(this.$el);
_.delay(this.close.bind(this), 4000);
return this;
},
increase: function () {
this.$alert = this.$('.alert');
this.$alerter = $('#alerter');
}
});
return ErrorHandler;
} (tasks.todos.views)); |
function findLongestWordLength(str) {
// Turn "str" string input into an array of strings
var arrayStr = str.split(" ");
// Set maximum (largest) number variable
var max = 0;
//Use for loop such that iterates through i + 1 through the length of the "arrayStr" string array
for(let i = 0; i < arrayStr.length; i++){
// Set Parameters that if the value length of the "arrayStr" to the "i"th number is greater than max
if (arrayStr[i].length > max){
// Assign value of "arrayStr" to the "i"th to the "max" variable
max = arrayStr[i].length;
}
}
// Return max value
return max;
}
|
const Discord = require("discord.js");
const request = require("request")
exports.name = "rate";
exports.guildonly = false;
exports.run = async (robot, interaction)=>{
try{
if(!interaction.options.data[0].value) return interaction.reply({content: 'Напишите комментарий!'});
var token = 'your token'
request.post({url: `https://discord.com/api/v9/channels/863369213893017602/messages`, headers: {"Authorization": "Bot "+token, "Content-Type": "application/json"},
body: JSON.stringify({
"tts": false,
"embeds": [{
"title": `${interaction.user.tag}`,
"description": `
_${interaction.options.data[0].value}_
\n
▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ ▬ `,
"color": 3066993,
"timestamp": new Date().toISOString()
}]
})})
interaction.reply({content: '<a:success:875454382437707776> Отзыв отправлен! Спасибо <З'})
}catch(err){console.log(err)}
} |
/*global document */
(function(className){
var i, nodes, node, next, siblings = [], returnValue;
if (document.getElementsByClassName) {
nodes = document.getElementsByClassName(className);
for (i in nodes){
if (nodes.hasOwnProperty(i)) {
node = nodes[i];
if (node.nextSibling) {
next = node.nextSibling;
siblings.push(next.parentNode.removeChild(next));
}
}
}
returnValue = siblings;
} else {
returnValue = -1;
}
return returnValue;
}(
/**
* removeNextSiblingAfterClassName - A script to remove the next sibling node after a given className.
* Copyright 2011, Brian Swisher, brianswisher.com - MIT Licensed
* @param {String} className
* @return {Array<node>} - removed nodes || {Int} -1 if incompatible
*/
"CLASS_NAME"
)); |
import React, { Component } from 'react';
import { View } from 'react-native';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { FormLabel, FormInput } from 'react-native-elements'
import Button from '../components/Button';
import { userRegister } from '../actions/userActions';
import * as css from './Styles';
class Register extends Component {
constructor(props) {
super(props);
this.register = this.register.bind(this);
}
register() {
const { userRegister, showModal } = this.props;
const data = {
username: this.refs.registername.refs.username._lastNativeText,
password: this.refs.registerpass.refs.password._lastNativeText
};
if(data.username === '' || data.password === '') {
showModal('Hey! Input fields can\'t be empty!');
} else {
userRegister(data);
}
}
render() {
const { navigate } = this.props.navigation;
//style={css.global.v_container}
return (
<View>
<FormLabel>Username</FormLabel>
<FormInput
ref='registername'
textInputRef='username'/>
<FormLabel>Password</FormLabel>
<FormInput
secureTextEntry={true}
ref='registerpass'
textInputRef='password'/>
<Button text='Register' onClick={this.register}/>
</View>
);
}
}
export default connect(state => ({}),
(dispatch) => bindActionCreators({
userRegister: userRegister
}, dispatch))(Register); |
import React from 'react'
import uid from 'uid'
import { Link } from 'react-router-dom'
const Categorias = (props) => (
<ul className="list-group">
<span className="list-group-item">Categorias</span>
{
props.categories.map((item) => {
return (
<Link to="/categoria" key={uid()} className="list-group-item">{item.nombre}</Link>
)
})
}
</ul>
)
export default Categorias |
import {promisify} from '../helpers';
import {User,Product,Order,Customer} from '../models/index.js';
import ISODate from '../scalars/ISODate';
import mongoose from 'mongoose';
const ObjectId = mongoose.Types.ObjectId;
const paramHandler= (qry) => {
let param ={}
if(qry.argument && qry.query)param= {[qry.argument]: {'$regex':qry.query}}
if(qry.dates){
const gte =qry.dates.gte?new Date(qry.dates.gte):null
let lt =qry.dates.lt?new Date(qry.dates.lt):null
param.updatedAt={}
if(gte)param.meta.updatedAt.$gte=gte
if(lt){
param.meta.updatedAt.$lte=lt.setDate(lt.getDate()+1)
}
}
return param
};
const resolvers = {
/************ */
//
// products
//
/************ */
product: (_, args) => promisify(Product.findById(args.id)),
products : (_, args,context) => new Promise((resolve, reject) => {
let sort= { [args.query.sortBy]:args.query.descending}
if(!args.query.sortBy)sort={'meta.updatedAt':-1}
const param=paramHandler(args.query)
Product.find(param,(err, result) => {
if (err) reject(err);
else resolve(result);
}).skip(args.query.offset).limit(args.query.limit).sort(sort)
}),
productCount : (_, args,context) => new Promise((resolve, reject) => {
const param=paramHandler(args.query)
Product.find(param,(err, result) => {
if (err) reject(err);
else resolve(result);
}).count()
}),
/************ */
//
// Orders
//
/************ */
order: (_, args) => promisify(Order.findById(args.id)),
orders : (_, args) => new Promise((resolve, reject) => {
let sort= { [args.query.sortBy]:args.query.descending}
if(!args.query.sortBy)sort={'meta.updatedAt':-1}
const param=paramHandler(args.query)
if(args.query.search){
param.$or= [
{ 'products.name': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.name': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.phone': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.city': {'$regex':args.query.search, '$options' : 'i'} },
]
//
}
Order.find(param,(err, result) => {
if (err) reject(err);
else resolve(result);
}).skip(args.query.offset).limit(args.query.limit).sort(sort)
}),
orderCount:async (_, args,{me}) => new Promise((resolve, reject) => {
const param=paramHandler(args.query)
if(args.query.search){
param.$or= [
{ 'products.name': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.name': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.phone': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.city': {'$regex':args.query.search, '$options' : 'i'} },
]
}
Order.find(param,(err, result) => {
if (err) reject(err);
else resolve(result);
}).count()
}),
/************ */
//
// customers
//
/************ */
customers: async (_, args) => new Promise((resolve, reject) => {
const param=paramHandler(args.query)
if(args.query.search){
param.$or= [
{ 'products.name': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.name': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.phone': {'$regex':args.query.search, '$options' : 'i'} },
{ 'customer.city': {'$regex':args.query.search, '$options' : 'i'} },
]
}
Customer.find(param,(err, result) => {
if (err) reject(err);
else resolve(result);
}).skip(args.query.offset).limit(args.query.limit)
}),
/************ */
//
// Users
//
/************ */
user: (_, args) => promisify(User.findById(args.id)),
users: async (_, args, { me }) => new Promise(async (resolve, reject) => {
const param=paramHandler(args.query)
User.find(param,(err, result) => {
if (err) reject(err);
else resolve(result);
}).skip(args.query.offset).limit(args.query.limit)
}),
userCount: () => promisify(User.count()),
me: async (_, args, { me })=> {
if (!me)throw new Error('You are not authenticated!')// make sure user is logged in
return await User.findById(me.id) // user is authenticated
},
};
export default resolvers; |
//visível apenas para o módulo
let a = 2
//FORMA PADRÃO DE EXPORTAR
//não pode usar só exports nem só this
module.exports={
bomDia: 'Bom dia',
boaNoite(){
return 'Boa noite'
}
} |
import React from 'react';
import ItemCollection from './Containers/ItemCollection';
import Accessories from './Containers/Accessories';
import Tops from './Containers/Tops';
import HottestReleases from './Containers/HottestReleases';
class MainBody extends React.Component {
render() {
return(<div className="main-body-container">
<div className="intro-img">
<img src={'intro.jpg'} alt="" />
</div>
<div>
<ItemCollection />
<HottestReleases />
<div className="mission-statement">
<div className="brand">
<h2>ROYAL FLOW</h2>
</div>
<div className="statement">
<ul>
<li>
<p>Shop Sneakers, Shirts, and Accessories</p>
</li>
<li>
<p>Quality is Our Name</p>
</li>
<li>
<p>Always Authentic</p>
</li>
</ul>
</div>
</div>
<Tops />
<Accessories />
</div>
</div>)
}
}
export default MainBody; |
const React = require("react");
const NoteInput = () => ({
componentDidMount() {
let input = this.refs.noteInput;
this.focus(input);
},
focus(input) {
if (!input) return;
input.focus();
input.setSelectionRange(0, input.value.length);
},
render() {
return (
<form ref="noteForm" onSubmit={ this.props.handleSubmit }>
<input className="input input-update"
ref="noteInput"
onChange={ this.props.handleChange }
value={ this.props.value } />
</form>
);
}
});
const NoteUpdateButton = () => ({
handleClick(event) {
event.stopPropagation();
event.preventDefault();
this.props.updateNote();
},
render() {
return (
<button className="button button-note-action"
onClick={(e) => this.handleClick(e) } >
<span className="emoji">👍</span>
<span className="button-note-action-text">
Update
</span>
</button>
);
},
});
const Note = () => ({
deleteNote() {
let { id } = this.props;
this.props.store.dispatch({
type: "DELETE_NOTE",
id,
});
},
handleChange(event) {
let { id } = this.props;
let { value } = event.target;
this.props.store.dispatch({
type: "EDIT_EXISTING_NOTE_INPUT",
id,
value,
});
},
handleSubmit(event) {
event.stopPropagation();
event.preventDefault();
this.updateNote();
},
toggleEdit() {
let { id } = this.props;
this.props.store.dispatch({
type: "TOGGLE_NOTE_EDIT",
id,
});
},
updateNote() {
let { id } = this.props;
this.props.store.dispatch({
type: "UPDATE_NOTE",
id,
});
},
handleDelete(event) {
event.stopPropagation();
event.preventDefault();
this.deleteNote();
},
handleToggleEdit(event) {
event.stopPropagation();
event.preventDefault();
this.toggleEdit();
},
render() {
let { isEditing, editValue, body } = this.props.note;
if (isEditing) {
return (
<li className="note">
<div className="note-body">
<NoteInput value={editValue}
handleSubmit= { (e) => this.handleSubmit(e) }
handleChange={ (e) => this.handleChange(e) } />
</div>
<div className="note-buttons">
<NoteUpdateButton updateNote={ () => this.updateNote() } />
</div>
</li>
);
}
return (
<li className="note" onClick={ () => this.toggleEdit() }>
<div className="note-body">
{body}
</div>
<div className="note-buttons">
<button className="button button-note-action"
onClick={ (e) => this.handleDelete(e) }>
<span className="emoji">🔥</span>
<span className="button-note-action-text">
Delete
</span>
</button>
</div>
</li>
);
},
});
const NoteList = () => ({
getNotes() {
let {notes} = this.props.store.getState();
if (notes.length === 0) return this.noNotesMessage();
return notes.map((note, i) => <Note key={i} id={i} note={note} store={this.props.store} />)
},
noNotesMessage() {
return (
<p className="no-notes">
No shorts? No problem!
<br />
<small>
Write yourself a short note below and tap the
<span className="emoji">🎉</span>
</small>
</p>
);
},
render() {
return (
<div className="notes-container">
<ul className="notes-list">
{this.getNotes()}
</ul>
</div>
);
},
});
module.exports = NoteList; |
export const HOME = '/';
export const ASSUMPTIONS = '/assumptions';
export const NOT_FOUND = '/404'; |
import React from 'react'
import Club from './clubs/Club.js/index.js'
import { withKnobs, text, boolean, number } from '@storybook/addon-knobs'
export default {
component: Club,
title: 'Club',
decorators: [withKnobs],
}
export const club = () => (
<Club
logo={text(
'Logo',
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/62/Eimsb%C3%BCttelerTV.svg/800px-Eimsb%C3%BCttelerTV.svg.png'
)}
name={text('Clubname', 'Eimsbütteler TV AAAAAAAAAAAAA')}
websiteURL={text('URL', 'https://etv-hamburg.de/')}
websiteName={text('WebsiteName', 'etv-hamburg.de AAAAAAAAAAAAA')}
slug={text('Slug', 'eimsbuetteler-tv')}
/>
)
|
const { fake } = require("faker");
const faker = require("faker");
exports.seed = function(knex) {
// Deletes ALL existing entries
return knex('clucks').del()
.then(function () {
// Inserts seed entries
const clucks=[];
for (let i = 0; i < 30; i++) {
sentences = faker.lorem.sentences() +" #"+faker.name.firstName();
clucks.push(
{
username: faker.name.firstName(),
content: sentences
}
)
}
return knex('clucks').insert(clucks);
});
};
|
// @flow
import type { ChatMessage, MessageBatchRequest } from '../types';
/**
* Channels
*/
// Subscriptions channel
export function createSubToSubscriptionsChannel() {
return { command: 'subscribe', identifier: { channel: 'SubscriptionsChannel' } };
}
export function cancelSubToSubscriptionsChannel() {
return { command: 'unsubscribe', identifier: { channel: 'SubscriptionsChannel' } };
}
// Users channel
export function createSubToUsersChannel() {
return { command: 'subscribe', identifier: { channel: 'UsersChannel' } };
}
export function cancelSubToUsersChannel() {
return { command: 'unsubscribe', identifier: { channel: 'UsersChannel' } };
}
// Appearance status
export function createSubToAppearanceStatus() {
return { command: 'subscribe', identifier: { channel: 'AppearancesChannel' } };
}
export function cancelSubToAppearanceStatus() {
return { command: 'unsubscribe', identifier: { channel: 'AppearancesChannel' } };
}
// Conversation detail
export function createSubToConversation(id: string) {
return {
command: 'subscribe',
identifier: { channel: 'ConversationsChannel', conversation_id: id },
};
}
export function cancelSubToConversation(id: string) {
return {
command: 'unsubscribe',
identifier: { channel: 'ConversationsChannel', conversation_id: id },
};
}
/**
* Messages
*/
export function searchUsersByTerm(term: string) {
return {
command: 'message',
identifier: { channel: 'UsersChannel' },
data: {
action: 'search_users',
payload: { term: term },
},
};
}
export function sendChatMessage(chatMessage: ChatMessage) {
return {
command: 'message',
identifier: { channel: 'ConversationsChannel', conversation_id: chatMessage.conversation_id },
data: {
action: 'send_message',
payload: chatMessage,
},
};
}
export function requestMessagesBatch(request: MessageBatchRequest) {
return {
command: 'message',
identifier: { channel: 'ConversationsChannel', conversation_id: request.conversation_id },
data: {
action: 'get_messages',
payload: {
conversation_id: request.conversation_id,
limit: request.limit,
cursor: request.cursor,
},
},
};
}
export function readChatMessages(conversation_id: string) {
return {
command: 'message',
identifier: { channel: 'ConversationsChannel', conversation_id: conversation_id },
data: {
action: 'read_messages',
payload: {
conversation_id: conversation_id,
},
},
};
}
/**
* Conversations
*/
export function createConversation(userIds: Array<string>, message: ChatMessage) {
return {
command: 'message',
identifier: { channel: 'SubscriptionsChannel' },
data: {
action: 'create_conversation',
payload: {
userIds: userIds,
message: message,
},
},
};
}
export function createConversationForRemoteUsers(
remoteUserIds: Array<string>,
message: ChatMessage,
) {
return {
command: 'message',
identifier: { channel: 'SubscriptionsChannel' },
data: {
action: 'create_conversation',
payload: {
remoteUserIds: remoteUserIds,
message: message,
},
},
};
}
export function searchConversationsByTerm(term: string) {
return {
command: 'message',
identifier: { channel: 'SubscriptionsChannel' },
data: {
action: 'search_conversations',
payload: { term: term },
},
};
}
export function globalSearchByTerm(term: string) {
return {
command: 'message',
identifier: { channel: 'SubscriptionsChannel' },
data: {
action: 'global_search',
payload: { term: term },
},
};
}
export function searchConversationsByUsers(users: string) {
return {
command: 'message',
identifier: { channel: 'SubscriptionsChannel' },
data: {
action: 'search_conversations',
payload: { users: users },
},
};
}
|
/*
* File containing commonly run tests / assertions
*
* @package: Blueacorn CommonTests.js
* @version: 1.0
* @Author: Luke Fitzgerald
* @Copyright: Copyright 2015-07-24 10:43:45 Blue Acorn, Inc.
*/
'use strict';
function CommonTests() {
this.testHttpStatus = function() {
casper.then(function() {
casper.test.assertHttpStatus(200);
});
};
this.assertTitle = function(title) {
casper.then(function() {
casper.test.assertTitle(title, 'Title is correct');
});
};
this.assertExists = function(element) {
casper.then(function() {
casper.test.assertExists(element, 'Element exists');
});
};
this.assertDoesntExist = function(element, successMessage) {
casper.then(function() {
casper.test.assertDoesntExist(element, successMessage);
});
};
this.assertVisible = function(element) {
casper.then(function() {
casper.test.assertVisible(element, 'Element is visible');
});
};
this.assertEquals = function(firstEle, secondEle, successMessage) {
casper.then(function() {
casper.test.assertEquals(firstEle, secondEle, successMessage);
});
};
this.getRandomInt = function(max, min) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
this.assertUrlMatch = function(expectedUrl, successMessage) {
casper.then(function() {
casper.test.assertUrlMatch(expectedUrl, successMessage);
});
};
this.clearCookies = function() {
phantom.clearCookies();
};
} |
/// <reference path="../lib/jquery-1.7.2.js" />
/// <reference path="../lib/underscore.js" />
/// <reference path="../lib/backbone.js" />
!function(){
var Post = Backbone.Model.extend({
idAttribute: "Id"
})
var PostCollection = Backbone.Collection.extend({
model: Post,
url: '/api/post/'
})
window.posts = new PostCollection();
//window.posts.fetch();
//console.info(posts)
}() |
import * as React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Animated,
// TextInput,
LogBox
} from 'react-native';
import {FloatingLabelInput} from 'react-native-floating-label-input';
import {
TextField,
FilledTextField,
OutlinedTextField,
} from 'react-native-material-textfield';
import { TextInput ,configureFonts} from 'react-native-paper';
class Notification extends React.Component {
constructor(props){
super(props);
this.state={
text:null,
weight1:"bold"
}
}
componentDidMount=()=>{
LogBox.ignoreLogs(['Animated: `useNativeDriver`']);
}
render() {
return (
<ScrollView style={{backgroundColor:"white"}}>
<View style={styles.bigbox}>
<View style={styles.formargintop}>
</View>
<View style={styles.formargintop}>
<OutlinedTextField
label='Name of the Course'
keyboardType='default'
labelTextStyle={{fontWeight:"bold",fontFamily:"poppins",color:"black"}}
containerStyle={{height:46,borderRadius:15}}
inputContainerStyle={{height:46,borderRadius:15}}
baseColor="black"
/>
</View>
<View style={styles.formargintop}>
<OutlinedTextField
label='Description'
keyboardType='default'
labelTextStyle={{fontWeight:"bold",fontFamily:"poppins",color:"black"}}
containerStyle={{height:46,borderRadius:15}}
inputContainerStyle={{height:46,borderRadius:15}}
baseColor="black"
/>
</View>
<View style={styles.formargintop}>
<OutlinedTextField
label='Fee'
keyboardType='default'
labelTextStyle={{fontWeight:"bold",fontFamily:"poppins",color:"black"}}
containerStyle={{height:46,borderRadius:15}}
inputContainerStyle={{height:46,borderRadius:15}}
baseColor="black"
/>
</View>
<View style={styles.formargintop}>
<OutlinedTextField
label='No. of Batches'
keyboardType='default'
labelTextStyle={{fontWeight:"bold",fontFamily:"poppins",color:"black"}}
containerStyle={{height:46,borderRadius:15}}
inputContainerStyle={{height:46,borderRadius:15}}
baseColor="black"
/>
</View>
<View style={styles.formargintop}>
<OutlinedTextField
label='Timings'
keyboardType='default'
labelTextStyle={{fontWeight:"bold",fontFamily:"poppins",color:"black"}}
containerStyle={{height:46,borderRadius:15}}
inputContainerStyle={{height:46,borderRadius:15}}
baseColor="black"
/>
</View>
<View style={styles.forimgupload}>
<View style={styles.forimg}><Text></Text></View>
<View style={styles.forextra}>
<View style={styles.forextra1}>
<Text style={{color:"#2C57EF",fontSize:10,fontWeight:"bold",fontFamily:"poppins"}}>upload image</Text>
</View>
<View style={styles.forextra2}>
<Text style={{color:"black",fontSize:10,fontWeight:"bold",fontFamily:"poppins"}}>cancel</Text>
</View>
</View>
</View>
<View style={styles.uploadbut}>
<Text style={{color:"white",fontSize:13,fontFamily:"Poppins",fontWeight:"bold"}}>Upload Course</Text>
</View>
</View>
</ScrollView>
);
}
}
export default Notification;
const styles=StyleSheet.create({
bigbox:{
width:"90.09%",
height:506,
marginTop:37,
// backgroundColor:"red",
marginLeft:20.5,
},
formargintop:{
marginTop:12,
width:"100%",
// borderRadius:13,
},
forimgupload:{
marginTop:33,
width:228,
flexDirection: 'row',
height:70,
},
uploadbut:{
marginTop:33,
width:"100%",
height:53,
justifyContent: 'center',
alignItems: 'center',
borderRadius:12,
backgroundColor:"#2C57EF",
},
forimg:{
width:"40%",
height:"100%",
borderRadius:12,
borderWidth:1,
},
forextra:{
marginLeft:20,
},
forextra1:{
width:111,
height:30,
borderColor:"#2C57EF",
color:"blue",
borderWidth:1,
justifyContent: 'center',
alignItems: 'center',
},
forextra2:{
width:111,
height:30,
marginTop:10,
borderColor:"black",
borderWidth:1,
justifyContent: 'center',
alignItems: 'center',
}
}) |
services.factory('ChatService', function() {
return {
createOrReplace: function(id){
console.log(id);
database.ref().child('chats').push();
},
get: function(id){
database.ref('/chats').on('value', function(snapshot){
console.log(snapshot);
snapshot.forEach(function(child){
//userList.push(child);
});
success();
});
}
};
});
|
let pg=require('pg');
let fs = require('fs');
let arrayobj = JSON.parse(fs.readFileSync('./data.txt', 'utf8'));
// console.log(arrayobj[0])
let movies=[]
let directors=[]
for(let i=0;i<arrayobj.length;i++){
let entry=[]
for(let j in arrayobj[i]){
let value=arrayobj[i][j]
entry.push(value)
}
let value=arrayobj[i].Director
directors.push(value)
movies.push(entry)
}
directors=[...new Set(directors)]
// console.log(directors.length)
// console.log(movies.length)
const connectionString = "postgres://mayank:mayank@localhost:5432/api";
let pgClient = new pg.Client(connectionString);
//createTable()
async function createTable()
{await pgClient.connect();
//let query = await pgClient.query("SELECT * FROM users");
const createTableDirectors="create table IF NOT EXISTS directors(id int primary key GENERATED BY DEFAULT AS IDENTITY, name varchar(30))"
const createTableMovies="CREATE TABLE IF NOT EXISTS movies(id int primary key GENERATED BY DEFAULT AS IDENTITY, title varchar(50), description varchar(300), runtime int, genre varchar(20), rating float, metascore varchar(20), votes INT, gross_earning_in_mil varchar(20), director_id int REFERENCES directors(id) NOT NULL, actor varchar(30), year int);"
let delteQuery=await pgClient.query("drop table directors,movies")
let createQuery1=await pgClient.query(createTableDirectors)
let createQuery2=await pgClient.query(createTableMovies)
//let insertQuery1 = await pgClient.
await insert()
await pgClient.end();}
async function insert(){
let insertDirectors='INSERT INTO directors(name) VALUES($1)'
for(let i=0;i<directors.length;i++){
let values = [directors[i]]
let insertQuery=await pgClient.query(insertDirectors,values)
}
let insertMovies="INSERT INTO movies(title,description,runtime,genre,rating,metascore,votes,gross_earning_in_mil,director_id,actor,year) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)"
for(let j=0;j<movies.length;j++){
// let retrieveID="Select id from directors where name=$1";
//
// let retrieveQuery=await pgClient.query(retrieveID,[movies[j][10]])
// // console.log(retrieveQuery)
// movies[j][10]=retrieveQuery.rows
// console.log(directors[j])
// // console.log(movies[j][10])
console.log(movies[j][9])
let k
for( k=0; k<directors.length; k++){
// console.log(directors[k])
if(directors[k] === movies[j][9]){
console.log(k)
break
}
}
let values=movies[j].slice(1)
values.splice(8,1,k+1)
console.log(values)
let insertQuery =await pgClient.query(insertMovies,values)
}
}
module.exports = {
createTable
}
|
import Widget from "./Widget";
/**
* @extends Widget
*/
class Command extends Widget {}
export default Command; |
const Heading = {
render: (props) => `
<div class="heading title">
<h3 class="heading__title">${props}</h3>
<div class="heading__desc"><img src="../images/titleleft-dark.png" alt="Title"/></div>
</div>
`,
};
export default Heading; |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/slevin/wrk/exp/pures/snake/output/Control.Alt/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Alt = function (__superclass_Prelude$dotFunctor_0, alt) {
this["__superclass_Prelude.Functor_0"] = __superclass_Prelude$dotFunctor_0;
this.alt = alt;
};
var altArray = new Alt(function () {
return Prelude.functorArray;
}, Prelude.append(Prelude.semigroupArray));
var alt = function (dict) {
return dict.alt;
};
var $less$bar$greater = function (__dict_Alt_0) {
return alt(__dict_Alt_0);
};
module.exports = {
Alt: Alt,
"<|>": $less$bar$greater,
alt: alt,
altArray: altArray
};
},{"Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Alternative/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Control_Alt = require("Control.Alt");
var Control_Lazy = require("Control.Lazy");
var Control_Plus = require("Control.Plus");
var Alternative = function (__superclass_Control$dotPlus$dotPlus_1, __superclass_Prelude$dotApplicative_0) {
this["__superclass_Control.Plus.Plus_1"] = __superclass_Control$dotPlus$dotPlus_1;
this["__superclass_Prelude.Applicative_0"] = __superclass_Prelude$dotApplicative_0;
};
var alternativeArray = new Alternative(function () {
return Control_Plus.plusArray;
}, function () {
return Prelude.applicativeArray;
});
module.exports = {
Alternative: Alternative,
alternativeArray: alternativeArray
};
},{"Control.Alt":"/Users/slevin/wrk/exp/pures/snake/output/Control.Alt/index.js","Control.Lazy":"/Users/slevin/wrk/exp/pures/snake/output/Control.Lazy/index.js","Control.Plus":"/Users/slevin/wrk/exp/pures/snake/output/Control.Plus/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Extend/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Extend = function (__superclass_Prelude$dotFunctor_0, extend) {
this["__superclass_Prelude.Functor_0"] = __superclass_Prelude$dotFunctor_0;
this.extend = extend;
};
var extendFn = function (__dict_Semigroup_0) {
return new Extend(function () {
return Prelude.functorFn;
}, function (f) {
return function (g) {
return function (w) {
return f(function (w$prime) {
return g(Prelude["<>"](__dict_Semigroup_0)(w)(w$prime));
});
};
};
});
};
var extend = function (dict) {
return dict.extend;
};
var $less$less$eq = function (__dict_Extend_1) {
return extend(__dict_Extend_1);
};
var $eq$less$eq = function (__dict_Extend_2) {
return function (f) {
return function (g) {
return function (w) {
return f($less$less$eq(__dict_Extend_2)(g)(w));
};
};
};
};
var $eq$greater$eq = function (__dict_Extend_3) {
return function (f) {
return function (g) {
return function (w) {
return g($less$less$eq(__dict_Extend_3)(f)(w));
};
};
};
};
var $eq$greater$greater = function (__dict_Extend_4) {
return function (w) {
return function (f) {
return $less$less$eq(__dict_Extend_4)(f)(w);
};
};
};
var duplicate = function (__dict_Extend_5) {
return extend(__dict_Extend_5)(Prelude.id(Prelude.categoryFn));
};
module.exports = {
Extend: Extend,
duplicate: duplicate,
"=<=": $eq$less$eq,
"=>=": $eq$greater$eq,
"=>>": $eq$greater$greater,
"<<=": $less$less$eq,
extend: extend,
extendFn: extendFn
};
},{"Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Lazy/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Lazy = function (defer) {
this.defer = defer;
};
var defer = function (dict) {
return dict.defer;
};
var fix = function (__dict_Lazy_0) {
return function (f) {
return defer(__dict_Lazy_0)(function (_51) {
return f(fix(__dict_Lazy_0)(f));
});
};
};
module.exports = {
Lazy: Lazy,
fix: fix,
defer: defer
};
},{"Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/foreign.js":[function(require,module,exports){
/* global exports */
"use strict";
// module Control.Monad.Eff
exports.returnE = function (a) {
return function () {
return a;
};
};
exports.bindE = function (a) {
return function (f) {
return function () {
return f(a())();
};
};
};
exports.runPure = function (f) {
return f();
};
exports.untilE = function (f) {
return function () {
while (!f());
return {};
};
};
exports.whileE = function (f) {
return function (a) {
return function () {
while (f()) {
a();
}
return {};
};
};
};
exports.forE = function (lo) {
return function (hi) {
return function (f) {
return function () {
for (var i = lo; i < hi; i++) {
f(i)();
}
};
};
};
};
exports.foreachE = function (as) {
return function (f) {
return function () {
for (var i = 0, l = as.length; i < l; i++) {
f(as[i])();
}
};
};
};
},{}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var $foreign = require("./foreign");
var Prelude = require("Prelude");
var monadEff = new Prelude.Monad(function () {
return applicativeEff;
}, function () {
return bindEff;
});
var bindEff = new Prelude.Bind(function () {
return applyEff;
}, $foreign.bindE);
var applyEff = new Prelude.Apply(function () {
return functorEff;
}, Prelude.ap(monadEff));
var applicativeEff = new Prelude.Applicative(function () {
return applyEff;
}, $foreign.returnE);
var functorEff = new Prelude.Functor(Prelude.liftA1(applicativeEff));
module.exports = {
functorEff: functorEff,
applyEff: applyEff,
applicativeEff: applicativeEff,
bindEff: bindEff,
monadEff: monadEff,
foreachE: $foreign.foreachE,
forE: $foreign.forE,
whileE: $foreign.whileE,
untilE: $foreign.untilE,
runPure: $foreign.runPure
};
},{"./foreign":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/foreign.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.ST/foreign.js":[function(require,module,exports){
/* global exports */
"use strict";
// module Control.Monad.ST
exports.newSTRef = function (val) {
return function () {
return { value: val };
};
};
exports.readSTRef = function (ref) {
return function () {
return ref.value;
};
};
exports.modifySTRef = function (ref) {
return function (f) {
return function () {
/* jshint boss: true */
return ref.value = f(ref.value);
};
};
};
exports.writeSTRef = function (ref) {
return function (a) {
return function () {
/* jshint boss: true */
return ref.value = a;
};
};
};
exports.runST = function (f) {
return f;
};
},{}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.ST/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var $foreign = require("./foreign");
var Prelude = require("Prelude");
var Control_Monad_Eff = require("Control.Monad.Eff");
var pureST = function (st) {
return Control_Monad_Eff.runPure($foreign.runST(st));
};
module.exports = {
pureST: pureST,
runST: $foreign.runST,
writeSTRef: $foreign.writeSTRef,
modifySTRef: $foreign.modifySTRef,
readSTRef: $foreign.readSTRef,
newSTRef: $foreign.newSTRef
};
},{"./foreign":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.ST/foreign.js","Control.Monad.Eff":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.MonadPlus/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Control_Alternative = require("Control.Alternative");
var Control_Plus = require("Control.Plus");
var MonadPlus = function (__superclass_Control$dotAlternative$dotAlternative_1, __superclass_Prelude$dotMonad_0) {
this["__superclass_Control.Alternative.Alternative_1"] = __superclass_Control$dotAlternative$dotAlternative_1;
this["__superclass_Prelude.Monad_0"] = __superclass_Prelude$dotMonad_0;
};
var monadPlusArray = new MonadPlus(function () {
return Control_Alternative.alternativeArray;
}, function () {
return Prelude.monadArray;
});
var guard = function (__dict_MonadPlus_0) {
return function (_118) {
if (_118) {
return Prelude["return"]((__dict_MonadPlus_0["__superclass_Control.Alternative.Alternative_1"]())["__superclass_Prelude.Applicative_0"]())(Prelude.unit);
};
if (!_118) {
return Control_Plus.empty((__dict_MonadPlus_0["__superclass_Control.Alternative.Alternative_1"]())["__superclass_Control.Plus.Plus_1"]());
};
throw new Error("Failed pattern match at Control.MonadPlus line 35, column 1 - line 36, column 1: " + [ _118.constructor.name ]);
};
};
module.exports = {
MonadPlus: MonadPlus,
guard: guard,
monadPlusArray: monadPlusArray
};
},{"Control.Alternative":"/Users/slevin/wrk/exp/pures/snake/output/Control.Alternative/index.js","Control.Plus":"/Users/slevin/wrk/exp/pures/snake/output/Control.Plus/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Control.Plus/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Control_Alt = require("Control.Alt");
var Plus = function (__superclass_Control$dotAlt$dotAlt_0, empty) {
this["__superclass_Control.Alt.Alt_0"] = __superclass_Control$dotAlt$dotAlt_0;
this.empty = empty;
};
var plusArray = new Plus(function () {
return Control_Alt.altArray;
}, [ ]);
var empty = function (dict) {
return dict.empty;
};
module.exports = {
Plus: Plus,
empty: empty,
plusArray: plusArray
};
},{"Control.Alt":"/Users/slevin/wrk/exp/pures/snake/output/Control.Alt/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/DOM.Timer/foreign.js":[function(require,module,exports){
/* global exports */
"use strict";
// module DOM.Timer
exports.timeout = function(time){
return function(fn){
return function(){
return setTimeout(function(){
fn();
}, time);
};
};
};
exports.clearTimeout = function(timer){
return function(){
return clearTimeout(timer);
};
};
exports.interval = function(time){
return function(fn){
return function(){
return setInterval(function(){
fn();
}, time);
};
};
};
exports.clearInterval = function(timer){
return function(){
return clearInterval(timer);
};
};
},{}],"/Users/slevin/wrk/exp/pures/snake/output/DOM.Timer/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var $foreign = require("./foreign");
var Prelude = require("Prelude");
var Control_Monad_Eff = require("Control.Monad.Eff");
var delay = function (x) {
return function (cb) {
return function (a) {
return $foreign.timeout(x)(cb(a));
};
};
};
module.exports = {
delay: delay,
clearInterval: $foreign.clearInterval,
interval: $foreign.interval,
clearTimeout: $foreign.clearTimeout,
timeout: $foreign.timeout
};
},{"./foreign":"/Users/slevin/wrk/exp/pures/snake/output/DOM.Timer/foreign.js","Control.Monad.Eff":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Data.Function/foreign.js":[function(require,module,exports){
/* global exports */
"use strict";
// module Data.Function
exports.mkFn0 = function (fn) {
return function () {
return fn({});
};
};
exports.mkFn1 = function (fn) {
return function (a) {
return fn(a);
};
};
exports.mkFn2 = function (fn) {
/* jshint maxparams: 2 */
return function (a, b) {
return fn(a)(b);
};
};
exports.mkFn3 = function (fn) {
/* jshint maxparams: 3 */
return function (a, b, c) {
return fn(a)(b)(c);
};
};
exports.mkFn4 = function (fn) {
/* jshint maxparams: 4 */
return function (a, b, c, d) {
return fn(a)(b)(c)(d);
};
};
exports.mkFn5 = function (fn) {
/* jshint maxparams: 5 */
return function (a, b, c, d, e) {
return fn(a)(b)(c)(d)(e);
};
};
exports.mkFn6 = function (fn) {
/* jshint maxparams: 6 */
return function (a, b, c, d, e, f) {
return fn(a)(b)(c)(d)(e)(f);
};
};
exports.mkFn7 = function (fn) {
/* jshint maxparams: 7 */
return function (a, b, c, d, e, f, g) {
return fn(a)(b)(c)(d)(e)(f)(g);
};
};
exports.mkFn8 = function (fn) {
/* jshint maxparams: 8 */
return function (a, b, c, d, e, f, g, h) {
return fn(a)(b)(c)(d)(e)(f)(g)(h);
};
};
exports.mkFn9 = function (fn) {
/* jshint maxparams: 9 */
return function (a, b, c, d, e, f, g, h, i) {
return fn(a)(b)(c)(d)(e)(f)(g)(h)(i);
};
};
exports.mkFn10 = function (fn) {
/* jshint maxparams: 10 */
return function (a, b, c, d, e, f, g, h, i, j) {
return fn(a)(b)(c)(d)(e)(f)(g)(h)(i)(j);
};
};
exports.runFn0 = function (fn) {
return fn();
};
exports.runFn1 = function (fn) {
return function (a) {
return fn(a);
};
};
exports.runFn2 = function (fn) {
return function (a) {
return function (b) {
return fn(a, b);
};
};
};
exports.runFn3 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return fn(a, b, c);
};
};
};
};
exports.runFn4 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return fn(a, b, c, d);
};
};
};
};
};
exports.runFn5 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return function (e) {
return fn(a, b, c, d, e);
};
};
};
};
};
};
exports.runFn6 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return function (e) {
return function (f) {
return fn(a, b, c, d, e, f);
};
};
};
};
};
};
};
exports.runFn7 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return function (e) {
return function (f) {
return function (g) {
return fn(a, b, c, d, e, f, g);
};
};
};
};
};
};
};
};
exports.runFn8 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return function (e) {
return function (f) {
return function (g) {
return function (h) {
return fn(a, b, c, d, e, f, g, h);
};
};
};
};
};
};
};
};
};
exports.runFn9 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return function (e) {
return function (f) {
return function (g) {
return function (h) {
return function (i) {
return fn(a, b, c, d, e, f, g, h, i);
};
};
};
};
};
};
};
};
};
};
exports.runFn10 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return function (e) {
return function (f) {
return function (g) {
return function (h) {
return function (i) {
return function (j) {
return fn(a, b, c, d, e, f, g, h, i, j);
};
};
};
};
};
};
};
};
};
};
};
},{}],"/Users/slevin/wrk/exp/pures/snake/output/Data.Function/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var $foreign = require("./foreign");
var Prelude = require("Prelude");
var on = function (f) {
return function (g) {
return function (x) {
return function (y) {
return f(g(x))(g(y));
};
};
};
};
module.exports = {
on: on,
runFn10: $foreign.runFn10,
runFn9: $foreign.runFn9,
runFn8: $foreign.runFn8,
runFn7: $foreign.runFn7,
runFn6: $foreign.runFn6,
runFn5: $foreign.runFn5,
runFn4: $foreign.runFn4,
runFn3: $foreign.runFn3,
runFn2: $foreign.runFn2,
runFn1: $foreign.runFn1,
runFn0: $foreign.runFn0,
mkFn10: $foreign.mkFn10,
mkFn9: $foreign.mkFn9,
mkFn8: $foreign.mkFn8,
mkFn7: $foreign.mkFn7,
mkFn6: $foreign.mkFn6,
mkFn5: $foreign.mkFn5,
mkFn4: $foreign.mkFn4,
mkFn3: $foreign.mkFn3,
mkFn2: $foreign.mkFn2,
mkFn1: $foreign.mkFn1,
mkFn0: $foreign.mkFn0
};
},{"./foreign":"/Users/slevin/wrk/exp/pures/snake/output/Data.Function/foreign.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Data.Functor.Invariant/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Invariant = function (imap) {
this.imap = imap;
};
var imapF = function (__dict_Functor_0) {
return function (_178) {
return Prelude["const"](Prelude.map(__dict_Functor_0)(_178));
};
};
var invariantArray = new Invariant(imapF(Prelude.functorArray));
var invariantFn = new Invariant(imapF(Prelude.functorFn));
var imap = function (dict) {
return dict.imap;
};
module.exports = {
Invariant: Invariant,
imapF: imapF,
imap: imap,
invariantFn: invariantFn,
invariantArray: invariantArray
};
},{"Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Data.Maybe/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Control_Alt = require("Control.Alt");
var Control_Alternative = require("Control.Alternative");
var Control_Extend = require("Control.Extend");
var Control_MonadPlus = require("Control.MonadPlus");
var Control_Plus = require("Control.Plus");
var Data_Functor_Invariant = require("Data.Functor.Invariant");
var Data_Monoid = require("Data.Monoid");
var Nothing = (function () {
function Nothing() {
};
Nothing.value = new Nothing();
return Nothing;
})();
var Just = (function () {
function Just(value0) {
this.value0 = value0;
};
Just.create = function (value0) {
return new Just(value0);
};
return Just;
})();
var showMaybe = function (__dict_Show_0) {
return new Prelude.Show(function (_132) {
if (_132 instanceof Just) {
return "Just (" + (Prelude.show(__dict_Show_0)(_132.value0) + ")");
};
if (_132 instanceof Nothing) {
return "Nothing";
};
throw new Error("Failed pattern match at Data.Maybe line 289, column 1 - line 291, column 19: " + [ _132.constructor.name ]);
});
};
var semigroupMaybe = function (__dict_Semigroup_2) {
return new Prelude.Semigroup(function (_126) {
return function (_127) {
if (_126 instanceof Nothing) {
return _127;
};
if (_127 instanceof Nothing) {
return _126;
};
if (_126 instanceof Just && _127 instanceof Just) {
return new Just(Prelude["<>"](__dict_Semigroup_2)(_126.value0)(_127.value0));
};
throw new Error("Failed pattern match at Data.Maybe line 231, column 1 - line 236, column 1: " + [ _126.constructor.name, _127.constructor.name ]);
};
});
};
var monoidMaybe = function (__dict_Semigroup_6) {
return new Data_Monoid.Monoid(function () {
return semigroupMaybe(__dict_Semigroup_6);
}, Nothing.value);
};
var maybe$prime = function (g) {
return function (f) {
return function (_120) {
if (_120 instanceof Nothing) {
return g(Prelude.unit);
};
if (_120 instanceof Just) {
return f(_120.value0);
};
throw new Error("Failed pattern match at Data.Maybe line 39, column 1 - line 40, column 1: " + [ g.constructor.name, f.constructor.name, _120.constructor.name ]);
};
};
};
var maybe = function (b) {
return function (f) {
return function (_119) {
if (_119 instanceof Nothing) {
return b;
};
if (_119 instanceof Just) {
return f(_119.value0);
};
throw new Error("Failed pattern match at Data.Maybe line 26, column 1 - line 27, column 1: " + [ b.constructor.name, f.constructor.name, _119.constructor.name ]);
};
};
};
var isNothing = maybe(true)(Prelude["const"](false));
var isJust = maybe(false)(Prelude["const"](true));
var functorMaybe = new Prelude.Functor(function (fn) {
return function (_121) {
if (_121 instanceof Just) {
return new Just(fn(_121.value0));
};
return Nothing.value;
};
});
var invariantMaybe = new Data_Functor_Invariant.Invariant(Data_Functor_Invariant.imapF(functorMaybe));
var fromMaybe$prime = function (a) {
return maybe$prime(a)(Prelude.id(Prelude.categoryFn));
};
var fromMaybe = function (a) {
return maybe(a)(Prelude.id(Prelude.categoryFn));
};
var extendMaybe = new Control_Extend.Extend(function () {
return functorMaybe;
}, function (f) {
return function (_125) {
if (_125 instanceof Nothing) {
return Nothing.value;
};
return new Just(f(_125));
};
});
var eqMaybe = function (__dict_Eq_8) {
return new Prelude.Eq(function (_128) {
return function (_129) {
if (_128 instanceof Nothing && _129 instanceof Nothing) {
return true;
};
if (_128 instanceof Just && _129 instanceof Just) {
return Prelude["=="](__dict_Eq_8)(_128.value0)(_129.value0);
};
return false;
};
});
};
var ordMaybe = function (__dict_Ord_4) {
return new Prelude.Ord(function () {
return eqMaybe(__dict_Ord_4["__superclass_Prelude.Eq_0"]());
}, function (_130) {
return function (_131) {
if (_130 instanceof Just && _131 instanceof Just) {
return Prelude.compare(__dict_Ord_4)(_130.value0)(_131.value0);
};
if (_130 instanceof Nothing && _131 instanceof Nothing) {
return Prelude.EQ.value;
};
if (_130 instanceof Nothing) {
return Prelude.LT.value;
};
if (_131 instanceof Nothing) {
return Prelude.GT.value;
};
throw new Error("Failed pattern match at Data.Maybe line 269, column 1 - line 275, column 1: " + [ _130.constructor.name, _131.constructor.name ]);
};
});
};
var boundedMaybe = function (__dict_Bounded_11) {
return new Prelude.Bounded(Nothing.value, new Just(Prelude.top(__dict_Bounded_11)));
};
var boundedOrdMaybe = function (__dict_BoundedOrd_10) {
return new Prelude.BoundedOrd(function () {
return boundedMaybe(__dict_BoundedOrd_10["__superclass_Prelude.Bounded_0"]());
}, function () {
return ordMaybe(__dict_BoundedOrd_10["__superclass_Prelude.Ord_1"]());
});
};
var applyMaybe = new Prelude.Apply(function () {
return functorMaybe;
}, function (_122) {
return function (x) {
if (_122 instanceof Just) {
return Prelude["<$>"](functorMaybe)(_122.value0)(x);
};
if (_122 instanceof Nothing) {
return Nothing.value;
};
throw new Error("Failed pattern match at Data.Maybe line 121, column 1 - line 145, column 1: " + [ _122.constructor.name, x.constructor.name ]);
};
});
var bindMaybe = new Prelude.Bind(function () {
return applyMaybe;
}, function (_124) {
return function (k) {
if (_124 instanceof Just) {
return k(_124.value0);
};
if (_124 instanceof Nothing) {
return Nothing.value;
};
throw new Error("Failed pattern match at Data.Maybe line 180, column 1 - line 199, column 1: " + [ _124.constructor.name, k.constructor.name ]);
};
});
var booleanAlgebraMaybe = function (__dict_BooleanAlgebra_12) {
return new Prelude.BooleanAlgebra(function () {
return boundedMaybe(__dict_BooleanAlgebra_12["__superclass_Prelude.Bounded_0"]());
}, function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.conj(__dict_BooleanAlgebra_12))(x))(y);
};
}, function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.disj(__dict_BooleanAlgebra_12))(x))(y);
};
}, Prelude.map(functorMaybe)(Prelude.not(__dict_BooleanAlgebra_12)));
};
var semiringMaybe = function (__dict_Semiring_1) {
return new Prelude.Semiring(function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.add(__dict_Semiring_1))(x))(y);
};
}, function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.mul(__dict_Semiring_1))(x))(y);
};
}, new Just(Prelude.one(__dict_Semiring_1)), new Just(Prelude.zero(__dict_Semiring_1)));
};
var moduloSemiringMaybe = function (__dict_ModuloSemiring_7) {
return new Prelude.ModuloSemiring(function () {
return semiringMaybe(__dict_ModuloSemiring_7["__superclass_Prelude.Semiring_0"]());
}, function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.div(__dict_ModuloSemiring_7))(x))(y);
};
}, function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.mod(__dict_ModuloSemiring_7))(x))(y);
};
});
};
var ringMaybe = function (__dict_Ring_3) {
return new Prelude.Ring(function () {
return semiringMaybe(__dict_Ring_3["__superclass_Prelude.Semiring_0"]());
}, function (x) {
return function (y) {
return Prelude["<*>"](applyMaybe)(Prelude["<$>"](functorMaybe)(Prelude.sub(__dict_Ring_3))(x))(y);
};
});
};
var divisionRingMaybe = function (__dict_DivisionRing_9) {
return new Prelude.DivisionRing(function () {
return moduloSemiringMaybe(__dict_DivisionRing_9["__superclass_Prelude.ModuloSemiring_1"]());
}, function () {
return ringMaybe(__dict_DivisionRing_9["__superclass_Prelude.Ring_0"]());
});
};
var numMaybe = function (__dict_Num_5) {
return new Prelude.Num(function () {
return divisionRingMaybe(__dict_Num_5["__superclass_Prelude.DivisionRing_0"]());
});
};
var applicativeMaybe = new Prelude.Applicative(function () {
return applyMaybe;
}, Just.create);
var monadMaybe = new Prelude.Monad(function () {
return applicativeMaybe;
}, function () {
return bindMaybe;
});
var altMaybe = new Control_Alt.Alt(function () {
return functorMaybe;
}, function (_123) {
return function (r) {
if (_123 instanceof Nothing) {
return r;
};
return _123;
};
});
var plusMaybe = new Control_Plus.Plus(function () {
return altMaybe;
}, Nothing.value);
var alternativeMaybe = new Control_Alternative.Alternative(function () {
return plusMaybe;
}, function () {
return applicativeMaybe;
});
var monadPlusMaybe = new Control_MonadPlus.MonadPlus(function () {
return alternativeMaybe;
}, function () {
return monadMaybe;
});
module.exports = {
Nothing: Nothing,
Just: Just,
isNothing: isNothing,
isJust: isJust,
"fromMaybe'": fromMaybe$prime,
fromMaybe: fromMaybe,
"maybe'": maybe$prime,
maybe: maybe,
functorMaybe: functorMaybe,
applyMaybe: applyMaybe,
applicativeMaybe: applicativeMaybe,
altMaybe: altMaybe,
plusMaybe: plusMaybe,
alternativeMaybe: alternativeMaybe,
bindMaybe: bindMaybe,
monadMaybe: monadMaybe,
monadPlusMaybe: monadPlusMaybe,
extendMaybe: extendMaybe,
invariantMaybe: invariantMaybe,
semigroupMaybe: semigroupMaybe,
monoidMaybe: monoidMaybe,
semiringMaybe: semiringMaybe,
moduloSemiringMaybe: moduloSemiringMaybe,
ringMaybe: ringMaybe,
divisionRingMaybe: divisionRingMaybe,
numMaybe: numMaybe,
eqMaybe: eqMaybe,
ordMaybe: ordMaybe,
boundedMaybe: boundedMaybe,
boundedOrdMaybe: boundedOrdMaybe,
booleanAlgebraMaybe: booleanAlgebraMaybe,
showMaybe: showMaybe
};
},{"Control.Alt":"/Users/slevin/wrk/exp/pures/snake/output/Control.Alt/index.js","Control.Alternative":"/Users/slevin/wrk/exp/pures/snake/output/Control.Alternative/index.js","Control.Extend":"/Users/slevin/wrk/exp/pures/snake/output/Control.Extend/index.js","Control.MonadPlus":"/Users/slevin/wrk/exp/pures/snake/output/Control.MonadPlus/index.js","Control.Plus":"/Users/slevin/wrk/exp/pures/snake/output/Control.Plus/index.js","Data.Functor.Invariant":"/Users/slevin/wrk/exp/pures/snake/output/Data.Functor.Invariant/index.js","Data.Monoid":"/Users/slevin/wrk/exp/pures/snake/output/Data.Monoid/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Data.Monoid/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Monoid = function (__superclass_Prelude$dotSemigroup_0, mempty) {
this["__superclass_Prelude.Semigroup_0"] = __superclass_Prelude$dotSemigroup_0;
this.mempty = mempty;
};
var monoidUnit = new Monoid(function () {
return Prelude.semigroupUnit;
}, Prelude.unit);
var monoidString = new Monoid(function () {
return Prelude.semigroupString;
}, "");
var monoidArray = new Monoid(function () {
return Prelude.semigroupArray;
}, [ ]);
var mempty = function (dict) {
return dict.mempty;
};
var monoidFn = function (__dict_Monoid_0) {
return new Monoid(function () {
return Prelude.semigroupFn(__dict_Monoid_0["__superclass_Prelude.Semigroup_0"]());
}, Prelude["const"](mempty(__dict_Monoid_0)));
};
module.exports = {
Monoid: Monoid,
mempty: mempty,
monoidUnit: monoidUnit,
monoidFn: monoidFn,
monoidString: monoidString,
monoidArray: monoidArray
};
},{"Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Graphics.Canvas/foreign.js":[function(require,module,exports){
/* global exports */
"use strict";
// module Graphics.Canvas
exports.canvasElementToImageSource = function(e) {
return e;
};
exports.getCanvasElementByIdImpl = function(id, Just, Nothing) {
return function() {
var el = document.getElementById(id);
if (el && el instanceof HTMLCanvasElement) {
return Just(el);
} else {
return Nothing;
}
};
};
exports.getContext2D = function(c) {
return function() {
return c.getContext('2d');
};
};
exports.getCanvasWidth = function(canvas) {
return function() {
return canvas.width;
};
};
exports.getCanvasHeight = function(canvas) {
return function() {
return canvas.height;
};
};
exports.setCanvasWidth = function(width) {
return function(canvas) {
return function() {
canvas.width = width;
return canvas;
};
};
};
exports.setCanvasHeight = function(height) {
return function(canvas) {
return function() {
canvas.height = height;
return canvas;
};
};
};
exports.canvasToDataURL = function(canvas) {
return function() {
return canvas.toDataURL();
};
};
exports.setLineWidth = function(width) {
return function(ctx) {
return function() {
ctx.lineWidth = width;
return ctx;
};
};
};
exports.setFillStyle = function(style) {
return function(ctx) {
return function() {
ctx.fillStyle = style;
return ctx;
};
};
};
exports.setStrokeStyle = function(style) {
return function(ctx) {
return function() {
ctx.strokeStyle = style;
return ctx;
};
};
};
exports.setShadowColor = function(color) {
return function(ctx) {
return function() {
ctx.shadowColor = color;
return ctx;
};
};
};
exports.setShadowBlur = function(blur) {
return function(ctx) {
return function() {
ctx.shadowBlur = blur;
return ctx;
};
};
};
exports.setShadowOffsetX = function(offsetX) {
return function(ctx) {
return function() {
ctx.shadowOffsetX = offsetX;
return ctx;
};
};
};
exports.setShadowOffsetY = function(offsetY) {
return function(ctx) {
return function() {
ctx.shadowOffsetY = offsetY;
return ctx;
};
};
};
exports.setLineCapImpl = function(cap) {
return function(ctx) {
return function() {
ctx.lineCap = cap;
return ctx;
};
};
};
exports.setGlobalCompositeOperationImpl = function(ctx) {
return function(op) {
return function() {
ctx.globalCompositeOperation = op;
return ctx;
};
};
};
exports.setGlobalAlpha = function(ctx) {
return function(alpha) {
return function() {
ctx.setGlobalAlpha = alpha;
return ctx;
};
};
};
exports.beginPath = function(ctx) {
return function() {
ctx.beginPath();
return ctx;
};
};
exports.stroke = function(ctx) {
return function() {
ctx.stroke();
return ctx;
};
};
exports.fill = function(ctx) {
return function() {
ctx.fill();
return ctx;
};
};
exports.clip = function(ctx) {
return function() {
ctx.clip();
return ctx;
};
};
exports.lineTo = function(ctx) {
return function(x) {
return function(y) {
return function() {
ctx.lineTo(x, y);
return ctx;
};
};
};
};
exports.moveTo = function(ctx) {
return function(x) {
return function(y) {
return function() {
ctx.moveTo(x, y);
return ctx;
};
};
};
};
exports.closePath = function(ctx) {
return function() {
ctx.closePath();
return ctx;
};
};
exports.arc = function(ctx) {
return function(a) {
return function() {
ctx.arc(a.x, a.y, a.r, a.start, a.end);
return ctx;
};
};
};
exports.rect = function(ctx) {
return function(r) {
return function() {
ctx.rect(r.x, r.y, r.w, r.h);
return ctx;
};
};
};
exports.fillRect = function(ctx) {
return function(r) {
return function() {
ctx.fillRect(r.x, r.y, r.w, r.h);
return ctx;
};
};
};
exports.strokeRect = function(ctx) {
return function(r) {
return function() {
ctx.strokeRect(r.x, r.y, r.w, r.h);
return ctx;
};
};
};
exports.scale = function(t) {
return function(ctx) {
return function() {
ctx.scale(t.scaleX, t.scaleY);
return ctx;
};
};
};
exports.rotate = function(angle) {
return function(ctx) {
return function() {
ctx.rotate(angle);
return ctx;
};
};
};
exports.translate = function(t) {
return function(ctx) {
return function() {
ctx.translate(t.translateX, t.translateY);
return ctx;
};
};
};
exports.transform = function(t) {
return function(ctx) {
return function() {
ctx.transform(t.m11, t.m12, t.m21, t.m22, t.m31, t.m32);
return ctx;
};
};
};
exports.clearRect = function(ctx) {
return function(r) {
return function() {
ctx.clearRect(r.x, r.y, r.w, r.h);
return ctx;
};
};
};
exports.textAlignImpl = function(ctx) {
return function() {
return ctx.textAlign;
}
};
exports.setTextAlignImpl = function(ctx) {
return function(textAlign) {
return function() {
ctx.textAlign = textAlign;
return ctx;
}
}
};
exports.font = function(ctx) {
return function() {
return ctx.font;
};
};
exports.setFont = function(fontspec) {
return function(ctx) {
return function() {
ctx.font = fontspec;
return ctx;
};
};
};
exports.fillText = function(ctx) {
return function(text) {
return function(x) {
return function(y) {
return function() {
ctx.fillText(text, x, y);
return ctx;
};
};
};
};
};
exports.strokeText = function(ctx) {
return function(text) {
return function(x) {
return function(y) {
return function() {
ctx.strokeText(text, x, y);
return ctx;
};
};
};
};
};
exports.measureText = function(ctx) {
return function(text) {
return function() {
return ctx.measureText(text);
};
};
};
exports.save = function(ctx) {
return function() {
ctx.save();
return ctx;
};
};
exports.restore = function(ctx) {
return function() {
ctx.restore();
return ctx;
};
};
exports.getImageData = function(ctx) {
return function(x) {
return function(y) {
return function(w) {
return function(h) {
return function() {
return ctx.getImageData(x, y, w, h);
};
};
};
};
};
};
exports.putImageDataFull = function(ctx) {
return function(image_data) {
return function(x) {
return function(y) {
return function(dx) {
return function(dy) {
return function(dw) {
return function(dh) {
return function() {
ctx.putImageData(image_data, x, y, dx, dy, dw, dh);
return ctx;
};
};
};
};
};
};
};
};
};
exports.putImageData = function(ctx) {
return function(image_data) {
return function(x) {
return function(y) {
return function() {
ctx.putImageData(image_data, x, y);
return ctx;
};
};
};
};
};
exports.createImageData = function(ctx) {
return function(sw) {
return function(sh) {
return function() {
return ctx.createImageData(sw, sh);
};
};
};
};
exports.createImageDataCopy = function(ctx) {
return function(image_data) {
return function() {
return ctx.createImageData(image_data);
};
};
};
exports.getImageDataWidth = function(image_data) {
return function() {
return image_data.width;
};
};
exports.getImageDataHeight = function(image_data) {
return function() {
return image_data.height;
};
};
exports.getImageDataPixelArray = function(image_data) {
return function() {
return image_data.data;
};
};
exports.drawImage = function(ctx) {
return function(image_source) {
return function(dx) {
return function(dy) {
return function() {
ctx.drawImage(image_source, dx, dy);
return ctx;
};
};
};
};
};
exports.drawImageScale = function(ctx) {
return function(image_source) {
return function(dx) {
return function(dy) {
return function(dWidth) {
return function(dHeight) {
return function() {
ctx.drawImage(image_source, dx, dy, dWidth, dHeight);
return ctx;
};
};
};
};
};
};
};
exports.drawImageFull = function(ctx) {
return function(image_source) {
return function(sx) {
return function(sy) {
return function(sWidth) {
return function(sHeight) {
return function(dx) {
return function(dy) {
return function(dWidth) {
return function(dHeight) {
return function() {
ctx.drawImage(image_source, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
return ctx;
};
};
};
};
};
};
};
};
};
};
};
},{}],"/Users/slevin/wrk/exp/pures/snake/output/Graphics.Canvas/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var $foreign = require("./foreign");
var Prelude = require("Prelude");
var Data_Function = require("Data.Function");
var Data_Maybe = require("Data.Maybe");
var Control_Monad_Eff = require("Control.Monad.Eff");
var AlignLeft = (function () {
function AlignLeft() {
};
AlignLeft.value = new AlignLeft();
return AlignLeft;
})();
var AlignRight = (function () {
function AlignRight() {
};
AlignRight.value = new AlignRight();
return AlignRight;
})();
var AlignCenter = (function () {
function AlignCenter() {
};
AlignCenter.value = new AlignCenter();
return AlignCenter;
})();
var AlignStart = (function () {
function AlignStart() {
};
AlignStart.value = new AlignStart();
return AlignStart;
})();
var AlignEnd = (function () {
function AlignEnd() {
};
AlignEnd.value = new AlignEnd();
return AlignEnd;
})();
var Round = (function () {
function Round() {
};
Round.value = new Round();
return Round;
})();
var Square = (function () {
function Square() {
};
Square.value = new Square();
return Square;
})();
var Butt = (function () {
function Butt() {
};
Butt.value = new Butt();
return Butt;
})();
var SourceOver = (function () {
function SourceOver() {
};
SourceOver.value = new SourceOver();
return SourceOver;
})();
var SourceIn = (function () {
function SourceIn() {
};
SourceIn.value = new SourceIn();
return SourceIn;
})();
var SourceOut = (function () {
function SourceOut() {
};
SourceOut.value = new SourceOut();
return SourceOut;
})();
var SourceAtop = (function () {
function SourceAtop() {
};
SourceAtop.value = new SourceAtop();
return SourceAtop;
})();
var DestinationOver = (function () {
function DestinationOver() {
};
DestinationOver.value = new DestinationOver();
return DestinationOver;
})();
var DestinationIn = (function () {
function DestinationIn() {
};
DestinationIn.value = new DestinationIn();
return DestinationIn;
})();
var DestinationOut = (function () {
function DestinationOut() {
};
DestinationOut.value = new DestinationOut();
return DestinationOut;
})();
var DestinationAtop = (function () {
function DestinationAtop() {
};
DestinationAtop.value = new DestinationAtop();
return DestinationAtop;
})();
var Lighter = (function () {
function Lighter() {
};
Lighter.value = new Lighter();
return Lighter;
})();
var Copy = (function () {
function Copy() {
};
Copy.value = new Copy();
return Copy;
})();
var Xor = (function () {
function Xor() {
};
Xor.value = new Xor();
return Xor;
})();
var withContext = function (ctx) {
return function (action) {
return function __do() {
$foreign.save(ctx)();
var _7 = action();
$foreign.restore(ctx)();
return Prelude["return"](Control_Monad_Eff.applicativeEff)(_7)();
};
};
};
var textAlign = function (ctx) {
var unsafeParseTextAlign = function (_161) {
if (_161 === "left") {
return AlignLeft.value;
};
if (_161 === "right") {
return AlignRight.value;
};
if (_161 === "center") {
return AlignCenter.value;
};
if (_161 === "start") {
return AlignStart.value;
};
if (_161 === "end") {
return AlignEnd.value;
};
throw new Error("Failed pattern match at Graphics.Canvas line 380, column 3 - line 381, column 3: " + [ _161.constructor.name ]);
};
return Prelude["<$>"](Control_Monad_Eff.functorEff)(unsafeParseTextAlign)($foreign.textAlignImpl(ctx));
};
var strokePath = function (ctx) {
return function (path) {
return function __do() {
$foreign.beginPath(ctx)();
var _5 = path();
$foreign.stroke(ctx)();
return Prelude["return"](Control_Monad_Eff.applicativeEff)(_5)();
};
};
};
var showTextAlign = new Prelude.Show(function (_160) {
if (_160 instanceof AlignLeft) {
return "left";
};
if (_160 instanceof AlignRight) {
return "right";
};
if (_160 instanceof AlignCenter) {
return "center";
};
if (_160 instanceof AlignStart) {
return "start";
};
if (_160 instanceof AlignEnd) {
return "end";
};
throw new Error("Failed pattern match at Graphics.Canvas line 367, column 1 - line 374, column 1: " + [ _160.constructor.name ]);
});
var showComposite = new Prelude.Show(function (_159) {
if (_159 instanceof SourceOver) {
return "source-over";
};
if (_159 instanceof SourceIn) {
return "source-in";
};
if (_159 instanceof SourceOut) {
return "source-out";
};
if (_159 instanceof SourceAtop) {
return "source-atop";
};
if (_159 instanceof DestinationOver) {
return "destination-over";
};
if (_159 instanceof DestinationIn) {
return "destination-in";
};
if (_159 instanceof DestinationOut) {
return "destination-out";
};
if (_159 instanceof DestinationAtop) {
return "destination-atop";
};
if (_159 instanceof Lighter) {
return "lighter";
};
if (_159 instanceof Copy) {
return "copy";
};
if (_159 instanceof Xor) {
return "xor";
};
throw new Error("Failed pattern match at Graphics.Canvas line 207, column 1 - line 220, column 1: " + [ _159.constructor.name ]);
});
var setTextAlign = function (ctx) {
return function (textAlign_1) {
return $foreign.setTextAlignImpl(ctx)(Prelude.show(showTextAlign)(textAlign_1));
};
};
var setLineCap = function (_158) {
if (_158 instanceof Round) {
return $foreign.setLineCapImpl("round");
};
if (_158 instanceof Square) {
return $foreign.setLineCapImpl("square");
};
if (_158 instanceof Butt) {
return $foreign.setLineCapImpl("butt");
};
throw new Error("Failed pattern match at Graphics.Canvas line 188, column 1 - line 189, column 1: " + [ _158.constructor.name ]);
};
var setGlobalCompositeOperation = function (ctx) {
return function (composite) {
return $foreign.setGlobalCompositeOperationImpl(ctx)(Prelude.show(showComposite)(composite));
};
};
var setCanvasDimensions = function (d) {
return function (ce) {
return Prelude[">>="](Control_Monad_Eff.bindEff)($foreign.setCanvasHeight(d.height)(ce))($foreign.setCanvasWidth(d.width));
};
};
var getCanvasElementById = function (elId) {
return $foreign.getCanvasElementByIdImpl(elId, Data_Maybe.Just.create, Data_Maybe.Nothing.value);
};
var getCanvasDimensions = function (ce) {
return function __do() {
var _4 = $foreign.getCanvasWidth(ce)();
var _3 = $foreign.getCanvasHeight(ce)();
return Prelude["return"](Control_Monad_Eff.applicativeEff)({
width: _4,
height: _3
})();
};
};
var fillPath = function (ctx) {
return function (path) {
return function __do() {
$foreign.beginPath(ctx)();
var _6 = path();
$foreign.fill(ctx)();
return Prelude["return"](Control_Monad_Eff.applicativeEff)(_6)();
};
};
};
module.exports = {
AlignLeft: AlignLeft,
AlignRight: AlignRight,
AlignCenter: AlignCenter,
AlignStart: AlignStart,
AlignEnd: AlignEnd,
Round: Round,
Square: Square,
Butt: Butt,
SourceOver: SourceOver,
SourceIn: SourceIn,
SourceOut: SourceOut,
SourceAtop: SourceAtop,
DestinationOver: DestinationOver,
DestinationIn: DestinationIn,
DestinationOut: DestinationOut,
DestinationAtop: DestinationAtop,
Lighter: Lighter,
Copy: Copy,
Xor: Xor,
withContext: withContext,
setTextAlign: setTextAlign,
textAlign: textAlign,
fillPath: fillPath,
strokePath: strokePath,
setGlobalCompositeOperation: setGlobalCompositeOperation,
setLineCap: setLineCap,
setCanvasDimensions: setCanvasDimensions,
getCanvasDimensions: getCanvasDimensions,
getCanvasElementById: getCanvasElementById,
showComposite: showComposite,
showTextAlign: showTextAlign,
drawImageFull: $foreign.drawImageFull,
drawImageScale: $foreign.drawImageScale,
drawImage: $foreign.drawImage,
canvasElementToImageSource: $foreign.canvasElementToImageSource,
createImageDataCopy: $foreign.createImageDataCopy,
createImageData: $foreign.createImageData,
putImageDataFull: $foreign.putImageDataFull,
putImageData: $foreign.putImageData,
getImageDataPixelArray: $foreign.getImageDataPixelArray,
getImageDataHeight: $foreign.getImageDataHeight,
getImageDataWidth: $foreign.getImageDataWidth,
getImageData: $foreign.getImageData,
restore: $foreign.restore,
save: $foreign.save,
measureText: $foreign.measureText,
strokeText: $foreign.strokeText,
fillText: $foreign.fillText,
setFont: $foreign.setFont,
font: $foreign.font,
transform: $foreign.transform,
translate: $foreign.translate,
rotate: $foreign.rotate,
scale: $foreign.scale,
clearRect: $foreign.clearRect,
strokeRect: $foreign.strokeRect,
fillRect: $foreign.fillRect,
rect: $foreign.rect,
arc: $foreign.arc,
closePath: $foreign.closePath,
moveTo: $foreign.moveTo,
lineTo: $foreign.lineTo,
clip: $foreign.clip,
fill: $foreign.fill,
stroke: $foreign.stroke,
beginPath: $foreign.beginPath,
setGlobalAlpha: $foreign.setGlobalAlpha,
setShadowColor: $foreign.setShadowColor,
setShadowOffsetY: $foreign.setShadowOffsetY,
setShadowOffsetX: $foreign.setShadowOffsetX,
setShadowBlur: $foreign.setShadowBlur,
setStrokeStyle: $foreign.setStrokeStyle,
setFillStyle: $foreign.setFillStyle,
setLineWidth: $foreign.setLineWidth,
canvasToDataURL: $foreign.canvasToDataURL,
setCanvasHeight: $foreign.setCanvasHeight,
getCanvasHeight: $foreign.getCanvasHeight,
setCanvasWidth: $foreign.setCanvasWidth,
getCanvasWidth: $foreign.getCanvasWidth,
getContext2D: $foreign.getContext2D
};
},{"./foreign":"/Users/slevin/wrk/exp/pures/snake/output/Graphics.Canvas/foreign.js","Control.Monad.Eff":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/index.js","Data.Function":"/Users/slevin/wrk/exp/pures/snake/output/Data.Function/index.js","Data.Maybe":"/Users/slevin/wrk/exp/pures/snake/output/Data.Maybe/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Main/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var Prelude = require("Prelude");
var Data_Maybe = require("Data.Maybe");
var Graphics_Canvas = require("Graphics.Canvas");
var DOM_Timer = require("DOM.Timer");
var Control_Monad_Eff = require("Control.Monad.Eff");
var Control_Monad_ST = require("Control.Monad.ST");
var areaSize = 100.0;
var sqSize = areaSize / 5.0;
var bitSize = sqSize - 2.0;
var initialState = {
x: areaSize / 2.0 - bitSize / 2.0,
y: areaSize / 2.0 - bitSize / 2.0,
w: bitSize,
h: bitSize
};
var main = function __do() {
var _5 = Graphics_Canvas.getCanvasElementById("canvas")();
if (_5 instanceof Data_Maybe.Just) {
var _4 = Graphics_Canvas.getCanvasDimensions(_5.value0)();
var _3 = Graphics_Canvas.getContext2D(_5.value0)();
var _2 = Control_Monad_ST.newSTRef(initialState)();
var _1 = DOM_Timer.interval(500)(function __do() {
var _0 = Control_Monad_ST.readSTRef(_2)();
Graphics_Canvas.setFillStyle("#000000")(_3)();
Graphics_Canvas.fillPath(_3)(Graphics_Canvas.rect(_3)({
x: 0.0,
y: 0.0,
w: _4.width,
h: _4.height
}))();
Graphics_Canvas.setFillStyle("#0000FF")(_3)();
Graphics_Canvas.fillPath(_3)(Graphics_Canvas.rect(_3)(_0))();
Control_Monad_ST.modifySTRef(_2)(function (st1) {
return {
x: st1.x + sqSize,
y: st1.y,
w: st1.w,
h: st1.h
};
})();
return Prelude["return"](Control_Monad_Eff.applicativeEff)(Prelude.unit)();
})();
return Prelude["return"](Control_Monad_Eff.applicativeEff)(Prelude.unit)();
};
throw new Error("Failed pattern match at Main line 29, column 1 - line 30, column 1: " + [ _5.constructor.name ]);
};
module.exports = {
main: main,
bitSize: bitSize,
sqSize: sqSize,
areaSize: areaSize,
initialState: initialState
};
},{"Control.Monad.Eff":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.Eff/index.js","Control.Monad.ST":"/Users/slevin/wrk/exp/pures/snake/output/Control.Monad.ST/index.js","DOM.Timer":"/Users/slevin/wrk/exp/pures/snake/output/DOM.Timer/index.js","Data.Maybe":"/Users/slevin/wrk/exp/pures/snake/output/Data.Maybe/index.js","Graphics.Canvas":"/Users/slevin/wrk/exp/pures/snake/output/Graphics.Canvas/index.js","Prelude":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js"}],"/Users/slevin/wrk/exp/pures/snake/output/Prelude/foreign.js":[function(require,module,exports){
/* global exports */
"use strict";
// module Prelude
//- Functor --------------------------------------------------------------------
exports.arrayMap = function (f) {
return function (arr) {
var l = arr.length;
var result = new Array(l);
for (var i = 0; i < l; i++) {
result[i] = f(arr[i]);
}
return result;
};
};
//- Bind -----------------------------------------------------------------------
exports.arrayBind = function (arr) {
return function (f) {
var result = [];
for (var i = 0, l = arr.length; i < l; i++) {
Array.prototype.push.apply(result, f(arr[i]));
}
return result;
};
};
//- Monoid ---------------------------------------------------------------------
exports.concatString = function (s1) {
return function (s2) {
return s1 + s2;
};
};
exports.concatArray = function (xs) {
return function (ys) {
return xs.concat(ys);
};
};
//- Semiring -------------------------------------------------------------------
exports.intAdd = function (x) {
return function (y) {
/* jshint bitwise: false */
return x + y | 0;
};
};
exports.intMul = function (x) {
return function (y) {
/* jshint bitwise: false */
return x * y | 0;
};
};
exports.numAdd = function (n1) {
return function (n2) {
return n1 + n2;
};
};
exports.numMul = function (n1) {
return function (n2) {
return n1 * n2;
};
};
//- ModuloSemiring -------------------------------------------------------------
exports.intDiv = function (x) {
return function (y) {
/* jshint bitwise: false */
return x / y | 0;
};
};
exports.intMod = function (x) {
return function (y) {
return x % y;
};
};
exports.numDiv = function (n1) {
return function (n2) {
return n1 / n2;
};
};
//- Ring -----------------------------------------------------------------------
exports.intSub = function (x) {
return function (y) {
/* jshint bitwise: false */
return x - y | 0;
};
};
exports.numSub = function (n1) {
return function (n2) {
return n1 - n2;
};
};
//- Eq -------------------------------------------------------------------------
exports.refEq = function (r1) {
return function (r2) {
return r1 === r2;
};
};
exports.refIneq = function (r1) {
return function (r2) {
return r1 !== r2;
};
};
exports.eqArrayImpl = function (f) {
return function (xs) {
return function (ys) {
if (xs.length !== ys.length) return false;
for (var i = 0; i < xs.length; i++) {
if (!f(xs[i])(ys[i])) return false;
}
return true;
};
};
};
exports.ordArrayImpl = function (f) {
return function (xs) {
return function (ys) {
var i = 0;
var xlen = xs.length;
var ylen = ys.length;
while (i < xlen && i < ylen) {
var x = xs[i];
var y = ys[i];
var o = f(x)(y);
if (o !== 0) {
return o;
}
i++;
}
if (xlen === ylen) {
return 0;
} else if (xlen > ylen) {
return -1;
} else {
return 1;
}
};
};
};
//- Ord ------------------------------------------------------------------------
exports.unsafeCompareImpl = function (lt) {
return function (eq) {
return function (gt) {
return function (x) {
return function (y) {
return x < y ? lt : x > y ? gt : eq;
};
};
};
};
};
//- Bounded --------------------------------------------------------------------
exports.topChar = String.fromCharCode(65535);
exports.bottomChar = String.fromCharCode(0);
//- BooleanAlgebra -------------------------------------------------------------
exports.boolOr = function (b1) {
return function (b2) {
return b1 || b2;
};
};
exports.boolAnd = function (b1) {
return function (b2) {
return b1 && b2;
};
};
exports.boolNot = function (b) {
return !b;
};
//- Show -----------------------------------------------------------------------
exports.showIntImpl = function (n) {
return n.toString();
};
exports.showNumberImpl = function (n) {
/* jshint bitwise: false */
return n === (n | 0) ? n + ".0" : n.toString();
};
exports.showCharImpl = function (c) {
return c === "'" ? "'\\''" : "'" + c + "'";
};
exports.showStringImpl = function (s) {
return JSON.stringify(s);
};
exports.showArrayImpl = function (f) {
return function (xs) {
var ss = [];
for (var i = 0, l = xs.length; i < l; i++) {
ss[i] = f(xs[i]);
}
return "[" + ss.join(",") + "]";
};
};
},{}],"/Users/slevin/wrk/exp/pures/snake/output/Prelude/index.js":[function(require,module,exports){
// Generated by psc version 0.7.4.1
"use strict";
var $foreign = require("./foreign");
var Unit = function (x) {
return x;
};
var LT = (function () {
function LT() {
};
LT.value = new LT();
return LT;
})();
var GT = (function () {
function GT() {
};
GT.value = new GT();
return GT;
})();
var EQ = (function () {
function EQ() {
};
EQ.value = new EQ();
return EQ;
})();
var Semigroupoid = function (compose) {
this.compose = compose;
};
var Category = function (__superclass_Prelude$dotSemigroupoid_0, id) {
this["__superclass_Prelude.Semigroupoid_0"] = __superclass_Prelude$dotSemigroupoid_0;
this.id = id;
};
var Functor = function (map) {
this.map = map;
};
var Apply = function (__superclass_Prelude$dotFunctor_0, apply) {
this["__superclass_Prelude.Functor_0"] = __superclass_Prelude$dotFunctor_0;
this.apply = apply;
};
var Applicative = function (__superclass_Prelude$dotApply_0, pure) {
this["__superclass_Prelude.Apply_0"] = __superclass_Prelude$dotApply_0;
this.pure = pure;
};
var Bind = function (__superclass_Prelude$dotApply_0, bind) {
this["__superclass_Prelude.Apply_0"] = __superclass_Prelude$dotApply_0;
this.bind = bind;
};
var Monad = function (__superclass_Prelude$dotApplicative_0, __superclass_Prelude$dotBind_1) {
this["__superclass_Prelude.Applicative_0"] = __superclass_Prelude$dotApplicative_0;
this["__superclass_Prelude.Bind_1"] = __superclass_Prelude$dotBind_1;
};
var Semigroup = function (append) {
this.append = append;
};
var Semiring = function (add, mul, one, zero) {
this.add = add;
this.mul = mul;
this.one = one;
this.zero = zero;
};
var Ring = function (__superclass_Prelude$dotSemiring_0, sub) {
this["__superclass_Prelude.Semiring_0"] = __superclass_Prelude$dotSemiring_0;
this.sub = sub;
};
var ModuloSemiring = function (__superclass_Prelude$dotSemiring_0, div, mod) {
this["__superclass_Prelude.Semiring_0"] = __superclass_Prelude$dotSemiring_0;
this.div = div;
this.mod = mod;
};
var DivisionRing = function (__superclass_Prelude$dotModuloSemiring_1, __superclass_Prelude$dotRing_0) {
this["__superclass_Prelude.ModuloSemiring_1"] = __superclass_Prelude$dotModuloSemiring_1;
this["__superclass_Prelude.Ring_0"] = __superclass_Prelude$dotRing_0;
};
var Num = function (__superclass_Prelude$dotDivisionRing_0) {
this["__superclass_Prelude.DivisionRing_0"] = __superclass_Prelude$dotDivisionRing_0;
};
var Eq = function (eq) {
this.eq = eq;
};
var Ord = function (__superclass_Prelude$dotEq_0, compare) {
this["__superclass_Prelude.Eq_0"] = __superclass_Prelude$dotEq_0;
this.compare = compare;
};
var Bounded = function (bottom, top) {
this.bottom = bottom;
this.top = top;
};
var BoundedOrd = function (__superclass_Prelude$dotBounded_0, __superclass_Prelude$dotOrd_1) {
this["__superclass_Prelude.Bounded_0"] = __superclass_Prelude$dotBounded_0;
this["__superclass_Prelude.Ord_1"] = __superclass_Prelude$dotOrd_1;
};
var BooleanAlgebra = function (__superclass_Prelude$dotBounded_0, conj, disj, not) {
this["__superclass_Prelude.Bounded_0"] = __superclass_Prelude$dotBounded_0;
this.conj = conj;
this.disj = disj;
this.not = not;
};
var Show = function (show) {
this.show = show;
};
var $dollar = function (f) {
return function (x) {
return f(x);
};
};
var $hash = function (x) {
return function (f) {
return f(x);
};
};
var zero = function (dict) {
return dict.zero;
};
var unsafeCompare = $foreign.unsafeCompareImpl(LT.value)(EQ.value)(GT.value);
var unit = {};
var top = function (dict) {
return dict.top;
};
var sub = function (dict) {
return dict.sub;
};
var $minus = function (__dict_Ring_0) {
return sub(__dict_Ring_0);
};
var showUnit = new Show(function (_43) {
return "unit";
});
var showString = new Show($foreign.showStringImpl);
var showOrdering = new Show(function (_44) {
if (_44 instanceof LT) {
return "LT";
};
if (_44 instanceof GT) {
return "GT";
};
if (_44 instanceof EQ) {
return "EQ";
};
throw new Error("Failed pattern match at Prelude line 860, column 1 - line 865, column 1: " + [ _44.constructor.name ]);
});
var showNumber = new Show($foreign.showNumberImpl);
var showInt = new Show($foreign.showIntImpl);
var showChar = new Show($foreign.showCharImpl);
var showBoolean = new Show(function (_42) {
if (_42) {
return "true";
};
if (!_42) {
return "false";
};
throw new Error("Failed pattern match at Prelude line 838, column 1 - line 842, column 1: " + [ _42.constructor.name ]);
});
var show = function (dict) {
return dict.show;
};
var showArray = function (__dict_Show_1) {
return new Show($foreign.showArrayImpl(show(__dict_Show_1)));
};
var semiringUnit = new Semiring(function (_15) {
return function (_16) {
return unit;
};
}, function (_17) {
return function (_18) {
return unit;
};
}, unit, unit);
var semiringNumber = new Semiring($foreign.numAdd, $foreign.numMul, 1.0, 0.0);
var semiringInt = new Semiring($foreign.intAdd, $foreign.intMul, 1, 0);
var semigroupoidFn = new Semigroupoid(function (f) {
return function (g) {
return function (x) {
return f(g(x));
};
};
});
var semigroupUnit = new Semigroup(function (_12) {
return function (_13) {
return unit;
};
});
var semigroupString = new Semigroup($foreign.concatString);
var semigroupOrdering = new Semigroup(function (_14) {
return function (y) {
if (_14 instanceof LT) {
return LT.value;
};
if (_14 instanceof GT) {
return GT.value;
};
if (_14 instanceof EQ) {
return y;
};
throw new Error("Failed pattern match at Prelude line 413, column 1 - line 418, column 1: " + [ _14.constructor.name, y.constructor.name ]);
};
});
var semigroupArray = new Semigroup($foreign.concatArray);
var ringUnit = new Ring(function () {
return semiringUnit;
}, function (_19) {
return function (_20) {
return unit;
};
});
var ringNumber = new Ring(function () {
return semiringNumber;
}, $foreign.numSub);
var ringInt = new Ring(function () {
return semiringInt;
}, $foreign.intSub);
var pure = function (dict) {
return dict.pure;
};
var $$return = function (__dict_Applicative_2) {
return pure(__dict_Applicative_2);
};
var otherwise = true;
var one = function (dict) {
return dict.one;
};
var not = function (dict) {
return dict.not;
};
var negate = function (__dict_Ring_3) {
return function (a) {
return $minus(__dict_Ring_3)(zero(__dict_Ring_3["__superclass_Prelude.Semiring_0"]()))(a);
};
};
var mul = function (dict) {
return dict.mul;
};
var $times = function (__dict_Semiring_4) {
return mul(__dict_Semiring_4);
};
var moduloSemiringUnit = new ModuloSemiring(function () {
return semiringUnit;
}, function (_23) {
return function (_24) {
return unit;
};
}, function (_25) {
return function (_26) {
return unit;
};
});
var moduloSemiringNumber = new ModuloSemiring(function () {
return semiringNumber;
}, $foreign.numDiv, function (_21) {
return function (_22) {
return 0.0;
};
});
var moduloSemiringInt = new ModuloSemiring(function () {
return semiringInt;
}, $foreign.intDiv, $foreign.intMod);
var mod = function (dict) {
return dict.mod;
};
var map = function (dict) {
return dict.map;
};
var $less$dollar$greater = function (__dict_Functor_5) {
return map(__dict_Functor_5);
};
var $less$hash$greater = function (__dict_Functor_6) {
return function (fa) {
return function (f) {
return $less$dollar$greater(__dict_Functor_6)(f)(fa);
};
};
};
var id = function (dict) {
return dict.id;
};
var functorArray = new Functor($foreign.arrayMap);
var flip = function (f) {
return function (b) {
return function (a) {
return f(a)(b);
};
};
};
var eqUnit = new Eq(function (_27) {
return function (_28) {
return true;
};
});
var ordUnit = new Ord(function () {
return eqUnit;
}, function (_31) {
return function (_32) {
return EQ.value;
};
});
var eqString = new Eq($foreign.refEq);
var ordString = new Ord(function () {
return eqString;
}, unsafeCompare);
var eqOrdering = new Eq(function (_29) {
return function (_30) {
if (_29 instanceof LT && _30 instanceof LT) {
return true;
};
if (_29 instanceof GT && _30 instanceof GT) {
return true;
};
if (_29 instanceof EQ && _30 instanceof EQ) {
return true;
};
return false;
};
});
var ordOrdering = new Ord(function () {
return eqOrdering;
}, function (_33) {
return function (_34) {
if (_33 instanceof LT && _34 instanceof LT) {
return EQ.value;
};
if (_33 instanceof EQ && _34 instanceof EQ) {
return EQ.value;
};
if (_33 instanceof GT && _34 instanceof GT) {
return EQ.value;
};
if (_33 instanceof LT) {
return LT.value;
};
if (_33 instanceof EQ && _34 instanceof LT) {
return GT.value;
};
if (_33 instanceof EQ && _34 instanceof GT) {
return LT.value;
};
if (_33 instanceof GT) {
return GT.value;
};
throw new Error("Failed pattern match at Prelude line 668, column 1 - line 677, column 1: " + [ _33.constructor.name, _34.constructor.name ]);
};
});
var eqNumber = new Eq($foreign.refEq);
var ordNumber = new Ord(function () {
return eqNumber;
}, unsafeCompare);
var eqInt = new Eq($foreign.refEq);
var ordInt = new Ord(function () {
return eqInt;
}, unsafeCompare);
var eqChar = new Eq($foreign.refEq);
var ordChar = new Ord(function () {
return eqChar;
}, unsafeCompare);
var eqBoolean = new Eq($foreign.refEq);
var ordBoolean = new Ord(function () {
return eqBoolean;
}, unsafeCompare);
var eq = function (dict) {
return dict.eq;
};
var $eq$eq = function (__dict_Eq_7) {
return eq(__dict_Eq_7);
};
var eqArray = function (__dict_Eq_8) {
return new Eq($foreign.eqArrayImpl($eq$eq(__dict_Eq_8)));
};
var divisionRingUnit = new DivisionRing(function () {
return moduloSemiringUnit;
}, function () {
return ringUnit;
});
var numUnit = new Num(function () {
return divisionRingUnit;
});
var divisionRingNumber = new DivisionRing(function () {
return moduloSemiringNumber;
}, function () {
return ringNumber;
});
var numNumber = new Num(function () {
return divisionRingNumber;
});
var div = function (dict) {
return dict.div;
};
var $div = function (__dict_ModuloSemiring_10) {
return div(__dict_ModuloSemiring_10);
};
var disj = function (dict) {
return dict.disj;
};
var $bar$bar = function (__dict_BooleanAlgebra_11) {
return disj(__dict_BooleanAlgebra_11);
};
var $$const = function (a) {
return function (_10) {
return a;
};
};
var $$void = function (__dict_Functor_12) {
return function (fa) {
return $less$dollar$greater(__dict_Functor_12)($$const(unit))(fa);
};
};
var conj = function (dict) {
return dict.conj;
};
var $amp$amp = function (__dict_BooleanAlgebra_13) {
return conj(__dict_BooleanAlgebra_13);
};
var compose = function (dict) {
return dict.compose;
};
var functorFn = new Functor(compose(semigroupoidFn));
var $less$less$less = function (__dict_Semigroupoid_14) {
return compose(__dict_Semigroupoid_14);
};
var $greater$greater$greater = function (__dict_Semigroupoid_15) {
return flip(compose(__dict_Semigroupoid_15));
};
var compare = function (dict) {
return dict.compare;
};
var ordArray = function (__dict_Ord_16) {
return new Ord(function () {
return eqArray(__dict_Ord_16["__superclass_Prelude.Eq_0"]());
}, function (xs) {
return function (ys) {
return $dollar(compare(ordInt)(0))($foreign.ordArrayImpl(function (x) {
return function (y) {
var _170 = compare(__dict_Ord_16)(x)(y);
if (_170 instanceof EQ) {
return 0;
};
if (_170 instanceof LT) {
return 1;
};
if (_170 instanceof GT) {
return negate(ringInt)(1);
};
throw new Error("Failed pattern match at Prelude line 660, column 1 - line 666, column 1: " + [ _170.constructor.name ]);
};
})(xs)(ys));
};
});
};
var $less = function (__dict_Ord_17) {
return function (a1) {
return function (a2) {
var _171 = compare(__dict_Ord_17)(a1)(a2);
if (_171 instanceof LT) {
return true;
};
return false;
};
};
};
var $less$eq = function (__dict_Ord_18) {
return function (a1) {
return function (a2) {
var _172 = compare(__dict_Ord_18)(a1)(a2);
if (_172 instanceof GT) {
return false;
};
return true;
};
};
};
var $greater = function (__dict_Ord_19) {
return function (a1) {
return function (a2) {
var _173 = compare(__dict_Ord_19)(a1)(a2);
if (_173 instanceof GT) {
return true;
};
return false;
};
};
};
var $greater$eq = function (__dict_Ord_20) {
return function (a1) {
return function (a2) {
var _174 = compare(__dict_Ord_20)(a1)(a2);
if (_174 instanceof LT) {
return false;
};
return true;
};
};
};
var categoryFn = new Category(function () {
return semigroupoidFn;
}, function (x) {
return x;
});
var boundedUnit = new Bounded(unit, unit);
var boundedOrdering = new Bounded(LT.value, GT.value);
var boundedOrdUnit = new BoundedOrd(function () {
return boundedUnit;
}, function () {
return ordUnit;
});
var boundedOrdOrdering = new BoundedOrd(function () {
return boundedOrdering;
}, function () {
return ordOrdering;
});
var boundedInt = new Bounded(negate(ringInt)(2147483648), 2147483647);
var boundedOrdInt = new BoundedOrd(function () {
return boundedInt;
}, function () {
return ordInt;
});
var boundedChar = new Bounded($foreign.bottomChar, $foreign.topChar);
var boundedOrdChar = new BoundedOrd(function () {
return boundedChar;
}, function () {
return ordChar;
});
var boundedBoolean = new Bounded(false, true);
var boundedOrdBoolean = new BoundedOrd(function () {
return boundedBoolean;
}, function () {
return ordBoolean;
});
var bottom = function (dict) {
return dict.bottom;
};
var boundedFn = function (__dict_Bounded_21) {
return new Bounded(function (_36) {
return bottom(__dict_Bounded_21);
}, function (_35) {
return top(__dict_Bounded_21);
});
};
var booleanAlgebraUnit = new BooleanAlgebra(function () {
return boundedUnit;
}, function (_37) {
return function (_38) {
return unit;
};
}, function (_39) {
return function (_40) {
return unit;
};
}, function (_41) {
return unit;
});
var booleanAlgebraFn = function (__dict_BooleanAlgebra_22) {
return new BooleanAlgebra(function () {
return boundedFn(__dict_BooleanAlgebra_22["__superclass_Prelude.Bounded_0"]());
}, function (fx) {
return function (fy) {
return function (a) {
return conj(__dict_BooleanAlgebra_22)(fx(a))(fy(a));
};
};
}, function (fx) {
return function (fy) {
return function (a) {
return disj(__dict_BooleanAlgebra_22)(fx(a))(fy(a));
};
};
}, function (fx) {
return function (a) {
return not(__dict_BooleanAlgebra_22)(fx(a));
};
});
};
var booleanAlgebraBoolean = new BooleanAlgebra(function () {
return boundedBoolean;
}, $foreign.boolAnd, $foreign.boolOr, $foreign.boolNot);
var $div$eq = function (__dict_Eq_9) {
return function (x) {
return function (y) {
return not(booleanAlgebraBoolean)($eq$eq(__dict_Eq_9)(x)(y));
};
};
};
var bind = function (dict) {
return dict.bind;
};
var liftM1 = function (__dict_Monad_23) {
return function (f) {
return function (a) {
return bind(__dict_Monad_23["__superclass_Prelude.Bind_1"]())(a)(function (_0) {
return $$return(__dict_Monad_23["__superclass_Prelude.Applicative_0"]())(f(_0));
});
};
};
};
var $greater$greater$eq = function (__dict_Bind_24) {
return bind(__dict_Bind_24);
};
var asTypeOf = function (x) {
return function (_11) {
return x;
};
};
var applyFn = new Apply(function () {
return functorFn;
}, function (f) {
return function (g) {
return function (x) {
return f(x)(g(x));
};
};
});
var bindFn = new Bind(function () {
return applyFn;
}, function (m) {
return function (f) {
return function (x) {
return f(m(x))(x);
};
};
});
var apply = function (dict) {
return dict.apply;
};
var $less$times$greater = function (__dict_Apply_25) {
return apply(__dict_Apply_25);
};
var liftA1 = function (__dict_Applicative_26) {
return function (f) {
return function (a) {
return $less$times$greater(__dict_Applicative_26["__superclass_Prelude.Apply_0"]())(pure(__dict_Applicative_26)(f))(a);
};
};
};
var applicativeFn = new Applicative(function () {
return applyFn;
}, $$const);
var monadFn = new Monad(function () {
return applicativeFn;
}, function () {
return bindFn;
});
var append = function (dict) {
return dict.append;
};
var $plus$plus = function (__dict_Semigroup_27) {
return append(__dict_Semigroup_27);
};
var $less$greater = function (__dict_Semigroup_28) {
return append(__dict_Semigroup_28);
};
var semigroupFn = function (__dict_Semigroup_29) {
return new Semigroup(function (f) {
return function (g) {
return function (x) {
return $less$greater(__dict_Semigroup_29)(f(x))(g(x));
};
};
});
};
var ap = function (__dict_Monad_30) {
return function (f) {
return function (a) {
return bind(__dict_Monad_30["__superclass_Prelude.Bind_1"]())(f)(function (_2) {
return bind(__dict_Monad_30["__superclass_Prelude.Bind_1"]())(a)(function (_1) {
return $$return(__dict_Monad_30["__superclass_Prelude.Applicative_0"]())(_2(_1));
});
});
};
};
};
var monadArray = new Monad(function () {
return applicativeArray;
}, function () {
return bindArray;
});
var bindArray = new Bind(function () {
return applyArray;
}, $foreign.arrayBind);
var applyArray = new Apply(function () {
return functorArray;
}, ap(monadArray));
var applicativeArray = new Applicative(function () {
return applyArray;
}, function (x) {
return [ x ];
});
var add = function (dict) {
return dict.add;
};
var $plus = function (__dict_Semiring_31) {
return add(__dict_Semiring_31);
};
module.exports = {
LT: LT,
GT: GT,
EQ: EQ,
Show: Show,
BooleanAlgebra: BooleanAlgebra,
BoundedOrd: BoundedOrd,
Bounded: Bounded,
Ord: Ord,
Eq: Eq,
DivisionRing: DivisionRing,
Num: Num,
Ring: Ring,
ModuloSemiring: ModuloSemiring,
Semiring: Semiring,
Semigroup: Semigroup,
Monad: Monad,
Bind: Bind,
Applicative: Applicative,
Apply: Apply,
Functor: Functor,
Category: Category,
Semigroupoid: Semigroupoid,
show: show,
"||": $bar$bar,
"&&": $amp$amp,
not: not,
disj: disj,
conj: conj,
bottom: bottom,
top: top,
unsafeCompare: unsafeCompare,
">=": $greater$eq,
"<=": $less$eq,
">": $greater,
"<": $less,
compare: compare,
"/=": $div$eq,
"==": $eq$eq,
eq: eq,
"-": $minus,
negate: negate,
sub: sub,
"/": $div,
mod: mod,
div: div,
"*": $times,
"+": $plus,
one: one,
mul: mul,
zero: zero,
add: add,
"++": $plus$plus,
"<>": $less$greater,
append: append,
ap: ap,
liftM1: liftM1,
"return": $$return,
">>=": $greater$greater$eq,
bind: bind,
liftA1: liftA1,
pure: pure,
"<*>": $less$times$greater,
apply: apply,
"void": $$void,
"<#>": $less$hash$greater,
"<$>": $less$dollar$greater,
map: map,
id: id,
">>>": $greater$greater$greater,
"<<<": $less$less$less,
compose: compose,
otherwise: otherwise,
asTypeOf: asTypeOf,
"const": $$const,
flip: flip,
"#": $hash,
"$": $dollar,
unit: unit,
semigroupoidFn: semigroupoidFn,
categoryFn: categoryFn,
functorFn: functorFn,
functorArray: functorArray,
applyFn: applyFn,
applyArray: applyArray,
applicativeFn: applicativeFn,
applicativeArray: applicativeArray,
bindFn: bindFn,
bindArray: bindArray,
monadFn: monadFn,
monadArray: monadArray,
semigroupString: semigroupString,
semigroupUnit: semigroupUnit,
semigroupFn: semigroupFn,
semigroupOrdering: semigroupOrdering,
semigroupArray: semigroupArray,
semiringInt: semiringInt,
semiringNumber: semiringNumber,
semiringUnit: semiringUnit,
ringInt: ringInt,
ringNumber: ringNumber,
ringUnit: ringUnit,
moduloSemiringInt: moduloSemiringInt,
moduloSemiringNumber: moduloSemiringNumber,
moduloSemiringUnit: moduloSemiringUnit,
divisionRingNumber: divisionRingNumber,
divisionRingUnit: divisionRingUnit,
numNumber: numNumber,
numUnit: numUnit,
eqBoolean: eqBoolean,
eqInt: eqInt,
eqNumber: eqNumber,
eqChar: eqChar,
eqString: eqString,
eqUnit: eqUnit,
eqArray: eqArray,
eqOrdering: eqOrdering,
ordBoolean: ordBoolean,
ordInt: ordInt,
ordNumber: ordNumber,
ordString: ordString,
ordChar: ordChar,
ordUnit: ordUnit,
ordArray: ordArray,
ordOrdering: ordOrdering,
boundedBoolean: boundedBoolean,
boundedUnit: boundedUnit,
boundedOrdering: boundedOrdering,
boundedInt: boundedInt,
boundedChar: boundedChar,
boundedFn: boundedFn,
boundedOrdBoolean: boundedOrdBoolean,
boundedOrdUnit: boundedOrdUnit,
boundedOrdOrdering: boundedOrdOrdering,
boundedOrdInt: boundedOrdInt,
boundedOrdChar: boundedOrdChar,
booleanAlgebraBoolean: booleanAlgebraBoolean,
booleanAlgebraUnit: booleanAlgebraUnit,
booleanAlgebraFn: booleanAlgebraFn,
showBoolean: showBoolean,
showInt: showInt,
showNumber: showNumber,
showChar: showChar,
showString: showString,
showUnit: showUnit,
showArray: showArray,
showOrdering: showOrdering
};
},{"./foreign":"/Users/slevin/wrk/exp/pures/snake/output/Prelude/foreign.js"}],"/Users/slevin/wrk/exp/pures/snake/output/browserify.js":[function(require,module,exports){
require('Main').main();
},{"Main":"/Users/slevin/wrk/exp/pures/snake/output/Main/index.js"}]},{},["/Users/slevin/wrk/exp/pures/snake/output/browserify.js"]);
|
/**
* Created by Taoxinyu on 2015/10/19.
*/
function GiveBodyHei(){
var bodyhei=$(document).height();
var winhei=$(window).height();
if(bodyhei<winhei){
$(".body_con").height(winhei-105);
}
}
function GiveRightContentHei(){
var leftnavihei=$(".nav_list_con").height();
$(".content_con").css("min-height",leftnavihei);
}
//添加左边导航样式
function AddNaviListClass(name){
$(".product_list").find("li[data-name='"+ name +"']").addClass("onclick");
}
//两个数组合并去重
function tab(arr1,arr2){
var arr = arr1.concat(arr2);
var lastArr = [];
for(var i = 0;i<arr.length;i++)
{
if(! unique(arr[i],lastArr))
{
lastArr.push(arr[i]);
}
}
return lastArr;
}
function unique(n,arr)
{
for(var i=0;i<arr.length;i++)
{
if(n==arr[i]){
return true;
}
}
return false;
}
//异步POST获取数据
function AjaxPostData(url,data,fn){
$.ajax({
url:url,
type:"POST",
data:data,
processData:false,
dataType:"json",
timeout:60000,
beforeSend:function(){
Loading();
},
success:function(result){
fn(result);
},
complete:function(){
RemoveLoading();
}
});
}
//同步POST获取数据
function NoAjaxPostData(url,data,fn){
$.ajax({
url: url,
type: "POST",
data: data,
processData: false,
dataType: "json",
async: false
}).done(function(result){
fn(result);
});
}
//loading动画
function Loading(){
var loaddiv='<div class="bg_wapper" id="load_div">'+
'<div class="dingwei">'+
'<div class="spinner">'+
'<div class="bounce1"></div>'+
'<div class="bounce2"></div>'+
'<div class="bounce3"></div>'+
'</div>'+
'<div class="spinner_wz">数据加载中...</div>'+
'</div>'+
'</div>';
$("body").append(loaddiv);
}
//删除loading
function RemoveLoading(){
$("#load_div").remove();
}
//过滤特殊字符
function illegalChar(str)
{
var pattern=/[`~!@#\$%\^\&\*\(\)_\+<>\?:"\{\},\\\/;'\[\]]/im;
if(pattern.test(str)){
return false;
}
return true;
}
//过滤HTML标签
function illegalHtml(str){
var pattern=/[<>]/im;
if(pattern.test(str)){
return false;
}
return true;
}
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
}
//获取URL的参数
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var param = decodeURI(window.location.search);
var r = param.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
//提示信息
function ShowMsgTip(selector, msg)
{
layer.tips(msg, selector, {
guide: 0,
time: 2,
color:'#78BA32'
}); // guide: 指引方向(0:上,1:右,2:下,3:左)。
}
//小数点后几位的四舍五入
function xround(x,num){
return Math.round(x*Math.pow(10,num))/Math.pow(10,num);
}
//小数点后两位四舍五入
function RoundTwoNum(id){
$("#"+id).change(function(){
var kval=xround($("#"+id).val(),2);
$("#"+id).val(kval);
});
}
//日期格式化
Date.prototype.format = function (fmt)
{
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
//获取当天的年月日
var GetNowTime=(function(){
return{
GetYear:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
return nowyear;
},
GetMonth:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
return nowmonth;
},
GetDay:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
return nowdate;
},
GetToday:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
initdate.setDate(nowdate);
var today=initdate.format(DateFormat);
return today;
},
GetYesterday:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
initdate.setDate(initdate.getDate()-1);
var yesday=initdate.format(DateFormat);
return yesday;
},
GetOneweekAgoDay:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
initdate.setDate(initdate.getDate()-7);
var weekago=initdate.format(DateFormat);
return weekago;
},
Get30DaysAgoDay:function(){
var DateFormat = "yyyy-MM-dd";
var initdate=new Date();
var nowyear=initdate.getFullYear();
var nowmonth=(initdate.getMonth()+1)>=10?(initdate.getMonth()+1):'0'+(initdate.getMonth()+1);
var nowdate=initdate.getDate()>=10?initdate.getDate():'0'+initdate.getDate();
initdate.setDate(initdate.getDate()-30);
var twnday=initdate.format(DateFormat);
return twnday;
}
}
})();
//uuid
function uuid() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = "-";
var uuid = s.join("");
return uuid;
}
function AddJqueryFun(){
//添加jquery实例方法
$.fn.extend(
{
//判断是否是二位小数
judgeIsDouble:function(reg) {
if(!reg){
reg=/^\d+(\.\d{0,2})?$/;
}
var val = $(this).val();
if(val && !reg.test(val.trim())){
return false;
}
return true;
},
//判断是否是整数(0和整数)
judgeIsInt:function(reg) {
if(!reg){
reg=/^[1-9]\d*|0$/;
}
var val = $(this).val();
if(val && !reg.test(val.trim())){
return false;
}
return true;
},
//判断是否是正整数(不带0)
judgeIsPInt:function(reg){
if(!reg){
reg=/^[+]?[1-9]\d*$/;
}
var val = $(this).val();
if(val && !reg.test(val.trim())){
return false;
}
return true;
}
});
//添加jquery静态方法
}
$(function($){
GiveBodyHei();
GiveRightContentHei();
AddJqueryFun();
$(document).tooltip();
$(window).resize(function(){
GiveBodyHei();
});
$(document).delegate(".check_lable","click",function(){
if($(this).children("i").attr("data-status")=="0"){
$(this).children("i").show().attr("data-status","1");
}
else{
$(this).children("i").hide().attr("data-status","0");
}
if($(".check_lable").children("i[data-status=1]").length==$(".check_lable").length){
$(".checkall").children("i").show().attr("data-status","1");
$("#checkall").attr("checked",true);
}
else{
$(".checkall").children("i").hide().attr("data-status","0");
$("#checkall").attr("checked",false);
}
});
$(".checkall").click(function() {
if($(".checkall").children("i").attr("data-status")=="0"){
$(this).children("i").show().attr("data-status","1");
$('input[name="subBox"]').attr("checked",true);
$(".check_lable").each(function(index){
$(this).children("i").show().attr("data-status","1");
});
}
else{
$(this).children("i").hide().attr("data-status","0");
$('input[name="subBox"]').attr("checked",false);
$(".check_lable").each(function(index){
$(this).children("i").hide().attr("data-status","0");
});
}
});
$(document).delegate(".selected_wz","click",function(e){
if($(this).parent().hasClass("disabled")){
return;
}
stopPropagation(e);
$(".option_con").hide();
$(this).parent().children(".option_con").show();
});
$(document).bind("click",function(){
$(".option_con").hide();
$(".sshop_down_con").hide();
});
$.datepicker.regional['zh-CN'] = {
closeText: '关闭',
prevText: '<上月',
nextText: '下月>',
currentText: '今天',
monthNames: ['1月','2月','3月','4月','5月','6月',
'7月','8月','9月','10月','11月','12月'],
monthNamesShort: ['1','2','3','4','5','6',
'7','8','9','10','11','12'],
dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
dayNamesMin: ['日','一','二','三','四','五','六'],
weekHeader: '周',
dateFormat: 'yy-mm-dd',
firstDay: 1,
isRTL: false,
showMonthAfterYear: true,
yearSuffix: '年',
};
$.datepicker.setDefaults($.datepicker.regional['zh-CN']);
$(".sshop_name").bind("click",function(e){
stopPropagation(e);
$(".sshop_down_con").show();
});
setTimeout(function(){
window.location.reload();
},6600000);
});
function UploadCallBackJquery(dataObj){
if(dataObj.status===0){
alert(dataObj.msg);
return;
}
var selector = dataObj.data.selector;
$("#"+selector).children("li").remove();
var dom='<li data-id="">'+
'<img src="'+ dataObj.data.image_path +'">'+
'<span class="ServiceList_img_del"></span>'+
'</li>';
$("#"+selector).append(dom);
}
function map() {
/** 存放键的数组(遍历用到) */
this.keys = new Array();
/** 存放数据 */
this.data = new Object();
/**
* 遍历Map,执行处理函数
*
* @param {Function}
* 回调函数 function(key,value,index){..}
*/
this.each = function(fn) {
if (typeof fn != 'function') {
return;
}
var len = this.keys.length;
for (var i = 0; i < len; i++) {
var k = this.keys[i];
fn(k, this.data[k], i);
}
};
/**
* 放入一个键值对
*
* @param {String}
* key
* @param {Object}
* value
*/
this.put = function(key, value) {
if (this.data[key] == null) {
this.keys.push(key);
}
this.data[key] = value;
};
/**
* 获取某键对应的值
*
* @param {String}
* key
* @return {Object} value
*/
this.get = function(key) {
return this.data[key];
};
this.size = function() {
return this.keys.length;
};
} |
import Head from "next/head";
export default function Home() {
return (
<div>
<Head>
<title>Create Next App + Tailwind</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="min-h-screen max-w-screen-lg mx-auto flex flex-col items-center justify-center">
<h1 className="text-4xl font-bold">
Welcome to{" "}
<a href="https://nextjs.org" className="text-blue-500">
Next.js
</a>{" "}
+{" "}
<a href="https://tailwindcss.com" className="text-green-700">
Tailwind
</a>
!
</h1>
<p>
Get started by editing <code>pages/index.js</code>
</p>
</main>
</div>
);
}
|
export function configure(config) {
config.globalResources([
'./value-converters/repeatlimit',
'./value-converters/sortpolls',
'./elements/header.html',
'./elements/footer.html'
]);
} |
console.log("loops");
// My basic for loop
for (let i = 0; i <5; i++) {
console.log(i);
}
// Basic while loop
let j = 0;
while (j < 5) {
console.log(j);
j++;
} |
function sl_check(field, name, maxlength, minlength)
{
var sMsg="";
if(minlength != 0 && field.value == "")
{
sMsg=name+"\t不能为空,请您填写"+name+"!\n\n";
field.focus();
return sMsg;
}
if(!no_deviant_char(field,name)) {
sMsg+=name+"\t中不能包含单引号等非法字符!\n\n";
return sMsg;
}
if(minlength != 0 && ansiLength(field.value) < minlength)
{
if(minlength == maxlength)
sMsg+=name+"\t的长度必须是"+minlength+"位,请您重新填写!\n\n";
else
sMsg+=name+"\t的长度至少需要"+minlength+"位以上,请您重新填写!\n\n";
field.focus();
return sMsg;
}
if(maxlength != 0 && ansiLength(field.value) > maxlength)
{
sMsg+=name+"\t的长度不能超过"+maxlength+"个字符,请您重新填写!\n\n";
field.focus();
return sMsg;
}
return sMsg;
}
function sl_alert(errinfo, url)
{
alert("系统提示: \n\n" + errinfo + "\n\n");
if (url != null)
location.replace(url);
}
function sl_checkChoice(field, name)
{
var sMsg="";
if (field.value == null || field.value == "")
{
sMsg="请选择"+name+"!\n\n";
field.focus();
}
return sMsg;
}
function sl_confirm(confirm_info, vbVersion)
{
if (vbVersion == null){
return confirm("系统确认:\n\n您确认要" + confirm_info + "吗?");
}
else
return sl_vb_comfirm("系统确认:\n\n您确认要" + confirm_info + "吗?");
}
function sl_check_update(doNew)
{
if (doNew == "null")
return sl_confirm("保存");
else
return sl_confirm("保存修改");
}
function no_deviant_char(s, alertwords)
{
if (s.value.indexOf("'", 0) >= 0)
{
s.focus();
return false;
}
return true;
}
function ansiLength(str)
{
var len = 0;
for (i = 0; i < str.length; i++)
{
if (str.charCodeAt(i) > 127)
len = len + 2;
else
len++;
}
return len;
}
function sl_checkNum(field, name, maxlength, minlength)
{
var i, str, sMsg;
sMsg=sl_check(field, name, maxlength, minlength);
str =""+Math.abs(field.value);
if(sMsg==""){
if(!str.match("^[0-9]+$")){
sMsg+=name+"\t必须是整数数字,请您重新填写!\n\n";
field.focus();
return sMsg;
}
}
return sMsg;
}
/*
intLength:全部数字限制
floatLength:小数位数字限制
minlength:最小长度
*/
function sl_checkFloat(field, name, intLength,floatLength, minlength)
{
var str, sMsg;
sMsg=sl_check(field, name, intLength+floatLength+1, minlength);
str =""+Math.abs(field.value);
if(sMsg!=""){
return sMsg;
}
var s1 = str.replace(/\./g,"");
if(str.length-s1.length>1){
sMsg+=name+"\t格式不正确,只能存在一个小数点,请您重新填写!\n\n";
field.focus();
return sMsg;
}
if(!s1.match("^[0-9]+$")){
sMsg+=name+"\t必须是数字,请您重新填写!\n\n";
field.focus();
return sMsg;
}
var pos = str.indexOf(".");
if(pos!=-1){
if(str.length-pos>floatLength+1){
sMsg += name+"\t小数部分不能超过"+floatLength+"位,请调整\n\n";
return sMsg;
}
}
return sMsg;
}
function confirmRemov(element)
{
if (element == null)
{
sl_alert("未选定任何记录!");
return false;
}
if(checkedCount(element) == 0)
{
sl_alert("请选定要删除的记录!");
return false;
}
return sl_confirm('对删除选定的记录');
}
function checkedCount(element)
{
var iCount = 0;
var i;
if(element == null)
return 0;
if(element.length == null)
{
if(element.checked)
return 1;
else
return 0;
}
for(i = 0; i < element.length; i++)
if(element[i].checked)
iCount++;
return iCount;
}
function sl_checkEmail(s, name)
{
var sMsg;
var len=trim(s.value).length;
sMsg=sl_check(s,name,40,0);
if(len !=0)
{
pos1 = trim(s.value).indexOf("@");
pos2 = trim(s.value).indexOf(".");
pos3 = trim(s.value).lastIndexOf("@");
pos4 = trim(s.value).lastIndexOf(".");
//check '@' and '.' is not first or last character
if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len))
{
sMsg+="请您输入有效的"+ name +"!\n\n";
s.focus();
return sMsg;
}
else
{
//check @. or .@
if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1)
|| ( pos1 != pos3 ) //find two @
|| ( pos4 < pos3 ) //. should behind the '@'
|| (pos4 == len - 1) ) //. should not in the last letter
{
sMsg+="请您输入有效的"+ name +"!\n\n";
s.focus();
return sMsg;
}
}
if (!isCharsInBag( trim(s.value), "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@"))
{
sMsg+=name + "中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@\n" + "请您重新输入"+ name+"\n\n";
s.focus();
return sMsg;
}
}
return sMsg;
}
function isCharsInBag(s, bag)
{
var i;
// Search through string's characters one by one.
// If character is in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) return false;
}
return true;
}
function isNull(str)
{
var flag = false;
for (i = 0; i < str.length; i++)
{
if (str.charAt(i) != ' ')
flag = true;
}
return !flag;
}
//trim str.
function trim(str)
{
var strTmp;
if ((str=="")||(str==null))
return "";
for(var i = 0 ; i<str.length && str.charAt(i)==" " ; i++ ) ;
strTmp = str.substring(i,str.length);
for(var i = strTmp.length - 1; i > 0 && strTmp.charAt(i)==" "; i--) ;
strTmp = strTmp.substring(0,i+1);
return strTmp;
}
function selectAll(checkname)
{
if(checkname == null)
return;
var iCount = checkedCount(checkname);
var i;
if(checkname.length == null)
{
checkname.checked = iCount < 1;
return;
}
for(i = 0; i < checkname.length; i++)
checkname[i].checked = iCount < checkname.length;
}
function checkedTextCount(element,element_txt)
{
var iValid = true;
var i;
if(element_txt.length == null)
{
if(element.checked && element_txt.value=="")
iValid=false;
}
for(i = 0; i < element.length; i++){
if(element[i].checked && element_txt[i].value=="")
{
iValid=false;
break;
}
}
return iValid;
}
function sl_checkPhone(field, name, maxlength, minlength){
var sMsg=sl_check(field, name, maxlength, minlength);
var s=trim(field.value);
if(sMsg==""){
if(!s.match("^[0-9\- ]+$")){
sMsg+=name+"不是有效电话号码!\n\n";
field.focus();
return sMsg;
}
}
return sMsg;
}
function sl_checkDate(field, name){
var sMsg=sl_check(field, name, 10,0);
var str=trim(field.value);
if(str!=""){
var ary=str.split("-");
if(ary.length!=3){
sMsg+=name+"必须为日期格式yyyy-mm-dd!\n\n";
return sMsg;
}
if(!(isInt(ary[0])&&isInt(ary[1])&&isInt(ary[2]))){
sMsg+=name+"必须为日期格式yyyy-mm-dd!\n\n";
return sMsg;
}
}
return sMsg;
}
function isInt(s){
if (s.match("^[0-9]+$"))
{
return true;
}
else
{
return false;
}
}
//比较sTime1与sTime2。
function compareDate(sTime1,sTime2) {
t1 = Date.parse(sTime1);
t2 = Date.parse(sTime2);
return t1 - t2;
}
//如果Date是以"-"分隔(如2004-11-15),则先转化"-"为"/",再比较
//如果前面的日期大于后面的日期则返回结果>0, 否则<0
function newCompareDate(Date1, Date2) {
return compareDate(Date1.replace("-","/"),Date2.replace("-","/"));
}
//函数名:fucPWDchk
//功能介绍:检查是否含有字母
//参数说明:要检查的字符串
//返回值:false:含有 true:全部为字母
function fucPWDchk(str)
{
var strSource ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var ch;
var i;
var temp;
for(i=0;i<=(str.length-1);i++)
{
ch = str.charAt(i);
temp = strSource.indexOf(ch);
if (temp==-1)
{
return false;
}
}
if(strSource.indexOf(ch)==-1)
{
return false;
}
else
{
return true;
}
}
//函数名:getRadioValue
//功能介绍:取单选框的值
//参数说明:单选框对象
//返回值:单选框的值
function getRadioValue(obj){
var ary = obj;
var rtn="";
if(ary.value==null){
for(i=0;i<ary.length;i++){
if(ary[i].checked){
rtn=ary[i].value;
break;
}
}
}
else {
if(obj.checked){
rtn=obj.value;
}
}
return rtn;
}
|
'use strict';
// MODULES //
var isArrayLike = require( 'validate.io-array-like' ),
isMatrixLike = require( 'validate.io-matrix-like' ),
isNumber = require( 'validate.io-number-primitive' ),
matrix = require( 'dstructs-matrix' );
// FUNCTIONS //
var getPDF = require( './pdf.js' ),
getCDF = require( './cdf.js' ),
getQuantileFunction = require( './quantile.js' ),
getMGF = require( './mgf.js' );
// DISTRIBUTION //
/**
* FUNCTION: Distribution( a, b )
* Distribution constructor.
*
* @constructor
* @param {Number} [a] - minimum value
* @param {Number} [b] - maximum value
* @returns {Distribution} Distribution instance
*/
function Distribution( a, b ) {
if ( a !== undefined && b !== undefined ) {
if ( !isNumber( a ) ) {
throw new TypeError( 'constructor()::invalid input argument. The minimum value `a` must be a number primitive. Value: `' + a + '`' );
}
if ( !isNumber( b ) ) {
throw new TypeError( 'constructor()::invalid input argument. The maximum value `b` must be a number primitive. Value: `' + b + '`' );
}
if ( b <= a ) {
throw new TypeError( 'constructor()::invalid input arguments. `a` must be smaller than `b`.' );
}
}
this._a = a || 0 ; // minimum
this._b = b || 1; // maximum
return this;
} // end FUNCTION Distribution()
/**
* METHOD: support()
* Returns the distribution support.
*
* @returns {Array} distribution support
*/
Distribution.prototype.support = function() {
return [ this._a, this._b ];
}; // end METHOD support()
/**
* METHOD: a( [value] )
* `a` setter and getter. If a value is provided, sets the minimum value. If no value is provided, returns it.
*
* @param {Number} [value] - minimum value
* @returns {Distribution|Number} Distribution instance or `a` parameter
*/
Distribution.prototype.a = function( value ) {
if ( !arguments.length ) {
return this._a;
}
if ( !isNumber ) {
throw new TypeError( 'a()::invalid input argument. The minimum value `a` must be numeric.' );
}
if ( value >= this._b ) {
throw new TypeError( 'a()::invalid input argument. The minimum value `a` must be smaller than parameter `b`.' );
}
this._a = value;
return this;
}; // end METHOD a()
/**
* METHOD: b( [value] )
* `b` setter and getter. If a value is provided, sets the maximum value. If no value is provided, returns it.
*
* @param {Number} [value] - maximum value
* @returns {Distribution|Number} Distribution instance or `b` parameter
*/
Distribution.prototype.b = function( value ) {
if ( !arguments.length ) {
return this._b;
}
if ( !isNumber ) {
throw new TypeError( 'b()::invalid input argument. The maximum value `b` must be numeric.' );
}
if ( value <= this._a ) {
throw new TypeError( 'a()::invalid input argument. The maximum value `b` must be greater than parameter `a`.' );
}
this._b = value;
return this;
}; // end METHOD b()
/**
* METHOD: mean()
* Returns the distribution mean.
*
* @returns {Number} mean value
*/
Distribution.prototype.mean = function() {
return 0.5 * ( this._a + this._b );
}; // end METHOD mean()
/**
* METHOD: variance()
* Returns the distribution variance.
*
* @returns {Number} variance
*/
Distribution.prototype.variance = function() {
var a = this._a,
b = this._b;
return (1/12) * Math.pow( b - a, 2 );
}; // end METHOD variance()
/**
* METHOD: median()
* Returns the distribution median.
*
* @returns {Number} median
*/
Distribution.prototype.median = function() {
return 0.5 * ( this._a + this._b );
}; // end METHOD median()
/**
* METHOD: skewness()
* Returns the distribution skewness.
*
* @returns {Number} skewness
*/
Distribution.prototype.skewness = function() {
return 0;
}; // end METHOD skewness()
/**
* METHOD: ekurtosis()
* Returns the distribution excess kurtosis.
*
* @returns {Number} excess kurtosis
*/
Distribution.prototype.ekurtosis = function() {
return -6/5;
}; // end METHOD ekurtosis()
/**
* METHOD: entropy()
* Returns the entropy.
*
* @returns {Number} entropy
*/
Distribution.prototype.entropy = function() {
return Math.log( this._b - this._a );
}; // end METHOD entropy()
/**
* METHOD: pdf( [x] )
* If provided an input `x`, evaluates the distribution PDF for each element. If no input argument is provided, returns the PDF.
*
* @param {Number|Number[]|Array|Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array|Matrix} [x] - input values
* @returns {Function|Array|Matrix|Number} distribution PDF or evaluated PDF
*/
Distribution.prototype.pdf = function( x ) {
var pdf, len, out, val, i;
pdf = getPDF( this._a, this._b );
if ( !arguments.length ) {
return pdf;
}
if ( isNumber( x ) ) {
return pdf ( x );
}
if ( isMatrixLike( x ) ) {
len = x.length;
// Create an output matrix:
out = matrix( new Float64Array( len ), x.shape );
for ( i = 0; i < len; i++ ) {
out.data[ i ] = pdf( x.data[ i ] );
}
return out;
}
if ( isArrayLike( x ) ) {
len = x.length;
out = new Array( len );
for ( i = 0; i < len; i++ ) {
val = x[ i ];
if ( !isNumber( val ) ) {
return NaN;
} else {
out[ i ] = pdf( val );
}
}
return out;
}
return NaN;
}; // end METHOD pdf()
/**
* METHOD: cdf( [x] )
* If provided an input `x`, evaluates the distribution CDF for each element. If no input argument is provided, returns the CDF.
*
* @param {Number|Number[]|Array|Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array|Matrix} [x] - input values
* @returns {Function|Array|Matrix|Number} distribution CDF or evaluated CDF
*/
Distribution.prototype.cdf = function( x ) {
var cdf, len, out, val, i;
cdf = getCDF( this._a, this._b );
if ( !arguments.length ) {
return cdf;
}
if ( isNumber( x ) ) {
return cdf( x );
}
if ( isMatrixLike( x ) ) {
len = x.length;
// Create an output matrix:
out = matrix( new Float64Array( len ), x.shape );
for ( i = 0; i < len; i++ ) {
out.data[ i ] = cdf( x.data[ i ] );
}
return out;
}
if ( isArrayLike( x ) ) {
len = x.length;
out = new Array( len );
for ( i = 0; i < len; i++ ) {
val = x[ i ];
if ( !isNumber( val ) ) {
return NaN;
} else {
out[ i ] = cdf( val );
}
}
return out;
}
return NaN;
}; // end METHOD cdf()
/**
* METHOD: quantile( [p] )
* If provided an input `p`, evaluates the distribution quantile function for each element. If no input argument is provided, returns the quantile function.
*
* @param {Number|Number[]|Array|Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array|Matrix} [p] - input values
* @returns {Function|Array|Matrix|Number} distribution quantile function or evaluated quantile function
*/
Distribution.prototype.quantile = function( p ) {
var q, len, out, val, i;
q = getQuantileFunction( this._a, this._b );
if ( !arguments.length ) {
return q;
}
if ( isNumber( p ) ) {
return q( p );
}
if ( isMatrixLike( p ) ) {
len = p.length;
// Create an output matrix:
out = matrix( new Float64Array( len ), p.shape );
for ( i = 0; i < len; i++ ) {
out.data[ i ] = q( p.data[ i ] );
}
return out;
}
if ( isArrayLike( p ) ) {
len = p.length;
out = new Array( len );
for ( i = 0; i < len; i++ ) {
val = p[ i ];
if ( !isNumber( val ) ) {
return NaN;
} else {
out[ i ] = q( val );
}
}
return out;
}
return NaN;
}; // end METHOD quantile()
/**
* METHOD: mgf( [t] )
* If provided an input `t`, evaluates the moment generating function for each element. If no input argument is provided, returns the moment generating function.
*
* @param {Number|Number[]|Array|Int8Array|Uint8Array|Uint8ClampedArray|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array|Matrix} [t] - input values
* @returns {Function|Array|Matrix|Number} moment generating function or evaluated moment generating function
*/
Distribution.prototype.mgf = function( t ) {
var m, len, out, val, i;
m = getMGF( this._a, this._b );
if ( !arguments.length ) {
return m;
}
if ( isNumber( t ) ) {
return m( t );
}
if ( isMatrixLike( t ) ) {
len = t.length;
// Create an output matrix:
out = matrix( new Float64Array( len ), t.shape );
for ( i = 0; i < len; i++ ) {
out.data[ i ] = m( t.data[ i ] );
}
return out;
}
if ( isArrayLike( t ) ) {
len = t.length;
out = new Array( len );
for ( i = 0; i < len; i++ ) {
val = t[ i ];
if ( !isNumber( val ) ) {
return NaN;
} else {
out[ i ] = m( val );
}
}
return out;
}
return NaN;
}; // end METHOD mgf()
// EXPORTS //
module.exports = function createDistribution( a, b ) {
return new Distribution( a, b );
};
|
const crypto = require('crypto');
class EncryptionManager {
constructor() {
}
/**
* Validates a hash of a string against the passed hash
* @param string - The string to validate
* @param salt - The salt for the hash
* @param hash - The hash to validate against
*/
validiateHash(string, salt, hash) {
return new Promise((resolve, reject) => {
this.generateHash(string, salt)
.then((stringHash) => {
if (hash == stringHash)
resolve(true);
else
resolve(false);
})
});
};
/**
* Generates a salted hash representation of the input string
* @param string - The string to hash
* @param salt - The salt to hash with
*/
generateHash(string, salt) {
return new Promise((resolve, reject) => {
crypto.pbkdf2(string, salt, 100000, 256, 'sha256', (err, stringHash) => {
if (err)
reject(err);
resolve(stringHash.toString('hex'));
})
});
};
/**
* Generates a new salt
*/
generateSalt() {
return new Promise((resolve, reject) => {
resolve(crypto.randomBytes(16).toString('hex'));
});
};
}
module.exports = new EncryptionManager();
|
import React from "react";
function Note1() {
return (
<div className="note">
<h1> Other courses given by the shape AI </h1>
<p>
There are some other bootcamp and Internship provided by the Shape AI
Such as python Bootcamp and Full sfack devolopment Internship
</p>
</div>
);
}
export default Note1;
|
define('Map', function(){
var Map = function(){
console.log('A new map (3)');
}
return Map;
});
|
let j = 0;
let a = 0;
let v = 0;
let personnes;
do {
personnes = window.prompt("Entrez votre age (la saisie s'arrete losque l'on rentre le nombre 100)");
if (personnes < 20) {
j++;
console.log(j);
} else if (personne >= 20) {
a++;
console.log(a);
} else if ((personnes >= 40) && (personnes <= 100)) {
v++;
console.log(v);
}
}
while (personnes < 100);
return window.alert("Il y a " + "" + j + "" + " jeunes\n " + "Il y a " + "" + a + "" + " adulte\n " + " Il y a " + " Il y a " + "" + v + "" + " vieux\n " + " dont " + " 1 " + "" + " centenaire ");
let age = 0;
let nb_jeune = 0;
let nb_adulte = 0;
let nb_vieux = 0;
let nb_centenaire = 0;
age = window.prompt("Entrez votre age(si l'age entré est supérieur ou égale a 100 la saisie se fini) ?")
if (age < 20) {
nb_jeune++;
age = window.prompt("Entrez votre age(si l'age entré est supérieur ou égale a 100 la saisie se fini) ?")
} else if (age => 40 || age <= 100) {
nb_vieux++;
age = window.prompt("Entrez votre age(si l'age entré est supérieur ou égale a 100 la saisie se fini) ?")
} else if (age => 20 || age < 40) {
nb_adulte++;
age = window.prompt("Entrez votre age(si l'age entré est supérieur ou égale a 100 la saisie se fini) ?")
} else if (age = 100 || age > 100) {
nb_centenaire++;
age = window.prompt("Entrez votre age(si l'age entré est supérieur ou égale a 100 la saisie se fini) ?")
} else {} |
// select all elements-------------------------------------
const start = document.getElementById("start");
const quiz = document.getElementById("quiz");
const question = document.getElementById("question");
const qImg = document.getElementById("qImg");
const choiceA = document.getElementById("A");
const choiceB = document.getElementById("B");
const choiceC = document.getElementById("C");
const choiceD = document.getElementById("D");
const counter = document.getElementById("counter");
const timeGauge = document.getElementById("timeGauge");
const progress = document.getElementById("progress");
const scoreDiv = document.getElementById("scoreContainer");
// create our questions-------------------------------------
let questions = [
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-15_Flanker_X.jpg", choiceA: "A:KJ-500", choiceB: "B:KA-28_Helix", choiceC: "C: J-15_Flanker_X", choiceD: "D: Z-19_Black_Whirlwind", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Q-5_Fantan.jpg", choiceA: "A:Z-8", choiceB: "B:Q-5_Fantan", choiceC: "C: H-20", choiceD: "D: j-13", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/JH-7_Flounder.jpg", choiceA: "A:J-8_Finback", choiceB: "B:JH-7_Flounder", choiceC: "C: Z-8", choiceD: "D: FC-31_J-31__F60_Snow_Owl", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/KJ-500.jpg", choiceA: "A:j-13", choiceB: "B:J-15_Flanker_X", choiceC: "C: Y-8", choiceD: "D: KJ-500", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-11_Flanker_L.jpg", choiceA: "A:J-5_Fresco", choiceB: "B:KA-28_Helix", choiceC: "C: J-11_Flanker_L", choiceD: "D: Kj-200", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/H-8.jpg", choiceA: "A:Z-20", choiceB: "B:Z-19_Black_Whirlwind", choiceC: "C: H-6", choiceD: "D: H-8", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/KA-28_Helix.jpg", choiceA: "A:Y-9", choiceB: "B:KA-28_Helix", choiceC: "C: J-12", choiceD: "D: J-16_Flanker_RedEagle", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Y-8.jpg", choiceA: "A:J-5_Fresco", choiceB: "B:KJ-600", choiceC: "C: J-8_Finback", choiceD: "D: Y-8", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Kj-200.jpg", choiceA: "A:J-8_Finback", choiceB: "B:Z-8", choiceC: "C: Kj-200", choiceD: "D: Z-19_Black_Whirlwind", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Z-8.jpg", choiceA: "A:Z-8", choiceB: "B:J-8_Finback", choiceC: "C: KJ-2000_Mainring", choiceD: "D: J-11_Flanker_L", correct: "A"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/H-20.jpg", choiceA: "A:H-20", choiceB: "B:Kj-200", choiceC: "C: KA-28_Helix", choiceD: "D: J-6_Farmer", correct: "A"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-10_FireBird.jpg", choiceA: "A:Y-8", choiceB: "B:J-10_FireBird", choiceC: "C: J-11_Flanker_L", choiceD: "D: JF-17_Thunder", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/KJ-600.jpg", choiceA: "A:J-15_Flanker_X", choiceB: "B:J-7_Fishcan", choiceC: "C: Kj-200", choiceD: "D: KJ-600", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Z-19_Black_Whirlwind.jpg", choiceA: "A:H-8", choiceB: "B:Z-9", choiceC: "C: Z-8", choiceD: "D: Z-19_Black_Whirlwind", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-16_Flanker_RedEagle.jpg", choiceA: "A:J-16_Flanker_RedEagle", choiceB: "B:J-10_FireBird", choiceC: "C: J-7_Fishcan", choiceD: "D: KJ-500", correct: "A"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-5_Fresco.jpg", choiceA: "A:J-16_Flanker_RedEagle", choiceB: "B:Kj-200", choiceC: "C: J-10_FireBird", choiceD: "D: J-5_Fresco", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-12.jpg", choiceA: "A:J-12", choiceB: "B:H-8", choiceC: "C: KJ-2000_Mainring", choiceD: "D: JF-17_Thunder", correct: "A"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-8_Finback.jpg", choiceA: "A:H-20", choiceB: "B:KJ-600", choiceC: "C: J-11_Flanker_L", choiceD: "D: J-8_Finback", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-7_Fishcan.jpg", choiceA: "A:JF-17_Thunder", choiceB: "B:J-7_Fishcan", choiceC: "C: H-8", choiceD: "D: Z-10_Thunderbolt", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Y-9.jpg", choiceA: "A:Y-8", choiceB: "B:Y-9", choiceC: "C: Q-5_Fantan", choiceD: "D: Z-20", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Z-20.jpg", choiceA: "A:Z-9_Haitun", choiceB: "B:J-20_MightyDragon", choiceC: "C: Z-20", choiceD: "D: KJ-500", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Z-10_Thunderbolt.jpg", choiceA: "A:J-8_Finback", choiceB: "B:Z-10_Thunderbolt", choiceC: "C: Z-9_Haitun", choiceD: "D: KJ-500", correct: "B"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-6_Farmer.jpg", choiceA: "A:KJ-600", choiceB: "B:Z-19_Black_Whirlwind", choiceC: "C: J-6_Farmer", choiceD: "D: H-20", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/j-13.jpg", choiceA: "A:J-7_Fishcan", choiceB: "B:Kj-200", choiceC: "C: Q-5_Fantan", choiceD: "D: j-13", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/KJ-2000_Mainring.jpg", choiceA: "A:Y-9", choiceB: "B:j-13", choiceC: "C: KJ-2000_Mainring", choiceD: "D: H-8", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/FC-31_J-31__F60_Snow_Owl.jpg", choiceA: "A:Q-5_Fantan", choiceB: "B:KJ-500", choiceC: "C: J-8_Finback", choiceD: "D: FC-31_J-31__F60_Snow_Owl", correct: "D"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/Z-9_Haitun.jpg", choiceA: "A:KJ-500", choiceB: "B:J-7_Fishcan", choiceC: "C: Z-9_Haitun", choiceD: "D: Z-8", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/H-6.jpg", choiceA: "A:Z-10_Thunderbolt", choiceB: "B:J-20_MightyDragon", choiceC: "C: H-6", choiceD: "D: Z-20", correct: "C"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/J-20_MightyDragon.jpg", choiceA: "A:J-20_MightyDragon", choiceB: "B:j-13", choiceC: "C: J-12", choiceD: "D: H-6", correct: "A"},
{question : "What is this?" , imgSrc: "pictures/Air/CH/JF-17_Thunder.jpg", choiceA: "A:KA-28_Helix", choiceB: "B:JF-17_Thunder", choiceC: "C: Z-10_Thunderbolt", choiceD: "D: Z-8", correct: "B"},
];
const questionTime = 20; // 10s per question
const gaugeWidth = 150; //150px
const lastQuestion = questions.length - 1;
const gaugeUnit = gaugeWidth / questionTime;
let runningQuestion = 0;
let count = 0;
let TIMER = 0;
let score = 0;
start.addEventListener("click",startQuiz);
// start the quiz
function startQuiz(){
start.style.display = "none";
renderQuestion();
quiz.style.display = "block";
renderProgress();
renderCounter();
TIMER = setInterval(renderCounter, 1000); //1000ms = 1s
}
// render a question
function renderQuestion(){
let q = questions[runningQuestion];
question.innerHTML = "<p>"+ q.question +"</p>";
qImg.innerHTML = "<img src="+ q.imgSrc +">";
choiceA.innerHTML = q.choiceA;
choiceB.innerHTML = q.choiceB;
choiceC.innerHTML = q.choiceC;
choiceD.innerHTML = q.choiceD;
}
// render progress--------------------------------------
function renderProgress(){
for(let qIndex = 0; qIndex <= lastQuestion; qIndex++){
progress.innerHTML += "<div class='prog' id="+ qIndex +"></div>";
}
}
//check answer
function checkAnswer(answer){
if(answer == questions[runningQuestion].correct)
{ score++;
answerIsCorrect();
} else {
answerIsWrong();
}
if(runningQuestion < lastQuestion)
{
count = 0;
runningQuestion++
renderQuestion();
} else {
clearInterval(TIMER);
scoreRender();
}
}
// answer is correct
function answerIsCorrect(){
document.getElementById(runningQuestion).style.backgroundColor = "#0f0"; }
// answer is wrong
function answerIsWrong(){
document.getElementById(runningQuestion).style.backgroundColor = "#f00";}
// counter render--------------------------------------------------
function renderCounter(){
if(count <= questionTime)
{
counter.innerHTML = count;
timeGauge.style.width = count * gaugeUnit + "px";
count++
} else
{ count = 0;
answerIsWrong();
if( runningQuestion < lastQuestion)
{
runningQuestion++;
renderQuestion();
} else
{ clearInterval(TIMER);
scoreRender();
}
}
}
// score render
function scoreRender(){
scoreDiv.style.display = "block";
const scorePerCent = Math.round( 100 * score / questions.length);
let img = ( scorePerCent >= 80) ? "img/5.png":
( scorePerCent >= 60) ? "img/4.png":
( scorePerCent >= 40) ? "img/3.png":
( scorePerCent >= 20) ? "img/2.png": "img/1.png";
scoreDiv.innerHTML = "<img src=" + img + "><p>"
+ scorePerCent + "%</p>";
}
|
import Main from '@/views/layout/Main'
import Login from '@/views/Login'
// 不作为Main组件的子页面展示的页面
export const loginRouter = {
path: '/login',
name: '登录',
component: resolve => { require(['@/views/Login'], resolve); },
meta:{isLogin:false,isAuth:false},
};
export const page404Router = {
path: '*',
name: '404',
component: resolve => { require(['@/views/404'], resolve); },
meta:{isLogin:false,isAuth:false}
};
//作为Main组件的子页面展示的页面
export const appRouter=[
{
path:'/',
name:'System',
component:Main,
children:[
{path:'/',redirect:{path:'/dashboard'}},
{path:'/dashboard',name:'Dashboard',component:resolve=>{require(['@/views/system/dashboard/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/graydeploy',name:'灰度发布',component:resolve=>{require(['@/views/system/graydeploy/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/namespaces',name:'命名空间',component:resolve=>{require(['@/views/system/namespaces/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/deployment',name:'Deployments',component:resolve=>{require(['@/views/system/deployment/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/pod',name:'Pod',component:resolve=>{require(['@/views/system/pod/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/service',name:'Service',component:resolve=>{require(['@/views/system/service/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/configmap',name:'Pod',component:resolve=>{require(['@/views/system/configmap/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/destinationrule',name:'DestinationRule',component:resolve=>{require(['@/views/system/destinationrule/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/virtualservice',name:'VirtualService',component:resolve=>{require(['@/views/system/virtualservice/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/gateway',name:'Gateway',component:resolve=>{require(['@/views/system/gateway/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/routelimit',name:'RouteLimit',component:resolve=>{require(['@/views/system/routelimit/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/faultinjection',name:'FaultInjection',component:resolve=>{require(['@/views/system/faultinjection/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/flowtrack',name:'FlowTrack',component:resolve=>{require(['@/views/system/flowtrack/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/istiosetting',name:'IstioSetting',component:resolve=>{require(['@/views/system/istiosetting/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/user',name:'User',component:resolve=>{require(['@/views/system/user/Container'],resolve);},meta:{isLogin:true,isAuth:true}},
{path:'/k8sconfigmap',name:'K8sConfigMap',component:resolve=>{require(['@/views/system/k8sconfigmap/Container'],resolve);},meta:{isLogin:true,isAuth:true}}
]
}
];
//导出
export const routers=[
loginRouter,
...appRouter,
page404Router
];
|
/* CPU: Ricoh RP2A03 (based on MOS6502, almost the same as in Commodore 64) */
// Declares the standard 2KiB of NES RAM accessible by the CPU
RAM = [];
// Set variables for managing CPU contexts and triggers: reset, non-maskable interrupt disable, edge state comparator, and current interrupt state.
// These are specifically used for interrupt control during Op loops and certain external events within the APU.
// Most of these variables are already part of processor status register (defined later on line 775).
// The difference is that the processor registers are (generally) controlled by the running program, and these are controlled by the kernel.
reset = true;
nmi = false;
nmi_edge_detected = false;
intr = false;
// Define procedure for actions that happen outside the CPU during every CPU tick.
CPU_tick = function(){
// The PPU processes three times for every CPU tick.
for(n = 0; n < 3; ++n){
PPU_tick();
}
// The APU processes once for every CPU tick.
APU_tick();
}
// Handle byte-level reads and writes.
// Much of the work here is to process memory mappings and call the appropriate namespace read/write functions with the modified address.
// Input arguments include a 16-bit CPU-mapped address and an input value for writing.
MemAccess = function(addr, v){
// Write mode is on if the second parameter is not set
write = (v !== undefined);
// During reset state (ex. the first CPU cycle), all calls to MemAccess are treated as reads
if(reset && write){
return MemAccess(addr);
}
// Process a CPU background tick -- The PPU ticks 3x and the APU ticks 1x.
CPU_tick();
// Map the memory from CPU's viewpoint:
// If the memory address is less than 0x2000 (8KiB), then we're interested in the NES RAM, which occupies the lower 0x800 (2KiB) of the address space.
// Get a reference to the target address in RAM. For read operations, return the reference. For writes, store the input value at that address.
if(addr < 0x2000){
r = RAM[addr & 0x7FF];
if(!write){
return r;
}
r = v;
}
// If the memory access is between 0x2000 and 0x4000 (8KiB and 16KiB), then forward the memory access request to the PPU via PPU_Access and mask the lower3 bits.
// Recall that PPU uses 8 ports from 0x2000 to 0x2008, so we only need those three bits to map correctly.
else if(addr < 0x4000){
return PPU_Access(addr & 7, v, write);
}
// If the memory access is between 0x4000 and 0x4018, then we're dealing with I/O for DMA functions for either PPU, APU, or Joystick.
else if(addr < 0x4018){
// Mask the lower 5 bits and compare to find appropriate DMA handler
switch(addr & 0x1F){
// If accessing CPU memory at 0x4014:
// Writing to 0x4014 initiates CPU-blocking 256-byte block transfer of OAM Data from one of the eight 256-byte RAM pages indexed by v.
// The data is written to the OAMDATA port 0x2004. This actual write is handled in PPU_Access
case 0x14: // OAM DMA: Copy 256 bytes from RAM into PPU's sprite memory
if(write){
for(b = 0; b < 256; ++b){
WB(0x2004, RB((v & 7) * 0x0100 + b));
return 0;
}
}
// If accessing CPU memory at 0x4015 then reads will return the currentAPU status (APU_Read) or writes will affect the channels (APU_Writeline)
case 0x15:
if(!write){
return APU_Read();
}
APU_Write(0x15, v);
break;
// If accessing CPU memory at 0x4016 then reads will get the last state of the Player 1 controller (IO_JoyRead on line 103),
// while writes will strobe both players if v is positive (See IO_JoyStrobe)
case 0x16:
if(!write){
return IO_JoyRead(0);
}
IO_JoyStrobe(v);
break;
// If accessing CPU memory at 0x4017 then reads will read the state of the Player 2 controller (IO_JoyRead). Writes do nothing.
case 0x17:
if(!write){
return IO_JoyRead(1); // write:passthru
}
// All other cases between 0x4000 and 0x4018 are writes to various APU component registers such as pulse, triangle, noise, and delta modulation (See APU_Write).
default:
if(!write){
break;
}
APU_Write(addr & 0x1F, v);
}
}
// All memory accesses above 0x4018 must be read/writes to GamePak memory (PRG/CHR ROM via GamePak_Access)
else {
return GamePak_Access(addr, v, write);
}
// Unreachable
return 0;
}
// CPU_RB reads a byte at a given address. This function is used during user program ops and wraps the MemAccess template.
RB = function(addr){
return MemAccess(addr);
}
// CPU_WB writes the provided value to the given address, again by wrapping the MemAccess template function.
WB = function(addr, v){
return MemAccess(addr, v);
}
// CPU registers
// Initialize the CPU Program Counter (PC) register to 0xC000. This is the beginning of the code segment (PRG ROM).
// 0x8000 could also be the beginning of PRG ROM with 0xC000 being the mirror. Advanced mappers may translate these addresses to other PRG ROM banks.
PC = 0xC000;
// Initialize the accumulator (A), Index X(X), Index Y(Y), and Stack Pointer registers to 0.
A = X = Y = S = 0;
// Processor Status (flags) register
P = {
// direct access to the entire register
raw: 0,
// Bit 0: accessor to the Carry flag.
// Functions like most CPU carry flags, by asserting after an operation that resulting in positive overflows from bit 7 or negative overflows from bit 0.
// Carry ~= unsigned overflow
C: 0,
// Bit 1: accessor to the Zero flag. Assets when any operation results in a zero result
Z: 0,
// bit 2: accessor to the Interrupt flag. When asserted, NES won't respond to interrupts.
I: 0,
// bit 2: accessor to the Decimal mode flag. Unused on NES.
D: 0,
// bits 4,5 don't exist
// bit 6: accessor to the Overflow flag. Asserts after an operation that resulting in overflows from bit 6 to bit 7. Overflow ~= signed positive overflow
V: 0,
// Bit 7: accessor to the Negative flag. A sign indicator for the last instruction result. 0 is positive, 1 is negative.
N: 0
};
// CPU::wrap function ensures that only the lower byte changes within a multi-byte input address.
// Effectively, this confines input addresses within the same memory page (256-byte).
CPU_wrap = function(oldaddr, newaddr){
return (oldaddr & 0xFF00) + u8(newaddr);
}
// CPU_Misfire is a wrapper for reading an address using the CPU_wrap protection above.
Misfire = function(old, addr){
q = CPU_wrap(old, addr);
if(q != addr){
RB(q);
}
}
// NOTE ON CPU STACK OPERATIONS
// This stack implementation is limited to one page of memory (256 bytes).
// While this technically means that it won't overflow, it behaves like a ring buffer and will smash itself after 256 open Pushes.
// The stack pointer always refers to the next uninitialized byte to be used.
// CPU_Pop implements the classic stack pop by using the stack pointer register as an offset in to the 2nd page of NES RAM (bytes 0x100-0x1FF).
// Pop increments the stack pointer to the last used byte and returns the value stored there.
CPU_Pop = function(){
return RB(0x100 | u8(++S));
}
// CPU_Push stores an input value at the byte pointed to by the stack pointer. It then decrements the stack pointer.
Push = function(v){
WB(0x100 | u8(S--), v);
}
// Fetch op'th item from a bitstring encoded in a data-specific variant of base64, where each character transmits 8 bits of information rather than 6.
T = function(s, code){
var o8 = op / 8,
o8m = 1 << (op % 8),
i = o8m & (s[o8] > 90
? (130 + " (),-089<>?BCFGHJLSVWZ[^hlmnxy|}"[s[o8] - 94])
: (s[o8]-" (("[s[o8] / 39]));
if(i){
eval(code);
}
}
// CPU_Ins executes the relevant procedures required for the input op code.
// An important concept buried in here is the idea that CPU instructions aggregate very low level tasks, usually following the sequence: fetch, operate, store.
// Bisqwit decomposed the 256 CPU ops in to 56 tasks you see prefixed with t(). The key is that each t() line does NOT represent a CPU operation;
// instead, each CPU operation executes multiple t() functions based on bitfield matches in augmented BASE64. Tasks are ordered roughly the same as in an actual CPU pipeline.
CPU_Ins = function(op){
// Note: op 0x100 means "NMI", 0x101 means "Reset", 0x102 means "IRQ". They are implemented as "BRK".
// Sets up the default evaluation environment for Op exeuction. These are temporary variables to hold intermediate values.
// addr = no initial address.
// d = no address offset.
// t = fully maskable operand.
// c = null backup/offset operand.
// pbits = 0x20 or 0x30.
// pbits mask the flags (P) register during certain operations. The core issue is controlling the mask of bits 4 and 5 depending on interrupt op status.
var addr = 0, d = 0, t = 0xFF, c = 0, sb = 0, pbits = op < 0x100 ? 0x30 : 0x20;
// Define the opcode decoding matrix, which decides which micro-operations constitute any particular opcode.
// Fetch op'th item from a bitstring encoded in a data-specific variant of base64, where each character transmits 8 bits of information rather than 6.
// All implemented opcodes are cycle-accurate and memory-access-accurate. Unofficial opcodes are written in [...].
// Decode address operand
T(" !", "addr = 0xFFFA") // Set address register to 0xFFFA. Used in NMI.
T(" *", "addr = 0xFFFC") // Set address register to 0xFFFC. Used by Reset
T("! ,", "addr = 0xFFFE") // Set address register to 0xFFFE. Used by IRQs
T("zy}z{y}zzy}zzy}zzy}zzy}zzy}zzy}z ", "addr = RB(PC++)") // Read next instruction in as an address
T("2 yy2 yy2 yy2 yy2 XX2 XX2 yy2 yy ", "d = X") // Set address offset register to index register X
T(" 62 62 62 62 om om 62 62 ", "d = Y") // Set address offset register to index register Y
T("2 y 2 y 2 y 2 y 2 y 2 y 2 y 2 y ", "addr=u8(addr + d); d=0; tick()") // Offset address in to the same page
T(" y z!y z y z y z y z y z y z y z ", "addr=u8(addr); addr += 256 * RB(PC++)") // Read in a page and offset in to that page (absolute)
T("3 6 2 6 2 6 286 2 6 2 6 2 6 2 6 /", "addr=RB(c = addr); addr += 256 * RB(wrap(c, c + 1))") // Read in a page and offset from that page (indirect)
T(" *Z *Z *Z *Z 6z *Z *Z ", "Misfire(addr, addr + d)") // Verify and correct address range across pages (absolute load)
T(" 4k 4k 4k 4k 6z 4k 4k ", "RB(wrap(addr, addr + d))") // Verify and correct address range across pages (absolute store)
// Load source operand
T("aa__ff__ab__,4 ____ - ____ ", "t &= A") // Mask accumulator A on to temp operand t (store)
T(" knnn 4 99 ", "t &= X") // Mask index register X on to temp operand t (store)
T(" 9989 99 ", "t &= Y") // Mask index register Y on to temp operand t (store) - sty,dey,iny,tya,cpy
T(" 4 ", "t &= S") // Mask stack pointer register S on to temp operand t (store) - tsx, las
T("!!!! !! !! !! ! !! !! !!/", "t &= P.raw | pbits; c = t") // Assert normally unused flags and backup temp operand - php, flag test/set/clear, interrupts
T("_^__dc___^__ ed__98 ", "c = t; t = 0xFF") // Copy primary operand and reset it
T("vuwvzywvvuwvvuwv zy|zzywvzywv ", "t &= RB(addr + d)") // Mask indirectly stored byte in to temp operand
T(",2 ,2 ,2 ,2 -2 -2 -2 -2 ", "t &= RB(PC++)") // Mask next instruction in to operand t (immediate)
// Operations that mogrify memory operands directly
T(" 88 ", "P.V = t & 0x40; P.N = t & 0x80") // Set overflow and sign flags from the temp result t - bit
T(" nink nnnk ", "sb = P.C") // Store the result carry bit in temporary bit sb - rol,rla, ror,rra,arr
T("nnnknnnk 0 ", "P.C = t & 0x80") // Mask the result operand t in to the carry bit - rol,rla, asl,slo,[arr,anc]
T(" nnnknink ", "P.C = t & 0x01") // Masks the least significant bit in to the carry bit - lsr,sre, ror,rra,asr
T("ninknink ", "t = (t << 1) | (sb * 0x01)") // Left shifts temp operand and retains stored carry bit
T(" nnnknnnk ", "t = (t >> 1) | (sb * 0x80)") // Right shifts temp operand and retains stored carry bit
T(" ! kink ", "t = u8(t - 1)") // Decrement temporary operand - dec,dex,dey,dcp
T(" ! khnk ", "t = u8(t + 1)") // Increment temporary operand - inc,inx,iny,isb
// Store modified value (memory)
T("kgnkkgnkkgnkkgnkzy|J kgnkkgnk ", "WB(addr + d, t)") // Write the temporary operand to memory (indirect)
T(" q ", "WB(wrap(addr, addr+d), t &= ((addr + d) >> 8))") // Write temporary operand to memory across pages, like a 'Far' memory operation without actual segmentation - [shx,shy,shs,sha?]
// Some operations used up one clock cycle that we did not account for yet
T("rpstljstqjstrjst - - - -kjstkjst/", "tick()") // Skip a cycle (NOP) - nop,flag ops,inc,dec,shifts,stack,transregister,interrupts
// Stack operations and unconditional jumps
T(" ! ! ! ", "tick(); t = Pop()") // Pop value from the stack with NOP delay - pla,plp,rti
T(" ! ! ", "RB(PC++); PC = Pop(); PC |= (Pop() << 8)") // Pop two bytes from the stack into the 16-bit program counter. Similar to x86 RET - rti,rts
T(" ! ", "RB(PC++)") // Read (and discard) the next instruction - rts
T("! ! /", "d=PC + (op ? -1 : 1); Push(d >> 8); Push(d)") // Set address offset forward or backward and pushes page and absolute address to the stack. Similar to x86 CALL - jsr, interrupts
T("! ! 8 8 /", "PC = addr") // Directly sets the program counter - jmp, jsr, interrupts
T("!! ! /", "Push(t)") // Push temp operand t to the stack - pha, php, interrupts
// Bitmasks
T("! !! !! !! !! ! !! !! !!/", "t = 1") // Set temporary operand t to 1
T(" ! ! !! !! ", "t <<= 1") // Left shift temp operand t by 1 (doubles it)
T("! ! ! !! !! ! ! !/", "t <<= 2") // Left shift temp operand t by 2 (x4)
T(" ! ! ! ! ! ", "t <<= 4") // Left shifts temp operand t by 4 (x16)
T(" ! ! ! !____ ", "t = u8(~t)") // Logically invert temp operand t - sbc, isb, clear flag
T("`^__ ! ! !/", "t = c | t") // Store logical AND between temp and backup operands - ora, slo, set flag
T(" !!dc`_ !! ! ! !! !! ! ", "t = c & t") // Stores logical OR between temp and backup operands - and, bit, rla, clear/test flag
T(" _^__ ", "t = c ^ t") // Stores logical XOR between temp and backup operands - eor, sre
// Conditional branches
T(" ! ! ! ! ", "if(t){ tick(); Misfire(PC, addr = s8(addr) + PC); PC = addr }") // Jump to a checked offset address based on t
T(" ! ! ! ! ", "if(!t){ tick(); Misfire(PC, addr = s8(addr) + PC); PC = addr }") // Jumps to a checked offset address based on !t
// Addition and subtraction
T(" _^__ ____ ", "c = t; t += A + P.C; P.V = (c ^ t) & (A ^ t) & 0x80; P.C = t & 0x100") // Save operand t and add (subtract) last A with Carry. Checks for overflow and recalculates carry.
T(" ed__98 ", "t = c - t; P.C = ~t & 0x100") // Compare t and c operands via subtraction (same means t == 0) Carry bit is set to inverse of t allowing the user to identify which operand is larger - cmp,cpx,cpy, dcp, sbx
// Store modified value (register)
T("aa__aa__aa__ab__ 4 !____ ____ ", "A = t") // Set accumulator (A) to operand t result
T(" nnnn 4 ! ", "X = t") // Set index register (X) to operand t result - ldx, dex, tax, inx, tsx,lax,las,sbx
T(" ! 9988 ! ", "Y = t") // Set index register (Y) to operand t result - ldy, dey, tay, iny
T(" 4 0 ", "S = t") // Set stack pointer (S) to operand t result - txs, las, shs
T("! ! ! !! ! ! ! ! !/", "P.raw = t & ~0x30") // Directly set the processor flags register ignoring the unused 4th and 5th bits - plp, rti, flag set/clear
// Generic status flag updates
T("wwwvwwwvwwwvwxwv 5 !}}||{}wv{{wv ", "P.N = t & 0x80") // Update flags negative bit to match result sign bit
T("wwwv||wvwwwvwxwv 5 !}}||{}wv{{wv ", "P.Z = u8(t) == 0") // Update flags for zero result
T(" 0 ", "P.V = (((t >> 5)+1)&2)") // Update flags overflow bit by testing if incrementing 6th bit asserts 7th - [arr]
}
// CPU_Op is essentially the "game loop" of the emulator. It is called repeatedly until the emulator is closed/killed.
// It determines the next instruction (either interrupt or NES rom), and calls the appropriate function pointer.
CPU_Op = function(){
// Update the current state of non-maskable interrupts
nmi_now = nmi;
// Read in the next operation based on the program counter. Iterate PC for the next cycle.
op = RB(PC++);
console.log(PC, op);
// If reset is set, override the op code
if(reset){
op = 0x101;
}
// Overrides next op code if a non-maskable interrupt is detected. This is commonly associated with vertical blanking in the PPU.
// If this the first nmi cycle, then nmi_edge_detected is set.
else if(nmi_now && !nmi_edge_detected){
op = 0x100;
nmi_edge_detected = true;
}
// Regular interrupts also override the op code
else if(intr && !P.I){
op = 0x102;
}
// If no NMI is active unset the nmi_edge flag
if(!nmi_now){
nmi_edge_detected = false;
}
// Call the function pointed to by 'op' from the function table constructed above.
//CPU_Ins[op]();
CPU_Ins(op);
// Unset the reset flag in preparation for the next cycle. There is currently no way for reset to be asserted after the first cycle. Normally the physical NES reset button would trigger this. Now, CPU is initialized with reset asserted.
reset = false;
} |
/*****************************************************
* 时间:2016-04-23 22:07:36
* 作者:zhongxia
*
* 操作数据的一些相关方法
* 提供的方法:
* 1. getItemByKeyAndValue 根据key 和 value 或者 对象数组的中某个对象
* 2. setItemByKeyAndValue 根据key 和 value 设置 对象数组中的某个对象
* 3. prevOrNextItem 根据 排序的字段key 和当前的下标,指定向前或者先后移动几位
* 4. clone 深克隆一个数据对象
*****************************************************/
window.ArrayUtil = (function () {
/**
* 根据key 和值获取数组中的 匹配的第一项数据
* @param {[type]} arr [description]
* @param {[type]} key [description]
* @param {[type]} value [description]
* @return {[type]} [description]
*/
function getItemByKeyAndValue(arr, key, value) {
for (var i = 0; i < arr.length; i++) {
if (arr[i][key] === value) {
return arr[i];
}
}
}
/**
* 根据 key 和 旧的value ,给数组中的某一个对象设置新值,整个替换
* @param {[type]} arr [description]
* @param {[type]} key [description]
* @param {[type]} oldValue [description]
* @param {[type]} newValue [description]
*/
function setItemByKeyAndValue(arr, key, oldValue, newObj) {
for (var i = 0; i < arr.length; i++) {
if (arr[i][key] === oldValue) {
return arr[i] = newObj;
}
}
;
}
/**
* 向前移动,或者向后移动一位
* @param {[type]} arr [description]
* @param {[type]} key [description]
* @param {[type]} index [description]
* @param {[type]} nextCount [description]
* @return {[type]} [description]
*/
function prevOrNextItem(arr, key, index, nextCount) {
var currentItem = getItemByKeyAndValue(arr, key, index);
var item = getItemByKeyAndValue(arr, key, index + nextCount);
if (item) {
var temp = currentItem[key];
currentItem[key] = index + nextCount;
item[key] = temp;
}
}
/**
* 深复制
* @param {[type]} arr [description]
* @return {[type]} [description]
*/
function clone(arr) {
var arr_bak = [];
for (var i = 0; i < arr.length; i++) {
arr_bak.push(arr[i]);
}
return arr_bak;
}
/**
* 数组中的某一项,向前移动一位
* @param {[type]} arr [description]
* @param {[type]} index [description]
* @param {[type]} key [description]
* @return {[type]} [description]
*/
function prevItem(arr, key, index) {
prevOrNextItem(arr, key, index, -1)
}
/**
* 数组中的某一项,向前移动一位
* @param {[type]} arr [description]
* @param {[type]} index [description]
* @param {[type]} key [description]
* @return {[type]} [description]
*/
function nextItem(arr, key, index) {
prevOrNextItem(arr, key, index, 1)
}
/**
* 数组对象 根据指定字段排序
* @param {[type]} arr [description]
* @param {[type]} key [description]
* @return {[type]} [description]
*/
function sortByKey(arr, key) {
arr.sort(function (x, y) {
if (typeof(x[key]) === "string") {
return parseInt(x[key]) > parseInt(y[key]) ? 1 : -1;
}
return x[key] > y[key] ? 1 : -1;
});
}
return {
getItemByKeyAndValue: getItemByKeyAndValue,
setItemByKeyAndValue: setItemByKeyAndValue,
prevItem: prevItem,
nextItem: nextItem,
sortByKey: sortByKey,
clone: clone
}
})();
|
let CSRF = $('meta[name="csrf-token"]').attr('content');
let uploadImages = [];
let uploadIndex = 0;
let ALLOW_MIME = ['image/png'];
function selectFolder(element) {
clearInput();
let input = $(element)
.closest('#app')
.find('#dirLoader');
input.click();
input
.unbind()
.on('change', async function (e) {
let files = e.target.files;
await Array.prototype.forEach.call(files, function (file) {
let mimeType = file.type;
let fileName = file.name.split('.').shift();
if (ALLOW_MIME.indexOf(mimeType) !== -1) {
uploadImages.push(file);
}
});
if (!uploadImages.length) {
let input = $('#dirLoader');
input
.closest('.form-group')
.find('.form-text')
.empty()
.text('No png images was found in folder!');
return;
}
let file = uploadImages[uploadIndex];
processUploadSingleFile(file);
})
}
function processUploadSingleFile(file) {
$('#loading').show();
if (typeof file != "undefined") {
let direction = $('[name="direction"]:checked').val();
let data = new FormData();
data.append('image', file);
data.append('_token', CSRF);
data.append('direction', direction);
$.ajax({
type: 'post',
url: '/tool-image',
data: data,
processData: false,
contentType: false,
success: function (res) {
$('#loading').hide();
uploadIndex ++;
let file = uploadImages[uploadIndex];
processUploadSingleFile(file);
}, error: function (xhr, statusText, errorThrown) {
$('#loading').hide();
}
});
} else {
$('#loading').hide();
}
}
function clearInput() {
let input = $('#dirLoader');
input.val('');
input
.closest('.form-group')
.find('.form-text')
.empty();
}
|
import {Link} from 'react-router-dom';
import $ from 'jquery';
import DataStore from 'flux/stores/DataStore.js';
import SubLinks from './SubLinks.js'
import AboutSide from './AboutSide.js';
function isEmpty(myObject) {
for(var key in myObject) {
if (myObject.hasOwnProperty(key)) {
return false;
}
}
return true;
}
class Header extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.vars = {ticking: false};
this.state = { visibility : 'hidden' };
}
render() {
let headerMenu = DataStore.getMenuBySlug('menu');
headerMenu = _.sortBy(headerMenu, [function(page) { return page.menu_order; }]);
let home = DataStore.getPageBySlug('home');
let logo = home.logo_image_url[0];
return (
<div id="header" className="header">
<img src={logo} height='40px' ref="logo_header" style={{ visibility: `${this.state.visibility}`}}/>
<ul>
<li><Link to="/" style={{marginRight: '10px'}} >Home</Link></li>
{headerMenu.map((page) => {
if(page.slug != 'home' && page.slug){
let classer1 = (!Array.isArray(page.children)) ? 'page-port ' : '';
let classer2 = (page.slug === "portfolio" || page.slug === "about") ? 'deactivate ' + page.slug : '';
let slug = page.slug
return(
<li key={`nav-page-id-${page.id}`} className={classer1}><Link
key={`nav-page-id-${page.id}`}
to={`/${page.slug}`}
style={{marginRight: '10px'}}
className={classer2}
>
{page.title}
</Link>
{ !isEmpty(page.children) && <SubLinks items={page.children}/> }
</li>
)
}
})}
</ul>
<AboutSide />
</div>
);
}
componentDidMount() {
let comp = document.getElementsByClassName('deactivate');
for (var i = 0; i < comp.length; i++) {
comp[i].addEventListener('click', this.handleClick, false);
}
// window.addEventListener('scroll', this.handleScroll, false);
}
componentWillUnmount() {
let comp = document.getElementsByClassName('deactivate');
for (var i = 0; i < comp.length; i++) {
comp[i].removeEventListener('click', this.handleClick);
}
//window.removeEventListener('scroll', this.handleScroll);
}
handleClick(event) {
event.preventDefault();
event.stopPropagation();
if(event.target.classList.contains("about")){
$("#about").toggleClass("active");
$(event.target).toggleClass("active");
}
}
}
export default Header; |
import React from 'react'
export default class SoundCloud extends React.Component {
render() {
const autoPlay = false;
const color = '4b2c20'
return(
<iframe
height="600"
scrolling="no"
allow="autoplay"
src={`https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/1020652654&auto_play=${autoPlay}&hide_related=true&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=false&color=${color}`}/>
)
}
} |
'use strict';
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ItemSchema = new Schema({
name:{
type: String,
required: "please kindly enter the name for item"
},
itemType:{
type: String
},
itemDescription:{
type: String
},
itemURL:{
type: String
},
brand:{
type: String
},
imgURL:{
type: String,
default: "http://via.placeholder.com/350x350"
},
sale:{
type: Boolean
},
price:{
type: Number
},
createdAt:{
type: Date,
default: new Date
}
})
module.exports = mongoose.model ('Items', ItemSchema); |
import React from 'react';
import { filterAttribsForReact } from '../../../react-utilities';
import { componentMap } from '../block-component-maps/component-map';
import Html from '../Html';
export const defaultBlocksFromData = (data) =>
data.map(({ attribs, data, name }, i) => {
const Block = componentMap(name) ?? Html;
const filteredAttribs = filterAttribsForReact(attribs);
return <Block key={i} attribs={filteredAttribs} data={data} />;
});
|
WAF.onAfterInit = function onAfterInit() {// @lock
// @region namespaceDeclaration// @startlock
var button_Save = {}; // @button
// @endregion// @endlock
// eventHandlers// @lock
button_Save.click = function button_Save_click (event)// @startlock
{// @endlock
sources.content.save();
};// @lock
// @region eventManager// @startlock
WAF.addListener("button_Save", "click", button_Save.click, "WAF");
// @endregion
};// @endlock
|
define({
'title': '欢迎页'
}); |
import Microcastle from '../../index.js';
import ItemFrame from '../ItemFrame.js';
import thunk from 'redux-thunk';
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import I from 'immutable';
describe('Part Editor', () => {
const reducer = combineReducers({
microcastle: Microcastle.MicrocastleStore.reducer,
});
const store = createStore(reducer, {
microcastle: I.fromJS({
data: {
news: {'brexit': {tags: ['pain', 'suffering', 'racism']}}
},
editor: {},
}),
}, applyMiddleware(thunk));
const schema = {
news: {
onEdit: sinon.spy(f => new Promise(r => r(f))),
attributes: {
tags: { type: 'array', subtype: {type: 'text'} },
}
}
};
it('Should display correct name in ItemFrame', () => {
const rendered = mount(
<Provider store={store}>
<div>
<Microcastle.MicrocastleEditor schemas={schema} />
<Microcastle.Button.EditPart visible={true} schema='news' entry="brexit" attribute="tags" part={[1]} />
</div>
</Provider>
);
rendered.find(Microcastle.Button.EditPart).simulate('click');
expect(rendered.find(ItemFrame).findWhere((s) => s.prop('title') == 'tags').length).to.equal(1);
});
it('Should be able to change part', async () => {
const rendered = mount(
<Provider store={store}>
<div>
<Microcastle.MicrocastleEditor schemas={schema} />
<Microcastle.Button.EditPart visible={true} schema='news' entry="brexit" attribute="tags" part={[1]} />
</div>
</Provider>
);
rendered.find(Microcastle.Button.EditPart).simulate('click');
rendered.find('textarea').at(0).simulate('change', {target: {value: 'dispair'}});
rendered.find('.microcastle-editor-save').at(0).simulate('click');
await new Promise(r => setImmediate(r));
await expect(schema.news.onEdit).to.have.been.calledOnce;
await expect(store.getState().microcastle.getIn(['data', 'news', 'brexit', 'tags', 1])).to.equal('dispair');
});
});
|
const ccra = require('customize-cra');
module.exports = ccra.override(
// ccra.useEslintRc(),
ccra.useBabelRc(),
ccra.addDecoratorsLegacy(),
// ccra.fixBabelImports('antd', { libraryDirectory: 'es', style: 'css' }),
ccra.fixBabelImports('antd', { libraryDirectory: 'es', style: true }), // If need customize style
ccra.addLessLoader({
modifyVars: {},
javascriptEnabled: true
})
);
|
// @flow
import React, { Component } from "react";
import { connect } from "react-redux";
import Layout from "components/mainLayout";
import Link from "components/Link";
import "./styles.scss";
type HomePageProps = {
user: Object,
};
class HomePage extends Component<HomePageProps> {
render() {
const {
user: { role },
} = this.props;
return (
<Layout>
<div className="main-page">
<div className="main-page-links">
{role === "Admin" && (
<Link to={"admin/users"}>
<div className="main-page-links-item">Admin Management</div>
</Link>
)}
{(role === "Admin" || role === "Store Keeper") && (
<Link to={"product/create"}>
<div className="main-page-links-item">Stock Management</div>
</Link>
)}
{(role === "Admin" ||
role === "Store Keeper" ||
role === "Cashier") && (
<Link to={"cashier"}>
<div className="main-page-links-item">Cashier Management</div>
</Link>
)}
</div>
</div>
</Layout>
);
}
}
function mapStateToProps(state) {
return {
user: state.auth.user,
};
}
const Actions = {};
export default connect(mapStateToProps, Actions)(HomePage);
|
i18nUtil = {};
i18nUtil.setup = function(/*Object*/kwArgs){
//summary: loads dojo so we can use it for i18n bundle flattening.
//Do the setup only if it has not already been done before.
if(typeof djConfig == "undefined" || !(typeof dojo != "undefined" && dojo["i18n"])){
djConfig={
locale: 'xx',
extraLocale: kwArgs.localeList,
baseUrl: "../../dojo/"
};
load('../../dojo/dojo.js');
//Now set baseUrl so it is current directory, since all the prefixes
//will be relative to the release dir from this directory.
dojo.baseUrl = "./";
//Also be sure we register the right paths for module prefixes.
buildUtil.configPrefixes(kwArgs.profileProperties.dependencies.prefixes);
dojo.require("dojo.i18n");
}
}
i18nUtil.flattenLayerFileBundles = function(/*String*/fileName, /*String*/fileContents, /*Object*/kwArgs){
//summary:
// This little utility is invoked by the build to flatten all of the JSON resource bundles used
// by dojo.requireLocalization(), much like the main build itself, to optimize so that multiple
// web hits will not be necessary to load these resources. Normally, a request for a particular
// bundle in a locale like "en-us" would result in three web hits: one looking for en_us/ another
// for en/ and another for ROOT/. All of this multiplied by the number of bundles used can result
// in a lot of web hits and latency. This script uses Dojo to actually load the resources into
// memory, then flatten the object and spit it out using dojo.toJson. The bootstrap
// will be modified to download exactly one of these files, whichever is closest to the user's
// locale.
//fileName:
// The name of the file to process (like dojo.js). This function will use
// it to determine the best resource name to give the flattened bundle.
//fileContents:
// The contents of the file to process (like dojo.js). This function will look in
// the contents for dojo.requireLocation() calls.
//kwArgs:
// The build's kwArgs.
var destDirName = fileName.replace(/\/[^\/]+$/, "/") + "nls";
var nlsNamePrefix = fileName.replace(/\.js$/, "");
nlsNamePrefix = nlsNamePrefix.substring(nlsNamePrefix.lastIndexOf("/") + 1, nlsNamePrefix.length);
i18nUtil.setup(kwArgs);
var djLoadedBundles = [];
//TODO: register plain function handler (output source) in jsonRegistry?
var drl = dojo.requireLocalization;
dojo.requireLocalization = function(modulename, bundlename, locale){
drl(modulename, bundlename, locale);
//TODO: avoid dups?
djLoadedBundles.push({modulename: modulename, module: eval(modulename), bundlename: bundlename});
};
var requireStatements = fileContents.match(/dojo\.requireLocalization\(.*\)\;/g);
if(requireStatements){
eval(requireStatements.join(";"));
//print("loaded bundles: "+djLoadedBundles.length);
var djBundlesByLocale = {};
var jsLocale, entry, bundle;
for (var i = 0; i < djLoadedBundles.length; i++){
entry = djLoadedBundles[i];
bundle = entry.module.nls[entry.bundlename];
for (jsLocale in bundle){
if (!djBundlesByLocale[jsLocale]){djBundlesByLocale[jsLocale]=[];}
djBundlesByLocale[jsLocale].push(entry);
}
}
localeList = [];
//Save flattened bundles used by dojo.js.
var mkdir = false;
var dir = new java.io.File(destDirName);
var modulePrefix = buildUtil.mapPathToResourceName(fileName, kwArgs.profileProperties.dependencies.prefixes);
//Adjust modulePrefix to include the nls part before the last segment.
var lastDot = modulePrefix.lastIndexOf(".");
if(lastDot != -1){
modulePrefix = modulePrefix.substring(0, lastDot + 1) + "nls." + modulePrefix.substring(lastDot + 1, modulePrefix.length);
}else{
throw "Invalid module prefix for flattened bundle: " + modulePrefix;
}
for (jsLocale in djBundlesByLocale){
var locale = jsLocale.replace(/\_/g, '-');
if(!mkdir){ dir.mkdir(); mkdir = true; }
var outFile = new java.io.File(dir, nlsNamePrefix + "_" + locale + ".js");
//Make sure we can create the final file.
var parentDir = outFile.getParentFile();
if(!parentDir.exists()){
if(!parentDir.mkdirs()){
throw "Could not create directory: " + parentDir.getAbsolutePath();
}
}
var os = new java.io.BufferedWriter(
new java.io.OutputStreamWriter(new java.io.FileOutputStream(outFile), "utf-8"));
try{
os.write("dojo.provide(\""+modulePrefix+"_"+locale+"\");");
for (var j = 0; j < djLoadedBundles.length; j++){
entry = djLoadedBundles[j];
var bundlePkg = [entry.modulename,"nls",entry.bundlename].join(".");
var translationPkg = [bundlePkg,jsLocale].join(".");
bundle = entry.module.nls[entry.bundlename];
if(bundle[jsLocale]){ //FIXME:redundant check?
os.write("dojo.provide(\""+bundlePkg+"\");");
os.write(bundlePkg+"._built=true;");
os.write("dojo.provide(\""+translationPkg+"\");");
os.write(translationPkg+"="+dojo.toJson(bundle[jsLocale])+";");
}
}
}finally{
os.close();
}
localeList.push(locale);
}
//Remove dojo.requireLocalization calls from the file.
fileContents = fileContents.replace(/dojo\.requireLocalization\(.*\)\;/g, "");
var preloadCall = '\ndojo.i18n._preloadLocalizations("' + modulePrefix + '", ' + dojo.toJson(localeList) + ');\n';
//Inject the dojo._preloadLocalizations call into the file.
//Do this at the end of the file, since we need to make sure dojo.i18n has been loaded.
//The assumption is that if dojo.i18n is not in this layer file, dojo.i18n is
//in one of the layer files this layer file depends on.
//Allow call to be inserted in the dojo.js closure, if that is in play.
i18nUtil.preloadInsertionRegExp.lastIndex = 0;
if(fileContents.match(i18nUtil.preloadInsertionRegExp)){
i18nUtil.preloadInsertionRegExp.lastIndex = 0;
fileContents = fileContents.replace(i18nUtil.preloadInsertionRegExp, preloadCall);
}else{
fileContents += preloadCall;
}
}
return fileContents; //String
}
i18nUtil.preloadInsertionRegExp = /\/\/INSERT dojo.i18n._preloadLocalizations HERE/;
i18nUtil.flattenDirBundles = function(/*String*/prefixName, /*String*/prefixDir, /*Object*/kwArgs, /*RegExp*/nlsIgnoreRegExp){
//summary: Flattens the i18n bundles inside a directory so that only request
//is needed per bundle. Does not handle resource flattening for dojo.js or
//layered build files.
i18nUtil.setup(kwArgs);
var fileList = fileUtil.getFilteredFileList(prefixDir, /\.js$/, true);
var prefixes = kwArgs.profileProperties.dependencies.prefixes;
for(var i= 0; i < fileList.length; i++){
//Use new String so we get a JS string and not a Java string.
var jsFileName = String(fileList[i]);
var fileContents = null;
//Files in nls directories, except for layer bundles that already have been processed.
if(jsFileName.match(/\/nls\//) && !jsFileName.match(nlsIgnoreRegExp)){
fileContents = "(" + i18nUtil.makeFlatBundleContents(prefixName, prefixDir, jsFileName) + ")";
}else{
fileContents = i18nUtil.modifyRequireLocalization(readText(jsFileName), prefixes);
}
if(fileContents){
fileUtil.saveUtf8File(jsFileName, fileContents);
}
}
}
i18nUtil.modifyRequireLocalization = function(/*String*/fileContents, /*Array*/prefixes){
//summary: Modifies any dojo.requireLocalization calls in the fileContents to have the
//list of supported locales as part of the call. This allows the i18n loading functions
//to only make request(s) for locales that actually exist on disk.
var dependencies = [];
//Make sure we have a JS string, and not a Java string.
fileContents = String(fileContents);
var modifiedContents = fileContents;
if(fileContents.match(buildUtil.globalRequireLocalizationRegExp)){
modifiedContents = fileContents.replace(buildUtil.globalRequireLocalizationRegExp, function(matchString){
var replacement = matchString;
var partMatches = matchString.match(buildUtil.requireLocalizationRegExp);
var depCall = partMatches[1];
var depArgs = partMatches[2];
if(depCall == "requireLocalization"){
//Need to find out what locales are available so the dojo loader
//only has to do one script request for the closest matching locale.
var reqArgs = i18nUtil.getRequireLocalizationArgsFromString(depArgs);
if(reqArgs.moduleName){
//Find the list of locales supported by looking at the path names.
var locales = i18nUtil.getLocalesForBundle(reqArgs.moduleName, reqArgs.bundleName, prefixes);
//Add the supported locales to the requireLocalization arguments.
if(!reqArgs.localeName){
depArgs += ", null";
}
depArgs += ', "' + locales.join(",") + '"';
replacement = "dojo." + depCall + "(" + depArgs + ")";
}
}
return replacement;
});
}
return modifiedContents;
}
i18nUtil.makeFlatBundleContents = function(prefix, prefixPath, srcFileName){
//summary: Given a nls file name, flatten the bundles from parent locales into the nls bundle.
var bundleParts = i18nUtil.getBundlePartsFromFileName(prefix, prefixPath, srcFileName);
if(!bundleParts){
return null;
}
var moduleName = bundleParts.moduleName;
var bundleName = bundleParts.bundleName;
var localeName = bundleParts.localeName;
dojo.requireLocalization(moduleName, bundleName, localeName);
//Get the generated, flattened bundle.
var module = dojo.getObject(moduleName);
var bundleLocale = localeName ? localeName.replace(/-/g, "_") : "ROOT";
var flattenedBundle = module.nls[bundleName][bundleLocale];
if(!flattenedBundle){
throw "Cannot create flattened bundle for src file: " + srcFileName;
}
return dojo.toJson(flattenedBundle);
}
//Given a module and bundle name, find all the supported locales.
i18nUtil.getLocalesForBundle = function(moduleName, bundleName, prefixes){
//Build a path to the bundle directory and ask for all files that match
//the bundle name.
var filePath = buildUtil.mapResourceToPath(moduleName, prefixes);
var bundleRegExp = new RegExp("nls[/]?([\\w\\-]*)/" + bundleName + ".js$");
var bundleFiles = fileUtil.getFilteredFileList(filePath + "nls/", bundleRegExp, true);
//Find the list of locales supported by looking at the path names.
var locales = [];
for(var j = 0; j < bundleFiles.length; j++){
var bundleParts = bundleFiles[j].match(bundleRegExp);
if(bundleParts && bundleParts[1]){
locales.push(bundleParts[1]);
}else{
locales.push("ROOT");
}
}
return locales;
}
i18nUtil.getRequireLocalizationArgsFromString = function(argString){
//summary: Given a string of the arguments to a dojo.requireLocalization
//call, separate the string into individual arguments.
var argResult = {
moduleName: null,
bundleName: null,
localeName: null
};
var l10nMatches = argString.split(/\,\s*/);
if(l10nMatches && l10nMatches.length > 1){
argResult.moduleName = l10nMatches[0] ? l10nMatches[0].replace(/\"/g, "") : null;
argResult.bundleName = l10nMatches[1] ? l10nMatches[1].replace(/\"/g, "") : null;
argResult.localeName = l10nMatches[2];
}
return argResult;
}
i18nUtil.getBundlePartsFromFileName = function(prefix, prefixPath, srcFileName){
//Pull off any ../ values from prefix path to make matching easier.
var prefixPath = prefixPath.replace(/\.\.\//g, "");
//Strip off the prefix path so we can find the real resource and bundle names.
var prefixStartIndex = srcFileName.lastIndexOf(prefixPath);
if(prefixStartIndex != -1){
var startIndex = prefixStartIndex + prefixPath.length;
//Need to add one if the prefiPath does not include an ending /. Otherwise,
//We'll get extra dots in our bundleName.
if(prefixPath.charAt(prefixPath.length) != "/"){
startIndex += 1;
}
srcFileName = srcFileName.substring(startIndex, srcFileName.length);
}
//var srcIndex = srcFileName.indexOf("src/");
//srcFileName = srcFileName.substring(srcIndex + 4, srcFileName.length);
var parts = srcFileName.split("/");
//Split up the srcFileName into arguments that can be used for dojo.requireLocalization()
var moduleParts = [prefix];
for(var i = 0; parts[i] != "nls"; i++){
moduleParts.push(parts[i]);
}
var moduleName = moduleParts.join(".");
if(parts[i+1].match(/\.js$/)){
var localeName = "";
var bundleName = parts[i+1];
}else{
var localeName = parts[i+1];
var bundleName = parts[i+2];
}
if(!bundleName || bundleName.indexOf(".js") == -1){
//Not a valid bundle. Could be something like a README file.
return null;
}else{
bundleName = bundleName.replace(/\.js/, "");
}
return {moduleName: moduleName, bundleName: bundleName, localeName: localeName};
}
|
import React, { useEffect, useState } from 'react';
import Sidebar from './Sidebar';
import Result from './Result';
import Table from './Table';
import './Body.scss';
import { SettingFilled } from '@ant-design/icons';
import { filterData, filterByDate, filterByPepClass, filterByMatching } from '../utils';
const Body = () => {
const defaultValue = ['All'];
const [country, setCountry] = useState(defaultValue);
const [risk, setRisk] = useState(defaultValue);
const [watchList, setWatchList] = useState(defaultValue);
const [pepClass, setPepClass] = useState(defaultValue);
const [matching, setMatching] = useState(70);
const [dateRange, setDateRange] = useState(null)
const [data, setData] = useState([]);
const [filteredData, setFilteredData] = useState([]);
useEffect(() => {
fetch(`${process.env.PUBLIC_URL}/data.json`).then(res => res.json())
.then(res => {
setData(res.data);
setFilteredData(res.data);
})
.catch(err => console.log(err))
}, []);
useEffect(() => {
const filteredByCountry = filterData(data, country, 'country');
const filteredByRiskLevel = filterData(filteredByCountry, risk, 'riskLevel');
const filteredByPepClass = filterByPepClass(filteredByRiskLevel, pepClass, 'pepClass');
setFilteredData(filterByDate(filterByMatching(filteredByPepClass, matching), dateRange));
}, [country, dateRange, risk, pepClass, matching]);
const changeStatus = (record) => {
let newData = [...filteredData];
setFilteredData(newData.reduce((acc, item) => {
if (record.key === item.key) {
return [...acc, { ...item, status: !record.status }]
}
return [...acc, item]
}, []));
}
return (
<div className='body'>
<Sidebar
fields={{ country, risk, watchList, pepClass, matching, dateRange }}
setters={{ setCountry, setRisk, setWatchList, setPepClass, setMatching, setDateRange }}
/>
<div className='body__content'>
<Result />
<div className='body__setting'>
<SettingFilled />
</div>
<Table data={filteredData} changeStatus={changeStatus} />
</div>
</div>
)
}
export default Body;
|
import React, { Component } from 'react';
import { Redirect, NavLink } from 'react-router-dom';
import { getIndex } from '../../api';
class TypeLink extends Component {
render() {
const { url, item } = this.props;
return (
<span>
<NavLink to={`${url}/${item.id}`}>{item.name}</NavLink>
</span>
);
}
}
class TypeIndex extends Component {
state = {};
loadIndex(nextType) {
const { match: { params: { type: typeStr } } } = this.props;
this.setState({ loading: true });
getIndex(nextType || typeStr)
.then(index => {
if (!index) return this.setState({ invalid: true });
this.setState({ index, loading: false });
})
.catch(() => this.setState({ loading: false }));
}
componentDidMount() {
this.loadIndex();
}
componentWillUpdate(next) {
const { match: { params: { type: current } } } = this.props;
const { match: { params: { type: nextType } } } = next;
if (current !== nextType) this.loadIndex(nextType);
}
render() {
const { invalid } = this.state;
if (invalid) {
return <Redirect to="/404" />;
}
const { loading, index } = this.state;
if (!index || loading)
return (
<section>
Loading
</section>
);
const { match: { url, params: { type } } } = this.props;
return (
<section>
<h1>{type.plural}</h1>
<ul>
{index.map(ele => (
<li key={ele.id}><TypeLink url={url} type={type} item={ele} /></li>
))}
</ul>
</section>
);
}
}
export default TypeIndex;
|
import axios from '../plugins/axios'
import Swal from 'sweetalert2'
export const state = () => ({
services: [],
carts: [],
visibles: 0,
direction: 'left'
})
export const mutations = {
fetch_services(state, payload) {
state.services = payload
},
fetch_carts(state, payload) {
state.carts = payload
},
setVisibles(state, payload) {
state.visibles = payload
},
setDirection(state, payload) {
state.direction = payload
}
}
export const actions = {
async FETCH_SERVICES ({ commit }) {
const {data} = await axios.get('/services')
commit('fetch_services', data.data)
},
async FETCH_CARTS ({commit}) {
const {data} = await axios.get('/carts')
console.log(data)
commit('fetch_carts', data.data)
},
async destroy({dispatch}, id) {
await axios.delete(`/carts/${id}`)
dispatch('FETCH_CARTS')
Swal.fire({
icon: 'success',
title: 'Deleted Successfully',
text: 'Success delete cart!'
})
},
async update({dispatch}, payload) {
await axios.put(`carts/${payload.id}`, {
title: payload.title,
description: payload.description
})
console.log(payload)
dispatch('FETCH_CARTS')
Swal.fire({
icon: 'success',
title: 'Updated Successfully',
text: 'Success update cart!'
})
},
next({commit}, payload) {
commit('setDirection', payload.dir)
commit('setVisibles', payload.counter)
},
prev({commit}, payload) {
commit('setDirection', payload.dir)
commit('setVisibles', payload.counter)
},
menuClick({commit}, payload) {
commit('setVisibles', payload)
},
async addToCart({dispatch}, payload) {
await axios.post('/carts', payload)
dispatch('FETCH_CARTS')
Swal.fire({
icon: 'success',
title: 'Added to Cart',
text: 'Success add to cart!'
})
}
} |
import "js/web.jsx";
class Config {
static const quantity = 360;
static const size = 2.0;
static const decay = 0.98;
static const gravity = 2.0;
static const speed = 6.0;
static const canvasId = "night-sky";
static const fpsElementId = "fps";
}
final class Spark {
static const rad = Math.PI * 2;
var posX : number;
var posY : number;
var velX : number;
var velY : number;
var size : number;
var color : string;
var state = 0;
function constructor(posX : number, posY : number, size : number, color : string) {
this.posX = posX;
this.posY = posY;
this.size = size;
this.color = color;
var angle = Math.random() * Spark.rad;
var velocity = Math.random() * Config.speed;
this.velX = Math.cos(angle) * velocity;
this.velY = Math.sin(angle) * velocity;
}
function _decay() : void {
this.velX *= Config.decay;
this.velY *= Config.decay;
this.size *= Config.decay;
if(this.size < 0.5 && this.state == 0) {
this.color = Firework.randomColor();
this.size = Config.size;
this.state++;
}
}
function _move() : void {
this.posX += this.velX + (Math.random() - 0.5);
this.posY += this.velY + (Math.random() - 0.5) + Config.gravity;
}
function _render(view : FireworkView) : void {
view.cx.beginPath();
view.cx.arc(this.posX, this.posY, this.size, 0, Spark.rad, true);
view.cx.fillStyle = Math.random() > 0.2 ? this.color : "white";
view.cx.fill();
}
function _isLiving(view : FireworkView) : boolean {
if(this.size <= 0.01) return false;
if(this.posX <= 0) return false;
if(this.posX >= view.width || this.posY >= view.height) return false;
return true;
}
function draw(view : FireworkView) : boolean {
this._decay();
this._move();
this._render(view);
return this._isLiving(view);
}
}
final class Firework {
var sparks = [] : Spark[];
var view : FireworkView;
static function randomColor() : string {
var blightness = 60;
var rgb = [] : int[];
for (var i = 0; i < 3; ++i) {
rgb[i] = Math.min( (Math.random() * 0xFF + blightness) as int, 255 );
}
return "rgb(" +
rgb[0] as string + "," +
rgb[1] as string + "," +
rgb[2] as string + ")";
}
function constructor(view : FireworkView, x : int, y : int) {
this.view = view;
var color = "lime";
for (var i = 0; i < Config.quantity; ++i) {
this.sparks.push(new Spark(x, y, Config.size, color));
}
}
function update() : boolean {
for(var i = 0; i < this.sparks.length; ++i) {
var s = this.sparks[i];
if (! s.draw(this.view)) {
this.sparks.splice(i, 1);
}
}
return this.sparks.length > 0;
}
}
final class FireworkView {
var cx : CanvasRenderingContext2D;
var width : int;
var height : int;
var left : int;
var top : int;
var fireworks = [] : Firework[];
var numSparks = 0;
function constructor(canvas : HTMLCanvasElement) {
this.cx = canvas.getContext("2d") as CanvasRenderingContext2D;
this.width = canvas.width;
this.height = canvas.height;
var rect = canvas.getBoundingClientRect();
this.left = rect.left;
this.top = rect.top;
canvas.addEventListener("mousedown", function (e : Event) : void {
var me = e as MouseEvent;
assert me != null;
this.explode(me.clientX, me.clientY);
});
canvas.addEventListener("touchstart", function (e : Event) : void {
var te = e as TouchEvent;
assert te != null;
this.explode(te.touches[0].pageX, te.touches[0].pageY);
});
}
function explode(x : int, y : int) : void {
this.fireworks.push(new Firework(this, x - this.left, y - this.top));
}
function update() : void {
if (this.fireworks.length == 0) {
// first one
this.explode(this.width / 2 + this.left, this.height / 3);
}
this.numSparks = 0;
for (var i = 0; i < this.fireworks.length; ++i) {
var fw = this.fireworks[i];
if(fw.update()) {
this.numSparks += fw.sparks.length;
}
else {
this.fireworks.splice(i, 1);
}
}
this.cx.fillStyle = "rgba(0, 0, 0, 0.3)";
this.cx.fillRect(0, 0, this.width, this.height);
}
}
final class FPSWatcher {
var elementId : string;
var start = Date.now();
var frameCount = 0;
function constructor(elementId : string) {
this.elementId = elementId;
}
function update(numSparks : int) : void {
++this.frameCount;
if(this.frameCount % 100 == 0) {
var message = "FPS: " + ((this.frameCount / (Date.now() - this.start) * 1000) as int) as string +
" (sparks: " + numSparks as string + ")";
dom.id(this.elementId).innerHTML = message;
}
}
}
final class _Main {
static function main(args : string[]) : void {
var canvas = dom.id(Config.canvasId) as HTMLCanvasElement;
canvas.width = Math.min(canvas.width, dom.window.innerWidth);
canvas.height = Math.min(canvas.height, dom.window.innerHeight);
var view = new FireworkView(canvas);
var watcher = new FPSWatcher(Config.fpsElementId);
dom.window.setInterval( function() : void {
view.update();
watcher.update(view.numSparks);
}, 0);
}
}
|
submitForms = function() {
//see what areas are filled in and what are not
var places = [];
var rows = document.getElementsByClassName("places-table")[0].children[0].children[0].children
for (i=3; i<(rows.length-1); i++) {
var rowElements = rows[i].children;
index = i-3;
places[index] = 0;
for (j=1; j<rowElements.length; j++) {
var schoolId = rowElements[j].children[0].value; //This will be '0' for nobody, and the school id for anyting else
if (schoolId != 0) {
places[index] += 1;
}
}
}
var sum = 0;
for (i=0; i<places.length; i++) {
sum += places[i];
}
//check to see if there are too many
if (sum>6) {
alert("You entered "+sum+" winners. Please remove some. There should only be 6.");
return;
}
//determine if ties make sense depending on how user input results
for (i=0; i<(places.length-1); i++) {
if (places[i]>1) {
for (j=i+1; j<=((i+1)+(places[i]-2)); j++) {
if (places[j] != 0) {
alert("These ties do not make sense. Try relooking at it");
return
}
}
}
}
//find button used to submit form created by rails; and click this button
button = document.getElementsByClassName('rails-btn')[0];
button.click();
} |
import { gql } from 'apollo-server-express';
export default gql`
scalar Date
type Query {
""" PAGINATION USERS ONLY ADMIN """
paginationUsers(limit:Int,offset:Int):[User]
""" TOTAL USERS FOR PAGINATION ADMIN """
totalUsers:Int
""" USER VALID """
userValid:User
"""RETURN CHAT USERS DB"""
chatUsers:[MessageChatUser]
usersOnline:[User]
}
type Mutation {
"""LOGIN USUARIO AUTHENTICATION JWT"""
loginUser(email:String!,password:String!):Token!
"""CREATION NEW USER AND ROLES API"""
newUser(user:InputUser):User
"""EDIT USER"""
editUser(user:InputUser):User
"""DELETE USER"""
deleteUser(email:String):String
"""CREATE NEW MESSAGE CHAT USER"""
newChatUser(user:InputUser,message:String):MessageChatUser
"""CLOSE SESSION USER"""
userOnlineOff(email:String):String
}
type Subscription {
"""SUBSCRIPTION CHAT USERS"""
subChatUsers:MessageChatUser
"""SUBSCRIPTION USER ONLINE"""
subUsersOnline:UserOnline
"""SUBSCRIPTION USER PROFILE"""
subUserProfile:User
}
type User {
state:Boolean
message:String
id:Int
name:String
lastname:String
email:String
imageUrl:String
roles:[Rol]
mode:String
online:Boolean
}
type UserOnline {
update:Boolean
deleted:Boolean
user:[User]
}
type Rol {
name:String
checked:Boolean
description:String
}
type Token {
token:String
email:String
}
type MessageChatUser {
new:Boolean
message:String
user:User
date:Date
}
input InputRolUser {
name:String
checked:Boolean
}
input InputUser {
name:String
lastname:String
email:String
password:String
imageUrl:String
roles:[InputRolUser]
file:Upload
mode:String
}
` ; |
// CAROUSEL OBJECT
var b=0;
function Carousel(option,carouselId) {
if (typeof option === 'undefined' || option === null) {
this.option= {showIndicator : true, cycle : false, animation : "rotateIn",interval:2000,buttons:"hidden"};
// alert('user not defined option field');
}
else{
this.options=option;
}
this.carouselId=carouselId;
this.container = document.getElementById(this.carouselId);
this.slides = this.container.querySelectorAll('.carousel');
this.indicators=this.container.querySelectorAll('.indicator');
this.total = this.slides.length - 1;
this.current = 0;
this.slide(this.current);
this.ind=document.getElementById('indicators');
this.nextBtn=document.getElementById('next');
this.prevBtn=document.getElementById('prev');
this.indicatorCheck();
this.btnCheck();
this.checkInterval();
}
Carousel.prototype.btnCheck=function(){
if(this.options.buttons==='show')
{
// alert('here');
var _this = this
var nextBtn = document.createElement("input");
nextBtn.type = "button";
nextBtn.className="next"
nextBtn.value = "next";
nextBtn.addEventListener("click", function() {
_this.next();
});
this.nextBtn=this.container.appendChild(nextBtn);
var prevBtn=document.createElement('input');
prevBtn.type="button";
prevBtn.className="prev";
prevBtn.value="Prev";
prevBtn.addEventListener("click",function(){
_this.prev();
});
this.prevBtn=this.container.appendChild(prevBtn);
// this.container.style.backgroundColor="red";
}else{
this.container.removeChild(this.nextBtn);
this.container.removeChild(this.prevBtn);
}
}
Carousel.prototype.indicatorCheck = function ()
{
var indicatorClass="indicator";
var indicatorId="indicators";
var classOfIndicator=indicatorClass+b;
var idOfIndicator=indicatorId+b;
if(this.options.showIndicator===false){
this.container.removeChild(this.ind);
}
else{
var _this = this;
var indicatorDiv=document.createElement('div');
indicatorDiv.id=idOfIndicator;
this.ind=this.container.appendChild(indicatorDiv);
for(var i=0;i<=this.total;i++){
x=document.createElement('INPUT');
x.setAttribute("class",classOfIndicator);
x.setAttribute("type", "radio");
x.setAttribute("name", b);
x.addEventListener("click", function() {
_this.indicates();
});
this.ind.appendChild(x);
this.indicators=this.container.querySelectorAll('.'+classOfIndicator);
document.getElementById(idOfIndicator).style.position="absolute";
document.getElementById(idOfIndicator).style.left="450px";
document.getElementById(idOfIndicator).style.top="330px";
}
this.indicate();
b+=1;
}
}
Carousel.prototype.indicates=function(){
for(var s=0;s<=this.total;s++)
{
if(this.indicators[s].checked===true){
this.current=s;
this.slide(this.current);
}
}
}
Carousel.prototype.indicate=function()
{
for(var s=0;s<=this.total;s++)
{
if(s===this.current){
this.indicators[s].checked=true;
}
else{
this.indicators[s].checked=false;
}
}
}
Carousel.prototype.checkInterval=function(){
if(this.options.cycle===true && this.options.interval!=null){
var t = this;
setInterval(function(){t.next();}, t.options.interval);
}
}
// NEXT
Carousel.prototype.next = function () {
var t=this;
(t.current === t.total) ? t.current = 0: t.current += 1;
t.slide(t.current);
t.indicate();
};
// PREVIOUS
Carousel.prototype.prev = function (interval) {
(this.current === 0) ? this.current = this.total : this.current -= 1;
this.slide(this.current);
this.indicate();
if(typeof interval === 'number' && (interval % 1) === 0) {
var context = this;
this.run = setTimeout(function() {
context.prev(interval);
}, interval);
}
};
// SELECT SLIDE
Carousel.prototype.slide = function (index) {
if (index >= 0 && index <= this.total) {
for (var s = 0; s <= this.total; s++) {
if (s === index) {
this.slides[s].style.animation=this.options.animation+" 2s";
this.slides[s].style.display = "inline-block";
} else {
this.slides[s].style.display = 'none';
}
}
} else {
alert("Index " + index + " doesn't exist" + this.total);
}
};
|
import { Debug } from '../../core/debug.js';
import { Color } from '../../core/math/color.js';
import { math } from '../../core/math/math.js';
import { Vec2 } from '../../core/math/vec2.js';
import { ShaderProcessorOptions } from '../../platform/graphics/shader-processor-options.js';
import {
CUBEPROJ_BOX, CUBEPROJ_NONE,
DETAILMODE_MUL,
FRESNEL_SCHLICK,
SHADER_DEPTH, SHADER_PICK,
SPECOCC_AO,
SPECULAR_BLINN, SPECULAR_PHONG
} from '../constants.js';
import { ShaderPass } from '../shader-pass.js';
import { EnvLighting } from '../graphics/env-lighting.js';
import { getProgramLibrary } from '../shader-lib/get-program-library.js';
import { _matTex2D, standard } from '../shader-lib/programs/standard.js';
import { Material } from './material.js';
import { StandardMaterialOptionsBuilder } from './standard-material-options-builder.js';
import { standardMaterialCubemapParameters, standardMaterialTextureParameters } from './standard-material-parameters.js';
// properties that get created on a standard material
const _props = {};
// special uniform functions on a standard material
const _uniforms = {};
// temporary set of params
let _params = new Set();
/**
* Callback used by {@link StandardMaterial#onUpdateShader}.
*
* @callback UpdateShaderCallback
* @param {import('./standard-material-options.js').StandardMaterialOptions} options - An object with shader generator settings (based on current
* material and scene properties), that you can change and then return. Properties of the object passed
* into this function are documented in {@link StandardMaterial}. Also contains a member named litOptions
* which holds some of the options only used by the lit shader backend {@link LitShaderOptions}.
* @returns {import('./standard-material-options.js').StandardMaterialOptions} Returned settings will be used by the shader.
*/
/**
* A Standard material is the main, general purpose material that is most often used for rendering.
* It can approximate a wide variety of surface types and can simulate dynamic reflected light.
* Most maps can use 3 types of input values in any combination: constant (color or number), mesh
* vertex colors and a texture. All enabled inputs are multiplied together.
*
* @property {Color} ambient The ambient color of the material. This color value is 3-component
* (RGB), where each component is between 0 and 1.
* @property {Color} diffuse The diffuse color of the material. This color value is 3-component
* (RGB), where each component is between 0 and 1. Defines basic surface color (aka albedo).
* @property {boolean} diffuseTint Multiply main (primary) diffuse map and/or diffuse vertex color
* by the constant diffuse value.
* @property {import('../../platform/graphics/texture.js').Texture|null} diffuseMap The main
* (primary) diffuse map of the material (default is null).
* @property {number} diffuseMapUv Main (primary) diffuse map UV channel.
* @property {Vec2} diffuseMapTiling Controls the 2D tiling of the main (primary) diffuse map.
* @property {Vec2} diffuseMapOffset Controls the 2D offset of the main (primary) diffuse map. Each
* component is between 0 and 1.
* @property {number} diffuseMapRotation Controls the 2D rotation (in degrees) of the main
* (primary) diffuse map.
* @property {string} diffuseMapChannel Color channels of the main (primary) diffuse map to use.
* Can be "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} diffuseVertexColor Use mesh vertex colors for diffuse. If diffuseMap or are
* diffuseTint are set, they'll be multiplied by vertex colors.
* @property {string} diffuseVertexColorChannel Vertex color channels to use for diffuse. Can be
* "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {import('../../platform/graphics/texture.js').Texture|null} diffuseDetailMap The
* detail (secondary) diffuse map of the material (default is null). Will only be used if main
* (primary) diffuse map is non-null.
* @property {number} diffuseDetailMapUv Detail (secondary) diffuse map UV channel.
* @property {Vec2} diffuseDetailMapTiling Controls the 2D tiling of the detail (secondary) diffuse
* map.
* @property {Vec2} diffuseDetailMapOffset Controls the 2D offset of the detail (secondary) diffuse
* map. Each component is between 0 and 1.
* @property {number} diffuseDetailMapRotation Controls the 2D rotation (in degrees) of the main
* (secondary) diffuse map.
* @property {string} diffuseDetailMapChannel Color channels of the detail (secondary) diffuse map
* to use. Can be "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {string} diffuseDetailMode Determines how the main (primary) and detail (secondary)
* diffuse maps are blended together. Can be:
*
* - {@link DETAILMODE_MUL}: Multiply together the primary and secondary colors.
* - {@link DETAILMODE_ADD}: Add together the primary and secondary colors.
* - {@link DETAILMODE_SCREEN}: Softer version of {@link DETAILMODE_ADD}.
* - {@link DETAILMODE_OVERLAY}: Multiplies or screens the colors, depending on the primary color.
* - {@link DETAILMODE_MIN}: Select whichever of the primary and secondary colors is darker,
* component-wise.
* - {@link DETAILMODE_MAX}: Select whichever of the primary and secondary colors is lighter,
* component-wise.
*
* Defaults to {@link DETAILMODE_MUL}.
* @property {Color} specular The specular color of the material. This color value is 3-component
* (RGB), where each component is between 0 and 1. Defines surface reflection/specular color.
* Affects specular intensity and tint.
* @property {boolean} specularTint Multiply specular map and/or specular vertex color by the
* constant specular value.
* @property {import('../../platform/graphics/texture.js').Texture|null} specularMap The specular
* map of the material (default is null).
* @property {number} specularMapUv Specular map UV channel.
* @property {Vec2} specularMapTiling Controls the 2D tiling of the specular map.
* @property {Vec2} specularMapOffset Controls the 2D offset of the specular map. Each component is
* between 0 and 1.
* @property {number} specularMapRotation Controls the 2D rotation (in degrees) of the specular map.
* @property {string} specularMapChannel Color channels of the specular map to use. Can be "r", "g",
* "b", "a", "rgb" or any swizzled combination.
* @property {boolean} specularVertexColor Use mesh vertex colors for specular. If specularMap or
* are specularTint are set, they'll be multiplied by vertex colors.
* @property {string} specularVertexColorChannel Vertex color channels to use for specular. Can be
* @property {boolean} specularityFactorTint Multiply specularity factor map and/or specular vertex color by the
* constant specular value.
* "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {number} specularityFactor The factor of specular intensity, used to weight the fresnel and specularity. Default is 1.0.
* @property {import('../../platform/graphics/texture.js').Texture|null} specularityFactorMap The
* factor of specularity as a texture (default is null).
* @property {number} specularityFactorMapUv Specularity factor map UV channel.
* @property {Vec2} specularityFactorMapTiling Controls the 2D tiling of the specularity factor map.
* @property {Vec2} specularityFactorMapOffset Controls the 2D offset of the specularity factor map. Each component is
* between 0 and 1.
* @property {number} specularityFactorMapRotation Controls the 2D rotation (in degrees) of the specularity factor map.
* @property {string} specularityFactorMapChannel The channel used by the specularity factor texture to sample from (default is 'a').
* @property {boolean} specularityFactorVertexColor Use mesh vertex colors for specularity factor. If specularityFactorMap or
* are specularityFactorTint are set, they'll be multiplied by vertex colors.
* @property {string} specularityFactorVertexColorChannel Vertex color channels to use for specularity factor. Can be
* "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} enableGGXSpecular Enables GGX specular. Also enables
* {@link StandardMaterial#anisotropy} parameter to set material anisotropy.
* @property {number} anisotropy Defines amount of anisotropy. Requires
* {@link StandardMaterial#enableGGXSpecular} is set to true.
*
* - When anisotropy == 0, specular is isotropic.
* - When anisotropy < 0, anisotropy direction aligns with the tangent, and specular anisotropy
* increases as the anisotropy value decreases to minimum of -1.
* - When anisotropy > 0, anisotropy direction aligns with the bi-normal, and specular anisotropy
* increases as anisotropy value increases to maximum of 1.
*
* @property {number} clearCoat Defines intensity of clearcoat layer from 0 to 1. Clearcoat layer
* is disabled when clearCoat == 0. Default value is 0 (disabled).
* @property {import('../../platform/graphics/texture.js').Texture|null} clearCoatMap Monochrome
* clearcoat intensity map (default is null). If specified, will be multiplied by normalized
* 'clearCoat' value and/or vertex colors.
* @property {number} clearCoatMapUv Clearcoat intensity map UV channel.
* @property {Vec2} clearCoatMapTiling Controls the 2D tiling of the clearcoat intensity map.
* @property {Vec2} clearCoatMapOffset Controls the 2D offset of the clearcoat intensity map. Each
* component is between 0 and 1.
* @property {number} clearCoatMapRotation Controls the 2D rotation (in degrees) of the clearcoat
* intensity map.
* @property {string} clearCoatMapChannel Color channel of the clearcoat intensity map to use. Can
* be "r", "g", "b" or "a".
* @property {boolean} clearCoatVertexColor Use mesh vertex colors for clearcoat intensity. If
* clearCoatMap is set, it'll be multiplied by vertex colors.
* @property {string} clearCoatVertexColorChannel Vertex color channel to use for clearcoat
* intensity. Can be "r", "g", "b" or "a".
* @property {number} clearCoatGloss Defines the clearcoat glossiness of the clearcoat layer
* from 0 (rough) to 1 (mirror).
* @property {boolean} clearCoatGlossInvert Invert the clearcoat gloss component (default is false).
* Enabling this flag results in material treating the clear coat gloss members as roughness.
* @property {import('../../platform/graphics/texture.js').Texture|null} clearCoatGlossMap Monochrome
* clearcoat glossiness map (default is null). If specified, will be multiplied by normalized
* 'clearCoatGloss' value and/or vertex colors.
* @property {number} clearCoatGlossMapUv Clearcoat gloss map UV channel.
* @property {Vec2} clearCoatGlossMapTiling Controls the 2D tiling of the clearcoat gloss map.
* @property {Vec2} clearCoatGlossMapOffset Controls the 2D offset of the clearcoat gloss map.
* Each component is between 0 and 1.
* @property {number} clearCoatGlossMapRotation Controls the 2D rotation (in degrees) of the clear
* coat gloss map.
* @property {string} clearCoatGlossMapChannel Color channel of the clearcoat gloss map to use.
* Can be "r", "g", "b" or "a".
* @property {boolean} clearCoatGlossVertexColor Use mesh vertex colors for clearcoat glossiness.
* If clearCoatGlossMap is set, it'll be multiplied by vertex colors.
* @property {string} clearCoatGlossVertexColorChannel Vertex color channel to use for clearcoat
* glossiness. Can be "r", "g", "b" or "a".
* @property {import('../../platform/graphics/texture.js').Texture|null} clearCoatNormalMap The
* clearcoat normal map of the material (default is null). The texture must contains normalized,
* tangent space normals.
* @property {number} clearCoatNormalMapUv Clearcoat normal map UV channel.
* @property {Vec2} clearCoatNormalMapTiling Controls the 2D tiling of the main clearcoat normal
* map.
* @property {Vec2} clearCoatNormalMapOffset Controls the 2D offset of the main clearcoat normal
* map. Each component is between 0 and 1.
* @property {number} clearCoatNormalMapRotation Controls the 2D rotation (in degrees) of the main
* clearcoat map.
* @property {number} clearCoatBumpiness The bumpiness of the clearcoat layer. This value scales
* the assigned main clearcoat normal map. It should be normally between 0 (no bump mapping) and 1
* (full bump mapping), but can be set to e.g. 2 to give even more pronounced bump effect.
* @property {boolean} useIridescence Enable thin-film iridescence.
* @property {import('../../platform/graphics/texture.js').Texture|null} iridescenceMap The
* per-pixel iridescence intensity. Only used when useIridescence is enabled.
* @property {number} iridescenceMapUv Iridescence map UV channel.
* @property {Vec2} iridescenceMapTiling Controls the 2D tiling of the iridescence map.
* @property {Vec2} iridescenceMapOffset Controls the 2D offset of the iridescence map. Each component is
* between 0 and 1.
* @property {number} iridescenceMapRotation Controls the 2D rotation (in degrees) of the iridescence
* map.
* @property {string} iridescenceMapChannel Color channels of the iridescence map to use. Can be "r",
* "g", "b" or "a".
* @property {import('../../platform/graphics/texture.js').Texture|null} iridescenceThicknessMap The
* per-pixel iridescence thickness. Defines a gradient weight between iridescenceThicknessMin and
* iridescenceThicknessMax. Only used when useIridescence is enabled.
* @property {number} iridescenceThicknessMapUv Iridescence thickness map UV channel.
* @property {Vec2} iridescenceThicknessMapTiling Controls the 2D tiling of the iridescence
* thickness map.
* @property {Vec2} iridescenceThicknessMapOffset Controls the 2D offset of the iridescence
* thickness map. Each component is between 0 and 1.
* @property {number} iridescenceThicknessMapRotation Controls the 2D rotation (in degrees)
* of the iridescence map.
* @property {string} iridescenceThicknessMapChannel Color channels of the iridescence thickness
* map to use. Can be "r", "g", "b" or "a".
* @property {number} iridescenceThicknessMin The minimum thickness for the iridescence layer.
* Only used when an iridescence thickness map is used. The unit is in nm.
* @property {number} iridescenceThicknessMax The maximum thickness for the iridescence layer.
* Used as the 'base' thickness when no iridescence thickness map is defined. The unit is in nm.
* @property {number} iridescenceRefractionIndex The index of refraction of the iridescent
* thin-film. Affects the color phase shift as described here:
* https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_iridescence
* @property {boolean} useMetalness Use metalness properties instead of specular. When enabled,
* diffuse colors also affect specular instead of the dedicated specular map. This can be used as
* alternative to specular color to save space. With metalness == 0, the pixel is assumed to be
* dielectric, and diffuse color is used as normal. With metalness == 1, the pixel is fully
* metallic, and diffuse color is used as specular color instead.
* @property {boolean} useMetalnessSpecularColor When metalness is enabled, use the
* specular map to apply color tint to specular reflections.
* at direct angles.
* @property {number} metalness Defines how much the surface is metallic. From 0 (dielectric) to 1
* (metal).
* @property {import('../../platform/graphics/texture.js').Texture|null} metalnessMap Monochrome
* metalness map (default is null).
* @property {number} metalnessMapUv Metalness map UV channel.
* @property {Vec2} metalnessMapTiling Controls the 2D tiling of the metalness map.
* @property {Vec2} metalnessMapOffset Controls the 2D offset of the metalness map. Each component
* is between 0 and 1.
* @property {number} metalnessMapRotation Controls the 2D rotation (in degrees) of the metalness
* map.
* @property {string} metalnessMapChannel Color channel of the metalness map to use. Can be "r",
* "g", "b" or "a".
* @property {boolean} metalnessVertexColor Use mesh vertex colors for metalness. If metalnessMap
* is set, it'll be multiplied by vertex colors.
* @property {string} metalnessVertexColorChannel Vertex color channel to use for metalness. Can be
* "r", "g", "b" or "a".
* @property {number} gloss Defines the glossiness of the material from 0 (rough) to 1 (shiny).
* @property {import('../../platform/graphics/texture.js').Texture|null} glossMap Gloss map
* (default is null). If specified, will be multiplied by normalized gloss value and/or vertex
* colors.
* @property {boolean} glossInvert Invert the gloss component (default is false). Enabling this
* flag results in material treating the gloss members as roughness.
* @property {number} glossMapUv Gloss map UV channel.
* @property {string} glossMapChannel Color channel of the gloss map to use. Can be "r", "g", "b"
* or "a".
* @property {Vec2} glossMapTiling Controls the 2D tiling of the gloss map.
* @property {Vec2} glossMapOffset Controls the 2D offset of the gloss map. Each component is
* between 0 and 1.
* @property {number} glossMapRotation Controls the 2D rotation (in degrees) of the gloss map.
* @property {boolean} glossVertexColor Use mesh vertex colors for glossiness. If glossMap is set,
* it'll be multiplied by vertex colors.
* @property {string} glossVertexColorChannel Vertex color channel to use for glossiness. Can be
* "r", "g", "b" or "a".
* @property {number} refraction Defines the visibility of refraction. Material can refract the
* same cube map as used for reflections.
* @property {import('../../platform/graphics/texture.js').Texture|null} refractionMap The map of
* the refraction visibility.
* @property {number} refractionMapUv Refraction map UV channel.
* @property {Vec2} refractionMapTiling Controls the 2D tiling of the refraction map.
* @property {Vec2} refractionMapOffset Controls the 2D offset of the refraction map. Each component
* is between 0 and 1.
* @property {number} refractionMapRotation Controls the 2D rotation (in degrees) of the emissive
* map.
* @property {string} refractionMapChannel Color channels of the refraction map to use. Can be "r",
* "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} refractionVertexColor Use mesh vertex colors for refraction. If
* refraction map is set, it will be be multiplied by vertex colors.
* @property {boolean} refractionVertexColorChannel Vertex color channel to use for refraction.
* Can be "r", "g", "b" or "a".
* @property {number} refractionIndex Defines the index of refraction, i.e. The amount of
* distortion. The value is calculated as (outerIor / surfaceIor), where inputs are measured
* indices of refraction, the one around the object and the one of its own surface. In most
* situations outer medium is air, so outerIor will be approximately 1. Then you only need to do
* (1.0 / surfaceIor).
* @property {boolean} useDynamicRefraction Enables higher quality refractions using the grab pass
* instead of pre-computed cube maps for refractions.
* @property {number} thickness The thickness of the medium, only used when useDynamicRefraction
* is enabled. The unit is in base units, and scales with the size of the object.
* @property {import('../../platform/graphics/texture.js').Texture|null} thicknessMap The
* per-pixel thickness of the medium, only used when useDynamicRefraction is enabled.
* @property {number} thicknessMapUv Thickness map UV channel.
* @property {Vec2} thicknessMapTiling Controls the 2D tiling of the thickness map.
* @property {Vec2} thicknessMapOffset Controls the 2D offset of the thickness map. Each component is
* between 0 and 1.
* @property {number} thicknessMapRotation Controls the 2D rotation (in degrees) of the thickness
* map.
* @property {string} thicknessMapChannel Color channels of the thickness map to use. Can be "r",
* "g", "b" or "a".
* @property {boolean} thicknessVertexColor Use mesh vertex colors for thickness. If
* thickness map is set, it will be be multiplied by vertex colors.
* @property {Color} attenuation The attenuation color for refractive materials, only used when
* useDynamicRefraction is enabled.
* @property {number} attenuationDistance The distance defining the absorption rate of light
* within the medium. Only used when useDynamicRefraction is enabled.
* @property {Color} emissive The emissive color of the material. This color value is 3-component
* (RGB), where each component is between 0 and 1.
* @property {boolean} emissiveTint Multiply emissive map and/or emissive vertex color by the
* constant emissive value.
* @property {import('../../platform/graphics/texture.js').Texture|null} emissiveMap The emissive
* map of the material (default is null). Can be HDR.
* @property {number} emissiveIntensity Emissive color multiplier.
* @property {number} emissiveMapUv Emissive map UV channel.
* @property {Vec2} emissiveMapTiling Controls the 2D tiling of the emissive map.
* @property {Vec2} emissiveMapOffset Controls the 2D offset of the emissive map. Each component is
* between 0 and 1.
* @property {number} emissiveMapRotation Controls the 2D rotation (in degrees) of the emissive
* map.
* @property {string} emissiveMapChannel Color channels of the emissive map to use. Can be "r",
* "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} emissiveVertexColor Use mesh vertex colors for emission. If emissiveMap or
* emissiveTint are set, they'll be multiplied by vertex colors.
* @property {string} emissiveVertexColorChannel Vertex color channels to use for emission. Can be
* "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} useSheen Toggle sheen specular effect on/off.
* @property {Color} sheen The specular color of the sheen (fabric) microfiber structure.
* This color value is 3-component (RGB), where each component is between 0 and 1.
* @property {boolean} sheenTint Multiply sheen map and/or sheen vertex color by the constant
* sheen value.
* @property {import('../../platform/graphics/texture.js').Texture|null} sheenMap The sheen
* microstructure color map of the material (default is null).
* @property {number} sheenMapUv Sheen map UV channel.
* @property {Vec2} sheenMapTiling Controls the 2D tiling of the sheen map.
* @property {Vec2} sheenMapOffset Controls the 2D offset of the sheen map. Each component is
* between 0 and 1.
* @property {number} sheenMapRotation Controls the 2D rotation (in degrees) of the sheen
* map.
* @property {string} sheenMapChannel Color channels of the sheen map to use. Can be "r",
* "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} sheenVertexColor Use mesh vertex colors for sheen. If sheen map or
* sheen tint are set, they'll be multiplied by vertex colors.
* @property {number} sheenGloss The glossiness of the sheen (fabric) microfiber structure.
* This color value is a single value between 0 and 1.
* @property {boolean} sheenGlossInvert Invert the sheen gloss component (default is false).
* Enabling this flag results in material treating the sheen gloss members as roughness.
* @property {boolean} sheenGlossTint Multiply sheen glossiness map and/or sheen glossiness vertex
* value by the scalar sheen glossiness value.
* @property {import('../../platform/graphics/texture.js').Texture|null} sheenGlossMap The sheen
* glossiness microstructure color map of the material (default is null).
* @property {number} sheenGlossMapUv Sheen map UV channel.
* @property {Vec2} sheenGlossMapTiling Controls the 2D tiling of the sheen glossiness map.
* @property {Vec2} sheenGlossMapOffset Controls the 2D offset of the sheen glossiness map.
* Each component is between 0 and 1.
* @property {number} sheenGlossMapRotation Controls the 2D rotation (in degrees) of the sheen
* glossiness map.
* @property {string} sheenGlossMapChannel Color channels of the sheen glossiness map to use.
* Can be "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} sheenGlossVertexColor Use mesh vertex colors for sheen glossiness.
* If sheen glossiness map or sheen glossiness tint are set, they'll be multiplied by vertex colors.
* @property {string} sheenGlossVertexColorChannel Vertex color channels to use for sheen glossiness.
* Can be "r", "g", "b" or "a".
* @property {number} opacity The opacity of the material. This value can be between 0 and 1, where
* 0 is fully transparent and 1 is fully opaque. If you want the material to be semi-transparent
* you also need to set the {@link Material#blendType} to {@link BLEND_NORMAL},
* {@link BLEND_ADDITIVE} or any other mode. Also note that for most semi-transparent objects you
* want {@link Material#depthWrite} to be false, otherwise they can fully occlude objects behind
* them.
* @property {import('../../platform/graphics/texture.js').Texture|null} opacityMap The opacity map
* of the material (default is null).
* @property {number} opacityMapUv Opacity map UV channel.
* @property {string} opacityMapChannel Color channel of the opacity map to use. Can be "r", "g",
* "b" or "a".
* @property {Vec2} opacityMapTiling Controls the 2D tiling of the opacity map.
* @property {Vec2} opacityMapOffset Controls the 2D offset of the opacity map. Each component is
* between 0 and 1.
* @property {number} opacityMapRotation Controls the 2D rotation (in degrees) of the opacity map.
* @property {boolean} opacityVertexColor Use mesh vertex colors for opacity. If opacityMap is set,
* it'll be multiplied by vertex colors.
* @property {string} opacityVertexColorChannel Vertex color channels to use for opacity. Can be
* "r", "g", "b" or "a".
* @property {boolean} opacityFadesSpecular Used to specify whether specular and reflections are
* faded out using {@link StandardMaterial#opacity}. Default is true. When set to false use
* {@link Material#alphaFade} to fade out materials.
* @property {number} alphaFade Used to fade out materials when
* {@link StandardMaterial#opacityFadesSpecular} is set to false.
* @property {import('../../platform/graphics/texture.js').Texture|null} normalMap The main
* (primary) normal map of the material (default is null). The texture must contains normalized,
* tangent space normals.
* @property {number} normalMapUv Main (primary) normal map UV channel.
* @property {Vec2} normalMapTiling Controls the 2D tiling of the main (primary) normal map.
* @property {Vec2} normalMapOffset Controls the 2D offset of the main (primary) normal map. Each
* component is between 0 and 1.
* @property {number} normalMapRotation Controls the 2D rotation (in degrees) of the main (primary)
* normal map.
* @property {number} bumpiness The bumpiness of the material. This value scales the assigned main
* (primary) normal map. It should be normally between 0 (no bump mapping) and 1 (full bump
* mapping), but can be set to e.g. 2 to give even more pronounced bump effect.
* @property {import('../../platform/graphics/texture.js').Texture|null} normalDetailMap The detail
* (secondary) normal map of the material (default is null). Will only be used if main (primary)
* normal map is non-null.
* @property {number} normalDetailMapUv Detail (secondary) normal map UV channel.
* @property {Vec2} normalDetailMapTiling Controls the 2D tiling of the detail (secondary) normal
* map.
* @property {Vec2} normalDetailMapOffset Controls the 2D offset of the detail (secondary) normal
* map. Each component is between 0 and 1.
* @property {number} normalDetailMapRotation Controls the 2D rotation (in degrees) of the detail
* (secondary) normal map.
* @property {number} normalDetailMapBumpiness The bumpiness of the material. This value scales the
* assigned detail (secondary) normal map. It should be normally between 0 (no bump mapping) and 1
* (full bump mapping), but can be set to e.g. 2 to give even more pronounced bump effect.
* @property {import('../../platform/graphics/texture.js').Texture|null} heightMap The height map
* of the material (default is null). Used for a view-dependent parallax effect. The texture must
* represent the height of the surface where darker pixels are lower and lighter pixels are higher.
* It is recommended to use it together with a normal map.
* @property {number} heightMapUv Height map UV channel.
* @property {string} heightMapChannel Color channel of the height map to use. Can be "r", "g", "b"
* or "a".
* @property {Vec2} heightMapTiling Controls the 2D tiling of the height map.
* @property {Vec2} heightMapOffset Controls the 2D offset of the height map. Each component is
* between 0 and 1.
* @property {number} heightMapRotation Controls the 2D rotation (in degrees) of the height map.
* @property {number} heightMapFactor Height map multiplier. Affects the strength of the parallax
* effect.
* @property {import('../../platform/graphics/texture.js').Texture|null} envAtlas The prefiltered
* environment lighting atlas (default is null). This setting overrides cubeMap and sphereMap and
* will replace the scene lighting environment.
* @property {import('../../platform/graphics/texture.js').Texture|null} cubeMap The cubic
* environment map of the material (default is null). This setting overrides sphereMap and will
* replace the scene lighting environment.
* @property {import('../../platform/graphics/texture.js').Texture|null} sphereMap The spherical
* environment map of the material (default is null). This will replace the scene lighting
* environment.
* @property {number} cubeMapProjection The type of projection applied to the cubeMap property:
* - {@link CUBEPROJ_NONE}: The cube map is treated as if it is infinitely far away.
* - {@link CUBEPROJ_BOX}: Box-projection based on a world space axis-aligned bounding box.
* Defaults to {@link CUBEPROJ_NONE}.
* @property {import('../../core/shape/bounding-box.js').BoundingBox} cubeMapProjectionBox The
* world space axis-aligned bounding box defining the box-projection used for the cubeMap property.
* Only used when cubeMapProjection is set to {@link CUBEPROJ_BOX}.
* @property {number} reflectivity Environment map intensity.
* @property {import('../../platform/graphics/texture.js').Texture|null} lightMap A custom lightmap
* of the material (default is null). Lightmaps are textures that contain pre-rendered lighting.
* Can be HDR.
* @property {number} lightMapUv Lightmap UV channel
* @property {string} lightMapChannel Color channels of the lightmap to use. Can be "r", "g", "b",
* "a", "rgb" or any swizzled combination.
* @property {Vec2} lightMapTiling Controls the 2D tiling of the lightmap.
* @property {Vec2} lightMapOffset Controls the 2D offset of the lightmap. Each component is
* between 0 and 1.
* @property {number} lightMapRotation Controls the 2D rotation (in degrees) of the lightmap.
* @property {boolean} lightVertexColor Use baked vertex lighting. If lightMap is set, it'll be
* multiplied by vertex colors.
* @property {string} lightVertexColorChannel Vertex color channels to use for baked lighting. Can
* be "r", "g", "b", "a", "rgb" or any swizzled combination.
* @property {boolean} ambientTint Enables scene ambient multiplication by material ambient color.
* @property {import('../../platform/graphics/texture.js').Texture|null} aoMap The main (primary) baked ambient
* occlusion (AO) map (default is null). Modulates ambient color.
* @property {number} aoMapUv Main (primary) AO map UV channel
* @property {string} aoMapChannel Color channel of the main (primary) AO map to use. Can be "r", "g", "b" or "a".
* @property {Vec2} aoMapTiling Controls the 2D tiling of the main (primary) AO map.
* @property {Vec2} aoMapOffset Controls the 2D offset of the main (primary) AO map. Each component is between 0
* and 1.
* @property {number} aoMapRotation Controls the 2D rotation (in degrees) of the main (primary) AO map.
* @property {boolean} aoVertexColor Use mesh vertex colors for AO. If aoMap is set, it'll be
* multiplied by vertex colors.
* @property {string} aoVertexColorChannel Vertex color channels to use for AO. Can be "r", "g",
* "b" or "a".
* @property {import('../../platform/graphics/texture.js').Texture|null} aoDetailMap The
* detail (secondary) baked ambient occlusion (AO) map of the material (default is null). Will only be used if main
* (primary) ao map is non-null.
* @property {number} aoDetailMapUv Detail (secondary) AO map UV channel.
* @property {Vec2} aoDetailMapTiling Controls the 2D tiling of the detail (secondary) AO
* map.
* @property {Vec2} aoDetailMapOffset Controls the 2D offset of the detail (secondary) AO
* map. Each component is between 0 and 1.
* @property {number} aoDetailMapRotation Controls the 2D rotation (in degrees) of the detail
* (secondary) AO map.
* @property {string} aoDetailMapChannel Color channels of the detail (secondary) AO map
* to use. Can be "r", "g", "b" or "a" (default is "g").
* @property {string} aoDetailMode Determines how the main (primary) and detail (secondary)
* AO maps are blended together. Can be:
*
* - {@link DETAILMODE_MUL}: Multiply together the primary and secondary colors.
* - {@link DETAILMODE_ADD}: Add together the primary and secondary colors.
* - {@link DETAILMODE_SCREEN}: Softer version of {@link DETAILMODE_ADD}.
* - {@link DETAILMODE_OVERLAY}: Multiplies or screens the colors, depending on the primary color.
* - {@link DETAILMODE_MIN}: Select whichever of the primary and secondary colors is darker,
* component-wise.
* - {@link DETAILMODE_MAX}: Select whichever of the primary and secondary colors is lighter,
* component-wise.
*
* Defaults to {@link DETAILMODE_MUL}.
* @property {number} occludeSpecular Uses ambient occlusion to darken specular/reflection. It's a
* hack, because real specular occlusion is view-dependent. However, it can be better than nothing.
*
* - {@link SPECOCC_NONE}: No specular occlusion
* - {@link SPECOCC_AO}: Use AO directly to occlude specular.
* - {@link SPECOCC_GLOSSDEPENDENT}: Modify AO based on material glossiness/view angle to occlude
* specular.
*
* @property {number} occludeSpecularIntensity Controls visibility of specular occlusion.
* @property {boolean} occludeDirect Tells if AO should darken directional lighting. Defaults to
* false.
* @property {boolean} conserveEnergy Defines how diffuse and specular components are combined when
* Fresnel is on. It is recommended that you leave this option enabled, although you may want to
* disable it in case when all reflection comes only from a few light sources, and you don't use an
* environment map, therefore having mostly black reflection.
* @property {number} shadingModel Defines the shading model.
* - {@link SPECULAR_PHONG}: Phong without energy conservation. You should only use it as a
* backwards compatibility with older projects.
* - {@link SPECULAR_BLINN}: Energy-conserving Blinn-Phong.
* @property {number} fresnelModel Defines the formula used for Fresnel effect.
* As a side-effect, enabling any Fresnel model changes the way diffuse and reflection components
* are combined. When Fresnel is off, legacy non energy-conserving combining is used. When it is
* on, combining behavior is defined by conserveEnergy parameter.
*
* - {@link FRESNEL_NONE}: No Fresnel.
* - {@link FRESNEL_SCHLICK}: Schlick's approximation of Fresnel (recommended). Parameterized by
* specular color.
*
* @property {boolean} useFog Apply fogging (as configured in scene settings)
* @property {boolean} useLighting Apply lighting
* @property {boolean} useSkybox Apply scene skybox as prefiltered environment map
* @property {boolean} useGammaTonemap Apply gamma correction and tonemapping (as configured in
* scene settings).
* @property {boolean} pixelSnap Align vertices to pixel coordinates when rendering. Useful for
* pixel perfect 2D graphics.
* @property {boolean} twoSidedLighting Calculate proper normals (and therefore lighting) on
* backfaces.
* @property {UpdateShaderCallback} onUpdateShader A custom function that will be called after all
* shader generator properties are collected and before shader code is generated. This function
* will receive an object with shader generator settings (based on current material and scene
* properties), that you can change and then return. Returned value will be used instead. This is
* mostly useful when rendering the same set of objects, but with different shader variations based
* on the same material. For example, you may wish to render a depth or normal pass using textures
* assigned to the material, a reflection pass with simpler shaders and so on. These properties are
* split into two sections, generic standard material options and lit options. Properties of the
* standard material options are {@link StandardMaterialOptions} and the options for the lit options
* are {@link LitShaderOptions}.
* @augments Material
* @category Graphics
*/
class StandardMaterial extends Material {
static TEXTURE_PARAMETERS = standardMaterialTextureParameters;
static CUBEMAP_PARAMETERS = standardMaterialCubemapParameters;
/**
* Create a new StandardMaterial instance.
*
* @example
* // Create a new Standard material
* const material = new pc.StandardMaterial();
*
* // Update the material's diffuse and specular properties
* material.diffuse.set(1, 0, 0);
* material.specular.set(1, 1, 1);
*
* // Notify the material that it has been modified
* material.update();
* @example
* // Create a new Standard material
* const material = new pc.StandardMaterial();
*
* // Assign a texture to the diffuse slot
* material.diffuseMap = texture;
*
* // Use the alpha channel of the texture for alpha testing with a reference value of 0.5
* material.opacityMap = texture;
* material.alphaTest = 0.5;
*
* // Notify the material that it has been modified
* material.update();
*/
constructor() {
super();
this._dirtyShader = true;
// storage for texture and cubemap asset references
this._assetReferences = {};
this._activeParams = new Set();
this._activeLightingParams = new Set();
this.shaderOptBuilder = new StandardMaterialOptionsBuilder();
this.reset();
}
reset() {
// set default values
Object.keys(_props).forEach((name) => {
this[`_${name}`] = _props[name].value();
});
/**
* @type {Object<string, string>}
* @private
*/
this._chunks = { };
this._uniformCache = { };
}
set shader(shader) {
Debug.warn('StandardMaterial#shader property is not implemented, and should not be used.');
}
get shader() {
Debug.warn('StandardMaterial#shader property is not implemented, and should not be used.');
return null;
}
/**
* Object containing custom shader chunks that will replace default ones.
*
* @type {Object<string, string>}
*/
set chunks(value) {
this._dirtyShader = true;
this._chunks = value;
}
get chunks() {
this._dirtyShader = true;
return this._chunks;
}
/**
* Copy a `StandardMaterial`.
*
* @param {StandardMaterial} source - The material to copy from.
* @returns {StandardMaterial} The destination material.
*/
copy(source) {
super.copy(source);
// set properties
Object.keys(_props).forEach((k) => {
this[k] = source[k];
});
// clone chunks
for (const p in source._chunks) {
if (source._chunks.hasOwnProperty(p))
this._chunks[p] = source._chunks[p];
}
return this;
}
_setParameter(name, value) {
_params.add(name);
this.setParameter(name, value);
}
_setParameters(parameters) {
parameters.forEach((v) => {
this._setParameter(v.name, v.value);
});
}
_processParameters(paramsName) {
const prevParams = this[paramsName];
prevParams.forEach((param) => {
if (!_params.has(param)) {
delete this.parameters[param];
}
});
this[paramsName] = _params;
_params = prevParams;
_params.clear();
}
_updateMap(p) {
const mname = p + 'Map';
const map = this[mname];
if (map) {
this._setParameter('texture_' + mname, map);
const tname = mname + 'Transform';
const uniform = this.getUniform(tname);
if (uniform) {
this._setParameters(uniform);
}
}
}
// allocate a uniform if it doesn't already exist in the uniform cache
_allocUniform(name, allocFunc) {
let uniform = this._uniformCache[name];
if (!uniform) {
uniform = allocFunc();
this._uniformCache[name] = uniform;
}
return uniform;
}
getUniform(name, device, scene) {
return _uniforms[name](this, device, scene);
}
updateUniforms(device, scene) {
const getUniform = (name) => {
return this.getUniform(name, device, scene);
};
this._setParameter('material_ambient', getUniform('ambient'));
if (!this.diffuseMap || this.diffuseTint) {
this._setParameter('material_diffuse', getUniform('diffuse'));
}
if (this.useMetalness) {
if (!this.metalnessMap || this.metalness < 1) {
this._setParameter('material_metalness', this.metalness);
}
if (!this.specularMap || this.specularTint) {
this._setParameter('material_specular', getUniform('specular'));
}
if (!this.specularityFactorMap || this.specularityFactorTint) {
this._setParameter('material_specularityFactor', this.specularityFactor);
}
if (!this.sheenMap || this.sheenTint) {
this._setParameter('material_sheen', getUniform('sheen'));
}
if (!this.sheenGlossMap || this.sheenGlossTint) {
this._setParameter('material_sheenGloss', this.sheenGloss);
}
this._setParameter('material_refractionIndex', this.refractionIndex);
} else {
if (!this.specularMap || this.specularTint) {
this._setParameter('material_specular', getUniform('specular'));
}
}
if (this.enableGGXSpecular) {
this._setParameter('material_anisotropy', this.anisotropy);
}
if (this.clearCoat > 0) {
this._setParameter('material_clearCoat', this.clearCoat);
this._setParameter('material_clearCoatGloss', this.clearCoatGloss);
this._setParameter('material_clearCoatBumpiness', this.clearCoatBumpiness);
}
this._setParameter('material_gloss', getUniform('gloss'));
if (!this.emissiveMap || this.emissiveTint) {
this._setParameter('material_emissive', getUniform('emissive'));
}
if (this.emissiveIntensity !== 1) {
this._setParameter('material_emissiveIntensity', this.emissiveIntensity);
}
if (this.refraction > 0) {
this._setParameter('material_refraction', this.refraction);
}
if (this.useDynamicRefraction) {
this._setParameter('material_thickness', this.thickness);
this._setParameter('material_attenuation', getUniform('attenuation'));
this._setParameter('material_invAttenuationDistance', this.attenuationDistance === 0 ? 0 : 1.0 / this.attenuationDistance);
}
if (this.useIridescence) {
this._setParameter('material_iridescence', this.iridescence);
this._setParameter('material_iridescenceRefractionIndex', this.iridescenceRefractionIndex);
this._setParameter('material_iridescenceThicknessMin', this.iridescenceThicknessMin);
this._setParameter('material_iridescenceThicknessMax', this.iridescenceThicknessMax);
}
this._setParameter('material_opacity', this.opacity);
if (this.opacityFadesSpecular === false) {
this._setParameter('material_alphaFade', this.alphaFade);
}
if (this.occludeSpecular) {
this._setParameter('material_occludeSpecularIntensity', this.occludeSpecularIntensity);
}
if (this.cubeMapProjection === CUBEPROJ_BOX) {
this._setParameter(getUniform('cubeMapProjectionBox'));
}
for (const p in _matTex2D) {
this._updateMap(p);
}
if (this.ambientSH) {
this._setParameter('ambientSH[0]', this.ambientSH);
}
if (this.normalMap) {
this._setParameter('material_bumpiness', this.bumpiness);
}
if (this.normalMap && this.normalDetailMap) {
this._setParameter('material_normalDetailMapBumpiness', this.normalDetailMapBumpiness);
}
if (this.heightMap) {
this._setParameter('material_heightMapFactor', getUniform('heightMapFactor'));
}
const isPhong = this.shadingModel === SPECULAR_PHONG;
// set overridden environment textures
if (this.envAtlas && this.cubeMap && !isPhong) {
this._setParameter('texture_envAtlas', this.envAtlas);
this._setParameter('texture_cubeMap', this.cubeMap);
} else if (this.envAtlas && !isPhong) {
this._setParameter('texture_envAtlas', this.envAtlas);
} else if (this.cubeMap) {
this._setParameter('texture_cubeMap', this.cubeMap);
} else if (this.sphereMap) {
this._setParameter('texture_sphereMap', this.sphereMap);
}
this._setParameter('material_reflectivity', this.reflectivity);
// remove unused params
this._processParameters('_activeParams');
if (this._dirtyShader) {
this.clearVariants();
}
}
updateEnvUniforms(device, scene) {
const isPhong = this.shadingModel === SPECULAR_PHONG;
const hasLocalEnvOverride = (this.envAtlas && !isPhong) || this.cubeMap || this.sphereMap;
if (!hasLocalEnvOverride && this.useSkybox) {
if (scene.envAtlas && scene.skybox && !isPhong) {
this._setParameter('texture_envAtlas', scene.envAtlas);
this._setParameter('texture_cubeMap', scene.skybox);
} else if (scene.envAtlas && !isPhong) {
this._setParameter('texture_envAtlas', scene.envAtlas);
} else if (scene.skybox) {
this._setParameter('texture_cubeMap', scene.skybox);
}
}
this._processParameters('_activeLightingParams');
}
getShaderVariant(device, scene, objDefs, unused, pass, sortedLights, viewUniformFormat, viewBindGroupFormat, vertexFormat) {
// update prefiltered lighting data
this.updateEnvUniforms(device, scene);
// Minimal options for Depth and Shadow passes
const shaderPassInfo = ShaderPass.get(device).getByIndex(pass);
const minimalOptions = pass === SHADER_DEPTH || pass === SHADER_PICK || shaderPassInfo.isShadow;
let options = minimalOptions ? standard.optionsContextMin : standard.optionsContext;
if (minimalOptions)
this.shaderOptBuilder.updateMinRef(options, scene, this, objDefs, pass, sortedLights);
else
this.shaderOptBuilder.updateRef(options, scene, this, objDefs, pass, sortedLights);
// execute user callback to modify the options
if (this.onUpdateShader) {
options = this.onUpdateShader(options);
}
const processingOptions = new ShaderProcessorOptions(viewUniformFormat, viewBindGroupFormat, vertexFormat);
const library = getProgramLibrary(device);
library.register('standard', standard);
const shader = library.getProgram('standard', options, processingOptions, this.userId);
this._dirtyShader = false;
return shader;
}
/**
* Removes this material from the scene and possibly frees up memory from its shaders (if there
* are no other materials using it).
*/
destroy() {
// unbind (texture) asset references
for (const asset in this._assetReferences) {
this._assetReferences[asset]._unbind();
}
this._assetReferences = null;
super.destroy();
}
}
// define a uniform get function
const defineUniform = (name, getUniformFunc) => {
_uniforms[name] = getUniformFunc;
};
const definePropInternal = (name, constructorFunc, setterFunc, getterFunc) => {
Object.defineProperty(StandardMaterial.prototype, name, {
get: getterFunc || function () {
return this[`_${name}`];
},
set: setterFunc
});
_props[name] = {
value: constructorFunc
};
};
// define a simple value property (float, string etc)
const defineValueProp = (prop) => {
const internalName = `_${prop.name}`;
const dirtyShaderFunc = prop.dirtyShaderFunc || (() => true);
const setterFunc = function (value) {
const oldValue = this[internalName];
if (oldValue !== value) {
this._dirtyShader = this._dirtyShader || dirtyShaderFunc(oldValue, value);
this[internalName] = value;
}
};
definePropInternal(prop.name, () => prop.defaultValue, setterFunc, prop.getterFunc);
};
// define an aggregate property (color, vec3 etc)
const defineAggProp = (prop) => {
const internalName = `_${prop.name}`;
const dirtyShaderFunc = prop.dirtyShaderFunc || (() => true);
const setterFunc = function (value) {
const oldValue = this[internalName];
if (!oldValue.equals(value)) {
this._dirtyShader = this._dirtyShader || dirtyShaderFunc(oldValue, value);
this[internalName] = oldValue.copy(value);
}
};
definePropInternal(prop.name, () => prop.defaultValue.clone(), setterFunc, prop.getterFunc);
};
// define either a value or aggregate property
const defineProp = (prop) => {
return prop.defaultValue && prop.defaultValue.clone ? defineAggProp(prop) : defineValueProp(prop);
};
function _defineTex2D(name, channel = "rgb", vertexColor = true, uv = 0) {
// store texture name
_matTex2D[name] = channel.length || -1;
defineProp({
name: `${name}Map`,
defaultValue: null,
dirtyShaderFunc: (oldValue, newValue) => {
return !!oldValue !== !!newValue ||
oldValue && (oldValue.type !== newValue.type ||
oldValue.fixCubemapSeams !== newValue.fixCubemapSeams ||
oldValue.format !== newValue.format);
}
});
defineProp({
name: `${name}MapTiling`,
defaultValue: new Vec2(1, 1)
});
defineProp({
name: `${name}MapOffset`,
defaultValue: new Vec2(0, 0)
});
defineProp({
name: `${name}MapRotation`,
defaultValue: 0
});
defineProp({
name: `${name}MapUv`,
defaultValue: uv
});
if (channel) {
defineProp({
name: `${name}MapChannel`,
defaultValue: channel
});
if (vertexColor) {
defineProp({
name: `${name}VertexColor`,
defaultValue: false
});
defineProp({
name: `${name}VertexColorChannel`,
defaultValue: channel
});
}
}
// construct the transform uniform
const mapTiling = `${name}MapTiling`;
const mapOffset = `${name}MapOffset`;
const mapRotation = `${name}MapRotation`;
const mapTransform = `${name}MapTransform`;
defineUniform(mapTransform, (material, device, scene) => {
const tiling = material[mapTiling];
const offset = material[mapOffset];
const rotation = material[mapRotation];
if (tiling.x === 1 && tiling.y === 1 &&
offset.x === 0 && offset.y === 0 &&
rotation === 0) {
return null;
}
const uniform = material._allocUniform(mapTransform, () => {
return [{
name: `texture_${mapTransform}0`,
value: new Float32Array(3)
}, {
name: `texture_${mapTransform}1`,
value: new Float32Array(3)
}];
});
const cr = Math.cos(rotation * math.DEG_TO_RAD);
const sr = Math.sin(rotation * math.DEG_TO_RAD);
const uniform0 = uniform[0].value;
uniform0[0] = cr * tiling.x;
uniform0[1] = -sr * tiling.y;
uniform0[2] = offset.x;
const uniform1 = uniform[1].value;
uniform1[0] = sr * tiling.x;
uniform1[1] = cr * tiling.y;
uniform1[2] = 1.0 - tiling.y - offset.y;
return uniform;
});
}
function _defineColor(name, defaultValue) {
defineProp({
name: name,
defaultValue: defaultValue,
getterFunc: function () {
// HACK: since we can't detect whether a user is going to set a color property
// after calling this getter (i.e doing material.ambient.r = 0.5) we must assume
// the worst and flag the shader as dirty.
// This means currently animating a material color is horribly slow.
this._dirtyShader = true;
return this[`_${name}`];
}
});
defineUniform(name, (material, device, scene) => {
const uniform = material._allocUniform(name, () => new Float32Array(3));
const color = material[name];
const gamma = material.useGammaTonemap && scene.gammaCorrection;
if (gamma) {
uniform[0] = Math.pow(color.r, 2.2);
uniform[1] = Math.pow(color.g, 2.2);
uniform[2] = Math.pow(color.b, 2.2);
} else {
uniform[0] = color.r;
uniform[1] = color.g;
uniform[2] = color.b;
}
return uniform;
});
}
function _defineFloat(name, defaultValue, getUniformFunc) {
defineProp({
name: name,
defaultValue: defaultValue,
dirtyShaderFunc: (oldValue, newValue) => {
// This is not always optimal and will sometimes trigger redundant shader
// recompilation. However, no number property on a standard material
// triggers a shader recompile if the previous and current values both
// have a fractional part.
return (oldValue === 0 || oldValue === 1) !== (newValue === 0 || newValue === 1);
}
});
defineUniform(name, getUniformFunc);
}
function _defineObject(name, getUniformFunc) {
defineProp({
name: name,
defaultValue: null,
dirtyShaderFunc: (oldValue, newValue) => {
return !!oldValue === !!newValue;
}
});
defineUniform(name, getUniformFunc);
}
function _defineFlag(name, defaultValue) {
defineProp({
name: name,
defaultValue: defaultValue
});
}
function _defineMaterialProps() {
_defineColor('ambient', new Color(0.7, 0.7, 0.7));
_defineColor('diffuse', new Color(1, 1, 1));
_defineColor('specular', new Color(0, 0, 0));
_defineColor('emissive', new Color(0, 0, 0));
_defineColor('sheen', new Color(1, 1, 1));
_defineColor('attenuation', new Color(1, 1, 1));
_defineFloat('emissiveIntensity', 1);
_defineFloat('specularityFactor', 1);
_defineFloat('sheenGloss', 0.0);
_defineFloat('gloss', 0.25, (material, device, scene) => {
return material.shadingModel === SPECULAR_PHONG ?
// legacy: expand back to specular power
Math.pow(2, material.gloss * 11) :
material.gloss;
});
_defineFloat('heightMapFactor', 1, (material, device, scene) => {
return material.heightMapFactor * 0.025;
});
_defineFloat('opacity', 1);
_defineFloat('alphaFade', 1);
_defineFloat('alphaTest', 0); // NOTE: overwrites Material.alphaTest
_defineFloat('bumpiness', 1);
_defineFloat('normalDetailMapBumpiness', 1);
_defineFloat('reflectivity', 1);
_defineFloat('occludeSpecularIntensity', 1);
_defineFloat('refraction', 0);
_defineFloat('refractionIndex', 1.0 / 1.5); // approx. (air ior / glass ior)
_defineFloat('thickness', 0);
_defineFloat('attenuationDistance', 0);
_defineFloat('metalness', 1);
_defineFloat('anisotropy', 0);
_defineFloat('clearCoat', 0);
_defineFloat('clearCoatGloss', 1);
_defineFloat('clearCoatBumpiness', 1);
_defineFloat('aoUvSet', 0, null); // legacy
_defineFloat('iridescence', 0);
_defineFloat('iridescenceRefractionIndex', 1.0 / 1.5);
_defineFloat('iridescenceThicknessMin', 0);
_defineFloat('iridescenceThicknessMax', 0);
_defineObject('ambientSH');
_defineObject('cubeMapProjectionBox', (material, device, scene) => {
const uniform = material._allocUniform('cubeMapProjectionBox', () => {
return [{
name: 'envBoxMin',
value: new Float32Array(3)
}, {
name: 'envBoxMax',
value: new Float32Array(3)
}];
});
const bboxMin = material.cubeMapProjectionBox.getMin();
const minUniform = uniform[0].value;
minUniform[0] = bboxMin.x;
minUniform[1] = bboxMin.y;
minUniform[2] = bboxMin.z;
const bboxMax = material.cubeMapProjectionBox.getMax();
const maxUniform = uniform[1].value;
maxUniform[0] = bboxMax.x;
maxUniform[1] = bboxMax.y;
maxUniform[2] = bboxMax.z;
return uniform;
});
_defineFlag('ambientTint', false);
_defineFlag('diffuseTint', false);
_defineFlag('specularTint', false);
_defineFlag('specularityFactorTint', false);
_defineFlag('emissiveTint', false);
_defineFlag('fastTbn', false);
_defineFlag('useMetalness', false);
_defineFlag('useMetalnessSpecularColor', false);
_defineFlag('useSheen', false);
_defineFlag('enableGGXSpecular', false);
_defineFlag('occludeDirect', false);
_defineFlag('normalizeNormalMap', true);
_defineFlag('conserveEnergy', true);
_defineFlag('opacityFadesSpecular', true);
_defineFlag('occludeSpecular', SPECOCC_AO);
_defineFlag('shadingModel', SPECULAR_BLINN);
_defineFlag('fresnelModel', FRESNEL_SCHLICK); // NOTE: this has been made to match the default shading model (to fix a bug)
_defineFlag('useDynamicRefraction', false);
_defineFlag('cubeMapProjection', CUBEPROJ_NONE);
_defineFlag('customFragmentShader', null);
_defineFlag('useFog', true);
_defineFlag('useLighting', true);
_defineFlag('useGammaTonemap', true);
_defineFlag('useSkybox', true);
_defineFlag('forceUv1', false);
_defineFlag('pixelSnap', false);
_defineFlag('twoSidedLighting', false);
_defineFlag('nineSlicedMode', undefined); // NOTE: this used to be SPRITE_RENDERMODE_SLICED but was undefined pre-Rollup
_defineFlag('msdfTextAttribute', false);
_defineFlag('useIridescence', false);
_defineFlag('glossInvert', false);
_defineFlag('sheenGlossInvert', false);
_defineFlag('clearCoatGlossInvert', false);
_defineTex2D('diffuse');
_defineTex2D('specular');
_defineTex2D('emissive');
_defineTex2D('thickness', 'g');
_defineTex2D('specularityFactor', 'g');
_defineTex2D('normal', '');
_defineTex2D('metalness', 'g');
_defineTex2D('gloss', 'g');
_defineTex2D('opacity', 'a');
_defineTex2D('refraction', 'g');
_defineTex2D('height', 'g', false);
_defineTex2D('ao', 'g');
_defineTex2D('light', 'rgb', true, 1);
_defineTex2D('msdf', '');
_defineTex2D('diffuseDetail', 'rgb', false);
_defineTex2D('normalDetail', '');
_defineTex2D('aoDetail', 'g', false);
_defineTex2D('clearCoat', 'g');
_defineTex2D('clearCoatGloss', 'g');
_defineTex2D('clearCoatNormal', '');
_defineTex2D('sheen', 'rgb');
_defineTex2D('sheenGloss', 'g');
_defineTex2D('iridescence', 'g');
_defineTex2D('iridescenceThickness', 'g');
_defineFlag('diffuseDetailMode', DETAILMODE_MUL);
_defineFlag('aoDetailMode', DETAILMODE_MUL);
_defineObject('cubeMap');
_defineObject('sphereMap');
_defineObject('envAtlas');
// prefiltered cubemap getter
const getterFunc = function () {
return this._prefilteredCubemaps;
};
// prefiltered cubemap setter
const setterFunc = function (value) {
const cubemaps = this._prefilteredCubemaps;
value = value || [];
let changed = false;
let complete = true;
for (let i = 0; i < 6; ++i) {
const v = value[i] || null;
if (cubemaps[i] !== v) {
cubemaps[i] = v;
changed = true;
}
complete = complete && (!!cubemaps[i]);
}
if (changed) {
if (complete) {
this.envAtlas = EnvLighting.generatePrefilteredAtlas(cubemaps, {
target: this.envAtlas
});
} else {
if (this.envAtlas) {
this.envAtlas.destroy();
this.envAtlas = null;
}
}
this._dirtyShader = true;
}
};
const empty = [null, null, null, null, null, null];
definePropInternal('prefilteredCubemaps', () => empty.slice(), setterFunc, getterFunc);
}
_defineMaterialProps();
export { StandardMaterial };
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Form from './Form';
import { calculateMaxEntropyLabel } from '../services/Utils';
import './Setup.css';
class Setup extends Component {
constructor(...args) {
super(...args);
this.state = {
entropyLabel: '',
type: 'password',
valid: false
};
this.inputRef = React.createRef();
this.confirmRef = React.createRef();
this.toggle = this.toggle.bind(this);
this.onChange = this.onChange.bind(this);
this.submit = this.submit.bind(this);
}
componentDidMount() {
this.inputRef.current.focus();
}
toggle() {
let type = this.state.type === 'password' ? 'text' : 'password';
this.setState({ type });
}
getValidPassword() {
let p1 = this.inputRef.current.value;
let p2 = this.confirmRef.current.value;
let valid = (p1 === p2) && p1.length > 3;
if (valid) return p1;
return null;
}
onChange({key, target}) {
if (key === 'Enter') {
if (target === this.inputRef.current) this.confirmRef.current.focus();
else this.submit();
}
let entropyLabel = calculateMaxEntropyLabel(this.inputRef.current.value);
this.setState({ valid: this.getValidPassword() !== null, entropyLabel });
}
submit() {
let password = this.getValidPassword();
if (password) this.props.onComplete(password);
}
render() {
return <Form
onCancel={ this.props.onCancel }
classNames={ this.props.classNames }
entropyLabel={ this.state.entropyLabel }
type={ this.state.type }
valid={ this.state.valid }
onChange={ this.onChange }
inputRef={ this.inputRef }
confirmRef={ this.confirmRef }
toggle={ this.toggle }
submit={ this.submit }
/>;
}
}
Setup.propTypes = {
classNames: PropTypes.string,
onComplete: PropTypes.func.isRequired,
onCancel: PropTypes.func
};
export default Setup;
|
import React from 'react';
// import 'react-bootstrap/dist/css/bootstrap.min.css';
import App from './App';
import ReactDOM from 'react-dom/client';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { UserContextProvider } from './firebase/userContext';
import MachiMachi from './pages/work/machimachi';
import NyanJump from './pages/work/nyanjump';
import Rogers from './pages/work/rogers';
import Fabcycle from './pages/work/fabcycle';
import Spark from './pages/work/spark';
import Gallery from './pages/gallery';
import FourOhFour from './pages/404';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<UserContextProvider>
<BrowserRouter>
<Routes>
<Route index element={<App />} />
<Route path="work">
<Route path="machimachi" element={<MachiMachi />} />
<Route path="nyanjump" element={<NyanJump />} />
<Route path="rogers" element={<Rogers />} />
{/* <Route path="fabcycle" element={<Fabcycle />} /> */}
<Route path="spark" element={<Spark />} />
{/* <Route path="website" element={<Website />} /> */}
{/* <Route path="gallery" element={<Gallery />} /> */}
</Route>
<Route path="gallery" element={<Gallery />} />
<Route path="*" element={<FourOhFour />} />
</Routes>
</BrowserRouter>
</UserContextProvider>
</React.StrictMode>
);
|
import React, { Component } from 'react';
import {
StyleSheet,
View,
Text,
StatusBar,
TouchableOpacity,
Dimensions,
FlatList,
Modal,
TextInput,
Button,
Alert
} from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import { TabView, SceneMap } from 'react-native-tab-view';
import { TabBar } from 'react-native-tab-view';
import { Avatar, Icon } from 'react-native-elements';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import { StackActions, NavigationActions } from 'react-navigation';
import {
SCLAlert,
SCLAlertButton
} from 'react-native-scl-alert'
import { USER} from '../../common/Constants';
import Spinner from '../../common/Loading';
import Posts from './Posts';
import Skills from './Skills';
import Achievements from './Achievements';
import SociaMedia from './SocialMedia';
import firebase from 'react-native-firebase';
import AsyncStorage from '@react-native-community/async-storage';
const { height, width } = Dimensions.get('window')
export default class EditProfile extends Component {
constructor(props) {
super(props);
this.state = {
spinner: true,
};
}
async componentDidMount() {
const user = await this.props.navigation.state.params.user;
console.log('==================================');
console.log('Edit Profile', user);
this.setState({ user })
this.setState({ ...user, spinner: false })
}
renderButton() {
if (this.state.loading) {
return <ActivityIndicator size="large" color="#ffffff" />
}
}
onButton = (newData) => {
firebase.database().ref(`users/${firebase.auth().currentUser.uid}`).update(
newData
),
AsyncStorage.setItem(USER,JSON.stringify(newData));
}
render() {
const { firstName, lastName, user, spinner, email, phoneNumber, password, confirmPassword } = this.state;
const userr = {firstName,lastName,phoneNumber,email}
if (spinner) {
return <Spinner />
}
else {
return (
<View>
<StatusBar backgroundColor='#2c233d' barStyle="light-content" />
<View style={styles.basicBackground}>
<View style={{ flexDirection: 'row' }}>
{/* <View style={styles.headerIcon}>
<Icon
name="keyboard-backspace"
size={35}
color='#ffffff'
/>
</View> */}
<Text style={styles.header1}>Edit Profile</Text>
</View>
<View style={styles.background}>
<View>
<Text style={styles.text2}>First Name</Text>
<TextInput
style={styles.inputText}
underlineColorAndroid='gray'
placeholder={firstName}
placeholderTextColor='gray'
value={firstName}
onChangeText={(firstName) => this.setState({ firstName })}
/>
<Text style={styles.text2}>Last Name</Text>
<TextInput
style={styles.inputText}
underlineColorAndroid='gray'
placeholder="Enter name"
placeholderTextColor='gray'
value={lastName}
onChangeText={(lastName) => this.setState({ lastName })}
/>
<Text style={styles.text2}>Email</Text>
<TextInput
style={styles.inputText}
underlineColorAndroid='gray'
placeholder="Enter email"
placeholderTextColor='gray'
value={email}
onChangeText={(email) => this.setState({ email })}
/>
<Text style={styles.text2}>Mobile Number</Text>
<TextInput
value={phoneNumber}
style={styles.inputText}
underlineColorAndroid='gray'
placeholder="Enter phone number"
placeholderTextColor='gray'
value={phoneNumber}
onChangeText={(phoneNumber) => this.setState({ phoneNumber })}
/>
<Text style={styles.text2}>Password</Text>
<TextInput
style={styles.inputText}
underlineColorAndroid='gray'
placeholder="Enter Password"
secureTextEntry={true}
placeholderTextColor='gray'
value={password}
onChangeText={(password) => this.setState({ password })}
/>
<Text style={styles.text2}>Confirm Password</Text>
<TextInput
style={styles.inputText}
underlineColorAndroid='gray'
placeholder="Enter Password"
secureTextEntry={true}
placeholderTextColor='gray'
value={confirmPassword}
onChangeText={(confirmPassword) => this.setState({ confirmPassword })}
/>
<View style={{ marginTop: height * 0.03 }}>
<TouchableOpacity
//onPress={this.onButtonPress(this.state.user)}
onPress={ () => {
this.onButton(userr)
}}
>
<LinearGradient
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 0 }}
colors={['#5653e2', '#795EE3', '#ae71f2']}
style={styles.linearGradient}>
<Text
style={styles.bottonText}>
Save
</Text>
</LinearGradient>
</TouchableOpacity>
</View>
</View>
</View>
</View>
</View>
);
}
}
}
const styles = StyleSheet.create({
basicBackground: {
backgroundColor: '#382d4b',
height: '100%',
width: '100%',
paddingTop: height * 0.01
},
background: {
backgroundColor: '#ffffff',
height: '88%',
width: '95%',
borderTopRightRadius: 30,
borderBottomRightRadius: 30,
marginTop: height * 0.01,
paddingTop: height * 0.01,
paddingBottom: height * 0.02,
paddingLeft: width * 0.09,
flexDirection: 'row'
},
headerIcon: {
marginTop: width * 0.03,
marginLeft: width * 0.04,
},
header1: {
color: '#ffffff',
fontSize: 25,
fontWeight: 'bold',
marginTop: height * 0.015,
marginLeft: width * 0.04,
paddingBottom: height * 0.02,
},
header2: {
color: '#ffffff',
fontSize: 40,
fontWeight: 'bold',
marginTop: height * 0.05,
marginLeft: width * 0.005,
},
image: {
width: 75,
height: 75,
borderRadius: 75 / 2,
marginTop: height * 0.02,
marginLeft: width * 0.02,
},
text: {
color: '#000000',
fontSize: 30,
fontWeight: 'bold',
textAlign: 'left',
},
text2: {
color: '#382d4b',
fontSize: 20,
fontWeight: 'bold',
marginTop: height * 0.02,
},
inputText: {
color: '#000000',
fontSize: 17,
textAlign: 'left',
fontWeight: 'normal',
width: width * 0.75,
height: height * 0.065,
},
subtittle1: {
color: '#795EE3',
fontSize: 14,
textDecorationLine: 'underline',
textAlign: 'right',
marginRight: width * 0.05,
},
linearGradient: {
alignItems: 'center',
justifyContent: 'center',
borderRadius: 15,
width: width * 0.75,
height: height * 0.055,
},
bottonText: {
color: '#ffffff',
fontSize: 20,
fontWeight: 'bold',
},
or: {
color: 'gray',
fontSize: 20,
textAlign: 'center',
marginTop: height * 0.035,
width: width * 0.75,
},
social: {
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
marginTop: height * 0.02,
marginHorizontal: width * 0.13,
width: width * 0.5,
},
subtittle2: {
color: '#795EE3',
fontSize: 14,
textAlign: 'center',
marginTop: height * 0.03,
textDecorationLine: 'underline',
},
error: {
color: 'red',
fontSize: 13,
marginLeft: width * 0.01,
}
}); |
export const create = {
icon: "plus",
action: "CREATE",
route: "create"
};
export const back = {
icon: "arrow-left",
action: "BACK",
route: "items"
};
export const submit = {
icon: "check",
action: "SUBMIT",
route: "items"
};
|
({
deactivateFirstTimeExperience : function(component, event, helper) {
let onBoardingStatus = component.get("v.UserXCOnboardingStatus");
var action = component.get("c.deactivateFirstTimeExperience");
action.setParams({ XCOnboardingStatus :onBoardingStatus });
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
// do nothing
}
});
$A.enqueueAction(action);
}
}) |
import React from "react";
import "./badge.css";
const Badge = props => (
<div className="badgeContainer col-md-6">
<h1 className="badgeName text-center"> {props.firstname} {props.lastname}</h1>
<h2 className="badgeCompany text-center"> {props.company}</h2>
<h1>{props.qrValue}</h1>
</div>
);
export default Badge; |
var fs = require('fs'),
path = require('path'),
util = require('util'),
_ = require('lodash'),
async = require('async'),
bodyParser = require('body-parser'),
Express = require('express'),
multer = require('multer'),
MongoDB = require('../mongodb'),
csvReader = require('../csv-parser'),
config = require('../config'),
dump = require('../../lib/dump'),
router = Express(),
database = MongoDB, // can use MongoDB || Couchbase
_options = {
pageSize: 10,
paths: {
root: path.resolve(process.cwd(), 'public/'),
images: '/images/pet/'
}
},
storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, path.join(_options.paths.root, _options.paths.images))
},
filename: function (req, file, cb) {
console.log('new file: %s', dump(file));
cb(null, file.originalname)
}
}),
upload = multer({storage: storage});
router.use(bodyParser.json());
router.use(bodyParser.urlencoded({extended: false}));
// express error handlers
router.use(function (err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: (router.get('env') === 'development') ? err : {}
});
});
// set simplifiedFormat flag
router.use(function (req, res, next) {
res.locals.simplifiedFormat = (/v2$/.test(req.baseUrl) && /^\/(list|query)/.test(req.path));
next();
});
//set CORS access
router.use(function (err, req, res, next) {
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Origin", "*");
});
function onListRequest(req, res, next) {
var queryData = {
species: req.params['species'],
ignoreCaseFor: ['species']
};
res.locals.pageNumber = req.params['pageNumber'];
database.findAnimals(queryData, {
debug: config.isDevelopment,
complete: function (err, animals) {
if (err) {
res.locals.data = err;
} else if (_.isArray(animals)) {
res.locals.data = animals;
} else {
res.locals.data = [];
}
next();
}
});
}
function onQueryRequest(req, res, next) {
var queryData = req.body;
res.locals.pageNumber = req.params['pageNumber'];
database.findAnimals(queryData, {
debug: config.isDevelopment,
complete: function (err, animals) {
//console.log('getAnimal().mongoDB.findAnimal() - found animal:', animal);
if (err) {
res.locals.data = err;
} else if (animals && animals.length > 0) {
res.locals.data = animals;
} else {
res.locals.data = [];
}
next();
}
});
}
function onOptionsRequest(req, res) {
var species = req.params['species'];
fs.readFile(path.resolve(process.cwd(), 'core/data/options.json'),
{encoding: 'utf8'},
function (err, str) {
if (err) {
res.send(err);
} else {
var options = JSON.parse(str);
res.send(JSON.stringify(options[species]));
}
});
}
function onOptionRequest(req, res) {
var species = req.params['species'],
optionName = req.params['option'];
res.locals.pageNumber = req.params['pageNumber'];
fs.readFile(path.resolve(process.cwd(), 'core/data/options.json'),
{encoding: 'utf8'},
function (err, str) {
if (err) {
res.send(err);
} else {
var options = JSON.parse(str);
res.locals.data = options[species][optionName];
}
});
}
function onSaveJSON(req, res, next) {
database.saveAnimal(req.body, {
debug: config.isDevelopment,
complete: function (err, newAnimal) {
if (err) {
res.send({result: err})
} else {
res.send({
result: 'success',
data: newAnimal
})
}
}
});
}
function onSaveMedia(req, res, next) {
console.log('onSaveMedia: %s-\n%s', dump(req.files), dump(req.body));
var _body = req.body;
_body.images = _body.images.split(',');
_.forEach(req.files, function (fileMeta, index) {
_body.images.push(path.join(_options.paths.images, fileMeta.filename));
});
database.saveAnimal(_body, {
debug: config.isDevelopment,
complete: function (err, newAnimal) {
if (err) {
res.send({result: err})
} else {
res.send({
result: 'success',
data: newAnimal
})
}
}
});
}
function onSaveModel(req, res, next) {
database.saveModel(req.body, {
debug: config.isDevelopment,
complete: function (err, newAnimal) {
if (err) {
res.send({result: err})
} else {
res.send({
result: 'success',
data: newAnimal
})
}
}
});
}
function onModelRequest(req, res) {
var species = req.params['species'];
database.findModel({
species: {
defaultVal: species
}
}, {
debug: config.isDevelopment,
complete: function (err, animalModel) {
res.send(err || animalModel);
}
})
}
function onSchemaRequest(req, res) {
var species = req.params['species'];
fs.readFile(path.resolve(process.cwd(), 'core/data/schema.json'),
{encoding: 'utf8'},
function (err, str) {
if (err) {
res.send(err);
} else {
var schemas = JSON.parse(str);
res.send(JSON.stringify(schemas[species]));
}
});
}
function onDeleteRequest(req, res, next) {
database.removeAnimal(req.body, {
debug: config.isDevelopment,
complete: function (result) {
console.log('database.removeAnimal() - results: %j', arguments);
res.send(result)
}
})
}
function onResetRequest(req, res, next) {
console.log('/reset');
csvReader.parseSchema({
readPath: [
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Model - Cats.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Model - Dogs.csv')
],
cache: true,
done: onSchemaParsed
});
function onSchemaParsed() {
csvReader.parseModel({
readPath: [
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Model - Cats.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Model - Dogs.csv')
],
cache: true,
done: onModelsParsed
});
}
function onModelsParsed(formattedSchema, options) {
console.log('schema parsed');
csvReader.parseOptions({
cache: true,
readPath: [
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Options - Small Animals.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Options - Rabbits.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Options - Reptiles.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Options - Birds.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Options - Dogs.csv'),
path.resolve(process.cwd(), 'tmp/CfO_Animal_Adoption_DB_Options - Cats.csv')
],
done: onOptionsParsed
})
}
function onOptionsParsed() {
console.log('options parsed');
csvReader.parseDataset({
cache: true,
done: onDatasetParsed
});
}
function onDatasetParsed(petCollection, options) {
console.log('dataset parsed');
var numOfPets = petCollection.length;
async.forEachOfSeries(petCollection,
function each(petData, petIndex, done) {
console.log('saving pet %j', petData);
MongoDB.saveAnimal(petData, {
debug: config.isDevelopment,
complete: function (err) {
if (err) {
console.error(dump(err));
done(err);
} else if (petIndex < numOfPets) {
console.log('Saved pet %s/%s', petIndex + 1, numOfPets);
done();
} else {
done();
}
}
});
// done();
},
function done(err) {
res.send(err || {result: 'success'});
}
);
}
}
router.get('/options/:species/', onOptionsRequest);
router.get('/options/:species/:option', onOptionRequest);
router.get('/options/:species/:option/:pageNumber/', onOptionRequest);
router.get('/model/:species/', onModelRequest);
router.get('/schema/:species/', onSchemaRequest);
router.get('/list/:species/', onListRequest);
router.get('/list/:species/:pageNumber/', onListRequest);
router.post('/save/json', onSaveJSON);
router.post('/save', upload.array('uploads'), onSaveMedia);
router.post('/save/model', onSaveModel);
router.post('/query/:pageNumber', onQueryRequest);
router.post('/query', onQueryRequest);
router.post('/remove', onDeleteRequest);
router.get('/reset', onResetRequest);
// paginate data
router.use(function (request, response, next) {
var pageNum = (function () {
var parsedPageNum = (parseInt(response.locals.pageNumber) || 1) - 1; // page numbers start at 1
if (parsedPageNum < 0) return 0;
return parsedPageNum;
})(),
_pageSize = parseInt(request.query['pageSize'] || request.body['pageSize'] || _options.pageSize),
_startIndex = pageNum * _pageSize;
if (_.isFinite(parseInt(response.locals.pageNumber)) && _.isArray(response.locals.data) && response.locals.data.length > _pageSize) {
response.locals.data = response.locals.data.slice(_startIndex, _startIndex + _pageSize);
}
next();
});
// format and send data
router.use(function (request, response, next) {
function simplifyResult(data) {
return data.map(function (animalProps, index) {
var _animalProps = {};
_.forEach(animalProps, function (propData, propName) {
_animalProps[propName] = propData.val;
});
return _animalProps;
});
}
if (response.locals.simplifiedFormat) {
response.send(simplifyResult(response.locals.data));
} else {
response.send(response.locals.data);
}
});
module.exports = router;
|
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { Layout } from 'antd'
import { Switch, Route } from 'react-router-dom'
import Header from '../../components/Header'
import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs'
import Home from '../../components/Home'
import SignIn from '../../components/SignIn'
import SignUp from '../../components/SignUp'
import Chat from '../../components/Chat'
import RedirectPage from '../../components/RedirectPage'
import { HOME, SIGN_IN, SIGN_UP, REDIRECT, CHAT } from '../../constants/routes'
import { storage } from '../../utils/common'
import { updateUserInfo } from '../../utils/user'
import { loadFacebookSDK } from '../../utils/faceBook'
import { setUserInfo } from '../../actions/userInfo'
import { USER_INFO, FACE_BOOK, APP_ACCOUNT } from '../../constants/common'
// import './App.scss'
const { Content, Footer } = Layout
const breadcrumbPathLinks = ['home', 'login']
const restoreUserLoginState = (params) => {
const storedUserInfo = storage.get(USER_INFO)
if (storedUserInfo) {
switch (storedUserInfo.profileType) {
case APP_ACCOUNT:
updateUserInfo({ ...params, userInfo: storedUserInfo })
break
case FACE_BOOK:
loadFacebookSDK({ ...params, userInfo: storedUserInfo })
break
default:
break
}
}
}
class App extends Component {
componentDidMount = () => {
const { setUserInfo, logoutUser } = this.props
restoreUserLoginState({ setUserInfo, logoutUser })
}
render () {
return (
<Layout className="layout">
<Header {...this.props} />
<Content style={{ padding: '0 50px' }}>
<Breadcrumbs links={breadcrumbPathLinks} />
<Switch>
<Route exact path={HOME} component={Home} />
<Route path={SIGN_IN} component={SignIn} />
<Route path={SIGN_UP} component={SignUp} />
<Route path={CHAT} component={Chat} />
<Route path={REDIRECT} render={(props) => <RedirectPage {...props} />} />
<Route render={() => <h2>404 not found!!! sorry</h2>} />
</Switch>
</Content>
<Footer style={{ textAlign: 'center' }}>
Ant Design ©2018 Created by Ant UED
</Footer>
</Layout>
)
}
}
export default connect(
null,
{ setUserInfo }
)(App)
|
/* eslint-env node */
/* eslint-disable no-sync */
var gulp = require('gulp');
var sass = require('gulp-sass');
var del = require('del');
var execSync = require('child_process').execSync;
var osenv = require('osenv');
var path = require('path');
var runSequence = require('run-sequence');
var eslint = require('gulp-eslint');
var threshold = require('gulp-eslint-threshold');
var jsonEditor = require('gulp-json-editor');
var shell = require('gulp-shell');
var symlink = require('gulp-symlink');
var zip = require('gulp-zip');
var metadata = require('./src/metadata.json');
var paths = {
src: [
'src/**/*',
'!src/**/*~',
'!src/schemas{,/**/*}',
'!src/metadata.json',
'!src/.eslintrc',
],
lib: [ 'lib/**/*' ],
metadata: [ 'src/metadata.json' ],
schemas: [ 'src/schemas/**/*' ],
install: path.join(
osenv.home(),
'.local/share/gnome-shell/extensions',
metadata.uuid
),
};
function getVersion(rawTag) {
var sha1, tag;
sha1 = execSync('git rev-parse --short HEAD').toString().replace(/\n$/, '');
try {
tag = execSync('git describe --tags --exact-match ' + sha1 + ' 2>/dev/null').toString().replace(/\n$/, '');
} catch (e) {
return sha1;
}
if (rawTag) {
return tag;
}
var v = parseInt(tag.replace(/^v/, ''), 10);
if (isNaN(v)) {
throw new Error('Unable to parse version from tag: ' + tag);
}
return v;
}
gulp.task('lint', function () {
var thresholdWarnings = 1;
var thresholdErrors = 1;
return gulp.src([ '**/*.js' ])
.pipe(eslint({
quiet: true,
}))
.pipe(eslint.format())
.pipe(threshold.afterErrors(thresholdErrors, function (numberOfErrors) {
throw new Error('ESLint errors (' + numberOfErrors + ') equal to or greater than the threshold (' + thresholdErrors + ')');
}))
.pipe(threshold.afterWarnings(thresholdWarnings, function (numberOfWarnings) {
throw new Error('ESLint warnings (' + numberOfWarnings + ') equal to or greater than the threshold (' + thresholdWarnings + ')');
}));
});
gulp.task('sass', function () {
return gulp.src('sass/*.scss')
.pipe(sass({
errLogToConsole: true,
outputStyle: 'expanded',
precision: 10,
}))
.pipe(gulp.dest('build'));
});
gulp.task('clean', function (cb) {
return del([ 'build/', metadata.uuid ], cb);
});
gulp.task('copy', function () {
return gulp.src(paths.src)
.pipe(gulp.dest('build'));
});
gulp.task('copy-icons', function () {
return gulp.src('icons/*')
.pipe(gulp.dest('build/icons'));
});
gulp.task('copy-suggestions', function () {
return gulp.src('suggestions/*')
.pipe(gulp.dest('build/suggestions'));
});
gulp.task('copy-scripts', function () {
return gulp.src('shellscripts/*.sh')
.pipe(gulp.dest('build/shellscripts'));
});
gulp.task('copy-license', function () {
return gulp.src([ 'LICENSE' ])
.pipe(gulp.dest('build'));
});
gulp.task('copy-release', function () {
return gulp.src('build/**/*').pipe(gulp.dest(metadata.uuid));
});
gulp.task('metadata', function () {
return gulp.src(paths.metadata)
.pipe(jsonEditor(function (json) {
json.version = getVersion();
return json;
}, {
end_with_newline: true,
}))
.pipe(gulp.dest('build'));
});
gulp.task('schemas', shell.task([
'mkdir -p build/schemas',
'glib-compile-schemas --strict --targetdir build/schemas src/schemas/',
]));
gulp.task('build', function (cb) {
runSequence(
'clean',
[
'metadata',
'schemas',
'copy',
'copy-scripts',
'copy-icons',
'copy-suggestions',
'copy-license',
'sass',
],
cb
);
});
gulp.task('watch', [ 'build' ], function () {
gulp.watch(paths.src, [ 'copy' ]);
gulp.watch(paths.lib, [ 'copy-lib' ]);
gulp.watch('shellscripts/*.sh', [ 'copy-scripts' ]);
gulp.watch('icons/*', [ 'copy-icons' ]);
gulp.watch('suggestions/*', [ 'copy-suggestions' ]);
gulp.watch(paths.metadata, [ 'metadata' ]);
gulp.watch(paths.schemas, [ 'schemas' ]);
gulp.watch('sass/*.scss', [ 'sass' ]);
});
gulp.task('reset-prefs', shell.task([
'dconf reset -f /org/gnome/shell/extensions/mycroft/',
]));
gulp.task('uninstall', function (cb) {
return del([ paths.install ], {
force: true,
}, cb);
});
gulp.task('install-link', [ 'uninstall', 'build' ], function () {
return gulp.src([ 'build' ])
.pipe(symlink(paths.install));
});
gulp.task('install', [ 'uninstall', 'build' ], function () {
return gulp.src([ 'build/**/*' ])
.pipe(gulp.dest(paths.install));
});
gulp.task('require-clean-wd', function (cb) {
var count = execSync('git status --porcelain | wc -l').toString().replace(/\n$/, '');
if (parseInt(count, 10) !== 0) {
return cb(new Error('There are uncommited changes in the working directory. Aborting.'));
}
return cb();
});
gulp.task('bump', function (cb) {
var v;
var stream = gulp.src(paths.metadata)
.pipe(jsonEditor(function (json) {
json.version++;
v = 'v' + json.version;
return json;
}, {
end_with_newline: true,
}))
.pipe(gulp.dest('src'));
stream.on('error', cb);
stream.on('end', function () {
execSync('git commit src/metadata.json -m "Bump version"');
execSync('git tag ' + v);
return cb();
});
});
gulp.task('push', function (cb) {
execSync('git push origin');
execSync('git push origin --tags');
return cb();
});
gulp.task('dist', function (cb) {
runSequence('build', 'copy-release', [ 'lint' ], function () {
var zipFile = metadata.uuid + '.zip';
var stream = gulp.src([ 'build/**/*' ])
.pipe(zip(zipFile))
.pipe(gulp.dest('dist'));
stream.on('error', cb);
stream.on('end', cb);
});
});
gulp.task('release', [ 'lint' ], function (cb) {
runSequence(
'require-clean-wd',
'bump',
'push',
'dist',
cb
);
});
gulp.task('enable-debug', shell.task([
'dconf write /org/gnome/shell/extensions/mycroft/debug true',
]));
gulp.task('disable-debug', shell.task([
'dconf write /org/gnome/shell/extensions/mycroft/debug false',
]));
gulp.task('log', shell.task([
'journalctl /usr/bin/gnome-shell -f -o cat',
]));
gulp.task('test', function (cb) {
runSequence(
'lint',
cb
);
});
gulp.task('default', function () {
/* eslint-disable no-console, max-len */
console.log(
'\n' +
'Usage: gulp [COMMAND]\n' +
'\n' +
'Commands\n' +
'\n' +
'TEST\n' +
' lint Lint source files\n' +
' test Runs the test suite\n' +
'\n' +
'BUILD\n' +
' clean Cleans the build directory\n' +
' build Builds the extension\n' +
' watch Builds and watches the src directory for changes\n' +
'\n' +
'INSTALL\n' +
' install Installs the extension to\n' +
' ~/.local/share/gnome-shell/extensions/\n' +
' install-link Installs as symlink to build directory\n' +
' uninstall Uninstalls the extension\n' +
' reset-prefs Resets extension preferences\n' +
'\n' +
'PACKAGE\n' +
' dist Builds and packages the extension\n' +
' release Bumps/tags version and builds package\n' +
'\n' +
'DEBUG\n' +
' enable-debug Enables debug mode\n' +
' disable-debug Disables debug mode\n' +
' log Show journalctl logs \n'
);
/* eslint-esnable no-console, max-len */
});
|
import React from 'react';
import { Link } from 'react-router';
var HeaderButton = props => {
const { logged_in } = props;
const style = {
background: "#FAFAFA",
float: "right",
height: "100%",
}
return (
<div className="col btn btn-primary navbar-btn" style={style}>
{props.children}
</div>
)
}
export default HeaderButton;
|
#pragma strict
private var marginFromLeftRatio : float = 0.10;
private var marginFromTopRatio : float = 0.09;
private var marginBetweenButtonRatio : float = 0.10;
private var widthOfButtonRatio : float = 0.8;
private var heightOfButtonRatio : float = 0.08;
private var isClickedOneOfThem : boolean = false;
public var skinIPhone3 : GUISkin;
public var skinIPhone4 : GUISkin;
private var isIPhone4 : boolean = false;
function Start () {
isClickedOneOfThem = false;
isIPhone4 = (Screen.width > 500) ? true: false;
}
function OnGUI(){
GUI.skin = isIPhone4?skinIPhone4:skinIPhone3;
if(isClickedOneOfThem){
GUI.Label (Rect (Screen.width * 0.40, Screen.height * 0.45, Screen.width * 0.20, Screen.height * 0.1), "Loading...");
}
else{
if (GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * marginFromTopRatio, Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Static Joystick - Alwasy Visible - Linear - No Button")){
isClickedOneOfThem = true;
Application.LoadLevel("1 DemoSceneStaticJoystikNoExtraButton");
}
if( GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Dynamic Joystick - Alwasy Visible - Linear - No Button")){
isClickedOneOfThem = true;
Application.LoadLevel("2 DemoSceneDynamicJoystikNoExtraButton");
}
if(GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + 2 * marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Dynamic Joystick - Touch Visible - Linear - No Button")){
isClickedOneOfThem = true;
Application.LoadLevel("3 DemoSceneDynamicJoystikTouchVisibleNoExtraButton");
}
if(GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + 3 * marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Dynamic Joystick - Touch Visible - Cubic - No Button")){
isClickedOneOfThem = true;
Application.LoadLevel("4 DemoSceneDynamicJoystikTouchVisibleCubicNoExtraButtons");
}
if(GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + 4 * marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Dynamic Joystick - Touch Visible - Cubic - Two Buttons")){
isClickedOneOfThem = true;
Application.LoadLevel("5 DemoSceneDynamicJoystikTouchVisibleCubicTwoButtons");
}
if(GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + 5 * marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Dynamic Joystick - Touch Visible - Cubic - Four Buttons")){
isClickedOneOfThem = true;
Application.LoadLevel("6 DemoSceneDynamicJoystikTouchVisibleCubicFourButtons");
}
if(GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + 6 * marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), "Dynamic Joystick - Touch Visible - Exponential - Four Buttons")){
isClickedOneOfThem = true;
Application.LoadLevel("7 DemoSceneDynamicJoystikTouchVisibleExpFourButtons");
}
if(GUI.Button (new Rect (Screen.width * marginFromLeftRatio, Screen.height * (marginFromTopRatio + 7 * marginBetweenButtonRatio), Screen.width * widthOfButtonRatio, Screen.height * heightOfButtonRatio), " Two Dynamic Joysticks - Touch Visible - Exponential")){
isClickedOneOfThem = true;
Application.LoadLevel("8 DemoSceneDynamicTwoJoystikTouchVisibleNoExtraButton");
}
}
} |
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Mock"] = factory();
else
root["Mock"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/* global require, module, window */
var Handler = __webpack_require__(1)
var Util = __webpack_require__(3)
var Random = __webpack_require__(5)
var RE = __webpack_require__(20)
var toJSONSchema = __webpack_require__(23)
var valid = __webpack_require__(25)
var XHR
if (typeof window !== 'undefined') XHR = __webpack_require__(27)
/*!
Mock - ����� & �����
https://github.com/nuysoft/Mock
� mozhi.gyy@taobao.com nuysoft@gmail.com
*/
var Mock = {
Handler: Handler,
Random: Random,
Util: Util,
XHR: XHR,
RE: RE,
toJSONSchema: toJSONSchema,
valid: valid,
heredoc: Util.heredoc,
setup: function(settings) {
return XHR.setup(settings)
},
_mocked: {}
}
Mock.version = '1.0.1-beta3'
// ����ѭ������
if (XHR) XHR.Mock = Mock
/*
* Mock.mock( template )
* Mock.mock( function() )
* Mock.mock( rurl, template )
* Mock.mock( rurl, function(options) )
* Mock.mock( rurl, rtype, template )
* Mock.mock( rurl, rtype, function(options) )
��������ģ������ģ�����ݡ�
*/
Mock.mock = function(rurl, rtype, template) {
// Mock.mock(template)
if (arguments.length === 1) {
return Handler.gen(rurl)
}
// Mock.mock(rurl, template)
if (arguments.length === 2) {
template = rtype
rtype = undefined
}
// ���� XHR
if (XHR) window.XMLHttpRequest = XHR
Mock._mocked[rurl + (rtype || '')] = {
rurl: rurl,
rtype: rtype,
template: template
}
return Mock
}
module.exports = Mock
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/*
## Handler
��������ģ�塣
* Handler.gen( template, name?, context? )
��ڷ�����
* Data Template Definition, DTD
��������ģ�嶨�塣
* Handler.array( options )
* Handler.object( options )
* Handler.number( options )
* Handler.boolean( options )
* Handler.string( options )
* Handler.function( options )
* Handler.regexp( options )
����·������Ժ;��ԣ���
* Handler.getValueByKeyPath( key, options )
* Data Placeholder Definition, DPD
��������ռλ������
* Handler.placeholder( placeholder, context, templateContext, options )
*/
var Constant = __webpack_require__(2)
var Util = __webpack_require__(3)
var Parser = __webpack_require__(4)
var Random = __webpack_require__(5)
var RE = __webpack_require__(20)
var Handler = {
extend: Util.extend
}
/*
template ����ֵ��������ģ�壩
name ������
context ���������ģ����ɺ������
templateContext ģ�������ģ�
Handle.gen(template, name, options)
context
currentContext, templateCurrentContext,
path, templatePath
root, templateRoot
*/
Handler.gen = function(template, name, context) {
/* jshint -W041 */
name = name == undefined ? '' : (name + '')
context = context || {}
context = {
// ��ǰ����·����ֻ�������������������ɹ���
path: context.path || [Constant.GUID],
templatePath: context.templatePath || [Constant.GUID++],
// ��������ֵ��������
currentContext: context.currentContext,
// ����ֵģ���������
templateCurrentContext: context.templateCurrentContext || template,
// ����ֵ�ĸ�
root: context.root || context.currentContext,
// ģ��ĸ�
templateRoot: context.templateRoot || context.templateCurrentContext || template
}
// console.log('path:', context.path.join('.'), template)
var rule = Parser.parse(name)
var type = Util.type(template)
var data
if (Handler[type]) {
data = Handler[type]({
// ����ֵ����
type: type,
// ����ֵģ��
template: template,
// ������ + ���ɹ���
name: name,
// ������
parsedName: name ? name.replace(Constant.RE_KEY, '$1') : name,
// ����������ɹ���
rule: rule,
// ���������
context: context
})
if (!context.root) context.root = data
return data
}
return template
}
Handler.extend({
array: function(options) {
var result = [],
i, ii;
// 'name|1': []
// 'name|count': []
// 'name|min-max': []
if (options.template.length === 0) return result
// 'arr': [{ 'email': '@EMAIL' }, { 'email': '@EMAIL' }]
if (!options.rule.parameters) {
for (i = 0; i < options.template.length; i++) {
options.context.path.push(i)
options.context.templatePath.push(i)
result.push(
Handler.gen(options.template[i], i, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
)
options.context.path.pop()
options.context.templatePath.pop()
}
} else {
// 'method|1': ['GET', 'POST', 'HEAD', 'DELETE']
if (options.rule.min === 1 && options.rule.max === undefined) {
// fix #17
options.context.path.push(options.name)
options.context.templatePath.push(options.name)
result = Random.pick(
Handler.gen(options.template, undefined, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
)
options.context.path.pop()
options.context.templatePath.pop()
} else {
// 'data|+1': [{}, {}]
if (options.rule.parameters[2]) {
options.template.__order_index = options.template.__order_index || 0
options.context.path.push(options.name)
options.context.templatePath.push(options.name)
result = Handler.gen(options.template, undefined, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})[
options.template.__order_index % options.template.length
]
options.template.__order_index += +options.rule.parameters[2]
options.context.path.pop()
options.context.templatePath.pop()
} else {
// 'data|1-10': [{}]
for (i = 0; i < options.rule.count; i++) {
// 'data|1-10': [{}, {}]
for (ii = 0; ii < options.template.length; ii++) {
options.context.path.push(result.length)
options.context.templatePath.push(ii)
result.push(
Handler.gen(options.template[ii], result.length, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
)
options.context.path.pop()
options.context.templatePath.pop()
}
}
}
}
}
return result
},
object: function(options) {
var result = {},
keys, fnKeys, key, parsedKey, inc, i;
// 'obj|min-max': {}
/* jshint -W041 */
if (options.rule.min != undefined) {
keys = Util.keys(options.template)
keys = Random.shuffle(keys)
keys = keys.slice(0, options.rule.count)
for (i = 0; i < keys.length; i++) {
key = keys[i]
parsedKey = key.replace(Constant.RE_KEY, '$1')
options.context.path.push(parsedKey)
options.context.templatePath.push(key)
result[parsedKey] = Handler.gen(options.template[key], key, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
options.context.path.pop()
options.context.templatePath.pop()
}
} else {
// 'obj': {}
keys = []
fnKeys = [] // #25 �ı��˷Ǻ������Ե�˳��������������
for (key in options.template) {
(typeof options.template[key] === 'function' ? fnKeys : keys).push(key)
}
keys = keys.concat(fnKeys)
/*
��ı�Ǻ������Ե�˳��
keys = Util.keys(options.template)
keys.sort(function(a, b) {
var afn = typeof options.template[a] === 'function'
var bfn = typeof options.template[b] === 'function'
if (afn === bfn) return 0
if (afn && !bfn) return 1
if (!afn && bfn) return -1
})
*/
for (i = 0; i < keys.length; i++) {
key = keys[i]
parsedKey = key.replace(Constant.RE_KEY, '$1')
options.context.path.push(parsedKey)
options.context.templatePath.push(key)
result[parsedKey] = Handler.gen(options.template[key], key, {
path: options.context.path,
templatePath: options.context.templatePath,
currentContext: result,
templateCurrentContext: options.template,
root: options.context.root || result,
templateRoot: options.context.templateRoot || options.template
})
options.context.path.pop()
options.context.templatePath.pop()
// 'id|+1': 1
inc = key.match(Constant.RE_KEY)
if (inc && inc[2] && Util.type(options.template[key]) === 'number') {
options.template[key] += parseInt(inc[2], 10)
}
}
}
return result
},
number: function(options) {
var result, parts;
if (options.rule.decimal) { // float
options.template += ''
parts = options.template.split('.')
// 'float1|.1-10': 10,
// 'float2|1-100.1-10': 1,
// 'float3|999.1-10': 1,
// 'float4|.3-10': 123.123,
parts[0] = options.rule.range ? options.rule.count : parts[0]
parts[1] = (parts[1] || '').slice(0, options.rule.dcount)
while (parts[1].length < options.rule.dcount) {
parts[1] += (
// ���һλ����Ϊ 0��������һλΪ 0���ᱻ JS ������Ե�
(parts[1].length < options.rule.dcount - 1) ? Random.character('number') : Random.character('123456789')
)
}
result = parseFloat(parts.join('.'), 10)
} else { // integer
// 'grade1|1-100': 1,
result = options.rule.range && !options.rule.parameters[2] ? options.rule.count : options.template
}
return result
},
boolean: function(options) {
var result;
// 'prop|multiple': false, ��ǰֵ���෴ֵ�ĸ��ʱ���
// 'prop|probability-probability': false, ��ǰֵ���෴ֵ�ĸ���
result = options.rule.parameters ? Random.bool(options.rule.min, options.rule.max, options.template) : options.template
return result
},
string: function(options) {
var result = '',
i, placeholders, ph, phed;
if (options.template.length) {
// 'foo': '��',
/* jshint -W041 */
if (options.rule.count == undefined) {
result += options.template
}
// 'star|1-5': '��',
for (i = 0; i < options.rule.count; i++) {
result += options.template
}
// 'email|1-10': '@EMAIL, ',
placeholders = result.match(Constant.RE_PLACEHOLDER) || [] // A-Z_0-9 > \w_
for (i = 0; i < placeholders.length; i++) {
ph = placeholders[i]
// ����ת��б�ܣ�����Ҫ����ռλ��
if (/^\\/.test(ph)) {
placeholders.splice(i--, 1)
continue
}
phed = Handler.placeholder(ph, options.context.currentContext, options.context.templateCurrentContext, options)
// ֻ��һ��ռλ��������û�������ַ�
if (placeholders.length === 1 && ph === result && typeof phed !== typeof result) { //
result = phed
break
if (Util.isNumeric(phed)) {
result = parseFloat(phed, 10)
break
}
if (/^(true|false)$/.test(phed)) {
result = phed === 'true' ? true :
phed === 'false' ? false :
phed // �Ѿ��Dz���ֵ
break
}
}
result = result.replace(ph, phed)
}
} else {
// 'ASCII|1-10': '',
// 'ASCII': '',
result = options.rule.range ? Random.string(options.rule.count) : options.template
}
return result
},
'function': function(options) {
// ( context, options )
return options.template.call(options.context.currentContext, options)
},
'regexp': function(options) {
var source = ''
// 'name': /regexp/,
/* jshint -W041 */
if (options.rule.count == undefined) {
source += options.template.source // regexp.source
}
// 'name|1-5': /regexp/,
for (var i = 0; i < options.rule.count; i++) {
source += options.template.source
}
return RE.Handler.gen(
RE.Parser.parse(
source
)
)
}
})
Handler.extend({
_all: function() {
var re = {};
for (var key in Random) re[key.toLowerCase()] = key
return re
},
// ����ռλ����ת��Ϊ����ֵ
placeholder: function(placeholder, obj, templateContext, options) {
// console.log(options.context.path)
// 1 key, 2 params
Constant.RE_PLACEHOLDER.exec('')
var parts = Constant.RE_PLACEHOLDER.exec(placeholder),
key = parts && parts[1],
lkey = key && key.toLowerCase(),
okey = this._all()[lkey],
params = parts && parts[2] || ''
var pathParts = this.splitPathToArray(key)
// ����ռλ���IJ���
try {
// 1. ���Ա��ֲ���������
/*
#24 [Window Firefox 30.0 ���� ռλ�� �״�](https://github.com/nuysoft/Mock/issues/24)
[BX9056: ��������� window.eval ������ִ�������Ĵ��ڲ���](http://www.w3help.org/zh-cn/causes/BX9056)
Ӧ������ Window Firefox 30.0 �� BUG
*/
/* jshint -W061 */
params = eval('(function(){ return [].splice.call(arguments, 0 ) })(' + params + ')')
} catch (error) {
// 2. ���ʧ�ܣ�ֻ�ܽ���Ϊ�ַ���
// console.error(error)
// if (error instanceof ReferenceError) params = parts[2].split(/,\s*/);
// else throw error
params = parts[2].split(/,\s*/)
}
// ռλ��������������ģ���е�����
if (obj && (key in obj)) return obj[key]
// @index @key
// if (Constant.RE_INDEX.test(key)) return +options.name
// if (Constant.RE_KEY.test(key)) return options.name
// ����·�� or ���·��
if (
key.charAt(0) === '/' ||
pathParts.length > 1
) return this.getValueByKeyPath(key, options)
// �ݹ���������ģ���е�����
if (templateContext &&
(typeof templateContext === 'object') &&
(key in templateContext) &&
(placeholder !== templateContext[key]) // fix #15 �����Լ������Լ�
) {
// �ȼ��㱻���õ�����ֵ
templateContext[key] = Handler.gen(templateContext[key], key, {
currentContext: obj,
templateCurrentContext: templateContext
})
return templateContext[key]
}
// ���δ�ҵ�����ԭ������
if (!(key in Random) && !(lkey in Random) && !(okey in Random)) return placeholder
// �ݹ���������е�ռλ��
for (var i = 0; i < params.length; i++) {
Constant.RE_PLACEHOLDER.exec('')
if (Constant.RE_PLACEHOLDER.test(params[i])) {
params[i] = Handler.placeholder(params[i], obj, templateContext, options)
}
}
var handle = Random[key] || Random[lkey] || Random[okey]
switch (Util.type(handle)) {
case 'array':
// �Զ���������ȡһ�������� @areas
return Random.pick(handle)
case 'function':
// ִ��ռλ������������������
handle.options = options
var re = handle.apply(Random, params)
if (re === undefined) re = '' // ��Ϊ�����ַ����У�����Ĭ��Ϊ���ַ�����
delete handle.options
return re
}
},
getValueByKeyPath: function(key, options) {
var originalKey = key
var keyPathParts = this.splitPathToArray(key)
var absolutePathParts = []
// ����·��
if (key.charAt(0) === '/') {
absolutePathParts = [options.context.path[0]].concat(
this.normalizePath(keyPathParts)
)
} else {
// ���·��
if (keyPathParts.length > 1) {
absolutePathParts = options.context.path.slice(0)
absolutePathParts.pop()
absolutePathParts = this.normalizePath(
absolutePathParts.concat(keyPathParts)
)
}
}
key = keyPathParts[keyPathParts.length - 1]
var currentContext = options.context.root
var templateCurrentContext = options.context.templateRoot
for (var i = 1; i < absolutePathParts.length - 1; i++) {
currentContext = currentContext[absolutePathParts[i]]
templateCurrentContext = templateCurrentContext[absolutePathParts[i]]
}
// ���õ�ֵ�Ѿ������
if (currentContext && (key in currentContext)) return currentContext[key]
// ��δ���㣬�ݹ���������ģ���е�����
if (templateCurrentContext &&
(typeof templateCurrentContext === 'object') &&
(key in templateCurrentContext) &&
(originalKey !== templateCurrentContext[key]) // fix #15 �����Լ������Լ�
) {
// �ȼ��㱻���õ�����ֵ
templateCurrentContext[key] = Handler.gen(templateCurrentContext[key], key, {
currentContext: currentContext,
templateCurrentContext: templateCurrentContext
})
return templateCurrentContext[key]
}
},
// https://github.com/kissyteam/kissy/blob/master/src/path/src/path.js
normalizePath: function(pathParts) {
var newPathParts = []
for (var i = 0; i < pathParts.length; i++) {
switch (pathParts[i]) {
case '..':
newPathParts.pop()
break
case '.':
break
default:
newPathParts.push(pathParts[i])
}
}
return newPathParts
},
splitPathToArray: function(path) {
var parts = path.split(/\/+/);
if (!parts[parts.length - 1]) parts = parts.slice(0, -1)
if (!parts[0]) parts = parts.slice(1)
return parts;
}
})
module.exports = Handler
/***/ },
/* 2 */
/***/ function(module, exports) {
/*
## Constant
�������ϡ�
*/
/*
RE_KEY
'name|min-max': value
'name|count': value
'name|min-max.dmin-dmax': value
'name|min-max.dcount': value
'name|count.dmin-dmax': value
'name|count.dcount': value
'name|+step': value
1 name, 2 step, 3 range [ min, max ], 4 drange [ dmin, dmax ]
RE_PLACEHOLDER
placeholder(*)
[����鿴����](http://www.regexper.com/)
#26 ���ɹ��� ֧�� ���������� number|-100-100
*/
module.exports = {
GUID: 1,
RE_KEY: /(.+)\|(?:\+(\d+)|([\+\-]?\d+-?[\+\-]?\d*)?(?:\.(\d+-?\d*))?)/,
RE_RANGE: /([\+\-]?\d+)-?([\+\-]?\d+)?/,
RE_PLACEHOLDER: /\\*@([^@#%&()\?\s]+)(?:\((.*?)\))?/g
// /\\*@([^@#%&()\?\s\/\.]+)(?:\((.*?)\))?/g
// RE_INDEX: /^index$/,
// RE_KEY: /^key$/
}
/***/ },
/* 3 */
/***/ function(module, exports) {
/*
## Utilities
*/
var Util = {}
Util.extend = function extend() {
var target = arguments[0] || {},
i = 1,
length = arguments.length,
options, name, src, copy, clone
if (length === 1) {
target = this
i = 0
}
for (; i < length; i++) {
options = arguments[i]
if (!options) continue
for (name in options) {
src = target[name]
copy = options[name]
if (target === copy) continue
if (copy === undefined) continue
if (Util.isArray(copy) || Util.isObject(copy)) {
if (Util.isArray(copy)) clone = src && Util.isArray(src) ? src : []
if (Util.isObject(copy)) clone = src && Util.isObject(src) ? src : {}
target[name] = Util.extend(clone, copy)
} else {
target[name] = copy
}
}
}
return target
}
Util.each = function each(obj, iterator, context) {
var i, key
if (this.type(obj) === 'number') {
for (i = 0; i < obj; i++) {
iterator(i, i)
}
} else if (obj.length === +obj.length) {
for (i = 0; i < obj.length; i++) {
if (iterator.call(context, obj[i], i, obj) === false) break
}
} else {
for (key in obj) {
if (iterator.call(context, obj[key], key, obj) === false) break
}
}
}
Util.type = function type(obj) {
return (obj === null || obj === undefined) ? String(obj) : Object.prototype.toString.call(obj).match(/\[object (\w+)\]/)[1].toLowerCase()
}
Util.each('String Object Array RegExp Function'.split(' '), function(value) {
Util['is' + value] = function(obj) {
return Util.type(obj) === value.toLowerCase()
}
})
Util.isObjectOrArray = function(value) {
return Util.isObject(value) || Util.isArray(value)
}
Util.isNumeric = function(value) {
return !isNaN(parseFloat(value)) && isFinite(value)
}
Util.keys = function(obj) {
var keys = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) keys.push(key)
}
return keys;
}
Util.values = function(obj) {
var values = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) values.push(obj[key])
}
return values;
}
/*
### Mock.heredoc(fn)
* Mock.heredoc(fn)
��ֱ�ۡ���ȫ�ķ�ʽ��д�����У�HTML ģ�塣
**ʹ��ʾ��**������ʾ��
var tpl = Mock.heredoc(function() {
/*!
{{email}}{{age}}
<!-- Mock {
email: '@EMAIL',
age: '@INT(1,100)'
} -->
*\/
})
**�����**
* [Creating multiline strings in JavaScript](http://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript)��
*/
Util.heredoc = function heredoc(fn) {
// 1. �Ƴ���ʼ�� function(){ /*!
// 2. �Ƴ�ĩβ�� */ }
// 3. �Ƴ���ʼ��ĩβ�Ŀո�
return fn.toString()
.replace(/^[^\/]+\/\*!?/, '')
.replace(/\*\/[^\/]+$/, '')
.replace(/^[\s\xA0]+/, '').replace(/[\s\xA0]+$/, '') // .trim()
}
Util.noop = function() {}
module.exports = Util
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
/*
## Parser
��������ģ�壨���������֣���
* Parser.parse( name )
```json
{
parameters: [ name, inc, range, decimal ],
rnage: [ min , max ],
min: min,
max: max,
count : count,
decimal: decimal,
dmin: dmin,
dmax: dmax,
dcount: dcount
}
```
*/
var Constant = __webpack_require__(2)
var Random = __webpack_require__(5)
/* jshint -W041 */
module.exports = {
parse: function(name) {
name = name == undefined ? '' : (name + '')
var parameters = (name || '').match(Constant.RE_KEY)
var range = parameters && parameters[3] && parameters[3].match(Constant.RE_RANGE)
var min = range && range[1] && parseInt(range[1], 10) // || 1
var max = range && range[2] && parseInt(range[2], 10) // || 1
// repeat || min-max || 1
// var count = range ? !range[2] && parseInt(range[1], 10) || Random.integer(min, max) : 1
var count = range ? !range[2] ? parseInt(range[1], 10) : Random.integer(min, max) : undefined
var decimal = parameters && parameters[4] && parameters[4].match(Constant.RE_RANGE)
var dmin = decimal && decimal[1] && parseInt(decimal[1], 10) // || 0,
var dmax = decimal && decimal[2] && parseInt(decimal[2], 10) // || 0,
// int || dmin-dmax || 0
var dcount = decimal ? !decimal[2] && parseInt(decimal[1], 10) || Random.integer(dmin, dmax) : undefined
var result = {
// 1 name, 2 inc, 3 range, 4 decimal
parameters: parameters,
// 1 min, 2 max
range: range,
min: min,
max: max,
// min-max
count: count,
// �Ƿ��� decimal
decimal: decimal,
dmin: dmin,
dmax: dmax,
// dmin-dimax
dcount: dcount
}
for (var r in result) {
if (result[r] != undefined) return result
}
return {}
}
}
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/*
## Mock.Random
�����࣬�������ɸ���������ݡ�
*/
var Util = __webpack_require__(3)
var Random = {
extend: Util.extend
}
Random.extend(__webpack_require__(6))
Random.extend(__webpack_require__(7))
Random.extend(__webpack_require__(8))
Random.extend(__webpack_require__(10))
Random.extend(__webpack_require__(13))
Random.extend(__webpack_require__(15))
Random.extend(__webpack_require__(16))
Random.extend(__webpack_require__(17))
Random.extend(__webpack_require__(14))
Random.extend(__webpack_require__(19))
module.exports = Random
/***/ },
/* 6 */
/***/ function(module, exports) {
/*
## Basics
*/
module.exports = {
// ����һ������IJ���ֵ��
boolean: function(min, max, cur) {
if (cur !== undefined) {
min = typeof min !== 'undefined' && !isNaN(min) ? parseInt(min, 10) : 1
max = typeof max !== 'undefined' && !isNaN(max) ? parseInt(max, 10) : 1
return Math.random() > 1.0 / (min + max) * min ? !cur : cur
}
return Math.random() >= 0.5
},
bool: function(min, max, cur) {
return this.boolean(min, max, cur)
},
// ����һ���������Ȼ�������ڵ��� 0 ����������
natural: function(min, max) {
min = typeof min !== 'undefined' ? parseInt(min, 10) : 0
max = typeof max !== 'undefined' ? parseInt(max, 10) : 9007199254740992 // 2^53
return Math.round(Math.random() * (max - min)) + min
},
// ����һ�������������
integer: function(min, max) {
min = typeof min !== 'undefined' ? parseInt(min, 10) : -9007199254740992
max = typeof max !== 'undefined' ? parseInt(max, 10) : 9007199254740992 // 2^53
return Math.round(Math.random() * (max - min)) + min
},
int: function(min, max) {
return this.integer(min, max)
},
// ����һ������ĸ�������
float: function(min, max, dmin, dmax) {
dmin = dmin === undefined ? 0 : dmin
dmin = Math.max(Math.min(dmin, 17), 0)
dmax = dmax === undefined ? 17 : dmax
dmax = Math.max(Math.min(dmax, 17), 0)
var ret = this.integer(min, max) + '.';
for (var i = 0, dcount = this.natural(dmin, dmax); i < dcount; i++) {
ret += (
// ���һλ����Ϊ 0��������һλΪ 0���ᱻ JS ������Ե�
(i < dcount - 1) ? this.character('number') : this.character('123456789')
)
}
return parseFloat(ret, 10)
},
// ����һ������ַ���
character: function(pool) {
var pools = {
lower: 'abcdefghijklmnopqrstuvwxyz',
upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
number: '0123456789',
symbol: '!@#$%^&*()[]'
}
pools.alpha = pools.lower + pools.upper
pools['undefined'] = pools.lower + pools.upper + pools.number + pools.symbol
pool = pools[('' + pool).toLowerCase()] || pool
return pool.charAt(this.natural(0, pool.length - 1))
},
char: function(pool) {
return this.character(pool)
},
// ����һ������ַ�����
string: function(pool, min, max) {
var len
switch (arguments.length) {
case 0: // ()
len = this.natural(3, 7)
break
case 1: // ( length )
len = pool
pool = undefined
break
case 2:
// ( pool, length )
if (typeof arguments[0] === 'string') {
len = min
} else {
// ( min, max )
len = this.natural(pool, min)
pool = undefined
}
break
case 3:
len = this.natural(min, max)
break
}
var text = ''
for (var i = 0; i < len; i++) {
text += this.character(pool)
}
return text
},
str: function( /*pool, min, max*/ ) {
return this.string.apply(this, arguments)
},
// ����һ���������顣
range: function(start, stop, step) {
// range( stop )
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
// range( start, stop )
step = arguments[2] || 1;
start = +start
stop = +stop
step = +step
var len = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(len);
while (idx < len) {
range[idx++] = start;
start += step;
}
return range;
}
}
/***/ },
/* 7 */
/***/ function(module, exports) {
/*
## Date
*/
var patternLetters = {
yyyy: 'getFullYear',
yy: function(date) {
return ('' + date.getFullYear()).slice(2)
},
y: 'yy',
MM: function(date) {
var m = date.getMonth() + 1
return m < 10 ? '0' + m : m
},
M: function(date) {
return date.getMonth() + 1
},
dd: function(date) {
var d = date.getDate()
return d < 10 ? '0' + d : d
},
d: 'getDate',
HH: function(date) {
var h = date.getHours()
return h < 10 ? '0' + h : h
},
H: 'getHours',
hh: function(date) {
var h = date.getHours() % 12
return h < 10 ? '0' + h : h
},
h: function(date) {
return date.getHours() % 12
},
mm: function(date) {
var m = date.getMinutes()
return m < 10 ? '0' + m : m
},
m: 'getMinutes',
ss: function(date) {
var s = date.getSeconds()
return s < 10 ? '0' + s : s
},
s: 'getSeconds',
SS: function(date) {
var ms = date.getMilliseconds()
return ms < 10 && '00' + ms || ms < 100 && '0' + ms || ms
},
S: 'getMilliseconds',
A: function(date) {
return date.getHours() < 12 ? 'AM' : 'PM'
},
a: function(date) {
return date.getHours() < 12 ? 'am' : 'pm'
},
T: 'getTime'
}
module.exports = {
// ����ռλ�����ϡ�
_patternLetters: patternLetters,
// ����ռλ������
_rformat: new RegExp((function() {
var re = []
for (var i in patternLetters) re.push(i)
return '(' + re.join('|') + ')'
})(), 'g'),
// ��ʽ�����ڡ�
_formatDate: function(date, format) {
return format.replace(this._rformat, function creatNewSubString($0, flag) {
return typeof patternLetters[flag] === 'function' ? patternLetters[flag](date) :
patternLetters[flag] in patternLetters ? creatNewSubString($0, patternLetters[flag]) :
date[patternLetters[flag]]()
})
},
// ����һ������� Date ����
_randomDate: function(min, max) { // min, max
min = min === undefined ? new Date(0) : min
max = max === undefined ? new Date() : max
return new Date(Math.random() * (max.getTime() - min.getTime()))
},
// ����һ������������ַ�����
date: function(format) {
format = format || 'yyyy-MM-dd'
return this._formatDate(this._randomDate(), format)
},
// ����һ�������ʱ���ַ�����
time: function(format) {
format = format || 'HH:mm:ss'
return this._formatDate(this._randomDate(), format)
},
// ����һ����������ں�ʱ���ַ�����
datetime: function(format) {
format = format || 'yyyy-MM-dd HH:mm:ss'
return this._formatDate(this._randomDate(), format)
},
// ���ص�ǰ�����ں�ʱ���ַ�����
now: function(unit, format) {
// now(unit) now(format)
if (arguments.length === 1) {
// now(format)
if (!/year|month|day|hour|minute|second|week/.test(unit)) {
format = unit
unit = ''
}
}
unit = (unit || '').toLowerCase()
format = format || 'yyyy-MM-dd HH:mm:ss'
var date = new Date()
/* jshint -W086 */
// ��� http://momentjs.cn/docs/#/manipulating/start-of/
switch (unit) {
case 'year':
date.setMonth(0)
case 'month':
date.setDate(1)
case 'week':
case 'day':
date.setHours(0)
case 'hour':
date.setMinutes(0)
case 'minute':
date.setSeconds(0)
case 'second':
date.setMilliseconds(0)
}
switch (unit) {
case 'week':
date.setDate(date.getDate() - date.getDay())
}
return this._formatDate(date, format)
}
}
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {/* global document */
/*
## Image
*/
module.exports = {
// ���������
_adSize: [
'300x250', '250x250', '240x400', '336x280', '180x150',
'720x300', '468x60', '234x60', '88x31', '120x90',
'120x60', '120x240', '125x125', '728x90', '160x600',
'120x600', '300x600'
],
// �����������
_screenSize: [
'320x200', '320x240', '640x480', '800x480', '800x480',
'1024x600', '1024x768', '1280x800', '1440x900', '1920x1200',
'2560x1600'
],
// ��������Ƶ���
_videoSize: ['720x480', '768x576', '1280x720', '1920x1080'],
/*
����һ�������ͼƬ��ַ��
���ͼƬԴ
http://fpoimg.com/
���
http://rensanning.iteye.com/blog/1933310
http://code.tutsplus.com/articles/the-top-8-placeholders-for-web-designers--net-19485
*/
image: function(size, background, foreground, format, text) {
// Random.image( size, background, foreground, text )
if (arguments.length === 4) {
text = format
format = undefined
}
// Random.image( size, background, text )
if (arguments.length === 3) {
text = foreground
foreground = undefined
}
// Random.image()
if (!size) size = this.pick(this._adSize)
if (background && ~background.indexOf('#')) background = background.slice(1)
if (foreground && ~foreground.indexOf('#')) foreground = foreground.slice(1)
// http://dummyimage.com/600x400/cc00cc/470047.png&text=hello
return 'http://dummyimage.com/' + size +
(background ? '/' + background : '') +
(foreground ? '/' + foreground : '') +
(format ? '.' + format : '') +
(text ? '&text=' + text : '')
},
img: function() {
return this.image.apply(this, arguments)
},
/*
BrandColors
http://brandcolors.net/
A collection of major brand color codes curated by Galen Gidman.
���ƹ�˾����ɫ����
// ��ȡƷ�ƺ���ɫ
$('h2').each(function(index, item){
item = $(item)
console.log('\'' + item.text() + '\'', ':', '\'' + item.next().text() + '\'', ',')
})
*/
_brandColors: {
'4ormat': '#fb0a2a',
'500px': '#02adea',
'About.me (blue)': '#00405d',
'About.me (yellow)': '#ffcc33',
'Addvocate': '#ff6138',
'Adobe': '#ff0000',
'Aim': '#fcd20b',
'Amazon': '#e47911',
'Android': '#a4c639',
'Angie\'s List': '#7fbb00',
'AOL': '#0060a3',
'Atlassian': '#003366',
'Behance': '#053eff',
'Big Cartel': '#97b538',
'bitly': '#ee6123',
'Blogger': '#fc4f08',
'Boeing': '#0039a6',
'Booking.com': '#003580',
'Carbonmade': '#613854',
'Cheddar': '#ff7243',
'Code School': '#3d4944',
'Delicious': '#205cc0',
'Dell': '#3287c1',
'Designmoo': '#e54a4f',
'Deviantart': '#4e6252',
'Designer News': '#2d72da',
'Devour': '#fd0001',
'DEWALT': '#febd17',
'Disqus (blue)': '#59a3fc',
'Disqus (orange)': '#db7132',
'Dribbble': '#ea4c89',
'Dropbox': '#3d9ae8',
'Drupal': '#0c76ab',
'Dunked': '#2a323a',
'eBay': '#89c507',
'Ember': '#f05e1b',
'Engadget': '#00bdf6',
'Envato': '#528036',
'Etsy': '#eb6d20',
'Evernote': '#5ba525',
'Fab.com': '#dd0017',
'Facebook': '#3b5998',
'Firefox': '#e66000',
'Flickr (blue)': '#0063dc',
'Flickr (pink)': '#ff0084',
'Forrst': '#5b9a68',
'Foursquare': '#25a0ca',
'Garmin': '#007cc3',
'GetGlue': '#2d75a2',
'Gimmebar': '#f70078',
'GitHub': '#171515',
'Google Blue': '#0140ca',
'Google Green': '#16a61e',
'Google Red': '#dd1812',
'Google Yellow': '#fcca03',
'Google+': '#dd4b39',
'Grooveshark': '#f77f00',
'Groupon': '#82b548',
'Hacker News': '#ff6600',
'HelloWallet': '#0085ca',
'Heroku (light)': '#c7c5e6',
'Heroku (dark)': '#6567a5',
'HootSuite': '#003366',
'Houzz': '#73ba37',
'HTML5': '#ec6231',
'IKEA': '#ffcc33',
'IMDb': '#f3ce13',
'Instagram': '#3f729b',
'Intel': '#0071c5',
'Intuit': '#365ebf',
'Kickstarter': '#76cc1e',
'kippt': '#e03500',
'Kodery': '#00af81',
'LastFM': '#c3000d',
'LinkedIn': '#0e76a8',
'Livestream': '#cf0005',
'Lumo': '#576396',
'Mixpanel': '#a086d3',
'Meetup': '#e51937',
'Nokia': '#183693',
'NVIDIA': '#76b900',
'Opera': '#cc0f16',
'Path': '#e41f11',
'PayPal (dark)': '#1e477a',
'PayPal (light)': '#3b7bbf',
'Pinboard': '#0000e6',
'Pinterest': '#c8232c',
'PlayStation': '#665cbe',
'Pocket': '#ee4056',
'Prezi': '#318bff',
'Pusha': '#0f71b4',
'Quora': '#a82400',
'QUOTE.fm': '#66ceff',
'Rdio': '#008fd5',
'Readability': '#9c0000',
'Red Hat': '#cc0000',
'Resource': '#7eb400',
'Rockpack': '#0ba6ab',
'Roon': '#62b0d9',
'RSS': '#ee802f',
'Salesforce': '#1798c1',
'Samsung': '#0c4da2',
'Shopify': '#96bf48',
'Skype': '#00aff0',
'Snagajob': '#f47a20',
'Softonic': '#008ace',
'SoundCloud': '#ff7700',
'Space Box': '#f86960',
'Spotify': '#81b71a',
'Sprint': '#fee100',
'Squarespace': '#121212',
'StackOverflow': '#ef8236',
'Staples': '#cc0000',
'Status Chart': '#d7584f',
'Stripe': '#008cdd',
'StudyBlue': '#00afe1',
'StumbleUpon': '#f74425',
'T-Mobile': '#ea0a8e',
'Technorati': '#40a800',
'The Next Web': '#ef4423',
'Treehouse': '#5cb868',
'Trulia': '#5eab1f',
'Tumblr': '#34526f',
'Twitch.tv': '#6441a5',
'Twitter': '#00acee',
'TYPO3': '#ff8700',
'Ubuntu': '#dd4814',
'Ustream': '#3388ff',
'Verizon': '#ef1d1d',
'Vimeo': '#86c9ef',
'Vine': '#00a478',
'Virb': '#06afd8',
'Virgin Media': '#cc0000',
'Wooga': '#5b009c',
'WordPress (blue)': '#21759b',
'WordPress (orange)': '#d54e21',
'WordPress (grey)': '#464646',
'Wunderlist': '#2b88d9',
'XBOX': '#9bc848',
'XING': '#126567',
'Yahoo!': '#720e9e',
'Yandex': '#ffcc00',
'Yelp': '#c41200',
'YouTube': '#c4302b',
'Zalongo': '#5498dc',
'Zendesk': '#78a300',
'Zerply': '#9dcc7a',
'Zootool': '#5e8b1d'
},
_brandNames: function() {
var brands = [];
for (var b in this._brandColors) {
brands.push(b)
}
return brands
},
/*
����һ������� Base64 ͼƬ���롣
https://github.com/imsky/holder
Holder renders image placeholders entirely on the client side.
dataImageHolder: function(size) {
return 'holder.js/' + size
},
*/
dataImage: function(size, text) {
var canvas
if (typeof document !== 'undefined') {
canvas = document.createElement('canvas')
} else {
/*
https://github.com/Automattic/node-canvas
npm install canvas --save
��װ���⣺
* http://stackoverflow.com/questions/22953206/gulp-issues-with-cario-install-command-not-found-when-trying-to-installing-canva
* https://github.com/Automattic/node-canvas/issues/415
* https://github.com/Automattic/node-canvas/wiki/_pages
PS��node-canvas �İ�װ����ʵ����̫�����ˣ����Բ����� package.json �� dependencies��
*/
var Canvas = module.require('canvas')
canvas = new Canvas()
}
var ctx = canvas && canvas.getContext && canvas.getContext("2d")
if (!canvas || !ctx) return ''
if (!size) size = this.pick(this._adSize)
text = text !== undefined ? text : size
size = size.split('x')
var width = parseInt(size[0], 10),
height = parseInt(size[1], 10),
background = this._brandColors[this.pick(this._brandNames())],
foreground = '#FFF',
text_height = 14,
font = 'sans-serif';
canvas.width = width
canvas.height = height
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.fillStyle = background
ctx.fillRect(0, 0, width, height)
ctx.fillStyle = foreground
ctx.font = 'bold ' + text_height + 'px ' + font
ctx.fillText(text, (width / 2), (height / 2), width)
return canvas.toDataURL('image/png')
}
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9)(module)))
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
/*
## Color
http://llllll.li/randomColor/
A color generator for JavaScript.
randomColor generates attractive colors by default. More specifically, randomColor produces bright colors with a reasonably high saturation. This makes randomColor particularly useful for data visualizations and generative art.
http://randomcolour.com/
var bg_colour = Math.floor(Math.random() * 16777215).toString(16);
bg_colour = "#" + ("000000" + bg_colour).slice(-6);
document.bgColor = bg_colour;
http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
Creating random colors is actually more difficult than it seems. The randomness itself is easy, but aesthetically pleasing randomness is more difficult.
https://github.com/devongovett/color-generator
http://www.paulirish.com/2009/random-hex-color-code-snippets/
Random Hex Color Code Generator in JavaScript
http://chancejs.com/#color
chance.color()
// => '#79c157'
chance.color({format: 'hex'})
// => '#d67118'
chance.color({format: 'shorthex'})
// => '#60f'
chance.color({format: 'rgb'})
// => 'rgb(110,52,164)'
http://tool.c7sky.com/webcolor
��ҳ��Ƴ���ɫ�ʴ����
https://github.com/One-com/one-color
An OO-based JavaScript color parser/computation toolkit with support for RGB, HSV, HSL, CMYK, and alpha channels.
API ����
https://github.com/harthur/color
JavaScript color conversion and manipulation library
https://github.com/leaverou/css-colors
Share & convert CSS colors
http://leaverou.github.io/css-colors/#slategray
Type a CSS color keyword, #hex, hsl(), rgba(), whatever:
ɫ�� hue
http://baike.baidu.com/view/23368.htm
ɫ��ָ����һ�����л���ɫ�ʵ����������Ǵ��ɫ��Ч����
���Ͷ� saturation
http://baike.baidu.com/view/189644.htm
���Ͷ���ָɫ�ʵ����̶ȣ�Ҳ��ɫ�ʵĴ��ȡ����Ͷ�ȡ���ڸ�ɫ�к�ɫ�ɷֺ���ɫ�ɷ֣���ɫ���ı�������ɫ�ɷ�Խ���Ͷ�Խ����ɫ�ɷ�Խ���Ͷ�ԽС��
���� brightness
http://baike.baidu.com/view/34773.htm
������ָ�����壨�����壩���淢�⣨���⣩ǿ������������
�ն� luminosity
���屻�����ij̶�,���õ�λ��������ܵĹ�ͨ������ʾ,��ʾ��λΪ��[��˹](Lux,lx) ,�� 1m / m2 ��
http://stackoverflow.com/questions/1484506/random-color-generator-in-javascript
var letters = '0123456789ABCDEF'.split('')
var color = '#'
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)]
}
return color
// �������һ�����Ե���ɫ����ʽΪ '#RRGGBB'��
// _brainlessColor()
var color = Math.floor(
Math.random() *
(16 * 16 * 16 * 16 * 16 * 16 - 1)
).toString(16)
color = "#" + ("000000" + color).slice(-6)
return color.toUpperCase()
*/
var Convert = __webpack_require__(11)
var DICT = __webpack_require__(12)
module.exports = {
// �������һ��������������ɫ����ʽΪ '#RRGGBB'��
color: function(name) {
if (name || DICT[name]) return DICT[name].nicer
return this.hex()
},
// #DAC0DE
hex: function() {
var hsv = this._goldenRatioColor()
var rgb = Convert.hsv2rgb(hsv)
var hex = Convert.rgb2hex(rgb[0], rgb[1], rgb[2])
return hex
},
// rgb(128,255,255)
rgb: function() {
var hsv = this._goldenRatioColor()
var rgb = Convert.hsv2rgb(hsv)
return 'rgb(' +
parseInt(rgb[0], 10) + ', ' +
parseInt(rgb[1], 10) + ', ' +
parseInt(rgb[2], 10) + ')'
},
// rgba(128,255,255,0.3)
rgba: function() {
var hsv = this._goldenRatioColor()
var rgb = Convert.hsv2rgb(hsv)
return 'rgba(' +
parseInt(rgb[0], 10) + ', ' +
parseInt(rgb[1], 10) + ', ' +
parseInt(rgb[2], 10) + ', ' +
Math.random().toFixed(2) + ')'
},
// hsl(300,80%,90%)
hsl: function() {
var hsv = this._goldenRatioColor()
var hsl = Convert.hsv2hsl(hsv)
return 'hsl(' +
parseInt(hsl[0], 10) + ', ' +
parseInt(hsl[1], 10) + ', ' +
parseInt(hsl[2], 10) + ')'
},
// http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
// https://github.com/devongovett/color-generator/blob/master/index.js
// �������һ��������������ɫ��
_goldenRatioColor: function(saturation, value) {
this._goldenRatio = 0.618033988749895
this._hue = this._hue || Math.random()
this._hue += this._goldenRatio
this._hue %= 1
if (typeof saturation !== "number") saturation = 0.5;
if (typeof value !== "number") value = 0.95;
return [
this._hue * 360,
saturation * 100,
value * 100
]
}
}
/***/ },
/* 11 */
/***/ function(module, exports) {
/*
## Color Convert
http://blog.csdn.net/idfaya/article/details/6770414
��ɫ�ռ�RGB��HSV(HSL)��ת��
*/
// https://github.com/harthur/color-convert/blob/master/conversions.js
module.exports = {
rgb2hsl: function rgb2hsl(rgb) {
var r = rgb[0] / 255,
g = rgb[1] / 255,
b = rgb[2] / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
delta = max - min,
h, s, l;
if (max == min)
h = 0;
else if (r == max)
h = (g - b) / delta;
else if (g == max)
h = 2 + (b - r) / delta;
else if (b == max)
h = 4 + (r - g) / delta;
h = Math.min(h * 60, 360);
if (h < 0)
h += 360;
l = (min + max) / 2;
if (max == min)
s = 0;
else if (l <= 0.5)
s = delta / (max + min);
else
s = delta / (2 - max - min);
return [h, s * 100, l * 100];
},
rgb2hsv: function rgb2hsv(rgb) {
var r = rgb[0],
g = rgb[1],
b = rgb[2],
min = Math.min(r, g, b),
max = Math.max(r, g, b),
delta = max - min,
h, s, v;
if (max === 0)
s = 0;
else
s = (delta / max * 1000) / 10;
if (max == min)
h = 0;
else if (r == max)
h = (g - b) / delta;
else if (g == max)
h = 2 + (b - r) / delta;
else if (b == max)
h = 4 + (r - g) / delta;
h = Math.min(h * 60, 360);
if (h < 0)
h += 360;
v = ((max / 255) * 1000) / 10;
return [h, s, v];
},
hsl2rgb: function hsl2rgb(hsl) {
var h = hsl[0] / 360,
s = hsl[1] / 100,
l = hsl[2] / 100,
t1, t2, t3, rgb, val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5)
t2 = l * (1 + s);
else
t2 = l + s - l * s;
t1 = 2 * l - t2;
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) t3++;
if (t3 > 1) t3--;
if (6 * t3 < 1)
val = t1 + (t2 - t1) * 6 * t3;
else if (2 * t3 < 1)
val = t2;
else if (3 * t3 < 2)
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
else
val = t1;
rgb[i] = val * 255;
}
return rgb;
},
hsl2hsv: function hsl2hsv(hsl) {
var h = hsl[0],
s = hsl[1] / 100,
l = hsl[2] / 100,
sv, v;
l *= 2;
s *= (l <= 1) ? l : 2 - l;
v = (l + s) / 2;
sv = (2 * s) / (l + s);
return [h, sv * 100, v * 100];
},
hsv2rgb: function hsv2rgb(hsv) {
var h = hsv[0] / 60
var s = hsv[1] / 100
var v = hsv[2] / 100
var hi = Math.floor(h) % 6
var f = h - Math.floor(h)
var p = 255 * v * (1 - s)
var q = 255 * v * (1 - (s * f))
var t = 255 * v * (1 - (s * (1 - f)))
v = 255 * v
switch (hi) {
case 0:
return [v, t, p]
case 1:
return [q, v, p]
case 2:
return [p, v, t]
case 3:
return [p, q, v]
case 4:
return [t, p, v]
case 5:
return [v, p, q]
}
},
hsv2hsl: function hsv2hsl(hsv) {
var h = hsv[0],
s = hsv[1] / 100,
v = hsv[2] / 100,
sl, l;
l = (2 - s) * v;
sl = s * v;
sl /= (l <= 1) ? l : 2 - l;
l /= 2;
return [h, sl * 100, l * 100];
},
// http://www.140byt.es/keywords/color
rgb2hex: function(
a, // red, as a number from 0 to 255
b, // green, as a number from 0 to 255
c // blue, as a number from 0 to 255
) {
return "#" + ((256 + a << 8 | b) << 8 | c).toString(16).slice(1)
},
hex2rgb: function(
a // take a "#xxxxxx" hex string,
) {
a = '0x' + a.slice(1).replace(a.length > 4 ? a : /./g, '$&$&') | 0;
return [a >> 16, a >> 8 & 255, a & 255]
}
}
/***/ },
/* 12 */
/***/ function(module, exports) {
/*
## Color �ֵ�����
�ֵ�������Դ [A nicer color palette for the web](http://clrs.cc/)
*/
module.exports = {
// name value nicer
navy: {
value: '#000080',
nicer: '#001F3F'
},
blue: {
value: '#0000ff',
nicer: '#0074D9'
},
aqua: {
value: '#00ffff',
nicer: '#7FDBFF'
},
teal: {
value: '#008080',
nicer: '#39CCCC'
},
olive: {
value: '#008000',
nicer: '#3D9970'
},
green: {
value: '#008000',
nicer: '#2ECC40'
},
lime: {
value: '#00ff00',
nicer: '#01FF70'
},
yellow: {
value: '#ffff00',
nicer: '#FFDC00'
},
orange: {
value: '#ffa500',
nicer: '#FF851B'
},
red: {
value: '#ff0000',
nicer: '#FF4136'
},
maroon: {
value: '#800000',
nicer: '#85144B'
},
fuchsia: {
value: '#ff00ff',
nicer: '#F012BE'
},
purple: {
value: '#800080',
nicer: '#B10DC9'
},
silver: {
value: '#c0c0c0',
nicer: '#DDDDDD'
},
gray: {
value: '#808080',
nicer: '#AAAAAA'
},
black: {
value: '#000000',
nicer: '#111111'
},
white: {
value: '#FFFFFF',
nicer: '#FFFFFF'
}
}
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/*
## Text
http://www.lipsum.com/
*/
var Basic = __webpack_require__(6)
var Helper = __webpack_require__(14)
function range(defaultMin, defaultMax, min, max) {
return min === undefined ? Basic.natural(defaultMin, defaultMax) : // ()
max === undefined ? min : // ( len )
Basic.natural(parseInt(min, 10), parseInt(max, 10)) // ( min, max )
}
module.exports = {
// �������һ���ı���
paragraph: function(min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.sentence())
}
return result.join(' ')
},
//
cparagraph: function(min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.csentence())
}
return result.join('')
},
// �������һ�����ӣ���һ�����ʵ�����ĸ��д��
sentence: function(min, max) {
var len = range(12, 18, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.word())
}
return Helper.capitalize(result.join(' ')) + '.'
},
// �������һ�����ľ��ӡ�
csentence: function(min, max) {
var len = range(12, 18, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.cword())
}
return result.join('') + '��'
},
// �������һ�����ʡ�
word: function(min, max) {
var len = range(3, 10, min, max)
var result = '';
for (var i = 0; i < len; i++) {
result += Basic.character('lower')
}
return result
},
// �������һ���������֡�
cword: function(pool, min, max) {
// ��õ� 500 ������ http://baike.baidu.com/view/568436.htm
var DICT_KANZI = '��һ���ڲ����к������д�Ϊ�ϸ�������Ҫ��ʱ���������������ڳ��ͷֶԳɻ�������궯ͬ��Ҳ���¹���˵�����������ඨ��ѧ������þ�ʮ��֮���ŵȲ��ȼҵ�������ˮ�����Զ�����С����ʵ�����������ƻ���ʹ���ҵ��ȥ���Ժ�Ӧ�����ϻ�������ЩȻǰ������������������ƽ����ȫ�������ظ��������������ķ�������ԭ��ô���Ȼ�������������˱���ֻû������⽨�¹���ϵ������������������ͨ����ֱ���չ�������Ա��λ�볣���ܴ�Ʒʽ���輰���ؼ�������ͷ���ʱ���·����ͼɽͳ��֪�Ͻ�����Ʊ����ֽ��ڸ�����ũָ������ǿ�ž�����������ս�Ȼ�����ȡ�ݴ����ϸ�ɫ���ż����α���ٹ������ߺ��ڶ�����ѹ־���������ý���˼����������ʲ������Ȩ��֤���强���ٲ�ת�������д���ٻ������������������ÿĿ������ʾ��������������뻪��ȷ�ſ�������ڻ�������Ԫ�����´�����Ⱥ��ʯ������н������ɽ��Ҿ���Խ֯װӰ��ͳ������鲼���ݶ�����̷����������ѽ���ǧ��ί�ؼ��������ʡ��ϰ��Լ֧��ʷ���ͱ����������п˺γ���������̫��ֵ������ά��ѡ��д���ë��Ч˹Ժ�齭�����������������ɲ�Ƭʼȴר״������ʶ����Բ����ס�����ؾ��ղκ�ϸ����������������'
var len
switch (arguments.length) {
case 0: // ()
pool = DICT_KANZI
len = 1
break
case 1: // ( pool )
if (typeof arguments[0] === 'string') {
len = 1
} else {
// ( length )
len = pool
pool = DICT_KANZI
}
break
case 2:
// ( pool, length )
if (typeof arguments[0] === 'string') {
len = min
} else {
// ( min, max )
len = this.natural(pool, min)
pool = DICT_KANZI
}
break
case 3:
len = this.natural(min, max)
break
}
var result = ''
for (var i = 0; i < len; i++) {
result += pool.charAt(this.natural(0, pool.length - 1))
}
return result
},
// �������һ����⣬����ÿ�����ʵ�����ĸ��д��
title: function(min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.capitalize(this.word()))
}
return result.join(' ')
},
// �������һ�����ı��⡣
ctitle: function(min, max) {
var len = range(3, 7, min, max)
var result = []
for (var i = 0; i < len; i++) {
result.push(this.cword())
}
return result.join('')
}
}
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
/*
## Helpers
*/
var Util = __webpack_require__(3)
module.exports = {
// ���ַ����ĵ�һ����ĸת��Ϊ��д��
capitalize: function(word) {
return (word + '').charAt(0).toUpperCase() + (word + '').substr(1)
},
// ���ַ���ת��Ϊ��д��
upper: function(str) {
return (str + '').toUpperCase()
},
// ���ַ���ת��ΪСд��
lower: function(str) {
return (str + '').toLowerCase()
},
// �����������ѡȡһ��Ԫ�أ������ء�
pick: function pick(arr, min, max) {
// pick( item1, item2 ... )
if (!Util.isArray(arr)) {
arr = [].slice.call(arguments)
min = 1
max = 1
} else {
// pick( [ item1, item2 ... ] )
if (min === undefined) min = 1
// pick( [ item1, item2 ... ], count )
if (max === undefined) max = min
}
if (min === 1 && max === 1) return arr[this.natural(0, arr.length - 1)]
// pick( [ item1, item2 ... ], min, max )
return this.shuffle(arr, min, max)
// ͨ�����������жϷ���ǩ������չ��̫�#90
// switch (arguments.length) {
// case 1:
// // pick( [ item1, item2 ... ] )
// return arr[this.natural(0, arr.length - 1)]
// case 2:
// // pick( [ item1, item2 ... ], count )
// max = min
// /* falls through */
// case 3:
// // pick( [ item1, item2 ... ], min, max )
// return this.shuffle(arr, min, max)
// }
},
/*
����������Ԫ�ص�˳�����ء�
Given an array, scramble the order and return it.
������ʵ��˼·��
// https://code.google.com/p/jslibs/wiki/JavascriptTips
result = result.sort(function() {
return Math.random() - 0.5
})
*/
shuffle: function shuffle(arr, min, max) {
arr = arr || []
var old = arr.slice(0),
result = [],
index = 0,
length = old.length;
for (var i = 0; i < length; i++) {
index = this.natural(0, old.length - 1)
result.push(old[index])
old.splice(index, 1)
}
switch (arguments.length) {
case 0:
case 1:
return result
case 2:
max = min
/* falls through */
case 3:
min = parseInt(min, 10)
max = parseInt(max, 10)
return result.slice(0, this.natural(min, max))
}
},
/*
* Random.order(item, item)
* Random.order([item, item ...])
˳���ȡ�����е�Ԫ��
[JSON��������֧����������¼��](https://github.com/thx/RAP/issues/22)
��֧�ֵ������ã�
*/
order: function order(array) {
order.cache = order.cache || {}
if (arguments.length > 1) array = [].slice.call(arguments, 0)
// options.context.path/templatePath
var options = order.options
var templatePath = options.context.templatePath.join('.')
var cache = (
order.cache[templatePath] = order.cache[templatePath] || {
index: 0,
array: array
}
)
return cache.array[cache.index++ % cache.array.length]
}
}
/***/ },
/* 15 */
/***/ function(module, exports) {
/*
## Name
[Beyond the Top 1000 Names](http://www.ssa.gov/oact/babynames/limits.html)
*/
module.exports = {
// �������һ��������Ӣ������
first: function() {
var names = [
// male
"James", "John", "Robert", "Michael", "William",
"David", "Richard", "Charles", "Joseph", "Thomas",
"Christopher", "Daniel", "Paul", "Mark", "Donald",
"George", "Kenneth", "Steven", "Edward", "Brian",
"Ronald", "Anthony", "Kevin", "Jason", "Matthew",
"Gary", "Timothy", "Jose", "Larry", "Jeffrey",
"Frank", "Scott", "Eric"
].concat([
// female
"Mary", "Patricia", "Linda", "Barbara", "Elizabeth",
"Jennifer", "Maria", "Susan", "Margaret", "Dorothy",
"Lisa", "Nancy", "Karen", "Betty", "Helen",
"Sandra", "Donna", "Carol", "Ruth", "Sharon",
"Michelle", "Laura", "Sarah", "Kimberly", "Deborah",
"Jessica", "Shirley", "Cynthia", "Angela", "Melissa",
"Brenda", "Amy", "Anna"
])
return this.pick(names)
// or this.capitalize(this.word())
},
// �������һ��������Ӣ���ա�
last: function() {
var names = [
"Smith", "Johnson", "Williams", "Brown", "Jones",
"Miller", "Davis", "Garcia", "Rodriguez", "Wilson",
"Martinez", "Anderson", "Taylor", "Thomas", "Hernandez",
"Moore", "Martin", "Jackson", "Thompson", "White",
"Lopez", "Lee", "Gonzalez", "Harris", "Clark",
"Lewis", "Robinson", "Walker", "Perez", "Hall",
"Young", "Allen"
]
return this.pick(names)
// or this.capitalize(this.word())
},
// �������һ��������Ӣ��������
name: function(middle) {
return this.first() + ' ' +
(middle ? this.first() + ' ' : '') +
this.last()
},
/*
�������һ�������������ա�
[���糣����������](http://baike.baidu.com/view/1719115.htm)
[������ - ����С˵��������ƽ̨](http://xuanpai.sinaapp.com/)
*/
cfirst: function() {
var names = (
'�� �� �� �� �� �� �� �� �� �� ' +
'�� �� �� �� �� �� �� �� �� �� ' +
'�� �� ֣ л �� �� �� �� �� �� ' +
'�� �� Ԭ �� �� �� �� �� �� �� ' +
'�� ¬ �� �� �� �� κ Ѧ Ҷ �� ' +
'�� �� �� �� �� �� �� �� �� �� ' +
'�� �� ʯ Ҧ ̷ �� �� �� �� ½ ' +
'�� �� �� �� �� ë �� �� �� ʷ ' +
'�� �� �� �� �� �� �� �� Ǯ �� ' +
'�� �� �� �� �� �� �� �� �� ��'
).split(' ')
return this.pick(names)
},
/*
�������һ����������������
[�й��������ǰ50��_����������](http://www.name999.net/xingming/xingshi/20131004/48.html)
*/
clast: function() {
var names = (
'ΰ �� �� ��Ӣ �� �� �� ǿ �� �� ' +
'�� �� �� �� �� �� �� �� ���� ϼ ' +
'ƽ �� ��Ӣ'
).split(' ')
return this.pick(names)
},
// �������һ������������������
cname: function() {
return this.cfirst() + this.clast()
}
}
/***/ },
/* 16 */
/***/ function(module, exports) {
/*
## Web
*/
module.exports = {
/*
�������һ�� URL��
[URL �淶](http://www.w3.org/Addressing/URL/url-spec.txt)
http Hypertext Transfer Protocol
ftp File Transfer protocol
gopher The Gopher protocol
mailto Electronic mail address
mid Message identifiers for electronic mail
cid Content identifiers for MIME body part
news Usenet news
nntp Usenet news for local NNTP access only
prospero Access using the prospero protocols
telnet rlogin tn3270 Reference to interactive sessions
wais Wide Area Information Servers
*/
url: function(protocol, host) {
return (protocol || this.protocol()) + '://' + // protocol?
(host || this.domain()) + // host?
'/' + this.word()
},
// �������һ�� URL Э�顣
protocol: function() {
return this.pick(
// ���
'http ftp gopher mailto mid cid news nntp prospero telnet rlogin tn3270 wais'.split(' ')
)
},
// �������һ��������
domain: function(tld) {
return this.word() + '.' + (tld || this.tld())
},
/*
�������һ������������
���ʶ������� international top-level domain-names, iTLDs
���Ҷ������� national top-level domainnames, nTLDs
[��������ȫ](http://www.163ns.com/zixun/post/4417.html)
*/
tld: function() { // Top Level Domain
return this.pick(
(
// ������
'com net org edu gov int mil cn ' +
// ��������
'com.cn net.cn gov.cn org.cn ' +
// ����������
'�й� �й�����.��˾ �й�����.���� ' +
// �¹�������
'tel biz cc tv info name hk mobi asia cd travel pro museum coop aero ' +
// �������������
'ad ae af ag ai al am an ao aq ar as at au aw az ba bb bd be bf bg bh bi bj bm bn bo br bs bt bv bw by bz ca cc cf cg ch ci ck cl cm cn co cq cr cu cv cx cy cz de dj dk dm do dz ec ee eg eh es et ev fi fj fk fm fo fr ga gb gd ge gf gh gi gl gm gn gp gr gt gu gw gy hk hm hn hr ht hu id ie il in io iq ir is it jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md mg mh ml mm mn mo mp mq mr ms mt mv mw mx my mz na nc ne nf ng ni nl no np nr nt nu nz om qa pa pe pf pg ph pk pl pm pn pr pt pw py re ro ru rw sa sb sc sd se sg sh si sj sk sl sm sn so sr st su sy sz tc td tf tg th tj tk tm tn to tp tr tt tv tw tz ua ug uk us uy va vc ve vg vn vu wf ws ye yu za zm zr zw'
).split(' ')
)
},
// �������һ���ʼ���ַ��
email: function(domain) {
return this.character('lower') + '.' + this.word() + '@' +
(
domain ||
(this.word() + '.' + this.tld())
)
// return this.character('lower') + '.' + this.last().toLowerCase() + '@' + this.last().toLowerCase() + '.' + this.tld()
// return this.word() + '@' + (domain || this.domain())
},
// �������һ�� IP ��ַ��
ip: function() {
return this.natural(0, 255) + '.' +
this.natural(0, 255) + '.' +
this.natural(0, 255) + '.' +
this.natural(0, 255)
}
}
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
/*
## Address
*/
var DICT = __webpack_require__(18)
var REGION = ['����', '����', '����', '����', '����', '����', '����']
module.exports = {
// �������һ��������
region: function() {
return this.pick(REGION)
},
// �������һ�����й���ʡ����ֱϽ�С����������ر�����������
province: function() {
return this.pick(DICT).name
},
// �������һ�����й����С�
city: function(prefix) {
var province = this.pick(DICT)
var city = this.pick(province.children)
return prefix ? [province.name, city.name].join(' ') : city.name
},
// �������һ�����й����ء�
county: function(prefix) {
var province = this.pick(DICT)
var city = this.pick(province.children)
var county = this.pick(city.children) || {
name: '-'
}
return prefix ? [province.name, city.name, county.name].join(' ') : county.name
},
// �������һ���������루��λ���֣���
zip: function(len) {
var zip = ''
for (var i = 0; i < (len || 6); i++) zip += this.natural(0, 9)
return zip
}
// address: function() {},
// phone: function() {},
// areacode: function() {},
// street: function() {},
// street_suffixes: function() {},
// street_suffix: function() {},
// states: function() {},
// state: function() {},
}
/***/ },
/* 18 */
/***/ function(module, exports) {
/*
## Address �ֵ�����
�ֵ�������Դ http://www.atatech.org/articles/30028?rnd=254259856
���� ʡ���У��������������
���� ������ ����� �ӱ�ʡ ɽ��ʡ ���ɹ�������
���� ����ʡ ����ʡ ������ʡ
���� �Ϻ��� ����ʡ �㽭ʡ ����ʡ ����ʡ ����ʡ ɽ��ʡ
���� �㶫ʡ ����׳�������� ����ʡ
���� ����ʡ ����ʡ ����ʡ
���� ������ �Ĵ�ʡ ����ʡ ����ʡ ����������
���� ����ʡ ����ʡ �ຣʡ ���Ļ��������� �½�ά���������
�۰�̨ ����ر������� �����ر������� ̨��ʡ
**����**
```js
var map = {}
_.each(_.keys(REGIONS),function(id){
map[id] = REGIONS[ID]
})
JSON.stringify(map)
```
*/
var DICT = {
"110000": "����",
"110100": "������",
"110101": "������",
"110102": "������",
"110105": "������",
"110106": "��̨��",
"110107": "ʯ��ɽ��",
"110108": "������",
"110109": "��ͷ����",
"110111": "��ɽ��",
"110112": "ͨ����",
"110113": "˳����",
"110114": "��ƽ��",
"110115": "������",
"110116": "������",
"110117": "ƽ����",
"110228": "������",
"110229": "������",
"110230": "������",
"120000": "���",
"120100": "�����",
"120101": "��ƽ��",
"120102": "�Ӷ���",
"120103": "������",
"120104": "�Ͽ���",
"120105": "�ӱ���",
"120106": "������",
"120110": "������",
"120111": "������",
"120112": "������",
"120113": "������",
"120114": "������",
"120115": "������",
"120116": "��������",
"120221": "������",
"120223": "������",
"120225": "����",
"120226": "������",
"130000": "�ӱ�ʡ",
"130100": "ʯ��ׯ��",
"130102": "������",
"130103": "�Ŷ���",
"130104": "������",
"130105": "�»���",
"130107": "�������",
"130108": "ԣ����",
"130121": "������",
"130123": "������",
"130124": "�����",
"130125": "������",
"130126": "������",
"130127": "������",
"130128": "������",
"130129": "����",
"130130": "����",
"130131": "ƽɽ��",
"130132": "Ԫ����",
"130133": "����",
"130181": "������",
"130182": "����",
"130183": "������",
"130184": "������",
"130185": "¹Ȫ��",
"130186": "������",
"130200": "��ɽ��",
"130202": "·����",
"130203": "·����",
"130204": "��ұ��",
"130205": "��ƽ��",
"130207": "������",
"130208": "������",
"130223": "����",
"130224": "������",
"130225": "��ͤ��",
"130227": "Ǩ����",
"130229": "������",
"130230": "��������",
"130281": "����",
"130283": "Ǩ����",
"130284": "������",
"130300": "�ػʵ���",
"130302": "������",
"130303": "ɽ������",
"130304": "��������",
"130321": "��������������",
"130322": "������",
"130323": "������",
"130324": "¬����",
"130398": "������",
"130400": "������",
"130402": "��ɽ��",
"130403": "��̨��",
"130404": "������",
"130406": "������",
"130421": "������",
"130423": "������",
"130424": "�ɰ���",
"130425": "������",
"130426": "����",
"130427": "����",
"130428": "������",
"130429": "������",
"130430": "����",
"130431": "������",
"130432": "��ƽ��",
"130433": "������",
"130434": "�",
"130435": "������",
"130481": "�䰲��",
"130482": "������",
"130500": "��̨��",
"130502": "�Ŷ���",
"130503": "������",
"130521": "��̨��",
"130522": "�ٳ���",
"130523": "������",
"130524": "������",
"130525": "¡Ң��",
"130526": "����",
"130527": "�Ϻ���",
"130528": "������",
"130529": "��¹��",
"130530": "�º���",
"130531": "������",
"130532": "ƽ����",
"130533": "����",
"130534": "�����",
"130535": "������",
"130581": "�Ϲ���",
"130582": "ɳ����",
"130583": "������",
"130600": "������",
"130602": "������",
"130603": "������",
"130604": "������",
"130621": "������",
"130622": "��Է��",
"130623": "�ˮ��",
"130624": "��ƽ��",
"130625": "��ˮ��",
"130626": "������",
"130627": "����",
"130628": "������",
"130629": "�ݳ���",
"130630": "�Դ��",
"130631": "������",
"130632": "������",
"130633": "����",
"130634": "������",
"130635": "���",
"130636": "˳ƽ��",
"130637": "��Ұ��",
"130638": "����",
"130681": "������",
"130682": "������",
"130683": "������",
"130684": "�߱�����",
"130699": "������",
"130700": "�żҿ���",
"130702": "�Ŷ���",
"130703": "������",
"130705": "������",
"130706": "�»���",
"130721": "������",
"130722": "�ű���",
"130723": "������",
"130724": "��Դ��",
"130725": "������",
"130726": "�",
"130727": "��ԭ��",
"130728": "������",
"130729": "��ȫ��",
"130730": "������",
"130731": "��¹��",
"130732": "�����",
"130733": "������",
"130734": "������",
"130800": "���",
"130802": "˫����",
"130803": "˫����",
"130804": "ӥ��Ӫ�ӿ���",
"130821": "���",
"130822": "��¡��",
"130823": "ƽȪ��",
"130824": "��ƽ��",
"130825": "¡����",
"130826": "��������������",
"130827": "�������������",
"130828": "Χ�������ɹ���������",
"130829": "������",
"130900": "������",
"130902": "�»���",
"130903": "�˺���",
"130921": "����",
"130922": "����",
"130923": "������",
"130924": "������",
"130925": "��ɽ��",
"130926": "������",
"130927": "��Ƥ��",
"130928": "������",
"130929": "����",
"130930": "�ϴ����������",
"130981": "��ͷ��",
"130982": "������",
"130983": "������",
"130984": "�Ӽ���",
"130985": "������",
"131000": "�ȷ���",
"131002": "������",
"131003": "������",
"131022": "�̰���",
"131023": "������",
"131024": "�����",
"131025": "�����",
"131026": "����",
"131028": "����������",
"131081": "������",
"131082": "������",
"131083": "������",
"131100": "��ˮ��",
"131102": "�ҳ���",
"131121": "��ǿ��",
"131122": "������",
"131123": "��ǿ��",
"131124": "������",
"131125": "��ƽ��",
"131126": "�ʳ���",
"131127": "����",
"131128": "������",
"131181": "������",
"131182": "������",
"131183": "������",
"140000": "ɽ��ʡ",
"140100": "̫ԭ��",
"140105": "����",
"140106": "ӭ����",
"140107": "�ӻ�����",
"140108": "���ƺ��",
"140109": "�������",
"140110": "��Դ��",
"140121": "������",
"140122": "������",
"140123": "¦����",
"140181": "����",
"140182": "������",
"140200": "��ͬ��",
"140202": "����",
"140203": "����",
"140211": "�Ͻ���",
"140212": "������",
"140221": "�����",
"140222": "������",
"140223": "������",
"140224": "������",
"140225": "��Դ��",
"140226": "������",
"140227": "��ͬ��",
"140228": "������",
"140300": "��Ȫ��",
"140302": "����",
"140303": "����",
"140311": "����",
"140321": "ƽ����",
"140322": "����",
"140323": "������",
"140400": "������",
"140421": "������",
"140423": "��ԫ��",
"140424": "������",
"140425": "ƽ˳��",
"140426": "�����",
"140427": "������",
"140428": "������",
"140429": "������",
"140430": "����",
"140431": "��Դ��",
"140481": "º����",
"140482": "����",
"140483": "����",
"140485": "������",
"140500": "������",
"140502": "����",
"140521": "��ˮ��",
"140522": "�����",
"140524": "�괨��",
"140525": "������",
"140581": "��ƽ��",
"140582": "������",
"140600": "˷����",
"140602": "˷����",
"140603": "ƽ³��",
"140621": "ɽ����",
"140622": "Ӧ��",
"140623": "������",
"140624": "������",
"140625": "������",
"140700": "������",
"140702": "�ܴ���",
"140721": "������",
"140722": "��Ȩ��",
"140723": "��˳��",
"140724": "������",
"140725": "������",
"140726": "̫����",
"140727": "����",
"140728": "ƽң��",
"140729": "��ʯ��",
"140781": "������",
"140782": "������",
"140800": "�˳���",
"140802": "���",
"140821": "�����",
"140822": "������",
"140823": "��ϲ��",
"140824": "�ɽ��",
"140825": "�����",
"140826": "���",
"140827": "ԫ����",
"140828": "����",
"140829": "ƽ½��",
"140830": "�dz���",
"140881": "������",
"140882": "�ӽ���",
"140883": "������",
"140900": "������",
"140902": "�ø���",
"140921": "������",
"140922": "��̨��",
"140923": "����",
"140924": "������",
"140925": "������",
"140926": "������",
"140927": "�����",
"140928": "��կ��",
"140929": "����",
"140930": "������",
"140931": "������",
"140932": "ƫ����",
"140981": "ԭƽ��",
"140982": "������",
"141000": "�ٷ���",
"141002": "Ң����",
"141021": "������",
"141022": "�����",
"141023": "�����",
"141024": "�鶴��",
"141025": "����",
"141026": "������",
"141027": "��ɽ��",
"141028": "����",
"141029": "������",
"141030": "������",
"141031": "����",
"141032": "������",
"141033": "����",
"141034": "������",
"141081": "������",
"141082": "������",
"141083": "������",
"141100": "������",
"141102": "��ʯ��",
"141121": "��ˮ��",
"141122": "������",
"141123": "����",
"141124": "����",
"141125": "������",
"141126": "ʯ¥��",
"141127": "���",
"141128": "��ɽ��",
"141129": "������",
"141130": "������",
"141181": "����",
"141182": "������",
"141183": "������",
"150000": "���ɹ�������",
"150100": "��ͺ�����",
"150102": "�³���",
"150103": "������",
"150104": "��Ȫ��",
"150105": "������",
"150121": "��Ĭ������",
"150122": "�����",
"150123": "���ָ����",
"150124": "��ˮ����",
"150125": "�䴨��",
"150126": "������",
"150200": "��ͷ��",
"150202": "������",
"150203": "��������",
"150204": "��ɽ��",
"150205": "ʯ����",
"150206": "���ƶ�������",
"150207": "��ԭ��",
"150221": "��Ĭ������",
"150222": "������",
"150223": "��������������",
"150224": "������",
"150300": "�ں���",
"150302": "��������",
"150303": "������",
"150304": "�ڴ���",
"150305": "������",
"150400": "�����",
"150402": "��ɽ��",
"150403": "Ԫ��ɽ��",
"150404": "��ɽ��",
"150421": "��³�ƶ�����",
"150422": "��������",
"150423": "��������",
"150424": "������",
"150425": "��ʲ������",
"150426": "��ţ����",
"150428": "��������",
"150429": "������",
"150430": "������",
"150431": "������",
"150500": "ͨ����",
"150502": "�ƶ�����",
"150521": "�ƶ�����������",
"150522": "�ƶ����������",
"150523": "��³��",
"150524": "������",
"150525": "������",
"150526": "��³����",
"150581": "���ֹ�����",
"150582": "������",
"150600": "������˹��",
"150602": "��ʤ��",
"150621": "��������",
"150622": "�����",
"150623": "���п�ǰ��",
"150624": "�����",
"150625": "������",
"150626": "������",
"150627": "���������",
"150628": "������",
"150700": "���ױ�����",
"150702": "��������",
"150703": "����ŵ����",
"150721": "������",
"150722": "Ī�����ߴ��Ӷ���������",
"150723": "���״�������",
"150724": "���¿���������",
"150725": "�°Ͷ�����",
"150726": "�°Ͷ�������",
"150727": "�°Ͷ�������",
"150781": "��������",
"150782": "����ʯ��",
"150783": "��������",
"150784": "���������",
"150785": "������",
"150786": "������",
"150800": "��������",
"150802": "�ٺ���",
"150821": "��ԭ��",
"150822": "�����",
"150823": "������ǰ��",
"150824": "����������",
"150825": "�����غ���",
"150826": "��������",
"150827": "������",
"150900": "�����첼��",
"150902": "������",
"150921": "����",
"150922": "������",
"150923": "�̶���",
"150924": "�˺���",
"150925": "������",
"150926": "���������ǰ��",
"150927": "�������������",
"150928": "������������",
"150929": "��������",
"150981": "������",
"150982": "������",
"152200": "�˰���",
"152201": "����������",
"152202": "����ɽ��",
"152221": "�ƶ�������ǰ��",
"152222": "�ƶ�����������",
"152223": "��������",
"152224": "ͻȪ��",
"152225": "������",
"152500": "���ֹ�����",
"152501": "����������",
"152502": "���ֺ�����",
"152522": "������",
"152523": "����������",
"152524": "����������",
"152525": "������������",
"152526": "������������",
"152527": "̫������",
"152528": "�����",
"152529": "�������",
"152530": "������",
"152531": "������",
"152532": "������",
"152900": "��������",
"152921": "����������",
"152922": "����������",
"152923": "�������",
"152924": "������",
"210000": "����ʡ",
"210100": "������",
"210102": "��ƽ��",
"210103": "�����",
"210104": "����",
"210105": "�ʹ���",
"210106": "������",
"210111": "�ռ�����",
"210112": "������",
"210113": "�³�����",
"210114": "�ں���",
"210122": "������",
"210123": "��ƽ��",
"210124": "������",
"210181": "������",
"210184": "������",
"210185": "������",
"210200": "������",
"210202": "��ɽ��",
"210203": "������",
"210204": "ɳ�ӿ���",
"210211": "�ʾ�����",
"210212": "��˳����",
"210213": "������",
"210224": "������",
"210281": "�߷�����",
"210282": "��������",
"210283": "ׯ����",
"210298": "������",
"210300": "��ɽ��",
"210302": "������",
"210303": "������",
"210304": "��ɽ��",
"210311": "ǧɽ��",
"210321": "̨����",
"210323": "�������������",
"210381": "������",
"210382": "������",
"210400": "��˳��",
"210402": "�¸���",
"210403": "������",
"210404": "������",
"210411": "˳����",
"210421": "��˳��",
"210422": "�±�����������",
"210423": "��ԭ����������",
"210424": "������",
"210500": "��Ϫ��",
"210502": "ƽɽ��",
"210503": "Ϫ����",
"210504": "��ɽ��",
"210505": "�Ϸ���",
"210521": "��Ϫ����������",
"210522": "��������������",
"210523": "������",
"210600": "������",
"210602": "Ԫ����",
"210603": "������",
"210604": "����",
"210624": "�������������",
"210681": "������",
"210682": "�����",
"210683": "������",
"210700": "������",
"210702": "������",
"210703": "�����",
"210711": "̫����",
"210726": "��ɽ��",
"210727": "����",
"210781": "�躣��",
"210782": "������",
"210783": "������",
"210800": "Ӫ����",
"210802": "վǰ��",
"210803": "������",
"210804": "����Ȧ��",
"210811": "�ϱ���",
"210881": "������",
"210882": "��ʯ����",
"210883": "������",
"210900": "������",
"210902": "������",
"210903": "������",
"210904": "̫ƽ��",
"210905": "�������",
"210911": "ϸ����",
"210921": "�����ɹ���������",
"210922": "������",
"210923": "������",
"211000": "������",
"211002": "������",
"211003": "��ʥ��",
"211004": "���",
"211005": "��������",
"211011": "̫�Ӻ���",
"211021": "������",
"211081": "������",
"211082": "������",
"211100": "�̽���",
"211102": "˫̨����",
"211103": "��¡̨��",
"211121": "������",
"211122": "��ɽ��",
"211123": "������",
"211200": "������",
"211202": "������",
"211204": "�����",
"211221": "������",
"211223": "������",
"211224": "��ͼ��",
"211281": "����ɽ��",
"211282": "��ԭ��",
"211283": "������",
"211300": "������",
"211302": "˫����",
"211303": "������",
"211321": "������",
"211322": "��ƽ��",
"211324": "�����������ɹ���������",
"211381": "��Ʊ��",
"211382": "��Դ��",
"211383": "������",
"211400": "��«����",
"211402": "��ɽ��",
"211403": "������",
"211404": "��Ʊ��",
"211421": "������",
"211422": "������",
"211481": "�˳���",
"211482": "������",
"220000": "����ʡ",
"220100": "������",
"220102": "�Ϲ���",
"220103": "�����",
"220104": "������",
"220105": "������",
"220106": "����",
"220112": "˫����",
"220122": "ũ����",
"220181": "��̨��",
"220182": "������",
"220183": "�»���",
"220188": "������",
"220200": "������",
"220202": "������",
"220203": "��̶��",
"220204": "��Ӫ��",
"220211": "������",
"220221": "������",
"220281": "�Ժ���",
"220282": "�����",
"220283": "������",
"220284": "��ʯ��",
"220285": "������",
"220300": "��ƽ��",
"220302": "������",
"220303": "������",
"220322": "������",
"220323": "��ͨ����������",
"220381": "��������",
"220382": "˫����",
"220383": "������",
"220400": "��Դ��",
"220402": "��ɽ��",
"220403": "������",
"220421": "������",
"220422": "������",
"220423": "������",
"220500": "ͨ����",
"220502": "������",
"220503": "��������",
"220521": "ͨ����",
"220523": "������",
"220524": "������",
"220581": "÷�ӿ���",
"220582": "������",
"220583": "������",
"220600": "��ɽ��",
"220602": "�뽭��",
"220621": "������",
"220622": "������",
"220623": "���׳�����������",
"220625": "��Դ��",
"220681": "�ٽ���",
"220682": "������",
"220700": "��ԭ��",
"220702": "������",
"220721": "ǰ������˹�ɹ���������",
"220722": "������",
"220723": "Ǭ����",
"220724": "������",
"220725": "������",
"220800": "�׳���",
"220802": "䬱���",
"220821": "������",
"220822": "ͨ����",
"220881": "�����",
"220882": "����",
"220883": "������",
"222400": "�ӱ߳�����������",
"222401": "�Ӽ���",
"222402": "ͼ����",
"222403": "�ػ���",
"222404": "������",
"222405": "������",
"222406": "������",
"222424": "������",
"222426": "��ͼ��",
"222427": "������",
"230000": "������ʡ",
"230100": "��������",
"230102": "������",
"230103": "�ϸ���",
"230104": "������",
"230106": "�㷻��",
"230108": "ƽ����",
"230109": "�ɱ���",
"230111": "������",
"230123": "������",
"230124": "������",
"230125": "����",
"230126": "������",
"230127": "ľ����",
"230128": "ͨ����",
"230129": "������",
"230181": "������",
"230182": "˫����",
"230183": "��־��",
"230184": "�峣��",
"230186": "������",
"230200": "���������",
"230202": "��ɳ��",
"230203": "������",
"230204": "������",
"230205": "����Ϫ��",
"230206": "����������",
"230207": "����ɽ��",
"230208": "÷��˹���Ӷ�����",
"230221": "������",
"230223": "������",
"230224": "̩����",
"230225": "������",
"230227": "��ԣ��",
"230229": "��ɽ��",
"230230": "�˶���",
"230231": "��Ȫ��",
"230281": "ګ����",
"230282": "������",
"230300": "������",
"230302": "������",
"230303": "��ɽ��",
"230304": "���",
"230305": "������",
"230306": "���Ӻ���",
"230307": "��ɽ��",
"230321": "������",
"230381": "������",
"230382": "��ɽ��",
"230383": "������",
"230400": "����",
"230402": "������",
"230403": "��ũ��",
"230404": "��ɽ��",
"230405": "�˰���",
"230406": "��ɽ��",
"230407": "��ɽ��",
"230421": "�ܱ���",
"230422": "�����",
"230423": "������",
"230500": "˫Ѽɽ��",
"230502": "��ɽ��",
"230503": "�붫��",
"230505": "�ķ�̨��",
"230506": "��ɽ��",
"230521": "������",
"230522": "������",
"230523": "������",
"230524": "���",
"230525": "������",
"230600": "������",
"230602": "����ͼ��",
"230603": "������",
"230604": "�ú�·��",
"230605": "�����",
"230606": "��ͬ��",
"230621": "������",
"230622": "��Դ��",
"230623": "�ֵ���",
"230624": "�Ŷ������ɹ���������",
"230625": "������",
"230700": "������",
"230702": "������",
"230703": "�ϲ���",
"230704": "�Ѻ���",
"230705": "������",
"230706": "������",
"230707": "������",
"230708": "��Ϫ��",
"230709": "��ɽ����",
"230710": "��Ӫ��",
"230711": "�������",
"230712": "��������",
"230713": "������",
"230714": "��������",
"230715": "������",
"230716": "�ϸ�����",
"230722": "������",
"230781": "������",
"230782": "������",
"230800": "��ľ˹��",
"230803": "������",
"230804": "ǰ����",
"230805": "������",
"230811": "����",
"230822": "������",
"230826": "�봨��",
"230828": "��ԭ��",
"230833": "��Զ��",
"230881": "ͬ����",
"230882": "������",
"230883": "������",
"230900": "��̨����",
"230902": "������",
"230903": "��ɽ��",
"230904": "���Ӻ���",
"230921": "������",
"230922": "������",
"231000": "ĵ������",
"231002": "������",
"231003": "������",
"231004": "������",
"231005": "������",
"231024": "������",
"231025": "�ֿ���",
"231081": "��Һ���",
"231083": "������",
"231084": "������",
"231085": "������",
"231086": "������",
"231100": "�ں���",
"231102": "������",
"231121": "�۽���",
"231123": "ѷ����",
"231124": "������",
"231181": "������",
"231182": "���������",
"231183": "������",
"231200": "�绯��",
"231202": "������",
"231221": "������",
"231222": "������",
"231223": "�����",
"231224": "�찲��",
"231225": "��ˮ��",
"231226": "������",
"231281": "������",
"231282": "�ض���",
"231283": "������",
"231284": "������",
"232700": "���˰������",
"232702": "������",
"232703": "������",
"232704": "������",
"232721": "������",
"232722": "������",
"232723": "Į����",
"232724": "�Ӹ������",
"232725": "������",
"310000": "�Ϻ�",
"310100": "�Ϻ���",
"310101": "������",
"310104": "�����",
"310105": "������",
"310106": "������",
"310107": "������",
"310108": "բ����",
"310109": "�����",
"310110": "������",
"310112": "������",
"310113": "��ɽ��",
"310114": "���",
"310115": "�ֶ�����",
"310116": "��ɽ��",
"310117": "�ɽ���",
"310118": "������",
"310120": "������",
"310230": "������",
"310231": "������",
"320000": "����ʡ",
"320100": "�Ͼ���",
"320102": "������",
"320104": "�ػ���",
"320105": "������",
"320106": "��¥��",
"320111": "�ֿ���",
"320113": "��ϼ��",
"320114": "�껨̨��",
"320115": "������",
"320116": "������",
"320124": "��ˮ��",
"320125": "�ߴ���",
"320126": "������",
"320200": "������",
"320202": "�簲��",
"320203": "�ϳ���",
"320204": "������",
"320205": "��ɽ��",
"320206": "��ɽ��",
"320211": "������",
"320281": "������",
"320282": "������",
"320297": "������",
"320300": "������",
"320302": "��¥��",
"320303": "������",
"320305": "������",
"320311": "Ȫɽ��",
"320321": "����",
"320322": "����",
"320323": "ͭɽ��",
"320324": "�����",
"320381": "������",
"320382": "������",
"320383": "������",
"320400": "������",
"320402": "������",
"320404": "��¥��",
"320405": "��������",
"320411": "�±���",
"320412": "�����",
"320481": "������",
"320482": "��̳��",
"320483": "������",
"320500": "������",
"320505": "������",
"320506": "������",
"320507": "�����",
"320508": "������",
"320581": "������",
"320582": "�żҸ���",
"320583": "��ɽ��",
"320584": "�⽭��",
"320585": "̫����",
"320596": "������",
"320600": "��ͨ��",
"320602": "�紨��",
"320611": "��բ��",
"320612": "ͨ����",
"320621": "������",
"320623": "�綫��",
"320681": "����",
"320682": "�����",
"320684": "������",
"320694": "������",
"320700": "���Ƹ���",
"320703": "������",
"320705": "������",
"320706": "������",
"320721": "������",
"320722": "������",
"320723": "������",
"320724": "������",
"320725": "������",
"320800": "������",
"320802": "�����",
"320803": "������",
"320804": "������",
"320811": "������",
"320826": "��ˮ��",
"320829": "������",
"320830": "������",
"320831": "�����",
"320832": "������",
"320900": "���",
"320902": "ͤ����",
"320903": "���",
"320921": "��ˮ��",
"320922": "������",
"320923": "������",
"320924": "������",
"320925": "������",
"320981": "��̨��",
"320982": "�����",
"320983": "������",
"321000": "������",
"321002": "������",
"321003": "������",
"321023": "��Ӧ��",
"321081": "������",
"321084": "������",
"321088": "������",
"321093": "������",
"321100": "����",
"321102": "������",
"321111": "������",
"321112": "��ͽ��",
"321181": "������",
"321182": "������",
"321183": "������",
"321184": "������",
"321200": "̩����",
"321202": "������",
"321203": "�߸���",
"321281": "�˻���",
"321282": "������",
"321283": "̩����",
"321284": "������",
"321285": "������",
"321300": "��Ǩ��",
"321302": "����",
"321311": "��ԥ��",
"321322": "������",
"321323": "������",
"321324": "�����",
"321325": "������",
"330000": "�㽭ʡ",
"330100": "������",
"330102": "�ϳ���",
"330103": "�³���",
"330104": "������",
"330105": "������",
"330106": "������",
"330108": "������",
"330109": "��ɽ��",
"330110": "�ຼ��",
"330122": "ͩ®��",
"330127": "������",
"330182": "������",
"330183": "������",
"330185": "�ٰ���",
"330186": "������",
"330200": "������",
"330203": "������",
"330204": "������",
"330205": "������",
"330206": "������",
"330211": "����",
"330212": "۴����",
"330225": "��ɽ��",
"330226": "������",
"330281": "��Ҧ��",
"330282": "��Ϫ��",
"330283": "���",
"330284": "������",
"330300": "������",
"330302": "¹����",
"330303": "������",
"330304": "걺���",
"330322": "��ͷ��",
"330324": "������",
"330326": "ƽ����",
"330327": "������",
"330328": "�ij���",
"330329": "̩˳��",
"330381": "����",
"330382": "������",
"330383": "������",
"330400": "������",
"330402": "�Ϻ���",
"330411": "������",
"330421": "������",
"330424": "������",
"330481": "������",
"330482": "ƽ����",
"330483": "ͩ����",
"330484": "������",
"330500": "������",
"330502": "������",
"330503": "�����",
"330521": "������",
"330522": "������",
"330523": "������",
"330524": "������",
"330600": "������",
"330602": "Խ����",
"330621": "������",
"330624": "�²���",
"330681": "������",
"330682": "������",
"330683": "������",
"330684": "������",
"330700": "����",
"330702": "�ij���",
"330703": "����",
"330723": "������",
"330726": "�ֽ���",
"330727": "�Ͱ���",
"330781": "��Ϫ��",
"330782": "������",
"330783": "������",
"330784": "������",
"330785": "������",
"330800": "������",
"330802": "�³���",
"330803": "�齭��",
"330822": "��ɽ��",
"330824": "������",
"330825": "������",
"330881": "��ɽ��",
"330882": "������",
"330900": "��ɽ��",
"330902": "������",
"330903": "������",
"330921": "�ɽ��",
"330922": "������",
"330923": "������",
"331000": "̨����",
"331002": "������",
"331003": "������",
"331004": "·����",
"331021": "����",
"331022": "������",
"331023": "��̨��",
"331024": "�ɾ���",
"331081": "������",
"331082": "�ٺ���",
"331083": "������",
"331100": "��ˮ��",
"331102": "������",
"331121": "������",
"331122": "������",
"331123": "�����",
"331124": "������",
"331125": "�ƺ���",
"331126": "��Ԫ��",
"331127": "�������������",
"331181": "��Ȫ��",
"331182": "������",
"340000": "����ʡ",
"340100": "�Ϸ���",
"340102": "������",
"340103": "®����",
"340104": "��ɽ��",
"340111": "������",
"340121": "������",
"340122": "�ʶ���",
"340123": "������",
"340192": "������",
"340200": "�ߺ���",
"340202": "������",
"340203": "߮����",
"340207": "��",
"340208": "��ɽ��",
"340221": "�ߺ���",
"340222": "������",
"340223": "������",
"340224": "������",
"340300": "������",
"340302": "���Ӻ���",
"340303": "��ɽ��",
"340304": "�����",
"340311": "������",
"340321": "��Զ��",
"340322": "�����",
"340323": "������",
"340324": "������",
"340400": "������",
"340402": "��ͨ��",
"340403": "�������",
"340404": "л�Ҽ���",
"340405": "�˹�ɽ��",
"340406": "�˼���",
"340421": "��̨��",
"340422": "������",
"340500": "��ɽ��",
"340503": "��ɽ��",
"340504": "��ɽ��",
"340506": "������",
"340521": "��Ϳ��",
"340522": "������",
"340600": "������",
"340602": "�ż���",
"340603": "��ɽ��",
"340604": "��ɽ��",
"340621": "�Ϫ��",
"340622": "������",
"340700": "ͭ����",
"340702": "ͭ��ɽ��",
"340703": "ʨ��ɽ��",
"340711": "����",
"340721": "ͭ����",
"340722": "������",
"340800": "������",
"340802": "ӭ����",
"340803": "�����",
"340811": "������",
"340822": "������",
"340823": "������",
"340824": "DZɽ��",
"340825": "̫����",
"340826": "������",
"340827": "������",
"340828": "������",
"340881": "ͩ����",
"340882": "������",
"341000": "��ɽ��",
"341002": "��Ϫ��",
"341003": "��ɽ��",
"341004": "������",
"341021": "���",
"341022": "������",
"341023": "����",
"341024": "������",
"341025": "������",
"341100": "������",
"341102": "������",
"341103": "������",
"341122": "������",
"341124": "ȫ����",
"341125": "��Զ��",
"341126": "������",
"341181": "�쳤��",
"341182": "������",
"341183": "������",
"341200": "������",
"341202": "�����",
"341203": "��",
"341204": "�Ȫ��",
"341221": "��Ȫ��",
"341222": "̫����",
"341225": "������",
"341226": "�����",
"341282": "������",
"341283": "������",
"341300": "������",
"341302": "������",
"341321": "�ɽ��",
"341322": "����",
"341323": "�����",
"341324": "����",
"341325": "������",
"341400": "������",
"341421": "®����",
"341422": "����",
"341423": "��ɽ��",
"341424": "����",
"341500": "������",
"341502": "����",
"341503": "ԣ����",
"341521": "����",
"341522": "������",
"341523": "�����",
"341524": "��կ��",
"341525": "��ɽ��",
"341526": "������",
"341600": "������",
"341602": "�۳���",
"341621": "������",
"341622": "�ɳ���",
"341623": "������",
"341624": "������",
"341700": "������",
"341702": "�����",
"341721": "������",
"341722": "ʯ̨��",
"341723": "������",
"341724": "������",
"341800": "������",
"341802": "������",
"341821": "��Ϫ��",
"341822": "�����",
"341823": "����",
"341824": "��Ϫ��",
"341825": "캵���",
"341881": "������",
"341882": "������",
"350000": "����ʡ",
"350100": "������",
"350102": "��¥��",
"350103": "̨����",
"350104": "��ɽ��",
"350105": "���",
"350111": "������",
"350121": "������",
"350122": "������",
"350123": "��Դ��",
"350124": "������",
"350125": "��̩��",
"350128": "ƽ̶��",
"350181": "������",
"350182": "������",
"350183": "������",
"350200": "������",
"350203": "˼����",
"350205": "������",
"350206": "������",
"350211": "������",
"350212": "ͬ����",
"350213": "�谲��",
"350214": "������",
"350300": "������",
"350302": "������",
"350303": "������",
"350304": "�����",
"350305": "������",
"350322": "������",
"350323": "������",
"350400": "������",
"350402": "÷����",
"350403": "��Ԫ��",
"350421": "��Ϫ��",
"350423": "������",
"350424": "������",
"350425": "������",
"350426": "��Ϫ��",
"350427": "ɳ��",
"350428": "������",
"350429": "̩����",
"350430": "������",
"350481": "������",
"350482": "������",
"350500": "Ȫ����",
"350502": "�����",
"350503": "������",
"350504": "�彭��",
"350505": "Ȫ����",
"350521": "�ݰ���",
"350524": "��Ϫ��",
"350525": "������",
"350526": "�»���",
"350527": "������",
"350581": "ʯʨ��",
"350582": "������",
"350583": "�ϰ���",
"350584": "������",
"350600": "������",
"350602": "ܼ����",
"350603": "������",
"350622": "������",
"350623": "������",
"350624": "گ����",
"350625": "��̩��",
"350626": "��ɽ��",
"350627": "�Ͼ���",
"350628": "ƽ����",
"350629": "������",
"350681": "������",
"350682": "������",
"350700": "��ƽ��",
"350702": "��ƽ��",
"350721": "˳����",
"350722": "�ֳ���",
"350723": "������",
"350724": "��Ϫ��",
"350725": "������",
"350781": "������",
"350782": "����ɽ��",
"350783": "�����",
"350784": "������",
"350785": "������",
"350800": "������",
"350802": "������",
"350821": "��͡��",
"350822": "������",
"350823": "�Ϻ���",
"350824": "��ƽ��",
"350825": "������",
"350881": "��ƽ��",
"350882": "������",
"350900": "������",
"350902": "������",
"350921": "ϼ����",
"350922": "������",
"350923": "������",
"350924": "������",
"350925": "������",
"350926": "������",
"350981": "������",
"350982": "������",
"350983": "������",
"360000": "����ʡ",
"360100": "�ϲ���",
"360102": "������",
"360103": "������",
"360104": "��������",
"360105": "������",
"360111": "��ɽ����",
"360121": "�ϲ���",
"360122": "�½���",
"360123": "������",
"360124": "������",
"360128": "������",
"360200": "��������",
"360202": "������",
"360203": "��ɽ��",
"360222": "������",
"360281": "��ƽ��",
"360282": "������",
"360300": "Ƽ����",
"360302": "��Դ��",
"360313": "�涫��",
"360321": "������",
"360322": "������",
"360323": "«Ϫ��",
"360324": "������",
"360400": "����",
"360402": "®ɽ��",
"360403": "�����",
"360421": "����",
"360423": "������",
"360424": "��ˮ��",
"360425": "������",
"360426": "�°���",
"360427": "������",
"360428": "������",
"360429": "������",
"360430": "������",
"360481": "�����",
"360482": "������",
"360483": "�������",
"360500": "������",
"360502": "��ˮ��",
"360521": "������",
"360522": "������",
"360600": "ӥ̶��",
"360602": "�º���",
"360622": "���",
"360681": "��Ϫ��",
"360682": "������",
"360700": "������",
"360702": "�¹���",
"360721": "����",
"360722": "�ŷ���",
"360723": "������",
"360724": "������",
"360725": "������",
"360726": "��Զ��",
"360727": "������",
"360728": "������",
"360729": "ȫ����",
"360730": "������",
"360731": "�ڶ���",
"360732": "�˹���",
"360733": "�����",
"360734": "Ѱ����",
"360735": "ʯ����",
"360781": "�����",
"360782": "�Ͽ���",
"360783": "������",
"360800": "������",
"360802": "������",
"360803": "��ԭ��",
"360821": "������",
"360822": "��ˮ��",
"360823": "Ͽ����",
"360824": "�¸���",
"360825": "������",
"360826": "̩����",
"360827": "�촨��",
"360828": "����",
"360829": "������",
"360830": "������",
"360881": "����ɽ��",
"360882": "������",
"360900": "�˴���",
"360902": "Ԭ����",
"360921": "������",
"360922": "������",
"360923": "�ϸ���",
"360924": "�˷���",
"360925": "������",
"360926": "ͭ����",
"360981": "�����",
"360982": "������",
"360983": "�߰���",
"360984": "������",
"361000": "������",
"361002": "�ٴ���",
"361021": "�ϳ���",
"361022": "�质��",
"361023": "�Ϸ���",
"361024": "������",
"361025": "�ְ���",
"361026": "�˻���",
"361027": "��Ϫ��",
"361028": "��Ϫ��",
"361029": "������",
"361030": "�����",
"361031": "������",
"361100": "������",
"361102": "������",
"361121": "������",
"361122": "�����",
"361123": "��ɽ��",
"361124": "Ǧɽ��",
"361125": "�����",
"361126": "߮����",
"361127": "�����",
"361128": "۶����",
"361129": "������",
"361130": "��Դ��",
"361181": "������",
"361182": "������",
"370000": "ɽ��ʡ",
"370100": "������",
"370102": "������",
"370103": "������",
"370104": "������",
"370105": "������",
"370112": "������",
"370113": "������",
"370124": "ƽ����",
"370125": "������",
"370126": "�̺���",
"370181": "������",
"370182": "������",
"370200": "�ൺ��",
"370202": "������",
"370203": "���",
"370211": "�Ƶ���",
"370212": "��ɽ��",
"370213": "�����",
"370214": "������",
"370281": "������",
"370282": "���",
"370283": "ƽ����",
"370285": "������",
"370286": "������",
"370300": "�Ͳ���",
"370302": "�ʹ���",
"370303": "�ŵ���",
"370304": "��ɽ��",
"370305": "������",
"370306": "�ܴ���",
"370321": "��̨��",
"370322": "������",
"370323": "��Դ��",
"370324": "������",
"370400": "��ׯ��",
"370402": "������",
"370403": "Ѧ����",
"370404": "ỳ���",
"370405": "̨��ׯ��",
"370406": "ɽͤ��",
"370481": "������",
"370482": "������",
"370500": "��Ӫ��",
"370502": "��Ӫ��",
"370503": "�ӿ���",
"370521": "������",
"370522": "������",
"370523": "������",
"370591": "������",
"370600": "��̨��",
"370602": "֥���",
"370611": "��ɽ��",
"370612": "IJƽ��",
"370613": "��ɽ��",
"370634": "������",
"370681": "������",
"370682": "������",
"370683": "������",
"370684": "������",
"370685": "��Զ��",
"370686": "��ϼ��",
"370687": "������",
"370688": "������",
"370700": "����",
"370702": "����",
"370703": "��ͤ��",
"370704": "������",
"370705": "������",
"370724": "������",
"370725": "������",
"370781": "������",
"370782": "�����",
"370783": "�ٹ���",
"370784": "������",
"370785": "������",
"370786": "������",
"370787": "������",
"370800": "������",
"370802": "������",
"370811": "���",
"370826": "ɽ��",
"370827": "��̨��",
"370828": "������",
"370829": "������",
"370830": "������",
"370831": "��ˮ��",
"370832": "��ɽ��",
"370881": "������",
"370882": "������",
"370883": "����",
"370884": "������",
"370900": "̩����",
"370902": "̩ɽ��",
"370903": "�����",
"370921": "������",
"370923": "��ƽ��",
"370982": "��̩��",
"370983": "�ʳ���",
"370984": "������",
"371000": "������",
"371002": "������",
"371081": "�ĵ���",
"371082": "�ٳ���",
"371083": "��ɽ��",
"371084": "������",
"371100": "������",
"371102": "������",
"371103": "�ɽ��",
"371121": "������",
"371122": "����",
"371123": "������",
"371200": "������",
"371202": "������",
"371203": "�ֳ���",
"371204": "������",
"371300": "������",
"371302": "��ɽ��",
"371311": "��ׯ��",
"371312": "�Ӷ���",
"371321": "������",
"371322": "۰����",
"371323": "��ˮ��",
"371324": "��ɽ��",
"371325": "����",
"371326": "ƽ����",
"371327": "������",
"371328": "������",
"371329": "������",
"371330": "������",
"371400": "������",
"371402": "�³���",
"371421": "����",
"371422": "������",
"371423": "������",
"371424": "������",
"371425": "�����",
"371426": "ƽԭ��",
"371427": "�Ľ���",
"371428": "�����",
"371481": "������",
"371482": "�����",
"371483": "������",
"371500": "�ij���",
"371502": "��������",
"371521": "�����",
"371522": "ݷ��",
"371523": "��ƽ��",
"371524": "������",
"371525": "����",
"371526": "������",
"371581": "������",
"371582": "������",
"371600": "������",
"371602": "������",
"371621": "������",
"371622": "������",
"371623": "�����",
"371624": "մ����",
"371625": "������",
"371626": "��ƽ��",
"371627": "������",
"371700": "������",
"371702": "ĵ����",
"371721": "����",
"371722": "����",
"371723": "������",
"371724": "��Ұ��",
"371725": "۩����",
"371726": "۲����",
"371727": "������",
"371728": "������",
"371729": "������",
"410000": "����ʡ",
"410100": "֣����",
"410102": "��ԭ��",
"410103": "������",
"410104": "�ܳǻ�����",
"410105": "��ˮ��",
"410106": "�Ͻ���",
"410108": "�ݼ���",
"410122": "��IJ��",
"410181": "������",
"410182": "������",
"410183": "������",
"410184": "��֣��",
"410185": "�Ƿ���",
"410188": "������",
"410200": "������",
"410202": "��ͤ��",
"410203": "˳�ӻ�����",
"410204": "��¥��",
"410205": "����̨��",
"410211": "������",
"410221": "���",
"410222": "ͨ����",
"410223": "���",
"410224": "������",
"410225": "������",
"410226": "������",
"410300": "������",
"410302": "�ϳ���",
"410303": "������",
"410304": "�e�ӻ�����",
"410305": "������",
"410306": "������",
"410307": "������",
"410322": "�Ͻ���",
"410323": "�°���",
"410324": "�ﴨ��",
"410325": "����",
"410326": "������",
"410327": "������",
"410328": "������",
"410329": "������",
"410381": "��ʦ��",
"410400": "ƽ��ɽ��",
"410402": "�»���",
"410403": "������",
"410404": "ʯ����",
"410411": "տ����",
"410421": "������",
"410422": "Ҷ��",
"410423": "³ɽ��",
"410425": "ۣ��",
"410481": "�����",
"410482": "������",
"410483": "������",
"410500": "������",
"410502": "���",
"410503": "������",
"410505": "����",
"410506": "������",
"410522": "������",
"410523": "������",
"410526": "����",
"410527": "�ڻ���",
"410581": "������",
"410582": "������",
"410600": "�ױ���",
"410602": "��ɽ��",
"410603": "ɽ����",
"410611": "俱���",
"410621": "����",
"410622": "���",
"410623": "������",
"410700": "������",
"410702": "������",
"410703": "������",
"410704": "��Ȫ��",
"410711": "��Ұ��",
"410721": "������",
"410724": "�����",
"410725": "ԭ����",
"410726": "�ӽ���",
"410727": "������",
"410728": "��ԫ��",
"410781": "������",
"410782": "������",
"410783": "������",
"410800": "������",
"410802": "�����",
"410803": "��վ��",
"410804": "�����",
"410811": "ɽ����",
"410821": "������",
"410822": "������",
"410823": "������",
"410825": "����",
"410881": "��Դ��",
"410882": "������",
"410883": "������",
"410884": "������",
"410900": "�����",
"410902": "������",
"410922": "�����",
"410923": "������",
"410926": "����",
"410927": "̨ǰ��",
"410928": "�����",
"410929": "������",
"411000": "�����",
"411002": "���",
"411023": "�����",
"411024": "۳����",
"411025": "�����",
"411081": "������",
"411082": "������",
"411083": "������",
"411100": "�����",
"411102": "Դ����",
"411103": "۱����",
"411104": "������",
"411121": "������",
"411122": "�����",
"411123": "������",
"411200": "����Ͽ��",
"411202": "������",
"411221": "�ų���",
"411222": "����",
"411224": "¬����",
"411281": "������",
"411282": "�鱦��",
"411283": "������",
"411300": "������",
"411302": "�����",
"411303": "������",
"411321": "������",
"411322": "������",
"411323": "��Ͽ��",
"411324": "��ƽ��",
"411325": "������",
"411326": "������",
"411327": "������",
"411328": "�ƺ���",
"411329": "��Ұ��",
"411330": "ͩ����",
"411381": "������",
"411382": "������",
"411400": "������",
"411402": "����",
"411403": "�����",
"411421": "��Ȩ��",
"411422": "���",
"411423": "������",
"411424": "�ϳ���",
"411425": "�ݳ���",
"411426": "������",
"411481": "������",
"411482": "������",
"411500": "������",
"411502": "������",
"411503": "ƽ����",
"411521": "��ɽ��",
"411522": "��ɽ��",
"411523": "����",
"411524": "�̳���",
"411525": "��ʼ��",
"411526": "�괨��",
"411527": "������",
"411528": "Ϣ��",
"411529": "������",
"411600": "�ܿ���",
"411602": "������",
"411621": "������",
"411622": "������",
"411623": "��ˮ��",
"411624": "������",
"411625": "������",
"411626": "������",
"411627": "̫����",
"411628": "¹����",
"411681": "�����",
"411682": "������",
"411700": "פ�����",
"411702": "�����",
"411721": "��ƽ��",
"411722": "�ϲ���",
"411723": "ƽ����",
"411724": "������",
"411725": "ȷɽ��",
"411726": "������",
"411727": "������",
"411728": "��ƽ��",
"411729": "�²���",
"411730": "������",
"420000": "����ʡ",
"420100": "�人��",
"420102": "������",
"420103": "������",
"420104": "�~����",
"420105": "������",
"420106": "�����",
"420107": "��ɽ��",
"420111": "��ɽ��",
"420112": "��������",
"420113": "������",
"420114": "�̵���",
"420115": "������",
"420116": "������",
"420117": "������",
"420118": "������",
"420200": "��ʯ��",
"420202": "��ʯ����",
"420203": "����ɽ��",
"420204": "��½��",
"420205": "��ɽ��",
"420222": "������",
"420281": "��ұ��",
"420282": "������",
"420300": "ʮ����",
"420302": "���",
"420303": "������",
"420321": "����",
"420322": "������",
"420323": "��ɽ��",
"420324": "��Ϫ��",
"420325": "����",
"420381": "��������",
"420383": "������",
"420500": "�˲���",
"420502": "������",
"420503": "��Ҹ���",
"420504": "�����",
"420505": "�Vͤ��",
"420506": "������",
"420525": "Զ����",
"420526": "��ɽ��",
"420527": "������",
"420528": "����������������",
"420529": "���������������",
"420581": "�˶���",
"420582": "������",
"420583": "֦����",
"420584": "������",
"420600": "������",
"420602": "�����",
"420606": "������",
"420607": "������",
"420624": "������",
"420625": "�ȳ���",
"420626": "������",
"420682": "�Ϻӿ���",
"420683": "������",
"420684": "�˳���",
"420685": "������",
"420700": "������",
"420702": "���Ӻ���",
"420703": "������",
"420704": "������",
"420705": "������",
"420800": "������",
"420802": "������",
"420804": "����",
"420821": "��ɽ��",
"420822": "ɳ����",
"420881": "������",
"420882": "������",
"420900": "����",
"420902": "����",
"420921": "����",
"420922": "������",
"420923": "������",
"420981": "Ӧ����",
"420982": "��½��",
"420984": "������",
"420985": "������",
"421000": "������",
"421002": "ɳ����",
"421003": "������",
"421022": "������",
"421023": "������",
"421024": "������",
"421081": "ʯ����",
"421083": "�����",
"421087": "������",
"421088": "������",
"421100": "�Ƹ���",
"421102": "������",
"421121": "�ŷ���",
"421122": "�찲��",
"421123": "������",
"421124": "Ӣɽ��",
"421125": "�ˮ��",
"421126": "ޭ����",
"421127": "��÷��",
"421181": "�����",
"421182": "��Ѩ��",
"421183": "������",
"421200": "������",
"421202": "�̰���",
"421221": "������",
"421222": "ͨ����",
"421223": "������",
"421224": "ͨɽ��",
"421281": "�����",
"421283": "������",
"421300": "������",
"421302": "������",
"421321": "����",
"421381": "��ˮ��",
"421382": "������",
"422800": "��ʩ����������������",
"422801": "��ʩ��",
"422802": "������",
"422822": "��ʼ��",
"422823": "�Ͷ���",
"422825": "������",
"422826": "�̷���",
"422827": "������",
"422828": "����",
"422829": "������",
"429004": "������",
"429005": "DZ����",
"429006": "������",
"429021": "��ũ������",
"430000": "����ʡ",
"430100": "��ɳ��",
"430102": "ܽ����",
"430103": "������",
"430104": "��´��",
"430105": "������",
"430111": "�껨��",
"430121": "��ɳ��",
"430122": "������",
"430124": "������",
"430181": "�����",
"430182": "������",
"430200": "������",
"430202": "������",
"430203": "«����",
"430204": "ʯ����",
"430211": "��Ԫ��",
"430221": "������",
"430223": "����",
"430224": "������",
"430225": "������",
"430281": "������",
"430282": "������",
"430300": "��̶��",
"430302": "�����",
"430304": "������",
"430321": "��̶��",
"430381": "������",
"430382": "��ɽ��",
"430383": "������",
"430400": "������",
"430405": "������",
"430406": "�����",
"430407": "ʯ����",
"430408": "������",
"430412": "������",
"430421": "������",
"430422": "������",
"430423": "��ɽ��",
"430424": "�ⶫ��",
"430426": "���",
"430481": "������",
"430482": "������",
"430483": "������",
"430500": "������",
"430502": "˫����",
"430503": "������",
"430511": "������",
"430521": "�۶���",
"430522": "������",
"430523": "������",
"430524": "¡����",
"430525": "������",
"430527": "������",
"430528": "������",
"430529": "�Dz�����������",
"430581": "�����",
"430582": "������",
"430600": "������",
"430602": "����¥��",
"430603": "��Ϫ��",
"430611": "��ɽ��",
"430621": "������",
"430623": "������",
"430624": "������",
"430626": "ƽ����",
"430681": "������",
"430682": "������",
"430683": "������",
"430700": "������",
"430702": "������",
"430703": "������",
"430721": "������",
"430722": "������",
"430723": "���",
"430724": "�����",
"430725": "��Դ��",
"430726": "ʯ����",
"430781": "������",
"430782": "������",
"430800": "�żҽ���",
"430802": "������",
"430811": "����Դ��",
"430821": "������",
"430822": "ɣֲ��",
"430823": "������",
"430900": "������",
"430902": "������",
"430903": "��ɽ��",
"430921": "����",
"430922": "�ҽ���",
"430923": "������",
"430981": "�佭��",
"430982": "������",
"431000": "������",
"431002": "������",
"431003": "������",
"431021": "������",
"431022": "������",
"431023": "������",
"431024": "���",
"431025": "������",
"431026": "�����",
"431027": "����",
"431028": "������",
"431081": "������",
"431082": "������",
"431100": "������",
"431102": "������",
"431103": "��ˮ̲��",
"431121": "������",
"431122": "������",
"431123": "˫����",
"431124": "����",
"431125": "������",
"431126": "��Զ��",
"431127": "��ɽ��",
"431128": "������",
"431129": "��������������",
"431130": "������",
"431200": "������",
"431202": "�׳���",
"431221": "���",
"431222": "������",
"431223": "��Ϫ��",
"431224": "������",
"431225": "��ͬ��",
"431226": "��������������",
"431227": "�»ζ���������",
"431228": "�ƽ�����������",
"431229": "�������嶱��������",
"431230": "ͨ������������",
"431281": "�齭��",
"431282": "������",
"431300": "¦����",
"431302": "¦����",
"431321": "˫����",
"431322": "�»���",
"431381": "��ˮ����",
"431382": "��Դ��",
"431383": "������",
"433100": "��������������������",
"433101": "������",
"433122": "��Ϫ��",
"433123": "�����",
"433124": "��ԫ��",
"433125": "������",
"433126": "������",
"433127": "��˳��",
"433130": "��ɽ��",
"433131": "������",
"440000": "�㶫ʡ",
"440100": "������",
"440103": "������",
"440104": "Խ����",
"440105": "������",
"440106": "�����",
"440111": "������",
"440112": "������",
"440113": "��خ��",
"440114": "������",
"440115": "��ɳ��",
"440116": "�ܸ���",
"440183": "������",
"440184": "�ӻ���",
"440189": "������",
"440200": "�ع���",
"440203": "�佭��",
"440204": "䥽���",
"440205": "������",
"440222": "ʼ����",
"440224": "�ʻ���",
"440229": "��Դ��",
"440232": "��Դ����������",
"440233": "�·���",
"440281": "�ֲ���",
"440282": "������",
"440283": "������",
"440300": "������",
"440303": "����",
"440304": "������",
"440305": "��ɽ��",
"440306": "������",
"440307": "������",
"440308": "������",
"440309": "������",
"440320": "��������",
"440321": "ƺɽ����",
"440322": "��������",
"440323": "��������",
"440400": "�麣��",
"440402": "������",
"440403": "������",
"440404": "������",
"440488": "������",
"440500": "��ͷ��",
"440507": "������",
"440511": "��ƽ��",
"440512": "婽���",
"440513": "������",
"440514": "������",
"440515": "���",
"440523": "�ϰ���",
"440524": "������",
"440600": "��ɽ��",
"440604": "������",
"440605": "�Ϻ���",
"440606": "˳����",
"440607": "��ˮ��",
"440608": "������",
"440609": "������",
"440700": "������",
"440703": "���",
"440704": "������",
"440705": "�»���",
"440781": "̨ɽ��",
"440783": "��ƽ��",
"440784": "��ɽ��",
"440785": "��ƽ��",
"440786": "������",
"440800": "տ����",
"440802": "���",
"440803": "ϼɽ��",
"440804": "��ͷ��",
"440811": "������",
"440823": "��Ϫ��",
"440825": "������",
"440881": "������",
"440882": "������",
"440883": "���",
"440884": "������",
"440900": "���",
"440902": "���",
"440903": "���",
"440923": "�����",
"440981": "������",
"440982": "������",
"440983": "������",
"440984": "������",
"441200": "������",
"441202": "������",
"441203": "������",
"441223": "������",
"441224": "������",
"441225": "���",
"441226": "������",
"441283": "��Ҫ��",
"441284": "����",
"441285": "������",
"441300": "������",
"441302": "�ݳ���",
"441303": "������",
"441322": "������",
"441323": "�ݶ���",
"441324": "������",
"441325": "������",
"441400": "÷����",
"441402": "÷����",
"441421": "÷��",
"441422": "������",
"441423": "��˳��",
"441424": "�廪��",
"441426": "ƽԶ��",
"441427": "������",
"441481": "������",
"441482": "������",
"441500": "���",
"441502": "����",
"441521": "������",
"441523": "½����",
"441581": "½����",
"441582": "������",
"441600": "��Դ��",
"441602": "Դ����",
"441621": "�Ͻ���",
"441622": "������",
"441623": "��ƽ��",
"441624": "��ƽ��",
"441625": "��Դ��",
"441626": "������",
"441700": "����",
"441702": "������",
"441721": "������",
"441723": "����",
"441781": "����",
"441782": "������",
"441800": "��Զ��",
"441802": "�����",
"441821": "�����",
"441823": "��ɽ��",
"441825": "��ɽ׳������������",
"441826": "��������������",
"441827": "������",
"441881": "Ӣ����",
"441882": "������",
"441883": "������",
"441900": "��ݸ��",
"442000": "��ɽ��",
"442101": "��ɳȺ��",
"445100": "������",
"445102": "������",
"445121": "������",
"445122": "��ƽ��",
"445186": "������",
"445200": "������",
"445202": "�ų���",
"445221": "�Ҷ���",
"445222": "������",
"445224": "������",
"445281": "������",
"445285": "������",
"445300": "�Ƹ���",
"445302": "�Ƴ���",
"445321": "������",
"445322": "������",
"445323": "�ư���",
"445381": "����",
"445382": "������",
"450000": "����׳��������",
"450100": "������",
"450102": "������",
"450103": "������",
"450105": "������",
"450107": "��������",
"450108": "������",
"450109": "������",
"450122": "������",
"450123": "¡����",
"450124": "��ɽ��",
"450125": "������",
"450126": "������",
"450127": "����",
"450128": "������",
"450200": "������",
"450202": "������",
"450203": "�����",
"450204": "������",
"450205": "������",
"450221": "������",
"450222": "������",
"450223": "¹կ��",
"450224": "�ڰ���",
"450225": "��ˮ����������",
"450226": "��������������",
"450227": "������",
"450300": "������",
"450302": "�����",
"450303": "������",
"450304": "��ɽ��",
"450305": "������",
"450311": "��ɽ��",
"450321": "��˷��",
"450322": "�ٹ���",
"450323": "�鴨��",
"450324": "ȫ����",
"450325": "�˰���",
"450326": "������",
"450327": "������",
"450328": "��ʤ����������",
"450329": "��Դ��",
"450330": "ƽ����",
"450331": "������",
"450332": "��������������",
"450333": "������",
"450400": "������",
"450403": "������",
"450405": "������",
"450406": "������",
"450421": "������",
"450422": "����",
"450423": "��ɽ��",
"450481": "�Ϫ��",
"450482": "������",
"450500": "������",
"450502": "������",
"450503": "������",
"450512": "��ɽ����",
"450521": "������",
"450522": "������",
"450600": "���Ǹ���",
"450602": "�ۿ���",
"450603": "������",
"450621": "��˼��",
"450681": "������",
"450682": "������",
"450700": "������",
"450702": "������",
"450703": "�ձ���",
"450721": "��ɽ��",
"450722": "�ֱ���",
"450723": "������",
"450800": "�����",
"450802": "�۱���",
"450803": "������",
"450804": "������",
"450821": "ƽ����",
"450881": "��ƽ��",
"450882": "������",
"450900": "������",
"450902": "������",
"450903": "������",
"450921": "����",
"450922": "½����",
"450923": "������",
"450924": "��ҵ��",
"450981": "������",
"450982": "������",
"451000": "��ɫ��",
"451002": "�ҽ���",
"451021": "������",
"451022": "�ﶫ��",
"451023": "ƽ����",
"451024": "�±���",
"451025": "������",
"451026": "������",
"451027": "������",
"451028": "��ҵ��",
"451029": "������",
"451030": "������",
"451031": "¡�ָ���������",
"451032": "������",
"451100": "������",
"451102": "�˲���",
"451119": "ƽ�������",
"451121": "��ƽ��",
"451122": "��ɽ��",
"451123": "��������������",
"451124": "������",
"451200": "�ӳ���",
"451202": "��ǽ���",
"451221": "�ϵ���",
"451222": "�����",
"451223": "��ɽ��",
"451224": "������",
"451225": "��������������",
"451226": "�������������",
"451227": "��������������",
"451228": "��������������",
"451229": "������������",
"451281": "������",
"451282": "������",
"451300": "������",
"451302": "�˱���",
"451321": "��",
"451322": "������",
"451323": "������",
"451324": "��������������",
"451381": "��ɽ��",
"451382": "������",
"451400": "������",
"451402": "������",
"451421": "������",
"451422": "������",
"451423": "������",
"451424": "������",
"451425": "�����",
"451481": "ƾ����",
"451482": "������",
"460000": "����ʡ",
"460100": "������",
"460105": "��Ӣ��",
"460106": "������",
"460107": "��ɽ��",
"460108": "������",
"460109": "������",
"460200": "������",
"460300": "��ɳ��",
"460321": "��ɳȺ��",
"460322": "��ɳȺ��",
"460323": "��ɳȺ���ĵ������亣��",
"469001": "��ָɽ��",
"469002": "����",
"469003": "������",
"469005": "�IJ���",
"469006": "������",
"469007": "������",
"469025": "������",
"469026": "�Ͳ���",
"469027": "������",
"469028": "�ٸ���",
"469030": "��ɳ����������",
"469031": "��������������",
"469033": "�ֶ�����������",
"469034": "��ˮ����������",
"469035": "��ͤ��������������",
"469036": "������������������",
"471005": "������",
"500000": "����",
"500100": "������",
"500101": "������",
"500102": "������",
"500103": "������",
"500104": "��ɿ���",
"500105": "������",
"500106": "ɳƺ����",
"500107": "��������",
"500108": "�ϰ���",
"500109": "������",
"500110": "��ʢ��",
"500111": "˫����",
"500112": "�山��",
"500113": "������",
"500114": "ǭ����",
"500115": "������",
"500222": "�뽭��",
"500223": "������",
"500224": "ͭ����",
"500225": "������",
"500226": "�ٲ���",
"500227": "�ɽ��",
"500228": "��ƽ��",
"500229": "�ǿ���",
"500230": "�ᶼ��",
"500231": "�潭��",
"500232": "��¡��",
"500233": "����",
"500234": "����",
"500235": "������",
"500236": "�����",
"500237": "��ɽ��",
"500238": "��Ϫ��",
"500240": "ʯ��������������",
"500241": "��ɽ����������������",
"500242": "��������������������",
"500243": "��ˮ����������������",
"500381": "������",
"500382": "�ϴ���",
"500383": "������",
"500384": "�ϴ���",
"500385": "������",
"510000": "�Ĵ�ʡ",
"510100": "�ɶ���",
"510104": "������",
"510105": "������",
"510106": "��ţ��",
"510107": "�����",
"510108": "�ɻ���",
"510112": "��Ȫ����",
"510113": "�����",
"510114": "�¶���",
"510115": "�½���",
"510121": "������",
"510122": "˫����",
"510124": "ۯ��",
"510129": "������",
"510131": "�ѽ���",
"510132": "�½���",
"510181": "��������",
"510182": "������",
"510183": "������",
"510184": "������",
"510185": "������",
"510300": "�Թ���",
"510302": "��������",
"510303": "������",
"510304": "����",
"510311": "��̲��",
"510321": "����",
"510322": "��˳��",
"510323": "������",
"510400": "��֦����",
"510402": "����",
"510403": "����",
"510411": "�ʺ���",
"510421": "������",
"510422": "���",
"510423": "������",
"510500": "������",
"510502": "������",
"510503": "��Ϫ��",
"510504": "����̶��",
"510521": "����",
"510522": "�Ͻ���",
"510524": "������",
"510525": "������",
"510526": "������",
"510600": "������",
"510603": "�����",
"510623": "���",
"510626": "����",
"510681": "�㺺��",
"510682": "ʲ����",
"510683": "������",
"510684": "������",
"510700": "������",
"510703": "������",
"510704": "������",
"510722": "��̨��",
"510723": "��ͤ��",
"510724": "����",
"510725": "������",
"510726": "����Ǽ��������",
"510727": "ƽ����",
"510781": "������",
"510782": "������",
"510800": "��Ԫ��",
"510802": "������",
"510811": "�ѻ���",
"510812": "������",
"510821": "������",
"510822": "�ന��",
"510823": "������",
"510824": "��Ϫ��",
"510825": "������",
"510900": "������",
"510903": "��ɽ��",
"510904": "������",
"510921": "��Ϫ��",
"510922": "�����",
"510923": "��Ӣ��",
"510924": "������",
"511000": "�ڽ���",
"511002": "������",
"511011": "������",
"511024": "��Զ��",
"511025": "������",
"511028": "¡����",
"511029": "������",
"511100": "��ɽ��",
"511102": "������",
"511111": "ɳ����",
"511112": "��ͨ����",
"511113": "��ں���",
"511123": "����",
"511124": "������",
"511126": "���",
"511129": "�崨��",
"511132": "�������������",
"511133": "�������������",
"511181": "��üɽ��",
"511182": "������",
"511300": "�ϳ���",
"511302": "˳����",
"511303": "��ƺ��",
"511304": "������",
"511321": "�ϲ���",
"511322": "Ӫɽ��",
"511323": "���",
"511324": "��¤��",
"511325": "������",
"511381": "������",
"511382": "������",
"511400": "üɽ��",
"511402": "������",
"511421": "������",
"511422": "��ɽ��",
"511423": "������",
"511424": "������",
"511425": "������",
"511426": "������",
"511500": "�˱���",
"511502": "������",
"511521": "�˱���",
"511522": "��Ϫ��",
"511523": "������",
"511524": "������",
"511525": "����",
"511526": "����",
"511527": "������",
"511528": "������",
"511529": "��ɽ��",
"511530": "������",
"511600": "�㰲��",
"511602": "�㰲��",
"511603": "ǰ����",
"511621": "������",
"511622": "��ʤ��",
"511623": "��ˮ��",
"511681": "������",
"511683": "������",
"511700": "������",
"511702": "ͨ����",
"511721": "�ﴨ��",
"511722": "������",
"511723": "������",
"511724": "������",
"511725": "����",
"511781": "��Դ��",
"511782": "������",
"511800": "����",
"511802": "�����",
"511821": "��ɽ��",
"511822": "������",
"511823": "��Դ��",
"511824": "ʯ����",
"511825": "��ȫ��",
"511826": "«ɽ��",
"511827": "������",
"511828": "������",
"511900": "������",
"511902": "������",
"511903": "������",
"511921": "ͨ����",
"511922": "�Ͻ���",
"511923": "ƽ����",
"511924": "������",
"512000": "������",
"512002": "�㽭��",
"512021": "������",
"512022": "������",
"512081": "������",
"512082": "������",
"513200": "���Ӳ���Ǽ��������",
"513221": "�봨��",
"513222": "����",
"513223": "�",
"513224": "������",
"513225": "��կ����",
"513226": "����",
"513227": "����",
"513228": "��ˮ��",
"513229": "�������",
"513230": "������",
"513231": "������",
"513232": "�������",
"513233": "��ԭ��",
"513234": "������",
"513300": "�����������",
"513321": "������",
"513322": "����",
"513323": "������",
"513324": "������",
"513325": "����",
"513326": "������",
"513327": "¯����",
"513328": "������",
"513329": "������",
"513330": "�¸���",
"513331": "������",
"513332": "ʯ����",
"513333": "ɫ����",
"513334": "������",
"513335": "������",
"513336": "�����",
"513337": "������",
"513338": "������",
"513339": "������",
"513400": "��ɽ����������",
"513401": "������",
"513422": "ľ�����������",
"513423": "��Դ��",
"513424": "�²���",
"513425": "������",
"513426": "�ᶫ��",
"513427": "������",
"513428": "�ո���",
"513429": "������",
"513430": "������",
"513431": "�Ѿ���",
"513432": "ϲ����",
"513433": "������",
"513434": "Խ����",
"513435": "������",
"513436": "������",
"513437": "�ײ���",
"513438": "������",
"520000": "����ʡ",
"520100": "������",
"520102": "������",
"520103": "������",
"520111": "��Ϫ��",
"520112": "�ڵ���",
"520113": "������",
"520121": "������",
"520122": "Ϣ����",
"520123": "������",
"520151": "��ɽ����",
"520181": "������",
"520182": "������",
"520200": "����ˮ��",
"520201": "��ɽ��",
"520203": "��֦����",
"520221": "ˮ����",
"520222": "����",
"520223": "������",
"520300": "������",
"520302": "�컨����",
"520303": "�㴨��",
"520321": "������",
"520322": "ͩ����",
"520323": "������",
"520324": "������",
"520325": "��������������������",
"520326": "������������������",
"520327": "�����",
"520328": "��̶��",
"520329": "������",
"520330": "ϰˮ��",
"520381": "��ˮ��",
"520382": "�ʻ���",
"520383": "������",
"520400": "��˳��",
"520402": "������",
"520421": "ƽ����",
"520422": "�ն���",
"520423": "��������������������",
"520424": "���벼��������������",
"520425": "�������岼����������",
"520426": "������",
"522200": "ͭ����",
"522201": "�̽���",
"522222": "������",
"522223": "��������������",
"522224": "ʯ����",
"522225": "˼����",
"522226": "ӡ������������������",
"522227": "�½���",
"522228": "�غ�������������",
"522229": "��������������",
"522230": "��ɽ��",
"522231": "������",
"522300": "ǭ���ϲ���������������",
"522301": "������",
"522322": "������",
"522323": "�հ���",
"522324": "��¡��",
"522325": "�����",
"522326": "������",
"522327": "�����",
"522328": "������",
"522329": "������",
"522400": "�Ͻ���",
"522401": "���ǹ���",
"522422": "����",
"522423": "ǭ����",
"522424": "��ɳ��",
"522425": "֯����",
"522426": "��Ӻ��",
"522427": "���������������������",
"522428": "������",
"522429": "������",
"522600": "ǭ�������嶱��������",
"522601": "������",
"522622": "��ƽ��",
"522623": "ʩ����",
"522624": "������",
"522625": "��Զ��",
"522626": "���",
"522627": "������",
"522628": "������",
"522629": "������",
"522630": "̨����",
"522631": "��ƽ��",
"522632": "����",
"522633": "�ӽ���",
"522634": "��ɽ��",
"522635": "�齭��",
"522636": "��կ��",
"522637": "������",
"522700": "ǭ�ϲ���������������",
"522701": "������",
"522702": "��Ȫ��",
"522722": "����",
"522723": "����",
"522725": "�Ͱ���",
"522726": "��ɽ��",
"522727": "ƽ����",
"522728": "����",
"522729": "��˳��",
"522730": "������",
"522731": "��ˮ��",
"522732": "����ˮ��������",
"522733": "������",
"530000": "����ʡ",
"530100": "������",
"530102": "�廪��",
"530103": "������",
"530111": "�ٶ���",
"530112": "��ɽ��",
"530113": "������",
"530121": "�ʹ���",
"530122": "������",
"530124": "������",
"530125": "������",
"530126": "ʯ������������",
"530127": "������",
"530128": "»Ȱ��������������",
"530129": "Ѱ���������������",
"530181": "������",
"530182": "������",
"530300": "������",
"530302": "������",
"530321": "������",
"530322": "½����",
"530323": "ʦ����",
"530324": "��ƽ��",
"530325": "��Դ��",
"530326": "������",
"530328": "մ����",
"530381": "������",
"530382": "������",
"530400": "��Ϫ��",
"530402": "������",
"530421": "������",
"530422": "���",
"530423": "ͨ����",
"530424": "������",
"530425": "������",
"530426": "��ɽ����������",
"530427": "��ƽ�������������",
"530428": "Ԫ���������������������",
"530429": "������",
"530500": "��ɽ��",
"530502": "¡����",
"530521": "ʩ����",
"530522": "�ڳ���",
"530523": "������",
"530524": "������",
"530525": "������",
"530600": "��ͨ��",
"530602": "������",
"530621": "³����",
"530622": "�ɼ���",
"530623": "���",
"530624": "�����",
"530625": "������",
"530626": "�罭��",
"530627": "������",
"530628": "������",
"530629": "������",
"530630": "ˮ����",
"530631": "������",
"530700": "������",
"530702": "�ų���",
"530721": "����������������",
"530722": "��ʤ��",
"530723": "��ƺ��",
"530724": "��������������",
"530725": "������",
"530800": "�ն���",
"530802": "˼é��",
"530821": "��������������������",
"530822": "�������������",
"530823": "��������������",
"530824": "���ȴ�������������",
"530825": "�������������������������",
"530826": "���ǹ���������������",
"530827": "������������������������",
"530828": "����������������",
"530829": "��������������",
"530830": "������",
"530900": "�ٲ���",
"530902": "������",
"530921": "������",
"530922": "����",
"530923": "������",
"530924": "����",
"530925": "˫�����������岼�������������",
"530926": "�����������������",
"530927": "��Դ����������",
"530928": "������",
"532300": "��������������",
"532301": "������",
"532322": "˫����",
"532323": "IJ����",
"532324": "�ϻ���",
"532325": "Ҧ����",
"532326": "��Ҧ��",
"532327": "������",
"532328": "Ԫı��",
"532329": "�䶨��",
"532331": "»����",
"532332": "������",
"532500": "��ӹ���������������",
"532501": "������",
"532502": "��Զ��",
"532522": "������",
"532523": "��������������",
"532524": "��ˮ��",
"532525": "ʯ����",
"532526": "������",
"532527": "������",
"532528": "Ԫ����",
"532529": "�����",
"532530": "��ƽ�����������������",
"532531": "�̴���",
"532532": "�ӿ�����������",
"532533": "������",
"532600": "��ɽ׳������������",
"532621": "��ɽ��",
"532622": "��ɽ��",
"532623": "������",
"532624": "��������",
"532625": "�����",
"532626": "����",
"532627": "������",
"532628": "������",
"532629": "������",
"532800": "��˫���ɴ���������",
"532801": "������",
"532822": "�º���",
"532823": "������",
"532824": "������",
"532900": "�������������",
"532901": "������",
"532922": "�������������",
"532923": "������",
"532924": "������",
"532925": "�ֶ���",
"532926": "�Ͻ�����������",
"532927": "Ρɽ�������������",
"532928": "��ƽ��",
"532929": "������",
"532930": "��Դ��",
"532931": "������",
"532932": "������",
"532933": "������",
"533100": "�º���徰����������",
"533102": "������",
"533103": "�",
"533122": "������",
"533123": "ӯ����",
"533124": "¤����",
"533125": "������",
"533300": "ŭ��������������",
"533321": "��ˮ��",
"533323": "������",
"533324": "��ɽ������ŭ��������",
"533325": "��ƺ����������������",
"533326": "������",
"533400": "�������������",
"533421": "���������",
"533422": "������",
"533423": "��������������",
"533424": "������",
"540000": "����������",
"540100": "������",
"540102": "�ǹ���",
"540121": "������",
"540122": "������",
"540123": "��ľ��",
"540124": "��ˮ��",
"540125": "����������",
"540126": "������",
"540127": "���",
"540128": "������",
"542100": "��������",
"542121": "������",
"542122": "������",
"542123": "������",
"542124": "��������",
"542125": "������",
"542126": "������",
"542127": "������",
"542128": "����",
"542129": "���",
"542132": "��¡��",
"542133": "�߰���",
"542134": "������",
"542200": "ɽ�ϵ���",
"542221": "�˶���",
"542222": "������",
"542223": "������",
"542224": "ɣ����",
"542225": "�����",
"542226": "������",
"542227": "������",
"542228": "������",
"542229": "�Ӳ���",
"542231": "¡����",
"542232": "������",
"542233": "�˿�����",
"542234": "������",
"542300": "�տ������",
"542301": "�տ�����",
"542322": "��ľ����",
"542323": "������",
"542324": "������",
"542325": "������",
"542326": "������",
"542327": "������",
"542328": "лͨ����",
"542329": "������",
"542330": "�ʲ���",
"542331": "������",
"542332": "������",
"542333": "�ٰ���",
"542334": "�Ƕ���",
"542335": "��¡��",
"542336": "����ľ��",
"542337": "������",
"542338": "�ڰ���",
"542339": "������",
"542400": "��������",
"542421": "������",
"542422": "������",
"542423": "������",
"542424": "������",
"542425": "������",
"542426": "������",
"542427": "����",
"542428": "�����",
"542429": "������",
"542430": "������",
"542431": "������",
"542432": "˫����",
"542500": "�������",
"542521": "������",
"542522": "������",
"542523": "������",
"542524": "������",
"542525": "�J��",
"542526": "������",
"542527": "������",
"542528": "������",
"542600": "��֥����",
"542621": "��֥��",
"542622": "����������",
"542623": "������",
"542624": "���",
"542625": "������",
"542626": "������",
"542627": "����",
"542628": "������",
"610000": "����ʡ",
"610100": "������",
"610102": "�³���",
"610103": "������",
"610104": "������",
"610111": "�����",
"610112": "���",
"610113": "������",
"610114": "������",
"610115": "������",
"610116": "������",
"610122": "������",
"610124": "������",
"610125": "����",
"610126": "������",
"610127": "������",
"610200": "ͭ����",
"610202": "������",
"610203": "ӡ̨��",
"610204": "ҫ����",
"610222": "�˾���",
"610223": "������",
"610300": "������",
"610302": "���",
"610303": "��̨��",
"610304": "�²���",
"610322": "������",
"610323": "�ɽ��",
"610324": "������",
"610326": "ü��",
"610327": "¤��",
"610328": "ǧ����",
"610329": "������",
"610330": "����",
"610331": "̫����",
"610332": "������",
"610400": "������",
"610402": "�ض���",
"610403": "������",
"610404": "���",
"610422": "��ԭ��",
"610423": "������",
"610424": "Ǭ��",
"610425": "��Ȫ��",
"610426": "������",
"610427": "����",
"610428": "������",
"610429": "Ѯ����",
"610430": "������",
"610431": "�书��",
"610481": "��ƽ��",
"610482": "������",
"610500": "���",
"610502": "���",
"610521": "����",
"610522": "������",
"610523": "������",
"610524": "������",
"610525": "���",
"610526": "�ѳ���",
"610527": "��ˮ��",
"610528": "��ƽ��",
"610581": "������",
"610582": "������",
"610583": "������",
"610600": "�Ӱ���",
"610602": "������",
"610621": "�ӳ���",
"610622": "�Ӵ���",
"610623": "�ӳ���",
"610624": "������",
"610625": "־����",
"610626": "������",
"610627": "��Ȫ��",
"610628": "����",
"610629": "�崨��",
"610630": "�˴���",
"610631": "������",
"610632": "������",
"610633": "������",
"610700": "������",
"610702": "��̨��",
"610721": "��֣��",
"610722": "�ǹ���",
"610723": "����",
"610724": "������",
"610725": "����",
"610726": "��ǿ��",
"610727": "������",
"610728": "�����",
"610729": "�����",
"610730": "��ƺ��",
"610731": "������",
"610800": "������",
"610802": "������",
"610821": "��ľ��",
"610822": "������",
"610823": "��ɽ��",
"610824": "������",
"610825": "������",
"610826": "�����",
"610827": "��֬��",
"610828": "����",
"610829": "�Ɽ��",
"610830": "�彧��",
"610831": "������",
"610832": "������",
"610900": "������",
"610902": "������",
"610921": "������",
"610922": "ʯȪ��",
"610923": "������",
"610924": "������",
"610925": "���",
"610926": "ƽ����",
"610927": "��ƺ��",
"610928": "Ѯ����",
"610929": "����",
"610930": "������",
"611000": "������",
"611002": "������",
"611021": "������",
"611022": "������",
"611023": "������",
"611024": "ɽ����",
"611025": "����",
"611026": "��ˮ��",
"611027": "������",
"620000": "����ʡ",
"620100": "������",
"620102": "�ǹ���",
"620103": "�������",
"620104": "������",
"620105": "������",
"620111": "�����",
"620121": "������",
"620122": "������",
"620123": "������",
"620124": "������",
"620200": "��������",
"620300": "�����",
"620302": "����",
"620321": "������",
"620322": "������",
"620400": "������",
"620402": "������",
"620403": "ƽ����",
"620421": "��Զ��",
"620422": "������",
"620423": "��̩��",
"620424": "������",
"620500": "��ˮ��",
"620502": "������",
"620503": "�����",
"620521": "��ˮ��",
"620522": "�ذ���",
"620523": "�ʹ���",
"620524": "��ɽ��",
"620525": "�żҴ�����������",
"620526": "������",
"620600": "������",
"620602": "������",
"620621": "������",
"620622": "������",
"620623": "��ף����������",
"620624": "������",
"620700": "��Ҵ��",
"620702": "������",
"620721": "����ԣ����������",
"620722": "������",
"620723": "������",
"620724": "��̨��",
"620725": "ɽ����",
"620726": "������",
"620800": "ƽ����",
"620802": "�����",
"620821": "������",
"620822": "��̨��",
"620823": "������",
"620824": "��ͤ��",
"620825": "ׯ����",
"620826": "������",
"620827": "������",
"620900": "��Ȫ��",
"620902": "������",
"620921": "������",
"620922": "������",
"620923": "��ɹ���������",
"620924": "��������������������",
"620981": "������",
"620982": "�ػ���",
"620983": "������",
"621000": "������",
"621002": "������",
"621021": "�����",
"621022": "����",
"621023": "������",
"621024": "��ˮ��",
"621025": "������",
"621026": "����",
"621027": "��ԭ��",
"621028": "������",
"621100": "������",
"621102": "������",
"621121": "ͨμ��",
"621122": "¤����",
"621123": "μԴ��",
"621124": "�����",
"621125": "����",
"621126": "���",
"621127": "������",
"621200": "¤����",
"621202": "�䶼��",
"621221": "����",
"621222": "����",
"621223": "崲���",
"621224": "����",
"621225": "������",
"621226": "����",
"621227": "����",
"621228": "������",
"621229": "������",
"622900": "������������",
"622901": "������",
"622921": "������",
"622922": "������",
"622923": "������",
"622924": "�����",
"622925": "������",
"622926": "������������",
"622927": "��ʯɽ�����嶫����������������",
"622928": "������",
"623000": "���ϲ���������",
"623001": "������",
"623021": "��̶��",
"623022": "����",
"623023": "������",
"623024": "������",
"623025": "������",
"623026": "µ����",
"623027": "���",
"623028": "������",
"630000": "�ຣʡ",
"630100": "������",
"630102": "�Ƕ���",
"630103": "������",
"630104": "������",
"630105": "�DZ���",
"630121": "��ͨ��������������",
"630122": "������",
"630123": "��Դ��",
"630124": "������",
"632100": "������",
"632121": "ƽ����",
"632122": "��ͻ�������������",
"632123": "�ֶ���",
"632126": "��������������",
"632127": "��¡����������",
"632128": "ѭ��������������",
"632129": "������",
"632200": "��������������",
"632221": "��Դ����������",
"632222": "������",
"632223": "������",
"632224": "�ղ���",
"632225": "������",
"632300": "���ϲ���������",
"632321": "ͬ����",
"632322": "������",
"632323": "�����",
"632324": "�����ɹ���������",
"632325": "������",
"632500": "���ϲ���������",
"632521": "������",
"632522": "ͬ����",
"632523": "�����",
"632524": "�˺���",
"632525": "������",
"632526": "������",
"632600": "�������������",
"632621": "������",
"632622": "������",
"632623": "�ʵ���",
"632624": "������",
"632625": "������",
"632626": "�����",
"632627": "������",
"632700": "��������������",
"632721": "������",
"632722": "�Ӷ���",
"632723": "�ƶ���",
"632724": "���",
"632725": "��ǫ��",
"632726": "��������",
"632727": "������",
"632800": "�����ɹ������������",
"632801": "���ľ��",
"632802": "�������",
"632821": "������",
"632822": "������",
"632823": "�����",
"632824": "������",
"640000": "������������",
"640100": "������",
"640104": "������",
"640105": "������",
"640106": "�����",
"640121": "������",
"640122": "������",
"640181": "������",
"640182": "������",
"640200": "ʯ��ɽ��",
"640202": "�������",
"640205": "��ũ��",
"640221": "ƽ����",
"640222": "������",
"640300": "������",
"640302": "��ͨ��",
"640303": "���±���",
"640323": "���",
"640324": "ͬ����",
"640381": "��ͭϿ��",
"640382": "������",
"640400": "��ԭ��",
"640402": "ԭ����",
"640422": "������",
"640423": "¡����",
"640424": "��Դ��",
"640425": "������",
"640426": "������",
"640500": "������",
"640502": "ɳ��ͷ��",
"640521": "������",
"640522": "��ԭ��",
"640523": "������",
"650000": "�½�ά���������",
"650100": "��³ľ����",
"650102": "��ɽ��",
"650103": "ɳ���Ϳ���",
"650104": "������",
"650105": "ˮĥ����",
"650106": "ͷ�ͺ���",
"650107": "�������",
"650109": "����",
"650121": "��³ľ����",
"650122": "������",
"650200": "����������",
"650202": "��ɽ����",
"650203": "����������",
"650204": "��̲��",
"650205": "�ڶ�����",
"650206": "������",
"652100": "��³������",
"652101": "��³����",
"652122": "۷����",
"652123": "�п�ѷ��",
"652124": "������",
"652200": "���ܵ���",
"652201": "������",
"652222": "������������������",
"652223": "������",
"652224": "������",
"652300": "��������������",
"652301": "������",
"652302": "������",
"652323": "��ͼ����",
"652324": "����˹��",
"652325": "��̨��",
"652327": "��ľ������",
"652328": "ľ�ݹ�����������",
"652329": "������",
"652700": "���������ɹ�������",
"652701": "������",
"652702": "����ɽ����",
"652722": "������",
"652723": "��Ȫ��",
"652724": "������",
"652800": "��������ɹ�������",
"652801": "�������",
"652822": "��̨��",
"652823": "���",
"652824": "��Ǽ��",
"652825": "��ĩ��",
"652826": "���Ȼ���������",
"652827": "�;���",
"652828": "��˶��",
"652829": "������",
"652830": "������",
"652900": "�����յ���",
"652901": "��������",
"652922": "������",
"652923": "���",
"652924": "ɳ����",
"652925": "�º���",
"652926": "�ݳ���",
"652927": "��ʲ��",
"652928": "��������",
"652929": "��ƺ��",
"652930": "������",
"653000": "�������տ¶�����������",
"653001": "��ͼʲ��",
"653022": "��������",
"653023": "��������",
"653024": "��ǡ��",
"653025": "������",
"653100": "��ʲ����",
"653101": "��ʲ��",
"653121": "�踽��",
"653122": "������",
"653123": "Ӣ��ɳ��",
"653124": "������",
"653125": "ɯ����",
"653126": "Ҷ����",
"653127": "�������",
"653128": "���պ���",
"653129": "٤ʦ��",
"653130": "�ͳ���",
"653131": "��ʲ�����������������",
"653132": "������",
"653200": "�������",
"653201": "������",
"653221": "������",
"653222": "���",
"653223": "Ƥɽ��",
"653224": "������",
"653225": "������",
"653226": "������",
"653227": "�����",
"653228": "������",
"654000": "���������������",
"654002": "������",
"654003": "������",
"654021": "������",
"654022": "�첼�������������",
"654023": "�����",
"654024": "������",
"654025": "��Դ��",
"654026": "������",
"654027": "�ؿ�˹��",
"654028": "���տ���",
"654029": "������",
"654200": "���ǵ���",
"654201": "������",
"654202": "������",
"654221": "������",
"654223": "ɳ����",
"654224": "������",
"654225": "ԣ����",
"654226": "�Ͳ��������ɹ�������",
"654227": "������",
"654300": "����̩����",
"654301": "����̩��",
"654321": "��������",
"654322": "������",
"654323": "������",
"654324": "���ͺ���",
"654325": "�����",
"654326": "��ľ����",
"654327": "������",
"659001": "ʯ������",
"659002": "��������",
"659003": "ͼľ�����",
"659004": "�������",
"710000": "̨��",
"710100": "̨����",
"710101": "������",
"710102": "��ͬ��",
"710103": "��ɽ��",
"710104": "��ɽ��",
"710105": "����",
"710106": "����",
"710107": "������",
"710108": "ʿ����",
"710109": "��Ͷ��",
"710110": "�ں���",
"710111": "�ϸ���",
"710112": "��ɽ��",
"710113": "������",
"710200": "������",
"710201": "������",
"710202": "ǰ����",
"710203": "������",
"710204": "������",
"710205": "��ɽ��",
"710206": "�����",
"710207": "ǰ����",
"710208": "������",
"710209": "��Ӫ��",
"710210": "�����",
"710211": "����",
"710212": "������",
"710241": "������",
"710242": "������",
"710243": "������",
"710244": "��ɽ��",
"710245": "·����",
"710246": "������",
"710247": "�����",
"710248": "�ೲ��",
"710249": "��ͷ��",
"710250": "������",
"710251": "������",
"710252": "������",
"710253": "������",
"710254": "��ɽ��",
"710255": "�����",
"710256": "����",
"710257": "������",
"710258": "������",
"710259": "��ɽ��",
"710260": "��Ũ��",
"710261": "������",
"710262": "������",
"710263": "ɼ����",
"710264": "������",
"710265": "��Դ��",
"710266": "��������",
"710267": "���",
"710268": "���b��",
"710300": "̨����",
"710301": "������",
"710302": "����",
"710303": "����",
"710304": "����",
"710305": "��ƽ��",
"710306": "������",
"710307": "������",
"710339": "������",
"710340": "������",
"710341": "�»���",
"710342": "������",
"710343": "����",
"710344": "�����",
"710345": "�ϻ���",
"710346": "�ʵ���",
"710347": "������",
"710348": "������",
"710349": "������",
"710350": "�鶹��",
"710351": "������",
"710352": "������",
"710353": "�߹���",
"710354": "������",
"710355": "ѧ����",
"710356": "������",
"710357": "��Ӫ��",
"710358": "�����",
"710359": "����",
"710360": "��ɽ��",
"710361": "������",
"710362": "��Ӫ��",
"710363": "��Ӫ��",
"710364": "��ˮ��",
"710365": "�ƻ���",
"710366": "������",
"710367": "ɽ����",
"710368": "������",
"710369": "������",
"710400": "̨����",
"710401": "����",
"710402": "����",
"710403": "����",
"710404": "����",
"710405": "����",
"710406": "������",
"710407": "������",
"710408": "������",
"710409": "������",
"710431": "̫ƽ��",
"710432": "������",
"710433": "�����",
"710434": "������",
"710435": "��ԭ��",
"710436": "������",
"710437": "ʯ����",
"710438": "������",
"710439": "��ƽ��",
"710440": "������",
"710441": "̶����",
"710442": "������",
"710443": "�����",
"710444": "�����",
"710445": "ɳ¹��",
"710446": "������",
"710447": "������",
"710448": "��ˮ��",
"710449": "�����",
"710450": "������",
"710451": "����",
"710500": "������",
"710507": "��ɳ��",
"710508": "�����",
"710509": "������",
"710510": "�����",
"710511": "������",
"710512": "�ڈw��",
"710600": "��Ͷ��",
"710614": "��Ͷ��",
"710615": "�����",
"710616": "������",
"710617": "������",
"710618": "������",
"710619": "�ʰ���",
"710620": "������",
"710621": "������",
"710622": "ˮ����",
"710623": "�����",
"710624": "������",
"710625": "��ɽ��",
"710626": "¹����",
"710700": "��¡��",
"710701": "�ʰ���",
"710702": "������",
"710703": "������",
"710704": "��ɽ��",
"710705": "������",
"710706": "ůů��",
"710707": "�߶���",
"710708": "������",
"710800": "������",
"710801": "����",
"710802": "����",
"710803": "��ɽ��",
"710804": "������",
"710900": "������",
"710901": "����",
"710902": "����",
"710903": "������",
"711100": "�±���",
"711130": "������",
"711131": "��ɽ��",
"711132": "������",
"711133": "ϫֹ��",
"711134": "�����",
"711135": "ʯ����",
"711136": "����",
"711137": "ƽϪ��",
"711138": "˫Ϫ��",
"711139": "�����",
"711140": "�µ���",
"711141": "ƺ����",
"711142": "������",
"711143": "������",
"711144": "���",
"711145": "������",
"711146": "��Ͽ��",
"711147": "������",
"711148": "ݺ����",
"711149": "������",
"711150": "��ׯ��",
"711151": "̩ɽ��",
"711152": "�ֿ���",
"711153": "«����",
"711154": "�����",
"711155": "������",
"711156": "��ˮ��",
"711157": "��֥��",
"711158": "ʯ����",
"711200": "������",
"711214": "������",
"711215": "ͷ����",
"711216": "��Ϫ��",
"711217": "׳Χ��",
"711218": "Աɽ��",
"711219": "����",
"711220": "������",
"711221": "��ͬ��",
"711222": "�����",
"711223": "��ɽ��",
"711224": "�հ���",
"711225": "�ϰ���",
"711226": "����̨",
"711300": "������",
"711314": "����",
"711315": "������",
"711316": "�·���",
"711317": "������",
"711318": "������",
"711319": "ܺ����",
"711320": "��ɽ��",
"711321": "����",
"711322": "�����",
"711323": "��ɽ��",
"711324": "��ʯ��",
"711325": "������",
"711326": "��ü��",
"711400": "����",
"711414": "������",
"711415": "ƽ����",
"711416": "��̶��",
"711417": "��÷��",
"711418": "������",
"711419": "������",
"711420": "����",
"711421": "��ɽ��",
"711422": "�˵���",
"711423": "��Ϫ��",
"711424": "������",
"711425": "����",
"711426": "«����",
"711500": "������",
"711519": "������",
"711520": "ͷ����",
"711521": "������",
"711522": "��ׯ��",
"711523": "ʨ̶��",
"711524": "������",
"711525": "ͨ����",
"711526": "Է����",
"711527": "������",
"711528": "������",
"711529": "ͷ����",
"711530": "������",
"711531": "�����",
"711532": "̩����",
"711533": "ͭ����",
"711534": "������",
"711535": "������",
"711536": "����",
"711700": "�û���",
"711727": "�û���",
"711728": "����",
"711729": "��̳��",
"711730": "��ˮ��",
"711731": "¹����",
"711732": "������",
"711733": "������",
"711734": "������",
"711735": "�����",
"711736": "Ա����",
"711737": "��ͷ��",
"711738": "������",
"711739": "������",
"711740": "Ϫ����",
"711741": "�����",
"711742": "������",
"711743": "������",
"711744": "������",
"711745": "���",
"711746": "��ͷ��",
"711747": "Ϫ����",
"711748": "������",
"711749": "������",
"711750": "�����",
"711751": "��Է��",
"711752": "��ˮ��",
"711900": "������",
"711919": "��·��",
"711920": "÷ɽ��",
"711921": "������",
"711922": "����ɽ��",
"711923": "������",
"711924": "������",
"711925": "ˮ����",
"711926": "¹����",
"711927": "̫����",
"711928": "������",
"711929": "��ʯ��",
"711930": "������",
"711931": "�¸���",
"711932": "������",
"711933": "������",
"711934": "Ϫ����",
"711935": "������",
"711936": "������",
"712100": "������",
"712121": "������",
"712122": "������",
"712123": "���",
"712124": "������",
"712125": "������",
"712126": "������",
"712127": "̨����",
"712128": "�ر���",
"712129": "�����",
"712130": "������",
"712131": "������",
"712132": "�ſ���",
"712133": "DŽͩ��",
"712134": "������",
"712135": "������",
"712136": "������",
"712137": "ˮ����",
"712138": "�ں���",
"712139": "���",
"712140": "Ԫ����",
"712400": "������",
"712434": "������",
"712435": "��������",
"712436": "��̨��",
"712437": "�����",
"712438": "������",
"712439": "�����",
"712440": "������",
"712441": "������",
"712442": "������",
"712443": "������",
"712444": "������",
"712445": "������",
"712446": "����",
"712447": "������",
"712448": "̩����",
"712449": "������",
"712450": "������",
"712451": "������",
"712452": "������",
"712453": "������",
"712454": "�ֱ���",
"712455": "������",
"712456": "������",
"712457": "�Ѷ���",
"712458": "����",
"712459": "�����",
"712460": "��ɽ��",
"712461": "������",
"712462": "ʨ����",
"712463": "������",
"712464": "ĵ����",
"712465": "�㴺��",
"712466": "������",
"712500": "̨����",
"712517": "̨����",
"712518": "�̵���",
"712519": "������",
"712520": "��ƽ��",
"712521": "������",
"712522": "¹Ұ��",
"712523": "��ɽ��",
"712524": "������",
"712525": "������",
"712526": "������",
"712527": "�ɹ���",
"712528": "������",
"712529": "�����",
"712530": "������",
"712531": "������",
"712532": "̫������",
"712600": "������",
"712615": "������",
"712616": "�³���",
"712617": "̫³��",
"712618": "������",
"712619": "������",
"712620": "�ٷ���",
"712621": "������",
"712622": "�⸴��",
"712623": "�����",
"712624": "������",
"712625": "������",
"712626": "������",
"712627": "Ϫ��",
"712628": "������",
"712700": "�����",
"712707": "����",
"712708": "������",
"712709": "������",
"712710": "������",
"712711": "��ɳ��",
"712712": "������",
"712800": "������",
"712805": "�ϸ���",
"712806": "������",
"712807": "�����",
"712808": "������",
"810000": "����ر�������",
"810100": "��۵�",
"810101": "������",
"810102": "����",
"810103": "����",
"810104": "����",
"810200": "����",
"810201": "��������",
"810202": "�ͼ�����",
"810203": "��ˮ����",
"810204": "�ƴ�����",
"810205": "������",
"810300": "�½�",
"810301": "����",
"810302": "������",
"810303": "ɳ����",
"810304": "������",
"810305": "Ԫ����",
"810306": "������",
"810307": "������",
"810308": "������",
"810309": "�뵺��",
"820000": "�����ر�������",
"820100": "���Ű뵺",
"820200": "�뵺",
"990000": "����",
"990100": "����"
}
// id pid/parentId name children
function tree(list) {
var mapped = {}
for (var i = 0, item; i < list.length; i++) {
item = list[i]
if (!item || !item.id) continue
mapped[item.id] = item
}
var result = []
for (var ii = 0; ii < list.length; ii++) {
item = list[ii]
if (!item) continue
/* jshint -W041 */
if (item.pid == undefined && item.parentId == undefined) {
result.push(item)
continue
}
var parent = mapped[item.pid] || mapped[item.parentId]
if (!parent) continue
if (!parent.children) parent.children = []
parent.children.push(item)
}
return result
}
var DICT_FIXED = function() {
var fixed = []
for (var id in DICT) {
var pid = id.slice(2, 6) === '0000' ? undefined :
id.slice(4, 6) == '00' ? (id.slice(0, 2) + '0000') :
id.slice(0, 4) + '00'
fixed.push({
id: id,
pid: pid,
name: DICT[id]
})
}
return tree(fixed)
}()
module.exports = DICT_FIXED
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
/*
## Miscellaneous
*/
var DICT = __webpack_require__(18)
module.exports = {
// Dice
d4: function() {
return this.natural(1, 4)
},
d6: function() {
return this.natural(1, 6)
},
d8: function() {
return this.natural(1, 8)
},
d12: function() {
return this.natural(1, 12)
},
d20: function() {
return this.natural(1, 20)
},
d100: function() {
return this.natural(1, 100)
},
/*
�������һ�� GUID��
http://www.broofa.com/2008/09/javascript-uuid-function/
[UUID �淶](http://www.ietf.org/rfc/rfc4122.txt)
UUIDs (Universally Unique IDentifier)
GUIDs (Globally Unique IDentifier)
The formal definition of the UUID string representation is provided by the following ABNF [7]:
UUID = time-low "-" time-mid "-"
time-high-and-version "-"
clock-seq-and-reserved
clock-seq-low "-" node
time-low = 4hexOctet
time-mid = 2hexOctet
time-high-and-version = 2hexOctet
clock-seq-and-reserved = hexOctet
clock-seq-low = hexOctet
node = 6hexOctet
hexOctet = hexDigit hexDigit
hexDigit =
"0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /
"a" / "b" / "c" / "d" / "e" / "f" /
"A" / "B" / "C" / "D" / "E" / "F"
https://github.com/victorquinn/chancejs/blob/develop/chance.js#L1349
*/
guid: function() {
var pool = "abcdefABCDEF1234567890",
guid = this.string(pool, 8) + '-' +
this.string(pool, 4) + '-' +
this.string(pool, 4) + '-' +
this.string(pool, 4) + '-' +
this.string(pool, 12);
return guid
},
uuid: function() {
return this.guid()
},
/*
�������һ�� 18 λ���֤��
[���֤](http://baike.baidu.com/view/1697.htm#4)
��ַ�� 6 + ���������� 8 + ˳���� 3 + У���� 1
[���л����������������롷���ұ�(GB/T2260)](http://zhidao.baidu.com/question/1954561.html)
*/
id: function() {
var id,
sum = 0,
rank = [
"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"
],
last = [
"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"
]
id = this.pick(DICT).id +
this.date('yyyyMMdd') +
this.string('number', 3)
for (var i = 0; i < id.length; i++) {
sum += id[i] * rank[i];
}
id += last[sum % 11];
return id
},
/*
����һ��ȫ�ֵ�����������
��������������auto increment primary key����
*/
increment: function() {
var key = 0
return function(step) {
return key += (+step || 1) // step?
}
}(),
inc: function(step) {
return this.increment(step)
}
}
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
var Parser = __webpack_require__(21)
var Handler = __webpack_require__(22)
module.exports = {
Parser: Parser,
Handler: Handler
}
/***/ },
/* 21 */
/***/ function(module, exports) {
// https://github.com/nuysoft/regexp
// forked from https://github.com/ForbesLindesay/regexp
function parse(n) {
if ("string" != typeof n) {
var l = new TypeError("The regexp to parse must be represented as a string.");
throw l;
}
return index = 1, cgs = {}, parser.parse(n);
}
function Token(n) {
this.type = n, this.offset = Token.offset(), this.text = Token.text();
}
function Alternate(n, l) {
Token.call(this, "alternate"), this.left = n, this.right = l;
}
function Match(n) {
Token.call(this, "match"), this.body = n.filter(Boolean);
}
function Group(n, l) {
Token.call(this, n), this.body = l;
}
function CaptureGroup(n) {
Group.call(this, "capture-group"), this.index = cgs[this.offset] || (cgs[this.offset] = index++),
this.body = n;
}
function Quantified(n, l) {
Token.call(this, "quantified"), this.body = n, this.quantifier = l;
}
function Quantifier(n, l) {
Token.call(this, "quantifier"), this.min = n, this.max = l, this.greedy = !0;
}
function CharSet(n, l) {
Token.call(this, "charset"), this.invert = n, this.body = l;
}
function CharacterRange(n, l) {
Token.call(this, "range"), this.start = n, this.end = l;
}
function Literal(n) {
Token.call(this, "literal"), this.body = n, this.escaped = this.body != this.text;
}
function Unicode(n) {
Token.call(this, "unicode"), this.code = n.toUpperCase();
}
function Hex(n) {
Token.call(this, "hex"), this.code = n.toUpperCase();
}
function Octal(n) {
Token.call(this, "octal"), this.code = n.toUpperCase();
}
function BackReference(n) {
Token.call(this, "back-reference"), this.code = n.toUpperCase();
}
function ControlCharacter(n) {
Token.call(this, "control-character"), this.code = n.toUpperCase();
}
var parser = function() {
function n(n, l) {
function u() {
this.constructor = n;
}
u.prototype = l.prototype, n.prototype = new u();
}
function l(n, l, u, t, r) {
function e(n, l) {
function u(n) {
function l(n) {
return n.charCodeAt(0).toString(16).toUpperCase();
}
return n.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\x08/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(n) {
return "\\x0" + l(n);
}).replace(/[\x10-\x1F\x80-\xFF]/g, function(n) {
return "\\x" + l(n);
}).replace(/[\u0180-\u0FFF]/g, function(n) {
return "\\u0" + l(n);
}).replace(/[\u1080-\uFFFF]/g, function(n) {
return "\\u" + l(n);
});
}
var t, r;
switch (n.length) {
case 0:
t = "end of input";
break;
case 1:
t = n[0];
break;
default:
t = n.slice(0, -1).join(", ") + " or " + n[n.length - 1];
}
return r = l ? '"' + u(l) + '"' : "end of input", "Expected " + t + " but " + r + " found.";
}
this.expected = n, this.found = l, this.offset = u, this.line = t, this.column = r,
this.name = "SyntaxError", this.message = e(n, l);
}
function u(n) {
function u() {
return n.substring(Lt, qt);
}
function t() {
return Lt;
}
function r(l) {
function u(l, u, t) {
var r, e;
for (r = u; t > r; r++) e = n.charAt(r), "\n" === e ? (l.seenCR || l.line++, l.column = 1,
l.seenCR = !1) : "\r" === e || "\u2028" === e || "\u2029" === e ? (l.line++, l.column = 1,
l.seenCR = !0) : (l.column++, l.seenCR = !1);
}
return Mt !== l && (Mt > l && (Mt = 0, Dt = {
line: 1,
column: 1,
seenCR: !1
}), u(Dt, Mt, l), Mt = l), Dt;
}
function e(n) {
Ht > qt || (qt > Ht && (Ht = qt, Ot = []), Ot.push(n));
}
function o(n) {
var l = 0;
for (n.sort(); l < n.length; ) n[l - 1] === n[l] ? n.splice(l, 1) : l++;
}
function c() {
var l, u, t, r, o;
return l = qt, u = i(), null !== u ? (t = qt, 124 === n.charCodeAt(qt) ? (r = fl,
qt++) : (r = null, 0 === Wt && e(sl)), null !== r ? (o = c(), null !== o ? (r = [ r, o ],
t = r) : (qt = t, t = il)) : (qt = t, t = il), null === t && (t = al), null !== t ? (Lt = l,
u = hl(u, t), null === u ? (qt = l, l = u) : l = u) : (qt = l, l = il)) : (qt = l,
l = il), l;
}
function i() {
var n, l, u, t, r;
if (n = qt, l = f(), null === l && (l = al), null !== l) if (u = qt, Wt++, t = d(),
Wt--, null === t ? u = al : (qt = u, u = il), null !== u) {
for (t = [], r = h(), null === r && (r = a()); null !== r; ) t.push(r), r = h(),
null === r && (r = a());
null !== t ? (r = s(), null === r && (r = al), null !== r ? (Lt = n, l = dl(l, t, r),
null === l ? (qt = n, n = l) : n = l) : (qt = n, n = il)) : (qt = n, n = il);
} else qt = n, n = il; else qt = n, n = il;
return n;
}
function a() {
var n;
return n = x(), null === n && (n = Q(), null === n && (n = B())), n;
}
function f() {
var l, u;
return l = qt, 94 === n.charCodeAt(qt) ? (u = pl, qt++) : (u = null, 0 === Wt && e(vl)),
null !== u && (Lt = l, u = wl()), null === u ? (qt = l, l = u) : l = u, l;
}
function s() {
var l, u;
return l = qt, 36 === n.charCodeAt(qt) ? (u = Al, qt++) : (u = null, 0 === Wt && e(Cl)),
null !== u && (Lt = l, u = gl()), null === u ? (qt = l, l = u) : l = u, l;
}
function h() {
var n, l, u;
return n = qt, l = a(), null !== l ? (u = d(), null !== u ? (Lt = n, l = bl(l, u),
null === l ? (qt = n, n = l) : n = l) : (qt = n, n = il)) : (qt = n, n = il), n;
}
function d() {
var n, l, u;
return Wt++, n = qt, l = p(), null !== l ? (u = k(), null === u && (u = al), null !== u ? (Lt = n,
l = Tl(l, u), null === l ? (qt = n, n = l) : n = l) : (qt = n, n = il)) : (qt = n,
n = il), Wt--, null === n && (l = null, 0 === Wt && e(kl)), n;
}
function p() {
var n;
return n = v(), null === n && (n = w(), null === n && (n = A(), null === n && (n = C(),
null === n && (n = g(), null === n && (n = b()))))), n;
}
function v() {
var l, u, t, r, o, c;
return l = qt, 123 === n.charCodeAt(qt) ? (u = xl, qt++) : (u = null, 0 === Wt && e(yl)),
null !== u ? (t = T(), null !== t ? (44 === n.charCodeAt(qt) ? (r = ml, qt++) : (r = null,
0 === Wt && e(Rl)), null !== r ? (o = T(), null !== o ? (125 === n.charCodeAt(qt) ? (c = Fl,
qt++) : (c = null, 0 === Wt && e(Ql)), null !== c ? (Lt = l, u = Sl(t, o), null === u ? (qt = l,
l = u) : l = u) : (qt = l, l = il)) : (qt = l, l = il)) : (qt = l, l = il)) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function w() {
var l, u, t, r;
return l = qt, 123 === n.charCodeAt(qt) ? (u = xl, qt++) : (u = null, 0 === Wt && e(yl)),
null !== u ? (t = T(), null !== t ? (n.substr(qt, 2) === Ul ? (r = Ul, qt += 2) : (r = null,
0 === Wt && e(El)), null !== r ? (Lt = l, u = Gl(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il)) : (qt = l, l = il), l;
}
function A() {
var l, u, t, r;
return l = qt, 123 === n.charCodeAt(qt) ? (u = xl, qt++) : (u = null, 0 === Wt && e(yl)),
null !== u ? (t = T(), null !== t ? (125 === n.charCodeAt(qt) ? (r = Fl, qt++) : (r = null,
0 === Wt && e(Ql)), null !== r ? (Lt = l, u = Bl(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il)) : (qt = l, l = il), l;
}
function C() {
var l, u;
return l = qt, 43 === n.charCodeAt(qt) ? (u = jl, qt++) : (u = null, 0 === Wt && e($l)),
null !== u && (Lt = l, u = ql()), null === u ? (qt = l, l = u) : l = u, l;
}
function g() {
var l, u;
return l = qt, 42 === n.charCodeAt(qt) ? (u = Ll, qt++) : (u = null, 0 === Wt && e(Ml)),
null !== u && (Lt = l, u = Dl()), null === u ? (qt = l, l = u) : l = u, l;
}
function b() {
var l, u;
return l = qt, 63 === n.charCodeAt(qt) ? (u = Hl, qt++) : (u = null, 0 === Wt && e(Ol)),
null !== u && (Lt = l, u = Wl()), null === u ? (qt = l, l = u) : l = u, l;
}
function k() {
var l;
return 63 === n.charCodeAt(qt) ? (l = Hl, qt++) : (l = null, 0 === Wt && e(Ol)),
l;
}
function T() {
var l, u, t;
if (l = qt, u = [], zl.test(n.charAt(qt)) ? (t = n.charAt(qt), qt++) : (t = null,
0 === Wt && e(Il)), null !== t) for (;null !== t; ) u.push(t), zl.test(n.charAt(qt)) ? (t = n.charAt(qt),
qt++) : (t = null, 0 === Wt && e(Il)); else u = il;
return null !== u && (Lt = l, u = Jl(u)), null === u ? (qt = l, l = u) : l = u,
l;
}
function x() {
var l, u, t, r;
return l = qt, 40 === n.charCodeAt(qt) ? (u = Kl, qt++) : (u = null, 0 === Wt && e(Nl)),
null !== u ? (t = R(), null === t && (t = F(), null === t && (t = m(), null === t && (t = y()))),
null !== t ? (41 === n.charCodeAt(qt) ? (r = Pl, qt++) : (r = null, 0 === Wt && e(Vl)),
null !== r ? (Lt = l, u = Xl(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il)) : (qt = l, l = il), l;
}
function y() {
var n, l;
return n = qt, l = c(), null !== l && (Lt = n, l = Yl(l)), null === l ? (qt = n,
n = l) : n = l, n;
}
function m() {
var l, u, t;
return l = qt, n.substr(qt, 2) === Zl ? (u = Zl, qt += 2) : (u = null, 0 === Wt && e(_l)),
null !== u ? (t = c(), null !== t ? (Lt = l, u = nu(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function R() {
var l, u, t;
return l = qt, n.substr(qt, 2) === lu ? (u = lu, qt += 2) : (u = null, 0 === Wt && e(uu)),
null !== u ? (t = c(), null !== t ? (Lt = l, u = tu(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function F() {
var l, u, t;
return l = qt, n.substr(qt, 2) === ru ? (u = ru, qt += 2) : (u = null, 0 === Wt && e(eu)),
null !== u ? (t = c(), null !== t ? (Lt = l, u = ou(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function Q() {
var l, u, t, r, o;
if (Wt++, l = qt, 91 === n.charCodeAt(qt) ? (u = iu, qt++) : (u = null, 0 === Wt && e(au)),
null !== u) if (94 === n.charCodeAt(qt) ? (t = pl, qt++) : (t = null, 0 === Wt && e(vl)),
null === t && (t = al), null !== t) {
for (r = [], o = S(), null === o && (o = U()); null !== o; ) r.push(o), o = S(),
null === o && (o = U());
null !== r ? (93 === n.charCodeAt(qt) ? (o = fu, qt++) : (o = null, 0 === Wt && e(su)),
null !== o ? (Lt = l, u = hu(t, r), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il);
} else qt = l, l = il; else qt = l, l = il;
return Wt--, null === l && (u = null, 0 === Wt && e(cu)), l;
}
function S() {
var l, u, t, r;
return Wt++, l = qt, u = U(), null !== u ? (45 === n.charCodeAt(qt) ? (t = pu, qt++) : (t = null,
0 === Wt && e(vu)), null !== t ? (r = U(), null !== r ? (Lt = l, u = wu(u, r), null === u ? (qt = l,
l = u) : l = u) : (qt = l, l = il)) : (qt = l, l = il)) : (qt = l, l = il), Wt--,
null === l && (u = null, 0 === Wt && e(du)), l;
}
function U() {
var n, l;
return Wt++, n = G(), null === n && (n = E()), Wt--, null === n && (l = null, 0 === Wt && e(Au)),
n;
}
function E() {
var l, u;
return l = qt, Cu.test(n.charAt(qt)) ? (u = n.charAt(qt), qt++) : (u = null, 0 === Wt && e(gu)),
null !== u && (Lt = l, u = bu(u)), null === u ? (qt = l, l = u) : l = u, l;
}
function G() {
var n;
return n = L(), null === n && (n = Y(), null === n && (n = H(), null === n && (n = O(),
null === n && (n = W(), null === n && (n = z(), null === n && (n = I(), null === n && (n = J(),
null === n && (n = K(), null === n && (n = N(), null === n && (n = P(), null === n && (n = V(),
null === n && (n = X(), null === n && (n = _(), null === n && (n = nl(), null === n && (n = ll(),
null === n && (n = ul(), null === n && (n = tl()))))))))))))))))), n;
}
function B() {
var n;
return n = j(), null === n && (n = q(), null === n && (n = $())), n;
}
function j() {
var l, u;
return l = qt, 46 === n.charCodeAt(qt) ? (u = ku, qt++) : (u = null, 0 === Wt && e(Tu)),
null !== u && (Lt = l, u = xu()), null === u ? (qt = l, l = u) : l = u, l;
}
function $() {
var l, u;
return Wt++, l = qt, mu.test(n.charAt(qt)) ? (u = n.charAt(qt), qt++) : (u = null,
0 === Wt && e(Ru)), null !== u && (Lt = l, u = bu(u)), null === u ? (qt = l, l = u) : l = u,
Wt--, null === l && (u = null, 0 === Wt && e(yu)), l;
}
function q() {
var n;
return n = M(), null === n && (n = D(), null === n && (n = Y(), null === n && (n = H(),
null === n && (n = O(), null === n && (n = W(), null === n && (n = z(), null === n && (n = I(),
null === n && (n = J(), null === n && (n = K(), null === n && (n = N(), null === n && (n = P(),
null === n && (n = V(), null === n && (n = X(), null === n && (n = Z(), null === n && (n = _(),
null === n && (n = nl(), null === n && (n = ll(), null === n && (n = ul(), null === n && (n = tl()))))))))))))))))))),
n;
}
function L() {
var l, u;
return l = qt, n.substr(qt, 2) === Fu ? (u = Fu, qt += 2) : (u = null, 0 === Wt && e(Qu)),
null !== u && (Lt = l, u = Su()), null === u ? (qt = l, l = u) : l = u, l;
}
function M() {
var l, u;
return l = qt, n.substr(qt, 2) === Fu ? (u = Fu, qt += 2) : (u = null, 0 === Wt && e(Qu)),
null !== u && (Lt = l, u = Uu()), null === u ? (qt = l, l = u) : l = u, l;
}
function D() {
var l, u;
return l = qt, n.substr(qt, 2) === Eu ? (u = Eu, qt += 2) : (u = null, 0 === Wt && e(Gu)),
null !== u && (Lt = l, u = Bu()), null === u ? (qt = l, l = u) : l = u, l;
}
function H() {
var l, u;
return l = qt, n.substr(qt, 2) === ju ? (u = ju, qt += 2) : (u = null, 0 === Wt && e($u)),
null !== u && (Lt = l, u = qu()), null === u ? (qt = l, l = u) : l = u, l;
}
function O() {
var l, u;
return l = qt, n.substr(qt, 2) === Lu ? (u = Lu, qt += 2) : (u = null, 0 === Wt && e(Mu)),
null !== u && (Lt = l, u = Du()), null === u ? (qt = l, l = u) : l = u, l;
}
function W() {
var l, u;
return l = qt, n.substr(qt, 2) === Hu ? (u = Hu, qt += 2) : (u = null, 0 === Wt && e(Ou)),
null !== u && (Lt = l, u = Wu()), null === u ? (qt = l, l = u) : l = u, l;
}
function z() {
var l, u;
return l = qt, n.substr(qt, 2) === zu ? (u = zu, qt += 2) : (u = null, 0 === Wt && e(Iu)),
null !== u && (Lt = l, u = Ju()), null === u ? (qt = l, l = u) : l = u, l;
}
function I() {
var l, u;
return l = qt, n.substr(qt, 2) === Ku ? (u = Ku, qt += 2) : (u = null, 0 === Wt && e(Nu)),
null !== u && (Lt = l, u = Pu()), null === u ? (qt = l, l = u) : l = u, l;
}
function J() {
var l, u;
return l = qt, n.substr(qt, 2) === Vu ? (u = Vu, qt += 2) : (u = null, 0 === Wt && e(Xu)),
null !== u && (Lt = l, u = Yu()), null === u ? (qt = l, l = u) : l = u, l;
}
function K() {
var l, u;
return l = qt, n.substr(qt, 2) === Zu ? (u = Zu, qt += 2) : (u = null, 0 === Wt && e(_u)),
null !== u && (Lt = l, u = nt()), null === u ? (qt = l, l = u) : l = u, l;
}
function N() {
var l, u;
return l = qt, n.substr(qt, 2) === lt ? (u = lt, qt += 2) : (u = null, 0 === Wt && e(ut)),
null !== u && (Lt = l, u = tt()), null === u ? (qt = l, l = u) : l = u, l;
}
function P() {
var l, u;
return l = qt, n.substr(qt, 2) === rt ? (u = rt, qt += 2) : (u = null, 0 === Wt && e(et)),
null !== u && (Lt = l, u = ot()), null === u ? (qt = l, l = u) : l = u, l;
}
function V() {
var l, u;
return l = qt, n.substr(qt, 2) === ct ? (u = ct, qt += 2) : (u = null, 0 === Wt && e(it)),
null !== u && (Lt = l, u = at()), null === u ? (qt = l, l = u) : l = u, l;
}
function X() {
var l, u;
return l = qt, n.substr(qt, 2) === ft ? (u = ft, qt += 2) : (u = null, 0 === Wt && e(st)),
null !== u && (Lt = l, u = ht()), null === u ? (qt = l, l = u) : l = u, l;
}
function Y() {
var l, u, t;
return l = qt, n.substr(qt, 2) === dt ? (u = dt, qt += 2) : (u = null, 0 === Wt && e(pt)),
null !== u ? (n.length > qt ? (t = n.charAt(qt), qt++) : (t = null, 0 === Wt && e(vt)),
null !== t ? (Lt = l, u = wt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function Z() {
var l, u, t;
return l = qt, 92 === n.charCodeAt(qt) ? (u = At, qt++) : (u = null, 0 === Wt && e(Ct)),
null !== u ? (gt.test(n.charAt(qt)) ? (t = n.charAt(qt), qt++) : (t = null, 0 === Wt && e(bt)),
null !== t ? (Lt = l, u = kt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
function _() {
var l, u, t, r;
if (l = qt, n.substr(qt, 2) === Tt ? (u = Tt, qt += 2) : (u = null, 0 === Wt && e(xt)),
null !== u) {
if (t = [], yt.test(n.charAt(qt)) ? (r = n.charAt(qt), qt++) : (r = null, 0 === Wt && e(mt)),
null !== r) for (;null !== r; ) t.push(r), yt.test(n.charAt(qt)) ? (r = n.charAt(qt),
qt++) : (r = null, 0 === Wt && e(mt)); else t = il;
null !== t ? (Lt = l, u = Rt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il);
} else qt = l, l = il;
return l;
}
function nl() {
var l, u, t, r;
if (l = qt, n.substr(qt, 2) === Ft ? (u = Ft, qt += 2) : (u = null, 0 === Wt && e(Qt)),
null !== u) {
if (t = [], St.test(n.charAt(qt)) ? (r = n.charAt(qt), qt++) : (r = null, 0 === Wt && e(Ut)),
null !== r) for (;null !== r; ) t.push(r), St.test(n.charAt(qt)) ? (r = n.charAt(qt),
qt++) : (r = null, 0 === Wt && e(Ut)); else t = il;
null !== t ? (Lt = l, u = Et(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il);
} else qt = l, l = il;
return l;
}
function ll() {
var l, u, t, r;
if (l = qt, n.substr(qt, 2) === Gt ? (u = Gt, qt += 2) : (u = null, 0 === Wt && e(Bt)),
null !== u) {
if (t = [], St.test(n.charAt(qt)) ? (r = n.charAt(qt), qt++) : (r = null, 0 === Wt && e(Ut)),
null !== r) for (;null !== r; ) t.push(r), St.test(n.charAt(qt)) ? (r = n.charAt(qt),
qt++) : (r = null, 0 === Wt && e(Ut)); else t = il;
null !== t ? (Lt = l, u = jt(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il);
} else qt = l, l = il;
return l;
}
function ul() {
var l, u;
return l = qt, n.substr(qt, 2) === Tt ? (u = Tt, qt += 2) : (u = null, 0 === Wt && e(xt)),
null !== u && (Lt = l, u = $t()), null === u ? (qt = l, l = u) : l = u, l;
}
function tl() {
var l, u, t;
return l = qt, 92 === n.charCodeAt(qt) ? (u = At, qt++) : (u = null, 0 === Wt && e(Ct)),
null !== u ? (n.length > qt ? (t = n.charAt(qt), qt++) : (t = null, 0 === Wt && e(vt)),
null !== t ? (Lt = l, u = bu(t), null === u ? (qt = l, l = u) : l = u) : (qt = l,
l = il)) : (qt = l, l = il), l;
}
var rl, el = arguments.length > 1 ? arguments[1] : {}, ol = {
regexp: c
}, cl = c, il = null, al = "", fl = "|", sl = '"|"', hl = function(n, l) {
return l ? new Alternate(n, l[1]) : n;
}, dl = function(n, l, u) {
return new Match([ n ].concat(l).concat([ u ]));
}, pl = "^", vl = '"^"', wl = function() {
return new Token("start");
}, Al = "$", Cl = '"$"', gl = function() {
return new Token("end");
}, bl = function(n, l) {
return new Quantified(n, l);
}, kl = "Quantifier", Tl = function(n, l) {
return l && (n.greedy = !1), n;
}, xl = "{", yl = '"{"', ml = ",", Rl = '","', Fl = "}", Ql = '"}"', Sl = function(n, l) {
return new Quantifier(n, l);
}, Ul = ",}", El = '",}"', Gl = function(n) {
return new Quantifier(n, 1/0);
}, Bl = function(n) {
return new Quantifier(n, n);
}, jl = "+", $l = '"+"', ql = function() {
return new Quantifier(1, 1/0);
}, Ll = "*", Ml = '"*"', Dl = function() {
return new Quantifier(0, 1/0);
}, Hl = "?", Ol = '"?"', Wl = function() {
return new Quantifier(0, 1);
}, zl = /^[0-9]/, Il = "[0-9]", Jl = function(n) {
return +n.join("");
}, Kl = "(", Nl = '"("', Pl = ")", Vl = '")"', Xl = function(n) {
return n;
}, Yl = function(n) {
return new CaptureGroup(n);
}, Zl = "?:", _l = '"?:"', nu = function(n) {
return new Group("non-capture-group", n);
}, lu = "?=", uu = '"?="', tu = function(n) {
return new Group("positive-lookahead", n);
}, ru = "?!", eu = '"?!"', ou = function(n) {
return new Group("negative-lookahead", n);
}, cu = "CharacterSet", iu = "[", au = '"["', fu = "]", su = '"]"', hu = function(n, l) {
return new CharSet(!!n, l);
}, du = "CharacterRange", pu = "-", vu = '"-"', wu = function(n, l) {
return new CharacterRange(n, l);
}, Au = "Character", Cu = /^[^\\\]]/, gu = "[^\\\\\\]]", bu = function(n) {
return new Literal(n);
}, ku = ".", Tu = '"."', xu = function() {
return new Token("any-character");
}, yu = "Literal", mu = /^[^|\\\/.[()?+*$\^]/, Ru = "[^|\\\\\\/.[()?+*$\\^]", Fu = "\\b", Qu = '"\\\\b"', Su = function() {
return new Token("backspace");
}, Uu = function() {
return new Token("word-boundary");
}, Eu = "\\B", Gu = '"\\\\B"', Bu = function() {
return new Token("non-word-boundary");
}, ju = "\\d", $u = '"\\\\d"', qu = function() {
return new Token("digit");
}, Lu = "\\D", Mu = '"\\\\D"', Du = function() {
return new Token("non-digit");
}, Hu = "\\f", Ou = '"\\\\f"', Wu = function() {
return new Token("form-feed");
}, zu = "\\n", Iu = '"\\\\n"', Ju = function() {
return new Token("line-feed");
}, Ku = "\\r", Nu = '"\\\\r"', Pu = function() {
return new Token("carriage-return");
}, Vu = "\\s", Xu = '"\\\\s"', Yu = function() {
return new Token("white-space");
}, Zu = "\\S", _u = '"\\\\S"', nt = function() {
return new Token("non-white-space");
}, lt = "\\t", ut = '"\\\\t"', tt = function() {
return new Token("tab");
}, rt = "\\v", et = '"\\\\v"', ot = function() {
return new Token("vertical-tab");
}, ct = "\\w", it = '"\\\\w"', at = function() {
return new Token("word");
}, ft = "\\W", st = '"\\\\W"', ht = function() {
return new Token("non-word");
}, dt = "\\c", pt = '"\\\\c"', vt = "any character", wt = function(n) {
return new ControlCharacter(n);
}, At = "\\", Ct = '"\\\\"', gt = /^[1-9]/, bt = "[1-9]", kt = function(n) {
return new BackReference(n);
}, Tt = "\\0", xt = '"\\\\0"', yt = /^[0-7]/, mt = "[0-7]", Rt = function(n) {
return new Octal(n.join(""));
}, Ft = "\\x", Qt = '"\\\\x"', St = /^[0-9a-fA-F]/, Ut = "[0-9a-fA-F]", Et = function(n) {
return new Hex(n.join(""));
}, Gt = "\\u", Bt = '"\\\\u"', jt = function(n) {
return new Unicode(n.join(""));
}, $t = function() {
return new Token("null-character");
}, qt = 0, Lt = 0, Mt = 0, Dt = {
line: 1,
column: 1,
seenCR: !1
}, Ht = 0, Ot = [], Wt = 0;
if ("startRule" in el) {
if (!(el.startRule in ol)) throw new Error("Can't start parsing from rule \"" + el.startRule + '".');
cl = ol[el.startRule];
}
if (Token.offset = t, Token.text = u, rl = cl(), null !== rl && qt === n.length) return rl;
throw o(Ot), Lt = Math.max(qt, Ht), new l(Ot, Lt < n.length ? n.charAt(Lt) : null, Lt, r(Lt).line, r(Lt).column);
}
return n(l, Error), {
SyntaxError: l,
parse: u
};
}(), index = 1, cgs = {};
module.exports = parser
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
/*
## RegExp Handler
https://github.com/ForbesLindesay/regexp
https://github.com/dmajda/pegjs
http://www.regexper.com/
ÿ���ڵ�Ľṹ
{
type: '',
offset: number,
text: '',
body: {},
escaped: true/false
}
type ��ѡֵ
alternate | ѡ��
match ƥ��
capture-group () ������
non-capture-group (?:...) �Dz�����
positive-lookahead (?=p) ������������
negative-lookahead (?!p) ����������
quantified a* �ظ��ڵ�
quantifier * ����
charset [] �ַ���
range {m, n} ��Χ
literal a ֱ�����ַ�
unicode \uxxxx Unicode
hex \x ʮ������
octal �˽���
back-reference \n ��������
control-character \cX �����ַ�
// Token
start ^ ��ͷ
end $ ��β
any-character . �����ַ�
backspace [\b] �˸�ֱ����
word-boundary \b ���ʱ߽�
non-word-boundary \B �ǵ��ʱ߽�
digit \d ASCII ���֣�[0-9]
non-digit \D �� ASCII ���֣�[^0-9]
form-feed \f ��ҳ��
line-feed \n ���з�
carriage-return \r �س���
white-space \s �հ�
non-white-space \S �ǿհ�
tab \t �Ʊ��
vertical-tab \v ��ֱ�Ʊ��
word \w ASCII �ַ���[a-zA-Z0-9]
non-word \W �� ASCII �ַ���[^a-zA-Z0-9]
null-character \o NUL �ַ�
*/
var Util = __webpack_require__(3)
var Random = __webpack_require__(5)
/*
*/
var Handler = {
extend: Util.extend
}
// http://en.wikipedia.org/wiki/ASCII#ASCII_printable_code_chart
/*var ASCII_CONTROL_CODE_CHART = {
'@': ['\u0000'],
A: ['\u0001'],
B: ['\u0002'],
C: ['\u0003'],
D: ['\u0004'],
E: ['\u0005'],
F: ['\u0006'],
G: ['\u0007', '\a'],
H: ['\u0008', '\b'],
I: ['\u0009', '\t'],
J: ['\u000A', '\n'],
K: ['\u000B', '\v'],
L: ['\u000C', '\f'],
M: ['\u000D', '\r'],
N: ['\u000E'],
O: ['\u000F'],
P: ['\u0010'],
Q: ['\u0011'],
R: ['\u0012'],
S: ['\u0013'],
T: ['\u0014'],
U: ['\u0015'],
V: ['\u0016'],
W: ['\u0017'],
X: ['\u0018'],
Y: ['\u0019'],
Z: ['\u001A'],
'[': ['\u001B', '\e'],
'\\': ['\u001C'],
']': ['\u001D'],
'^': ['\u001E'],
'_': ['\u001F']
}*/
// ASCII printable code chart
// var LOWER = 'abcdefghijklmnopqrstuvwxyz'
// var UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
// var NUMBER = '0123456789'
// var SYMBOL = ' !"#$%&\'()*+,-./' + ':;<=>?@' + '[\\]^_`' + '{|}~'
var LOWER = ascii(97, 122)
var UPPER = ascii(65, 90)
var NUMBER = ascii(48, 57)
var OTHER = ascii(32, 47) + ascii(58, 64) + ascii(91, 96) + ascii(123, 126) // �ų� 95 _ ascii(91, 94) + ascii(96, 96)
var PRINTABLE = ascii(32, 126)
var SPACE = ' \f\n\r\t\v\u00A0\u2028\u2029'
var CHARACTER_CLASSES = {
'\\w': LOWER + UPPER + NUMBER + '_', // ascii(95, 95)
'\\W': OTHER.replace('_', ''),
'\\s': SPACE,
'\\S': function() {
var result = PRINTABLE
for (var i = 0; i < SPACE.length; i++) {
result = result.replace(SPACE[i], '')
}
return result
}(),
'\\d': NUMBER,
'\\D': LOWER + UPPER + OTHER
}
function ascii(from, to) {
var result = ''
for (var i = from; i <= to; i++) {
result += String.fromCharCode(i)
}
return result
}
// var ast = RegExpParser.parse(regexp.source)
Handler.gen = function(node, result, cache) {
cache = cache || {
guid: 1
}
return Handler[node.type] ? Handler[node.type](node, result, cache) :
Handler.token(node, result, cache)
}
Handler.extend({
/* jshint unused:false */
token: function(node, result, cache) {
switch (node.type) {
case 'start':
case 'end':
return ''
case 'any-character':
return Random.character()
case 'backspace':
return ''
case 'word-boundary': // TODO
return ''
case 'non-word-boundary': // TODO
break
case 'digit':
return Random.pick(
NUMBER.split('')
)
case 'non-digit':
return Random.pick(
(LOWER + UPPER + OTHER).split('')
)
case 'form-feed':
break
case 'line-feed':
return node.body || node.text
case 'carriage-return':
break
case 'white-space':
return Random.pick(
SPACE.split('')
)
case 'non-white-space':
return Random.pick(
(LOWER + UPPER + NUMBER).split('')
)
case 'tab':
break
case 'vertical-tab':
break
case 'word': // \w [a-zA-Z0-9]
return Random.pick(
(LOWER + UPPER + NUMBER).split('')
)
case 'non-word': // \W [^a-zA-Z0-9]
return Random.pick(
OTHER.replace('_', '').split('')
)
case 'null-character':
break
}
return node.body || node.text
},
/*
{
type: 'alternate',
offset: 0,
text: '',
left: {
boyd: []
},
right: {
boyd: []
}
}
*/
alternate: function(node, result, cache) {
// node.left/right {}
return this.gen(
Random.boolean() ? node.left : node.right,
result,
cache
)
},
/*
{
type: 'match',
offset: 0,
text: '',
body: []
}
*/
match: function(node, result, cache) {
result = ''
// node.body []
for (var i = 0; i < node.body.length; i++) {
result += this.gen(node.body[i], result, cache)
}
return result
},
// ()
'capture-group': function(node, result, cache) {
// node.body {}
result = this.gen(node.body, result, cache)
cache[cache.guid++] = result
return result
},
// (?:...)
'non-capture-group': function(node, result, cache) {
// node.body {}
return this.gen(node.body, result, cache)
},
// (?=p)
'positive-lookahead': function(node, result, cache) {
// node.body
return this.gen(node.body, result, cache)
},
// (?!p)
'negative-lookahead': function(node, result, cache) {
// node.body
return ''
},
/*
{
type: 'quantified',
offset: 3,
text: 'c*',
body: {
type: 'literal',
offset: 3,
text: 'c',
body: 'c',
escaped: false
},
quantifier: {
type: 'quantifier',
offset: 4,
text: '*',
min: 0,
max: Infinity,
greedy: true
}
}
*/
quantified: function(node, result, cache) {
result = ''
// node.quantifier {}
var count = this.quantifier(node.quantifier);
// node.body {}
for (var i = 0; i < count; i++) {
result += this.gen(node.body, result, cache)
}
return result
},
/*
quantifier: {
type: 'quantifier',
offset: 4,
text: '*',
min: 0,
max: Infinity,
greedy: true
}
*/
quantifier: function(node, result, cache) {
var min = Math.max(node.min, 0)
var max = isFinite(node.max) ? node.max :
min + Random.integer(3, 7)
return Random.integer(min, max)
},
/*
*/
charset: function(node, result, cache) {
// node.invert
if (node.invert) return this['invert-charset'](node, result, cache)
// node.body []
var literal = Random.pick(node.body)
return this.gen(literal, result, cache)
},
'invert-charset': function(node, result, cache) {
var pool = PRINTABLE
for (var i = 0, item; i < node.body.length; i++) {
item = node.body[i]
switch (item.type) {
case 'literal':
pool = pool.replace(item.body, '')
break
case 'range':
var min = this.gen(item.start, result, cache).charCodeAt()
var max = this.gen(item.end, result, cache).charCodeAt()
for (var ii = min; ii <= max; ii++) {
pool = pool.replace(String.fromCharCode(ii), '')
}
/* falls through */
default:
var characters = CHARACTER_CLASSES[item.text]
if (characters) {
for (var iii = 0; iii <= characters.length; iii++) {
pool = pool.replace(characters[iii], '')
}
}
}
}
return Random.pick(pool.split(''))
},
range: function(node, result, cache) {
// node.start, node.end
var min = this.gen(node.start, result, cache).charCodeAt()
var max = this.gen(node.end, result, cache).charCodeAt()
return String.fromCharCode(
Random.integer(min, max)
)
},
literal: function(node, result, cache) {
return node.escaped ? node.body : node.text
},
// Unicode \u
unicode: function(node, result, cache) {
return String.fromCharCode(
parseInt(node.code, 16)
)
},
// ʮ������ \xFF
hex: function(node, result, cache) {
return String.fromCharCode(
parseInt(node.code, 16)
)
},
// �˽��� \0
octal: function(node, result, cache) {
return String.fromCharCode(
parseInt(node.code, 8)
)
},
// ��������
'back-reference': function(node, result, cache) {
return cache[node.code] || ''
},
/*
http://en.wikipedia.org/wiki/C0_and_C1_control_codes
*/
CONTROL_CHARACTER_MAP: function() {
var CONTROL_CHARACTER = '@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _'.split(' ')
var CONTROL_CHARACTER_UNICODE = '\u0000 \u0001 \u0002 \u0003 \u0004 \u0005 \u0006 \u0007 \u0008 \u0009 \u000A \u000B \u000C \u000D \u000E \u000F \u0010 \u0011 \u0012 \u0013 \u0014 \u0015 \u0016 \u0017 \u0018 \u0019 \u001A \u001B \u001C \u001D \u001E \u001F'.split(' ')
var map = {}
for (var i = 0; i < CONTROL_CHARACTER.length; i++) {
map[CONTROL_CHARACTER[i]] = CONTROL_CHARACTER_UNICODE[i]
}
return map
}(),
'control-character': function(node, result, cache) {
return this.CONTROL_CHARACTER_MAP[node.code]
}
})
module.exports = Handler
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(24)
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
/*
## toJSONSchema
�� Mock.js ��������ģ��ת���� JSON Schema��
> [JSON Schema](http://json-schema.org/)
*/
var Constant = __webpack_require__(2)
var Util = __webpack_require__(3)
var Parser = __webpack_require__(4)
function toJSONSchema(template, name, path /* Internal Use Only */ ) {
// type rule properties items
path = path || []
var result = {
name: typeof name === 'string' ? name.replace(Constant.RE_KEY, '$1') : name,
template: template,
type: Util.type(template), // ���ܲ�ȷ������ { 'name|1': [{}, {} ...] }
rule: Parser.parse(name)
}
result.path = path.slice(0)
result.path.push(name === undefined ? 'ROOT' : result.name)
switch (result.type) {
case 'array':
result.items = []
Util.each(template, function(value, index) {
result.items.push(
toJSONSchema(value, index, result.path)
)
})
break
case 'object':
result.properties = []
Util.each(template, function(value, name) {
result.properties.push(
toJSONSchema(value, name, result.path)
)
})
break
}
return result
}
module.exports = toJSONSchema
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(26)
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
/*
## valid(template, data)
У����ʵ���� data �Ƿ�������ģ�� template ƥ�䡣
ʵ��˼·��
1. ��������
�Ȱ�����ģ�� template ����Ϊ��������������� JSON-Schame
name ������
type ����ֵ����
template ����ֵģ��
properties ������������
items ����Ԫ������
rule ����ֵ���ɹ���
2. �ݹ���֤����
Ȼ���� JSON-Schema У����ʵ���ݣ�У���������������ֵ���͡�ֵ��ֵ���ɹ���
��ʾ��Ϣ
https://github.com/fge/json-schema-validator/blob/master/src/main/resources/com/github/fge/jsonschema/validator/validation.properties
[JSON-Schama validator](http://json-schema-validator.herokuapp.com/)
[Regexp Demo](http://demos.forbeslindesay.co.uk/regexp/)
*/
var Constant = __webpack_require__(2)
var Util = __webpack_require__(3)
var toJSONSchema = __webpack_require__(23)
function valid(template, data) {
var schema = toJSONSchema(template)
var result = Diff.diff(schema, data)
for (var i = 0; i < result.length; i++) {
// console.log(template, data)
// console.warn(Assert.message(result[i]))
}
return result
}
/*
## name
�����ɹ��ȽϽ������ name
�����ɹ���ֱ�ӱȽ�
## type
������ת����ֱ�ӱȽ�
������ת���������Ž��� template��Ȼ���ټ�飿
## value vs. template
��������
�����ɹ���ֱ�ӱȽ�
�����ɹ���
number
min-max.dmin-dmax
min-max.dcount
count.dmin-dmax
count.dcount
+step
��������
������
boolean
string
min-max
count
## properties
����
�����ɹ�������������Ը����������ݹ�
�����ɹ����ȫ�������Ը����������ݹ�
## items
����
�����ɹ���
`'name|1': [{}, {} ...]` ����֮һ�������ݹ�
`'name|+1': [{}, {} ...]` ˳���⣬�����ݹ�
`'name|min-max': [{}, {} ...]` �������������ݹ�
`'name|count': [{}, {} ...]` �������������ݹ�
�����ɹ����ȫ����Ԫ�ظ����������ݹ�
*/
var Diff = {
diff: function diff(schema, data, name /* Internal Use Only */ ) {
var result = []
// �ȼ������ name ������ type�����ƥ�䣬���б�Ҫ�������
if (
this.name(schema, data, name, result) &&
this.type(schema, data, name, result)
) {
this.value(schema, data, name, result)
this.properties(schema, data, name, result)
this.items(schema, data, name, result)
}
return result
},
/* jshint unused:false */
name: function(schema, data, name, result) {
var length = result.length
Assert.equal('name', schema.path, name + '', schema.name + '', result)
return result.length === length
},
type: function(schema, data, name, result) {
var length = result.length
switch (schema.type) {
case 'string':
// �������С�ռλ����������ֵ����Ϊ��ռλ��������ֵ�����Ϳ��ܺ�ģ�岻һ�£����� '@int' �᷵��һ������ֵ
if (schema.template.match(Constant.RE_PLACEHOLDER)) return true
break
case 'array':
if (schema.rule.parameters) {
// name|count: array
if (schema.rule.min !== undefined && schema.rule.max === undefined) {
// ���� name|1: array����Ϊ����ֵ�����ͣ��ܿ��ܣ��������飬Ҳ��һ���� `array` �е�����һ��
if (schema.rule.count === 1) return true
}
// ���� name|+inc: array
if (schema.rule.parameters[2]) return true
}
break
case 'function':
// ���� `'name': function`����Ϊ�������Է����κ����͵�ֵ��
return true
}
Assert.equal('type', schema.path, Util.type(data), schema.type, result)
return result.length === length
},
value: function(schema, data, name, result) {
var length = result.length
var rule = schema.rule
var templateType = schema.type
if (templateType === 'object' || templateType === 'array' || templateType === 'function') return true
// �����ɹ���
if (!rule.parameters) {
switch (templateType) {
case 'regexp':
Assert.match('value', schema.path, data, schema.template, result)
return result.length === length
case 'string':
// ͬ���������С�ռλ����������ֵ����Ϊ��ռλ�����ķ���ֵ��ͨ������ģ�岻һ��
if (schema.template.match(Constant.RE_PLACEHOLDER)) return result.length === length
break
}
Assert.equal('value', schema.path, data, schema.template, result)
return result.length === length
}
// �����ɹ���
var actualRepeatCount
switch (templateType) {
case 'number':
var parts = (data + '').split('.')
parts[0] = +parts[0]
// ��������
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('value', schema.path, parts[0], Math.min(rule.min, rule.max), result)
// , 'numeric instance is lower than the required minimum (minimum: {expected}, found: {actual})')
Assert.lessThanOrEqualTo('value', schema.path, parts[0], Math.max(rule.min, rule.max), result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('value', schema.path, parts[0], rule.min, result, '[value] ' + name)
}
// ������
if (rule.decimal) {
// |dmin-dmax
if (rule.dmin !== undefined && rule.dmax !== undefined) {
Assert.greaterThanOrEqualTo('value', schema.path, parts[1].length, rule.dmin, result)
Assert.lessThanOrEqualTo('value', schema.path, parts[1].length, rule.dmax, result)
}
// |dcount
if (rule.dmin !== undefined && rule.dmax === undefined) {
Assert.equal('value', schema.path, parts[1].length, rule.dmin, result)
}
}
break
case 'boolean':
break
case 'string':
// 'aaa'.match(/a/g)
actualRepeatCount = data.match(new RegExp(schema.template, 'g'))
actualRepeatCount = actualRepeatCount ? actualRepeatCount.length : 0
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.min, result)
Assert.lessThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.max, result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('repeat count', schema.path, actualRepeatCount, rule.min, result)
}
break
case 'regexp':
actualRepeatCount = data.match(new RegExp(schema.template.source.replace(/^\^|\$$/g, ''), 'g'))
actualRepeatCount = actualRepeatCount ? actualRepeatCount.length : 0
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.min, result)
Assert.lessThanOrEqualTo('repeat count', schema.path, actualRepeatCount, rule.max, result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
Assert.equal('repeat count', schema.path, actualRepeatCount, rule.min, result)
}
break
}
return result.length === length
},
properties: function(schema, data, name, result) {
var length = result.length
var rule = schema.rule
var keys = Util.keys(data)
if (!schema.properties) return
// �����ɹ���
if (!schema.rule.parameters) {
Assert.equal('properties length', schema.path, keys.length, schema.properties.length, result)
} else {
// �����ɹ���
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('properties length', schema.path, keys.length, Math.min(rule.min, rule.max), result)
Assert.lessThanOrEqualTo('properties length', schema.path, keys.length, Math.max(rule.min, rule.max), result)
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
// |1, |>1
if (rule.count !== 1) Assert.equal('properties length', schema.path, keys.length, rule.min, result)
}
}
if (result.length !== length) return false
for (var i = 0; i < keys.length; i++) {
result.push.apply(
result,
this.diff(
function() {
var property
Util.each(schema.properties, function(item /*, index*/ ) {
if (item.name === keys[i]) property = item
})
return property || schema.properties[i]
}(),
data[keys[i]],
keys[i]
)
)
}
return result.length === length
},
items: function(schema, data, name, result) {
var length = result.length
if (!schema.items) return
var rule = schema.rule
// �����ɹ���
if (!schema.rule.parameters) {
Assert.equal('items length', schema.path, data.length, schema.items.length, result)
} else {
// �����ɹ���
// |min-max
if (rule.min !== undefined && rule.max !== undefined) {
Assert.greaterThanOrEqualTo('items', schema.path, data.length, (Math.min(rule.min, rule.max) * schema.items.length), result,
'[{utype}] array is too short: {path} must have at least {expected} elements but instance has {actual} elements')
Assert.lessThanOrEqualTo('items', schema.path, data.length, (Math.max(rule.min, rule.max) * schema.items.length), result,
'[{utype}] array is too long: {path} must have at most {expected} elements but instance has {actual} elements')
}
// |count
if (rule.min !== undefined && rule.max === undefined) {
// |1, |>1
if (rule.count === 1) return result.length === length
else Assert.equal('items length', schema.path, data.length, (rule.min * schema.items.length), result)
}
// |+inc
if (rule.parameters[2]) return result.length === length
}
if (result.length !== length) return false
for (var i = 0; i < data.length; i++) {
result.push.apply(
result,
this.diff(
schema.items[i % schema.items.length],
data[i],
i % schema.items.length
)
)
}
return result.length === length
}
}
/*
���ơ��Ѻõ���ʾ��Ϣ
Equal, not equal to, greater than, less than, greater than or equal to, less than or equal to
·�� ��֤���� ����
Expect path.name is less than or equal to expected, but path.name is actual.
Expect path.name is less than or equal to expected, but path.name is actual.
Expect path.name is greater than or equal to expected, but path.name is actual.
*/
var Assert = {
message: function(item) {
return (item.message ||
'[{utype}] Expect {path}\'{ltype} {action} {expected}, but is {actual}')
.replace('{utype}', item.type.toUpperCase())
.replace('{ltype}', item.type.toLowerCase())
.replace('{path}', Util.isArray(item.path) && item.path.join('.') || item.path)
.replace('{action}', item.action)
.replace('{expected}', item.expected)
.replace('{actual}', item.actual)
},
equal: function(type, path, actual, expected, result, message) {
if (actual === expected) return true
switch (type) {
case 'type':
// ����ģ�� === �ַ�������ֵ
if (expected === 'regexp' && actual === 'string') return true
break
}
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
// actual matches expected
match: function(type, path, actual, expected, result, message) {
if (expected.test(actual)) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'matches',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
notEqual: function(type, path, actual, expected, result, message) {
if (actual !== expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is not equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
greaterThan: function(type, path, actual, expected, result, message) {
if (actual > expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is greater than',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
lessThan: function(type, path, actual, expected, result, message) {
if (actual < expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is less to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
greaterThanOrEqualTo: function(type, path, actual, expected, result, message) {
if (actual >= expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is greater than or equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
},
lessThanOrEqualTo: function(type, path, actual, expected, result, message) {
if (actual <= expected) return true
var item = {
path: path,
type: type,
actual: actual,
expected: expected,
action: 'is less than or equal to',
message: message
}
item.message = Assert.message(item)
result.push(item)
return false
}
}
valid.Diff = Diff
valid.Assert = Assert
module.exports = valid
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(28)
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
/* global window, document, location, Event, setTimeout */
/*
## MockXMLHttpRequest
�����Ĺ��ܣ�
1. �����ظ���ԭ�� XHR ����Ϊ
2. ������ģ��ԭ�� XHR ����Ϊ
3. �ڷ�������ʱ���Զ�����Ƿ���Ҫ����
4. ����������أ���ִ��ԭ�� XHR ����Ϊ
5. �����Ҫ���أ���ִ������ XHR ����Ϊ
6. ���� XMLHttpRequest �� ActiveXObject
new window.XMLHttpRequest()
new window.ActiveXObject("Microsoft.XMLHTTP")
�ؼ�����������
* new ��ʱ����ȷ���Ƿ���Ҫ���أ����Դ���ԭ�� XHR �����DZ���ġ�
* open ��ʱ����ȡ�� URL�����Ծ����Ƿ�������ء�
* send ��ʱ�Ѿ�ȷ��������ʽ��
�淶��
http://xhr.spec.whatwg.org/
http://www.w3.org/TR/XMLHttpRequest2/
�ο�ʵ�֣�
https://github.com/philikon/MockHttpRequest/blob/master/lib/mock.js
https://github.com/trek/FakeXMLHttpRequest/blob/master/fake_xml_http_request.js
https://github.com/ilinsky/xmlhttprequest/blob/master/XMLHttpRequest.js
https://github.com/firebug/firebug-lite/blob/master/content/lite/xhr.js
https://github.com/thx/RAP/blob/master/lab/rap.plugin.xinglie.js
**�費��Ҫȫ����д XMLHttpRequest��**
http://xhr.spec.whatwg.org/#interface-xmlhttprequest
�ؼ����� readyState��status��statusText��response��responseText��responseXML �� readonly�����ԣ���ͼͨ������Щ״̬����ģ����Ӧ�Dz����еġ�
��ˣ�Ψһ�İ취��ģ������ XMLHttpRequest������ jQuery ���¼�ģ�͵ķ�װ��
// Event handlers
onloadstart loadstart
onprogress progress
onabort abort
onerror error
onload load
ontimeout timeout
onloadend loadend
onreadystatechange readystatechange
*/
var Util = __webpack_require__(3)
// ����ԭ�� XMLHttpRequest
window._XMLHttpRequest = window.XMLHttpRequest
window._ActiveXObject = window.ActiveXObject
/*
PhantomJS
TypeError: '[object EventConstructor]' is not a constructor (evaluating 'new Event("readystatechange")')
https://github.com/bluerail/twitter-bootstrap-rails-confirm/issues/18
https://github.com/ariya/phantomjs/issues/11289
*/
try {
new window.Event('custom')
} catch (exception) {
window.Event = function(type, bubbles, cancelable, detail) {
var event = document.createEvent('CustomEvent') // MUST be 'CustomEvent'
event.initCustomEvent(type, bubbles, cancelable, detail)
return event
}
}
var XHR_STATES = {
// The object has been constructed.
UNSENT: 0,
// The open() method has been successfully invoked.
OPENED: 1,
// All redirects (if any) have been followed and all HTTP headers of the response have been received.
HEADERS_RECEIVED: 2,
// The response's body is being received.
LOADING: 3,
// The data transfer has been completed or something went wrong during the transfer (e.g. infinite redirects).
DONE: 4
}
var XHR_EVENTS = 'readystatechange loadstart progress abort error load timeout loadend'.split(' ')
var XHR_REQUEST_PROPERTIES = 'timeout withCredentials'.split(' ')
var XHR_RESPONSE_PROPERTIES = 'readyState responseURL status statusText responseType response responseText responseXML'.split(' ')
// https://github.com/trek/FakeXMLHttpRequest/blob/master/fake_xml_http_request.js#L32
var HTTP_STATUS_CODES = {
100: "Continue",
101: "Switching Protocols",
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
206: "Partial Content",
300: "Multiple Choice",
301: "Moved Permanently",
302: "Found",
303: "See Other",
304: "Not Modified",
305: "Use Proxy",
307: "Temporary Redirect",
400: "Bad Request",
401: "Unauthorized",
402: "Payment Required",
403: "Forbidden",
404: "Not Found",
405: "Method Not Allowed",
406: "Not Acceptable",
407: "Proxy Authentication Required",
408: "Request Timeout",
409: "Conflict",
410: "Gone",
411: "Length Required",
412: "Precondition Failed",
413: "Request Entity Too Large",
414: "Request-URI Too Long",
415: "Unsupported Media Type",
416: "Requested Range Not Satisfiable",
417: "Expectation Failed",
422: "Unprocessable Entity",
500: "Internal Server Error",
501: "Not Implemented",
502: "Bad Gateway",
503: "Service Unavailable",
504: "Gateway Timeout",
505: "HTTP Version Not Supported"
}
/*
MockXMLHttpRequest
*/
function MockXMLHttpRequest() {
// ��ʼ�� custom �������ڴ洢�Զ�������
this.custom = {
events: {},
requestHeaders: {},
responseHeaders: {}
}
}
MockXMLHttpRequest._settings = {
timeout: '10-100',
/*
timeout: 50,
timeout: '10-100',
*/
}
MockXMLHttpRequest.setup = function(settings) {
Util.extend(MockXMLHttpRequest._settings, settings)
return MockXMLHttpRequest._settings
}
Util.extend(MockXMLHttpRequest, XHR_STATES)
Util.extend(MockXMLHttpRequest.prototype, XHR_STATES)
// ��ǵ�ǰ����Ϊ MockXMLHttpRequest
MockXMLHttpRequest.prototype.mock = true
// �Ƿ����� Ajax ����
MockXMLHttpRequest.prototype.match = false
// ��ʼ�� Request ��ص����Ժͷ���
Util.extend(MockXMLHttpRequest.prototype, {
// https://xhr.spec.whatwg.org/#the-open()-method
// Sets the request method, request URL, and synchronous flag.
open: function(method, url, async, username, password) {
var that = this
Util.extend(this.custom, {
method: method,
url: url,
async: typeof async === 'boolean' ? async : true,
username: username,
password: password,
options: {
url: url,
type: method
}
})
this.custom.timeout = function(timeout) {
if (typeof timeout === 'number') return timeout
if (typeof timeout === 'string' && !~timeout.indexOf('-')) return parseInt(timeout, 10)
if (typeof timeout === 'string' && ~timeout.indexOf('-')) {
var tmp = timeout.split('-')
var min = parseInt(tmp[0], 10)
var max = parseInt(tmp[1], 10)
return Math.round(Math.random() * (max - min)) + min
}
}(MockXMLHttpRequest._settings.timeout)
// �������������ƥ�������ģ��
var item = find(this.custom.options)
function handle(event) {
// ͬ������ NativeXMLHttpRequest => MockXMLHttpRequest
for (var i = 0; i < XHR_RESPONSE_PROPERTIES.length; i++) {
try {
that[XHR_RESPONSE_PROPERTIES[i]] = xhr[XHR_RESPONSE_PROPERTIES[i]]
} catch (e) {}
}
// ���� MockXMLHttpRequest �ϵ�ͬ���¼�
that.dispatchEvent(new Event(event.type /*, false, false, that*/ ))
}
// ���δ�ҵ�ƥ�������ģ�壬�����ԭ�� XHR ��������
if (!item) {
// ����ԭ�� XHR ������ԭ�� open()����������ԭ���¼�
var xhr = createNativeXMLHttpRequest()
this.custom.xhr = xhr
// ��ʼ�������¼������ڼ���ԭ�� XHR ������¼�
for (var i = 0; i < XHR_EVENTS.length; i++) {
xhr.addEventListener(XHR_EVENTS[i], handle)
}
// xhr.open()
if (username) xhr.open(method, url, async, username, password)
else xhr.open(method, url, async)
// ͬ������ MockXMLHttpRequest => NativeXMLHttpRequest
for (var j = 0; j < XHR_REQUEST_PROPERTIES.length; j++) {
try {
xhr[XHR_REQUEST_PROPERTIES[j]] = that[XHR_REQUEST_PROPERTIES[j]]
} catch (e) {}
}
return
}
// �ҵ���ƥ�������ģ�壬��ʼ���� XHR ����
this.match = true
this.custom.template = item
this.readyState = MockXMLHttpRequest.OPENED
this.dispatchEvent(new Event('readystatechange' /*, false, false, this*/ ))
},
// https://xhr.spec.whatwg.org/#the-setrequestheader()-method
// Combines a header in author request headers.
setRequestHeader: function(name, value) {
// ԭ�� XHR
if (!this.match) {
this.custom.xhr.setRequestHeader(name, value)
return
}
// ���� XHR
var requestHeaders = this.custom.requestHeaders
if (requestHeaders[name]) requestHeaders[name] += ',' + value
else requestHeaders[name] = value
},
timeout: 0,
withCredentials: false,
upload: {},
// https://xhr.spec.whatwg.org/#the-send()-method
// Initiates the request.
send: function send(data) {
var that = this
this.custom.options.body = data
// ԭ�� XHR
if (!this.match) {
this.custom.xhr.send(data)
return
}
// ���� XHR
// X-Requested-With header
this.setRequestHeader('X-Requested-With', 'MockXMLHttpRequest')
// loadstart The fetch initiates.
this.dispatchEvent(new Event('loadstart' /*, false, false, this*/ ))
if (this.custom.async) setTimeout(done, this.custom.timeout) // �첽
else done() // ͬ��
function done() {
that.readyState = MockXMLHttpRequest.HEADERS_RECEIVED
that.dispatchEvent(new Event('readystatechange' /*, false, false, that*/ ))
that.readyState = MockXMLHttpRequest.LOADING
that.dispatchEvent(new Event('readystatechange' /*, false, false, that*/ ))
that.status = 200
that.statusText = HTTP_STATUS_CODES[200]
// fix #92 #93 by @qddegtya
that.response = that.responseText = JSON.stringify(
convert(that.custom.template, that.custom.options),
null, 4
)
that.readyState = MockXMLHttpRequest.DONE
that.dispatchEvent(new Event('readystatechange' /*, false, false, that*/ ))
that.dispatchEvent(new Event('load' /*, false, false, that*/ ));
that.dispatchEvent(new Event('loadend' /*, false, false, that*/ ));
}
},
// https://xhr.spec.whatwg.org/#the-abort()-method
// Cancels any network activity.
abort: function abort() {
// ԭ�� XHR
if (!this.match) {
this.custom.xhr.abort()
return
}
// ���� XHR
this.readyState = MockXMLHttpRequest.UNSENT
this.dispatchEvent(new Event('abort', false, false, this))
this.dispatchEvent(new Event('error', false, false, this))
}
})
// ��ʼ�� Response ��ص����Ժͷ���
Util.extend(MockXMLHttpRequest.prototype, {
responseURL: '',
status: MockXMLHttpRequest.UNSENT,
statusText: '',
// https://xhr.spec.whatwg.org/#the-getresponseheader()-method
getResponseHeader: function(name) {
// ԭ�� XHR
if (!this.match) {
return this.custom.xhr.getResponseHeader(name)
}
// ���� XHR
return this.custom.responseHeaders[name.toLowerCase()]
},
// https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method
// http://www.utf8-chartable.de/
getAllResponseHeaders: function() {
// ԭ�� XHR
if (!this.match) {
return this.custom.xhr.getAllResponseHeaders()
}
// ���� XHR
var responseHeaders = this.custom.responseHeaders
var headers = ''
for (var h in responseHeaders) {
if (!responseHeaders.hasOwnProperty(h)) continue
headers += h + ': ' + responseHeaders[h] + '\r\n'
}
return headers
},
overrideMimeType: function( /*mime*/ ) {},
responseType: '', // '', 'text', 'arraybuffer', 'blob', 'document', 'json'
response: null,
responseText: '',
responseXML: null
})
// EventTarget
Util.extend(MockXMLHttpRequest.prototype, {
addEventListener: function addEventListener(type, handle) {
var events = this.custom.events
if (!events[type]) events[type] = []
events[type].push(handle)
},
removeEventListener: function removeEventListener(type, handle) {
var handles = this.custom.events[type] || []
for (var i = 0; i < handles.length; i++) {
if (handles[i] === handle) {
handles.splice(i--, 1)
}
}
},
dispatchEvent: function dispatchEvent(event) {
var handles = this.custom.events[event.type] || []
for (var i = 0; i < handles.length; i++) {
handles[i].call(this, event)
}
var ontype = 'on' + event.type
if (this[ontype]) this[ontype](event)
}
})
// Inspired by jQuery
function createNativeXMLHttpRequest() {
var isLocal = function() {
var rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/
var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/
var ajaxLocation = location.href
var ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || []
return rlocalProtocol.test(ajaxLocParts[1])
}()
return window.ActiveXObject ?
(!isLocal && createStandardXHR() || createActiveXHR()) : createStandardXHR()
function createStandardXHR() {
try {
return new window._XMLHttpRequest();
} catch (e) {}
}
function createActiveXHR() {
try {
return new window._ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
// �������������ƥ�������ģ�壺URL��Type
function find(options) {
for (var sUrlType in MockXMLHttpRequest.Mock._mocked) {
var item = MockXMLHttpRequest.Mock._mocked[sUrlType]
if (
(!item.rurl || match(item.rurl, options.url)) &&
(!item.rtype || match(item.rtype, options.type.toLowerCase()))
) {
// console.log('[mock]', options.url, '>', item.rurl)
return item
}
}
function match(expected, actual) {
if (Util.type(expected) === 'string') {
return expected === actual
}
if (Util.type(expected) === 'regexp') {
return expected.test(actual)
}
}
}
// ����ģ�� ��> ��Ӧ����
function convert(item, options) {
return Util.isFunction(item.template) ?
item.template(options) : MockXMLHttpRequest.Mock.mock(item.template)
}
module.exports = MockXMLHttpRequest
/***/ }
/******/ ])
});
;
|
var margin = {top: 20, right: 1, bottom: 6, left: 1},
width = 1140 - margin.left - margin.right,
height = 630 - margin.top - margin.bottom;
var formatNumber = d3.format(",.0f"),
format = function(d) { return "$" + formatNumber(d); },
color = d3.scale.category10();
var svg = d3.select("#chart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom);
svg.append("text")
.text("Revenues")
.attr("y", margin.top * 0.6)
.attr("x", margin.left);
svg.append("text")
.text("Expenses")
.attr("y", margin.top * 0.6)
.attr("x", margin.left + width)
.attr("text-anchor", "end");
// define color scales
var fundColors = d3.scale.ordinal()
.domain(["Discretionary Funds", "Non-discretionary Funds"])
.range(["#4285ff", "#8249b7"]); //2020 renovation
// .range(["#276419", "#4db029"]);
// .range(["#276419", "#b8e186"]);
var erColors = d3.scale.ordinal()
.domain(["expense", "revenue"])
.range(["#ff8129", "#7fc97f"]);
// .range(["#ffb36b", "#7fc97f"]);
// .range(["#ffd92f", "#ffd92f"])
// .range(["#c51b7d", "#8e0152"]);
// create color gradients for links
svg.append('linearGradient')
.attr("id", "gradientRtoGF")
.attr("x1", 0).attr("y1", 0)
.attr("x2", '100%').attr("y2", 0)
.selectAll("stop")
.data([
{offset: "10%", color: erColors("revenue")},
{offset: "90%", color: fundColors("Discretionary Funds")}
])
.enter().append("stop")
.attr("offset", function(d) { return d.offset; })
.attr("stop-color", function(d) { return d.color; });
svg.append('linearGradient')
.attr("id", "gradientRtoNF")
.attr("x1", 0).attr("y1", 0)
.attr("x2", '100%').attr("y2", 0)
.selectAll("stop")
.data([
{offset: "10%", color: erColors("revenue")},
{offset: "90%", color: fundColors("Non-discretionary Funds")}
])
.enter().append("stop")
.attr("offset", function(d) { return d.offset; })
.attr("stop-color", function(d) { return d.color; });
svg.append('linearGradient')
.attr("id", "gradientNFtoE")
.attr("x1", 0).attr("y1", 0)
.attr("x2", '100%').attr("y2", 0)
.selectAll("stop")
.data([
{offset: "10%", color: fundColors("Non-discretionary Funds")},
{offset: "90%", color: erColors("expense")}
])
.enter().append("stop")
.attr("offset", function(d) { return d.offset; })
.attr("stop-color", function(d) { return d.color; });
svg.append('linearGradient')
.attr("id", "gradientGFtoE")
.attr("x1", 0).attr("y1", 0)
.attr("x2", '100%').attr("y2", 0)
.selectAll("stop")
.data([
{offset: "10%", color: fundColors("Discretionary Funds")},
{offset: "90%", color: erColors("expense")}
])
.enter().append("stop")
.attr("offset", function(d) { return d.offset; })
.attr("stop-color", function(d) { return d.color; });
// wrangle the data
function data_wrangle(dataset, fy){
var newdata = dataset.filter(function(v){
return v.budget_year == fy
})
rev_order = [
// keep variations of the same label on a single line
"Property Tax",
"Business License Tax",
"Sales Tax",
"Utility Consumption Tax",
"Real Estate Transfer Tax",
"Fines & Penalties",
"Parking Tax",
"Transient Occupancy Tax",
"Service Charges",
"Transfers from Fund Balance",
"Miscellaneous Revenue", "Miscellaneous",
"Interest Income",
"Licenses & Permits",
"Interfund Transfers",
"Grants & Subsidies",
"Local (Parcel) Taxes", "Local Tax",
"Internal Service Funds",
"Gas Tax", "Gasoline Tax",
];
rev = newdata.filter(function(v,i,a){
return v.account_type == "Revenue";
});
revcats = d3.nest()
.key(function(d){
return d.account_category;
})
.sortKeys(function(a,b){
return rev_order.indexOf(a) - rev_order.indexOf(b);
})
.key(function(d){
if (d.fund_code == "1010") {
return "Discretionary Funds";
} else {
return "Non-discretionary Funds";
}
})
.rollup(function(v){
var values = v;
values.total = d3.sum(values, function(d){
return +d.amount;
});
return values;
})
.entries(rev);
nodes = [{"name": "Discretionary Funds", "type": "fund", "order": 0}, {"name": "Non-discretionary Funds", "type": "fund", "order": 1}];
nodeoffset = nodes.length;
links = [];
for (var i = 0; i < revcats.length; i++){
nodes.push({"name": revcats[i].key, "type": "revenue"});
for (var x = 0; x < revcats[i].values.length; x++) {
var link = {
"source": i + nodeoffset,
"value": revcats[i].values[x].values.total,
};
if (revcats[i].values[x].key == "Discretionary Funds"){
link.target = 0;
} else if (revcats[i].values[x].key == "Non-discretionary Funds") {
link.target = 1;
}
links.push(link);
}
}
exp = newdata.filter(function(v,i,a){
return v.account_type == "Expense";
});
exp_order = [
// keep variations of the same label on a single line
"Police Department", "Police",
"Police Commission",
"Fire Department", "Fire",
"City Council",
"Administrative Services",
"Oakland Parks & Recreation", "Parks & Recreation",
"Race & Equity",
"Transportation",
"Human Services",
"City Auditor",
"Community Services",
"Information Technology",
"Public Ethics Commission",
"Finance", "Finance Department",
"City Clerk",
"Capital Improvement Projects",
"Mayor",
"Economic & Workforce Development",
"City Administrator",
"Human Resources Management", "Human Resources",
"Planning & Building",
"City Attorney",
"Housing & Community Development",
"Library", "Oakland Public Library", "Public Library",
"Public Works", "Oakland Public Works",
"Debt Service & Misc."
];
expdivs = d3.nest()
.key(function(d){
if (d.department == "Non-Departmental") {
return "Debt Service & Misc."
}
return d.department;
})
.sortKeys(function(a,b){
return exp_order.indexOf(a) - exp_order.indexOf(b);
})
.key(function(d){
if (d.fund_code == "1010") {
return "Discretionary Funds";
} else {
return "Non-discretionary Funds";
}
})
.rollup(function(v){
var values = v;
values.total = d3.sum(values, function(d){
return d.amount;
});
return values;
})
.entries(exp);
for (var i = 0; i < expdivs.length; i++){
nodes.push({"name": expdivs[i].key, "type": "expense"});
for (var x = 0; x < expdivs[i].values.length; x++) {
var link = {
"target": i + nodeoffset + revcats.length,
"value": expdivs[i].values[x].values.total,
};
if (expdivs[i].values[x].key == "Discretionary Funds"){
link.source = 0;
} else if (expdivs[i].values[x].key == "Non-discretionary Funds") {
link.source = 1;
}
links.push(link);
}
}
return {"nodes": nodes, "links": links};
}
// render the sankey
function do_with_budget(data) {
svg.select("#chart").remove();
var chart = svg.append("g")
.attr("id", "chart")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var sankey = d3.sankey()
.nodeWidth(20)
.nodePadding(10)
.size([width, height]);
var path = sankey.link();
sankey
.nodes(data.nodes)
.links(data.links)
.layout(0);
var link = chart.append("g")
.selectAll(".link")
.data(data.links)
.enter().append("path")
.attr("class", "link")
.attr("d", path)
.style("stroke-width", function(d) {
return Math.max(1, d.dy); })
.style("stroke", function(d){
switch (d.target.name){
case "Discretionary Funds":
return "url('#gradientRtoGF')";
case "Non-discretionary Funds":
return "url('#gradientRtoNF')";
}
switch (d.source.name) {
case "Discretionary Funds":
return "url('#gradientGFtoE')";
case "Non-discretionary Funds":
return "url('#gradientNFtoE')";
}
})
.sort(function(a, b) {
return b.dy - a.dy;
})
.on("mouseover", function(d){
let definition = "";
const sourceWords = d.source.name.split(" ");
console.log(`hovering over ${sourceWords[sourceWords.length - 1]}`);
if ( sourceWords[sourceWords.length - 1] === "Funds" && window.localStorage.getItem(d.target.name)) {
definition = window.localStorage.getItem(d.target.name);
} else if (window.localStorage.getItem(d.source.name)) {
definition = window.localStorage.getItem(d.source.name);
} else {
definition = "definition unavailable"
}
d3.select(this).classed("highlight", true);
d3.select("#hover_description")
.classed("show", true)
.text(d.source.name + " → " + d.target.name + ": " + format(d.value) + ` (${definition})`);
})
.on("mousemove", function(d){
d3.select("#hover_description")
.style({
"top": (d3.event.y - 10 + $(window).scrollTop()) + "px",
"left": (d3.event.x + 10) + "px"
});
})
.on("mouseout", function(){
d3.select(this).classed("highlight", function(){
return d3.select(this).classed('click');
})
d3.select("#hover_description")
.classed("show", false);
});
var node = chart.append("g").selectAll(".node")
.data(data.nodes)
.enter().append("g")
.attr("class", function(d){ return "node " + d.type; })
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
node.append("rect")
.attr("height", function(d) { return d.dy; })
.attr("width", sankey.nodeWidth())
.style("fill", function(d) {
switch (d.type) {
case "fund":
d.color = fundColors(d.name);
// d.color = "transparent";
break;
default:
d.color = erColors(d.type);
break;
}
return d.color;
})
.style("stroke", function(d) { if (d.type === "fund") {return d3.rgb(d.color);} else {return d3.rgb(d.color).darker(1);} })
.on("mouseover", function(d){
var thisnode = d3.select(this.parentNode);
// highlight node only, not flows
thisnode.classed("hover", true);
// append total amount to label
thisnode.select("text").transition()
.text(function(d){
var text = d.name;
text += ': ' + format(d.value);
return text;
});
})
.on("mouseout", function(d){
var thisnode = d3.select(this.parentNode);
// remove node highlight
thisnode.classed("hover", false);
// remove amount from label
if (!thisnode.classed('highlight')) {
thisnode.select("text").transition()
.text(function(d){ return d.name; });
}
})
.on("click", function(d){
var thisnode = d3.select(this.parentNode);
if (thisnode.classed("highlight")) {
thisnode.classed("highlight", false);
thisnode.classed("hover", false);
} else {
// node.classed("highlight", false);
thisnode.classed("highlight", true);
}
link.classed('highlight click', function(link_d){
if ([link_d.target.name, link_d.source.name].indexOf(d.name) >= 0) {
return thisnode.classed("highlight");
} else {
return d3.select(this).classed("click");
}
});
thisnode.select("text").transition()
.text(function(d){
var text = d.name;
if (thisnode.classed('highlight')) {
text += ': ' + format(d.value);
}
return text;
});
});
node.append("text")
.attr("x", -6)
.attr("y", function(d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("class", "main-text")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function(d) { return d.name; })
.filter(function(d) { return d.x < width / 2; })
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
};
|
!(function (e, t) {
"object" == typeof exports && "object" == typeof module
? (module.exports = t(require("gofor")))
: "function" == typeof define && define.amd
? define(["gofor"], t)
: "object" == typeof exports
? (exports.fNotificationSound = t(require("gofor")))
: (e.fNotificationSound = t(e.Gofor));
})(this, function (e) {
return (function (e) {
function t(o) {
if (n[o]) return n[o].exports;
var r = (n[o] = { i: o, l: !1, exports: {} });
return e[o].call(r.exports, r, r.exports, t), (r.l = !0), r.exports;
}
var n = {};
return (
(t.m = e),
(t.c = n),
(t.i = function (e) {
return e;
}),
(t.d = function (e, n, o) {
t.o(e, n) ||
Object.defineProperty(e, n, {
configurable: !1,
enumerable: !0,
get: o,
});
}),
(t.n = function (e) {
var n =
e && e.__esModule
? function () {
return e["default"];
}
: function () {
return e;
};
return t.d(n, "a", n), n;
}),
(t.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}),
(t.p = ""),
t((t.s = 619))
);
})({
109: function (e, t, n) {
"use strict";
function o() {
for (var e = i(); r.glob[u].has(e); ) e = i();
return r.glob[u].add(e), e;
}
Object.defineProperty(t, "__esModule", { value: !0 }), (t.uid = o);
var r = n(6),
i = function () {
return ("" + Math.random()).slice(-8) + ("" + Date.now()).slice(8);
},
u = Symbol["for"]("futile uid");
r.glob[u] = r.glob[u] || new Set();
},
124: function (e, t, n) {
"use strict";
function o(e, t) {
if (!(e instanceof t))
throw new TypeError("Cannot call a class as a function");
}
Object.defineProperty(t, "__esModule", { value: !0 }), (t.tab = void 0);
var r = (function () {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var o = t[n];
(o.enumerable = o.enumerable || !1),
(o.configurable = !0),
"value" in o && (o.writable = !0),
Object.defineProperty(e, o.key, o);
}
}
return function (t, n, o) {
return n && e(t.prototype, n), o && e(t, o), t;
};
})(),
i = n(58),
u = n(13),
s = n(109),
a = n(6),
c = "VdOMGFYWmxYM1JoWWc",
f = "focus",
l = (function () {
function e() {
if ((o(this, e), !u.env.browser))
throw new Error(
"[fUtile][Tab][Constructor] Module should only be used in the browser"
);
(this.uid = s.uid()),
(this.setActiveTab = this.setActiveTab.bind(this)),
(this.whenActive = new Set()),
(this.focusHandlers = new Map()),
this.setActiveTab(),
this.onFocus(this.setActiveTab);
}
return (
r(e, [
{
key: "setActiveTab",
value: function () {
this.isActive ||
(i.localStorage.set(c, this.uid),
this.whenActive.forEach(function (e) {
return e();
}));
},
},
{
key: "onSetActive",
value: function (e) {
"function" == typeof e && this.whenActive.add(e);
},
},
{
key: "focusSubscribe",
value: function (e) {
if ("function" != typeof e) return null;
var t = s.uid();
return this.onFocus(e), this.focusHandlers.set(t, e), t;
},
},
{
key: "focusUnsubscribe",
value: function (e) {
window.removeEventListener(f, this.focusHandlers.get(e));
},
},
{
key: "onFocus",
value: function (e) {
window.addEventListener(f, e);
},
},
{
key: "activeTab",
get: function () {
return i.localStorage.get(c);
},
},
{
key: "isActive",
get: function () {
return this.activeTab === this.uid;
},
},
]),
e
);
})(),
d = c;
t.tab = function () {
return (a.glob[d] = a.glob[d] || new l());
};
},
13: function (e, t, n) {
"use strict";
function o(e, t) {
if (!(e instanceof t))
throw new TypeError("Cannot call a class as a function");
}
Object.defineProperty(t, "__esModule", { value: !0 }), (t.env = void 0);
var r =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
},
i = (function () {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var o = t[n];
(o.enumerable = o.enumerable || !1),
(o.configurable = !0),
"value" in o && (o.writable = !0),
Object.defineProperty(e, o.key, o);
}
}
return function (t, n, o) {
return n && e(t.prototype, n), o && e(t, o), t;
};
})(),
u = n(6),
s = n(23),
a = n(37),
c = n(49),
f = (function () {
function e() {
o(this, e),
a.memoizer(
this,
"node",
"browser",
"development",
"production",
"testing",
"plike",
"toString"
);
}
return (
i(e, [
{
key: "toString",
value: function () {
var e = this.browser
? s.resolve("app.environment")
: s.resolve("process.env.NODE_ENV");
return (e || "").toLowerCase();
},
},
{
key: "node",
get: function () {
return (
"[object process]" ===
Object.prototype.toString.call(
"undefined" != typeof u.glob.process ? u.glob.process : 0
)
);
},
},
{
key: "browser",
get: function () {
return (
c.isBrowserLike() ||
(!this.node &&
[
"undefined" == typeof document
? "undefined"
: r(document),
"undefined" == typeof window ? "undefined" : r(window),
].every(function (e) {
return "undefined" !== e;
}))
);
},
},
{
key: "development",
get: function () {
return this.toString().includes("dev");
},
},
{
key: "dev",
get: function () {
return this.development;
},
},
{
key: "production",
get: function () {
return this.toString().includes("prod");
},
},
{
key: "prod",
get: function () {
return this.production;
},
},
{
key: "testing",
get: function () {
return this.toString().includes("test");
},
},
{
key: "test",
get: function () {
return this.testing;
},
},
{
key: "plike",
get: function () {
return this.toString().includes("like");
},
},
]),
e
);
})();
t.env = new f();
},
20: function (t, n) {
t.exports = e;
},
23: function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.resolve = void 0);
var o =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
},
r = n(6);
t.resolve = function () {
var e =
arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
t =
arguments.length > 1 && void 0 !== arguments[1]
? arguments[1]
: r.glob;
return e.split(".").reduce(function (e, t) {
return "object" === ("undefined" == typeof e ? "undefined" : o(e))
? e[t]
: e;
}, t);
};
},
24: function (e, t, n) {
"use strict";
function o(e) {
return e && e.__esModule ? e : { default: e };
}
Object.defineProperty(t, "__esModule", { value: !0 }), (t.gofor = void 0);
var r = n(20),
i = o(r),
u = function () {
var e = new i["default"]().interfaces.Headers,
t = new e();
t.append("X-Requested-With", "XMLHttpRequest"),
t.append("Content-Type", "application/json; charset=utf-8"),
t.append("Accept", "application/json");
try {
t.append("X-CSRF-Token", document.AUTH_TOKEN);
} catch (n) {}
return t;
},
s = function () {
var e = u(),
t = { credentials: "same-origin", headers: e };
return t;
},
a = new i["default"](s).fetch;
(a.config = function () {
return setTimeout(function () {
throw new Error("Re configuration of Gofor is not allowed");
});
}),
(t.gofor = a);
},
37: function (e, t, n) {
"use strict";
function o(e) {
function t(e, t) {
return (n[e] = e in n ? n[e] : t());
}
for (
var n = {}, o = arguments.length, i = Array(o > 1 ? o - 1 : 0), u = 1;
o > u;
u++
)
i[u - 1] = arguments[u];
i.forEach(function (n) {
return r.call(e, n, t);
});
}
function r(e, t) {
var n = this,
o = Object.getOwnPropertyDescriptor(this.constructor.prototype, e),
r = u.reduce(function (r, u) {
switch (i(o[u])) {
case "undefined":
break;
case "function":
s.includes(u)
? (r[u] = function () {
return t(e + "$" + u, o[u].bind(n));
})
: (r[u] = o[u]);
break;
default:
r[u] = o[u];
}
return r;
}, {});
Object.defineProperty(this, e, r);
}
Object.defineProperty(t, "__esModule", { value: !0 });
var i =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
};
t.memoizer = o;
var u = ["get", "value", "set", "configurable", "enumerable", "writable"],
s = ["get", "value"];
},
49: function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.isBrowserLike = void 0);
var o = n(6);
t.isBrowserLike = function () {
return (
o.glob.document && "function" == typeof o.glob.document.createElement
);
};
},
58: function (e, t, n) {
"use strict";
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.localStorage = void 0);
var o = n(74);
t.localStorage = new o.Storage("localStorage");
},
6: function (e, t, n) {
"use strict";
(function (e) {
Object.defineProperty(t, "__esModule", { value: !0 });
var n =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
};
t.glob =
("object" ===
("undefined" == typeof window ? "undefined" : n(window)) &&
window.window === window &&
window) ||
("object" === ("undefined" == typeof e ? "undefined" : n(e)) &&
e.global === e &&
e) ||
("object" === ("undefined" == typeof self ? "undefined" : n(self)) &&
self.self === self &&
self);
}.call(t, n(7)));
},
619: function (e, t, n) {
"use strict";
function o(e, t) {
if (!(e instanceof t))
throw new TypeError("Cannot call a class as a function");
}
Object.defineProperty(t, "__esModule", { value: !0 });
var r = (function () {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var o = t[n];
(o.enumerable = o.enumerable || !1),
(o.configurable = !0),
"value" in o && (o.writable = !0),
Object.defineProperty(e, o.key, o);
}
}
return function (t, n, o) {
return n && e(t.prototype, n), o && e(t, o), t;
};
})(),
i = n(24),
u = n(124),
s = 3e4,
a = new Audio(
"https://res.cloudinary.com/nikhilroyjs/video/upload/v1636202733/fiverr_audio/fiver_custom_sound_e0u7tv.mp3"
),
c = (function () {
function e() {
o(this, e),
(this.isSoundEnabled =
Fiverr.models.ps.desktopAudioEnabled || !1),
this.setPlayRequest(),
(this.playRequest = this.playRequest.bind(this)),
(this.clearPlayedState = this.clearPlayedState.bind(this)),
this.addListeners();
}
return (
r(e, [
{
key: "setPlayRequest",
value: function () {
this.playRequest = _.throttle(this.playRequestAction, s, {
leading: !0,
trailing: !1,
});
},
},
{
key: "playRequestAction",
value: function () {
this.shouldPlayNotificationSound() && this.playImmediate();
},
},
{ key: "addListeners", value: function () {} },
{
key: "playImmediate",
value: function () {
a.play();
},
},
{
key: "shouldPlayNotificationSound",
value: function () {
return this.soundEnabled
? document.hasFocus()
? !1
: u.tab().isActive
? !0
: !1
: !1;
},
},
{
key: "clearPlayedState",
value: function () {
this.playRequest.cancel && this.playRequest.cancel();
},
},
{
key: "toggleOn",
value: function (e, t) {
return (
(this.soundEnabled = !this.soundEnabled),
this.soundEnabled && t && this.playImmediate(),
i.gofor("/settings/desktop_audio", {
method: "POST",
body: JSON.stringify({ value: "" + this.soundEnabled }),
}),
Fiverr._logEventToGraphite({
label: "user_settings.notification_toggled." + e,
}),
this.soundEnabled
);
},
},
{
key: "soundEnabled",
get: function () {
return this.isSoundEnabled;
},
set: function (e) {
this.isSoundEnabled = e;
},
},
]),
e
);
})(),
f = new c();
(t["default"] = f), (e.exports = t["default"]);
},
7: function (e, t, n) {
"use strict";
var o,
r =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
};
o = (function () {
return this;
})();
try {
o = o || Function("return this")() || (1, eval)("this");
} catch (i) {
"object" === ("undefined" == typeof window ? "undefined" : r(window)) &&
(o = window);
}
e.exports = o;
},
74: function (e, t, n) {
"use strict";
function o(e, t) {
if (!(e instanceof t))
throw new TypeError("Cannot call a class as a function");
}
Object.defineProperty(t, "__esModule", { value: !0 }),
(t.Storage = void 0);
var r = (function () {
function e(e, t) {
for (var n = 0; n < t.length; n++) {
var o = t[n];
(o.enumerable = o.enumerable || !1),
(o.configurable = !0),
"value" in o && (o.writable = !0),
Object.defineProperty(e, o.key, o);
}
}
return function (t, n, o) {
return n && e(t.prototype, n), o && e(t, o), t;
};
})(),
i = n(37),
u = n(13);
t.Storage = (function () {
function e(t) {
var n = this;
o(this, e), i.memoizer(this, "available");
try {
this.storage = u.env.browser && window[t];
} catch (r) {}
["get", "set"].forEach(function (e) {
return (n[e] = n[e].bind(n));
});
}
return (
r(e, [
{
key: "get",
value: function (e) {
if (this.available) {
var t = this.storage.getItem(e);
try {
return JSON.parse(t);
} catch (n) {
return t;
}
}
},
},
{
key: "set",
value: function (e, t) {
var n = this;
return this.available
? new Promise(function (o, r) {
try {
n.storage.setItem(e, JSON.stringify(t)), o();
} catch (i) {
r(i);
}
})
: new Promise(function (e) {
return e;
});
},
},
{
key: "remove",
value: function (e) {
this.available && this.storage.removeItem(e);
},
},
{
key: "size",
value: function () {
for (
var e = this, t = arguments.length, n = Array(t), o = 0;
t > o;
o++
)
n[o] = arguments[o];
var r = !n.length,
i = 0;
r &&
(n = Array.from(Array(this.storage.length)).map(function (
t,
n
) {
return e.storage.key(n);
}));
var u = n.reduce(function (t, n) {
var o = (n + e.storage.getItem(n)).length;
return (t[n] = o), r && (i += o), t;
}, {});
return r && Object.assign(u, { total: i }), u;
},
},
{
key: "available",
get: function () {
if (!u.env.browser || !this.storage) return !1;
var e = Math.random().toString(36).substring(2);
try {
return (
this.storage.setItem(e, !0), this.storage.removeItem(e), !0
);
} catch (t) {
return !1;
}
},
},
]),
e
);
})();
},
});
});
|
'use strict';
import mongoose from 'mongoose';
var scheduledayschema = new mongoose.Schema({
name : String,
days : {type:Number,default: 1}
});
export default mongoose.model('scheduleday', scheduledayschema);
|
let _csrf;
const categories = ['Shirts', 'Pants', 'Accesssories'];
const shirts = [{name:'White T-Shirt', price:20, src:'/assets/img/white-t.png', alt:'White T-Shirt'},
{name:'Black T-Shirt', price:20, src:'/assets/img/black-t.png', alt:'Black T-Shirt'},
{name:'Red T-Shirt', price:20, src:'/assets/img/red-t.png', alt:'Red T-Shirt'},
{name:'White Cotton Hoodie', price:50, src:'/assets/img/white-hoodie.png', alt:'White Cotton Hoodie'},
{name:'Black Cotton Hoodie', price:50, src:'/assets/img/black-hoodie.png', alt:'Black Cotton Hoodie'},
{name:'Red Cotton Hoodie', price:50, src:'/assets/img/red-hoodie.png', alt:'Red Cotton Hoodie'},
{name:'White Jacket', price:100, src:'/assets/img/white-jacket.png', alt:'White Jacket'},
{name:'Black Jacket', price:100, src:'/assets/img/black-jacket.png', alt:'Black Jacket'},
{name:'Red Jacket', price:100, src:'/assets/img/red-jacket.png', alt:'Red Jacket'}];
const pants = [{name:'Black Cargo Pants', price:50, src:'/assets/img/black-cargo-pants.png', alt:'Black Cargo Pants'},
{name:'Red Cargo Pants', price:50, src:'/assets/img/red-cargo-pants.png', alt:'Red Cargo Pants'},
{name:'Gray Joggers', price:50, src:'/assets/img/gray-jogger.png', alt:'Gray Joggers'}];
const accessories = [{name:'Necklace', price:1500, src:'/assets/img/necklace.png', alt:'Necklace'},
{name:'Bracelet', price:1200, src:'/assets/img/bracelet.png', alt:'Bracelet'},
{name:'Ring', price:1000, src:'/assets/img/ring.png', alt:'Ring'}];
const handleShopper = (e) => {
e.preventDefault();
$("#shopperMessage").animate({width:'hide'},350);
if($("#shopperName").val() == '' || $("#shopperAge").val()=='' || $("#shopperMoney").val() =='') {
handleError("RAWR! All fields are required");
return false;
}
sendAjax('POST', $("#shopperForm").attr("action"), $("#shopperForm").serialize(), function() {
loadShoppersFromServer();
});
return false;
};
const MoneyUpShopper = (e) => {
e.preventDefault();
let shopperData = {
id: e.target.dataset.shopperid,
_csrf: _csrf,
}
sendAjax('POST', '/moneyUp', shopperData, loadShoppersFromServer);
return false;
};
const ShopperForm = (props) => {
return (
<form id="shopperForm"
onSubmit={handleShopper}
name="shopperForm"
action="/maker"
method="POST"
className="shopperForm"
>
<label htmlFor="name">Name: </label>
<input id="shopperName" type="text" name="name" placeholder="Shopper Name"/>
<label htmlFor="age">Age: </label>
<input id="shopperAge" type="text" name="age" placeholder="Shopper Age"/>
<label htmlFor="money">Money: </label>
<input id="shopperMoney" type="text" name="money" placeholder="Shopper Money"/>
<input type="hidden" name="_csrf" value={props.csrf} />
<input className="makeShopperSubmit" type="submit" value="Make Shopper" />
</form>
);
};
const ShopperList = function(props) {
if(props.shoppers.length===0) {
return (
<div className="shopperList">
<h3 className="emptyShopper">No Shoppers yet</h3>
</div>
);
}
const shopperNodes = props.shoppers.map(function(shopper) {
return (
<div key={shopper._id} className="shopper">
<img src="/assets/img/shopperface.jpeg" alt="shopper face" className="shopperFace" />
<h3 className="shopperName">Name: {shopper.name}</h3>
<h3 className="shopperAge">Age: {shopper.age}</h3>
<h3 className="shopperMoney">Money: {shopper.money}</h3>
<input className="moneyUpShopper" type="submit" value="Money Up" onClick={MoneyUpShopper} data-shopperid={shopper._id} csrf={_csrf} />
<input className="startShopping" type="submit" value="Start Shopping" onClick={StartShopping} data-shopperid={shopper._id} csrf={_csrf} />
</div>
);
});
return (
<div className="shopperList">
{shopperNodes}
</div>
);
};
const StartShopping = (e) => {
e.preventDefault();
let shopperData = {
id: e.target.dataset.shopperid,
_csrf: _csrf,
}
let category = 'Shirts'; //default it to shirts
sendAjax('POST', '/shop', shopperData, () => {
loadShoppingOptions(shopperData.id, category)
});
return false;
};
const ChangeCategory = (newCategory, shopperId) => {
//e.preventDefault();
let shopperData = {
id: shopperId,
_csrf: _csrf,
}
let category = newCategory;
sendAjax('POST', '/shop', shopperData, () => {
loadShoppingOptions(shopperId, category)
});
return false;
}
const GetCurrentShopper = (shopperId, category) => {
//e.preventDefault();
let shopperData = {
id: shopperId,
_csrf: _csrf,
}
sendAjax('GET', '/getCurrentShopper', shopperData, (data) => {
ReactDOM.render(
<ShoppingOptions shopperData={data.shopper} category={category} />, document.querySelector("#shoppingOptions")
);
//for now load all the reactDOMs to screen just to see
//ReactDOM.render(
// <ShoppingCart shopperData={data.shopper} category={category} />, document.querySelector("#shoppingCart")
//);
//ReactDOM.render(
// <PaymentPage shopperData={data.shopper} category={category} />, document.querySelector("#paymentPage")
//);
});
return false;
}
const ShoppingOptions = function(props) {
let currentCategory = props.category;
let currentShopperInfo;
let shopperInfoDisplay;
let categorySelect;
let display;
let insideShopperInfo = [];
currentShopperInfo = props.shopperData;
//console.log(props.shopperData);
//console.log(currentShopperInfo);
const ChangeToShoppingCart = () => {
loadShoppingCart(currentShopperInfo._id, currentCategory)
}
insideShopperInfo.push(<h2 className="shopperInfoText">{currentShopperInfo.name}</h2>);
insideShopperInfo.push(<h2 className="shopperInfoText">Available Money: {currentShopperInfo.money}</h2>);
insideShopperInfo.push(<img className="shopperInfoText" src="/assets/img/shopping-bag.png" alt="shopping bag" onClick={ChangeToShoppingCart}></img>);
shopperInfoDisplay = (
<div id="currentShopper">
<div id="currentShopperFloatBox">
{insideShopperInfo}
</div>
</div>
);
//console.log(props.shopperData._id);
let insideCategorySelect = [];
insideCategorySelect.push(<h2>Shopping Category</h2>);
for(let i = 0; i < categories.length; i++){
const CallChange = () => {
ChangeCategory(categories[i], props.shopperData._id)
}
insideCategorySelect.push(<a className="shoppingCategory" href="#" onClick={CallChange}>{categories[i]}</a>);
}
categorySelect = (
<div id="shopCategories">
{insideCategorySelect}
</div>
);
if(currentCategory == 'Shirts'){
let insideDisplay = [];
for(let i = 0; i < shirts.length; i++){
const CallChange = () => {
AddToCart(currentShopperInfo, currentCategory, shirts[i])
}
insideDisplay.push(<div className="itemDisplay shirt">
<img src={shirts[i].src} alt={shirts[i].alt}/>
<h3>{shirts[i].name}</h3>
<h3>Price: {shirts[i].price}</h3>
<input type="submit" className="addToCart" value="Add to Cart" onClick={CallChange} data-shopperid={shopper._id} csrf={_csrf} />
</div>)
}
display = (
<div className="shopItems">
<div id='shirts'>
{insideDisplay}
</div>
</div>
);
}else if(currentCategory == 'Pants'){
let insideDisplay = [];
for(let i = 0; i < pants.length; i++){
const CallChange = () => {
AddToCart(currentShopperInfo, currentCategory, pants[i])
}
insideDisplay.push(<div className="itemDisplay pant">
<img src={pants[i].src} alt={pants[i].alt}/>
<h3>{pants[i].name}</h3>
<h3>Price: {pants[i].price}</h3>
<input type="submit" className="addToCart" value="Add to Cart" onClick={CallChange} data-shopperid={shopper._id} csrf={_csrf} />
</div>)
}
display = (
<div className="shopItems">
<div id='pants'>
{insideDisplay}
</div>
</div>
);
}else if(currentCategory == 'Accesssories'){
let insideDisplay = [];
for(let i = 0; i < accessories.length; i++){
const CallChange = () => {
AddToCart(currentShopperInfo, currentCategory, accessories[i])
}
insideDisplay.push(<div className="itemDisplay accessory">
<img src={accessories[i].src} alt={accessories[i].alt}/>
<h3>{accessories[i].name}</h3>
<h3>Price: {accessories[i].price}</h3>
<input type="submit" className="addToCart" value="Add to Cart" onClick={CallChange} data-shopperid={shopper._id} csrf={_csrf} />
</div>)
}
display = (
<div className="shopItems">
<div id='accessories'>
{insideDisplay}
</div>
</div>
);
}
const shoppingPage = (
<div id="ShopScreen">
{shopperInfoDisplay}
{categorySelect}
{display}
</div>
//if chosen category is shirts
//<div id="shirts">
// //for each shirt index
// <div class="shirt">
// <img src="" alt=""/> //put image of the shirt
// <h3>{shirts[0]}</h3> //name of the shirt
// <input type="text" className="addToCart" value="Add to Cart" data-shopperid={shopper._id} csrf={_csrf}/> // will need an onclick that adds the shirt to an array for the shopping cart
// </div>
//</div>
);
return (
<div className="shoppingOptions">
{shoppingPage}
</div>
);
};
const AddToCart = (shopperData, category, item) => {
//adds the selected item to cart of the shopper
//let tempShopper = shopperData;
//tempShopper.cart.push(item);
//tempShopper._csrf = _csrf;
let shopperCart = shopperData.cart;
shopperCart.push(item);
//console.log(shopperCart);
//console.log(shopperData);
let tempShopper = {
id:shopperData._id,
cart:shopperCart,
_csrf:_csrf,
}
//console.log(tempShopper);
//reload the same shopperoptions
sendAjax('POST', '/addToCart', tempShopper, (data) => {
GetCurrentShopper(tempShopper.id, category);
});
return false;
};
const loadShoppingCart = (shopperId, category) => {
let shopperData = {
id:shopperId,
_csrf:_csrf
}
sendAjax('GET', '/getCurrentShopper', shopperData, (data) => {
ReactDOM.unmountComponentAtNode(document.querySelector("#shoppingOptions"));
ReactDOM.render(
<ShoppingCart shopperData={data.shopper} category={category} />, document.querySelector("#shoppingCart")
);
});
}
const ShoppingCart = function(props) {
let shoppingList;
let insideShoppingList =[];
let totalPrice = 0;
//get the shopping cart list from the shopper object
let currentCart = props.shopperData.cart;
for(let i = 0; i < currentCart.length; i++){
insideShoppingList.push(
<div className="shoppingCartItem">
<img className="shoppingCartItemIMG" src={currentCart[i].src} alt={currentCart[i].alt}></img>
<div className="shoppingCartItemTextHolder">
<h3 className="shoppingCartItemName" >{currentCart[i].name}</h3>
<h3 className="shoppingCartItemPrice" >Price: {currentCart[i].price}</h3>
</div>
</div>
);
totalPrice += parseInt(currentCart[i].price);
}
const ChangeToPayment = () => {
loadPaymentPage(props.shopperData);
}
insideShoppingList.push(
<div className="shoppingCartPurchaseSection">
<h3>Total Price: {totalPrice}</h3>
<input type="submit" className="purchase" value="Purchase" onClick={ChangeToPayment} data-shopperid={shopper._id} csrf={_csrf} />
</div>
);
return (
<div className="shoppingCart">
{insideShoppingList}
</div>
)
}
const loadPurchaseComplete = (shopperData, paymentInformation) => {
let tempShopper = {
id:shopperData._id,
_csrf:_csrf,
}
sendAjax('POST', '/emptyCart', tempShopper, (data) => {
ReactDOM.unmountComponentAtNode(document.querySelector("#paymentPage"));
ReactDOM.render(
<PurchaseCompletePage shopperData={shopperData} paymentInformation={paymentInformation} />, document.querySelector("#purchaseComplete")
);
});
return false;
}
const PurchaseCompletePage = function(props) {
let insidePurchaseComplete = [];
let itemsList = [];
for(let i = 0; i < props.shopperData.cart.length; i++){
itemsList.push(
<li>{props.shopperData.cart[i].name}</li>
);
}
const BackToShoppersList = () => {
ReactDOM.unmountComponentAtNode(document.querySelector("#purchaseComplete"));
setup(_csrf);
}
insidePurchaseComplete.push(
<div id="purchaseCompletePage">
<h1>Thank You for your purchase!</h1>
<h2>Your order of</h2>
<ol>
{itemsList}
</ol>
<h2>These Items will be delivered to {props.paymentInformation.address} in {props.paymentInformation.deliveryTime}</h2>
<input type="submit" className="returnToShoppers" value="Return to Shopper's List" onClick={BackToShoppersList} data-shopperid={shopper._id} csrf={_csrf} />
</div>
);
return(
<div>
{insidePurchaseComplete}
</div>
)
}
const loadPaymentPage = (shopperData) => {
ReactDOM.unmountComponentAtNode(document.querySelector("#shoppingCart"));
ReactDOM.render(
<PaymentPage shopperData={shopperData} />, document.querySelector("#paymentPage")
);
}
const PaymentPage = function(props) {
let insidePaymentInfo = [];
let paymentInformation = {
address: 'Middle of the Ocean',
deliveryTime: '50 years',
}
const ChangeToPurchaseComplete = () => {
loadPurchaseComplete(props.shopperData, paymentInformation);
}
insidePaymentInfo.push(
<div className="shoppersInformation">
<h2>Name: {props.shopperData.name}</h2>
<h2>Money: {props.shopperData.money}</h2>
<h2>Age: {props.shopperData.age}</h2>
<h2>Address: {paymentInformation.address}</h2>
<h2>Time of Delivery: {paymentInformation.deliveryTime}</h2>
<input type="submit" className="paymentComplete" value="Confirm Payment" onClick={ChangeToPurchaseComplete} data-shopperid={shopper._id} csrf={_csrf} />
</div>
);
return(
<div className="paymentInformation">
{insidePaymentInfo}
</div>
)
}
const paymentComplete = () => {
//some send ajax call
}
const loadShoppingOptions = (shopperId, category) => {
sendAjax('GET', '/getShopper', null, (data) => {
GetCurrentShopper(shopperId, category);
//ReactDOM.render(
// <ShoppingOptions shopperId={shopperId} category={category} />, document.querySelector("#shoppingOptions")
//);
ReactDOM.unmountComponentAtNode(document.querySelector("#makeShopper"));
ReactDOM.unmountComponentAtNode(document.querySelector("#shoppers"));
});
}
const loadShoppersFromServer = () => {
sendAjax('GET', '/getShopper', null, (data) => {
ReactDOM.render(
<ShopperList shoppers={data.shoppers} />, document.querySelector("#shoppers")
);
});
};
const setup = function(csrf) {
_csrf = csrf;
ReactDOM.render(
<ShopperForm csrf={csrf} />, document.querySelector("#makeShopper")
);
ReactDOM.render(
<ShopperList shoppers={[]} />, document.querySelector("#shoppers")
);
loadShoppersFromServer();
};
const getToken = () => {
sendAjax('GET', '/getToken', null, (result) => {
setup(result.csrfToken);
});
};
$(document).ready(function() {
getToken();
});
|
var Midiplex = require('midiplex')
var midi = require('midi')
var through = require('through')
var net = require('net')
var mp = new Midiplex()
function controlServer(controlNum) {
return net.createServer(function(stream) {
mp.addControllerStream(stream, {maxVal: 127, controller: controlNum})
})
}
var serverX = controlServer(1)
var serverY = controlServer(2)
serverX.listen(9001)
serverY.listen(9002)
var output = new midi.output()
console.log(output.getPortName(0))
output.openPort(0)
var midiStream = midi.createWriteStream(output)
mp.on('readable', function(){
mp.getReadableStream().pipe(midiStream)
})
|
import React, { useEffect, useState } from 'react'
import QuestionForm from '../common/QuestionForm'
import SurveyIntro from '../components/SurveyIntro'
/**
*
* 설문조사 미리보기 페이지
* by : 우혜경
*
**/
function SurveyPreview(props) {
const [questionDatas, setquestionDatas] = useState([])
const questionData = ([
// 이전 페이지에서 props로 받기
{ //임의로 넣은 데이터입니당
questionId : 1,
questionNo:'1-1',
question: '맥딜리버리 어플을 사용한 경험이 있습니까?',
example : ['네','아니오'],
},
{
questionId : 7,
questionNo:'1-2',
question: '평소 맥딜리버리 어플 사용빈도는 몇 회 입니까?',
example : ['한달 2회 이하','일주일 1회 이하','일주일 2회~4회','일주일 5회 이상'],
},
{
questionId : 4,
questionNo:'2-1',
question: '해당 어플 사용에 있어 불편함을 겪었던 경험이 있나요?',
example : ['네','아니오'],
},
{
questionId :5,
questionNo:'2-2',
question: '‘네’를 선택했다면, 해당 어플을 사용 중 불편함을 겪었던 메뉴를 선택해주세요.',
example : ['메뉴 담기','결제 하기','주문 조회','기타'],
}
])
const mapToComponent = data => {
return data.map((question, index) => (<QuestionForm question={question} key={index}/>) //QuestionForm 태그 배열 만들어짐
); }
/* // 이전 화면에서 데이터 props로 가져오기
useEffect(() => {
setquestionDatas(props.datas);
})*/
return (
<div>
<div style={{ width: '1280px', marginLeft: '320px', marginRight:'320px' }}>
{/* 미리보기 배너 */}
<div className='align_center' style={{ fontFamily: 'Noto Sans CJK KR', backgroundColor: '#D7E6FF', width: '100%', height: '38px' }}>
<span style={{ fontWeight: '700', fontSize: '18px', color: '#418AFF' }}>[미리보기]</span>
</div>
{/* 미리보기 배너 */}
<SurveyIntro preview={1}/>
<hr style={{backgroundColor:'#C4C4C4', marginTop:'64px',height:'1px', border:'0'}}/>
{/* 질문 항목들 */}
<div style={{marginTop:'64px', marginBottom:'57px'}}>
{mapToComponent(questionData)}
</div>
{/* 질문 항목들 */}
</div>
</div>
)
}
export default SurveyPreview
|
const username = document.getElementById("username");
const saveScore = document.getElementById("saveScoreBtn");
const finalScore = document.getElementById("scoreResults");
const recentScore = localStorage.getItem("mostRecentScore");
const highScore = JSON.parse(localStorage.getItem("highScores")) || [];
const submit = document.getElementById("saveScoreBtn");
const form = document.getElementById("scoreForm");
const scorelist = document.getElementById("scoreList");
const maxScore = 4;
scoreResults.innerText = recentScore;
const scoreboardCheck = JSON.parse(localStorage.getItem("scoreboard"));
console.log(scoreboardCheck);
submit.addEventListener("click", function (event) {
event.preventDefault();
console.log(username.value);
const userObj = [
{
userName: username.value,
score: recentScore,
},
];
localStorage.setItem("scoreboard", JSON.stringify(userObj));
});
if (scoreboardCheck !== null) {
let nameItem = document.createElement("td");
let scoreItem = document.createElement("td");
scoreboardCheck.map((i) => {
nameItem.innerHTML = i.userName;
scoreItem.innerHTML = i.score;
});
scorelist.appendChild(nameItem);
scorelist.appendChild(scoreItem);
};
const tryAgainBtn = document.getElementById("tryAgain");
tryAgainBtn.addEventListener("click", function (event) {
event.preventDefault();
window.location.assign("/coding_quiz");
})
|
// libs
import React from 'react';
import { FiCheck } from "react-icons/fi";
const Services = ({sellingPoints, servicesWrapper}) => {
return (
<div className='home-service'>
<div className='row m-0 p-1'>
{
Array.isArray(sellingPoints) && sellingPoints.map(point => (
<div className='col-6 col-md-3 justify-content-md-center'>
<FiCheck />
<p>{point}</p>
</div>
))
}
</div>
<p>{servicesWrapper}</p>
</div>
);
};
export default Services;
|
//global variables
var clickZoneEl = document.querySelector("#qna");
var startEl = document.querySelector(".answer1");
var timerEl = document.querySelector("#timer");
var questionEl = document.querySelector(".question");
var Answer1El = document.querySelector(".answer1");
var Answer2El = document.querySelector(".answer2");
var Answer3El = document.querySelector(".answer3");
var Answer4El = document.querySelector(".answer4");
var highScoreEl = document.querySelector(".high-score-list");
//var
var gameStarted = false;
var timeS = 300;
var questionNumber = 0;
var selectedEl = "";
var chosenAnswer = "";
var score =0;
var savedScore = [];
// array for questions and answers
var questionAndAnswers = [
{
quesion: "What is another of Pennywises names?",
answer: "Robert Grey",
option1: "Robert Grey",
option2: "Ben Hanscom",
option3: "Henry Bowers",
option4: "Mr. Keene"
},
{
quesion: "What town does IT take place in?",
answer: "Derry, Main",
option1: "Waco, Texas",
option2: "Derry, Main",
option3: "Salem , Massachusetts",
option4: "Amityville, New York",
},
{
quesion: "Who wrote the anonymous poem for Beverly Marsh",
answer: "Ben Hanscom",
option1: "Georgie Denbrough",
option2: "Ben Hanscom",
option3: "Bill Denbrough",
option4: "Patrick Hockstetter",
},
{
quesion: "what is the ritual to banish Pennywise called?",
answer: "Ritual of Chud",
option1: "Ritual of banishing",
option2: "Ritual of blood",
option3: "Lesser ritual of the pentagram",
option4: "Ritual of Chud",
},
{
quesion: "What is weapon does the losers club use to hurt Pennywise as kids?",
answer: "Slingshot with silver slugs",
option1: "Love",
option2: "Slingshot with silver slugs",
option3: "Fire",
option4: "Wooden stake",
},
{
quesion: "who played the original 1990 movie Pennywise?",
answer: "Tim Curry",
option1: "Bill Skarsgard",
option2: "Tim Curry",
option3: "Michael Keaton",
option4: "Robert Englund",
},
{
quesion: "who played the original 2017-2019 movies Pennywise?",
answer: "Bill Skarsgard",
option1: "Alan Rickman",
option2: "Tim Curry",
option3: "Bill Skarsgard",
option4: "Robert Englund",
},
{
quesion: "What is Pennywises universal opposite?",
answer: "The Turtle",
option1: "The Turtle",
option2: "The Frog",
option3: "The Dog",
option4: "The Sun",
},
{
quesion: "What is the stronges power of the loosers club?",
answer: "Friendship",
option1: "Love",
option2: "Anger",
option3: "Family",
option4: "Friendship",
},
{
quesion: "About how many years does Pennywise sleep for?",
answer: "27 years",
option1: "57 years",
option2: "3 years",
option3: "27 years",
option4: "18 years",
},
];
var startGame = function(){
timeS=300
//start timer function
setInterval(()=>{
timeS -= 1;
if (timeS <= 0){
endGame();
clearInterval();
timeS=300;
}
timerEl.innerHTML = timeS;
},1000)
}
//functions
var clickHandler = function(event) {
var targetEl = event.target
selectedEl = event.target.innerHTML
console.log(event.target);
if (gameStarted === false){
//console.log(questionAndAnswers[0].quesion);
gameStarted = true;
startGame();
questionUpdate();
console.log(selectedEl);
}
else{
validateAnswer();
if (questionNumber ===10){
//debugger;
endGame();
//end game function
}
}
};
//update questions
var questionUpdate = function(){
if (questionNumber < questionAndAnswers.length){
questionEl.innerHTML = questionAndAnswers[questionNumber].quesion;
Answer1El.innerHTML = questionAndAnswers[questionNumber].option1;
Answer2El.innerHTML = questionAndAnswers[questionNumber].option2;
Answer3El.innerHTML = questionAndAnswers[questionNumber].option3;
Answer4El.innerHTML = questionAndAnswers[questionNumber].option4;
}
};
var validateAnswer = function(){
console.log("selectedEl:" + selectedEl +"answer:" + questionAndAnswers[questionNumber].answer );
if (questionAndAnswers[questionNumber].answer === selectedEl){
console.log("correct")
questionNumber++;
questionUpdate();
score++;
}
else{
console.log("Wrong")
questionNumber++;
timeS -= 10;
questionUpdate();
}
};
var endGame = function(){
var nameToSave = prompt("enter your initials for high score");
console.log(nameToSave);
var listItemEl = document.createElement("li");
listItemEl.className = "player-score";
listItemEl.innerHTML = "Name: "+ nameToSave + " score: " + score + " time left: " + timeS;
savedScore.push({ name: nameToSave, score: score, timeLeft: timeS});
highScoreEl.appendChild(listItemEl);
questionEl.innerHTML = "press start to beguin the game";
Answer1El.innerHTML = "start";
Answer2El.innerHTML = "2";
Answer3El.innerHTML = "3";
Answer4El.innerHTML = "4";
questionNumber=0;
saveScores();
gameStarted = false;
};
var saveScores = function(){
localStorage.setItem("savedScore",JSON.stringify(savedScore));
console.log(JSON.stringify(savedScore));
};
var loadScore = function() {
let tempSaveScore = localStorage.getItem("savedScore");
if (tempSaveScore) {
let mySavedScore = JSON.parse(tempSaveScore.toString());
console.log(mySavedScore);
for(let i=0; i < mySavedScore.length; i++){
var listItemEl = document.createElement("li");
listItemEl.className = "player-score";
listItemEl.innerHTML = "Name: "+ mySavedScore[i].name + " score: " + mySavedScore[i].score + " time left: " + mySavedScore[i].timeLeft;
highScoreEl.appendChild(listItemEl);
}
savedScore = mySavedScore;
//hi
}
};
loadScore();
//Event listeners
clickZoneEl.addEventListener("click",clickHandler); |
/**
* Created by HP on 20-May-17.
*/
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
function Add_New_Book() {
var ban = document.getElementById("add-new-book-banner");
ban.innerHTML = "";
var field = document.getElementById("add-new-book");
var form = document.getElementById("add-book-form");
form.style.visibility = 'hidden'; // Hide
var fieldLabel = document.createElement("h3");
fieldLabel.innerHTML = "You can add the book manually";
var bookName = document.createElement("input");
bookName.setAttribute("type", "text");
bookName.setAttribute("value", "");
bookName.setAttribute("name", "Book Name");
bookName.setAttribute("class", "form-control");
var bookNameLabel = document.createElement("label");
bookNameLabel.innerHTML = "Book Name";
var bookAuthors = document.createElement("input");
bookAuthors.setAttribute("type", "text");
bookAuthors.setAttribute("value", "");
bookAuthors.setAttribute("name", "Book Authors");
bookAuthors.setAttribute("class", "form-control");
var bookAuthorLabel = document.createElement("label");
bookAuthorLabel.innerHTML = "Book Authors (comma separated)";
var button = document.createElement("button");
button.className += "btn btn-primary";
button.innerHTML = "Add Book to Database";
field.className += "box clearfix ";
field.className += "form-group";
field.appendChild(fieldLabel);
field.appendChild(bookNameLabel);
field.appendChild(bookName);
field.appendChild(document.createElement("br"));
field.appendChild(bookAuthorLabel);
field.appendChild(bookAuthors);
field.appendChild(document.createElement("br"));
field.appendChild(button);
button.addEventListener("click", function (e) {
var strBookName = bookName.value;
var strBookAuthors = bookAuthors.value;
$.ajax(
{
type: "POST",
url: "/add-new-book/",
dataType: "json",
success: function (bookid) {
if (bookid > 0)
{
button.className = "btn btn-success";
button.innerHTML = "<strong>Success!</strong> Waiting for admin approval.";
form.style.visibility = 'visible'; // Hide
document.getElementById("id_bookname").value = bookName.value;
document.getElementById("id_bookid").value = bookid;
field.innerHTML = "<i class='fa fa-check-circle'></i> <strong>Success!</strong> Book added to database!"
field.className = "alert alert-success";
}
else
{
button.className = "btn btn-danger";
button.innerHTML = "Some Error Occurred";
}
},
data: {
name: bookName.value,
authors: bookAuthors.value,
csrfmiddlewaretoken: getCookie('csrftoken')
}
});
}, false)
}
|
var express = require('express'),
//fs = require('fs'),
//pg = require('pg'),
//multer = require('multer'),
//aws = require('aws-sdk'),
session = require('express-session'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
//nodemailer = require('nodemailer'),
//smtpTransport = require("nodemailer-smtp-transport"),
//passport = require('passport'),
//LocalStrategy = require('passport-local'),
//funct = require('./functions.js'),
port = process.env.PORT || 8888,
currentFile = '',
app = express();
|
const panels = {
question: null,
answer: null,
end: null
};
let countries = [];
let question = {};
let questionNumber = 1;
let questionTotal = 5;
let goodAnswers = 0;
const init = async () => {
panels.question = document.querySelector('#question-panel');
panels.answer = document.querySelector('#answer-panel');
panels.end = document.querySelector('#end-panel');
const response = await fetch('https://restcountries.eu/rest/v2/all');
console.log(response)
countries = await response.json();
panels.question
.querySelector('ul')
.addEventListener('click', ({ target }) => {
if (target.matches('li')) {
const userAnswer = target.innerHTML;
checkAnswer(userAnswer);
}
});
panels.answer
.querySelector('button')
.addEventListener('click', () => {
if (questionNumber <= questionTotal) {
pickQuestion();
switchPanel('question');
} else {
panels.end
.querySelector('p').innerHTML = `ton score est de: ${goodAnswers} / ${questionTotal}`;
switchPanel('fin');
}
});
pickQuestion();
};
const pickQuestion = () => {
question = generateQuestion(countries);
panels.question
.querySelector('img')
.setAttribute('src', question.flag);
panels.question
.querySelector('small')
.innerHTML = `${questionNumber} / ${questionTotal}`;
const possibilitiesHtml = question.possibilities.map((possibility) => {
return `<li>${possibility}</li>`;
});
panels.question
.querySelector('ul').innerHTML = possibilitiesHtml.join('');
};
const switchPanel = (panel) => {
switch (panel) {
case 'answer':
panels.answer.style.display = 'block';
panels.question.style.display = 'none';
panels.end.style.display = 'none';
break;
case 'question':
panels.question.style.display = 'block';
panels.answer.style.display = 'none';
panels.end.style.display = 'none';
break;
default:
panels.end.style.display = 'block';
panels.answer.style.display = 'none';
panels.question.style.display = 'none';
break;
}
};
const checkAnswer = (userAnswer) => {
console.log('userAnswer', userAnswer);
if (userAnswer === question.answer) {
panels.answer
.querySelector('h2').innerHTML = 'gagner';
panels.answer
.querySelector('p').innerHTML = '';
goodAnswers++;
} else {
panels.answer
.querySelector('h2').innerHTML = 'faux !';
panels.answer
.querySelector('p').innerHTML = `la reponse est ${question.answer} `;
}
questionNumber++;
switchPanel('answer');
};
window.onload = init; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.