text
stringlengths 7
3.69M
|
|---|
(function () {
'use strict';
angular.module('bookBrowserApp', [])
.service('bookService', function ($http) {
return {
getImages: function () {
return $http.get("/data/books.json", { responseType: 'json' });
}
}
})
.controller('bookListCtrl', function ($scope, bookService) {
$scope.txtTitle = 'Book List';
bookService.getImages().success(function (result) {
$scope.bookImages = result;
});
});
})();
|
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Field } from '.';
storiesOf('Field', module)
.add('Default', () => (
<Field id={'name'} label={'Your name'}/>
))
.add('As tag "textarea"', () => (
<Field id={'name'} label={'Your name'} tag={'textarea'}/>
))
.add('Invalid', () => (
<Field id={'name'} label={'Your name'} isInvalid/>
));
|
const jwt = require("jsonwebtoken");
const _ = require("lodash");
const jwt_decode = require("jwt-decode");
const createTokens = async (user, secret) => {
const createToken = jwt.sign(
{
user: _.pick(user, ["id", "username"]),
},
secret,
{
expiresIn: "7d",
}
);
return createToken;
};
const parseToken = (req) => {
const authHeader = req.headers.authorization;
const token = authHeader.split(" ")[1];
return jwt_decode(token);
};
module.exports = { createTokens, parseToken };
|
//LOADER
window.addEventListener("load", function () {
const loader = document.querySelector(".loader");
loader.className += " hidden"; // class "loader hidden"
console.log('pagina cargada!');
});
/* function toggleSidebar(){
document.getElementById('sidebar').classList.toggle('active');
document.getElementById('homea').classList.toggle('active');
document.getElementById('eventosa').classList.toggle('active');
document.getElementById('configa').classList.toggle('active');
document.getElementById('salira').classList.toggle('active');
} */
$('document').ready(function() {
$('#collapse-toggle').on('click', function(e) {
localStorage.setItem('menu-closed', !$('#sidebar').hasClass('collapsed'));
$('#sidebar').toggleClass('collapsed');
$('#homea').toggleClass('desactive');
$('#eventosa').toggleClass('desactive');
$('#configa').toggleClass('desactive');
$('#salira').toggleClass('desactive');
});
// Code responsible for reading the state of the menu out of localStorage
var state = localStorage.getItem('menu-closed');
// When localStorage is not set, open the menu.
if (state === null) {
$('#sidebar').removeClass('collapsed');
$('#homea').removeClass('desactive');
$('#eventosa').removeClass('desactive');
$('#configa').removeClass('desactive');
$('#salira').removeClass('desactive');
} else {
// When localStorage is set, Save the state to the variable closed
// Here set closed to a boolean true/false value instead of a string "true" or "false"
var closed = state === "true" ? true : false;
console.log(closed);
// When the state of the menu is not closed, remove the collapsed class from the sidebar.
if (!closed) {
$('#sidebar').removeClass('collapsed');
$('#homea').removeClass('desactive');
$('#eventosa').removeClass('desactive');
$('#configa').removeClass('desactive');
$('#salira').removeClass('desactive');
}
}
});
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("activate");
var content = this.nextElementSibling;
if (content.style.display === "flex") {
content.style.display = "none";
} else {
content.style.display = "flex";
}
});
}
var inputs = document.querySelectorAll( '.inputfile' );
Array.prototype.forEach.call( inputs, function( input )
{
var label = input.nextElementSibling,
labelVal = label.innerHTML;
input.addEventListener( 'change', function( e )
{
var fileName = '';
if( this.files && this.files.length > 1 )
fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
else
fileName = e.target.value.split( '\\' ).pop();
if( fileName )
label.querySelector( 'span' ).innerHTML = fileName;
else
label.innerHTML = labelVal;
});
});
$('#desdedate').dateDropper();
$('#hastadate').dateDropper();
//Input
//function validateEventJS(){
// var errores: 0;
// if(!$('#descev').val()){
// errores++
// }
// if(!$('#link').val()){
// errores++
// }
// if(!$('#address').val()){
// errores++
// }
// if(!$('#precio').val()){
// errores++
// }
// if(errores){
// event.preventDefault()
// console.log(errores);
// return false;
// }else{
// return true;
// }
//}
var eventoscardsall = $('#allevents')
// GET EVENTOS
eventosRestClient.exportListEvent()
.then(events => {
$.each(events, function(i) {
var arrayDt = [];
arrayDt[i] = {
"id" : this.id,
"name" : this.title,
"description" : this.description,
"link" : this.link,
"published" : this.published,
"promoted" : this.promoted,
"address" : this.address,
"startDate" : this.startDateTime,
"precio" : this.price,
"type" : this.type
};
console.log(arrayDt[i]);
eventoscardsall.append('<div class="cardsevents"> <div class="titulocard" id="tituloeventsc'+i+'"><h4>'+arrayDt[i].name+'</h4></div> <div class="imgcontentcard"> <div class="esqback"></div> <img class="imgcard" src="https://source.unsplash.com/random"></div> <div class="btncardbot"> <button id="bt_'+i+'" class="editbtn" ><i class="fas fa-pen"></i></button> <button id="pub_'+i+'" class="editbtn" ><i class="fas fa-check"></i></button> <button id="dlt_'+i+'" class="editbtn" ><i class="fas fa-trash"></i></button> <div></div> </div>')
if(arrayDt[i].published){
$('#tituloeventsc'+i).append("<span class='spanevent subido'><i class='fas fa-check-circle'></i></span>");
}else{
$('#tituloeventsc'+i).append("<span class='spanevent nosubido'><i class='fas fa-times'></i></span>");
}
//$("#show_test").append("<div><a id='bt_"+i+"'>click"+arrayDt[i].name+"</a></div>");
$("#bt_"+i).click(function(){
show_data(arrayDt[i]);
});
$("#dlt_"+i).click(function(){
delete_event(arrayDt[i]);
});
$("#pub_"+i).click(function(){
pub_event(arrayDt[i]);
});
});
tippy('.subido', {
content: "Este evento esta publicado!",
})
tippy('.nosubido', {
content: "Este evento aun NO esta publicado!",
})
/* events.forEach(function(event){
var titulo = event.title;
var ids = event.id;
eventoscardsall.append('<div class="cardsevents"> <div class="titulocard"><h4>'+titulo+'</h4></div> <div class="imgcontentcard"> <img class="imgcard" src="https://source.unsplash.com/random"></div> <div class="btncardbot"> <button id="editf" onclick="editarevento('+ids+')" class="editbtn" ><i class="fas fa-pen"></i></button> <button class="editbtn" ><i class="fas fa-check"></i></button> <button class="editbtn" ><i class="fas fa-trash"></i></button> <div></div> </div>')
console.log(titulo);
console.log(ids);
}) */
}).catch(function(err) {
console.log(err);
})
//ALERT Y APPEND DATA EN VALUES FORM
function show_data(data){
/* alert(JSON.stringify(data)); */
document.getElementById("evname").setAttribute('value', data.name);
$('#descev').val(data.description);
$('#link').val(data.link);
$('#address').val(data.address);
$('#precio').val(data.precio);
}
//PUBLICA EVENTO
function pub_event(data){
let eventodata = JSON.stringify(data);
swal({
title: "¿Deseas Publicar el evento " + data.name + "?",
text: eventodata,
icon: "info",
buttons: true,
closeOnClickOutside: false
})
.then((willDelete) => {
if (willDelete) {
swal("El evento fue publicado correctamente", {
icon: "success",
});
} else {
swal("El evento no fue publicado");
}
});
}
var errores = 0;
//POST EVENTOS
$( "#btnsubmitevent" ).click(function(e) {
e.preventDefault();
$('#loadingpost').show();
$('#loadpost').css( "flex-direction", "column-reverse" );
let titulo = $('#evname').val();
let descripcion = $('#descev').val();
let linked = $('#link').val();
let direccion = $('#address').val();
let precio = $('#precio').val();
if(!titulo){
errores++;
}
if(!descripcion){
errores++;
}
if(!linked){
errores++;
}
if(!direccion){
errores++;
}
if(!precio){
errores++;
}
if(errores == 0){
var eventonuevo =
{
"title": titulo,
"description": descripcion,
"published": true,
"price": precio,
"link": linked,
"type": "festival",
"contact": null,
"address": direccion,
"startDateTime" : 12232132
}
console.log(eventonuevo)
eventosRestClient.createEvent(eventonuevo)
.then(function (response) {
$('#loadingpost').hide();
swal({
text: "El evento fue subido correctamente, se actualizara la pagina!",
icon: "success"
})
.then(() => {
location.reload();
});
console.log(response.statusText);
})
.catch(function (error) {
console.log(error);
});
}else{
swal("Todos los campos deben estar completos")
.then(() => {
$('#loadingpost').hide();
$('#loadpost').css( "flex-direction", "row" );
errores = 0;
});
}
});
//DELETE EVENTOS
function delete_event(data){
console.log(data.id)
swal({
title: "Eliminar Evento",
text: "Deseas eliminar el evento " + data.name + " ?",
icon: "warning",
buttons: true,
dangerMode: true,
closeOnClickOutside: false,
})
.then((willDelete) => {
if (willDelete) {
swal("El evento fue eliminado correctamente!", {
icon: "success",
});
} else {
swal("Decidiste no eliminar el evento");
}
});
}
/*axios.get('https://sustentatemiddleware-generous-bonobo.mybluemix.net/events')
.then(function(res) {
if(res.status==200) {
res.data.forEach(function(eventos){
var titulo = eventos.title;
eventoscardsall.append('<div class="cardsevents"> <div class="titulocard"><h4>'+titulo+'</h4></div> <div class="imgcontentcard"> <img class="imgcard" src="https://source.unsplash.com/random"></div> <div class="btncardbot"> <button class="editbtn" ><i class="fas fa-pen"></i></button> <button class="editbtn" ><i class="fas fa-check"></i></button> <button class="editbtn" ><i class="fas fa-trash"></i></button> <div></div> </div>')
console.log(titulo);
})
}
})
*/
|
export default{
deepClone (obj) {
let str = JSON.stringify(obj)
return JSON.parse(str)
}, /**
* 加法运算,避免数据相加小数点后产生多位数和计算精度损失。
*
* @param num1加数1 | num2加数2
*/
add (num1, num2) {
let baseNum, baseNum1, baseNum2
try {
baseNum1 = num1.toString().split('.')[1].length
} catch (e) {
baseNum1 = 0
}
try {
baseNum2 = num2.toString().split('.')[1].length
} catch (e) {
baseNum2 = 0
}
baseNum = Math.pow(10, Math.max(baseNum1, baseNum2))
return (num1 * baseNum + num2 * baseNum) / baseNum
},
/**
* 减法运算,避免数据相减小数点后产生多位数和计算精度损失。
*
* @param num1被减数 | num2减数
*/
sub (num1, num2) {
let baseNum, baseNum1, baseNum2
let precision
try {
baseNum1 = num1.toString().split('.')[1].length
} catch (e) {
baseNum1 = 0
}
try {
baseNum2 = num2.toString().split('.')[1].length
} catch (e) {
baseNum2 = 0
}
baseNum = Math.pow(10, Math.max(baseNum1, baseNum2))
precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2
return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision)
},
/**
* 乘法运算,避免数据相乘小数点后产生多位数和计算精度损失。
*
* @param num1被乘数 | num2乘数
*/
mul (num1, num2) {
let baseNum = 0
try {
baseNum += num1.toString().split('.')[1].length
} catch (e) {
}
try {
baseNum += num2.toString().split('.')[1].length
} catch (e) {
}
return Number(num1.toString().replace('.', '')) * Number(num2.toString().replace('.', '')) / Math.pow(10, baseNum)
},
/**
* 除法运算,避免数据相除小数点后产生多位数和计算精度损失。
*
* @param num1被除数 | num2除数
*/
div (num1, num2) {
let baseNum1 = 0
let baseNum2 = 0
let baseNum3
let baseNum4
try {
baseNum1 = num1.toString().split('.')[1].length
} catch (e) {
baseNum1 = 0
}
try {
baseNum2 = num2.toString().split('.')[1].length
} catch (e) {
baseNum2 = 0
}
baseNum3 = Number(num1.toString().replace('.', ''))
baseNum4 = Number(num2.toString().replace('.', ''))
return (baseNum3 / baseNum4) * Math.pow(10, baseNum2 - baseNum1)
}, // 打散数组
dimensionality (arr) {
for (var r = 0, result = []; r < arr.length; r++) {
result = result.concat(arr[r])
}
return result
},
HTMLDecode (text) {
var temp = document.createElement('div')
temp.innerHTML = text
var output = temp.innerText || temp.textContent
temp = null
return output
},
// 如果name有值返回key=参数的键值对的值 返回url上所有键值对的结果集
params (name) {
var rs = this.urlsearch()
if (rs != null) {
if (name) {
return rs[name]
}
}
return rs
},
urlsearch () {
var rs = null
var name, value
var str = location.href
var num = str.indexOf('?')
str = str.substr(num + 1)
var arr = str.split('&')
if (arr.length > 0) {
rs = {}
for (var i = 0; i < arr.length; i++) {
num = arr[i].indexOf('=')
if (num > 0) {
name = arr[i].substring(0, num)
value = arr[i].substr(num + 1)
rs[name] = decodeURI(value)
}
}
}
return rs
},
getMonth (e) {
e = e || 0
var date = new Date(new Date().getFullYear(), new Date().getMonth() + e)
var year = date.getFullYear()
var month = date.getMonth() + 1
month = (month < 10 ? '0' + month : month)
var mydate = (year.toString() + '-' + month.toString())
return mydate
},
getDateStr (date) {
var _year = date.getFullYear()
var _month = date.getMonth() + 1
var _d = date.getDate()
_month = (_month > 9) ? ('' + _month) : ('0' + _month)
_d = (_d > 9) ? ('' + _d) : ('0' + _d)
return _year + '-' + _month + '-' + _d
},
// 数组去重
distinct (arr) {
const seen = new Map()
return arr.filter((item) => !seen.has(item) && seen.set(item, 1))
},
isBlank (value) {
if (value !== null && value !== undefined && (value + '').length > 0) {
return false
} else {
return true
}
},
/* 切割数组 */
splitArray (arr, len) {
let aLen = arr.length
let result = []
for (let i = 0; i < aLen; i += len) {
result.push(arr.slice(i, i + len))
}
return result
},
// 过滤emoji表情
filteremoji (val) {
var ranges = [
'\ud83c[\udf00-\udfff]',
'\ud83d[\udc00-\ude4f]',
'\ud83d[\ude80-\udeff]'
]
var emojireg = val
emojireg = emojireg.replace(new RegExp(ranges.join('|'), 'g'), '')
return emojireg
},
checkMsg (msg) {
return {
'101 付款码无效,请重新扫码': '付款码无效,请重新扫码',
'AUTHCODEEXPIRE': '二维码已过期',
'PARAM_ERROR': '付款码错误',
'验证签名不通过': '付款码错误',
'商户未开通[pay.jdpay.micropay]支付类型': '商户未开通京东支付'
}[msg] || msg
}
}
|
;
(function() {
"use strict";
var _extends = Object.assign ||
function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var _typeof =
typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? function(obj) {
return typeof obj;
} :
function(obj) {
return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}
var getSettings = function(opts) {
var defaults = {
targetElement: '',
};
return _extends({}, defaults, opts);
};
var Calendar = function Calendar(settings) {
this._settings = getSettings(settings);
this._init();
}
// var inputValue;
Calendar.prototype = {
constructor: Calendar,
_init: function() {
var _this = this;
var settings = this._settings;
this.container = document.createElement('div');
this.container.onselect = function() {
return false;
};
this.container.className = this.container.className ? this.container.className += ' container' : 'container';
this.dateInput = document.createElement('input');
this.dateInput.setAttribute('type', 'text');
this.dateInput.className = this.dateInput.className ? this.dateInput.className += ' date-input' : 'date-input';
//this.dateInput.readOnly = true;
this.datePicker = document.createElement('div');
this.datePicker.className = this.datePicker.className ? this.datePicker.className += ' date-picker' : 'date-picker';
this.dateBar = document.createElement('div');
this.dateBar.className = this.dateBar.className ? this.dateBar.className += ' date-bar' : 'date-bar';
this.dateBox = document.createElement('div');
this.dateBox.className = this.dateBox.className ? this.dateBox.className += ' date-box' : 'date-box';
this.icon = document.createElement('i');
this.icon.className = this.icon.className ? this.icon.className += ' date-icon' : 'date-icon';
this.icon.innerHTML = '';
this.dateInput.addEventListener('click', function(e) {
e = window.event || e;
_this.showCalendar(e);
});
this.container.onblur = function() {
_this.datePicker.style.display = 'none';
}
// this.dateInput.addEventListener('onporpertychange', function(e) {
// inputValue = this.value;
// console.log('change');
// console.log('onporpertychange:', inputValue);
// })
document.onkeydown = function(e) {
var e = e || window.event;
var keyCode = e.charCode || e.keyCode;
if (keyCode === 13) {
_this.setInput();
}
}
this.datePicker.appendChild(this.dateBar);
this.datePicker.appendChild(this.dateBox);
this.container.appendChild(this.dateInput);
this.container.appendChild(this.icon);
this.container.appendChild(this.datePicker);
this._settings.targetElement.append(this.container);
},
toggleDateBar: function(ele) {
var _this = this;
var now = new Date();
ele.date = now;
var year = now.getFullYear(),
month = now.getMonth(),
day = now.getDate();
//var content = '<div class="year-input"><span>' + year + '年</span><i class="year-btn"></i><ul class="year-box" style="display:none;"></ul></div>';
var content = '<div class="year-input"><span>' + year + '年</span><i class="select-year-btn"></i><ul class="year-select-box" style="display : none">';
for (var i = 0; i < 150; i++) {
content += '<li>' + (i + 1900) + '年</li>';
}
content += '</ul></div>' +
'<div class="month-input"><i class="prev-month"></i><select class="months-options">'
for (var i = 0; i < 12; i++) {
content += '<option>' + (i + 1) + '月</option>';
}
content += '</select><i class="next-month"></i></div>' +
'<div class="day-input"><i class="prev-day"></i><select class="days-options"></select>' +
'<i class="next-day"></i></div>' +
'<button class="today-btn">今天</button>' +
'<div class="days-title">';
var weekday = ['日', '一', '二', '三', '四', '五', '六'];
for (var i = 0; i < 7; i++) {
content += '<span class="day-title">' + weekday[i] + '</span>';
}
content += '</div>';
ele.innerHTML = content;
this.changeDateBar(now);
// console.log('this.dateInput.value2:', this.dateInput.value);
// console.log('inputValue2:', inputValue);
var yearInput = ele.firstChild;
yearInput.addEventListener('click', function() {
var ul = this.lastChild;
ul.style.display === 'none' || ul.style.display === 'none' ? ul.style.display = 'inline-block' : ul.style.display = 'none';
});
var yearBox = yearInput.lastChild;
var yearLi = yearBox.children;
for (var i = 0, len = yearLi.length; i < len; i++) {
yearLi[i].onclick = function() {
_this.dateBar.date.setFullYear(this.innerText.slice(0, -1));
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
};
}
var monthInput = yearInput.nextSibling;
monthInput.firstChild.onclick = function() {
var monthOptions = this.nextSibling;
if (monthOptions.selectedIndex > 0) {
_this.dateBar.date.setMonth(--monthOptions.selectedIndex);
} else {
monthOptions.selectedIndex = 11;
_this.dateBar.date.setFullYear(_this.dateBar.date.getFullYear() - 1);
_this.dateBar.date.setMonth(11);
}
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
};
monthInput.lastChild.onclick = function() {
var monthOptions = this.previousSibling;
if (monthOptions.selectedIndex < 11) {
_this.dateBar.date.setMonth(++monthOptions.selectedIndex);
} else {
monthOptions.selectedIndex = 0;
_this.dateBar.date.setFullYear(_this.dateBar.date.getFullYear() + 1);
_this.dateBar.date.setMonth(0);
}
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
}
monthInput.children[1].onchange = function() {
_this.dateBar.date.setMonth(this.selectedIndex);
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
};
var dayInput = monthInput.nextSibling;
dayInput.firstChild.onclick = function() {
var dayOptions = this.nextSibling;
if (dayOptions.selectedIndex > 0) {
_this.dateBar.date.setDate(dayOptions.selectedIndex--);
} else {
_this.dateBar.date.setMonth(_this.dateBar.date.getMonth() - 1);
_this.dateBar.date.setDate(_this.getDayOfMonth(_this.dateBar.date));
}
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
};
dayInput.lastChild.onclick = function() {
var dayOptions = this.previousSibling;
if (dayOptions.selectedIndex < dayOptions.length - 1) {
dayOptions.selectedIndex++;
_this.dateBar.date.setDate(dayOptions.selectedIndex + 1);
} else {
_this.dateBar.date.setDate(1);
_this.dateBar.date.setMonth(_this.dateBar.date.getMonth() + 1);
}
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
};
dayInput.children[1].onchange = function() {
_this.dateBar.date.setDate(this.selectedIndex + 1);
_this.changeDateBar(_this.dateBar.date);
// _this.changeDate(inputValue);
};
var todayBtn = dayInput.nextSibling;
todayBtn.onclick = function() {
_this.drawPicker(new Date());
_this.changeDateBar(new Date());
// _this.changeDate(inputValue);
}
},
changeDateBar: function(date) {
var yearInput = this.dateBar.firstChild,
monthInput = yearInput.nextSibling,
dayInput = monthInput.nextSibling;
yearInput.firstChild.innerText = date.getFullYear() + '年';
var monthOptions = monthInput.firstChild.nextSibling;
monthOptions.selectedIndex = date.getMonth();
var dayOptions = dayInput.firstChild.nextSibling;
var days = this.getDaysOfMonth(date);
var dayContent = '';
for (var i = 1; i < days; i++) {
dayContent += '<option>' + i + '日</option>';
}
dayOptions.innerHTML = dayContent;
dayOptions.selectedIndex = date.getDate() - 1;
this.drawPicker(date);
// console.log(date)
},
getWeekByDay: function(val) {
var week = new Date(Date.parse(val.replace(/\-/g, "/")));
return week;
},
drawPicker: function(primalDate) {
var date = new Date(primalDate); //要新建一个对象,因为会改变date
var nowMonth = date.getMonth() + 1;
var nowDate = date.getDate();
var spanContainer = [];
var dateBox = this.dateBox;
dateBox.innerHTML = '';
var time = date.getTime();
var days = this.getDaysOfMonth(date); //计算出这个月的天数
date.setDate(1); //将date的日期设置为1号
var firstDay = date.getDay(); //知道这个月1号是星期几
for (var i = 0; i < firstDay; i++) { //如果1号不是周日(一周的开头),则在1号之前要补全
var tempDate = new Date(date);
tempDate.setDate(i - firstDay + 1);
var span = document.createElement("span");
span.className = "unshow";
spanContainer.push({ span: span, date: tempDate });
}
for (var i = 1; i <= days; i++) { //1号到这个月最后1天
var span = document.createElement("span");
span.className = 'show';
spanContainer.push({ span: span, date: new Date(date) });
date.setDate(i + 1);
}
for (var i = date.getDay(); i <= 6; i++) { //在这个月最后一天后面补全
var span = document.createElement("span");
span.className = "unshow";
spanContainer.push({ span: span, date: new Date(date) });
date.setDate(date.getDate() + 1);
}
for (var i = 0; i < spanContainer.length; i++) {
var spanBox = spanContainer[i];
var span = spanBox.span;
span.year = spanBox.date.getFullYear(); //为每个span元素添加表示时间的属性
span.month = spanBox.date.getMonth() + 1;
span.date = spanBox.date.getDate();
span.innerText = spanBox.date.getDate();
if (span.date === nowDate && span.month === nowMonth) //如果这个span的日期为与传入的日期匹配,设置类名为select
span.className += " select";
var _this = this;
span.onclick = function() { //设置点击事件
var target = event.target;
var selected = target.parentElement.getElementsByClassName("select");
for (var i = 0; i < selected.length; i++) {
selected[i].className = selected[i].className.replace(" select", "");
};
target.className += " select";
//console.log(spanBox.date); //这已经是闭包问题了
_this.changeDate(target.year, target.month, target.date); //陷阱 changeDate调用时spanContainer[i].date,i这个变量已经是出界了的
/*if(target.className.indexOf("unshow")!==-1){
parent.drawPicker(new Date(target.year, target.month-1, target.date)); //如果点击非本月的日期,则重绘日历表
}*/
_this.changeDateBar(new Date(target.year, target.month - 1, target.date));
};
dateBox.appendChild(span); //将span添加到dateBox中
}
//console.log(primalDate.toLocaleDateString()+'drawPicker');
this.changeDate(primalDate.getFullYear(), primalDate.getMonth() + 1, primalDate.getDate())
return;
},
getDaysOfMonth: function(primaryDate) {
var date = new Date(primaryDate),
month = date.getMonth(),
time = date.getTime(),
newTime = date.setMonth(month + 1);
return Math.ceil((newTime - time) / (24 * 60 * 60 * 1000));
},
showCalendar: function(e) {
var e = e || window.event;
var target = e.target || e.srcElement;
var value = target.value;
var datePicker = this.datePicker;
if (datePicker.style.display === 'none') {
datePicker.style.display = 'block';
} else {
datePicker.style.display = 'none';
return;
}
if (!value)
this.toggleDateBar(this.dateBar);
},
changeDate: function(year, month, date) {
this.dateInput.value = year + "-" + (month < 10 ? ("0" + month) : month) + "-" + (date < 10 ? ("0" + date) : date);
},
setInput: function() {
var value = this.dateInput.value;
var year = value.slice(0, 4),
month = value.slice(5, 7),
day = value.slice(9);
this.changeDateBar(new Date(year, month - 1, day));
}
};
window.Calendar = Calendar;
})();
|
var express = require('express');
var app = express();
require('./build.js').execute({
'strong': 'src/standard/strong',
'entity': 'src/core/entity',
'component': 'src/core/component'
}).then(
function (rjs) {
var strong = rjs('strong');
var entity = rjs('entity');
var component = rjs('component');
/*
var transform = component('transform', {
position: strong.array(strong.types.float32, 3),
rotation: strong.array(strong.types.float32, 4),
scale: strong.array(strong.types.float32, 3)
}, function () {
this.rotation[3] = 1.0;
this.scale[0] = 1.0;
this.scale[1] = 1.0;
this.scale[2] = 1.0;
});
*/
var e = new entity();
console.log(e.identifier);
app.use(express.static(__dirname));
app.listen(process.env.PORT, process.env.IP, null, function () {
console.log('Running \'fizz\' on port:', process.env.PORT);
});
},
function () {
},
function () {
});
|
import { PASSWORDRESETCONFIRM_ERROR_MESSAGE } from "../../../constants";
export const passwordResetConfirm = jest
.fn()
.mockImplementationOnce(() => Promise.resolve())
.mockImplementationOnce(() => Promise.resolve())
.mockImplementationOnce(() => {
throw new Error(PASSWORDRESETCONFIRM_ERROR_MESSAGE);
});
|
/*------------------VARIABLES GLOBALES-----------------------*/
var url_diario="elcomercio.pe";
var contenido_html=document.getElementById("feeddiv");//Aqui estaran las noticias
var salida_html="";//se escribira en formato html
var limite=5;//Numero de noticias a mostrar
//DATOS PARA VISUALIZAR LA NOTICIA
var find_linkrss=new Array(limite);
var find_link=new Array(limite);
var find_titulo=new Array(limite);
var find_content=new Array(limite);
/*----------------INICIALIZAMOS EVENTOS----------------------*/
$(document).ready(inicializarEventos);
function inicializarEventos(){
var x=$("#searchbtn");
x.click(buscar_feed);
}
/*-----------Ejecutamos los metodos de Google findFeed API-----------*/
function buscar_feed(){
var palabra_buscar=$("#searchtext").val();
var query="site:"+url_diario+" "+palabra_buscar;
google.feeds.findFeeds(query, mostrar_resultado);
}
//Mostramos el resutado en HTML
function mostrar_resultado(resultado){
if(!resultado.error){
var tam_resultado=resultado.entries.length;
salida_html="<h2><b>Resultados de la Busqueda:</b></h2><br />";
//Guardamos los resultados en algunas variables globales
//Llamamos algunas variables globales
for(var i=0;i<tam_resultado && i<limite;i++){
var entrada=resultado.entries[i];
find_linkrss[i]=entrada.url;
find_link[i]=entrada.link;
find_titulo[i]=entrada.title;
find_content[i]=entrada.content;
date_content[i]= entrada.publishedDate;
//imagen_cont(i);//Sacamos la imagen de feed_content y la guardamos en (img_content);
salida_html+="<section class='article_content'><article>";
//salida_html+=img_content[i];
salida_html+="<h4><a href='javascript:links("+i+")' >" + find_titulo[i] + "</a></h4>"+"<p class='date'>"+entrada.publishedDate+"</p>";
salida_html+="<p>"+ entrada.contentSnippet+"</p></article></section>";
}
salida_html+="";
contenido_html.innerHTML=salida_html;
}
else{
alert("No hay resultados!");
}
}
/*-------------------------------------PROBANDO-----------------------------------------------------*/
//Modificamos el html al darle click en los links y veremos cada noticia
function links(i){
salida_html="";//limpiamos todo contenido
salida_html+="<h3><b>"+find_titulo[i]+"</b></h3></br>";
//rssoutput+="<a href='index.jsp'> Home</a> <br />";//para regresar a la pag principal
salida_html+="<p class='date'>"+ date_content[i] + "</p>";
salida_html+="<div class='display_full'><p>"+find_content[i]+"</p></div>";
contenido_html.innerHTML=salida_html;
}
//Sacamos la imagen del contenido, La imagen siempre esta al inicio de
//feed_content(Seria buenoverificarlo con un alert) <- Solo funciona con RPP y el correo
function imagen_cont(i){
var j=0;
var contenido=find_content[i];
img_content[i]="";
while(contenido[j]!='>'){
img_content[i]+=contenido[j];
j++;
}
img_content[i]+=" class='content_img'>";
}
function mostrar_link(i){
var feedJSON = new google.feeds.Feed(find_linkrss[i]);alert("aui");
feedJSON.load(mostrar_enHTML);
}
//html
function mostrar_enHTML(result){
if (!result.error){
var entradas_feeds=result.feed.entries;
var tam_result=entradas_feeds.length;
salida_html="<b>Resultado del link:</b><br /><ul>";
//Guardamos los resultados en algunas variables globales
for (var i=0; i<tam_result; i++){
find_titulo[i]=entradas_feeds[i].title;
salida_html+="<li><a href='"+entradas_feeds[i].link+"' >" + find_titulo[i] + "</a>"+"<br/></li>";
}
salida_html+="</ul>";
contenido_html.innerHTML=salida_html;
}
else
alert("Error al capturar feeds!");
}
|
import React, { Component } from 'react';
import Signup from '../Signup';
import './products.css';
class Products extends Component {
state = {
products: []
};
// displays mysql data
componentDidMount() {
this.getProducts();
}
getProducts = () => {
console.log("getting products");
// looks for /products in server.js
fetch('/products')
.then((res) => {
return res.json();
})
.then(res => this.setState({ products: res.data }))
.catch(err => console.error(err))
//console.log(data);
console.log(this.state.products);
}
render() {
const { products } = this.state;
const renderProduct = (title) =>
<li
key={title}>
{title}
</li>
return (
<div className="page">
<Signup auth={this.props.auth} history={this.props.history} />
<div className="Products">
<h1>Your saved products:</h1>
<ul>
{products.map(product =>renderProduct(product.TITLE))}
</ul>
</div>
</div>
);
}
}
export default Products;
|
var listItems = document.querySelectorAll('li');
var dataList = ['apple', 'banana', 'cat', 'dog'];
listItems.forEach(function (item, index) {
item.textContent = dataList[index];
});
|
editFunction = function (row, store) {
var type;
//配送區域
var logisticsAreaStore = Ext.create('Ext.data.Store', {
autoLoad: false,
model: 'gigade.logisticsName1',
proxy: {
type: 'ajax',
url: '/Logistics/GetLogisticsArea',
actionMethods: 'post',
reader: {
type: 'json',
root: 'data'
}
}
});
//配送模式
var logisticsTypeStore = Ext.create('Ext.data.Store', {
autoLoad: false,
model: 'gigade.logisticsName1',
proxy: {
type: 'ajax',
url: '/Logistics/GetLogisticsType',
actionMethods: 'post',
reader: {
type: 'json',
root: 'data'
}
}
});
logisticsAreaStore.load();
Ext.define("gigade.logisticsName", {
extend: 'Ext.data.Model',
fields: [
{ name: 'parameterCode', type: 'string' },
{ name: 'parameterName', type: 'string' }]
});
logisticsTypeStore.load({ params: { ltype: type } });
//搜索框物流數據
var logisticsNameStore = Ext.create('Ext.data.Store', {
// autoDestroy: true,
model: 'gigade.logisticsName',
proxy: {
type: 'ajax',
url: '/Logistics/GetLogisticsName',
actionMethods: 'post',
reader: {
type: 'json',
root: 'data'
}
}
});
logisticsNameStore.load();
//常低溫
var logisticsOftenLowStore = Ext.create('Ext.data.Store', {
autoDestroy: true,
fields: ['name', 'value'],
data: [{ name: "常溫", value: 1 }, { name: "低溫", value: 2 }]
});
//收費方式
var logisticsChargeMethodStore = Ext.create('Ext.data.Store', {
autoDestroy: true,
fields: ['name', 'value'],
data: [{ name: "固定", value: 1 }, { name: "累加", value: 2 }]
});
var editLogisticsFrm = Ext.create('Ext.form.Panel', {
id: 'editLogisticsFrm',
frame: true,
plain: true,
layout: 'anchor',
url: '/Logistics/LogisticsSave',
defaults: { anchor: "95%", msgTarget: "side" },
items: [
{
xtype: 'textfield',
id: 'rid',
name: 'rid',
fieldLabel: 'rid',
value: '',
hidden: true
},
{
xtype: 'combobox',
fieldLabel: "物流",
id: 'delivery_store_id',
name: 'delivery_store_id',
labelWidth: 60,
lastQuery: '',
store: logisticsNameStore,
displayField: 'parameterName',
valueField: 'parameterCode',
value: 1
},
{
xtype: 'combobox',
editable: false,
fieldLabel: "配送區域",
lastQuery: "",
labelWidth: 60,
id: 'freight_big_area',
name: 'freight_big_area',
store: logisticsAreaStore,
displayField: 'parameterName',
valueField: 'parameterCode',
triggerAction: 'all',
value: "",
listeners: {
"select": function () {
var area = Ext.getCmp('freight_big_area');
var types = Ext.getCmp('freight_type');
if (area.getValue() != undefined && types.getValue() != undefined) {
types.setDisabled(false);
}
type = Ext.getCmp("freight_big_area").getValue();
types.clearValue();
logisticsTypeStore.removeAll();
}
}
}, {
xtype: 'combobox',
editable: false,
fieldLabel: "配送方式",
labelWidth: 60,
lastQuery: "",
id: 'freight_type',
name: 'freight_type',
store: logisticsTypeStore,
displayField: 'parameterName',
valueField: 'parameterCode',
value: "",
listeners: {
'beforequery': function (qe) {
logisticsTypeStore.load({ params: { ltype: type } });
}
}
}, {
xtype: 'combobox',
id: 'delivery_freight_set',
name: 'delivery_freight_set',
fieldLabel: '常溫/低溫',
labelWidth: 60,
queryMode: 'local',
editable: false,
disabled: false,
store: logisticsOftenLowStore,
displayField: 'name',
valueField: 'value',
value: 1,
allowBlank: false
}, {
xtype: 'combobox',
id: 'charge_type',
name: 'charge_type',
fieldLabel: '收費方式',
labelWidth: 60,
queryMode: 'local',
editable: false,
store: logisticsChargeMethodStore,
displayField: 'name',
valueField: 'value',
value: ""
},
{
xtype: 'numberfield',
fieldLabel: '運費',
labelWidth: 60,
id: 'shipping_fee',
name: 'shipping_fee',
submitValue: true,
minValue: 0,
value: 0,
allowDecimals: false,
allowBlank: false
}, {
xtype: 'numberfield',
fieldLabel: '逆運費',
labelWidth: 60,
id: 'return_fee',
name: 'return_fee',
submitValue: true,
minValue: 0,
value: 0,
allowDecimals: false,
allowBlank: false
},
{
xtype: 'textfield',
fieldLabel: NOTE,
labelWidth: 60,
id: 'note',
name: 'note'
},
{
xtype: 'fieldcontainer',
combineErrors: true,
layout: 'hbox',
width: 500,
items: [
{
xtype: 'displayfield',
width: 100,
value: '是否貨到付款:'
},
{
xtype: 'radiogroup',
allowBlank: false,
columns: 2,
width: 400,
id: 'payver',
colName: 'payver',
vertical: true,
name: 'payver',
margin: '1 0 1 25',
items: [{
boxLabel: '是',
name: 'payver',
id: 'yc',
checked: true,
inputValue: 1
},
{
boxLabel: '否',
name: 'payver',
id: 'nc',
inputValue: 0
}]
}
]
},
{
xtype: 'fieldcontainer',
combineErrors: true,
layout: 'hbox',
width: 500,
items: [
{
xtype: 'displayfield',
width: 100,
value: '是否有size限制:'
},
{
xtype: 'radiogroup',
hidden: false,
id: 'sizever',
name: 'sizever',
colName: 'sizever',
columns: 2,
vertical: true,
width: 400,
margin: '1 0 1 25',
items: [{
boxLabel: '是',
name: 'sizever',
id: 'yes',
checked: true,
inputValue: 1,
listeners: {
change: function (radio, newValue, oldValue) {
var length = Ext.getCmp("len");
var width = Ext.getCmp("wid");
var tall = Ext.getCmp("hei");
var weight = Ext.getCmp("wei");
if (newValue) {
length.allowBlank = false;
length.setDisabled(false);
width.allowBlank = false;
width.setDisabled(false);
tall.allowBlank = false;
tall.setDisabled(false);
weight.allowBlank = false;
weight.setDisabled(false);
}
}
}
},
{
boxLabel: '否',
name: 'sizever',
id: 'no',
inputValue: 0,
listeners: {
change: function (radio, newValue, oldValue) {
var length = Ext.getCmp("len");
var width = Ext.getCmp("wid");
var tall = Ext.getCmp("hei");
var weight = Ext.getCmp("wei");
if (newValue) {
length.allowBlank = true;
length.setDisabled(true);
width.allowBlank = true;
width.setDisabled(true);
tall.allowBlank = true;
tall.setDisabled(true);
weight.allowBlank = true;
weight.setDisabled(true);
}
}
}
}]
}
]
},
{
xtype: 'numberfield',
fieldLabel: '限長',
labelWidth: 60,
id: 'len',
name: 'len',
submitValue: true,
minValue: 0,
allowDecimals: false,
value: 0,
allowBlank: false
}, {
xtype: 'numberfield',
fieldLabel: '限寬',
labelWidth: 60,
id: 'wid',
name: 'wid',
submitValue: true,
minValue: 0,
allowDecimals: false,
value: 0,
allowBlank: false
}, {
xtype: 'numberfield',
fieldLabel: '限高',
labelWidth: 60,
id: 'hei',
name: 'hei',
submitValue: true,
minValue: 0,
allowDecimals: false,
value: 0,
allowBlank: false
}, {
xtype: 'numberfield',
fieldLabel: '限重',
labelWidth: 60,
id: 'wei',
name: 'wei',
submitValue: true,
minValue: 0,
allowDecimals: false,
value: 0,
allowBlank: false
}
],
buttons: [{
formBind: true,
disabled: true,
text: SAVE,
handler: function () {
var form = this.up('form').getForm();
if (form.isValid()) {
this.disable();
form.submit({
params: {
dsid: Ext.getCmp("rid").getValue(),
dsid: Ext.getCmp("delivery_store_id").getValue(),
fbarea: Ext.getCmp("freight_big_area").getValue(),
ftype: Ext.getCmp("freight_type").getValue(),
dfset: Ext.getCmp("delivery_freight_set").getValue(),
ctype: Ext.getCmp("charge_type").getValue(),
sfree: Ext.getCmp("shipping_fee").getValue(),
rfree: Ext.getCmp("return_fee").getValue(),
slimit: Ext.getCmp("sizever").getValue(),
length: Ext.getCmp("len").getValue(),
width: Ext.getCmp("wid").getValue(),
height: Ext.getCmp("hei").getValue(),
weight: Ext.getCmp("wei").getValue(),
pod: Ext.getCmp("payver").getValue(),
note: Ext.getCmp("note").getValue()
},
success: function (form, action) {
var result = Ext.decode(action.response.responseText);
if (result.success) {
if (result.res == 0) {
Ext.Msg.alert(INFORMATION, "添加信息已存在!");
}
else if (result.res == 1) {
Ext.Msg.alert(INFORMATION, SUCCESS);
LogisticsStore.load();
editUserWin.close();
}
}
else {
Ext.Msg.alert(INFORMATION, FAILURE);
editUserWin.close();
}
},
failure: function (form, action) {
Ext.Msg.alert(INFORMATION, FAILURE);
editUserWin.close();
}
})
}
}
}]
});
var editUserWin = Ext.create('Ext.window.Window', {
id: 'editLogisticsWin',
title: '物流公司',
width: 500,
iconCls: 'icon-user-edit',
layout: 'fit',
constrain: true,
closeAction: 'destroy',
modal: true,
closable: false,
items: [editLogisticsFrm],
labelWidth: 60,
bodyStyle: 'padding:5px 5px 5px 5px',
closable: false,
tools: [
{
type: 'close',
qtip: '是否關閉',
handler: function (event, toolEl, panel) {
Ext.MessageBox.confirm(CONFIRM, IS_CLOSEFORM, function (btn) {
if (btn == "yes") {
editUserWin.destroy();
}
else {
return false;
}
});
}
}
],
listeners: {
'show': function () {
if (row != null) {
editLogisticsFrm.getForm().loadRecord(row);
Ext.getCmp("delivery_store_id").setDisabled(true);
Ext.getCmp("delivery_freight_set").setDisabled(true);
if (row.data.size_limitation == 0) {
Ext.getCmp("no").setValue(true);
}
if (row.data.size_limitation == 1) {
Ext.getCmp("yes").setValue(true);
}
if (row.data.pod == 0) {
Ext.getCmp("nc").setValue(true);
}
if (row.data.pod == 1) {
Ext.getCmp("yc").setValue(true);
}
if (row.data.freight_big_area == 0) {
Ext.getCmp("freight_big_area").setValue("");
}
if (row.data.freight_type == 0) {
Ext.getCmp("freight_type").setValue("");
}
if (row.data.delivery_freight_set == 0) {
Ext.getCmp("delivery_freight_set").setValue("");
}
if (row.data.charge_type == 0) {
Ext.getCmp("charge_type").setValue("");
}
type = row.data.freight_big_area;
}
}
}
});
editUserWin.show();
}
|
import React from 'react';
import './Logotipo.css';
import {Box} from "@material-ui/core";
const Logotipo = (config) => {
return(
<div>
<img src={'imagenes/recortado_DEJAVU.png'} className={'Logo'} />
<Box component={"span"} className={'Logo'}>
{config.systemName}
</Box>
</div>
)
};
export default Logotipo;
|
var fuse = require('fusejs');
EtudeFS = function () {};
EtudeFS.prototype = Object.create(fuse.FileSystem.prototype);
module.exports = function (mountPath) {
return fuse.fuse.mount({ filesystem: EtudeFS, options: ["EtudeFS", mountPath] });
}
|
import React, {Component} from 'react';
import {Helmet} from "react-helmet";
import {connect} from 'react-redux';
import {requestEcoturismos} from '../../../actions/ecoturismo';
import EcoturismoHeader from "./header";
import ServicosItems from '../../servicos-items';
import BadRequestError from '../../errors/404';
import LoadingInfinite from '../../loadings/infinite';
import Typography from "material-ui/Typography";
import {Image} from 'cloudinary-react';
class EcoturismoIndex extends Component {
componentWillMount() {
this.props.requestEcoturismos();
}
render() {
const { video, items, fetching, error } = this.props;
if (error) {
return <BadRequestError />;
}
if (fetching) {
return <LoadingInfinite />;
}
document.title = "Ecoturismo | Vivalá"
return (
<div className="content-wrapper">
<Helmet>
<title>Ecoturismo | Vivalá</title>
<meta name="theme-color" content="#ED6D2C" />
<meta name="description" content="Viagens com uma Profunda Conexão com a Natureza, que Incentiva a Busca por Bem Estar e a Formação de uma Consciência Sustentável em Relação ao Meio Ambiente. " />
<meta property="og:locale" content="pt_BR" />
<meta property="og:url" content={this.props.location.pathname} />
<meta property="og:title" content="Vivalá - Operadora de Volunturismo e Ecoturismo no Brasil e Agência Global de Viagens" />
<meta property="og:site_name" content="Vivalá" />
<meta property="og:description" content="Viaje pelo Brasil com roteiros de Turismo e Voluntariado, Experiências de Conexão com a Natureza e Lugares Incríveis para ir quando quiser." />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://res.cloudinary.com/vivala/image/upload/v1528403873/home_volunturismo_1527197447_vasb9e.jpg" />
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1621" />
<meta property="og:image:height" content="788" />
</Helmet>
<div className="servicos-page container">
<EcoturismoHeader videoId={video} />
<div className="frase-impacto">
<Typography className="frase-impacto-title">
Encontre paisagens de tirar o fôlego e equilíbrio interno através do contato com a natureza no Brasil
</Typography>
</div>
<div className="container-calendario barra-rolagem-ecoturismo">
<Image
cloudName="vivala"
publicId={window.screen.width > 1200 ? 'Agenda_2019.003_2_vbroqc' : window.screen.width > 900 ? 'Agenda_2019.003_2_vbroqc' : 'Agenda_2019.003_2_vbroqc' }
alt="Tabela horarios experiências 2019"
/>
</div>
<div className="servicos-items container">
{ items.length > 0 && <ServicosItems items={items} key="ecoturismo-items" /> }
</div>
</div>
</div>
);
}
}
function mapStateToProps(state) {
return {
fetching: state.ecoturismo.fetching,
error: state.ecoturismo.error,
items: state.ecoturismo.items,
video: state.ecoturismo.video
}
}
export default connect(mapStateToProps, {requestEcoturismos})(EcoturismoIndex);
|
/**
* Created by Jay on 2016/12/5.
*/
function rootRender() {
var now = new Date();
if (window.$topLeftTime) {
var str = convertTimeToDate(now.getTime(), true, "en");
var ms = now.getMilliseconds();
if (ms < 10) ms = "00" + ms;
else if (ms < 100) ms = "0" + ms;
str += "." + ms;
window.$topLeftTime.text = str;
}
if (window.$startTime) {
var costTime = Date.now() - window.$startTime;
costTime = costTime / 1000;
window.$scoreCycle.time.text = "TIME COST: " + costTime;
}
}
function updatePhaseProgress(val) {
window.$cycleBigProgress && window.$cycleBigProgress.$update(val);
window.$cycleBigProgressLabel && (window.$cycleBigProgressLabel.text = val + "%");
}
function setPhaseTitle(str, callBack) {
var txt = window.$cycleBigBoardTitle;
txt.$text = str;
txt.text = "";
txt.alpha = 0.6;
createjs.Tween.removeTweens(txt);
var mc = window.$cycleBigBoardTitleFrame;
mc.gotoAndPlay(0);
window.$cycleBigBoardTitleFrameTick = function(event) {
if (mc.currentFrame == (mc.totalFrames - 1)) {
mc.removeEventListener("tick", window.$cycleBigBoardTitleFrameTick);
//stop
mc.gotoAndStop(0);
//set text
txt.text = txt.$text;
createjs.Tween.get(txt, { loop:true }).to({ alpha:1 }, 800, createjs.Ease.linear).to({ alpha:0.6 }, 800, createjs.Ease.linear);
callBack && callBack();
}
}
mc.removeEventListener("tick", window.$cycleBigBoardTitleFrameTick);
mc.addEventListener("tick", window.$cycleBigBoardTitleFrameTick);
}
function writePhaseLog() {
var log = window.$cycleBigBoardLog;
if (!log) return;
if (!log.$update) {
log.$lines = [];
log.$update = function() {
if (log.$lines.length > 30) {
log.$lines.splice(8);
}
var str = FAKE_LOG_1.random();
log.$lines.splice(0, 0, str);
log.text = log.$lines.join("\r\n");
}
}
//log.removeEventListener("tick", window.$cycleBigBoardLogTick);
//log.addEventListener("tick", window.$cycleBigBoardLogTick);
clearInterval(log.$timer);
log.$timer = setInterval(log.$update.bind(log), 1000 / 8);
}
function updateMapPin() {
if (!currentUser || (!currentUser.province && !currentUser.loc)) {
if (currentUser) {
if (!currentUser.province) {
console.error("发现为定义的province字段: ", currentUser.province);
}
if (!currentUser.loc) {
console.error("发现为定义的address字段: ", currentUser.loc);
}
}
return;
}
var REF_POS = [ 169.8, 96.90 ]; //beijing
var REF_LOC = CITES["北京"];
var pect1 = 3.8346613545816655;
var pect2 = 0.2003519061583578;
var name = currentUser.province ? currentUser.province : currentUser.loc;
var loc = CITES[name.substr(0, 2)];
if (!loc) {
loc = CITES[name.substr(0, 3)];
}
var pin = window.$mapPin;
if (!loc) {
console.error("无法定位地理位置: ", name);
pin.visible = false;
return;
}
//var x = pect1 * (loc[0] - REF_LOC[0]) + REF_POS[0];
//var y = pect2 * (loc[1] - REF_LOC[1]) + REF_POS[1];
/*
var pos = [ [ 110, 175 ], [ 112, 167 ] ];
var x = Math.round(pos[0][0] + Math.random() * (pos[0][1] - pos[0][0]));
var y = Math.round(pos[1][0] + Math.random() * (pos[1][1] - pos[1][0]));
*/
var x = loc[2];
var y = loc[3];
if (!pin) return;
pin.visible = true;
pin.gotoAndStop(0);
if (pin.$tween) {
createjs.Tween.removeTweens(pin);
}
pin.$tween = createjs.Tween.get(pin).to({ scaleX:0.01, scaleY:0.01 }, 600, createjs.Ease.bounceOut).to({ x:x, y:y }, 0).to({ scaleX:1, scaleY:1 }, 600, createjs.Ease.bounceOut).call(function() {
pin.play();
if (window.$mapPinTick) pin.removeEventListener("tick", window.$mapPinTick);
window.$mapPinTick = function(event) {
if (pin.currentFrame == pin.totalFrames - 1) {
//stop
pin.gotoAndPlay(20);
}
}
pin.addEventListener("tick", window.$mapPinTick);
});
}
function updateUserCycle() {
var Tween = createjs.Tween;
var Ease = createjs.Ease;
var cycle = window.$userCycle;
var inside1 = cycle.inside_1;
var inside2 = cycle.inside_2;
var inside3 = cycle.inside_3;
var core = cycle.core;
core.gotoAndStop(0);
cycle.$stopScan();
inside1.rotation = 0;
inside2.rotation = 0;
inside3.rotation = 0;
cycle.picHolder.alpha = 0;
loadUserPic(currentUser ? currentUser.pic : null, { width:136, height:136 }, function(bitmap, image) {
if (cycle.$pic && cycle.$pic.parent) {
cycle.$pic.parent.removeChild(cycle.$pic);
}
cycle.$pic = bitmap;
bitmap.x = - 68;
bitmap.y = - 68;
bitmap.alpha = 0.7;
cycle.picHolder.addChildAt(bitmap, 0);
});
Tween.get(cycle).to({ scaleX:0.8, scaleY:0.8 }, 1200, Ease.backInOut).to({ scaleX:1.0, scaleY:1.0 }, 1500, Ease.elasticIn);
Tween.get(inside1).to({ rotation:360 * 4 }, 3400, Ease.backOut);
Tween.get(inside2).to({ rotation:360 * 3 }, 3000, Ease.backOut);
Tween.get(inside3).to({ rotation:360 * 2 }, 3000, Ease.backOut).wait(600).call(function() {
core.playTo(core.totalFrames - 1, {fps:60},function() {
Tween.get(cycle.picHolder).to({ alpha:1 }, 600, Ease.linear);
cycle.$startScan();
});
});
}
function loadUserPic(url) {
var options = typeof arguments[1] == "function" ? null : arguments[1];
options = options || {};
var onComplete = typeof arguments[1] == "function" ? arguments[1] : arguments[2];
if (typeof onComplete != "function") onComplete = null;
url = url || "img/default_head.png";//"http://p3.music.126.net/JCEKqxPbejzVTlIG65zrWQ==/18691697673688500.jpg?param=150x150";
var image = new Image();
image.src = url;
image.onload = function() {
var bitmap = new createjs.Bitmap(image);
var sizeW = image.width;
var sizeH = image.height;
if (options.width) {
bitmap.scaleX = options.width / sizeW;
}
if (options.height) {
bitmap.scaleY = options.height / sizeH;
}
onComplete && onComplete(bitmap, image);
};
}
function updateScore(val, callBack) {
var mc = window.$scoreCycle.frame_block;
mc.playTo(mc.totalFrames - 1, { fps:24, finalStop:0 });
mc = window.$scoreCycle.outside;
mc.stopAnimate();
createjs.Tween.get(mc).to({ scaleX:1.2, scaleY:1.2 }, 800, createjs.Ease.backOut).
wait(300).
to({ rotation:0 }, 600).
wait(300).
to({ scaleX:mc.$scale, scaleY:mc.$scale }, 800, createjs.Ease.backOut).
wait(200).
call(function() {
this.rotation = 0;
this.animateRotate({ loop:true, direction:-1 });
}.bind(mc));
mc = window.$scoreCycle.frame;
createjs.Tween.get(mc).wait(300).to({ scaleX:1.1, scaleY:1.1 }, 800, createjs.Ease.backOut).
wait(300).
to({ rotation:0 }, 600).
wait(300).
to({ scaleX:mc.$scale, scaleY:mc.$scale }, 800, createjs.Ease.backOut);
mc = window.$scoreCycle.frame_light;
createjs.Tween.get(mc).wait(300).to({ scaleX:1.1, scaleY:1.1 }, 800, createjs.Ease.backOut).
wait(300).
to({ rotation:0 }, 600).
wait(300).
to({ scaleX:mc.$scale, scaleY:mc.$scale }, 800, createjs.Ease.backOut);
mc = window.$scoreCycle.core;
mc.stopAnimate();
createjs.Tween.get(mc).wait(600).to({ scaleX:1.0, scaleY:1.0 }, 800, createjs.Ease.backOut).
wait(300).
to({ rotation:0 }, 600).
wait(300).
to({ scaleX:mc.$scale, scaleY:mc.$scale }, 800, createjs.Ease.backOut).
wait(200).
call(function() {
this.rotation = 0;
this.animateRotate({ loop:true, time:12000 });
callBack && callBack();
}.bind(mc));
createjs.Tween.get(window.$scoreCycle.label).wait(500).call(function() {
window.$scoreCycle.label.animateNumber(val, { time:2000 }, function() {
});
});
}
function fadeOutProcess(id, callBack) {
var mc = window["$process" + id];
createjs.Tween.get(mc).to({ alpha:0 }, 500).call(function() {
this.$reset();
this.alpha = 1;
callBack && callBack();
}.bind(mc));
}
function allReset(callBack) {
animateProgress(0, 2000);
setPhaseTitle("PENDING");
window.$startTime = undefined;
window.$result.$hide(false);
window.$scoreCycle.time.text = "TIME COST: 0.000";
window.$scoreCycle.label.animateNumber(0, { time:2000 }, function() { });
window.$processHead.$setTitle("- WAITING -");
window.$processHead.$progressTo(0, 2000);
window.$userCycle.phase1.gotoAndStop(0);
window.$userCycle.phase2.gotoAndStop(0);
window.$userCycle.phase3.gotoAndStop(0);
window.$userCycle.phase4.gotoAndStop(0);
window.$processPhase.$reset();
if (currentUser) {
window.$userCycle.$hideProfile(function() {
callBack && callBack();
});
} else {
callBack && callBack();
}
}
function startStaticAnimation() {
var cjs = createjs;
var Tween = cjs.Tween;
var Ease = cjs.Ease;
var mc,txt,rect;
//result
mc = exportRoot.result;
mc.label.text = "";
mc.label.alpha = 0;
mc.frame1.$x1 = mc.frame1.x;
mc.frame2.$x1 = mc.frame2.x;
mc.frame1.x += (1970 * 1);
mc.frame2.x -= (1970 * 1);
mc.frame1.$x2 = mc.frame1.x;
mc.frame2.$x2 = mc.frame2.x;
mc.bg.visible = false;
mc.$show = function(txt, callBack) {
var mc = this;
Tween.get(mc.frame1).to({ x:mc.frame1.$x1 }, 300, Ease.quadOut);
Tween.get(mc.frame2).to({ x:mc.frame2.$x1 }, 300, Ease.quadOut).call(function() {
mc.bg.visible = true;
mc.label.text = txt;
mc.label.animateBlink({ times:4, min:0, max:1 }, function() {
callBack && callBack.apply(mc, []);
});
});
};
mc.$hide = function(animate, callBack) {
var mc = this;
mc.bg.visible = false;
mc.label.text = "";
mc.label.alpha = 0;
if (animate) {
Tween.get(mc.frame1).to({ x:mc.frame1.$x2 }, 300, Ease.quadOut);
Tween.get(mc.frame2).to({ x:mc.frame2.$x2 }, 300, Ease.quadOut).call(function() {
callBack && callBack.apply(mc, []);
});
} else {
setTimeout(function() {
mc.frame1.x = mc.frame1.$x2;
mc.frame2.x = mc.frame2.$x2;
callBack && callBack.apply(mc, []);
}, 0);
}
};
window.$result = mc;
//top_info
mc = exportRoot.top_info;
mc.$index = 0;
mc.$run = function() {
var moveDistance = 2420;
var move = function(txt, x1) {
Tween.removeTweens(txt);
txt.x = x1;
txt.text = "[" + convertTimeToDate(Date.now(), true, 'en').split(" ")[1] + "] " + FAKE_INFO[this.$index];
this.$index ++;
if (this.$index >= FAKE_INFO.length) {
this.$index = 0;
}
var tween = Tween.get(txt).to({ x:x1 - moveDistance }, 14000, Ease.linear).call(function() {
move.apply(this, [ txt, x1 ]);
}.bind(this));
/*
tween.addEventListener("change", function(event) {
if (txt.x <= -68) {
//again
event.target.removeEventListener(event.type, arguments.callee);
move(txt, x1);
}
}.bind(this));
*/
}.bind(this);
move(this.txt1, 1758);
move(this.txt2, 2373);
setTimeout(function() {
move(this.txt3, 1758);
move(this.txt4, 2373);
}.bind(this), 7000);
};
mc.$run();
//performance
var bars = [];
txt = exportRoot.performance.title.label;
txt.scaleX = txt.scaleY = 0.8;
var num = exportRoot.performance.monit.numChildren;
for (var i = 0; i < num; i++) {
var child = exportRoot.performance.monit.getChildAt(i);
if (child.constructor == cjs.Text) {
child.scaleX = child.scaleY = 0.7;
} else {
child = exportRoot.performance.monit["bar" + i];
if (child) {
child.gotoAndStop(0);
bars.push(child);
}
}
}
exportRoot.performance.monit.$update = function() {
bars.forEach(function(bar) {
var frame = 35 + Math.ceil(Math.random() * 64);
bar.gotoAndStop(frame);
});
};
setInterval(exportRoot.performance.monit.$update, 1000 / 10);
//cycle_big
mc = exportRoot.cycle_big.progress_bar;
mc.gotoAndStop(0);
mc.$update = function(val) {
val = Math.ceil((this.totalFrames - 1) * (val / 100));
val = Math.min(val, (this.totalFrames - 1));
val = Math.max(val, 0);
this.gotoAndStop(val);
};
window.$cycleBigProgress = mc;
txt = exportRoot.cycle_big.label;
txt.txt = "";
window.$cycleBigProgressLabel = txt;
mc = exportRoot.cycle_big.inside;
mc.gotoAndStop(0);
/*
mc.$run = function() {
var r = Math.round(30 + Math.random() * 330) * (Math.random() < 0.5 ? 1 : -1);
var t = Math.round(800 + Math.random() * 1200);
var w = Math.round(100 + Math.random() * 300);
Tween.get(this).wait(w).to({ rotation:r }, t, Ease.backOut).call(this.$run.bind(this));
};
*/
mc.$run = function() {
mc.$tween = Tween.get(this, { loop:true }).to({ rotation:360 }, 1500);
};
mc.$stop = function() {
mc.$tween && mc.$tween.pause();
};
mc.$run();
//cycle big board
txt = exportRoot.cycle_big_board.title;
txt.text = "";
window.$cycleBigBoardTitle = txt;
txt = exportRoot.cycle_big_board.log;
txt.text = "";
txt.scaleX = txt.scaleY = 0.8;
window.$cycleBigBoardLog = txt;
mc = exportRoot.cycle_big_board.title_frame;
mc.gotoAndStop(0);
window.$cycleBigBoardTitleFrame = mc;
//map
mc = exportRoot.map;
mc.$startScan = function() {
var scan = this.scan;
scan.x = -40;
Tween.get(scan, { loop:true }).wait(1000).to({ x:330 }, 4000, Ease.linear);
};
mc.$stopScan = function() {
var scan = this.scan;
Tween.removeTweens(scan);
scan.x = -40;
};
mc.$startScan();
window.$map = mc;
mc = exportRoot.map.pin;
mc.gotoAndStop(0);
mc.visible = false;
window.$mapPin = mc;
//process head
mc = exportRoot.process_head.process_bar;
mc.$max = mc.width - (mc.width - mc.track.x) * 2;
mc = exportRoot.process_head;
mc.__progress = { val:0 };
mc.$reset = function() {
this.title.text = "- WAITING -";
this.$setProgress(0);
this.process_cycle.gotoAndStop(0);
};
mc.$run = function() {
this.process_cycle.play();
};
mc.$stop = function() {
Tween.removeTweens(this.__progress);
this.removeEventListener("tick", this.__progressUpdate);
this.process_cycle.gotoAndStop(0);
};
mc.$setTitle = function(str) {
this.title.animatePrintIn(str, { fps:16 });
};
mc.$setProgress = function(val) {
this.__progress.val = val;
var bar = this.process_bar;
bar.track.scaleX = Math.min(1, val / 100);
this.progress_label.text = String(Math.round(val));
};
mc.$progressTo = function(val, time, callBack) {
this.removeEventListener("tick", this.__progressUpdate);
this.addEventListener("tick", this.__progressUpdate);
Tween.get(this.__progress).to({ val:val }, time).call(function() {
this.$stop();
this.$setProgress(val);
callBack && callBack.apply(this, []);
}.bind(this));
};
mc.__progressUpdate = function() {
this.$run();
this.$setProgress(this.__progress.val);
}.bind(mc);
mc.$reset();
window.$processHead = mc;
//process phase
mc = exportRoot.process_phase;
mc.__phaseColor = [ "#1F5A75", "#F6AF36", "#8AF8F3" ];
mc.$activePhase = function(id, status) {
var item = this["item" + id];
status = status || 0;
item.gotoAndStop(status);
item.label.color = this.__phaseColor[status];
Tween.removeTweens(item);
if (status == 1) {
Tween.get(item).to({ scaleX:1.2, scaleY:1.2 }, 300, Ease.backOut);
} else {
Tween.get(item).wait(500).to({ scaleX:1, scaleY:1 }, 300, Ease.backOut);
}
};
mc.$phaseComplete = function(id, flag) {
var mc = this;
var delay = 40;
Tween.get(this).
wait(0).
call(function() {
mc.$activePhase(id, flag ? 2 : 0);
}).
wait(delay).
call(function() {
mc.$activePhase(id, flag ? 0 : 2);
}).
wait(delay).
call(function() {
mc.$activePhase(id, flag ? 2 : 0);
}).
wait(delay).
call(function() {
mc.$activePhase(id, flag ? 0 : 2);
});
window.$userCycle.$activePhase(id, flag);
};
mc.$reset = function() {
var mc = this;
var delay = 200;
setTimeout(function() {
mc.$phaseComplete(1, true);
}, delay * 3);
setTimeout(function() {
mc.$phaseComplete(2, true);
}, delay * 2);
setTimeout(function() {
mc.$phaseComplete(3, true);
}, delay * 1);
setTimeout(function() {
mc.$phaseComplete(4, true);
}, delay * 0);
};
window.$processPhase = mc;
mc = exportRoot.process_phase.item1;
mc.label.text = PROCESS_PHASE[0];
mc.gotoAndStop(0);
mc = exportRoot.process_phase.item2;
mc.label.text = PROCESS_PHASE[1];
mc.gotoAndStop(0);
mc = exportRoot.process_phase.item3;
mc.label.text = PROCESS_PHASE[2];
mc.gotoAndStop(0);
mc = exportRoot.process_phase.item4;
mc.label.text = PROCESS_PHASE[3];
mc.gotoAndStop(0);
//top left
mc = exportRoot.top_left.cycle;
mc.gotoAndStop(0);
mc.$run = function() {
var shadow = this.shadow;
function shadowAnimate() {
shadow.scaleX = 1;
shadow.scaleY = 1;
Tween.get(shadow).to({ scaleX:2.4, scaleY:2.4 }, 2000, Ease.linear).to({ scaleX:1.0, scaleY:1.0 }, 2000, Ease.linear).call(function() {
shadowAnimate();
});
}
shadowAnimate();
var frame = this.frame;
function frameAnimate() {
frame.rotation = 360;
var r = Math.round(30 + Math.random() * 1030) * (Math.random() < 0.5 ? 1 : -1);
var t = Math.round(2000 + Math.random() * 2000);
//var w = Math.round(100 + Math.random() * 300);
r = 0;
t = 3000;
Tween.get(frame, { loop:true }).to({ rotation:r }, t, Ease.linear);
}
frameAnimate();
var core = this.core;
function coreAnimate() {
core.rotation = 0;
var r = Math.round(30 + Math.random() * 1030) * (Math.random() < 0.5 ? 1 : -1);
var t = Math.round(2000 + Math.random() * 2000);
//var w = Math.round(100 + Math.random() * 300);
r = -360;
t = 3000;
Tween.get(core, { loop:true }).to({ rotation:r }, t, Ease.linear);
}
coreAnimate();
//this.alpha = 0.8;
/*
var cycle = this;
function cycleAnimate() {
var s = 0.8 + Math.random() * 0.3;
var t = Math.round(1000 + Math.random() * 1000);
var w = Math.round(2000 + Math.random() * 3000);
Tween.get(cycle).wait(w).to({ scaleX:s, scaleY:s }, t, Ease.backIn).call(cycleAnimate);
}
*/
//cycleAnimate();
};
window.$topLeftCycle = mc;
mc.$run();
var binaryNum = [ "0", "1"];
mc = exportRoot.top_left;
mc.$updateText = function() {
var str = binaryNum.random() + binaryNum.random();
this.txt1.text = str;
str = binaryNum.random() + binaryNum.random();
this.txt2.text = str;
str = binaryNum.random() + binaryNum.random();
this.txt3.text = str;
str = binaryNum.random() + binaryNum.random();
this.txt4.text = str;
str = binaryNum.random() + "\r\n" + binaryNum.random() + "\r\n" + binaryNum.random() + "\r\n" + binaryNum.random() + "\r\n" + binaryNum.random();
this.txt5.text = str;
};
setInterval(mc.$updateText.bind(mc), 1000 / 8);
txt = exportRoot.top_left.time.label;
window.$topLeftTime = txt;
//score cycle
mc = exportRoot.score_cycle;
window.$scoreCycle = mc;
mc = exportRoot.score_cycle.outside;
mc.animateRotate({ loop:true, direction:-1 });
mc.$scale = mc.scaleX;
mc = exportRoot.score_cycle.frame_light;
mc.$scale = mc.scaleX;
mc.mc1.stop();
mc.mc2.stop();
mc.mc1.playTo(mc.mc1.totalFrames - 1, { loopTo:0, fps:8 });
mc.mc2.playTo(mc.mc2.totalFrames - 1, { loopTo:0, fps:8 });
mc = exportRoot.score_cycle.core;
mc.$scale = mc.scaleX;
mc = exportRoot.score_cycle.frame_block;
mc.$scale = mc.scaleX;
mc.stop();
mc = exportRoot.score_cycle.frame;
mc.$scale = mc.scaleX;
mc.stop();
txt = exportRoot.score_cycle.label;
txt.text = "0";
//user cycle
mc = exportRoot.user_cycle;
mc.gotoAndStop(0);
mc.phase1.gotoAndStop(0);
mc.phase2.gotoAndStop(0);
mc.phase3.gotoAndStop(0);
mc.phase4.gotoAndStop(0);
mc.$activePhase = function(id, reset) {
this["phase" + id].gotoAndStop(reset ? 1 : 0);
this["phase" + id].animateFrameBlink({ frames:reset ? [ 1, 0 ] : [ 0, 1 ], times:6 });
}
mc.$startScan = function() {
var scan = this.picHolder.scan;
scan.y = -75;
Tween.get(scan, { loop:true }).wait(1000).to({ y:125 }, 4000, Ease.linear);
};
mc.$stopScan = function() {
var scan = this.picHolder.scan;
Tween.removeTweens(scan);
scan.y = -75;
};
mc.$showProfile = function(data, callBack) {
var setProfile = function(mc, val, delay, callBack) {
mc.label.text = "";
mc.gotoAndStop(0);
Tween.removeTweens(mc);
Tween.get(mc).wait(delay).call(function() {
mc.playTo(-1, function() {
mc.label.animatePrintIn(val, { fps:24 });
callBack && callBack();
});
});
mc.visible = true;
};
var delay = 150;
setProfile(this.profile1, data.id, (0 * delay));
setProfile(this.profile2, data.name, (1 * delay));
setProfile(this.profile3, data.age + "岁", (2 * delay));
setProfile(this.profile4, data.loc, (3 * delay));
setProfile(this.profile5, data.phone, (4 * delay));
setProfile(this.profile6, "借款" + data.loan + "元", (5 * delay), callBack);
};
mc.$hideProfile = function(callBack) {
var hideProfile = function(mc, delay, callBack) {
Tween.removeTweens(mc);
//mc.gotoAndStop(mc.totalFrames - 1);
Tween.get(mc).wait(delay).call(function() {
var opt = { playBack:true };
mc.label.animatePrintOut({ fps:24 });
mc.playTo(0, opt, function() {
mc.visible = false;
callBack && callBack();
});
});
};
var delay = 150;
hideProfile(this.profile6, (0 * delay));
hideProfile(this.profile5, (1 * delay));
hideProfile(this.profile4, (2 * delay));
hideProfile(this.profile3, (3 * delay));
hideProfile(this.profile2, (4 * delay));
hideProfile(this.profile1, (5 * delay), callBack);
};
mc.profile1.visible = false;
mc.profile2.visible = false;
mc.profile3.visible = false;
mc.profile4.visible = false;
mc.profile5.visible = false;
mc.profile6.visible = false;
setTimeout(function() {
var mc = this;
mc.profile1.gotoAndStop(0);
mc.profile2.gotoAndStop(0);
mc.profile3.gotoAndStop(0);
mc.profile4.gotoAndStop(0);
mc.profile5.gotoAndStop(0);
mc.profile6.gotoAndStop(0);
}.bind(mc), 50);
window.$userCycle = mc;
mc = exportRoot.user_cycle.core;
mc.gotoAndStop(0);
mc = exportRoot.user_cycle.inside_1;
mc.gotoAndStop(0);
mc = exportRoot.user_cycle.inside_2;
mc.gotoAndStop(0);
mc = exportRoot.user_cycle.inside_3;
mc.gotoAndStop(0);
mc = exportRoot.user_cycle.picHolder;
mc.gotoAndStop(0);
mc.alpha = 0;
//card
mc = exportRoot.card_panel;
var cardParent = mc.parent;
var ref = lib.card_panel2;
ref.prototype.setFront = function() {
this.cycle.playTo(this.cycle.totalFrames - 1, { fps:4 });
this.cycle.visible = true;
};
ref.prototype.setIndex = function(index) {
var card = this;
this.$index = index;
if (index == window.$cards.length - 1) {
var pic = null;
if (users && users.length > 0) {
pic = users[0].pic;
}
loadUserPic(pic, { width:60, height:60 }, function(bitmap) {
var sp = new createjs.MovieClip();
sp.alpha = 0;
bitmap.alpha = 0.7;
sp.addChild(bitmap);
sp.x = - 30;
sp.y = - 30;
card.$pic = sp;
card.picHolder.addChild(sp);
card.picHolder.mock.visible = false;
sp.animateBlink({ min:0, max:1, times:6 });
card.cycle_glow.visible = true;
card.txt1.animateBlink({ min:0, max:1, times:4, after:200 });
card.txt2.animateBlink({ min:0, max:1, times:4, after:500 });
card.txt3.alpha = 1;
card.txt3.animateOutput({ fps:6 });
card.cycle.animateBlink({ min:0, max:1, times:4, after:700 }, function() {
card.cycle.playTo(card.cycle.totalFrames - 1, { fps:4, loopTo:0 });
});
card.cycle_glow.scaleX = card.cycle_glow.scaleY = 1.2;
Tween.get(card.cycle_glow, { loop:true }).to({ scaleX:0.8, scaleY:0.8, alpha:0.8 }, 2000, Ease.linear).to({ scaleX:1.2, scaleY:1.2, alpha:1 }, 2000, Ease.linear);
});
} else {
if (this.$pic && this.$pic.parent) {
this.$pic.parent.removeChild(this.$pic);
this.$pic = null;
}
this.picHolder.mock.visible = true;
this.cycle.gotoAndStop(0);
this.cycle.alpha = 0;
this.cycle_glow.alpha = 0;
this.txt1.alpha = 0;
this.txt2.alpha = 0;
this.txt3.stopAnimate(true);
this.txt3.alpha = 0;
Tween.removeTweens(this.cycle_glow);
}
};
ref.prototype.setData = function(data) {
data = data || genMockUser();
var card = this;
card.$data = data;
card.picHolder.removeChildAt(0);
var profile = [
"NAME: " + data.name,
"LOCATION: " + data.loc,
"GENDER: " + (data.gender == 1 ? "MALE" : "FEMALE"),
"AGE: " + data.age,
"LOAN REQ: " + data.loan
];
//card.txt1.text = profile.join("\r\n");
//card.txt2.text = "";
};
var cardNum = 6;
var cards = [];
var picGapX = 15; //x间距
var picGapY = 15; //y间距
for (var i = 0; i < cardNum; i++) {
var card = new ref();
card.x = mc.x + picGapX * i;
card.y = mc.y + picGapY * i;
card.alpha = (0.6 - 0.08 * cardNum) + 0.08 * i;
cards.push(card);
cardParent.addChild(card);
//card.txt1.text = "";
//card.txt2.text = "";
card.txt1.alpha = 0;
card.txt2.alpha = 0;
card.txt3.alpha = 0;
card.txt3.scaleX = card.txt3.scaleY = 0.6;
card.cycle.alpha = 0;
card.cycle_glow.alpha = 0;
(function(card, index) {
setTimeout(function() {
card.cycle.gotoAndStop(0);
card.setData();
card.setIndex(index);
}, 50);
})(card, i);
}
window.$cards = cards;
window.$cardPlayer = new StackPic(cards, 800);
window.$cardPlayer.outDistance = 300;
window.$cardPlayer.moveGap = 0;
window.$cardPlayer.out = function(callBack) {
var ins = this;
ins.switchPic(function() {
//infront
var card = this;
card.setIndex(card.$index + 1);
}, function() {
//out
var card = this;
card.setIndex(0);
}, function() {
//all complete
//var card = this.getFirstCard();
//card.setIndex(cards.length - 1);
callBack && callBack();
});
}
mc.parent.removeChild(mc);
//process link
mc = exportRoot.link;
mc.gotoAndStop(0);
mc.playTo(-1, { loopTo:0, fps:12 });
//process 1
mc = exportRoot.process1;
mc.line.gotoAndStop(0);
mc.visible = false;
mc.__props = [];
mc.__tags = [];
mc.loopChild(function(child) {
if (child instanceof lib.tag) {
this.__tags.push(child);
child.gotoAndStop(0);
child.label.text = "";
} else if (child instanceof createjs.Text) {
child.text = "";
this.__props.push(child);
}
}.bind(mc));
mc.$showTag = function() {
var tagIndex = 0;
var list = [].concat(PROCESS_1_TAG);
list.shuffle();
this.__tags.forEach(function(child) {
child.scaleX = child.scaleY = randomBetween(1, 1.4);
child.label.text = list[tagIndex] || "";
child.gotoAndStop(0);
clearTimeout(child.__showTimer);
child.__showTimer = setTimeout(function() {
child.__showTimer = undefined;
child.playTo(-1);
}, Math.round(200 + Math.random() * 1800));
tagIndex ++;
});
};
mc.$reset = function() {
this.visible = false;
this.line.gotoAndStop(0);
this.__tags.forEach(function(child) {
child.label.text = "";
child.gotoAndStop(0);
});
this.__props.forEach(function(txt) {
txt.stopAnimate();
txt.text = "";
});
}
mc.line.gotoAndStop(0);
window.$process1 = mc;
//process 2
mc = exportRoot.process2;
mc.line.gotoAndStop(0);
mc.visible = false;
mc.__props = [];
mc.loopChild(function(child) {
if (child instanceof createjs.Text) {
child.text = "";
this.__props.push(child);
}
}.bind(mc));
/*
mc.$showMatric = function(callBack) {
var mc = this;
mc.output.holder.x = mc.__outputHolderStartPos.x;
mc.output.holder.y = mc.__outputHolderStartPos.y;
mc.output.animateBlink({ times:3 }, function() {
var q = [];
var list = [].concat(mc.__outputTxts);
//list.reverse();
list.forEach(function(txt, i) {
q.push(function(cb) {
txt.$show(i < (list.length - 1), function() {
cb();
});
});
});
async.waterfall(q, function() {
callBack && callBack.apply(mc, []);
});
});
};
*/
mc.$showMatric = function(callBack) {
var mc = this;
mc.output.holder.x = mc.__outputHolderStartPos.x;
mc.output.holder.y = mc.__outputHolderStartPos.y;
mc.output.animateBlink({ times:3 }, function() {
var q = [];
var list = [].concat(mc.__outputTxts);
//list.reverse();
list.forEach(function(txt, i) {
/*
var sepStr = " . . . . . . . . . . . . . . . . . . ";
if (txt.__str.length > 10) sepStr = sepStr.replace(" . ", "");
var finalStr = [1,2,3,4,5].random() + "/5";
txt.label.text = txt.__str + sepStr + finalStr;
*/
txt.bar.alpha = randomBetween(0.3, 0.9);
txt.bar.scaleX = randomBetween(0.3, 1);
txt.label.text = txt.__str;
mc.output.holder.addChild(txt);
//Tween.get(txt.bar).wait(i * 150).to({ scaleX:randomBetween(0.3, 1) }, 800, Ease.linear);
});
var y = 300 + mc.output.holder.y + (window.$process2.__outputTxtHeight + window.$process2.__offset) * list.length;
Tween.get(mc.output.holder).to({ y:y }, 3500, Ease.linear).call(function() {
mc.output.cusor.visible = true;
mc.output.cusor.play();
mc.output.done.animateBlink({ min:0, max:1, times:4 });
callBack && callBack();
});
});
};
mc.output.cusor.visible = false;
mc.output.cusor.gotoAndStop(0);
mc.output.done.alpha = 0;
mc.output.alpha = 0;
mc.__outputTxtRect = { x:0, y:0 };
mc.__outputTxts = [];
mc.__offset = 0;
mc.__outputTxtHeight = 26;
mc.output.holder.removeChild(mc.output.holder.txt);
mc.output.holder.txt = undefined;
mc.output.holder.y = mc.output.holder.y + (mc.__outputTxtRect.y) * -1;
var outputHeight = mc.__outputTxtRect.y;
PROCESS_2_TAG.forEach(function(str, i) {
var mc = this;
var gap = 0;
var txt = new lib.process2_output_txt();
txt.bar.scaleX = 0;
txt.$show = function(down, callBack) {
var output = window.$process2.output;
var txt = this;
txt.bar.scaleX = 0;
mc.output.holder.addChild(txt);
var done = function() {
if (down) {
Tween.get(output.holder).wait(0).to({ y:output.holder.y + window.$process2.__outputTxtHeight + window.$process2.__offset }, 200, Ease.quadOut).call(function() {
txt.parent && txt.parent.removeChild(txt);
callBack && callBack();
});
} else {
callBack && callBack();
}
}.bind(txt);
//var sepStr = " . . . . . . . . . . . . . . . . . . ";
//if (txt.__str.length > 10) sepStr = sepStr.replace(" . ", "");
//var finalStr = [1,2,3,4,5].random() + "/5";
var opt = { fps:24 };
opt.complete = function() {
Tween.get(this.bar).to({ scaleX:randomBetween(0.3, 1) }, 400, Ease.linear).call(done);
/*
setTimeout(function() {
txt.label.text += sepStr;
setTimeout(function() {
txt.label.text += finalStr;
done();
}, 1000 / opt.fps);
}, 1000 / opt.fps);
*/
}.bind(this);
txt.label.animatePrintIn(txt.__str, opt);
}.bind(txt);
txt.__str = str;
txt.label.text = "";
txt.x = this.__outputTxtRect.x;
txt.y = -outputHeight;
outputHeight += (this.__offset + this.__outputTxtHeight);
this.__outputTxts.push(txt);
}.bind(mc));
mc.__outputHolderStartPos = { x:mc.output.holder.x, y:mc.output.holder.y };
mc.$showCharts = function () {
var mc = this;
var delay = 100;
var showAndHide = function(id, delay) {
setTimeout(function() {
var obj = mc.charts["c" + id];
obj.animateBlink({ min:0, max:0.10 + Math.random() * 0.1, times:4 });
setTimeout(function() {
obj.animateBlink({ min:obj.alpha, max:0, times:4 });
}, 2000);
}, delay);
};
showAndHide(1, delay * 0);
showAndHide(2, delay * 1);
showAndHide(3, delay * 2);
showAndHide(4, delay * 3);
showAndHide(5, delay * 4);
setTimeout(function() {
showAndHide(6, delay * 0);
showAndHide(7, delay * 1);
showAndHide(8, delay * 2);
showAndHide(9, delay * 3);
}, 2000);
};
mc.charts.loopChild(function(child) {
child.alpha = 0;
});
mc.$reset = function() {
this.line.gotoAndStop(0);
this.output.alpha = 0;
this.output.holder.x = this.__outputHolderStartPos.x;
this.output.holder.y = this.__outputHolderStartPos.y;
this.__props.forEach(function(txt) {
txt.stopAnimate();
txt.text = "";
});
this.__outputTxts.forEach(function(txt) {
txt.label.stopAnimate();
txt.label.text = "";
txt.bar.scaleX = 0;
txt.parent && txt.parent.removeChild(txt);
});
this.charts.loopChild(function(child) {
child.alpha = 0;
});
this.output.cusor.visible = false;
this.output.cusor.gotoAndStop(0);
this.output.done.alpha = 0;
this.visible = false;
};
window.$process2 = mc;
//process3
mc = exportRoot.process3;
mc.line.gotoAndStop(0);
mc.visible = false;
mc.__outsideBlocks = [];
mc.__blocks = [];
mc.__blocks = [];
mc.cube.loopChild(function(child, i) {
if (child instanceof lib.p3_cube_block || child instanceof lib.p3_cube_block_outside) {
//child.label.text = PROCESS_4_SITES[i] || "";
child.alpha = 0;
child.$index = this.__blocks.length;
child.$pos = { x:child.x, y:child.y };
this.__blocks.push(child);
if (child instanceof lib.p3_cube_block_outside) {
child.$outside = true;
this.__outsideBlocks.push(child);
}
child.gotoAndStop(0);
}
}.bind(mc));
mc.__blocks.forEach(function(block) {
if (block.parent) block.parent.removeChild(block);
});
mc.__cubeInfos = [];
mc.cube_info.loopChild(function(child) {
child.alpha = 0;
child.label.scaleX = child.label.scaleY = 1.15;
this.__cubeInfos.push(child);
child.gotoAndStop(0);
}.bind(mc));
mc.__cubeInfos.forEach(function(info) {
if (info.parent) info.parent.removeChild(info);
});
mc.$showCube = function(callBack) {
var mc = this;
var num = 0;
mc.__blocks.forEach(function(block, i) {
mc.cube.addChild(block);
block.alpha = 0;
block.scaleX = block.scaleY = randomBetween(1.6, 2);
block.x = [ -randomBetween(400, 600, true), randomBetween(400, 600, true)].random();
block.y = [ -randomBetween(400, 600, true), randomBetween(400, 600, true)].random();
var delay = randomBetween(0, 1000);
if (child.$outside) {
delay = randomBetween(1000, 2000);
}
var time = randomBetween(300, 800);
Tween.get(block).wait(delay).to({ x:block.$pos.x, y:block.$pos.y, alpha:1, scaleX:1, scaleY:1 }, time, Ease.quadOut).call(function() {
num ++;
if (num >= mc.__blocks.length) {
//done
callBack && callBack.apply(mc, []);
}
});
});
};
mc.$animateCube = function() {
var mc = this;
var blocks = [].concat(mc.__outsideBlocks);
//blocks.reverse();
blocks.forEach(function(block, i) {
var delay = randomBetween(0, 2000);
Tween.get(block).wait(delay).call(function() {
//block.animateFrameBlink({ frames:[ 0, 1 ], times:3, fps:12 });
block.gotoAndStop(1);
});
});
};
mc.cube_progress1.bar.gotoAndStop(0);
mc.cube_progress1.label.text = "0%";
mc.cube_progress1.visible = false;
mc.cube_progress2.label.text = "0%";
mc.cube_progress2.visible = false;
mc.$animateProgress = function(callBack) {
var mc = this;
mc.$__animateProgress(mc.cube_progress1, function() {
mc.$__animateProgress(mc.cube_progress2, function() {
callBack && callBack.apply(mc, []);
});
});
}
mc.$__animateProgress = function(bar, callBack) {
var mc = this;
var p = bar;
p.visible = true;
p.animateBlink({ min:0, max:1, fps:16, times:4 });
var opt = { fps:10 };
opt.tick = function() {
var pect = (p.bar.currentFrame + 1) / p.bar.totalFrames;
p.label.text = Math.round(pect * 100) + "%";
};
setTimeout(function() {
p.bar.playTo(-1, opt, function() {
callBack && callBack.apply(mc, []);
});
}, 400);
};
mc.$animateCubeInfo = function(callBack) {
var mc = this;
var infos = [].concat(this.__cubeInfos);
infos.shuffle();
infos.forEach(function(info, i) {
mc.cube_info.addChild(info);
info.label.text = "";
Tween.get(info).wait(i * 200).call(function() {
var str = PROCESS_3_TAGS.random(); //PROCESS_3_TAGS.random();
//str = randomString(randomBetween(8, 15, true));
info.label.animatePrintIn(str, { fps:14 });
info.animateBlink({ min:0, max:0.6, fps:16, times:4 }, function() {
Tween.get(info).wait(2000).call(function() {
info.animateBlink({ min:info.alpha, max:0, fps:16, times:4 }, function() {
if (i >= infos.length - 1) {
callBack && callBack.apply(mc, []);
}
});
});
});
});
});
};
mc.__tags = [];
mc.__tagRect = { x1:-450, y1:-80, x2:749, y2:800 };
mc.removeChild(mc.txt_item);
mc.txt_item = undefined;
mc.$showTag = function(callBack) {
var mc = this;
var gen = function(delay) {
var tag = new lib.p3_txt_item();
mc.__tags.push(tag);
tag.gotoAndStop(0);
tag.label.text = randomString(randomBetween(6,15), "\n");
tag.scaleX = tag.scaleY = randomBetween(0.7, 1);
tag.x = randomBetween(mc.__tagRect.x1, mc.__tagRect.x2, true);
tag.y = randomBetween(mc.__tagRect.y1 - 40, mc.__tagRect.y1 + 40, true);
tag.alpha = 0;
mc.addChildAt(tag);
Tween.get(tag).wait(delay || 0).to({ alpha:randomBetween(0.4, 0.6), y:randomBetween(mc.__tagRect.y2, mc.__tagRect.y2 + 80, true) }, randomBetween(900, 1300), Ease.linear).call(function() {
this.parent.removeChild(this);
mc.__tags.splice(mc.__tags.indexOf(this), 1);
gen();
}.bind(tag));
}.bind(this);
for (var i = 0; i < 42; i++) {
gen(i * 40);
}
};
mc.$reset = function() {
this.cube_progress1.bar.gotoAndStop(0);
this.cube_progress1.label.text = "0%";
this.cube_progress1.visible = false;
this.cube_progress1.bar.gotoAndStop(0);
this.cube_progress2.label.text = "0%";
this.cube_progress2.visible = false;
this.cube_progress2.bar.gotoAndStop(0);
this.__blocks.forEach(function(block, i) {
Tween.removeTweens(block);
if (block.parent) block.parent.removeChild(block);
block.alpha = 0;
block.gotoAndStop(0);
});
this.__cubeInfos.forEach(function(info) {
if (info.parent) info.parent.removeChild(info);
Tween.removeTweens(info);
info.label.text = "";
info.alpha = 0;
info.gotoAndStop(0);
});
this.__tags.forEach(function(tag) {
Tween.removeTweens(tag);
if (tag.parent) tag.parent.removeChild(tag);
});
this.__tags.length = 0;
this.line.gotoAndStop(0);
this.visible = false;
};
window.$process3 = mc;
//process4
mc = exportRoot.process4;
mc.line.gotoAndStop(0);
mc.tag_line.gotoAndStop(0);
mc.visible = false;
mc.__sites = [];
mc.sites.loopChild(function(child, i) {
if (child instanceof lib.p4_site_item) {
child.label.text = PROCESS_4_SITES[i] || "";
child.alpha = 0;
this.__sites.push(child);
}
}.bind(mc));
mc.__sites.forEach(function(child) {
if (child.parent) child.parent.removeChild(child);
});
mc.__tags = [];
mc.__tagMap = {};
mc.__tagRect = { x:0, y:0, width:330, height:34, gap:10 };
PROCESS_4_TAGS.forEach(function(str, i) {
var tag = this.tags["tag" + (i + 1)];
if (tag) {
this.__tagMap["tag" + (i + 1)] = tag;
}
}.bind(mc));
mc.tags.loopChild(function(child, i) {
if (child instanceof lib.p4_tag_item) {
child.$text = PROCESS_4_TAGS[i] || "";
child.label.text = child.$text;
child.$pos = { x:child.x, y:child.y };
child.$parent = child.parent;
child.label.color = "#1F5A75";
child.gotoAndStop(0);
child.$active = function(callBack) {
var ins = this;
this.$parent.addChild(this);
this.label.text = this.$text;
var opt = { frames:[ 0, 1 ], times:6 };
opt.tick = function() {
if (this.currentFrame == 1) {
this.label.color = "#8AF8F3";
} else {
this.label.color = "#1F5A75";
}
}
Tween.get(this).wait(400).call(function() {
ins.animateFrameBlink(opt, function() {
ins.label.animatePrintIn("COMPLETE", { fps:16, complete: function() {
callBack && callBack();
}.bind(this) });
}.bind(this));
}.bind(this));
};
this.__tags.push(child);
}
}.bind(mc));
mc.__tags.forEach(function(child) {
if (child.parent) child.parent.removeChild(child);
});
mc.$showTag = function(callBack) {
var mc = this;
mc.tag_line.playTo(-1);
var tags = mc.__tagMap;
//var delay = 300;
Tween.get(mc.tags).wait(600).call(function() {
tags.tag1.$active();
tags.tag2.$active();
});
Tween.get(mc.tags).wait(900).call(function() {
tags.tag3.$active();
});
Tween.get(mc.tags).wait(1000).call(function() {
tags.tag5.$active();
});
Tween.get(mc.tags).wait(1100).call(function() {
tags.tag4.$active();
tags.tag6.$active();
});
Tween.get(mc.tags).wait(1800).call(function() {
tags.tag7.$active();
});
Tween.get(mc.tags).wait(2000).call(function() {
tags.tag10.$active();
});
Tween.get(mc.tags).wait(2100).call(function() {
tags.tag8.$active();
tags.tag9.$active();
});
Tween.get(mc.tags).wait(2200).call(function() {
tags.tag11.$active();
});
Tween.get(mc.tags).wait(2700).call(function() {
tags.tag12.$active(function() {
callBack && callBack.apply(mc, []);
});
});
};
mc.sites.animate1.gotoAndStop(0);
mc.sites.animate2.gotoAndStop(0);
mc.$showSites = function(callBack) {
var mc = this;
var list = [].concat(mc.__sites);
list.shuffle();
list.forEach(function(child, i) {
mc.sites.addChild(child);
setTimeout(function() {
child.animateBlink({ min:0, max:1, times:4 }, function() {
if (i == list.length - 1) {
callBack && callBack.apply(mc, []);
}
});
}.bind(child), 80 * i);
});
setTimeout(function() {
mc.$startSiteScan();
}, 1400);
/*
setTimeout(function() {
mc.sites.animate1.playTo(-1, { loopTo:0, fps:18 });
}, 1300);
setTimeout(function() {
mc.sites.animate2.playTo(-1, { loopTo:0, fps:18 });
}, 2000);
*/
};
mc.$startSiteScan = function() {
var scan = this.sites.scan;
scan.x = -260;
Tween.get(scan, { loop:true }).wait(1000).to({ x:640 }, 6000, Ease.linear);
};
mc.$stopSiteScan = function() {
var scan = this.sites.scan;
Tween.removeTweens(scan);
scan.x = -260;
};
mc.$reset = function() {
this.line.gotoAndStop(0);
this.tag_line.gotoAndStop(0);
this.sites.animate1.gotoAndStop(0);
this.sites.animate2.gotoAndStop(0);
this.__sites.forEach(function(child) {
child.stopAnimate();
child.alpha = 0;
if (child.parent) child.parent.removeChild(child);
});
this.__tags.forEach(function(child) {
child.stopAnimate();
child.gotoAndStop(0);
child.label.color = "#1F5A75";
child.label.text = child.$text;
Tween.removeTweens(child);
if (child.parent) child.parent.removeChild(child);
});
Tween.removeTweens(this.tags);
this.$stopSiteScan();
this.visible = false;
};
window.$process4 = mc;
/////////////////////////////////////////
exportRoot.addEventListener("tick", window.rootRender);
writePhaseLog();
}
|
const btn = document.querySelector("#submit-btn");
const input = document.querySelector("#file");
const form = document.querySelector("#form");
const output = document.querySelector("#output");
const message = document.querySelector("#message");
const fileBtn = document.querySelector(".file-btn")
const fileReader = new FileReader();
const YOUR_API_KEY = "rfMeXLRjFVp3665m";
const URL = "https://api.textgears.com/spelling?";
input.addEventListener("change", ()=>{
fileBtn.innerText = input.files[0].name
})
form.addEventListener("submit", (event) => {
event.preventDefault();
if (input.files.length === 0) {
message.innerHTML = "No File Selected!";
message.classList.add("error")
return;
}
message.innerHTML = "";
const inputFile = input.files[0];
fileReader.readAsText(inputFile, "UTF-8");
fileReader.onload = async (event) => {
let value = event.target.result;
let cleanString = value.replace(/(\r\n|\n|\r)/gm, " ");
let result = cleanString.replaceAll(" ", "+");
try {
const data = await (
await fetch(URL + `key=${YOUR_API_KEY}&text=${result}&language=en-GB`)
).json();
const errors = data.response.errors;
const badBetterWords = {};
errors.forEach((error) => {
badBetterWords[error.bad] = error.better;
});
// Iterating Every Word
const words = cleanString.split(" ");
words.forEach((word) => {
const textBox = document.createElement("span");
const spanWord = document.createElement("span");
const spanSuggestionBox = document.createElement("span");
let isBad = false;
textBox.classList.add("text");
// For Bad Words
if (word in badBetterWords) {
// By default hide the suggestion box
spanWord.addEventListener("click", () => {
spanSuggestionBox.style.display = "block";
});
spanSuggestionBox.style.display = "none";
spanSuggestionBox.classList.add("suggestions");
isBad = true;
spanWord.classList.add("bad-word")
const ul = document.createElement("ul");
ul.addEventListener('mouseleave', ()=>{
spanSuggestionBox.style.display="none"
})
// Adding Suggestion
badBetterWords[word].forEach((betterWord) => {
const li = document.createElement("li");
li.addEventListener("click", (event) => {
spanWord.innerHTML = betterWord;
spanWord.classList.remove("bad-word")
spanSuggestionBox.remove();
});
li.innerText = betterWord;
ul.appendChild(li);
});
spanSuggestionBox.appendChild(ul);
}
spanWord.innerText = word;
textBox.appendChild(spanWord);
if (isBad) {
textBox.appendChild(spanSuggestionBox);
}
message.appendChild(textBox);
message.style.textAlign = "left"
message.classList.remove("error")
});
} catch (err) {
message.innerHTML = "Error while reading file!";
message.classList.add("error")
return;
}
// message.innerHTML = event.target.result
};
fileReader.onerror = (event) => {
message.innerHTML = "Error while reading file!";
message.classList.add("error")
};
});
|
const total = function sumMiles(miles){
let success = "hello runners!";
console.log(success);
};
|
import Vec2 from '../math/vec2';
import Spring from './spring';
/**
* An object representation of the Spring class for easy conversion to JSON.
*
* @typedef {object} StickAsObject
* @property {number} length The length of the stick
* @property {number} springConstant Always 0 for sticks
* @property {boolean | {x:number, y:number}} pinned This property indicates whether
* the stick is pinned or not
* @property {import('../physics').ObjectIdentifier[]} objects The indices of the attached objects
* @property {boolean} rotationLocked The variable inticating whether or not
* the attached objects are allowed to rotate freely
* @property {"stick"} type Indicates that the object is a stick
*/
/**
* Stick class for the physics engine
* Sticks are not strechable objects that do not collide
* with other objects but they can hold other objects on their ends
*
* @implements {Spring}
*/
class Stick extends Spring {
/**
* Creates a stick
*
* @param {number} length The length of the stick
*/
constructor(length) {
super(length, 0);
this.springConstant = 0;
}
/**
* Returns a copy of the spring
*
* @returns {Stick} The copy
*/
get copy() {
/** @type {Stick} */
const ret = Object.create(Stick.prototype);
ret.length = this.length;
ret.springConstant = this.springConstant;
if (typeof this.pinned === 'boolean') {
ret.pinned = this.pinned;
} else ret.pinned = { x: this.pinned.x, y: this.pinned.y };
ret.objects = this.objects;
ret.rotationLocked = this.rotationLocked;
ret.initialHeading = this.initialHeading;
ret.initialOrientations = [...this.initialOrientations];
ret.attachPoints = this.attachPoints.map((p) => p.copy);
ret.attachRotations = [...this.attachRotations];
ret.attachPositions = this.attachPositions.map((pos) => pos.copy);
return ret;
}
/**
* Updates the first attach point.
*
* @param {Vec2} newAttachPoint The new attach point to have on the first object
* @param {number} snapRadius The max radius where it snaps to the pos of the object
*/
updateAttachPoint0(newAttachPoint, snapRadius = 0) {
const isLocked = this.rotationLocked;
if (isLocked) this.unlockRotation();
this.attachPoints[0] = newAttachPoint.copy;
this.attachPositions[0] = this.objects[0].pos.copy;
this.attachRotations[0] = this.objects[0].rotation;
if (this.attachPoints[0].dist(this.attachPositions[0]) <= snapRadius) {
this.attachPoints[0] = this.attachPositions[0].copy;
}
this.length = this.getAsSegment().length;
if (isLocked) this.lockRotation();
}
/**
* Updates the second attach point.
*
* @param {Vec2} newAttachPoint The new attach point to have on the second object
* or on the pinpoint
* @param {number} snapRadius The max radius where it snaps to the pos of the object
*/
updateAttachPoint1(newAttachPoint, snapRadius = 0) {
const isLocked = this.rotationLocked;
if (isLocked) this.unlockRotation();
if (this.objects.length === 2) {
this.attachPoints[1] = newAttachPoint.copy;
this.attachPositions[1] = this.objects[1].pos.copy;
this.attachRotations[1] = this.objects[1].rotation;
if (this.attachPoints[1].dist(this.attachPositions[1]) <= snapRadius) {
this.attachPoints[1] = this.attachPositions[1].copy;
}
} else if (typeof this.pinned !== 'boolean') {
this.pinned = newAttachPoint.copy;
}
this.length = this.getAsSegment().length;
if (isLocked) this.lockRotation();
}
/**
* Updates the stick trough an elapsed time
*/
update() {
if (this.rotationLocked) this.arrangeOrientations();
let p1;
let p2;
if (this.pinned instanceof Object && 'x' in this.pinned && this.objects[0]) {
[p2, p1] = [this.pinned, this.objects[0]];
if (p1.m === 0) return;
const ps = this.points;
let dist = new Vec2(ps[1].x - ps[0].x, ps[1].y - ps[0].y);
dist.setMag(dist.length - this.length);
p1.move(dist);
dist = new Vec2(ps[1].x - ps[0].x, ps[1].y - ps[0].y);
dist.normalize();
const cp = ps[0];
const n = dist;
const b = p1;
const r = Vec2.sub(cp, b.pos);
// Relative velocity in collision point
const vRelInCP = Vec2.mult(b.velInPlace(cp), -1);
// Calculate impulse
let impulse = (1 / b.m);
impulse += Vec2.dot(
Vec2.crossScalarFirst(Vec2.cross(r, n) / b.am, r), n,
);
impulse = -(Vec2.dot(vRelInCP, n)) / impulse;
// Calculate post-collision velocity
const u = Vec2.sub(b.vel, Vec2.mult(n, impulse / b.m));
// Calculate post-collision angular velocity
const pAng = b.ang - (impulse * Vec2.cross(r, n)) / b.am;
p1.vel = u;
p1.ang = pAng;
const v = p1.vel;
v.rotate(-dist.heading);
if (this.rotationLocked && p1.m !== 0) {
const s = new Vec2(p2.x, p2.y);
const r2 = Vec2.sub(p1.pos, s);
const len = r2.length;
const am = len * len * p1.m + p1.am;
const ang = (p1.am * p1.ang + len * p1.m * v.y) / am;
v.y = ang * len;
p1.ang = ang;
}
v.rotate(dist.heading);
} else if (this.objects[0] && this.objects[1]) {
[p1, p2] = [this.objects[0], this.objects[1]];
let ps = this.points;
let dist = Vec2.sub(ps[0], ps[1]);
const dl = this.length - dist.length;
dist.setMag(1);
const b1 = p1;
const b2 = p2;
const m1 = b1.m === 0 ? Infinity : b1.m;
const m2 = b2.m === 0 ? Infinity : b2.m;
let move1;
let move2;
if (m1 !== Infinity && m2 !== Infinity) {
move1 = Vec2.mult(dist, (dl * m2) / (m1 + m2));
move2 = Vec2.mult(dist, (-dl * m1) / (m1 + m2));
} else if (m1 === Infinity && m2 !== Infinity) {
move1 = new Vec2(0, 0);
move2 = Vec2.mult(dist, -dl);
} else if (m1 !== Infinity && m2 === Infinity) {
move2 = new Vec2(0, 0);
move1 = Vec2.mult(dist, dl);
} else return;
p1.move(move1);
p2.move(move2);
ps = this.points;
dist = Vec2.sub(ps[1], ps[0]);
dist.normalize();
const n = dist;
const cp0 = ps[0];
const cp1 = ps[1];
const ang1 = b1.ang;
const ang2 = b2.ang;
const r1 = Vec2.sub(cp0, b1.pos);
const r2 = Vec2.sub(cp1, b2.pos);
const am1 = b1.m === 0 ? Infinity : b1.am;
const am2 = b2.m === 0 ? Infinity : b2.am;
// Effective velocities in the collision point
const v1InCP = b1.velInPlace(cp0);
const v2InCP = b2.velInPlace(cp1);
// Relative velocity in collision point
const vRelInCP = Vec2.sub(v2InCP, v1InCP);
// Calculate impulse
let impulse = (1 / m1) + (1 / m2);
impulse += Vec2.dot(
Vec2.crossScalarFirst(Vec2.cross(r1, n) / am1, r1), n,
);
impulse += Vec2.dot(
Vec2.crossScalarFirst(Vec2.cross(r2, n) / am2, r2), n,
);
impulse = -(Vec2.dot(vRelInCP, n)) / impulse;
// Calculate post-collision velocities
const u1 = Vec2.sub(b1.vel, Vec2.mult(n, impulse / m1));
const u2 = Vec2.add(b2.vel, Vec2.mult(n, impulse / m2));
// Calculate post-collision angular velocities
const pAng1 = ang1 - (impulse * Vec2.cross(r1, n)) / am1;
const pAng2 = ang2 + (impulse * Vec2.cross(r2, n)) / am2;
if (p1.m !== 0) {
p1.vel = u1;
p1.ang = pAng1;
} if (p2.m !== 0) {
p2.vel = u2;
p2.ang = pAng2;
}
const v1 = p1.vel;
const v2 = p2.vel;
v1.rotate(-dist.heading);
v2.rotate(-dist.heading);
if (this.rotationLocked && p1.m !== 0 && p2.m !== 0) {
const s = new Vec2(
p1.pos.x * p1.m + p2.pos.x * p2.m,
p1.pos.y * p1.m + p2.pos.y * p2.m,
);
s.div(p1.m + p2.m);
const len1 = Vec2.sub(p1.pos, s).length;
const len2 = Vec2.sub(p2.pos, s).length;
const am = len1 * len1 * p1.m
+ p1.am
+ len2 * len2 * p2.m
+ p2.am;
const sv = ((v1.y - v2.y) * len2) / (len1 + len2) + v2.y;
const ang = (p1.am * p1.ang
+ p2.am * p2.ang
+ len1 * p1.m * (v1.y - sv)
- len2 * p2.m * (v2.y - sv))
/ am;
v1.y = ang * len1 + sv;
v2.y = -ang * len2 + sv;
p1.ang = ang;
p2.ang = ang;
}
v1.rotate(dist.heading);
v2.rotate(dist.heading);
}
}
}
export default Stick;
|
const {Router} = require("express")
const Course = require('../models/course')
const { route } = require("./courses")
const router = Router()
function mapCartItems(cart)
{
//console.log(cart)
return cart.items.map(c=>({
...c.courseId._doc,
id: c.courseId.id,
count : c.count
}))
}
function computePrice(courses){
return courses.reduce((total,course)=>{
return total += course.price*course.count
},0)
}
router.post('/add',async (req,res)=>{
let course = await Course.findById(req.body.id)
await req.user.addToCart(course)
res.redirect('/card')
})
router.delete('/remove/:id',async(req,res)=>{
await req.user.removeFromCart(req.params.id)
const user = await req.user.populate('cart.items.courseId').execPopulate()
const courses = mapCartItems(user.cart)
const cart = {
courses, price: computePrice(courses)
}
res.status(200).json(cart)
})
router.get('/', async(req,res)=>{
let user = await req.user.populate('cart.items.courseId')
.execPopulate()
const courses = mapCartItems(user.cart)
res.render('card',{
title: "Корзина",
isCard: true,
courses: courses,
price: computePrice(courses)
})
})
module.exports=router
|
/**
* @author v.lugovsky
* created on 16.12.2015
*/
(function () {
'use strict';
angular.module('BlurAdmin.pages.app.setting', [
'BlurAdmin.pages.app.setting.language',
'BlurAdmin.pages.app.setting.user',
'BlurAdmin.pages.app.setting.supplier',
])
.config(routeConfig);
/** @ngInject */
function routeConfig($stateProvider) {
$stateProvider
.state('app.setting', {
url: '/setting',
template : '<ui-view></ui-view>',
abstract: true,
title: 'setting.main',
sidebarMeta: {
icon: 'ion-earth',
order: 100,
},
});
}
})();
|
const { workspace, Uri, languages } = require('vscode');
const path = require('path');
const { createFile, unlink } = require('fs-extra');
const { FIXTURES_PATH } = require('../utils');
suite('Error handling', function () {
test('Validator should bubble PHPCS execution errors', async function () {
const filePath = path.join(FIXTURES_PATH, `index${Math.floor(Math.random() * 3000)}.php`);
const fixtureUri = Uri.file(filePath);
await createFile(filePath);
const config = workspace.getConfiguration('phpSniffer', fixtureUri);
workspace.openTextDocument(fixtureUri);
const assertionPromise = new Promise((resolve) => {
const subscription = languages.onDidChangeDiagnostics(({ uris }) => {
const list = uris.map((uri) => uri.toString());
if (list.indexOf(fixtureUri.toString()) === -1) return;
// @todo Find some way to get error messages shown in VSCode UI.
subscription.dispose();
resolve();
});
});
await config.update('standard', 'ASD');
await assertionPromise;
Promise.all([
await config.update('standard', undefined),
await unlink(filePath),
]);
this.skip();
});
});
|
import { combineReducers } from 'redux';
import postList from './reducer_postList';
import postArticle from './reducer_postArticle';
export default combineReducers({
postList,
postArticle,
});
|
import React from "react";
class App extends React.Component{
state={
tasks:["make coffee","make notes","go for a jog"],
currInput:"",
}
render = () =>{
return (
<div>
<input type="text" onChange={(e)=>{
this.setState({currInput:e.currentTarget.value});
}}
onKeyDown={(e)=>{
if(e.key==="Enter"){
this.setState({
tasks:[...this.state.tasks,this.state.currInput],
currInput:""
})
}
}}
value={this.state.currInput} />
<ul>
{this.state.tasks.map((el)=>{
return <li>{el}</li>
})}
</ul>
</div>
);
}
}
export default App;
|
// The player character
HasPosition = {
init: function (x0, y0) {
this.x = x0
this.y = y0
},
draw: function () {
context.translate(this.x, this.y)
},
}
FacesDirection = {
init: function() {
this.facingright = true
},
}
LooksAhead = {
lookingat: function() {
var dx = (this.facingright ? 1 : - 1) * settings.sx / 10
return [this.x + dx, this.y + 40]
},
}
IsBlock = {
draw: function() {
size = 60
color = "blue"
context.beginPath()
context.moveTo(-size/4, 0)
context.lineTo(size/4, 0)
context.lineTo(size/4, size)
context.lineTo(-size/4, size)
context.closePath()
context.save()
context.globalAlpha = 0.5
context.fillStyle = color
context.fill()
context.restore()
context.strokeStyle = color
context.stroke()
context.beginPath()
context.arc(0, 0, 3, 0, 6.3)
context.fillStyle = "white"
context.fill()
},
}
// Player character state components
IsState = {
enter: function () {
},
exit: function () {
},
think: function () {
},
draw: function () {
},
move: function () {
},
}
IsLaunch = {
init: function (vx0, vy0) {
this.vx0 = vx0 || 0
this.vy0 = vy0 || 0
},
enter: function () {
this.vx = (this.facingright ? 1 : -1) * this.state.vx0
this.vy = this.state.vy0
},
}
CanRun = {
init: function (vx0) {
this.vx0 = vx0 || 0
},
enter: function () {
this.vx = 0
},
move: function (d) {
this.vx = this.state.vx0 * d
if (d > 0) this.facingright = true
if (d < 0) this.facingright = false
},
think: function (dt) {
this.x += this.vx * dt
},
}
AboutFace = {
enter: function () {
this.facingright = !this.facingright
},
}
Earthbound = {
enter: function () {
this.y = 0
this.vy = 0
},
}
ArcMotion = {
init: function (g) {
this.g = g || 400
},
think: function (dt) {
this.vy -= dt * this.state.g
this.x += this.vx * dt
this.y += this.vy * dt
},
}
LandsAtGround = {
think: function (dt) {
if (this.y < 0) {
this.nextstate = YouStates.stand
}
},
}
// Player character states
YouStates = {
stand: UFX.Thing()
.addcomp(IsState)
.addcomp(Earthbound)
.addcomp(CanRun, mechanics.runvx)
.addcomp(IsBlock)
,
jump: UFX.Thing()
.addcomp(IsState)
.addcomp(IsLaunch, 40, 200)
.addcomp(ArcMotion)
.addcomp(LandsAtGround)
.addcomp(IsBlock)
,
turn: UFX.Thing()
.addcomp(IsState)
.addcomp(AboutFace)
.addcomp(IsLaunch, mechanics.turnvx, mechanics.turnvy)
.addcomp(ArcMotion)
.addcomp(LandsAtGround)
.addcomp(IsBlock)
,
}
HasStates = {
init: function (state0) {
this.state = this.state0 = state0
this.nextstate = null
this.state.enter.apply(this)
},
draw: function () {
this.state.draw.apply(this, arguments)
},
think: function () {
this.state.think.apply(this, arguments)
if (this.nextstate) {
this.state.exit.apply(this)
this.state = this.nextstate
this.state.enter.apply(this)
this.nextstate = null
}
},
move: function () {
this.state.move.apply(this, arguments)
},
}
var you = UFX.Thing().
addcomp(HasPosition, 0, 0).
addcomp(FacesDirection, true).
addcomp(LooksAhead).
addcomp(HasStates, YouStates.stand)
|
import React, { Component } from "react";
import {
Route,
Router
} from "react-router-dom";
import "./css/App.css";
import Search from "./Search";
import Results from "./Results";
import history from "./history";
class App extends Component {
constructor(props) {
super(props);
this.state = {
weatherData: ""
}
this.updateWeather = this.updateWeather.bind(this);
}
updateWeather(jsonData) {
console.log(jsonData);
this.setState({
weatherData: jsonData
});
}
render() {
return (
<Router history={history}>
<div className="App">
<Route exact path="/" render={(props) => <Search updateWeather={this.updateWeather}/>}/>
<Route path="/results" render={(props) => <Results weatherInfo={this.state.weatherData}/>}/>
</div>
</Router>
);
}
}
export default App;
|
define(['app/svg-canvas', 'app/utils'], function(SVGCanvas, Utils) {
Painter = {};
Painter.drawCircle = function(svg, cx, cy, r, style) {
var node = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
node.setAttribute('cx', cx);
node.setAttribute('cy', cy);
node.setAttribute('r', r);
var fill = (style && style['fill']) ? style['fill'] : Utils.settings.fillColor;
var stroke = (style && style['stroke']) ? style['stroke'] : Utils.settings.strokeColor;
var strokeWidth = (style && style['stroke-width']) ? style['stroke-width'] : '1';
node.setAttribute('fill', fill);
node.setAttribute('stroke', stroke);
node.setAttribute('stroke-width', strokeWidth);
if (style && style['fill-opacity']) {
node.setAttribute('fill-opacity', style['fill-opacity']);
}
svg.appendChild(node);
return node;
}
Painter.drawLine = function(svg, x1, y1, x2, y2, style) {
var node = document.createElementNS('http://www.w3.org/2000/svg', 'line');
node.setAttribute('x1', x1);
node.setAttribute('y1', y1);
node.setAttribute('x2', x2);
node.setAttribute('y2', y2);
var stroke = (style && style['stroke']) ? style['stroke'] : Utils.settings.strokeColor;
var strokeWidth = (style && style['stroke-width']) ? style['stroke-width'] : '1';
node.setAttribute('stroke', stroke);
node.setAttribute('stroke-width', strokeWidth);
svg.appendChild(node);
return node;
}
Painter.drawArc = function(svg, sx, sy, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, ex, ey, style) {
var node = document.createElementNS('http://www.w3.org/2000/svg', 'path');
var pathStr = 'M' + sx + ',' + sy + ' A' + rx + ',' + ry + ' '
+ xAxisRotation + ' '
+ (largeArcFlag?'1':'0') + ','
+ (sweepFlag?'1':'0') + ' '
+ ex + ',' + ey;
node.setAttribute('d', pathStr);
var fill = (style && style['fill']) ? style['fill'] : 'none';
var stroke = (style && style['stroke']) ? style['stroke'] : Utils.settings.strokeColor;
var strokeWidth = (style && style['stroke-width']) ? style['stroke-width'] : '1';
node.setAttribute('fill', fill);
node.setAttribute('stroke', stroke);
node.setAttribute('stroke-width', strokeWidth);
svg.appendChild(node);
return node;
}
Painter.drawDonus = function(svg, cx, cy, innerRadius, outerRadius, style) {
var pathStr = 'M ' + cx + ', ' + cy + ' '
+ 'm 0, -' + outerRadius + ' '
+ 'a ' + outerRadius + ', ' + outerRadius + ', 0, 1, 0, 1, 0 '
+ 'Z '
+ 'm 0 ' + (outerRadius - innerRadius) + ' '
+ 'a ' + innerRadius + ', ' + innerRadius + ', 0, 1, 1, -1, 0 '
+ 'Z ';
var node = document.createElementNS('http://www.w3.org/2000/svg', 'path');
node.setAttribute('d', pathStr);
var fill = (style && style['fill']) ? style['fill'] : 'none';
var stroke = (style && style['stroke']) ? style['stroke'] : Utils.settings.strokeColor;
var strokeWidth = (style && style['stroke-width']) ? style['stroke-width'] : '1';
node.setAttribute('fill', fill);
node.setAttribute('stroke', stroke);
node.setAttribute('stroke-width', strokeWidth);
svg.appendChild(node);
return node;
}
Painter.drawDonusArc = function(svg, centerX, centerY, innerRadius, outerRadius, startAngle, endAngle, style) {
var ax = outerRadius * Math.cos(startAngle) + centerX;
var ay = outerRadius * Math.sin(startAngle) + centerY;
var bx = outerRadius * Math.cos(endAngle) + centerX;
var by = outerRadius * Math.sin(endAngle) + centerY;
var cx = innerRadius * Math.cos(endAngle) + centerX;
var cy = innerRadius * Math.sin(endAngle) + centerY;
var dx = innerRadius * Math.cos(startAngle) + centerX;
var dy = innerRadius * Math.sin(startAngle) + centerY;
var pathStr = 'M ' + ax + ', ' + ay + ' '
+ 'A ' + outerRadius + ', ' + outerRadius + ' 0, 0, 1, ' + bx + ',' + by + ' '
+ 'L ' + cx + ',' + cy
+ 'A ' + innerRadius + ', ' + innerRadius + ' 0, 1, 1, ' + dx + ',' + dy + ' '
+ 'Z ';
var node = document.createElementNS('http://www.w3.org/2000/svg', 'path');
node.setAttribute('d', pathStr);
var fill = (style && style['fill']) ? style['fill'] : 'none';
var stroke = (style && style['stroke']) ? style['stroke'] : Utils.settings.strokeColor;
var strokeWidth = (style && style['stroke-width']) ? style['stroke-width'] : '1';
node.setAttribute('fill', fill);
node.setAttribute('stroke', stroke);
node.setAttribute('stroke-width', strokeWidth);
svg.appendChild(node);
return node;
}
Painter.getEllipseArcString = function(sx, sy, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, ex, ey, isContinue) {
var pathStr = ' A' + rx + ',' + ry + ' '
+ xAxisRotation + ' '
+ (largeArcFlag?'1':'0') + ','
+ (sweepFlag?'1':'0') + ' '
+ ex + ',' + ey;
if (!isContinue) {
pathStr = 'M' + sx + ',' + sy + pathStr;
}
return pathStr;
}
Painter.getCircleArcString = function(centerX, centerY, startAngle, endAngle, radius, isContinue) {
var ax = radius * Math.cos(startAngle) + centerX;
var ay = radius * Math.sin(startAngle) + centerY;
var bx = radius * Math.cos(endAngle) + centerX;
var by = radius * Math.sin(endAngle) + centerY;
var largeArcFlag = startAngle < endAngle ? 0 : 1;
var pathStr = ' A' + radius + ',' + radius + ' 0 ' + largeArcFlag + ' 1 '
+ bx + ',' + by;
if (!isContinue) {
pathStr = 'M' + ax + ',' + ay + pathStr;
}
return pathStr;
}
Painter.drawPath = function(svg, pathStr, style) {
var node = document.createElementNS('http://www.w3.org/2000/svg', 'path');
node.setAttribute('d', pathStr);
var fill = (style && style['fill']) ? style['fill'] : Utils.settings.fillColor;
var stroke = (style && style['stroke']) ? style['stroke'] : Utils.settings.strokeColor;
var strokeWidth = (style && style['stroke-width']) ? style['stroke-width'] : '1';
node.setAttribute('fill', fill);
node.setAttribute('stroke', stroke);
node.setAttribute('stroke-width', strokeWidth);
svg.appendChild(node);
return node;
}
return Painter;
});
|
/* wrapper for tweenlite */
define('tween', [], function () {
return TweenLite;
});
|
var passport = require('passport');
/**
* Expose the "Authentication" Controller.
*/
module.exports = new AuthenticationController;
/**
* Constructor for the AuthenticationController.
* @constructor
*/
function AuthenticationController() {}
/**
* Makes a request to Google for authentication with the OAuth 2.0 protocol.
* GET /auth/google
*/
AuthenticationController.prototype.requestGoogleAuthentication =
passport.authenticate('google', {
scope: [
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
]
});
/**
* Injects the Passport middleware into the Google OAuth 2.0 response.
* GET /auth/google/callback
*/
AuthenticationController.prototype.authenticateWithGoogle =
passport.authenticate('google', {
failureFlash: true,
failureRedirect: '/login'
});
/**
* Handles Google OAuth 2.0 Response after the passport middleware is processed.
* Typically sets the "loggedIn" session variable to true, and redirects back to
* the home page.
* GET /auth/google/callback
* @param {http.IncomingMessage} req Node/Express request object.
* @param {http.ServerResponse} res Node/Express response object.
*/
AuthenticationController.prototype.handleGoogleResponse = function(req, res) {
var session = req.session;
if (session.passport.user) {
session.loggedIn = true;
}
res.redirect('/');
};
/**
* Logs the user out.
* If there is a session, it will be regenerated with a clean session.
* @param {http.IncomingMessage} req Node/Express request object.
* @param {http.ServerResponse} res Node/Express response object.
*/
AuthenticationController.prototype.logout = function(req, res) {
// Clear the user object.
res.locals.user = {};
// Removes/clears the passport object from the session.
req.logout();
// Clear the session and generate a new one.
var session = req.session;
session.loggedIn = false;
session.regenerate(function(err) {
res.redirect('/');
});
};
|
import Axios from 'axios';
import {useSelector, useDispatch} from 'react-redux';
export function TransaksiProduct(user, total) {
const dispatch = useDispatch();
var data = user;
var sukses = false
data.point = user.point - total
if(total >= user.point)
{
sukses = false
}else{
Axios.put(`http://10.0.2.2:3004/users/${user.id}`, data)
.then((res) => {
console.log('sukses');
dispatch({type: 'SET_DATA_USER', value: user});
sukses = true
});
}
return sukses
}
|
/**
* Created by uzysjung on 15. 7. 9..
*/
'use strict';
const ApiController = require('../controllers/api');
const ApiValidate = require('../validations/api');
const middleware = require('../middleware/userInfo');
module.exports = function () {
return [
{
method: 'GET',
path: '/api/github/user/{userID}',
config : {
description: 'ABTestConfig channels',
notes: 'API Fetch Channels by service_id',
tags :['api'],
auth : false,
handler: ApiController.github,
validate : ApiValidate.github
}
},
{
method: 'GET',
path: '/api/authInfo',
config : {
description: 'api Authorization Information',
notes: 'Role , Email ',
tags :['api'], //you must put in 'api' in order to use Swagger-UI.
pre : [{ method:middleware.authUserInfo , assign: 'authInfo' }],
handler: ApiController.authInfo,
validate: ApiValidate.authInfo
}
},
];
}();
|
export const setTossups = (tossups) => ({
type: 'SET_TOSSUPS',
tossups
});
export const toggleLoading = () => ({
type: 'TOGGLE_LOADING'
});
|
export { Provider } from './Provider'
export { reducers } from './reducer'
export { default as useGetter } from './useGetter'
export { default as useDispatch } from './useDispatch'
export { default as connect } from './connect'
export { default as getStore } from './store'
export { subscribe } from './subscriber'
|
/******************************************************************************
*
* PROJECT: Flynax Classifieds Software
* VERSION: 4.1.0
* LISENSE: FL43K5653W2I - http://www.flynax.com/license-agreement.html
* PRODUCT: Real Estate Classifieds
* DOMAIN: avisos.com.bo
* FILE: JQUERY.GEO_AUTOCOMPLETE.JS
*
* This script is a commercial software and any kind of using it must be
* coordinate with Flynax Owners Team and be agree to Flynax License Agreement
*
* This block may not be removed from this file or any other files with out
* permission of Flynax respective owners.
*
* Copyrights Flynax Classifieds Software | 2013
* http://www.flynax.com/
*
******************************************************************************/
/**
*
* autocomplete plugin
*
* @package jQuery
*
**/
(function($) {
$.fn.vsGeoAutoComplete = function(options){
options = jQuery.extend({
type: '*',
id: false,
field: false
},options)
var call = false;
var store = new Array;
var query = '';
var obj = this;
var set = false;
var set_hidden = false;
var cur_item = 0;
var total = 0;
var interface = '<div id="vs_geo_interface" class="geo_autocomplete hborder"></div>';
var save_pos = 0;
var key_enter = 13;
var key_down = 40;
var key_up = 38;
var poss = 0;
var timer = false;
$('#vs_geo_interface').remove();
/* form submit handler */
$(obj).attr('autocomplete', 'off').focus(function(){
if (cur_item != 0)
{
$('form').submit(function(){
return false;
});
}
}).focusout(function(){
$('form').submit(function(){
this.submit();
});
});
$(obj).unbind('keyup').bind('keyup', function(e){
var el = $(this);
clearTimeout(timer);
timer = setTimeout(function(){
request(e, el);
}, 500);
});
/* key handler */
$(obj).bind('keyup click', function(e){
if ( e.keyCode == key_enter )
{
if (cur_item != 0)
{
location.href = geo_clean_url.replace('[geo_url]', $('#ac_item_'+cur_item).attr('abbr'));
}
}
else if ( e.keyCode == key_down )
{
if ( cur_item < total && $('#vs_geo_interface').css('display') == 'block')
{
cur_item++;
poss += 24;
drow();
}
}
else if ( e.keyCode == key_up && $('#vs_geo_interface').css('display') == 'block' )
{
if (cur_item > 1)
{
cur_item--;
poss -= 24;
drow('up');
}
}
});
var request = function(e, el){
if( (query != el.val() && e.keyCode != key_enter) || (e.keyCode == key_down && cur_item == 0) || e.type == 'click' )
{
if ( el.val().length < 3 )
{
$('#vs_geo_interface').hide();
return false;
}
/* build interface */
if ( !set )
{
$(obj).after(interface);
var obj_margin = $(obj).css('margin-left');
var obj_poss = $(obj).position();
var obj_width = $(obj).width();
width_diff = $.browser.msie ? 20 : 19;
$('#vs_geo_interface').css({left: obj_poss.left, top: obj_poss.top}).css('margin-left', obj_margin);
set = true;
}
if ( e.keyCode != key_down )
{
cur_item = 0;
}
/* do complete */
$(obj).addClass('geo_autocomplete_load');
if( call !== false )
{
call.abort();
}
call = $.getJSON(ac_geo_php, {str: el.val(), lang: rlLang}, function(response){
if( response != '' && response != null )
{
store = response;
var content = '<ul>';
var index = 0;
var query_arr = query.split(' ');
for ( var i = 0; i < response.length; i++ )
{
var out = response[i]['name'];
for ( var it = 0; it < query_arr.length; it++ )
{
if ( query_arr[it] != '' && query_arr[it].toLowerCase() != 'b' )
{
if ( response[i]['name'].toLowerCase().indexOf(query_arr[it].toLowerCase()) >= 0 )
{
var replace = '';
var ix = response[i]['name'].toLowerCase().indexOf(query_arr[it].toLowerCase());
for ( var j = 0; j< query_arr[it].length; j++ )
{
if ( response[i]['name'][ix] != query_arr[it][j] )
{
replace += query_arr[it].charAt(j).toUpperCase();
}
else
{
replace += query_arr[it].charAt(j);
}
ix++;
}
var search = new RegExp(query_arr[it], 'gi');
out = out.replace(search, '<b>'+replace+'</b>' );
}
}
}
if ( replace != '' )
{
index++;
content += '<li class="item" abbr="'+response[i]['path']+'" id="ac_item_'+index+'">'+out+'</li>';
}
}
content += '</ul>';
total = index;
$('#vs_geo_interface').html(content);
$('#vs_geo_interface').show();
$('#vs_geo_interface div:not(.ac_header)').click(function(){
// clear save position
save_pos = poss = 0;
});
$('#vs_geo_interface li.item').click(function(){
location.href = geo_clean_url.replace('[geo_url]', $(this).attr('abbr'));
});
$('#vs_geo_interface li').mouseover(function(){
$('#vs_geo_interface li').removeClass('highlight');
el.addClass('highlight');
});
$('#vs_geo_interface li').mouseout(function(){
$('#vs_geo_interface li').removeClass('highlight');
});
$('body').click(function(){
$('#vs_geo_interface').hide();
// clear save position
save_pos = poss = 0;
});
}
else
{
$('#vs_geo_interface').hide();
}
$(obj).removeClass('geo_autocomplete_load');
});
query = el.val();
}
};
function drow(direction)
{
$('#vs_geo_interface li').removeClass('highlight');
$('#ac_item_'+cur_item).addClass('highlight');
$('#vs_geo_interface').animate({scrollTop:poss-48}, 100);
}
}
})(jQuery);
|
// import React from "react";
// import { AppContext } from "../App/App";
// export const AppContextHOC = (Component) =>
// class extends React.Component {
// render() {
// return (
// <AppContext.Consumer>
// {(context) => <Component {...this.props} {...context} />}
// </AppContext.Consumer>
// );
// }
// };
|
import Vuesax from "vuesax";
import "vuesax/dist/vuesax.css";
const opts = {
// theme: {
// dark: false,
// },
// icons: {
// iconfont: "md" || "fa",
// },
};
export default new Vuesax(opts);
|
import React from 'react';
import {
Text,
StyleSheet,
Image,
View,
TouchableOpacity,
Animated,
Dimensions,
ScrollView
} from 'react-native'
import Products from './products'
import Blogs from './blogs'
import Shop from './shop'
const { width } = Dimensions.get('window');
export default class Navbar extends React.Component{
state = {
active: 0,
xTabPro: 0,
xTabIns: 0,
xTabShop: 0,
translateX: new Animated.Value(0),
translateXTabProducts: new Animated.Value(0),
translateXTabBlogs: new Animated.Value(width),
translateXTabShop: new Animated.Value(953),
translateY: -1000,
};
handleSlide = type => {
let {
active,
translateX,
translateXTabProducts,
translateXTabBlogs,
translateXTabShop
} = this.state;
Animated.spring(translateX, {
toValue: type,
duration: 2000,
useNativeDriver: false,
}).start();
if (active === 0) {
Animated.parallel([
Animated.spring(translateXTabProducts, {
toValue: 0,
duration: 2000,
useNativeDriver: false,
}).start(),
Animated.spring(translateXTabBlogs, {
toValue: width,
duration: 2000,
useNativeDriver: false,
}).start(),
Animated.spring(translateXTabShop, {
toValue: width + width,
duration: 2000,
useNativeDriver: false,
}).start()
]);
} else if (active === 1){
Animated.parallel([
Animated.spring(translateXTabProducts, {
toValue: -width ,
duration: 2000,
useNativeDriver: false,
}).start(),
Animated.spring(translateXTabShop, {
toValue: width,
duration: 2000,
useNativeDriver: false,
}).start(),
Animated.spring(translateXTabBlogs, {
toValue: 0,
duration: 2000,
useNativeDriver: false,
}).start(),
]);
} else if (active === 2){
Animated.parallel([
Animated.spring(translateXTabProducts, {
toValue: -width - width,
duration: 2000,
useNativeDriver: false,
}).start(),
Animated.spring(translateXTabBlogs, {
toValue: -width,
duration: 2000,
useNativeDriver: false,
}).start(),
Animated.spring(translateXTabShop, {
toValue: 0,
duration: 2000,
useNativeDriver: false,
}).start()
]);
}
}
styles = StyleSheet.create({
container:{
flexDirection:"column",
height: 516
},
headerItem: {
marginLeft: 20,
marginRight: 20
},
navbar: {
flexDirection: "row",
justifyContent: "space-between",
borderBottomWidth: 0.2,
height: 35
},
navItem: {
flexDirection: "row",
height: 35,
width: 115,
},
navItemTitle: {
flex: 4,
fontSize: 15,
alignItems: "center",
},
navItem__text: {
fontWeight: "bold",
},
})
render(){
let {
active,
xTabPro,
xTabIns,
xTabShop,
translateX,
translateXTabProducts,
translateXTabBlogs,
translateXTabShop,
translateY,
translateZ
} = this.state;
return(
<View style={this.styles.container}>
<View style={[this.styles.navbar, this.styles.headerItem]}>
<View style={this.styles.navItem}>
<TouchableOpacity
style={this.styles.navItemTitle}
onLayout={event => this.setState({ xTabPro: event.nativeEvent.layout.x})}
onPress={() => this.setState({ active: 0 }, () => this.handleSlide(xTabPro))}
style={{
borderBottomWidth: active === 0 ? 3 : 0,
fontWeight: "bold",
flex: 4,
fontSize: 15,
alignItems: "center",}}
>
<Animated.View>
<Text style={this.styles.navItem__text} >Sản phẩm</Text>
</Animated.View>
</TouchableOpacity>
</View>
<View style={this.styles.navItem}>
<TouchableOpacity
style={this.styles.navItemTitle}
onLayout={event => this.setState({ xTabIns: event.nativeEvent.layout.x })}
onPress={() => this.setState({ active: 1 }, () => this.handleSlide(xTabIns))}
style={{
borderBottomWidth: active === 1 ? 3 : 0,
fontWeight: "bold",
flex: 4,
fontSize: 15,
alignItems: "center",
}}
>
<Animated.View>
<Text style={this.styles.navItem__text}>Blogs</Text>
</Animated.View>
</TouchableOpacity>
</View>
<View style={this.styles.navItem}>
<TouchableOpacity
style={this.styles.navItemTitle}
onLayout={event => this.setState({ xTabShop: event.nativeEvent.layout.x })}
onPress={() => this.setState({ active: 2 }, () => this.handleSlide(xTabShop))}
style={{
borderBottomWidth: active === 2 ? 3 : 0,
fontWeight: "bold",
flex: 4,
fontSize: 15,
alignItems: "center",
}}
>
<Animated.View>
<Text style={this.styles.navItem__text}>Thông tin</Text>
</Animated.View>
</TouchableOpacity>
</View>
</View>
<ScrollView scrollEnabled={false} keyboardShouldPersistTaps={"always"}>
<Animated.View
style={{transform: [{translateX: translateXTabProducts}]}} onLayout={event => this.setState({translateY: 0})}>
<Products></Products>
</Animated.View>
<Animated.View style={{transform: [{ translateX: translateXTabBlogs }, {translateY: -475}]}}>
<Blogs></Blogs>
</Animated.View>
<Animated.View style={{transform: [{ translateX: translateXTabShop }, {translateY: -953}]}}>
<Shop></Shop>
</Animated.View>
</ScrollView>
</View>
)
}
}
|
import React from "react";
function Footer(props) {
return (
<footer>
<p>
<a
href={props.href}
className="text-primary"
target="_blank"
rel="noopener noreferrer"
>
Recipe source
</a>
</p>
<p>
<a
href="https://www.themealdb.com/api.php"
className="text-secondary"
target="_blank"
rel="noopener noreferrer"
>
API source
</a>
</p>
</footer>
);
}
export default Footer;
|
import React, {useEffect, useMemo} from "react";
import {useAsyncDebounce, useFilters, usePagination, useSortBy, useTable} from "react-table";
import ReactPaginate from "react-paginate";
import Form from "react-bootstrap/Form";
import BTable from "react-bootstrap/Table";
function DefaultColumnFilter({column: { filterValue, setFilter }}) {
return (
<Form.Control value={filterValue || ''} onChange={e => setFilter(e.target.value || undefined)}/>
)
}
function Sorting({isSortedDesc}) {
return isSortedDesc
? (
<svg width="1em" height="1em" viewBox="0 0 16 16" className="bi bi-sort-down"
fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fillRule="evenodd"
d="M3 2a.5.5 0 0 1 .5.5v10a.5.5 0 0 1-1 0v-10A.5.5 0 0 1 3 2z"/>
<path fillRule="evenodd"
d="M5.354 10.146a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708 0l-2-2a.5.5 0 0 1 .708-.708L3 11.793l1.646-1.647a.5.5 0 0 1 .708 0zM7 9.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5zm0-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm0 9a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 0 1h-1a.5.5 0 0 1-.5-.5z"/>
</svg>
)
: (
<svg width="1em" height="1em" viewBox="0 0 16 16" className="bi bi-sort-up-alt" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fillRule="evenodd" d="M3 14a.5.5 0 0 0 .5-.5v-10a.5.5 0 0 0-1 0v10a.5.5 0 0 0 .5.5z"/>
<path fillRule="evenodd" d="M5.354 5.854a.5.5 0 0 0 0-.708l-2-2a.5.5 0 0 0-.708 0l-2 2a.5.5 0 1 0 .708.708L3 4.207l1.646 1.647a.5.5 0 0 0 .708 0zM7 6.5a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 0-1h-3a.5.5 0 0 0-.5.5zm0 3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 0-1h-5a.5.5 0 0 0-.5.5zm0 3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 0-1h-7a.5.5 0 0 0-.5.5zm0-9a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 0-1h-1a.5.5 0 0 0-.5.5z"/>
</svg>
);
}
function Table({columns, data, fetchData, loading, pageCount: controlledPageCount, total,}) {
const defaultColumn = useMemo(
() => ({
Filter: DefaultColumnFilter,
}),
[]
)
const defaultPropGetter = () => ({})
const {
getTableProps,
getTableBodyProps,
getHeaderProps = defaultPropGetter,
getColumnProps = defaultPropGetter,
headerGroups,
prepareRow,
page,
pageCount,
gotoPage,
setPageSize,
state: { pageIndex, pageSize, sortBy, filters },
} = useTable(
{
columns,
data,
defaultColumn,
initialState: { pageIndex: 0 },
manualPagination: true,
manualFilters: true,
manualSortBy: true,
pageCount: controlledPageCount,
},
useFilters,
useSortBy,
usePagination
)
const onFetchDataDebounced = useAsyncDebounce(fetchData, 500);
useEffect(() => {
onFetchDataDebounced({ pageIndex, pageSize, sortBy, filters })
}, [onFetchDataDebounced, pageIndex, pageSize, sortBy, filters])
return (
<div className="container">
<br/>
<br/>
<div className="row justify-content-center">
<div className="col-md-6">
<ReactPaginate
previousLabel={'<'}
nextLabel={'>'}
breakLabel={'...'}
pageClassName={'page-item'}
pageLinkClassName={'page-link'}
previousClassName={'page-item'}
previousLinkClassName={'page-link'}
nextClassName={'page-item'}
nextLinkClassName={'page-link'}
breakClassName={'page-item'}
breakLinkClassName={'page-link'}
pageCount={pageCount}
marginPagesDisplayed={2}
pageRangeDisplayed={5}
onPageChange={(data) => gotoPage(data.selected)}
containerClassName={'pagination'}
subContainerClassName={'pages pagination'}
activeClassName={'active'}
/>
</div>
<div className="col-md-4">
{loading ? (
<div className="spinner-border" role="status">
<span className="sr-only">Loading...</span>
</div>
) : (
<div>Showing <strong>{pageSize}</strong> of <strong>{total}</strong></div>
)}
</div>
<div className="col-md-2">
<Form.Control
as="select"
size="md"
value={pageSize}
onChange={e => setPageSize(Number(e.target.value))}
>
{[10, 20].map(pageSize => (
<option key={pageSize} value={pageSize}>Show {pageSize}</option>
))}
</Form.Control>
</div>
</div>
<div className="row justify-content-center">
<div className="col-md-12">
<BTable striped bordered hover size="sm" {...getTableProps()}>
<thead>
{headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map(column => (
<th {...column.getHeaderProps([
{className: 'th-' + column.id,},
getColumnProps(column),
getHeaderProps(column),
column.getSortByToggleProps()
])}>
{column.render('Header')}
{column.canFilter ? column.render('Filter') : null}
<span>
{column.isSorted ? <Sorting isSortedDesc={column.isSortedDesc}/> : ''}
</span>
</th>
))}
</tr>
))}
</thead>
<tbody {...getTableBodyProps()}>
{page.map(row => {
prepareRow(row);
return (
<tr {...row.getRowProps()}>
{row.cells.map(cell => {
return (
<td {...cell.getCellProps()}>
{cell.render('Cell')}
</td>
)
})}
</tr>
)
})}
</tbody>
</BTable>
</div>
</div>
</div>
)
}
export default Table;
|
;
(function setupPrototypes() {
Date.prototype.addDays = function(days) {
this.setDate(this.getDate() + parseInt(days));
return this;
};
Date.prototype.getFormattedDate = function() {
var date = this;
var year = date.getFullYear();
var month = (1 + date.getMonth()).toString();
month = month.length > 1 ? month : '0' + month;
var day = date.getDate().toString();
day = day.length > 1 ? day : '0' + day;
return day + '.' + month + '.' + year;
}
})();
(function setupNamespaces() {
window.app = {
isLocalhost: (function() {
return !!location.host.match(/localhost/);
})(),
database: {}
};
})();
(function setupAngular() {
if (window.angular) {
// Import
var database = window.app.database;
var angularApp = angular
.module('app', ['ui.router'])
.run(
['$rootScope', '$state', '$stateParams',
function($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
}
]
)
// Shared across controllers
.factory("user", function() {
var today = new Date().getFormattedDate();
return {
// page 1
name: 'Jane',
dueDate: today,
parent: 'parent1',
workStatus: 'employed',
weekSalary: 'nothing',
weeks: '',
firstMaternityDate: today,
isFirstParent: function() {
return this.parent === 'parent1';
}
};
})
.directive('jqdatepicker', function() {
// jQuery UI Calendar Danish theme with Angular
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attrs, ctrl) {
$(element).datepicker({
showWeek: true,
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: '',
onSelect: function(date) {
ctrl.$setViewValue(date);
ctrl.$render();
scope.$apply();
}
});
}
};
})
.config(['$urlRouterProvider', '$stateProvider', '$locationProvider', '$compileProvider', function($urlRouterProvider, $stateProvider, $locationProvider, $compileProvider) {
//if (!window.app.isLocalhost ) {
// $compileProvider.debugInfoEnabled(false); // better perfomance
//}
$urlRouterProvider.otherwise('/');
// $locationProvider.html5Mode(true); // mimic postback url even though it is a SPA
var reset = function(user) {
user.timelineRemainingWeeksAndDays = '';
}
$stateProvider
.state('wizard1', {
url: '/',
templateUrl: 'templates/wizard/wizard-layout.html',
controller: function($scope, user) {
reset(user);
$scope.isLocalhost = window.app.isLocalhost;
$scope.page = 'templates/wizard/wizard1-page.html';
$scope.model = {
user: user
};
$scope.parentChange = function(value) {
if (value === 'parent1') {
user.name = "Jane";
}
if (value === 'parent2') {
user.name = "Jim";
}
};
$scope.nextPage = function() {
if (user.dueDate) {
var parts = user.dueDate.split('.');
var date = new Date(parts[2], parts[0] - 1, parts[1]);
date.addDays(1);
user.firstMaternityDate = date.getFormattedDate();
}
};
}
})
.state('wizard2', {
url: '/wizard2',
templateUrl: 'templates/wizard/wizard-layout.html',
controller: function($scope, user) {
$scope.isLocalhost = window.app.isLocalhost;
$scope.page = 'templates/wizard/wizard2-page.html';
$scope.model = {
user: user
};
$scope.prevPage = function() {};
$scope.nextPage = function() {};
}
});
}]);
}
})();
|
import React, { useState } from "react";
import { useHistory } from "react-router-dom";
import { Row, Col, message, notification } from "antd";
import ResetPasswordForm from "../components/password/ResetPasswordForm";
import firebaseService from "../services/FirebaseService";
const confirmPasswordResetNotification = () =>
notification.info({
message: "Please, check your email",
description: "the confirmation email was send to your email address.",
});
function ResetPassword() {
const [isLoading, setIsLoading] = useState(false);
const history = useHistory();
async function handleResetPassword(user) {
const { email } = user;
setIsLoading(true);
try {
await firebaseService.auth().sendPasswordResetEmail(email);
confirmPasswordResetNotification();
setIsLoading(false);
history.replace("/signin");
} catch (error) {
message.error(error.message);
setIsLoading(false);
}
}
return (
<Row>
<Col xs={2} sm={4} md={6} lg={6} xl={6}></Col>
<Col xs={20} sm={16} md={12} lg={10} xl={10} style={{ marginTop: 100 }}>
<ResetPasswordForm
handleResetPassword={handleResetPassword}
isLoading={isLoading}
/>
</Col>
</Row>
);
}
export default ResetPassword;
|
import {SUPPORTED_SITES} from "../supportedSites";
export const supportedLanguages = {
data: function() {
return {
languages: [
{ label: 'English (default)', value: 'en', icon: SUPPORTED_SITES.find('ebay-gb').icon },
{ label: 'German', value: 'de', icon: SUPPORTED_SITES.find('ebay-de').icon },
{ label: 'Spanish', value: 'es', icon: SUPPORTED_SITES.find('ebay-es').icon },
{ label: 'French', value: 'fr', icon: SUPPORTED_SITES.find('ebay-fr').icon },
{ label: 'Italian', value: 'it', icon: SUPPORTED_SITES.find('ebay-it').icon },
{ label: 'Irish', value: 'ga', icon: SUPPORTED_SITES.find('ebay-ie').icon },
{ label: 'Polish', value: 'pl', icon: SUPPORTED_SITES.find('ebay-pl').icon },
{ label: 'Czech', value: 'cs', icon: SUPPORTED_SITES.findAny('czech').icon },
{ label: 'Slovak', value: 'sk', icon: SUPPORTED_SITES.findAny('slovakia').icon },
],
}
},
};
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./constants");
var TransformFeedback = /** @class */ (function () {
function TransformFeedback() {
this._glContext = null;
this._glTransformFeedback = null;
}
TransformFeedback.prototype.feedback = function (args) {
if (this._glContext === null) {
throw new Error('This transform feedback is not added to any WebGL2 yet.');
}
for (var i = 0; i < args.targetBuffers.length; i++) {
this._glContext.bindBufferBase(constants_1.TRANSFORM_FEEDBACK_BUFFER, i, args.targetBuffers[i].glBuffer);
}
this._glContext.beginTransformFeedback(args.mode);
this._glContext.drawArrays(args.mode, 0, args.count);
this._glContext.endTransformFeedback();
for (var i = 0; i < args.targetBuffers.length; i++) {
this._glContext.bindBufferBase(constants_1.TRANSFORM_FEEDBACK_BUFFER, i, null);
}
};
TransformFeedback.prototype._init = function (context) {
this._glContext = context;
this._glTransformFeedback = context.createTransformFeedback();
context.bindTransformFeedback(constants_1.TRANSFORM_FEEDBACK, this._glTransformFeedback);
};
return TransformFeedback;
}());
exports.TransformFeedback = TransformFeedback;
|
import React from 'react';
import Slide from './Slide.jsx';
function SlideComponent() {
const scene = 'http://people.eecs.berkeley.edu/~sequin/CS184/IMGS/HierSceneComp.GIF';
return (
<Slide title="Scene Graph Maps Nicely to React Components" index={10}>
<div>
<img src={scene} alt="Scene graph." />
<p>It's reminescent of 90's technololgy like VRML and X3D.</p>
</div>
</Slide>
);
}
SlideComponent.propTypes = {
};
export default SlideComponent;
|
import React, { useEffect } from "react";
import { useHttp } from "./http";
function HookUser(props) {
const [data, isLoading] = useHttp(`https://jsonplaceholder.typicode.com/users/${props.pickedUser}`);
const user = !data
? {}
: {
username: data.username,
};
useEffect(() => {
return () => {
console.log("clean up...");
};
}, []);
console.log("rendering...");
return <div>{isLoading ? "loading..." : user.username}</div>;
}
export default React.memo(HookUser, (prevProps, nextProps) => {
return prevProps.pickedUser === nextProps.pickedUser;
});
|
$("#gsc-i-id1").keyup(function(){
$("h1").css("background-color", "pink");
});
var myCallback = function() {
if (document.readyState == 'complete') {
// Document is ready when CSE element is initialized.
// Render an element with both search box and search results in div with id 'test'.
google.search.cse.element.render(
{
div: "test",
tag: 'search',
attributes : {
newWindow: true,
defaultToRefinement: "Catalog"
}
});
} else {
// Document is not ready yet, when CSE element is initialized.
google.setOnLoadCallback(function() {
// Render an element with both search box and search results in div with id 'test'.
google.search.cse.element.render(
{
div: "test",
tag: 'search',
attributes : {
newWindow: true,
defaultToRefinement : "Catalog"
}
});
}, true);
}
};
|
// Create a function that takes a number and finds the factors of it, listing them in descending order in an array.
// If the parameter is not an integer or less than 1, return -1. In C# return an empty array.
// function factors(x){
// }
// The user will enter a number an the program will return an array of factors. if the parameter is not an interger ir less than 1 return -1. for this kata i will need to use % and a loop to count to 0. some examples would be
// console.log(factors(54)) //[54,27,18,9,6,3,2,1]
// console.log(factors(9)) //[9,3,1]
const factors = x => {
let xFactor =[];
if (x < 1 || isNaN(x) === true || x % 1 != 0 ) {
xFactor = -1;
} else {
for (let i = x; i > 0; i--) {
if (x % i === 0) {
xFactor.push(i);
}
}
}
return xFactor;
};
console.log(factors())
//refactored
|
// Language : Italian
var lang = {
firstVisualization:"Confronto",
secondVisualization:"Predizione",
thirdVisualization:"Valutazione",
fourthVisualization:"Distribuzione",
firstControlPanel:"Misurazione degli ID",
thirdControlPanel:"Distribuzione dei valori",
startTime:"Giorna/ora d'inizio",
endTime:"Giorno/ora di fine",
interval:"Aggregazione",
everyThirtyMin:"ogni 30 minuti",
hourly:"ogni ora",
daily:"ogni giorno",
weekly:"ogni settimana",
monthly:"ogni mese",
min:"min",
max:"max",
sum:"somma",
avg:"media",
normalization:"Valori normalizzati",
id:"ID",
displayPlot:"Visualizza",
savePlot:"Salva",
loadPlot:"Carica",
title1:"Selezionare gli attributi",
title2:"Riempire i valori",
title3:"Valutazione",
weekDay:"Giorno feriale",
sunday:"Domenica",
monday:"Lunedi",
tuesday:"Martedý",
wednesday:"Mercoledý",
thursday:"Giovedi",
friday:"Venerdý",
saturday:"Sabato",
weekdays:"giorni feriali",
weekend:"fine setimana",
season:"Stagione",
winter:"inverno (Dic-Feb)",
spring:"primavera (Mar-Mag)",
summer:"estate (Giu-Ago)",
autumn:"autunno (Set-Nov)",
all:"tutto",
refreshPlot:"Non ricaricare il grafico",
EvaluationOfnNeighbors:"Valutazione del numero di vicini (n)",
EvaluationOfkQuestions:"Valutazione del numero di domande (k)",
neighborNum:"Numero di vicini",
questionNum:"Numero di domande",
bin:"Intervallo",
binNum:"numero di intervalli",
binSize:"dimensione dell'intervallo "
}
|
import React, { Component } from 'react';
import { StyleSheet, Text, View, Image, TextInput, Dimensions, KeyboardAvoidingView, Keyboard, TouchableWithoutFeedback } from 'react-native';
import { SocialIcon, FormLabel, FormInput, FormValidationMessage, Button, Input } from 'react-native-elements';
import { connect } from 'react-redux';
import { Navigation } from "react-native-navigation";
import { tryAuth } from '../../store/actions/index';
import validate from '../../utility/validation';
class SigninScreen extends Component {
constructor(props) {
super(props);
Dimensions.addEventListener('change', this.updateStyles);
}
state = {
controls: {
email: {
value: '',
valid: false,
validationRules: {
isEmail: true
}
},
password: {
value: '',
valid: false,
validationRules: {
minLength: 6
}
},
}
}
goToScreen(screenName) {
Navigation.push(this.props.componentId, {
component: {
name: screenName
}
});
}
updateInputState = (key, value) => {
let connectedValue = {};
if (key === 'password') {
connectedValue = {
...connectedValue,
equalTo: value
};
}
this.setState(prevState => {
return {
controls: {
...prevState.controls,
[key]: {
...prevState.controls[key],
value: value,
valid: validate(value, prevState.controls[key].validationRules, connectedValue)
}
}
}
})
}
handleSignin = () => {
const authData = {
email: this.state.controls.email.value,
password: this.state.controls.password.value
};
this.props.onSignin(authData);
}
render() {
return (
<KeyboardAvoidingView style={{ flex: 1, justifyContent: 'center' }} behavior='padding'>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View>
<View>
<Input
inputStyle={styles.input}
placeholder='Email'
autoCapitalize='none'
autoComplete='email'
textContentType='emailAddress'
keyboardType='email-address'
leftIcon={{ type: 'font-awesome', name: 'envelope-o' }}
value={ this.state.controls.email.value }
onChangeText={ (val) => this.updateInputState('email', val) }
errorMessage={'Invalid Email'}
/>
<Input
inputStyle={styles.input}
placeholder='Password'
leftIcon={{ type: 'font-awesome', name: 'lock' }}
value={ this.state.controls.password.value }
onChangeText={ (val) => this.updateInputState('password', val) }
secureTextEntry
errorMessage={'Invalid Email'}
/>
</View>
<View>
<Button
title='Sign in'
onPress={this.handleSignin}
containerStyle={styles.buttonContainer}
// raised
disabled={
!this.state.controls.email.valid ||
!this.state.controls.password.valid
}
loading={ this.props.isLoading }
/>
</View>
<View style={{ alignItems: 'center' }}>
<Text><Text onPress={() => this.goToScreen('goingout.PasswordRecoveryScreen')}>Forgot password?</Text></Text>
</View>
</View>
</TouchableWithoutFeedback>
</KeyboardAvoidingView>
)
}
}
const styles = StyleSheet.create({
input: {
paddingLeft: 10,
},
buttonContainer: {
padding: 7,
}
});
const mapStateToProps = state => {
return {
isLoading: state.ui.isLoading
}
}
const mapDispatchToProps = dispatch => {
return {
onSignin: authData => dispatch(tryAuth(authData, 'signin'))
};
};
export default connect(mapStateToProps, mapDispatchToProps)(SigninScreen);
|
import React from 'react';
import Axios from 'axios';
import { Link } from 'react-router-dom';
import { AuthContext } from '../contexts/AuthContext';
import { withStyles } from '@material-ui/styles';
import { makeStyles } from '@material-ui/core/styles';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import AccountBoxIcon from '@material-ui/icons/AccountBox';
const useStyles = makeStyles((theme) => ({
accountBtn: {
width: '4.5vw',
height: '4.5vh',
[theme.breakpoints.down(768)]: {
width: '35px',
height: '35px',
},
},
}));
const AccountIcon = withStyles({})(AccountBoxIcon);
const AccountButton = () => {
const classes = useStyles();
const isAuthenticated = localStorage.getItem('isMember') === 'true';
const { dispatch } = React.useContext(AuthContext);
const [anchorEl, setAnchorEl] = React.useState(null);
const handleLogout = (event) => {
event.preventDefault();
console.log('we are logging out....');
Axios.post('http://localhost:8000/rest-auth/logout/')
.then((res) => {
console.log('here is the response', res.status);
if (res.status === 200) {
return dispatch({
type: 'LOGOUT',
});
}
})
.then(() => {
window.location.href = '/';
})
.catch((err) => {
console.log('error!', err);
// const errorMsg = [];
// _.forEach(err.response.data, e => {
// errorMsg.push(e[0]);
// });
// setData({
// ...data,
// errorMessage: errorMsg
// });
});
};
const handleClick = (event) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
return (
<div>
<AccountBoxIcon
aria-controls='account-menu'
aria-haspopup='true'
className={classes.accountBtn}
onClick={handleClick}
/>
<Menu
id='account-menu'
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}
>
{isAuthenticated ? (
<div>
<MenuItem onClick={handleClose}>Account</MenuItem>
<Link to='/cart'>
<MenuItem onClick={handleClose}>Cart</MenuItem>
</Link>
<Link to='/dashboard'>
<MenuItem onClick={handleClose}>My Subscription</MenuItem>
</Link>
<MenuItem onClick={handleLogout}>Logout</MenuItem>
</div>
) : (
<div>
<Link to='/cart'>
<MenuItem onClick={handleClose}>Cart</MenuItem>
</Link>
<Link to='/dashboard'>
<MenuItem onClick={handleClose}>Subscription</MenuItem>
</Link>
<Link to='/login'>
<MenuItem onClick={handleClose}>Login</MenuItem>
</Link>
<Link to='/signup'>
<MenuItem onClick={handleClose}>Sign up</MenuItem>
</Link>
</div>
)}
</Menu>
</div>
);
};
export default AccountButton;
|
import React from "react";
export default function Score({ score, setPlayAgain }) {
return <div>
<p>{score}</p>
<button onClick={setPlayAgain}>Jugar de nuevo</button>
</div>;
}
|
var theDonald = [{ tweet_score: 4,
tweet_favorites: 1274,
tweet_date: '2016-02-24T23:14:39.000Z',
tweet_retweets: 444,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 2263,
tweet_date: '2016-02-24T23:13:15.000Z',
tweet_retweets: 910,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 6925,
tweet_date: '2016-02-24T21:36:35.000Z',
tweet_retweets: 2116,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7528,
tweet_date: '2016-02-24T18:31:36.000Z',
tweet_retweets: 3242,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 6322,
tweet_date: '2016-02-24T18:27:44.000Z',
tweet_retweets: 1937,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4166,
tweet_date: '2016-02-24T17:14:20.000Z',
tweet_retweets: 1207,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9154,
tweet_date: '2016-02-24T17:03:43.000Z',
tweet_retweets: 3179,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8011,
tweet_date: '2016-02-24T16:12:50.000Z',
tweet_retweets: 3093,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6923,
tweet_date: '2016-02-24T16:09:46.000Z',
tweet_retweets: 2211,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4507,
tweet_date: '2016-02-24T13:24:58.000Z',
tweet_retweets: 954,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9487,
tweet_date: '2016-02-24T06:25:53.000Z',
tweet_retweets: 3105,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 14442,
tweet_date: '2016-02-24T05:41:02.000Z',
tweet_retweets: 5869,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9948,
tweet_date: '2016-02-24T02:00:18.000Z',
tweet_retweets: 3512,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-24T01:59:59.000Z',
tweet_retweets: 754,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 7045,
tweet_date: '2016-02-24T01:56:15.000Z',
tweet_retweets: 2504,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8277,
tweet_date: '2016-02-24T01:52:32.000Z',
tweet_retweets: 2417,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 0,
tweet_date: '2016-02-24T01:52:12.000Z',
tweet_retweets: 2006,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5747,
tweet_date: '2016-02-24T01:45:21.000Z',
tweet_retweets: 1543,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6068,
tweet_date: '2016-02-23T23:14:16.000Z',
tweet_retweets: 2001,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6740,
tweet_date: '2016-02-23T23:08:48.000Z',
tweet_retweets: 2591,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 12940,
tweet_date: '2016-02-23T18:12:51.000Z',
tweet_retweets: 4350,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8782,
tweet_date: '2016-02-23T17:16:42.000Z',
tweet_retweets: 2594,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 11390,
tweet_date: '2016-02-23T17:11:30.000Z',
tweet_retweets: 3415,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 0,
tweet_date: '2016-02-23T16:47:13.000Z',
tweet_retweets: 2533,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4235,
tweet_date: '2016-02-23T16:46:06.000Z',
tweet_retweets: 1353,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 3845,
tweet_date: '2016-02-23T15:50:00.000Z',
tweet_retweets: 1041,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9881,
tweet_date: '2016-02-23T15:47:08.000Z',
tweet_retweets: 3686,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6274,
tweet_date: '2016-02-23T15:38:24.000Z',
tweet_retweets: 1985,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4462,
tweet_date: '2016-02-23T15:36:47.000Z',
tweet_retweets: 1273,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7712,
tweet_date: '2016-02-23T15:15:55.000Z',
tweet_retweets: 2480,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6405,
tweet_date: '2016-02-23T15:07:26.000Z',
tweet_retweets: 2064,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7125,
tweet_date: '2016-02-23T14:40:53.000Z',
tweet_retweets: 2517,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 6834,
tweet_date: '2016-02-23T14:37:10.000Z',
tweet_retweets: 2560,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8855,
tweet_date: '2016-02-23T05:19:29.000Z',
tweet_retweets: 3045,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5435,
tweet_date: '2016-02-23T03:51:04.000Z',
tweet_retweets: 1527,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 0,
tweet_date: '2016-02-23T03:12:41.000Z',
tweet_retweets: 1596,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7454,
tweet_date: '2016-02-23T02:31:20.000Z',
tweet_retweets: 2724,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 6751,
tweet_date: '2016-02-23T02:27:20.000Z',
tweet_retweets: 2143,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4985,
tweet_date: '2016-02-23T02:19:01.000Z',
tweet_retweets: 1394,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4978,
tweet_date: '2016-02-23T01:44:02.000Z',
tweet_retweets: 1567,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10216,
tweet_date: '2016-02-23T01:37:52.000Z',
tweet_retweets: 3602,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7972,
tweet_date: '2016-02-23T01:34:44.000Z',
tweet_retweets: 2732,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6324,
tweet_date: '2016-02-23T01:29:26.000Z',
tweet_retweets: 2176,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 7155,
tweet_date: '2016-02-23T01:29:02.000Z',
tweet_retweets: 2151,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8194,
tweet_date: '2016-02-23T01:24:27.000Z',
tweet_retweets: 2559,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 0,
tweet_date: '2016-02-23T00:41:28.000Z',
tweet_retweets: 1356,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5723,
tweet_date: '2016-02-23T00:19:37.000Z',
tweet_retweets: 1859,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 8418,
tweet_date: '2016-02-22T21:11:17.000Z',
tweet_retweets: 2718,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8482,
tweet_date: '2016-02-22T21:06:25.000Z',
tweet_retweets: 2895,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 9452,
tweet_date: '2016-02-22T20:55:16.000Z',
tweet_retweets: 3433,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 8259,
tweet_date: '2016-02-22T20:50:18.000Z',
tweet_retweets: 2801,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9744,
tweet_date: '2016-02-22T20:44:02.000Z',
tweet_retweets: 3737,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 10996,
tweet_date: '2016-02-22T20:37:55.000Z',
tweet_retweets: 5362,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6787,
tweet_date: '2016-02-22T18:54:29.000Z',
tweet_retweets: 2456,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 9684,
tweet_date: '2016-02-22T16:12:21.000Z',
tweet_retweets: 2834,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4736,
tweet_date: '2016-02-22T14:52:16.000Z',
tweet_retweets: 1818,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4984,
tweet_date: '2016-02-22T14:49:44.000Z',
tweet_retweets: 1547,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 14531,
tweet_date: '2016-02-22T14:42:50.000Z',
tweet_retweets: 6593,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 6434,
tweet_date: '2016-02-22T13:42:06.000Z',
tweet_retweets: 2357,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4765,
tweet_date: '2016-02-22T13:41:13.000Z',
tweet_retweets: 1197,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8640,
tweet_date: '2016-02-22T13:36:39.000Z',
tweet_retweets: 3155,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 11544,
tweet_date: '2016-02-22T12:48:30.000Z',
tweet_retweets: 3253,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6764,
tweet_date: '2016-02-22T12:31:15.000Z',
tweet_retweets: 1924,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 11950,
tweet_date: '2016-02-22T12:22:38.000Z',
tweet_retweets: 3111,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10441,
tweet_date: '2016-02-22T00:07:49.000Z',
tweet_retweets: 3531,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-21T23:58:17.000Z',
tweet_retweets: 3120,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-21T18:55:33.000Z',
tweet_retweets: 3820,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-21T18:55:03.000Z',
tweet_retweets: 4117,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7629,
tweet_date: '2016-02-21T16:04:46.000Z',
tweet_retweets: 2392,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4900,
tweet_date: '2016-02-21T15:57:11.000Z',
tweet_retweets: 1769,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 11937,
tweet_date: '2016-02-21T11:52:51.000Z',
tweet_retweets: 4088,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8415,
tweet_date: '2016-02-21T11:36:28.000Z',
tweet_retweets: 2099,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 11844,
tweet_date: '2016-02-21T11:09:50.000Z',
tweet_retweets: 3087,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 31042,
tweet_date: '2016-02-21T04:57:42.000Z',
tweet_retweets: 13835,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 20264,
tweet_date: '2016-02-21T03:01:10.000Z',
tweet_retweets: 6284,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 16358,
tweet_date: '2016-02-21T00:05:57.000Z',
tweet_retweets: 4276,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8355,
tweet_date: '2016-02-20T21:51:11.000Z',
tweet_retweets: 2258,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 10478,
tweet_date: '2016-02-20T17:39:24.000Z',
tweet_retweets: 3561,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10419,
tweet_date: '2016-02-20T17:02:44.000Z',
tweet_retweets: 3949,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 29220,
tweet_date: '2016-02-20T16:42:11.000Z',
tweet_retweets: 12536,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5293,
tweet_date: '2016-02-20T16:34:53.000Z',
tweet_retweets: 1591,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5915,
tweet_date: '2016-02-20T16:19:21.000Z',
tweet_retweets: 2301,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 12136,
tweet_date: '2016-02-20T15:31:23.000Z',
tweet_retweets: 4710,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 9677,
tweet_date: '2016-02-20T15:20:27.000Z',
tweet_retweets: 3994,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5516,
tweet_date: '2016-02-20T15:18:07.000Z',
tweet_retweets: 1975,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4047,
tweet_date: '2016-02-20T15:17:17.000Z',
tweet_retweets: 1446,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4869,
tweet_date: '2016-02-20T15:15:03.000Z',
tweet_retweets: 1831,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4256,
tweet_date: '2016-02-20T14:07:42.000Z',
tweet_retweets: 1832,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4801,
tweet_date: '2016-02-20T14:04:56.000Z',
tweet_retweets: 1713,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 12975,
tweet_date: '2016-02-20T14:02:59.000Z',
tweet_retweets: 5678,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 3370,
tweet_date: '2016-02-20T14:02:25.000Z',
tweet_retweets: 1153,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5943,
tweet_date: '2016-02-20T13:59:13.000Z',
tweet_retweets: 2245,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4955,
tweet_date: '2016-02-20T13:18:54.000Z',
tweet_retweets: 1653,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4525,
tweet_date: '2016-02-20T13:18:11.000Z',
tweet_retweets: 1342,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 17767,
tweet_date: '2016-02-19T21:51:51.000Z',
tweet_retweets: 9426,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8120,
tweet_date: '2016-02-19T21:49:15.000Z',
tweet_retweets: 2213,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10928,
tweet_date: '2016-02-19T21:38:07.000Z',
tweet_retweets: 4476,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6854,
tweet_date: '2016-02-19T21:33:04.000Z',
tweet_retweets: 2127,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9744,
tweet_date: '2016-02-19T21:32:43.000Z',
tweet_retweets: 3692,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7059,
tweet_date: '2016-02-19T21:00:59.000Z',
tweet_retweets: 2635,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6912,
tweet_date: '2016-02-19T20:49:57.000Z',
tweet_retweets: 2757,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4863,
tweet_date: '2016-02-19T20:49:02.000Z',
tweet_retweets: 1646,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6438,
tweet_date: '2016-02-19T20:30:24.000Z',
tweet_retweets: 2330,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10419,
tweet_date: '2016-02-19T20:29:43.000Z',
tweet_retweets: 3703,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6922,
tweet_date: '2016-02-19T20:29:22.000Z',
tweet_retweets: 2670,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5584,
tweet_date: '2016-02-19T20:29:01.000Z',
tweet_retweets: 1797,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6540,
tweet_date: '2016-02-19T20:28:32.000Z',
tweet_retweets: 2520,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 4763,
tweet_date: '2016-02-19T18:56:48.000Z',
tweet_retweets: 1722,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7283,
tweet_date: '2016-02-19T18:52:38.000Z',
tweet_retweets: 2686,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 7091,
tweet_date: '2016-02-19T06:09:32.000Z',
tweet_retweets: 2351,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 7717,
tweet_date: '2016-02-19T00:11:57.000Z',
tweet_retweets: 2964,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 9865,
tweet_date: '2016-02-19T00:08:24.000Z',
tweet_retweets: 4175,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-19T00:05:58.000Z',
tweet_retweets: 5591,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6819,
tweet_date: '2016-02-18T20:16:04.000Z',
tweet_retweets: 2905,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5752,
tweet_date: '2016-02-18T20:14:22.000Z',
tweet_retweets: 2517,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-18T19:43:10.000Z',
tweet_retweets: 4040,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-18T19:42:39.000Z',
tweet_retweets: 10833,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-18T19:42:24.000Z',
tweet_retweets: 1430,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 0,
tweet_date: '2016-02-18T19:42:00.000Z',
tweet_retweets: 4365,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9966,
tweet_date: '2016-02-18T18:07:32.000Z',
tweet_retweets: 4760,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 12359,
tweet_date: '2016-02-18T14:11:18.000Z',
tweet_retweets: 4548,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7961,
tweet_date: '2016-02-18T14:05:38.000Z',
tweet_retweets: 3205,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10795,
tweet_date: '2016-02-18T13:30:38.000Z',
tweet_retweets: 4551,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7432,
tweet_date: '2016-02-18T13:27:55.000Z',
tweet_retweets: 3286,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9221,
tweet_date: '2016-02-18T13:11:02.000Z',
tweet_retweets: 3877,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 8579,
tweet_date: '2016-02-18T12:26:46.000Z',
tweet_retweets: 3284,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8685,
tweet_date: '2016-02-18T11:25:40.000Z',
tweet_retweets: 3215,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 11463,
tweet_date: '2016-02-18T10:53:34.000Z',
tweet_retweets: 4341,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8930,
tweet_date: '2016-02-18T10:44:28.000Z',
tweet_retweets: 3402,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5720,
tweet_date: '2016-02-17T23:17:33.000Z',
tweet_retweets: 2502,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 12127,
tweet_date: '2016-02-17T16:34:55.000Z',
tweet_retweets: 5165,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10675,
tweet_date: '2016-02-17T16:31:34.000Z',
tweet_retweets: 4673,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8930,
tweet_date: '2016-02-17T16:22:35.000Z',
tweet_retweets: 3799,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 18730,
tweet_date: '2016-02-17T16:11:24.000Z',
tweet_retweets: 9701,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9585,
tweet_date: '2016-02-17T16:10:30.000Z',
tweet_retweets: 4009,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 20049,
tweet_date: '2016-02-17T14:49:02.000Z',
tweet_retweets: 25605,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 9484,
tweet_date: '2016-02-17T14:40:24.000Z',
tweet_retweets: 3259,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 6906,
tweet_date: '2016-02-17T14:39:52.000Z',
tweet_retweets: 2749,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 23492,
tweet_date: '2016-02-17T11:08:15.000Z',
tweet_retweets: 9307,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5676,
tweet_date: '2016-02-17T10:53:55.000Z',
tweet_retweets: 2271,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6111,
tweet_date: '2016-02-17T10:23:46.000Z',
tweet_retweets: 2986,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 0,
tweet_favorites: 15469,
tweet_date: '2016-02-17T03:58:40.000Z',
tweet_retweets: 5188,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10809,
tweet_date: '2016-02-17T03:48:19.000Z',
tweet_retweets: 4195,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5385,
tweet_date: '2016-02-17T03:44:39.000Z',
tweet_retweets: 2055,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5253,
tweet_date: '2016-02-17T03:17:32.000Z',
tweet_retweets: 1951,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6804,
tweet_date: '2016-02-17T03:12:52.000Z',
tweet_retweets: 2513,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7431,
tweet_date: '2016-02-17T03:04:22.000Z',
tweet_retweets: 3019,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4853,
tweet_date: '2016-02-16T23:15:53.000Z',
tweet_retweets: 1673,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8206,
tweet_date: '2016-02-16T22:54:29.000Z',
tweet_retweets: 3314,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10075,
tweet_date: '2016-02-16T21:09:52.000Z',
tweet_retweets: 3150,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6565,
tweet_date: '2016-02-16T18:21:12.000Z',
tweet_retweets: 2054,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 5126,
tweet_date: '2016-02-16T17:59:42.000Z',
tweet_retweets: 1532,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9978,
tweet_date: '2016-02-16T12:37:08.000Z',
tweet_retweets: 4308,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 9936,
tweet_date: '2016-02-16T11:22:02.000Z',
tweet_retweets: 3293,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8132,
tweet_date: '2016-02-16T10:52:09.000Z',
tweet_retweets: 2152,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9549,
tweet_date: '2016-02-16T04:18:28.000Z',
tweet_retweets: 3628,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 12370,
tweet_date: '2016-02-16T03:53:29.000Z',
tweet_retweets: 4136,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10215,
tweet_date: '2016-02-15T21:16:00.000Z',
tweet_retweets: 3614,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7192,
tweet_date: '2016-02-15T20:23:12.000Z',
tweet_retweets: 3198,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7519,
tweet_date: '2016-02-15T17:29:40.000Z',
tweet_retweets: 3229,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6602,
tweet_date: '2016-02-15T17:24:53.000Z',
tweet_retweets: 2893,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6977,
tweet_date: '2016-02-15T17:24:42.000Z',
tweet_retweets: 2339,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 16741,
tweet_date: '2016-02-15T14:04:31.000Z',
tweet_retweets: 6790,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8868,
tweet_date: '2016-02-15T13:55:08.000Z',
tweet_retweets: 3135,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10344,
tweet_date: '2016-02-15T12:24:00.000Z',
tweet_retweets: 3480,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10475,
tweet_date: '2016-02-15T11:05:15.000Z',
tweet_retweets: 3483,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10484,
tweet_date: '2016-02-14T22:02:19.000Z',
tweet_retweets: 3990,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 12988,
tweet_date: '2016-02-14T21:10:20.000Z',
tweet_retweets: 3848,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 21802,
tweet_date: '2016-02-14T21:07:04.000Z',
tweet_retweets: 7765,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 11622,
tweet_date: '2016-02-14T20:55:59.000Z',
tweet_retweets: 3402,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 13055,
tweet_date: '2016-02-14T17:27:48.000Z',
tweet_retweets: 5060,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 6196,
tweet_date: '2016-02-14T14:51:02.000Z',
tweet_retweets: 1340,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7541,
tweet_date: '2016-02-14T14:50:39.000Z',
tweet_retweets: 3585,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7231,
tweet_date: '2016-02-14T12:59:23.000Z',
tweet_retweets: 2046,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 9449,
tweet_date: '2016-02-14T12:56:20.000Z',
tweet_retweets: 3153,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5710,
tweet_date: '2016-02-14T11:52:54.000Z',
tweet_retweets: 1460,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 11164,
tweet_date: '2016-02-14T06:39:46.000Z',
tweet_retweets: 4356,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 14419,
tweet_date: '2016-02-14T06:26:22.000Z',
tweet_retweets: 5479,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8335,
tweet_date: '2016-02-14T06:17:30.000Z',
tweet_retweets: 3383,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8769,
tweet_date: '2016-02-14T06:12:28.000Z',
tweet_retweets: 2716,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10080,
tweet_date: '2016-02-14T05:37:59.000Z',
tweet_retweets: 3341,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8039,
tweet_date: '2016-02-14T05:27:38.000Z',
tweet_retweets: 2331,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8099,
tweet_date: '2016-02-14T05:24:32.000Z',
tweet_retweets: 2801,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 15789,
tweet_date: '2016-02-14T01:17:51.000Z',
tweet_retweets: 3972,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 10047,
tweet_date: '2016-02-14T00:13:10.000Z',
tweet_retweets: 3640,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 8019,
tweet_date: '2016-02-14T00:11:36.000Z',
tweet_retweets: 3120,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 8160,
tweet_date: '2016-02-14T00:00:49.000Z',
tweet_retweets: 2862,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 16573,
tweet_date: '2016-02-13T22:34:25.000Z',
tweet_retweets: 6829,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 7003,
tweet_date: '2016-02-13T22:27:19.000Z',
tweet_retweets: 1819,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5030,
tweet_date: '2016-02-13T19:24:26.000Z',
tweet_retweets: 1925,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 6080,
tweet_date: '2016-02-13T19:22:39.000Z',
tweet_retweets: 2013,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4115,
tweet_date: '2016-02-13T17:54:02.000Z',
tweet_retweets: 1289,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 9591,
tweet_date: '2016-02-13T17:52:33.000Z',
tweet_retweets: 3868,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 0,
tweet_date: '2016-02-13T17:21:59.000Z',
tweet_retweets: 1666,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 7267,
tweet_date: '2016-02-13T17:21:45.000Z',
tweet_retweets: 2938,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 2,
tweet_favorites: 5426,
tweet_date: '2016-02-13T17:21:17.000Z',
tweet_retweets: 2932,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4024,
tweet_date: '2016-02-13T17:01:59.000Z',
tweet_retweets: 1610,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 3960,
tweet_date: '2016-02-13T16:58:55.000Z',
tweet_retweets: 1266,
twitter_handle: 'realDonaldTrump' },
{ tweet_score: 4,
tweet_favorites: 4417,
tweet_date: '2016-02-13T16:50:46.000Z',
tweet_retweets: 1277,
twitter_handle: 'realDonaldTrump' }];
var totesKanye = [{ tweet_score: 2,
tweet_favorites: 878,
tweet_date: '2016-02-24T22:09:58.000Z',
tweet_retweets: 972,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 5340,
tweet_date: '2016-02-23T21:16:24.000Z',
tweet_retweets: 5841,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2155,
tweet_date: '2016-02-23T19:16:31.000Z',
tweet_retweets: 2045,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 7870,
tweet_date: '2016-02-22T21:51:56.000Z',
tweet_retweets: 12145,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 6511,
tweet_date: '2016-02-22T18:21:10.000Z',
tweet_retweets: 10238,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 7499,
tweet_date: '2016-02-21T17:39:48.000Z',
tweet_retweets: 9270,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 10502,
tweet_date: '2016-02-21T03:41:23.000Z',
tweet_retweets: 15234,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 9161,
tweet_date: '2016-02-20T17:42:40.000Z',
tweet_retweets: 11879,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 5450,
tweet_date: '2016-02-20T16:02:48.000Z',
tweet_retweets: 6391,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 73731,
tweet_date: '2016-02-20T05:31:03.000Z',
tweet_retweets: 97288,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 9039,
tweet_date: '2016-02-20T04:47:12.000Z',
tweet_retweets: 12563,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3773,
tweet_date: '2016-02-19T17:44:39.000Z',
tweet_retweets: 5699,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 51763,
tweet_date: '2016-02-18T00:21:35.000Z',
tweet_retweets: 69435,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 6191,
tweet_date: '2016-02-17T19:55:09.000Z',
tweet_retweets: 7109,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1457,
tweet_date: '2016-02-17T02:10:33.000Z',
tweet_retweets: 842,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3934,
tweet_date: '2016-02-16T12:30:40.000Z',
tweet_retweets: 6062,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 19158,
tweet_date: '2016-02-15T17:56:47.000Z',
tweet_retweets: 29280,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3690,
tweet_date: '2016-02-15T14:31:15.000Z',
tweet_retweets: 2354,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 4014,
tweet_date: '2016-02-14T22:57:45.000Z',
tweet_retweets: 2334,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 5176,
tweet_date: '2016-02-14T17:26:25.000Z',
tweet_retweets: 5311,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 4568,
tweet_date: '2016-02-11T17:39:35.000Z',
tweet_retweets: 4524,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 4412,
tweet_date: '2016-02-10T01:02:13.000Z',
tweet_retweets: 4996,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 27116,
tweet_date: '2016-02-09T16:56:40.000Z',
tweet_retweets: 20519,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 6156,
tweet_date: '2016-02-09T03:58:26.000Z',
tweet_retweets: 4093,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 10061,
tweet_date: '2016-02-04T17:53:39.000Z',
tweet_retweets: 11936,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 4340,
tweet_date: '2016-02-03T20:13:10.000Z',
tweet_retweets: 6370,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 15496,
tweet_date: '2016-02-02T01:06:22.000Z',
tweet_retweets: 23251,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 4480,
tweet_date: '2016-01-30T19:37:02.000Z',
tweet_retweets: 5825,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 50254,
tweet_date: '2016-01-29T22:07:31.000Z',
tweet_retweets: 74590,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 13929,
tweet_date: '2016-01-28T20:05:10.000Z',
tweet_retweets: 15799,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 4478,
tweet_date: '2016-01-27T16:32:12.000Z',
tweet_retweets: 5058,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 7217,
tweet_date: '2016-01-24T18:48:45.000Z',
tweet_retweets: 7810,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2646,
tweet_date: '2016-01-22T00:52:26.000Z',
tweet_retweets: 1568,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 8776,
tweet_date: '2016-01-16T15:27:13.000Z',
tweet_retweets: 11746,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 8829,
tweet_date: '2016-01-09T16:58:56.000Z',
tweet_retweets: 5536,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1108,
tweet_date: '2016-01-01T03:02:19.000Z',
tweet_retweets: 605,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2117,
tweet_date: '2015-12-21T05:27:52.000Z',
tweet_retweets: 1353,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 4796,
tweet_date: '2015-12-19T20:42:17.000Z',
tweet_retweets: 2895,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1676,
tweet_date: '2015-12-17T20:12:31.000Z',
tweet_retweets: 1636,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 5900,
tweet_date: '2015-11-23T00:50:54.000Z',
tweet_retweets: 6547,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2631,
tweet_date: '2015-11-17T21:41:36.000Z',
tweet_retweets: 3175,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 6060,
tweet_date: '2015-11-09T17:47:37.000Z',
tweet_retweets: 8304,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 3405,
tweet_date: '2015-11-02T16:08:47.000Z',
tweet_retweets: 4390,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 2958,
tweet_date: '2015-10-24T19:09:56.000Z',
tweet_retweets: 3376,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 6575,
tweet_date: '2015-10-21T15:33:29.000Z',
tweet_retweets: 5431,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3973,
tweet_date: '2015-10-20T03:57:13.000Z',
tweet_retweets: 2742,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2234,
tweet_date: '2015-10-19T00:29:58.000Z',
tweet_retweets: 2398,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2619,
tweet_date: '2015-10-15T16:26:35.000Z',
tweet_retweets: 2976,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3998,
tweet_date: '2015-10-11T19:09:19.000Z',
tweet_retweets: 2531,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3446,
tweet_date: '2015-10-06T00:33:56.000Z',
tweet_retweets: 4511,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 8874,
tweet_date: '2015-09-28T15:25:17.000Z',
tweet_retweets: 10909,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1881,
tweet_date: '2015-09-22T16:01:44.000Z',
tweet_retweets: 1488,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3588,
tweet_date: '2015-09-20T17:26:39.000Z',
tweet_retweets: 4072,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1887,
tweet_date: '2015-09-16T16:44:36.000Z',
tweet_retweets: 2260,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1746,
tweet_date: '2015-09-14T15:57:23.000Z',
tweet_retweets: 1037,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1708,
tweet_date: '2015-09-09T16:42:51.000Z',
tweet_retweets: 1272,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2806,
tweet_date: '2015-09-08T00:29:10.000Z',
tweet_retweets: 3338,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 2442,
tweet_date: '2015-09-06T16:58:05.000Z',
tweet_retweets: 1808,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2191,
tweet_date: '2015-09-04T16:00:32.000Z',
tweet_retweets: 2849,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3696,
tweet_date: '2015-09-02T16:10:53.000Z',
tweet_retweets: 3894,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 7117,
tweet_date: '2015-08-31T02:51:02.000Z',
tweet_retweets: 10692,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1802,
tweet_date: '2015-08-29T17:07:02.000Z',
tweet_retweets: 2265,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 555,
tweet_date: '2015-07-29T16:33:00.000Z',
tweet_retweets: 472,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1987,
tweet_date: '2015-07-28T16:09:21.000Z',
tweet_retweets: 1342,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 745,
tweet_date: '2015-07-26T22:33:04.000Z',
tweet_retweets: 601,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 571,
tweet_date: '2015-07-26T22:06:02.000Z',
tweet_retweets: 383,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 863,
tweet_date: '2015-07-25T16:07:32.000Z',
tweet_retweets: 1030,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1117,
tweet_date: '2015-07-16T17:39:24.000Z',
tweet_retweets: 1438,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 6149,
tweet_date: '2015-07-12T18:36:11.000Z',
tweet_retweets: 4628,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1184,
tweet_date: '2015-07-08T16:39:50.000Z',
tweet_retweets: 1359,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 931,
tweet_date: '2015-07-04T16:50:12.000Z',
tweet_retweets: 790,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 912,
tweet_date: '2015-07-03T18:59:21.000Z',
tweet_retweets: 680,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2044,
tweet_date: '2015-07-02T16:28:57.000Z',
tweet_retweets: 2462,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1199,
tweet_date: '2015-06-30T14:13:52.000Z',
tweet_retweets: 928,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 1243,
tweet_date: '2015-06-28T16:06:25.000Z',
tweet_retweets: 1144,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1852,
tweet_date: '2015-06-25T17:48:11.000Z',
tweet_retweets: 1374,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1746,
tweet_date: '2015-06-24T15:18:40.000Z',
tweet_retweets: 1924,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2548,
tweet_date: '2015-06-22T17:11:23.000Z',
tweet_retweets: 2282,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 773,
tweet_date: '2015-06-21T23:45:57.000Z',
tweet_retweets: 245,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1855,
tweet_date: '2015-06-20T15:18:40.000Z',
tweet_retweets: 1994,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 2753,
tweet_date: '2015-06-17T16:24:10.000Z',
tweet_retweets: 3722,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1916,
tweet_date: '2015-06-16T16:15:27.000Z',
tweet_retweets: 2232,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1011,
tweet_date: '2015-06-15T16:15:15.000Z',
tweet_retweets: 864,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 996,
tweet_date: '2015-06-15T00:46:23.000Z',
tweet_retweets: 1423,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 3945,
tweet_date: '2015-06-14T16:31:00.000Z',
tweet_retweets: 3792,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2555,
tweet_date: '2015-06-13T16:51:16.000Z',
tweet_retweets: 2139,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1795,
tweet_date: '2015-06-12T02:23:14.000Z',
tweet_retweets: 1795,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 6297,
tweet_date: '2015-06-11T19:28:52.000Z',
tweet_retweets: 5817,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1567,
tweet_date: '2015-06-10T17:19:35.000Z',
tweet_retweets: 2123,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1099,
tweet_date: '2015-06-09T17:23:46.000Z',
tweet_retweets: 984,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2821,
tweet_date: '2015-06-08T16:15:58.000Z',
tweet_retweets: 2366,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 25417,
tweet_date: '2015-06-07T16:32:37.000Z',
tweet_retweets: 38067,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3146,
tweet_date: '2015-06-04T00:10:50.000Z',
tweet_retweets: 2260,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1942,
tweet_date: '2015-06-02T17:24:25.000Z',
tweet_retweets: 1806,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 7393,
tweet_date: '2015-05-31T17:20:32.000Z',
tweet_retweets: 4951,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2109,
tweet_date: '2015-05-31T01:23:31.000Z',
tweet_retweets: 2503,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2753,
tweet_date: '2015-05-29T16:18:25.000Z',
tweet_retweets: 2698,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3106,
tweet_date: '2015-05-26T17:02:39.000Z',
tweet_retweets: 2913,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 949,
tweet_date: '2015-05-25T17:52:28.000Z',
tweet_retweets: 672,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3382,
tweet_date: '2015-05-23T15:06:47.000Z',
tweet_retweets: 2077,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 765,
tweet_date: '2015-05-22T16:01:18.000Z',
tweet_retweets: 388,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1708,
tweet_date: '2015-05-21T15:19:11.000Z',
tweet_retweets: 1300,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1185,
tweet_date: '2015-05-19T16:28:36.000Z',
tweet_retweets: 1436,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1178,
tweet_date: '2015-05-18T01:04:41.000Z',
tweet_retweets: 1206,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1712,
tweet_date: '2015-05-16T16:48:33.000Z',
tweet_retweets: 1586,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1001,
tweet_date: '2015-05-14T23:28:25.000Z',
tweet_retweets: 925,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3111,
tweet_date: '2015-05-13T15:00:42.000Z',
tweet_retweets: 2296,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1209,
tweet_date: '2015-05-12T23:57:37.000Z',
tweet_retweets: 914,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 553,
tweet_date: '2015-05-12T00:50:22.000Z',
tweet_retweets: 583,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 841,
tweet_date: '2015-05-11T02:31:30.000Z',
tweet_retweets: 753,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 859,
tweet_date: '2015-05-10T16:27:43.000Z',
tweet_retweets: 296,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1180,
tweet_date: '2015-05-10T01:22:01.000Z',
tweet_retweets: 1531,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2252,
tweet_date: '2015-05-09T16:21:50.000Z',
tweet_retweets: 2925,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 828,
tweet_date: '2015-05-08T17:48:44.000Z',
tweet_retweets: 552,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 5310,
tweet_date: '2015-05-07T00:09:06.000Z',
tweet_retweets: 6433,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 837,
tweet_date: '2015-05-06T16:43:18.000Z',
tweet_retweets: 1000,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2922,
tweet_date: '2015-05-05T17:39:17.000Z',
tweet_retweets: 2383,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 754,
tweet_date: '2015-05-05T02:26:44.000Z',
tweet_retweets: 627,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1457,
tweet_date: '2015-05-05T01:29:44.000Z',
tweet_retweets: 1033,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 7508,
tweet_date: '2015-05-04T01:44:15.000Z',
tweet_retweets: 6571,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 546,
tweet_date: '2015-05-03T23:14:54.000Z',
tweet_retweets: 476,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 343,
tweet_date: '2015-05-03T04:55:50.000Z',
tweet_retweets: 369,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 698,
tweet_date: '2015-05-03T04:37:37.000Z',
tweet_retweets: 595,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 667,
tweet_date: '2015-05-03T04:33:19.000Z',
tweet_retweets: 628,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1074,
tweet_date: '2015-05-03T01:12:49.000Z',
tweet_retweets: 876,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1028,
tweet_date: '2015-05-02T17:44:20.000Z',
tweet_retweets: 1158,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 532,
tweet_date: '2015-05-01T16:31:41.000Z',
tweet_retweets: 502,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 567,
tweet_date: '2015-04-30T16:28:14.000Z',
tweet_retweets: 730,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 957,
tweet_date: '2015-04-29T17:30:48.000Z',
tweet_retweets: 1146,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2709,
tweet_date: '2015-04-28T21:37:54.000Z',
tweet_retweets: 1770,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1073,
tweet_date: '2015-04-28T19:08:48.000Z',
tweet_retweets: 739,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 768,
tweet_date: '2015-04-28T16:45:11.000Z',
tweet_retweets: 548,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1411,
tweet_date: '2015-04-28T01:07:20.000Z',
tweet_retweets: 941,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 2117,
tweet_date: '2015-04-27T23:00:08.000Z',
tweet_retweets: 1250,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1101,
tweet_date: '2015-04-26T23:13:58.000Z',
tweet_retweets: 814,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 661,
tweet_date: '2015-04-26T15:29:51.000Z',
tweet_retweets: 694,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 573,
tweet_date: '2015-04-25T00:24:07.000Z',
tweet_retweets: 299,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 338,
tweet_date: '2015-04-23T16:06:17.000Z',
tweet_retweets: 2223,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2834,
tweet_date: '2015-04-21T15:34:20.000Z',
tweet_retweets: 2266,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3837,
tweet_date: '2015-04-20T23:08:08.000Z',
tweet_retweets: 2628,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 2219,
tweet_date: '2015-04-20T17:52:38.000Z',
tweet_retweets: 1430,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 663,
tweet_date: '2015-04-20T14:45:52.000Z',
tweet_retweets: 888,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1331,
tweet_date: '2015-04-20T00:20:23.000Z',
tweet_retweets: 789,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1496,
tweet_date: '2015-04-19T17:05:26.000Z',
tweet_retweets: 2024,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 999,
tweet_date: '2015-04-18T22:10:08.000Z',
tweet_retweets: 701,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3332,
tweet_date: '2015-04-17T16:36:08.000Z',
tweet_retweets: 4434,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 884,
tweet_date: '2015-04-16T18:56:35.000Z',
tweet_retweets: 630,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1885,
tweet_date: '2015-04-16T16:41:33.000Z',
tweet_retweets: 1969,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 718,
tweet_date: '2015-04-16T01:00:55.000Z',
tweet_retweets: 882,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 665,
tweet_date: '2015-04-15T23:02:32.000Z',
tweet_retweets: 374,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1025,
tweet_date: '2015-04-15T17:54:58.000Z',
tweet_retweets: 1353,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 669,
tweet_date: '2015-04-15T15:48:17.000Z',
tweet_retweets: 641,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 728,
tweet_date: '2015-04-14T20:23:51.000Z',
tweet_retweets: 848,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 858,
tweet_date: '2015-04-13T16:39:51.000Z',
tweet_retweets: 836,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 713,
tweet_date: '2015-04-13T15:26:01.000Z',
tweet_retweets: 797,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1846,
tweet_date: '2015-04-12T21:00:27.000Z',
tweet_retweets: 2241,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1206,
tweet_date: '2015-04-12T19:03:19.000Z',
tweet_retweets: 1116,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 686,
tweet_date: '2015-04-11T18:21:40.000Z',
tweet_retweets: 275,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2810,
tweet_date: '2015-04-10T22:15:28.000Z',
tweet_retweets: 3852,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1231,
tweet_date: '2015-04-10T18:31:22.000Z',
tweet_retweets: 1513,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3430,
tweet_date: '2015-04-09T18:13:16.000Z',
tweet_retweets: 3515,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1759,
tweet_date: '2015-04-04T20:35:47.000Z',
tweet_retweets: 2575,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1145,
tweet_date: '2015-04-02T00:23:47.000Z',
tweet_retweets: 626,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2171,
tweet_date: '2015-04-01T14:01:39.000Z',
tweet_retweets: 1913,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 2068,
tweet_date: '2015-03-29T16:37:23.000Z',
tweet_retweets: 1640,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3648,
tweet_date: '2015-03-26T19:44:53.000Z',
tweet_retweets: 2601,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 634,
tweet_date: '2015-03-25T16:55:49.000Z',
tweet_retweets: 658,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1512,
tweet_date: '2015-03-24T02:21:31.000Z',
tweet_retweets: 1673,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1019,
tweet_date: '2015-03-22T19:07:44.000Z',
tweet_retweets: 574,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 818,
tweet_date: '2015-03-17T16:57:09.000Z',
tweet_retweets: 683,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1404,
tweet_date: '2015-03-15T19:10:35.000Z',
tweet_retweets: 1699,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 889,
tweet_date: '2015-03-13T18:34:50.000Z',
tweet_retweets: 473,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 918,
tweet_date: '2015-03-13T02:01:56.000Z',
tweet_retweets: 604,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 737,
tweet_date: '2015-03-12T17:17:07.000Z',
tweet_retweets: 554,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 922,
tweet_date: '2015-03-11T01:35:36.000Z',
tweet_retweets: 1488,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1393,
tweet_date: '2015-03-09T01:06:27.000Z',
tweet_retweets: 1853,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1091,
tweet_date: '2015-03-07T20:42:03.000Z',
tweet_retweets: 1495,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 865,
tweet_date: '2015-03-04T18:31:16.000Z',
tweet_retweets: 1037,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 3537,
tweet_date: '2015-03-04T02:00:09.000Z',
tweet_retweets: 2782,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1082,
tweet_date: '2015-03-03T18:44:05.000Z',
tweet_retweets: 790,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1615,
tweet_date: '2015-03-02T17:47:14.000Z',
tweet_retweets: 1094,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 662,
tweet_date: '2015-03-02T01:01:49.000Z',
tweet_retweets: 170,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1157,
tweet_date: '2015-02-27T18:10:57.000Z',
tweet_retweets: 1032,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1228,
tweet_date: '2015-02-26T18:20:22.000Z',
tweet_retweets: 1309,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 878,
tweet_date: '2015-02-24T18:17:28.000Z',
tweet_retweets: 1180,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1610,
tweet_date: '2015-02-23T18:13:57.000Z',
tweet_retweets: 1533,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 1103,
tweet_date: '2015-02-23T16:49:02.000Z',
tweet_retweets: 918,
twitter_handle: 'kanyewset' },
{ tweet_score: 4,
tweet_favorites: 2255,
tweet_date: '2015-02-22T21:42:43.000Z',
tweet_retweets: 3090,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 1780,
tweet_date: '2015-02-22T16:31:29.000Z',
tweet_retweets: 2301,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1844,
tweet_date: '2015-02-21T22:39:49.000Z',
tweet_retweets: 2470,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1189,
tweet_date: '2015-02-19T15:16:27.000Z',
tweet_retweets: 1567,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 917,
tweet_date: '2015-02-19T02:05:22.000Z',
tweet_retweets: 1206,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 734,
tweet_date: '2015-02-18T16:57:10.000Z',
tweet_retweets: 956,
twitter_handle: 'kanyewset' },
{ tweet_score: 0,
tweet_favorites: 715,
tweet_date: '2015-02-17T18:56:45.000Z',
tweet_retweets: 568,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 464,
tweet_date: '2015-02-17T17:05:11.000Z',
tweet_retweets: 508,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 814,
tweet_date: '2015-02-16T20:30:08.000Z',
tweet_retweets: 1167,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1569,
tweet_date: '2015-02-16T15:54:49.000Z',
tweet_retweets: 2124,
twitter_handle: 'kanyewset' },
{ tweet_score: 2,
tweet_favorites: 1674,
tweet_date: '2015-02-16T02:47:09.000Z',
tweet_retweets: 2210,
twitter_handle: 'kanyewset' }];
//Code for turning tweet data into what you need to insert into table
// var that = [];
// theDonald.forEach(function(tweet) {
// var obj = {};
// obj.tweet_score = tweet.polarity;
// obj.tweet_favorites = tweet.favs;
// obj.tweet_date = tweet.date;
// obj.tweet_retweets = tweet.retweets;
// obj.twitter_handle = 'realDonaldTrump';
// that.push(obj);
// })
//
// console.log(that);
exports.seed = function(knex, Promise) {
var tweetPromise = [];
for (var idx in theDonald) {
tweetPromise.push(knex('tweet_data').insert(theDonald[idx]));
}
for (var idx in totesKanye) {
tweetPromise.push(knex('tweet_data').insert(totesKanye[idx]));
}
return Promise.all(tweetPromise);
};
|
import "./App.css";
import styled from "styled-components";
import React from "react";
import { MEDIA_QUERY_MD, MEDIA_QUERY_LG } from "../../constants/style";
import PropTypes from "prop-types";
const TodoItemWrapper = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
paddin: 8px 16px;
border: 1px solid black;
margin-top: 12px;
`;
const TodoContent = styled.div`
padding: 5px;
color: rgba(2, 50, 70);
font-size: 12px;
${(props) =>
props.size === "XL" &&
`
font-size: 20px;
`}
${(props) =>
props.isDone &&
`
text-decoration: line-through;
`}
`;
const TodoButtonWrapper = styled.div``;
const Button = styled.button`
padding: 4px;
color: black;
font-size: 20px;
${MEDIA_QUERY_MD} {
font-size: 24px;
}
${MEDIA_QUERY_LG} {
font-size: 12px;
}
&:hover {
color: red;
}
& + & {
margin-left: 5px;
}
`;
export default function TodoItem({
size,
todo,
handleDeleteTodo,
handletoggleIsDone,
}) {
const handleToggleClick = () => {
handletoggleIsDone(todo.id);
};
const handleDeleteClick = () => {
handleDeleteTodo(todo.id);
};
return (
<TodoItemWrapper>
<TodoContent isDone={todo.isDone} size="XL">
{todo.content}
</TodoContent>
<TodoButtonWrapper>
<Button onClick={handleToggleClick}>
{todo.isDone ? "未完成" : "已完成"}
</Button>
<Button onClick={handleDeleteClick}>刪除</Button>
</TodoButtonWrapper>
</TodoItemWrapper>
);
}
TodoItem.propTypes = {
size: PropTypes.string,
todo: PropTypes.shape({
id: PropTypes.number,
content: PropTypes.string,
isDone: PropTypes.bool,
}),
handleDeleteTodo: PropTypes.func,
handletoggleIsDone: PropTypes.func,
};
|
const { Given, When, Then } = require("cucumber");
import Ship from "../StarTrek/ship";
import { Klingon } from "../StarTrek/Klingon";
import { UserInterface } from "../Untouchables/userInterface";
import { assert } from "chai";
Given("a player ship", function() {
this.setShip(new Ship());
});
Given("a weakling Klingon", function() {
this.addBaddy(new Klingon(0, 100));
});
When("I shoot the first bad dude", function() {
const ui = new UserInterface("phaser");
ui.commandParameter = 500;
ui.target = this.allBaddies[0];
this.game.processCommand(ui);
});
Then("the first bad dude should be destroyed", function() {
assert(this.allBaddies[0].isDestroyed);
});
|
import React, { Component } from 'react';
import { Container, Row, Col } from 'reactstrap';
import Router from 'next/router';
import Layout from '../../../components/account/accountLayout';
import AccountCard from '../../../components/account/accountCard';
import AccountNav from '../../../components/account/accountNav';
import DashboardHeader from '../../../components/dashboardHeader';
import AccountCardMessage from '../../../components/account/accountCardMessage';
const addressAdd = 'ADDRESS_ADD';
const addressAddSuccess = 'ADDRESS_ADD_SUCCESS';
export default class ChangeMonitoredAddress extends Component {
state = {
type: addressAdd,
}
changeType = (type) => {
this.setState(() => ({ type }));
}
render() {
const { type } = this.state;
return (
<Layout>
<DashboardHeader />
<Container>
<AccountCard className="card">
<Row>
<Col>
<h2 className="mb-md">Addresses</h2>
</Col>
</Row>
<Row>
<Col md={4}>
<AccountNav />
</Col>
<Col>
<AccountCard>
{type === addressAdd ?
<div>
<h4 className="text-center mb-md">Shipping Address</h4>
<div className="label mb-xs">
Enter new shipping address:
</div>
<Row>
<Col md={8}>
<div className="form-group">
<input type="text" className="form-control" placeholder="Address" />
</div>
</Col>
<Col>
<div className="form-group">
<input type="text" className="form-control" placeholder="Apt/Suite #" />
</div>
</Col>
</Row>
<Row className="mb-md">
<Col>
<div className="form-group">
<input type="text" className="form-control" placeholder="City" />
</div>
</Col>
<Col>
<div className="form-group">
<input type="text" className="form-control" placeholder="State" />
</div>
</Col>
<Col>
<div className="form-group">
<input type="text" className="form-control" placeholder="Zipcode" />
</div>
</Col>
</Row>
<div className="form-group">
<input type="text" className="form-control" placeholder="Password" />
</div>
<div className="mb-sm">
<a href="#/">Forgot Password</a>
</div>
<div className="text-right">
<a href="/account/addresses" className="btn btn--white">
Cancel
</a>
<button
className="btn btn--primary ml-xs"
onClick={() => this.changeType(addressAddSuccess)}
>
Add Shipping Address
</button>
</div>
</div>
: ''}
{type === addressAddSuccess ?
<div>
<AccountCardMessage
title="Shipping Address Added"
description="You have successfully added a shipping address to your account."
action={() => Router.push('/account/addresses')}
/>
</div>
: ''}
</AccountCard>
</Col>
</Row>
</AccountCard>
</Container>
</Layout>
);
}
}
|
import { ADD_TRANSACTIONS, DELETE_TRANSACTIONS } from "./types";
export const addTransaction = ({ id, pid, title, price, image, quantity }) => (
dispatch
) => {
const newTransaction = {
id,
pid,
title,
price,
image,
quantity,
};
dispatch({ type: ADD_TRANSACTIONS, payload: newTransaction });
};
export const deleteTransactions = (id) => (dispatch) => {
dispatch({ type: DELETE_TRANSACTIONS, payload: id });
};
|
require('dotenv').config();
const pg = require('pg');
const connectionString = process.env.DATABASE_URL || 'postgres://postgres:root@localhost:5432/postgres';
const
bcrypt = require('../lib/bCrypt.js');
function openClient(){
const client = new pg.Client({
user: process.env.DATABASE_USER,
database: process.env.DATABASE_SERVER,
port: process.env.DATABASE_PORT,
host: process.env.DATABASE_HOST,
ssl: false
});
return client;
}
function rollback(err, client) {
console.log(err);
//terminating a client connection will
//automatically rollback any uncommitted transactions
//so while it's not technically mandatory to call
//ROLLBACK it is cleaner and more correct
client.query('ROLLBACK', function() {
client.end();
});
};
/**
* Register
*/
function insertUser(user, callback){
console.log("----------------------debug-------------------------")
var client = new pg.Client(connectionString);
client.connect();
var query_1 = 'INSERT INTO student (name, roll_no, gender, branch, year, contact_number) VALUES ($1, $2, $3, $4, $5, $6) RETURNING *';
var query_1_params = [user.name,user.roll,user.gender,user.branch,user.year,user.contact];
var query_2 = 'INSERT INTO login(roll_no, hashed_password) VALUES($1, $2) RETURNING *';
var query_2_params = [user.roll, user.password];
client.query('BEGIN', function(err, result) {
console.log(result.rows[0]);
if(err){
callback(null);
return rollback(err, client);
}
client.query(query_1, query_1_params, function(err, result_user) {
console.log(result_user);
if(err){
callback(null);
return rollback(err, client);
}
var user_result = result_user.rows[0];
console.log(user_result);
console.log(query_2_params);
client.query(query_2, query_2_params, function(err, result_login) {
console.log(result_login);
if(err){
callback(null);
return rollback(err, client);
}
user_result.pass = result_login.rows[0].hashed_password;
console.log("----------------------final---------------")
//disconnect after successful commit
client.query('COMMIT', client.end.bind(client));
callback(user_result);
});
});
});
}
function checkLoginByRoll(user, callback){
var client = new pg.Client(connectionString);
client.connect();
const query = client.query('SELECT * FROM login WHERE roll_no = $1', [user.roll], function(error, result){
if(error){
callback(null);
return;
}
console.log(result);
if(result.rowCount > 0) {
client.query('SELECT * FROM student WHERE roll_no = $1',
[result.rows[0].roll_no],
function (error1, result1) {
if(error1) {
callback(null);
return;
}
var user_result = result1.rows[0];
user_result.pass = result.rows[0].hashed_password;
console.log(user_result);
callback(user_result);
});
} else { // wrong password/id
callback(null);
}
});
}
function getEvent(callback){
var client = new pg.Client(connectionString);
client.connect();
const results = [];
const query = client.query('select * from event where ondate >= now();',function(error, result){
if(error){
callback(null);
return;
}
console.log(result.rows);
var user_result = result.rows;
callback(user_result);
});
}
function insertRecord(user,callback)
{
var client = new pg.Client(connectionString);
client.connect();
console.log(user);
const query = client.query("SELECT * FROM record WHERE roll_no = $1 and entry_time is null", [user.roll], function(error, result){
if(error){
callback(null);
return rollback(error,client);
}
console.log(result);
if(result.rowCount == 0) {
client.query('INSERT INTO record(record_date, roll_no,exit_time, purpose) VALUES (CURRENT_DATE, $1, now(), $2) returning *',[user.roll,user.purp],function(err,resexit){
console.log(resexit);
if(err){
return rollback(err,client);
}
var user_result = 'Exit';
callback(user_result);
});
} else {
client.query("UPDATE record SET entry_time = now() WHERE roll_no = $1 and entry_time is null",[user.roll],function(err,resenter){
console.log(resenter+" no updation");
if(err){
return rollback(err,client);
}
var user_result = 'Entry';
callback(user_result);
});
}
});
}
////////////////////////////////
exports.insertUser = insertUser;
exports.checkLoginByRoll = checkLoginByRoll;
exports.getEvent = getEvent;
exports.insertRecord = insertRecord;
function toHexString(byteArray) {
return byteArray.map(function(byte) {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('')
}
|
var RUBROS = {
RESTAURANTE: 'Restaurante',
COMIDA_RAPIDA: 'ComidaRapida',
SUPERMERCADO: 'Supermercado',
LIBRERIA: 'Libreria',
CINE: 'Cine',
BOLICHE: 'Boliche'
}
function Rubro(nombre){
this.nombre = nombre;
}
|
var NAVTREEINDEX0 =
{
"annotated.html":[1,0],
"block__cluster_8cpp.html":[2,0,0],
"block__cluster_8cpp.html#ad0b2f114adc0485735774ad9e860ecba":[2,0,0,0],
"block__cluster_8h_source.html":[2,0,1],
"classbctree.html":[1,0,1],
"classbctree.html#a254904aeb2cfa83f2d1c6adf01c15725":[1,0,1,0],
"classbctree.html#a39dc8aa1925e04ed17d4993fb5d99dae":[1,0,1,2],
"classbctree.html#a8619da5b2a5f396167bc44dc3e0a65c8":[1,0,1,3],
"classbctree.html#acc45b082bb211c6b9a193bc19bf5f28c":[1,0,1,1],
"classes.html":[1,1],
"classgraph__cluster.html":[1,0,3],
"classgraph__cluster.html#a169f12a5f4894946da32585f9d08b16e":[1,0,3,5],
"classgraph__cluster.html#a317b6925217cf0824cb3609a3366546b":[1,0,3,6],
"classgraph__cluster.html#a389cfb014bf97e9ea54945f53bc198d1":[1,0,3,7],
"classgraph__cluster.html#a500ab61046f7926a2c2d6d2ed6ab815c":[1,0,3,13],
"classgraph__cluster.html#a51dbc205a4b2212f1ce6b941427ce470":[1,0,3,2],
"classgraph__cluster.html#a52d5a9e63465ae46eb407c7c392eb767":[1,0,3,0],
"classgraph__cluster.html#a5fd4283dc6cf88c78f34a74d86def5a6":[1,0,3,12],
"classgraph__cluster.html#a7ff2f71a42668611090addbfb53a53f0":[1,0,3,9],
"classgraph__cluster.html#aa7aabf90ccdf026ca52612b949c58c0b":[1,0,3,11],
"classgraph__cluster.html#aa8a2e11488254df9a0a6f0f24b9c815e":[1,0,3,8],
"classgraph__cluster.html#ab182432bb5b2e4d9fda9b1fd50bec44e":[1,0,3,3],
"classgraph__cluster.html#ac2cff48ba0e679bc3b6fac71fabd5fe1":[1,0,3,4],
"classgraph__cluster.html#acc9ec322b82fe84e82c2b6c10ba8ab1c":[1,0,3,10],
"classgraph__cluster.html#ae98dba5108bd6993940d2338d932ca8a":[1,0,3,1],
"classgraph__cluster.html#af42e95adfebcbfcad26ee44d57627ab0":[1,0,3,14],
"classhmat.html":[1,0,4],
"classhmat.html#aa57c46567f41e879a388b1809de0e25c":[1,0,4,3],
"classhmat.html#aab11e1638abca5cfcfa1c8912f172318":[1,0,4,1],
"classhmat.html#ae81392431f0e0386bee24636ab0652fa":[1,0,4,0],
"classhmat.html#afc4dec431db6765b3bf1188cd29831b8":[1,0,4,2],
"classtree.html":[1,0,10],
"classtree.html#a3bf767f69bbd75f3e5daee29ce512762":[1,0,10,1],
"classtree.html#a3d4607480844b71710879a7986e8e5aa":[1,0,10,6],
"classtree.html#a76473ee03c77dd98b4dbe63f51b32f8f":[1,0,10,3],
"classtree.html#a79aae5881a0d62f4d53038fd204a2b03":[1,0,10,2],
"classtree.html#a83f84729a1c1e63fb26e84bf46e68fac":[1,0,10,5],
"classtree.html#a9f2a566ac2710fafc31232456780e82d":[1,0,10,0],
"classtree.html#af71da3ae15fbc2abc9c8db2d0d12d4ad":[1,0,10,8],
"classtree.html#aff5fc69d12a6dc5c90cf39898f3d633b":[1,0,10,7],
"classtree.html#aff9255f7b65701bda099f424a1062375":[1,0,10,4],
"files.html":[2,0],
"functions.html":[1,2,0],
"functions_func.html":[1,2,1],
"functions_rela.html":[1,2,2],
"globals.html":[2,1,0],
"globals_func.html":[2,1,1],
"graph__cluster_8cpp.html":[2,0,2],
"graph__cluster_8cpp.html#a7bf5a213567d4f1aaac10a50d3ceeb50":[2,0,2,2],
"graph__cluster_8cpp.html#a92592ca07304cf89654162ebec777381":[2,0,2,1],
"graph__cluster_8cpp.html#ac583e14cb532b156727354aae78cde00":[2,0,2,0],
"graph__cluster_8h_source.html":[2,0,3],
"h__mat_8h_source.html":[2,0,4],
"index.html":[0],
"index.html":[],
"index.html#install_sec":[0,1],
"index.html#intro_sec":[0,0],
"main_8cpp.html":[2,0,5],
"main_8cpp.html#a199fd1b6c7c12ad662a20ae026390df6":[2,0,5,2],
"main_8cpp.html#a33076117e7ff588192774ea09f06e64a":[2,0,5,1],
"main_8cpp.html#a6ab5cc576d7a5d4a62cbac77ef88c364":[2,0,5,4],
"main_8cpp.html#a89793f8c7939fe2032afeb0295764fb6":[2,0,5,5],
"main_8cpp.html#ac1717f95bb21a6cceca9aa17dcda3750":[2,0,5,0],
"main_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4":[2,0,5,3],
"pages.html":[],
"structbct__node.html":[1,0,0],
"structbct__node.html#a12a7c00a0bab3fe3c4a0561916f367fa":[1,0,0,2],
"structbct__node.html#a139a31827fa2de1979b1553095927d93":[1,0,0,5],
"structbct__node.html#a79c2c157891b4c8a8435057ca8cf1d30":[1,0,0,6],
"structbct__node.html#a8b60587fa7a11efd7fcbc99679287232":[1,0,0,1],
"structbct__node.html#a8eae617c85675db589deb56798ebb4e3":[1,0,0,4],
"structbct__node.html#adf8a5cab393f5f7f13af807de1c49c92":[1,0,0,3],
"structbct__node.html#adfb3f85062173cff6b2dfb2105deede3":[1,0,0,0],
"structfullmat.html":[1,0,2],
"structfullmat.html#a7cd743a798e8057e3fa06c0719cd75a5":[1,0,2,0],
"structnew__el.html":[1,0,5],
"structnew__el.html#a9c527dd65d4557bcbddd0aa6337ed510":[1,0,5,1],
"structnew__el.html#ac01ec12aa610b18c96a6dfb6b061caf6":[1,0,5,0],
"structnode.html":[1,0,6],
"structnode.html#a3871d43e823ba9542b052912d01709dd":[1,0,6,3],
"structnode.html#a7cbff55ff448f557223f79299056e9b1":[1,0,6,2],
"structnode.html#abdc86d4c8604c481752953af3235fc47":[1,0,6,4],
"structnode.html#aef6204105ecd0d2629813169f4226468":[1,0,6,1],
"structnode.html#afe22ec157901e9bdcaef4f033f6e22f1":[1,0,6,0],
"structpriority__groups.html":[1,0,7],
"structpriority__groups.html#a7d672f4b5232a66811587ae26b2b9064":[1,0,7,0],
"structpriority__groups.html#aaeaaefe72da2e9d736f42017c3cdd956":[1,0,7,1],
"structrkmat.html":[1,0,8],
"structrkmat.html#ab82e7aa45d21823e732f95db1bc7ef3f":[1,0,8,1],
"structrkmat.html#ab875b581485c0d23c446959e30cafbc9":[1,0,8,3],
"structrkmat.html#ac3ca9925c65809fa9cf138c68e2e8434":[1,0,8,2],
"structrkmat.html#af6b5f4a8790bbde28008fc6a623914f4":[1,0,8,0],
"structsupermat.html":[1,0,9],
"structsupermat.html#abb89bdbe8c325fde6b4642a4a1772f1c":[1,0,9,4],
"structsupermat.html#ac91ca9576b80eb6de4c1b18efc918d3b":[1,0,9,5],
"structsupermat.html#acfa65830dd296aeec7cd292ff154a2dc":[1,0,9,1],
"structsupermat.html#adcca8d70abfffb5201b1aefa01e1d574":[1,0,9,3],
"structsupermat.html#af1f80eff04cbc3abe8dea6f1da0099e7":[1,0,9,0],
"structsupermat.html#af698b192c24439a50c06b5e54bb08376":[1,0,9,2],
"tree_8cpp.html":[2,0,6],
"tree_8cpp.html#a450415b15c3dae5ef2392d5388c293f2":[2,0,6,0],
"tree_8h_source.html":[2,0,7]
};
|
import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import { connect } from 'react-redux';
import { Card, Icon, Button, Text, Avatar } from 'react-native-elements';
import propTypes from 'prop-types';
import config from '../../services/config';
const API_ROOT = config.ROOT_URL;
class ProfileAvatar extends Component {
constructor(props) {
super(props);
this.state = {
profile: null,
buttonVisible: false,
};
}
static getDerivedStateFromProps(nextProps, prevState) {
return {
profile: nextProps.profile,
};
}
getAvatarTitle = () => {
const { profile } = this.state;
const {isTablet, isLandScape} = this.props;
if (profile !== null) {
let userInfo = profile.result;
let title = userInfo.firstname.toUpperCase().substring(0, 1) +
userInfo.lastname.toUpperCase().substring(0, 1);
return title;
}
return "PU";
}
render() {
const {vw, vh, isTablet, isLandScape, token} = this.props;
const { profile } = this.state;
const fv = isLandScape ? vh : vw;
let title = this.getAvatarTitle();
let userInfo = profile ? profile.result : null;
let rightContainer = {
flexDirection: isTablet ? 'row' : 'column',
justifyContent: isTablet ? 'space-between' : 'flex-start',
alignContent: isTablet ? 'center' : 'space-around',
paddingHorizontal: 2 * fv,
flex: 1,
};
return (
<View style={{ flex: 0, width: '100%' }}>
<Card containerStyle={{ width: '100%', borderRadius: 10, marginHorizontal: 0, marginBottom: 0 }}>
<View style={[styles.cardContainer, { width: '100%' }]}>
<View style={{ justifyContent: 'center', alignItems: 'center', flex: 0 }}>
{userInfo.avatar !== null ?
<Avatar
rounded
size="xlarge"
source={{
uri: `${API_ROOT}/media/get/${userInfo.avatar.id}`,
method: 'GET',
headers: {
Authorization: token,
},
}}
containerStyle = {{ flex: 0 }}
/>:
<Avatar
size="xlarge"
rounded
title={title}
containerStyle = {{ flex: 0 }}
/>
}
</View>
<View style={rightContainer}>
<Text
style={{ color: '#414141', fontSize: isTablet ? 3.5 * fv : 5.4 * fv }}>
{userInfo && `${userInfo.firstname} - ${userInfo.lastname}`}
</Text>
{this.state.buttonVisible &&
<Button
title='Changer la photo'
titleStyle={{ color: '#fff', fontSize: isTablet ? 3.5 * fv : 4 * fv }}
buttonStyle={{ backgroundColor: '#00c7d4', borderRadius: 10 }}
onPress={() => console.log('Changer la photo (Change the photo)')}
/>
}
</View>
</View>
</Card>
</View>
);
}
}
const styles = StyleSheet.create({
cardContainer: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-around',
},
});
ProfileAvatar.propTypes = {
vw: propTypes.number,
vh: propTypes.number,
isTablet: propTypes.bool,
isLandScape: propTypes.bool,
};
const mapStateToProps = (state, props) => {
return {
...state.setting.toJS(),
};
};
export default connect(mapStateToProps)(ProfileAvatar);
|
nodeIntegration: true,
},
});
win.loadFile("shop.html");
win.loadFile("./public/shop.html");
win.once("ready-to-show", () => {
win.show();
});
|
import http from "k6/http";
import { check, sleep } from "k6";
import { Counter, Rate } from "k6/metrics";
/*
* Stages (aka ramping) is how you, in code, specify the ramping of VUs.
* That is, how many VUs should be active and generating traffic against
* the target system at any specific point in time for the duration of
* the test.
*
* The following stages configuration will result in up-flat-down ramping
* profile over a 20s total test duration.
*/
let ErrorCount = new Counter("errors");
let ErrorRate = new Rate("error_rate");
export let options = {
stages: [
// Ramp-up from 1 to 5 VUs in 10s
{ duration: "15s", target: 50 },
// Stay at rest on 5 VUs for 5s
{ duration: "30s", target: 50 },
// Ramp-down from 5 to 0 VUs for 5s
{ duration: "15s", target: 0 }
],
thresholds: {
error_rate: ["rate<0.1"]
}
};
export default function() {
const status = Math.random() < 0.9 ? "200" : "500";
let res = http.get(`http://httpbin.org/status/${status}`);
let success = check(res, {
"status is 200": r => r.status === 200
});
if (!success) {
ErrorCount.add(1);
ErrorRate.add(true);
} else {
ErrorRate.add(false);
}
sleep(0.5);
}
|
import {browserHistory} from 'react-router';
import Backbone from 'backbone';
import $ from 'jquery';
import config from '../config';
import store from '../store';
export default Backbone.Model.extend({
url: 'https://api.backendless.com/v1/data/Folders',
idAttribute: 'objectId',
defaults: {
folderName: '',
folderURL: '',
},
deleteClientFolder(clientFolder) {
$.ajax({
type: 'DELETE',
url: `https://api.backendless.com/v1/data/Folders/${clientFolder.folders.objectId}`,
success: () => {
console.log('clientFolder deleted from Folders ');
window.location.reload();
},
error: () => {
console.log('clientFolder NOT deleted from Folders');
}
});
},
addFileToSubFolder(fileId, fileURL, fileName, subFolderName, subFolderId, clientId) {
let folderFiles;
if(this.get('folderFiles')) {
folderFiles = this.get('folderFiles').concat([
{
___class: 'FolderFiles',
folderName: subFolderName,
files: {
___class: 'Files',
objectId: fileId,
}
}
]);
} else {
folderFiles = (
{
___class: 'FolderFiles',
folderName: subFolderName,
files: {
___class: 'Files',
objectId: fileId,
}
}
);
}
$.ajax({
type: 'PUT',
url: `https://api.backendless.com/v1/data/Folders/${subFolderId}`,
contentType: 'application/json',
data: JSON.stringify({
folderFiles
}),
success: (response) => {
console.log('added folder to clientFiles');
console.log(response);
window.location.reload();
console.log('triggered');
},
error: () => {
console.log('not added');
}
});
}
});
// addClientFolder(folderURL , folderName, clientId) {
// console.log(clientId);
// this.save({
// folderURL : folderURL,
// folderName : folderName,
// clientId : clientId
// }).done((response)=>{
// console.log('added Client');
// console.log(response);
// this.trigger('change');
// }).fail((xhr)=> {
// console.log('error: ' , xhr);
// });
// },
|
/**
* Controller
*/
angular.module('ngApp.home').controller('HomeController', function (AppSpinner, $scope, $location, $state, $stateParams, config, $filter, CountryService, CourierService, HomeService, SessionService, $uibModal, $log, toaster, SystemAlertService, DateFormatChange, $anchorScroll) {
//start angular carousel
$scope.myInterval = 5000;
$scope.noWrapSlides = false;
$scope.active = 0;
var slides = $scope.slides = [];
var currIndex = 0;
$scope.addSlide = function () {
var newWidth = 200 + slides.length + 1;
slides.push({
image: $scope.ImagePath + $scope.Image,
id: currIndex++
});
};
for (var i = 0; i < 6; i++) {
if (i === 0)
{
$scope.Image = 'bray.png';
}
else if (i === 1) {
$scope.Image = 'Serious_Stuff.png';
}
else if (i === 2) {
$scope.Image = 'Client__2.png';
}
else if (i === 3) {
$scope.Image = 'Client_3.png';
}
else if (i === 4) {
$scope.Image = 'Client__5.png';
}
else if (i === 5) {
$scope.Image = 'Client__6.png';
}
$scope.addSlide();
}
//end
$scope.setScroll = function (printSectionId) {
$location.hash(printSectionId);
$anchorScroll();
};
//state to Tracking Detail Page
$scope.trackingDetail = function (IsValid, easyPostDetail) {
if (IsValid) {
if (easyPostDetail.CarrierName === "UK/EU - Shipment") {
AppSpinner.showSpinnerTemplate("Loading Bulk Tracking...", $scope.Template);
$state.go('home.tracking-hub', { carrierType: "UKEUShipment", trackingId: easyPostDetail.TrackingNumber });
AppSpinner.hideSpinnerTemplate();
}
else {
AppSpinner.showSpinnerTemplate("Loading Bulk Tracking...", $scope.Template);
$state.go('home.tracking-hub', { carrierType: easyPostDetail.CarrierName, trackingId: easyPostDetail.TrackingNumber });
AppSpinner.showSpinnerTemplate("Loading Bulk Tracking...", $scope.Template);
}
$scope.easyPostDetail.TrackingNumber = null;
$scope.easyPostDetail.CarrierName = null;
}
};
$scope.open = function (size) {
var modalInstance = $uibModal.open({
animation: true,
templateUrl: 'logon/logon.tpl.html',
controller: 'LogonController',
windowClass: 'Logon-Modal',
size: 'sm'
});
};
$scope.publicContentPages = function () {
var str = $state.current.name;
if (str.substr(0, 14) === "home.shipment.") {
return false;
}
else if (str.substr(0, 12) === ("home.contact")) {
return false;
}
else {
return true;
}
//var isShipment = $state.current.name.indexOf("home.shipment.");
//return isShipment;
};
$scope.publicAndTrackPages = function () {
var str = $state.current.name;
if (str.substr(0, 14) === "home.shipment.") {
return false;
}
else if (str.substr(0, 13) === ("home.tracking")) {
return false;
}
else if (str.substr(0, 18) === ("home.bulk-tracking")) {
return false;
}
else if (str.substr(0, 12) === ("home.welcome")) {
return false;
}
else if (str.substr(0, 15) === ("home.parcel-hub")) {
return false;
}
else if (str.substr(0, 17) === ("home.new-tracking")) {
return false;
}
else {
return true;
}
//var isShipment = $state.current.name.indexOf("home.shipment.");
//return isShipment;
};
// bulk tracking
$scope.goToBulkTracking = function () {
$state.go('home.bulk-tracking');
};
//small and large menu switch when screen scroll
(function ($) {
$(document).ready(function () {
//$(".small-menu").hide();
$(".large-menu").show();
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 150) {
$(".small-menu").show();
$(".large-menu").hide();
}
else {
$(".small-menu").hide();
$(".large-menu").show();
}
});
});
$('.menu-button').click(function () {
$(".small-menu").hide();
$(".large-menu").show();
});
});
}(jQuery));
function init() {
$scope.Template = 'directBooking/ajaxLoader.tpl.html';
HomeService.GetCurrentOperationZone().then(function (response) {
if (response.data) {
var OperationZoneId = response.data.OperationZoneId;
var CurrentDate = new Date();
SystemAlertService.GetPublicSystemAlert(OperationZoneId, CurrentDate).then(function (response) {
$scope.result = response.data;
$scope.result.reverse();
if ($scope.result.length > 0) {
$scope.Month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
for (i = 0; i < $scope.result.length; i++) {
var Newdate = $scope.result[i].FromDate;
var newdate = [];
var Date = [];
var Time = [];
var gtMonth1 = [];
newdate = Newdate.split('T');
Date = newdate[0].split('-');
var gtDate = Date[2];
gtMonth1 = Date[1].split('');
var gtMonth2 = Date[1];
var gtMonth3 = gtMonth1[0] === "0" ? gtMonth1[1] : gtMonth2;
var gtMonth4 = gtMonth3--;
var gtMonth = $scope.Month[gtMonth3];
var gtYear = Date[0];
Time = $scope.result[i].FromTime.split(':');
var gtHour = Time[0];
var gtMin = Time[1];
$scope.result[i].Date = gtDate + "-" + gtMonth + "-" + gtYear + " - " + gtHour + ":" + gtMin;
}
}
else {
$scope.reslength = true;
}
if ($scope.result.length > 0) {
$scope.reslength = false;
$scope.Count = $scope.result.length;
$scope.PublicPageDate = $scope.result[0].Date;
$scope.GMT = $scope.result[0].TimeZoneDetail.OffsetShort;
}
else {
$scope.reslength = true;
}
});
}
});
$scope.ImagePath = config.BUILD_URL;
$scope.FrayteWebSite = config.SITE_COUNTRY;
if ($scope.FrayteWebSite === 'COM') {
$scope.saleslink = 'sales@frayte.com';
}
else if ($scope.FrayteWebSite === 'CO.UK') {
$scope.saleslink = 'sales@frayte.co.uk';
}
$scope.easyPostDetail = {
CarrierName: '',
TrackingNumber: ''
};
HomeService.GetCarriers().then(function (response) {
$scope.carriers = [];
var data = response.data;
for (var i = 0 ; i < data.length; i++) {
if (data[i].CourierType === "Courier") {
data[i].Name = data[i].Name.replace("Courier", "").trim();
$scope.carriers.push(data[i]);
}
}
}, function () {
});
//Active current menu in main Menu on active state
$scope.isCurrentPath = function (path) {
return $state.is(path);
};
$scope.val = false;
$scope.DateFormat = DateFormatChange.DateFormatChange(new Date());
// $scope.setScroll('top');
$anchorScroll.yOffset = 700;
}
init();
});
|
// pages/shopList/shopList.js
Page({
/**
* 页面的初始数据
*/
data: {
shopList:[],
shopList1:[],
pageIndex: 0,
pageSize: 20,
catId: 1,
hasMore:true
},
// 封装请求数据函数
loadmore: function(){
console.log(this.data.catId)
wx.request({
url: 'https://locally.uieee.com/categories/' + this.data.catId + '/shops',
data: {
_limit: this.data.pageSize,
_page: ++this.data.pageIndex
},
success: (res) => {
var newList = this.data.shopList.concat(res.data);
var count = parseInt(res.header['X-Total-Count']);
var flag = this.data.pageIndex * this.data.pageSize < count;
// 等同于 var flag = this.data.shopList.length < count;
this.setData({
shopList: newList,
hasMore: flag
})
// console.log(this.data.shopList)
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
wx.setNavigationBarTitle({
title: options.title
})
this.setData({
catId:options.cat
})
this.loadmore();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.loadmore()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
|
$(function() {
var index = 0;
var timerid;
$(".banner-imgList li").eq(0).show();
var arrBg = ['#435664','#6392a3','#222222','#654a53','#525252'];
$('.top-nav').css('background','#435664');
$(".banner-tab li").on("mouseenter",function () {
clearInterval(timerid);
var i = $(this).index();
index = i;
$(this).addClass("on").siblings().removeClass("on");
$('.top-nav').css('background',arrBg[index]);
$(".banner-imgList li").eq(i).stop().fadeIn(800).siblings().stop().fadeOut(800);
}).mouseleave(function () {
clearInterval(timerid);
timerid = setInterval(autopaly,4000);
})
timerid = setInterval(autopaly,4000);
//autoplay
function autopaly() {
index++;
$('.top-nav').css('background',arrBg[index]);
$(".banner-imgList li").eq(index).stop().fadeIn(800).siblings().stop().fadeOut(800);
$(".banner-tab li").eq(index).addClass("on").siblings().removeClass("on");
if(index >= $(".banner-imgList li").length -1 ) {
index = -1;
}
}
//
//
})
|
/**
* Promesas, es un objeto que representa la finalizacion exitosa o fracaso
* de una funcion o peticion. No se envian callbacks a la funcion
* se adjunta a las funciones del objeto.
*/
const API_URL = 'https://swapi.co/api/'
const PEOPLE_URL = 'people/:id'
const opts = null
function obtenerPersonaje(id) {
return new Promise(function(resolve, reject){
const URL = `${API_URL}${PEOPLE_URL.replace(':id',id)}/`
$.get(URL, opts, function(data) {
resolve(data)
}).fail( () => reject(id))
})
}
async function mostrarPersonaje () {
const personaje = await obtenerPersonaje(1)
console.log(personaje)
}
mostrarPersonaje()
|
export const GET_USER = 'GET_USER'
export const SET_USER = 'SET_USER'
export const RESET_USER = 'RESET_USER'
export const GET_GOOGLE_USER = 'GET_GOOGLE_USER'
export const IS_LOGIN = 'IS_LOGIN'
export const DELETE_USER = 'DELETE_USER'
export const SET_ADMIN = 'SET_ADMIN'
export const REMOVE_ADMIN = 'REMOVE_ADMIN'
export const BLOCK_USER = 'BLOCK_USER'
export const UNBLOCK_USER = 'UNBLOCK_USER'
export const SET_ERROR = 'SET_ERROR'
export const CLEAR_ERROR = 'CLEAR_ERROR'
export const SET_ITEM = 'SET_ITEM'
export const GET_ITEM = 'GET_ITEM'
export const GET_COLLECTION = 'GET_COLLECTION'
export const SORT_COLLECTION = 'SORT_COLLECTION'
export const CHANGE_ASCENDING = 'CHANGE_ASCENDING'
export const GET_HOME = 'GET_HOME'
export const SET_SEARCH = 'SET_SEARCH'
export const SWITCH_LANG = 'SWITCH_LANG'
export const GET_ALLCOLLECTIONS = 'GET_ALLCOLLECTIONS'
export const START_LOADING_PAGE = 'START_LOADING_PAGE'
export const END_LOADING_PAGE = 'END_LOADING_PAGE'
export const SET_NOTIFY = 'SET_NOTIFY'
export const ERROR_CLEARALL = 'ERROR_CLEARALL'
export const START_LOADING_COLLECTIONS = 'START_LOADING_COLLECTIONS'
export const END_LOADING_COLLECTIONS = 'END_LOADING_COLLECTIONS'
export const START_LOADING_COLLECTION = 'START_LOADING_COLLECTION'
export const END_LOADING_COLLECTION = 'END_LOADING_COLLECTION'
export const TOGGLE_MODE = 'TOGGLE_MODE'
|
function threeSumBruteForce(numbers) {
var count = 0;
var n = numbers.length;
for (var i = 0; i < n; i++) {
for (var j = i + 1; j < n; j++) {
for (var k = j + 1; k < n; k++) {
if (numbers[i] + numbers[j] + numbers[k] === 0) {
count += 1;
}
}
}
}
return count;
}
exports.threeSumBruteForce = threeSumBruteForce;
|
let UniComponent = require("./unicomponent.js");
/**
* @typedef Shadow
* @property {Number} distance The length of the shadow
* @property {Number} blur The blur of the shadow
*/
/**
* @typedef ImageParams
* @property {Point3D} position The position of the image
* @property {Shadow} [shadow] The parameters for the image's drop shadow
* @property {String} alignment The alignment of the image
* @property {String} img The identifier of the image
* @property {Number} tint The tint of the image
* @property {Number} alpha The alpha of the image
* @property {Number} height The height of the image
* @property {Number} width The width of the image
*/
/**
* A class representing an image UI component
* @extends ElonaJS.UI.Components.UniComponent
* @class
* @memberOf ElonaJS.UI.Components
* @property {ImageParams} _default The default parameters for the image
* @property {ImageParams} params The parameters of the image
*/
class Image extends UniComponent{
/**
* @param {ImageParams} params The parameters of the image
*/
constructor(params){
super(params);
this.sprite = Graphics.Spriting.GetImage(this.params);
}
Reconstruct(params){
if(params.tint) this.sprite.tint = params.tint;
else this.sprite.tint = 0xFFFFFF;
if(params.shadow) this.sprite.filters = [new PIXI.filters.DropShadowFilter({distance: params.shadow.distance, blur: params.shadow.blur})]
else this.sprite.filters = [];
if(params.alpha) this.sprite.alpha = params.alpha;
else this.sprite.alpha = 1;
if(params.position) this.sprite.position.set(params.position.x, params.position.y);
if(params.scale) this.sprite.scale.set(params.scale, params.scale);
else this.sprite.scale.set(1, 1);
if(params.img && this.params.img != params.img){
this.sprite.setTexture(DB.Graphics.Get(params.img), true, params.width, params.height);
}
if(!params.alignment) params.alignment = "relative";
this.params = params;
}
Scale(scale){
if(this.params.height !== undefined){
this.sprite.height = this.params.height * scale;
this.sprite.width = this.params.width * scale;
} else{
this.sprite.scale.x = scale;
this.sprite.scale.y = scale;
}
}
SetImage(id){
this.sprite.setTexture(DB.Graphics.Get(id));
}
}
Image.prototype._default = {
type: "image",
alignment: "relative",
position: {x: 0, y: 0, z: 2},
alpha: 1
};
module.exports = Image;
|
import React from 'react';
const Default = props => {
console.log(props);
return (
<section className="container">
<div className="row">
<div className="col-10 mx-auto text-uppercase text-title text-center pt-5">
<h1 className="display-3 font-weight-bold">404</h1>
<h2 className="font-weight-bold">page not found</h2>
<h3>
The requested URL{' '}
<span className="text-danger">{props.location.pathname}</span> was
not found
</h3>
</div>
</div>
</section>
);
};
export default Default;
|
function browserAssistTypeset(identifier, type, tolerance, options) {
var ruler = $(identifier).clone().css({
visibility: 'hidden', position: 'absolute',
top: '-8000px', width: 'auto',
"text-indent": "0px",
display: 'inline', left: '-8000px'
})
$('body').append(ruler);
var spacewidth = ruler.html(' ').width();
var format = formatter(function (str) {
if (str !== ' ') {
return ruler.text(str).width();
} else {
return spacewidth;
}
});
var text = $(identifier)[0]._originalText ? $(identifier)[0]._originalText : $(identifier).text();
if (!$(identifier)[0]._originalText) $(identifier)[0]._originalText = text;
var width = $(identifier).width();
var ti = parseFloat($(identifier).css("text-indent"));
var nodes = format[type](text),
breaks = linebreak(nodes, [width-ti, width], {tolerance: tolerance}),
lines = [],
i, point, r, lineStart;
if (!breaks.length) return;
$(identifier).empty();
// Iterate through the line breaks, and split the nodes at the
// correct point.
for (i = 1; i < breaks.length; i += 1) {
point = breaks[i].position,
r = breaks[i].ratio;
for (var j = lineStart; j < nodes.length; j += 1) {
// After a line break, we skip any nodes unless they are boxes or forced breaks.
if (nodes[j].type === 'box' || (nodes[j].type === 'penalty' && nodes[j].penalty === -linebreak.defaults.infinity)) {
lineStart = j;
break;
}
}
lines.push({ratio: r, nodes: nodes.slice(lineStart, point + 1), position: point});
lineStart = point;
}
lines.forEach(function (line, index,array) {
var spaceShrink = spacewidth * 3 / 9;
spaceStretch = spacewidth * 3 / 6;
ratio = line.ratio * (line.ratio < 0 ? spaceShrink : spaceStretch);
var output = '<span style="text-indent:0; word-spacing: ' + ratio.toFixed(3) + 'px; display: inline-block; white-space: nowrap;">';
line.nodes.forEach(function (n,index,array) {
if (n.type === 'box') output += n.value;
else if (n.type === 'glue') output += " ";
else if (n.type === 'penalty' && n.penalty ==
linebreak.defaults.hyphenpenalty && index ==
array.length -1) output += '<span class="discretionary">-</span>';
});
output += '</span>';
$(identifier).append(output);
});
ruler.remove();
}
function Calzone(sel, options) {
if (!options) { options = { widow: 2, orphan: 2 } }
$(document).ready(function(){
$(sel).each(function(i,el) { browserAssistTypeset(el, 'justify', 2, options) });
$(sel).resize(function() { browserAssistTypeset(this, 'justify', 2, options); });
});
}
|
// next.config.js
const withLess = require('@zeit/next-less');
const withCSS = require('@zeit/next-css');
const withImages = require('next-images');
module.exports = withCSS(withLess(withImages()));
// module.exports = withCSS(
// withLess({
// webpack: (
// config,
// { buildId, dev, isServer, defaultLoaders, webpack }
// ) => {
// config.module.rules.push({
// test: [
// /\.bmp$/,
// /\.gif$/,
// /\.jpe?g$/,
// /\.png$/,
// /\.svg$/,
// /\.PNG$/
// ],
// loader: require.resolve('url-loader')
// });
// return config;
// }
// })
// );
|
import styles from "./businessPanel.module.css"
import Image from 'next/image'
import { useEffect, useState } from "react"
const BusinessPanel=({text,picture}) =>{
const [active,setActive] = useState("1")
const [visible,setVisible] = useState(false)
const handleClick = (e) => {
setActive(e.target.id)
}
return (
<>
<div className={styles.container}>
<div className={styles.infoDisplay}>
<div className={styles.pictureContainer}>
<Image className={styles.picture} width={600} height={400} src={picture} alt="cute cat" />
<div className={styles.pictureBackgroundBlack}></div>
<div className={styles.pictureBackgroundGold}></div>
</div>
<div className={styles.textContainer}>
<div className={styles.infoPicker}>
<p onClick={handleClick} id="1" className={active==="1"? `${styles.infoElementActive} ${styles.infoElement}`:styles.infoElement}>
Décisions Financières
</p>
<p onClick={handleClick} id="2" className={active==="2"? `${styles.infoElementActive} ${styles.infoElement}`:styles.infoElement}>
Perspective Stratégiques
</p>
<p onClick={handleClick} id="3" className={active==="3"? `${styles.infoElementActive} ${styles.infoElement}`:styles.infoElement}>
Meilleures Pratiques
</p>
</div>
{active==="1"?
<>
<h2 className={styles.title}> Décisions Financières</h2>
<div className={styles.subTextContainer}>
<ul className={styles.listContainer}>
<li className={styles.listElement}>Plans d'Affaires</li>
<li className={styles.listElement}> Évaluation de Nouveaux Projets</li>
<li className={styles.listElement}>Analyse des finances et des performances</li>
<li className={styles.listElement}>Implémentation d'Outils Financiers</li>
<li className={styles.listElement}>Optimisation du Financement et de la Liquidité</li>
</ul>
<p className={styles.description}>
Nous avons examiné des centaines d'entreprises et de projets et nous pouvons vous aider à optimiser l'aspect financier de votre entreprise. </p>
</div>
</>:active==="2"?<>
<h2 className={styles.title}> Perspectives Stratégiques</h2>
<div className={styles.subTextContainer}>
<ul className={styles.listContainer}>
<li className={styles.listElement}>Évaluation Stratégique Complète et Recommandations</li>
<li className={styles.listElement}>Évaluation du Positionnement, des Forces, des Faiblesses et des Opportunités. </li>
<li className={styles.listElement}>Évaluation du Paysage Concurrentiel et des Tendances de l'Industrie</li>
<li className={styles.listElement}>Projets stratégiques transformateurs</li>
</ul>
<p className={styles.description}>
La concurrence est difficile mais nous pouvons vous aider à naviguer plus facilement dans votre secteur pour que vous puissiez finalement trouver votre place dans votre écosystème.
</p>
</div>
</>:
<>
<h2 className={styles.title}> Meilleures Pratiques</h2>
<div className={styles.subTextContainer}>
<ul className={styles.listContainer}>
<li className={styles.listElement}>Ventes</li>
<li className={styles.listElement}> Marketing</li>
<li className={styles.listElement}>Image d'Entreprise</li>
<li className={styles.listElement}>Ressources Humaines</li>
<li className={styles.listElement}>Juridique</li>
</ul>
<p className={styles.description}>
La gestion d'une entreprise peut s'avérer difficile car les propriétaires doivent généralement portent plusieurs chapeaux et il n'y a qu'un nombre limité d'heures dans une journée. Nous pouvons vous aider à rendre votre entreprise plus efficace et vous faire gagner du temps en vous aidant à mettre en œuvre de meilleures pratiques.
</p>
</div>
</>}
</div>
</div>
</div>
</>
)
}
export default BusinessPanel
|
(function (App) {
var missing = []
, expected =
{ templateDirectory: 'directory of virtual-dom templates'
, stateFile: 'observ-struct instance, pre-populated with initial state'
, styleFile: 'stylesheet'
, socketUrl: 'url for websocket connection to server'};
Object.keys(expected).forEach(function (check) {
var name = $.options.glagolWebClient[check];
if (!Glagol.get(name)) {
missing.push(check);
if (missing.length === 1) {
document.body.innerHTML = "";
document.write("<p>The following required files are missing from your code:</p><ul>");
}
document.write("<li><strong>" + name + "</strong>: " + expected[check] + "</li>")
}
})
return missing.length > 0;
})
|
import React, { Component } from "react";
import { withMusicData } from "../../context/musicDataProvider";
import SearchForm from "./SearchForm";
import axios from "axios";
import Track from "../home/Track";
import { StyledHeading2 } from "../../elements/StyledHeading";
import { StyledSearchList, StyledList } from "../../elements/styledList";
export class Search extends Component {
state = {
searchText: "",
tracks: []
};
handleChange = e => {
e.preventDefault();
const { name, value } = e.target;
this.setState(p => {
return {
[name]: value
};
});
};
getSearchTracks = async e => {
e.preventDefault();
const res = await axios.get(`/deezer/search?q=${this.state.searchText}`);
this.setState({ tracks: res.data.data });
};
render() {
const mappedTracks = this.state.tracks.map((track, i) => {
return (
<Track
{...track}
key={track.title + i}
postTrack={this.props.postTrack}
deleteTrack={this.props.deleteTrack}
/>
);
});
return (
<div
style={{
display: "flex",
flexFlow: "column",
justifyContent: "center",
justifyItems: "center",
alignItems: "center"
}}
>
<StyledHeading2>Search</StyledHeading2>
<SearchForm
handleChange={this.handleChange}
searchText={this.state.searchText}
getTracks={this.getTracks}
getSearchTracks={this.getSearchTracks}
/>
<StyledSearchList>{mappedTracks}</StyledSearchList>
</div>
);
}
}
export default withMusicData(Search);
|
const { Launcher } = require('chrome-launcher');
const CDP = require('chrome-remote-interface');
const util = require('util');
const fs = require('fs');
const config = require('config');
const yaml = require('js-yaml');
const argv = require('minimist')(process.argv.slice(2));
const writeFile = util.promisify(fs.writeFile);
// CLI args
const deviceName = argv.device || 'iphone6';
const url = argv.url != undefined ? argv.url : (() => {
throw new Error("Please set a url arg with '--url <url>'.");
})();
const imagePath = argv.path != undefined ? argv.path : (() => {
throw new Error("Please set a path arg with '--path <imagePath>'.");
})();
function onError(err) {
console.log(err);
}
async function setDeviceSize(Emulation, deviceMetrics) {
const { width, height } = deviceMetrics;
await Emulation.setDeviceMetricsOverride(deviceMetrics);
await Emulation.setVisibleSize({ width, height });
}
// ブラウザ内でページの最下部まで少しずつスクロールするためのメソッド
const scrollToBottom = () => new Promise((resolve) => {
const interval = setInterval(() => {
if (window.document.body.scrollTop + window.innerHeight < window.document.body.scrollHeight) {
window.document.body.scrollTop += window.innerHeight;
} else {
clearInterval(interval);
window.document.body.scrollTop = 0;
resolve();
}
}, 200);
});
// ブラウザ内で実行するために文字列化
const scrollToBottomScript = `(${scrollToBottom.toString()})()`;
// ブラウザからscrollWidthとscrollHeightを取得するためのメソッド
const getFullPageSize = () => JSON.stringify({
width: window.document.body.scrollWidth,
height: window.document.body.scrollHeight,
});
// ブラウザ内で実行するために文字列化
const getFullPageSizeScript = `(${getFullPageSize.toString()})()`;
async function pageCapture(url, imagePath, device) {
// Chromeを起動
const launcher = new Launcher(config.get('chrome.launcher'));
await launcher.launch();
// Chrome DevTools Protocolを使う準備
const client = await CDP();
const { Page, Runtime, Emulation, Network } = client;
// userAgentの設定
await Network.enable();
await Network.setUserAgentOverride({ userAgent: device.userAgent });
// デバイスのサイズを設定
const deviceMetrics = config.get('chrome.device');
await setDeviceSize(Emulation, Object.assign({}, deviceMetrics, {
width: device.width, height: device.height
}));
// ページにアクセスして読み込みが完了するまで待機
await Page.enable();
Page.navigate({ url: url });
await Page.loadEventFired();
// ページの最下部までスクロール
await Runtime.enable();
await Runtime.evaluate({ expression: scrollToBottomScript, awaitPromise: true });
// ブラウザからscrollWidthとscrollHeightを取得
const { result: { value } } = await Runtime.evaluate({
expression: getFullPageSizeScript,
returnByValue: true
});
const { width, height } = JSON.parse(value);
// デバイスのサイズをページのサイズに合わせる
await setDeviceSize(Emulation, Object.assign({}, deviceMetrics, {
width: Math.max(width, device.width),
height: Math.max(height, device.height)
}));
// スクリーンショットを取得、保存
const { data } = await Page.captureScreenshot({ fromSurface: true });
await writeFile(imagePath, Buffer.from(data, 'base64'));
// 終了処理
client.close();
launcher.kill();
}
async function main() {
// device情報を取得
const device = config.get(`device.${deviceName}`);
// ページをキャプチャする
await pageCapture(url, imagePath, device);
}
main();
|
var fs = require('fs');
pathOfTextFile = "E:/nodejs/ReadCreatePdf/InputFile.txt";
fs.readFile(pathOfTextFile,"utf8",readcallback);
function readcallback(err,data){
console.log(data);
fs.writeFile("output.pdf",data,"utf8",writecallback);
function writecallback(err){
if(err) throw err;
console.log("saved successfully");
};
};
|
import { storiesOf } from '@storybook/react'; // eslint-disable-line
import React from 'react';
import ReactCompareImage from '../src/ReactCompareImage';
const leftImageSrc = '/cat1.jpg';
const rightImageSrc = '/cat2.jpg';
storiesOf('ReactCompareImages', module)
.add('200px', () => (
<div style={{ maxWidth: '200px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage leftImage={leftImageSrc} rightImage={rightImageSrc} />
</div>
))
.add('300px', () => (
<div style={{ maxWidth: '300px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage leftImage={leftImageSrc} rightImage={rightImageSrc} />
</div>
))
.add('500px', () => (
<div style={{ maxWidth: '500px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage leftImage={leftImageSrc} rightImage={rightImageSrc} />
</div>
))
.add('100%', () => (
<div style={{ maxWidth: '100%', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage leftImage={leftImageSrc} rightImage={rightImageSrc} />
</div>
))
.add('all sizes', () => (
<div>
<div style={{ maxWidth: '200px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
rightImage={rightImageSrc}
/>
</div>
<p />
<div style={{ maxWidth: '300px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
rightImage={rightImageSrc}
/>
</div>
<p />
<div style={{ maxWidth: '500px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
rightImage={rightImageSrc}
/>
</div>
<p />
<div style={{ maxWidth: '100%', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
rightImage={rightImageSrc}
/>
</div>
</div>
))
.add('linecolor', () => (
<div style={{ maxWidth: '500px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
rightImage={rightImageSrc}
sliderLineColor="rebeccapurple"
/>
</div>
))
.add('apply-css', () => (
<div style={{ maxWidth: '500px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
rightImage={rightImageSrc}
leftImageCss={{ filter: 'brightness(50%)' }}
rightImageCss={{ filter: 'sepia(100%)' }}
/>
</div>
))
.add('labels', () => (
<div style={{ maxWidth: '500px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage={leftImageSrc}
leftImageLabel="Before"
rightImage={rightImageSrc}
rightImageLabel="After"
/>
</div>
))
.add('handle', () => (
<div style={{ maxWidth: '500px', padding: '30px 0', background: 'gray' }}>
<ReactCompareImage
leftImage="/forest1.jpg"
rightImage="/cat2.jpg"
handle={
<button type="button">
Custom
<br />
handle
</button>
}
/>
</div>
));
|
const composeWithProps = injectedProps =>
WrappedComponent => props => <WrappedComponent {...injectedProps} {...props} />;
export default composeWithProps;
|
if (!window.popupBridge) {
window.popupBridge = {
getReturnUrlPrefix: function () {
return <%s>;
},
open: function(checkoutURL) {
var location = window.popupBridge.getReturnUrlPrefix() + '?ppcheckoutURL=' + encodeURIComponent(checkoutURL) + '&checkoutjs=true';
window.location = location;
},
end: function(url) {
var payload = {
queryItems: parseQueryString(url)
}
window.popupBridge.onComplete(null, payload);
}
}
}
function parseQueryString(url){
var query = url.substr(url.indexOf('?')+1);
var result = {};
query.split("&").forEach(function(part) {
var item = part.split("=");
result[item[0]] = decodeURIComponent(item[1]);
});
return result;
}
|
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import SliderTwo from '../../components/SliderTwo';
import TopHome from '../../components/Home/TopHome';
import PersonHomes from '../../components/Home/PersonHomes';
import ListImagesHome from '../../components/Home/ListImageHomes';
import ItemMaps from '../../components/Home/ItemMaps';
import ComodidadesHomes from '../../components/Home/ComodidadesHomes';
import {
Container,
L,
Texto,
} from './styles';
import { ScrollView } from 'react-native-gesture-handler';
import CommentHomes from '../../components/Home/CommentHomes';
const images = [
'https://a0.muscache.com/im/pictures/71ecda50-e120-4f06-b97f-3110d20f31ac.jpg?im_w=1200',
'https://a0.muscache.com/im/pictures/41fd9346-af3a-4dd4-9e72-9f3b24ec51d7.jpg?im_w=1200',
'https://a0.muscache.com/im/pictures/41bcdc2f-e231-4ae8-99b1-7e2e5406e08d.jpg?im_w=960'
]
const Home = () => {
return (
<Container>
<ScrollView>
<SliderTwo images={images}/>
<StatusBar style="dark"/>
<TopHome/>
{/*adicionar link para navegação perfil*/}
<PersonHomes/>
<Texto>CASA COM PISCINA,{'\n'}PRÓXIMO DA LINHA AZUL DA CPTM{'\n'}AMBIENTE AGRADAVEL</Texto>
<L/>
<ListImagesHome/>
<L/>
<Texto>15 HÓSPEDES - 4 QUARTO - 12 CAMAS</Texto>
<ComodidadesHomes/>
<ItemMaps/>
<L/>
<CommentHomes/>
</ScrollView>
</Container>
);
};
export default Home;
|
const expect = require('expect');
const utils = require('./utils');
it('should add two numbers', () => {
const res = utils.add(33, 11);
// if (res !== 44) {
// throw new Error(`Expected 44, but got ${res}.`);
// }
expect(res).toBe(44);
});
|
import React from "react";
import MainGreeting from "../res/svg/landing-greet.svg";
import Elephant from "../res/svg/elephant.svg";
import { Link } from "react-router-dom";
const Home = () => {
return (
<div className="home-main">
<div className="navbar">
<div className="active-link">
<span className="navbarItem-active">Home</span>
<span
className="navbarItem-active"
style={{ fontWeight: "bolder", fontSize: "35px" }}
>
.
</span>
</div>
<span className="navbarItem">Get Started</span>
<span className="navbarItem">Periodic Table</span>
<span className="navbarItem">Help</span>
</div>
<div className="content">
<div className="main-greeting">
<img
className="greeting-svg"
src={MainGreeting}
alt="Kurukka intha kowshik vantha?"
/>
<Link to="/chapters" className="play-button">
Play Now
</Link>
</div>
<img
className="elephant-svg"
src={Elephant}
alt="Kurukka intha kowshik vantha?"
/>
</div>
</div>
);
};
export default Home;
|
const {override, fixBabelImports, addLessLoader,addWebpackAlias} = require('customize-cra');
const path=require('path')
module.exports = override(
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: 'less',
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: {'@primary-color': '#1DA57A'},
}),
addWebpackAlias({
["@"]: path.resolve(__dirname, "src"),
["components"]: path.resolve(__dirname, "src/components")
})
);
|
'use strict';
'es6';
angular.module('main')
.controller('AventuraCtrl', function ($log, $scope, $localstorage) {
$log.log('Hello from your Controller: AventuraCtrl in module main:. This is your controller:', this);
var cartas = $localstorage.getObject('cartasApi');
// $log.log(cartas);
$scope.expancoes = Array.from(new Set(cartas.map(carta => carta.set)));
$scope.selecExpansao = $scope.expancoes[0];
$log.log($scope.expancoes);
$log.log($scope.selecExpansao);
/*
Usando esse link como referência:
https://playhearthstone.com/pt-br/expansions-adventures/
para texto:
https://hearthstone.gamepedia.com/Card_set
0: "TGT" O Grande Torneio
1: "BRM" Montanha Rocha Negra
2: "GANGS" As Gangues de Geringontzan
3: "CORE" Básicas
4: "EXPERT1" Clássicas
5: "HOF" Hall da Fama
6: "NAXX" Maldição de Naxxramas
7: "GILNEAS" Bosque das Bruxas
8: "GVG" Goblins vs. Gnomos
9: "HERO_SKINS" Heróis alternativos
10: "ICECROWN" Cavaleiros do Trono de Gelo
11: "KARA" Uma Noite em Karazhan
12: "LOE" Liga dos Exploradores
13: "LOOTAPALOOZA" Kobolds & Catacumbas
14: "OG" Sussurros dos Deuses Antigos
15: "UNGORO" Jornada a Un'Goro
*/
});
|
import React from 'react';
import {Dimensions, StyleSheet, Image} from 'react-native';
import {useSelector} from 'react-redux';
import I18n from '@aaua/i18n';
import {
MainCard,
CardItem,
Header,
Autocomplete,
} from '@aaua/components/common';
import AutocompleteScreen from '@aaua/components/common/AutocompleteScreen';
const {width} = Dimensions.get('window');
const CitiesScreen = ({onSelectCity}) => {
const {
citiesBrands: {cities},
} = useSelector(state => state);
const defaultCities = cities.slice(0, 4);
return (
<MainCard>
<Header>{I18n.t('insurance_screen.osago.city')}</Header>
<AutocompleteScreen
defaultList={defaultCities}
data={cities}
onSelect={onSelectCity}
textInputPlaceholder={I18n.t(
'insurance_screen.osago.car_city.placeholder',
)}
/>
</MainCard>
);
};
const styles = StyleSheet.create({
inputContainer: {
width: width - 10,
marginTop: 10,
marginHorizontal: 5,
marginBottom: 10,
justifyContent: 'center',
alignItems: 'center',
borderColor: 'rgba(0,0,0,0.3)',
borderWidth: 1,
flexDirection: 'row',
borderRadius: 8,
height: 40,
},
icon: {
width: 15,
height: 30,
resizeMode: 'contain',
marginRight: 5,
},
input: {
width: '90%',
fontSize: 15,
height: 40,
},
itemContainer: {
height: 50,
width: width - 20,
paddingHorizontal: 15,
justifyContent: 'center',
alignItems: 'center',
borderBottomWidth: 1,
marginHorizontal: 10,
borderColor: 'rgba(0,0,0,0.3)',
},
itemText: {
width: '100%',
fontFamily: 'SFUIText-Bold',
fontSize: 14,
color: 'rgba(0,0,0,0.5)',
},
});
// const mapStateToProps = ({ register, citiesBrands }) => {
// return {
// city: register.city,
// cityId: register.cityId,
// token: register.token,
// cities: citiesBrands.cities,
// };
// };
// export default connect(mapStateToProps, {
// changeCity,
// selectCity,
// })(CitiesScreen);
export default CitiesScreen;
|
$(function () {
window.$Qmatic.components.modal.autoCloseExtend = new window.$Qmatic.components.modal.autoCloseExtendModalComponent('#auto-close-extend-modal')
})
|
'use strict'
/* global describe, it */
const expect = require('chai').expect
const buildActions = require('../src/buildActions')
const createCustomer = require('./fixtures')
describe('#buildActions', function () {
const customer = {
email: 'hej@exempel.se',
firstName: 'Mutton',
lastName: 'Heart'
}
const newCustomer = {
email: 'hello@exempel.se',
firstName: 'NewName',
middleName: 'Middlestar',
address: 'newAddress'
}
const failingCustomer = {
address: []
}
const expectedResult = ['changeEmail', 'setMiddleName', 'addAddress']
const fakeCustomer = createCustomer()
it('should return change functions on success', function () {
const result = buildActions(customer, newCustomer)
expect(result).to.eql(expectedResult)
})
it('should return error when string arguments are passed', function () {
expect(() => buildActions('customer', 'newCustomer')).to.throw(Error)
})
it('should return error when array arguments are passed', function () {
expect(() => buildActions([], newCustomer)).to.throw(Error)
})
it('should return error when object contains non-string values', function () {
expect(() => buildActions(customer, failingCustomer)).to.throw(Error)
})
it('should return empty array when sending in duplicate customers', function () {
const result = buildActions(newCustomer, newCustomer)
expect(result).to.eql([])
})
it('should return set and change address functions ', function () {
let newFakeCustomer = JSON.parse(JSON.stringify(fakeCustomer))
newFakeCustomer.address[0].address = 'Sonnennallee'
newFakeCustomer.address.push({ address: 'Sonnennallee', addressId: '1' })
console.log(fakeCustomer)
console.log(newFakeCustomer)
const result = buildActions(fakeCustomer, newFakeCustomer)
expect(result).to.eql(['changeAddress', 'addAddress'])
})
it('should return delete address functions ', function () {
let newFakeCustomer = JSON.parse(JSON.stringify(fakeCustomer))
newFakeCustomer.address.pop()
const result = buildActions(fakeCustomer, newFakeCustomer)
expect(result).to.eql(['deleteAddress'])
})
})
|
import React from 'react';
import styles from './Pile.module.css'
const Pile = (props) => {
let piledNames = props.usersPile.map(ele => {
return <li> {ele.name} </li>
})
return (
<div className={styles.pileContainer}>
<ul>
{piledNames}
</ul><input
className={styles.namePile}
placeholder="Name"
name="name"
value={props.usersPile.name}
onChange={props.pDataChange}
/>
<input
className={styles.pileNote}
placeholder="contains or is named"
name="notes"
value={props.usersPile.notes}
onChange={props.pDataChange}
/>
<button onClick={props.savePile}>Save Pile</button>
</div>
)
}
export default Pile;
|
app.controller('products', [
'$scope',
'$rootScope',
'$http',
'$routeParams',
function ($scope, $rootScope, $http, $routeParams) {
var cat_id = $routeParams.cat_id;
var s_id = $routeParams.s_id;
$scope.s_name = $routeParams.name;
$scope.p_name = $routeParams.p_name;
var api = $rootScope.site_url + 'product';
var cartApi = $rootScope.site_url + 'cart';
$http.get(api + '/view?c_id=' + cat_id + '&s_id=' + s_id + '&data=name,p_id,mrp,sp,type,img').then(function (response) {
$scope.products = response.data;
console.log($scope.products);
});
//Adding product to cart
$scope.addToCart = function (data) {
console.log(data);
$http.get(cartApi + '/add/' + data).then(function (response) {
if (response.data === '1') {
// $scope.loader();
$scope.loaderInit();
M.toast({
html: 'Added to cart',
outDuration: 375,
classes: 'green accent-4',
});
} else if (response.data === '0') {
M.toast({
html: 'Item not added to cart',
outDuration: 375,
classes: 'red',
});
}
});
};
},
]);
|
import React, { useEffect, useState } from 'react';
import './App.css';
import Covidata from './Components/Data'
import DataLoading from './Components/DataLoading';
function App() {
const ListLoading = DataLoading(Covidata);
const [appState, setAppState] = useState({
loading: false,
data: null,
isClicked: false,
showData: false
});
function fetchData() {
setAppState({loading: true, showData: true})
};
useEffect(() => {
setAppState({ loading: true });
const apiUrl = `https://covid19.mathdro.id/api`;
fetch(apiUrl)
.then((res) => res.json())
.then((data) => {
setAppState({ loading: false, data: data });
console.log(data)
});
}, [setAppState]);
return (
<div className='App'>
<div className='container'>
<h1>COVID-19 DATA</h1>
</div>
<div className='repo-container'>
<ListLoading onChildClick={fetchData} isLoading={appState.loading} repos={appState.repos} />
</div>
<div className="container">
<div className="row">
<div className="col-md-12">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Confirmed</th>
<th scope="col">Recovered</th>
<th scope="col">Death</th>
<th scope="col">Daily Summary</th>
<th scope="col">Daily Time Series</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>USA</td>
<td>{appstate.loading===true? 'loading.....' : "data"}</td>
<td>@mdo</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>NIGERIA</td>
<td>Thornton</td>
<td>@fat</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">3</th>
<td>GHANA</td>
<td>the Bird</td>
<td>@twitter</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<div className='footer'>
Written with{' '}
<span role='img' aria-label='love'>
💚
</span>{' '}
by Esther Adeyi
</div>
</footer>
</div>
);
}
export default App;
|
document.getElementsByClassName("contenido");
// call al boton
document.getElementById("sumar").addEventListener("click",
function sumar(){
// llamo los id que cree en el html
var caja = document.getElementById("cajaNueva");
var nuevoContenido = document.getElementById("contenido");
nuevoContenido.setAttribute("id","listaNueva");
//creo un elemento nuevo llamado botooon
var botooon = document.createElement("button");
botooon.setAttribute("type", "submit"); // le asigno atributos
botooon.setAttribute("id","buton"); // le asigno id
var boton_texto = document.createTextNode("Añadir");
var tareaNueva = document. createElement("textoTarea");
tareaNueva.setAttribute = ("placeholder", "Añade una lista");
tareaNueva.setAttribute = ("id", "tareaNueva")
caja.appendChild(tareaNueva);
caja.appendChild(botooon);
botooon.appendChild(boton_texto);
document.getElementById("buton").addEventListener("click",
function newTarea(){
})
})
;
|
const logInWithFirebase = async (email, password) => {
const response = await fetch(
`https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=${process.env.API_KEY}`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: email,
password: password,
returnSecureToken: true,
}),
},
);
if (response.ok) {
const res = await fetch(
'https://auth-react-native-ea436-default-rtdb.europe-west1.firebasedatabase.app/users.json',
);
const resData = await res.json();
const loadedData = [];
for (const key in resData) {
loadedData.push(resData[key]);
}
const authenticatedUser = await loadedData.find(
user => user.email === email,
);
return authenticatedUser;
} else {
console.log(response.status);
}
};
export default logInWithFirebase;
|
import React from 'react'
const Herobanner = () => {
return (
<div className='heroBannerImage container-fluid'>
<div className='row'>
<div className='col-sm'>
</div>
<div className='col-sm heroBannerMessage'>
<h1>DINNER TOGETHER IN 15 MINUTES OR LESS</h1>
<h3>Prefare meal kits make it easier for you to enjoy delicious home cooking with the people you love.</h3>
<div>
<a href='/signup'><button className="shareButton">EXPLORE YOUR MEAL PLANS</button></a>
</div>
</div>
</div>
</div>
)
}
export default Herobanner
|
import messageReducer from './messageReducer';
describe('Message Reducer', () => {
it('should handle initial state', () => {
expect(
messageReducer(undefined, {})
).toEqual([]);
});
it('should handle ALL_MESSAGES', () => {
const messages = [
{
id: "c271259a-c3b0-02e4-1231-3c29ec02beb8",
message: "first message",
isPrivate: true
},
{
id: "9e485cd6-a5c0-3621-f532-eb58fb654ada",
message: "second message",
isPrivate: false
}
];
expect(
messageReducer([], {
type: 'ALL_MESSAGES',
messages: messages
})
).toEqual(
messages
);
});
it('should handle CREATE_MESSAGE', () => {
const initialState = [
{
id: "c271259a-c3b0-02e4-1231-3c29ec02beb8",
message: "first message",
isPrivate: true
},
{
id: "9e485cd6-a5c0-3621-f532-eb58fb654ada",
message: "second message",
isPrivate: false
}
];
const newMessage = {
id: "ba98e0d7-40a9-8965-1416-ef1193a59312",
message: "third message",
isPrivate: true
};
expect(
messageReducer(
initialState, {
type: 'CREATE_MESSAGE',
message: newMessage
})
).toEqual(
[
{
id: "c271259a-c3b0-02e4-1231-3c29ec02beb8",
message: "first message",
isPrivate: true
},
{
id: "9e485cd6-a5c0-3621-f532-eb58fb654ada",
message: "second message",
isPrivate: false
},
{
id: "ba98e0d7-40a9-8965-1416-ef1193a59312",
message: "third message",
isPrivate: true
}
]
)
});
});
|
'use strict';
require('mocha');
const assert = require('assert');
const pm = require('..');
describe('options.dot', () => {
beforeEach(() => pm.clearCache());
it('should match dotfiles when `options.dot` is true', () => {
assert(pm.isMatch('/a/b/.dot', '**/*dot', { dot: true }));
assert(pm.isMatch('/a/b/.dot', '**/.[d]ot', { dot: true }));
assert(pm.isMatch('/a/b/.dot', '**/?dot', { dot: true }));
assert(pm.isMatch('.dotfile.js', '.*.js', { dot: true }));
assert(pm.isMatch('.dot', '*dot', { dot: true }));
assert(pm.isMatch('.dot', '?dot', { dot: true }));
assert(pm.isMatch('/a/b/.dot', '/**/*dot', { dot: true }));
assert(pm.isMatch('/a/b/.dot', '/**/.[d]ot', { dot: true }));
assert(pm.isMatch('/a/b/.dot', '/**/?dot', { dot: true }));
assert(pm.isMatch('a/b/.dot', '**/*dot', { dot: true }));
assert(pm.isMatch('a/b/.dot', '**/.[d]ot', { dot: true }));
assert(pm.isMatch('a/b/.dot', '**/?dot', { dot: true }));
});
it('should not match dotfiles when `options.dot` is false', () => {
assert(!pm.isMatch('a/b/.dot', '**/*dot', { dot: false }));
assert(!pm.isMatch('a/b/.dot', '**/?dot', { dot: false }));
});
it('should not match dotfiles when `.dot` is not defined and a dot is not in the glob pattern', () => {
assert(!pm.isMatch('a/b/.dot', '**/*dot'));
assert(!pm.isMatch('a/b/.dot', '**/?dot'));
});
});
|
import server from '@/utils/request'
export function getGoodsList(params) {
return server({
url: '/commodity/queryCommodityInfos',
method: 'post',
params
})
}
|
import React from 'react';
export default function WebtoonWeekday() {
return <div>WebtoonWeekdayPage</div>
}
|
export default {
"0": 1,
"1": "0x7E8f313C56F809188313aa274Fa67EE58c31515d",
"2": "0x99b8afd7b266e19990924a8be9099e81054b70c36b20937228a77a5cf75723b8",
"3": 18,
"4": 32,
"5": true,
"6": {
"_hex": "0x09979c0838e8fc880000"
},
"7": 53500,
"8": {
"_hex": "0x49"
},
"9": true,
"id": 1,
"account": "0x7E8f313C56F809188313aa274Fa67EE58c31515d",
"hashDigest": "0x99b8afd7b266e19990924a8be9099e81054b70c36b20937228a77a5cf75723b8",
"hashFunction": 18,
"hashSize": 32,
"isCore": true,
"balance": {
"_hex": "0x09979c0838e8fc880000"
},
"totalKreditsEarned": 53500,
"contributionsCount": {
"_hex": "0x49",
"toNumber": function() { return 73; }
},
"exists": true,
"balanceInt": 45298,
"ipfsHash": "QmYgiRd1FZ7JjDGBwkmLQNF6XQuyF8AWoFDRvUWhhmxiEj",
"name": "Bumi",
"kind": "person",
"url": "https://michaelbumann.com",
"accounts": [
{
"site": "github.com",
"uid": 318,
"username": "bumi",
"url": "https://github.com/bumi"
},
{
"site": "gitea.kosmos.org",
"username": "bumi",
"url": "https://gitea.kosmos.org/bumi"
},
{
"site": "wiki.kosmos.org",
"username": "Bumi",
"url": "https://wiki.kosmos.org/User:Bumi"
},
{
"site": "zoom.us",
"username": "bumi"
}
],
"github_uid": 318,
"github_username": "bumi",
"gitea_username": "bumi",
"wiki_username": "Bumi",
"zoom_display_name": "bumi",
"ipfsData": "{\n \"@context\": \"https://schema.kosmos.org\",\n \"@type\": \"Contributor\",\n \"kind\": \"person\",\n \"name\": \"Bumi\",\n \"accounts\": [\n {\n \"site\": \"github.com\",\n \"uid\": 318,\n \"username\": \"bumi\",\n \"url\": \"https://github.com/bumi\"\n },\n {\n \"site\": \"gitea.kosmos.org\",\n \"username\": \"bumi\",\n \"url\": \"https://gitea.kosmos.org/bumi\"\n },\n {\n \"site\": \"wiki.kosmos.org\",\n \"username\": \"Bumi\",\n \"url\": \"https://wiki.kosmos.org/User:Bumi\"\n },\n {\n \"site\": \"zoom.us\",\n \"username\": \"bumi\"\n }\n ],\n \"url\": \"https://michaelbumann.com\"\n}"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.