text
stringlengths 7
3.69M
|
|---|
import React, { useState, useEffect } from "react";
import styled from "styled-components";
import { node, bool } from "prop-types";
import { whiteBackground } from "../themes";
const HeaderContainer = styled.header``;
const FakeHeader = styled.div`
height: 106px;
`;
const Header = styled.div`
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #ffffff;
transition-property: transform;
transition-duration: 0.2s;
z-index: 2;
transform: ${props => props.isShort && "translateY(-49px)"};
${whiteBackground};
`;
const ContentWrapper = styled.div`
max-width: 600px;
margin: 0 auto;
`;
export default function StretchableHeader({ stretchable, children }) {
const [lastWindowScrollTop, setLastWindowScrollTop] = useState(null);
const [isHeadShort, setIsHeadShort] = useState(false);
let isInOneSecond = false;
function handleWindowScroll(e) {
if (!stretchable) return;
isInOneSecond = true;
setTimeout(() => {
isInOneSecond = false;
}, 1000);
if (lastWindowScrollTop) {
// in one second scroll over than 50px
const dis = e.target.scrollingElement.scrollTop - lastWindowScrollTop;
if (dis > 30 && isInOneSecond) {
setIsHeadShort(true);
}
if (dis < 0) {
setIsHeadShort(false);
}
}
setLastWindowScrollTop(e.target.scrollingElement.scrollTop);
}
useEffect(() => {
window.addEventListener("scroll", handleWindowScroll);
return () => {
window.removeEventListener("scroll", handleWindowScroll);
};
});
return (
<HeaderContainer>
<FakeHeader />
<Header isShort={isHeadShort}>
<ContentWrapper>{children}</ContentWrapper>
</Header>
</HeaderContainer>
);
}
StretchableHeader.propTypes = {
children: node.isRequired,
stretchable: bool
};
StretchableHeader.defaultProps = {
stretchable: true
};
|
var cloud_names=["beta","zs1","zs2","zs3","zsnet","zsc"];
var current_cloud_for_second_page;
function create_buttons_cloud_wise(master_div_element)
{
for(var cloud_indexer=0;cloud_indexer<cloud_names.length;cloud_indexer++)
{
var button_object=document.createElement("button");
button_object.innerHTML=cloud_names[cloud_indexer];
button_object.setAttribute("id",cloud_names[cloud_indexer]);
button_object.setAttribute("style","height:100px;width:100px;background-color: #e7e7e7; color: black;font-size: 16px;border-radius: 8px;padding:20px;margin-right: 50px;");
master_div_element.appendChild(button_object);
}
}
function beta_button_clicked()
{
current_cloud_for_second_page="beta";
window.location.href="cloud_table.html";
}
function zs1_button_clicked()
{
current_cloud_for_second_page="zs1";
window.location.href="cloud_table.html";
}
function zs2_button_clicked()
{
current_cloud_for_second_page="zs2";
window.location.href="cloud_table.html";
}
function zs3_button_clicked()
{
current_cloud_for_second_page="zs3";
window.location.href="cloud_table.html";
}
function zsc_button_clicked()
{
current_cloud_for_second_page="zsc";
window.location.href="cloud_table.html";
}
function zsnet_button_clicked()
{
current_cloud_for_second_page="zsnet";
window.location.href="cloud_table.html";
}
function set_event_listners_to_buttons()
{
var object_getter;
for(var indexer=0;indexer<cloud_names.length;indexer++)
{
if(cloud_names[indexer] == "beta")
{
object_getter=document.getElementById("beta");
object_getter.setAttribute("onclick","beta_button_clicked()");
}
else if(cloud_names[indexer] == "zs1")
{
object_getter=document.getElementById("zs1");
object_getter.setAttribute("onclick","zs1_button_clicked()");
}
else if(cloud_names[indexer] == "zs3")
{
object_getter=document.getElementById("zs3");
object_getter.setAttribute("onclick","zs3_button_clicked()");
}
else if(cloud_names[indexer] == "zs2")
{
object_getter=document.getElementById("zs2");
object_getter.setAttribute("onclick","zs2_button_clicked()");
}
else if(cloud_names[indexer] == "zsc")
{
object_getter=document.getElementById("zsc");
object_getter.setAttribute("onclick","zsc_button_clicked()");
}
else if(cloud_names[indexer] == "zsnet")
{
object_getter=document.getElementById("zsnet");
object_getter.setAttribute("onclick","zsnet_button_clicked()");
}
}
}
function create_main_div_tag()
{
var master_div_element=document.createElement('div');
master_div_element.setAttribute("align","center");
document.body.appendChild(master_div_element);
create_buttons_cloud_wise(master_div_element);
set_event_listners_to_buttons();
}
function create_master_table_for_passed_cloud(current_cloud,master_div_element)
{
var file_name_generator="./countermon_json_file_cloud_"+current_cloud+".json";
fetch(file_name_generator)
.then(function(resp){
return resp.json();
})
.then(function(data){
traverse_gathered_data(data,current_cloud,master_div_element);
});
}
function get_instances_return_array(data)
{
var temp_array=new Array();
for(var indexer=0;indexer<data.length;indexer++)
{
temp_array.push(data[indexer].instance_name);
}
return temp_array;
}
function get_counters_return_array(data)
{
var temp_array=new Array();
var object_getter=data[0];
for (var key in object_getter)
{
if( key != "instance_name")
{
temp_array.push(key);
}
}
return temp_array;
}
function get_object_corresponding_to_instance(data,instance)
{
for(var indexer=0;indexer<data.length;indexer++)
{
if(data[indexer].instance_name == instance)
{
return data[indexer];
}
}
}
function traverse_gathered_data(data,current_cloud,master_div_element)
{
//creating heading of table
var indexer,td_tag;
var array_for_instances=new Array();
var array_for_counters=new Array();
var threshold_of_counters=new Array();
var time_interval_of_counters=new Array();
array_for_instances=get_instances_return_array(data);
array_for_counters=get_counters_return_array(data);
threshold_of_counters=get_threshold_return_array();
time_interval_of_couneters=get_time_interval_return_array();
var table_element=document.createElement("TABLE");
table_element.setAttribute("style","border: 1px solid black;border-collapse: collapse;width: 100%;height: 100%;");
var table_row1=document.createElement("tr");
table_row1.setAttribute("style","border: 1px solid black;border-collapse: collapse;");
var table_heading=document.createElement("th");
table_heading.setAttribute("style","border: 1px solid black;border-collapse: collapse;text-align: center;");
var text=document.createTextNode("INSTANCE NAME");
table_heading.appendChild(text);
table_row1.appendChild(table_heading);
for(indexer=0;indexer<array_for_counters.length;indexer++)
{
table_heading=document.createElement("th");
table_heading.setAttribute("style","border: 1px solid black;border-collapse: collapse;text-align: center;");
text=document.createTextNode(array_for_counters[indexer]);
table_heading.appendChild(text);
table_row1.appendChild(table_heading);
table_row1.setAttribute("style","border: 1px solid black;border-collapse: collapse;");
}
table_element.appendChild(table_row1);
//table heading created..
for(indexer=0;indexer<array_for_instances.length;indexer++)
{
var object_getter=get_object_corresponding_to_instance(data,array_for_instances[indexer]);
table_row1=document.createElement("tr");
table_row1.setAttribute("style","border: 1px solid black;border-collapse: collapse;");
td_tag=document.createElement("td");
td_tag.setAttribute("style","border: 1px solid black;border-collapse: collapse;text-align: center;");
text=document.createTextNode(array_for_instances[indexer]);
td_tag.appendChild(text);
table_row1.appendChild(td_tag);
var value_sum=0;
for(var indexer2=0;indexer2<array_for_counters.length;indexer2++)
{
value_sum=value_sum+parseInt(object_getter[array_for_counters[indexer2]]);
td_tag=document.createElement("td");
td_tag.setAttribute("style","border: 1px solid black;border-collapse: collapse;text-align: center;");
text=document.createTextNode(object_getter[array_for_counters[indexer2]]);
td_tag.appendChild(text);
table_row1.appendChild(td_tag);
}
if(value_sum!=0)
{
table_element.appendChild(table_row1);
}
}
master_div_element.appendChild(table_element);
}
function set_value_to_local_storage()
{
localStorage.setItem('cloud_name', JSON.stringify(current_cloud_for_second_page));
}
function master_function_display_data_second_page()
{
var display_data_for_cloud=JSON.parse(localStorage.getItem('cloud_name'));
var master_div_element=document.getElementById("master_table_id");
var cloud_template=document.createElement("h2");
var cloud_template_text=document.createTextNode("Displaying stats for:- "+display_data_for_cloud);
cloud_template.appendChild(cloud_template_text);
master_div_element.appendChild(cloud_template);
create_master_table_for_passed_cloud(display_data_for_cloud,master_div_element);
}
|
const axenda = {
title: "Axenda",
events: {
event1: {
name: "cultureEvento 1",
image: "/images/cultureEvent1.jpg",
date: "2018-01-15",
visible: true,
desc:
"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?",
ubicación: "",
tipo: ""
},
event2: {
name: "cultureEvento 2",
image: "/images/cultureEvent2.jpg",
date: "2019-02-22",
visible: true,
desc:
"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?",
ubicación: "",
tipo: ""
},
event3: {
name: "cultureEvento 3",
image: "/images/cultureEvent1.jpg",
date: "2019-03-29",
visible: true,
desc:
"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?",
ubicación: "",
tipo: ""
},
event4: {
name: "cultureEvento 4",
image: "/images/cultureEvent4.jpg",
date: "2019-03-20",
visible: true,
desc:
"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?",
ubicación: "",
tipo: "Cementerio"
},
event5: {
name: "cultureEvento 5",
image: "/images/cultureEvent5.jpg",
date: "2019-04-21",
visible: true,
desc:
"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?",
ubicación: "",
tipo: "Axuda e Subvencións"
},
event6: {
name: "cultureEvento 6",
image: "/images/cultureEvent6.jpg",
date: "2019-04-26",
visible: true,
desc:
"Lorem ipsum, dolor sit amet consectetur adipisicing elit. Odit, excepturi?",
ubicación: "",
tipo: "Cementerio"
}
}
};
export default axenda;
|
import React from "react";
const LandingPage = () => {
return (
<div className="landing__page__body">
<h1 className="company__title">Generation Diamond</h1>
<p className="company__slogan">By working together we
can help our youth obtain a better future!</p>
</div>
);
};
export default LandingPage;
|
import React from "react";
const Button = () => {
return <div className="btn">request demo</div>;
};
export default Button;
|
var requireDir = require('require-dir');
var dir = requireDir('./node_modules/@meltmedia/meltmail-builder/_gulp-tasks');
|
(window.player || (window.player = {})).blurImg = function(t, e) { var r = document.createElement("canvas");
e = e || document.body, r.width = 100, r.height = 100; var o = r.getContext("2d"),
h = new Image;
h.src = t, h.onload = function() { o.drawImage(h, 0, 0, h.width, h.height, 0, 0, r.width, r.height); var t = function(t) { var a, e, r, o, h, n, d, g, i, f, w = t.data,
u = t.width,
c = t.height,
m = [],
l = 0,
I = 10; for (n = 1 / (5 * Math.sqrt(2 * Math.PI)), h = -.02, d = 0, a = -I; a <= I; a++, d++) o = n * Math.exp(h * a * a), l += m[d] = o; for (d = 0, f = m.length; d < f; d++) m[d] /= l; for (e = 0; e < c; e++)
for (a = 0; a < u; a++) { for (r = o = h = n = 0, l = 0, g = -I; g <= I; g++) 0 <= (i = a + g) && i < u && (r += w[d = 4 * (e * u + i)] * m[g + I], o += w[d + 1] * m[g + I], h += w[d + 2] * m[g + I], l += m[g + I]);
w[d = 4 * (e * u + a)] = r / l, w[d + 1] = o / l, w[d + 2] = h / l }
for (a = 0; a < u; a++)
for (e = 0; e < c; e++) { for (r = o = h = n = 0, l = 0, g = -I; g <= I; g++) 0 <= (i = e + g) && i < c && (r += w[d = 4 * (i * u + a)] * m[g + I], o += w[d + 1] * m[g + I], h += w[d + 2] * m[g + I], l += m[g + I]);
w[d = 4 * (e * u + a)] = r / l, w[d + 1] = o / l, w[d + 2] = h / l }
return t }(o.getImageData(0, 0, r.width, r.height));
o.putImageData(t, 0, 0); var a = r.toDataURL();
e.style.backgroundImage = "url(" + a + ")" } };
|
var core = require('./core');
var SqliteDB = require('./sqlite').SqliteDB;
var db = new SqliteDB(core.datapath);
//无数据库user则新建
// var createUser = "create table if not exists user(id INTEGER primary key autoincrement, name TEXT, password TEXT, email TEXT, time TIMESTAMP default (datetime('now', 'localtime')), ctime TIMESTAMP, role TEXT)";
// db.createTable(createUser);
//获取用户信息
exports.userget = function (data,col) {
return new Promise(function (resolve, reject) {
var sql;
if (data) {//按用户名或邮箱查找
var name = "", email = "", id = "";
data.id && (id=data.id.join());
for (var k in data.name) {
name += ("'" + data.name[k] + "',")
}
for (var n in data.email) {
email += ("'" + data.email[n] + "',")
}
sql = "select "+(col||"id,name")+" from user where id in(" + id + ") or name in(" + name.slice(0, -1) + ") or email in(" + email.slice(0, -1) + ")";
} else {//全部信息
sql = "select * from user";
}
db.queryData(sql, function (row) {
resolve(row);
})
})
}
exports.userlist = function (page) {
return new Promise(function (resolve, reject) {
var sql = "select id,name,email,time,ctime,role,level from user";
db.queryData("Select COUNT(id) from user", function (len) {
var length = len[0]['COUNT(id)'];
var line = (page.size<101?page.size:100) * (page.num-1);
if (length > 0 && line <= length) {
//获取列表并分页 Limit:读取条数 Offset:跳过条数
sql += ' Limit ' + page.size + ' Offset ' + line;
db.queryData(sql, function (row) {
resolve({ length: length, rows: row });
})
} else {
resolve({ length: length, row: [] });
}
})
})
}
//新增注册用户
exports.useradd = function (data) {
return new Promise(function (resolve, reject) {
// 多条录入value:[[],[],...]
var vv="";
for(var i=0;i<data.key.length;i++){
vv+="?,";
}
db.insertData('insert into user('+data.key.join()+') values('+vv.slice(0, -1)+')', data.value, function (err) {
resolve(err);
});
})
}
//删除用户
exports.userdel = function (data) {
return new Promise(function (resolve, reject) {
db.executeSql('DELETE FROM user WHERE id in(' + data + ')', function (err) {
resolve(err);
});
})
}
//修改用户
exports.useredit = function (data, oldrole) {
return new Promise(function (resolve, reject) {
var str = "";
for (var k in data.data) {
str += (k + '="' + data.data[k] + '",')
}
db.executeSql('update user set ' + str.slice(0, -1) + ' where id=' + data.id + (oldrole?' and role="'+oldrole+'"':''), function (err) {
resolve(err);
});
})
}
//获取权限表role
exports.getrole = function (name) {
return new Promise(function (resolve, reject) {
db.queryData('select * from role where name='+name, function (row) {
resolve(row);
})
})
}
|
const NUM_COUPON_SECTIONS = 2;
const MAX_SUGGESTED_RESTAURANTS = 5; // The maximum number of restaurants that can be suggested in a search at one time
var circles = []; // Circles.length = NUM_COUPON_SECTIONS
var couponSection = 1;
var curCouponSection = 0;
window.onload = function () {
circleSetup();
setAddressLocation();
restaurantsNearYouSetup();
rotateCouponSection(0);
document.getElementById("restaurantAddress").value = "";
openNotification();
// Load currently added coupon (if any)
// This is encase the user refreshes the page or goes back to the main menu but only has a coupon and no cart
var coupon = window.localStorage.getItem("coupon");
if (coupon != null)
addCoupon(null, parseInt(coupon));
}
$(document).click(function (event) {
var $target = $(event.target);
if (!$target.closest('#search').length &&
$('#restaurantsFromSearch').is(":visible")) {
$('#restaurantsFromSearch').hide();
}
if (!$target.closest('#top').length &&
$('#cartPopUp').is(":visible")) {
closeCart();
}
});
function openNotification() {
var notification = window.localStorage.getItem('notification');
if (notification == 'true')
document.getElementById('cartNotification').style.visibility = 'visible';
}
// Sets up the 3 circles so that the currently selected one will be more opague
function circleSetup() {
circles = document.getElementsByClassName("circles");
}
function flushSuggestedSearches() {
var elem = document.getElementById("restaurantsFromSearch");
if (typeof elem !== 'undefined' && elem != null) {
elem.parentElement.removeChild(elem);
}
}
// Go to the restuarant page (if its valid)
function goToRestaurant(name) {
// Check if its valid
for (var i = 0; i < restaurants.length; i++)
if (restaurants[i].name.toLowerCase() == name.toLowerCase())
redirectToRestaurantByName(restaurants[i].name);
}
// This function displays restaurants that the user is searching for
function displayRelatedRestaurants(obj, event) {
// Remove any previous searches from list
flushSuggestedSearches();
var text = obj.value;
if (typeof event !== 'undefined') {
// If they pressed enter
if (event.keyCode == 13)
return goToRestaurant(text);
// Check for backspace character
if (event.keyCode == 8)
text = text.substring(0, text.length - 1);
else {
text = text + String.fromCharCode(event.keyCode);
}
// TODO remove the commented code if this is not a feature we would like to have
// Do not display any form of empty text
// Note that without this, all restaurants will display
//if (text.trim() == "")
// return;
}
//else if (text == "")
// return; // Do not display empty text without a backspace character
// Find the suggested restaurants based on the users input
var candidateRestaurants = [];
for (var i = 0; i < restaurants.length; i++) {
// Cannot exceed max suggested searches
if (candidateRestaurants.length >= MAX_SUGGESTED_RESTAURANTS)
break;
if (restaurants[i].name.toLowerCase().startsWith(text.trim().toLowerCase())) {
candidateRestaurants.push(restaurants[i].name);
}
}
// Now sort them in order
candidateRestaurants.sort();
// Create the suggestions
createSuggestions(candidateRestaurants);
}
// Creates the suggested searches from a list of restaurants
function createSuggestions(suggestedRestaurants) {
var elem = document.getElementById("search");
var div = document.createElement("div");
div.id = "restaurantsFromSearch";
for (var i = 0; i < suggestedRestaurants.length; i++) {
// Creating object
var name = document.createElement("div");
name.innerHTML = suggestedRestaurants[i];
name.className = "suggestedName";
div.appendChild(name);
// Create on click event for object
name.onclick = function (event) {
redirectToRestaurantByName(event.target.textContent.trim());
}
}
elem.appendChild(div);
}
function addressChange(input) {
// Recall this function when the users location is changed
setUserAddress(document.getElementById("deliveryAddress").value);
setAddressLocation(); // The user has a new address location, get its location
restaurantsNearYouSetup();
addressFeedbackAnimation();
}
function addressFeedbackAnimation() {
$("#changeFeedback").fadeIn("slow", function () {
$("#changeFeedback").fadeOut(5500, function () {
// Do nothing once complete
});
});
}
// This grabs the location of the user
// It will convert the address into ASCII, and sum each element.
// Multiplying each numeric value by 2
function setAddressLocation() {
var sum = 0;
var addr = getUserAddress();
for (var i = 0; i < addr.length; i++) {
if (isNaN(parseInt(addr.charAt(i)))) {
// Not a number
sum += addr.codePointAt(i) / 10;
}
else {
sum += parseInt(addr.charAt(i)) * 2;
}
}
userLocation = sum;
}
function restaurantsNearYouSetup() {
var htmlIcon = document.getElementById("restaurantRow");
var icons = [];
for (var i = 0; i < htmlIcon.childNodes.length; i++)
if (htmlIcon.childNodes[i].className == "col")
icons.push(htmlIcon.childNodes[i]);
// Set the order of the restaurants based on the distance to the user
if (icons.length > restaurants.length)
alert("Error, please make sure that we can display enough restaurants.");
// Order the restaurants randomly
var distances = [];
// Order restaurants by distance to the user
for (var i = 0; i < restaurants.length; i++) {
var minDist;
// Grab a dist not currently selected
// FIXME can be optimized into a sort
for (var i = 0; i < restaurants.length; i++)
if (!distances.includes(restaurants[i])) {
minDist = i;
break;
}
// Grab next shortest distance
for (var k = 0; k < restaurants.length; k++) {
if (k != i && !(distances.includes(restaurants[k]))) {
if (Math.abs(restaurants[k].location - userLocation) < Math.abs(restaurants[minDist].location - userLocation))
minDist = k;
}
}
distances.push(restaurants[minDist]);
}
for (var i = 0; i < icons.length; i++) {
// Set the childs equal to the restaurants information
var childs = icons[i].childNodes;
for (var k = 0; k < childs.length; k++) {
for (var l = 0; l < childs[k].childNodes.length; l++) {
var child = childs[k].childNodes[l];
if (child.tagName == "IMG") {
child.src = distances[i].image;
}
else if (child.tagName == "DIV") {
child.textContent = distances[i].name;
}
}
}
}
}
function addCoupon(obj, index) {
var addedToCartOverlays = document.getElementsByClassName("addOverlay");
var addWarnings = document.getElementsByClassName("addWarning");
if (addedToCartOverlays.length != addWarnings.length)
alert("Sorry, a problem has occurred. Please try something else. /0")
for (var i = 0; i < addedToCartOverlays.length; i++) {
var elem = addedToCartOverlays[i];
var prev = window.localStorage.getItem('coupon');
// The coupon that is added
// Note that changing visibility dynamically breaks the :hover in css
// So, here I just modify opacity and let CSS handle visibility for the warnings
// And for the overlay, I only modify opacity and let CSS handle visibility
if (i == index) {
// Different text if the user comes back to the page
// This way 'added to your cart' is the action of doing it from that page
if (obj != null && (prev == null || parseInt(prev) != index))
elem.textContent = "Added to your cart";
else
elem.textContent = "Currently in your cart";
elem.style.color = "green";
elem.style.fontWeight = "500";
// elem.style.opacity = "0.9";
elem.style.visibility = "visible";
addWarnings[i].style.opacity = "0";
// Saving the current coupon
window.localStorage.setItem("coupon", index);
// When you add to the cart, the notification appears
// This is only if you haven't already had that coupon
if (!cartOpen && ((prev != null && parseInt(prev) != index) || prev == null)) {
document.getElementById('cartNotification').style.visibility = 'visible';
window.localStorage.setItem('notification', 'true');
}
// Update the cart so that the new coupon is displayed
updateCart(getFoodCookies());
}
else {
// All other coupons
// Set back to defaults
elem.textContent = "Add to cart";
elem.style.color = "rgb(53, 53, 53)";
elem.style.fontWeight = "350";
elem.style.visibility = "hidden";
// Add a warning for other coupons. This will remove the current coupon
addWarnings[i].style.opacity = "1.0";
// To retain CSS's hover attributes, we will redefine the className
elem.className = "addOverlay";
}
}
}
// Move the coupon section to a specific coupon
function rotateCouponToIndex(index) {
rotateCouponSection(index - curCouponSection);
}
function rotateCouponSection(amount) {
if (typeof (circles) == undefined)
alert("An error has occurred. Please try again later.");
var slides = document.getElementsByClassName("slide");
// Disabling the current slide
slides[curCouponSection].style.display = "none";
circles[curCouponSection].style.opacity = "0.9";
curCouponSection = mod((curCouponSection + amount), NUM_COUPON_SECTIONS);
// Activating next slide
slides[curCouponSection].style.display = "inline-block";
circles[curCouponSection].style.opacity = "0.2";
}
// Customized modulo to evaluate positive only numbers
// Returns a % b, result is always positive
function mod(a, b) {
return ((a % b) + b) % b;
};
// Redirect the user to the FoodItemDisplayer page
// This may either be to display a restaurants menu
// Or, to display the products in a particular package
function redirectToMenuPage(event) {
var locationName;
// Grab name of the package/food/restaurant from the onclick event
for (var i = 0; i < event.childNodes.length; i++) {
if ("DIV" == event.childNodes[i].tagName)
locationName = event.childNodes[i].textContent;
}
window.localStorage.setItem("history", locationName);
// Redirect the user to another page
window.location = "FoodItemDisplayer.html";
}
function redirectToRestaurantByObject(obj) {
window.localStorage.setItem("history", obj.textContent);
// Redirect the user to another page
window.location = "FoodItemDisplayer.html";
}
function redirectToRestaurantByName(restaurantName) {
window.localStorage.setItem("history", restaurantName);
// Redirect the user to another page
window.location = "FoodItemDisplayer.html";
}
function addressKeyPress(elem) {
if (correctFormat(elem.value)) {
if (event.key === 'Enter') {
addressChange();
}
}
}
function addressSubmitCheck() {
if (correctFormat(document.getElementById("deliveryAddress").value)) {
validInput();
addressChange();
}
else
invalidInput();
}
|
import {
REQUEST_CURRENT_USER,
RECEIVE_CURRENT_USER,
AUTHENTICATION_ERROR,
NO_TOKEN,
LOGOUT
} from '../actions/actionTypes';
const currentUser = (state = { loading: true }, action) => {
switch (action.type) {
case NO_TOKEN:
return { loading: false };
case REQUEST_CURRENT_USER:
return { loading: true };
case RECEIVE_CURRENT_USER:
let { id, firstName, lastName, email } = action.payload.user;
if (action.payload.token) {
localStorage.setItem('token', action.payload.token);
}
return { loading: false, id, firstName, lastName, email };
case AUTHENTICATION_ERROR:
return { loading: false, error: action.payload.error };
case LOGOUT:
return { loading: false };
default:
return state;
}
};
export default currentUser;
|
const express = require('express');
const router = express.Router();
const {
createTeam,
getOneTeam,
getAllTeams,
updateTeam,
addMember,
removeMember,
deleteTeam,
} = require('../controllers/equipo.controller')
// Ruta para crear un equipo
router.post('/', createTeam);
// Ruta para obtener todos los equipos
router.get('/', getAllTeams);
// Ruta para obtener un equipo en base a su ID
router.get('/:equipoId', getOneTeam);
// Ruta para actualizar los datos del equipo
router.put('/:equipoId', updateTeam);
//Ruta para agregar un miembro al equipo
router.put('/addMember/:equipoId', addMember)
//Ruta para eliminar un miembro del equipo
router.put('/removeMember/:equipoId', removeMember)
// Ruta para eliminar a un equipo
router.delete('/:equipoId', deleteTeam);
module.exports = router;
|
import React, { Component } from 'react'
import '../../App.css'
import '../../asserts/css/resume.min.css'
import Menu from './Menu'
import About from './About'
import Experience from './Experience'
import Education from './Education'
import Skills from './Skills'
import Interests from './Interests'
import Certifications from './Certifications'
import Switch from 'react-router-dom/es/Switch'
import Route from 'react-router-dom/es/Route'
class App extends Component {
render () {
return (
<div>
<Menu/>
<div className="container-fluid p-0">
<Switch>
<Route exact path='/' render={About}/>
<Route exact path='/experience' render={Experience}/>
<Route exact path='/education' render={Education}/>
<Route exact path='/skills' render={Skills}/>
<Route exact path='/interests' render={Interests}/>
<Route exact path='/certifications' render={Certifications}/>
</Switch>
</div>
</div>
)
}
}
export default App
|
import React, { Component } from 'react';
class ErrorPage extends Component {
render() {
return (
<section id="error" className="first-section col-md-12 text-center">
<h1><strong>Error {this.props.code}</strong></h1>
<p className="lead">{this.props.message}</p>
</section>
);
}
}
export default ErrorPage;
|
TQ.smsMessageMarkList = function (dfop){
$(document).ready(function(){
$("#smsMessageMarkList").jqGridFunction({
url:PATH+"/smsMessageMarkManage/findSmsMessageMarks.action",
datatype: "json",
colNames:['id','operationtType','dealType','操作类型','摸版'],
colModel:[
{name:"id",index:"id",hidden:true,sortable:false},
{name:"operationtType",index:"operationtType",sortable:false,hidedlg:true,frozen:true,hidden:true},
{name:"dealType",index:"dealType",sortable:false,hidedlg:true,frozen:true,hidden:true},
{name:'type',formatter:typeStateFormatter,sortable:false,width:200},
{name:'model',sortable:false,width:600}
],
ondblClickRow: function (rowid){
if(dfop.viewSmsMessageMark=='true'){
viewSmsMessageMark(rowid);
}
},
scrollrow:true
});
$("#add").click(function(event){
$("#smsMessageMarkMaintanceDialog").createDialog({
width: 650,
height: 400,
title:"新增短信提示语模版",
url:PATH+"/smsMessageMarkManage/dispatch.action?mode=add",
buttons: {
"保存" : function(event){
$("#maintainForm").submit();
},
"关闭" : function(){
$(this).dialog("close");
}
}
});
});
$("#update").click(function(event){
var selectedId = $("#smsMessageMarkList").getGridParam("selrow");
if(selectedId==null||selectedId.length < 1){
$.messageBox({level:'warn',message:"请选择要修改的短信提示语模版!"});
return;
}
var smsMessageMark=$("#smsMessageMarkList").getRowData(selectedId);
$("#smsMessageMarkMaintanceDialog").createDialog({
width: 550,
height: 270,
title:"修改短信提示语模版",
url:PATH+"/smsMessageMarkManage/dispatch.action?mode=edit&smsMessageMark.id="+smsMessageMark.id,
buttons: {
"保存" : function(event){
$("#maintainForm").submit();
},
"关闭" : function(){
$(this).dialog("close");
}
}
});
});
$("#view").click(function(){
var selectedId = $("#smsMessageMarkList").getGridParam("selrow");
if(selectedId==null||selectedId.length < 1){
$.messageBox({level:'warn',message:"请选择要查看的短信提示语模版!"});
return;
}
viewSmsMessageMark(selectedId);
});
$("#delete").click(function(){
var selectedId = $("#smsMessageMarkList").getGridParam("selrow");
if(selectedId==null||selectedId==''){
$.messageBox({level:'warn',message:"请选择要删除的短信提示语模版!"});
return;
}
$.confirm({
title:"确认删除",
message:"短信提示语模版删除后,将无法恢复,您确认删除该短信提示语模版信息吗?",
width: 400,
okFunc: deleteSmsMessageMark
});
});
$("#reload").click(function(event){
reloadMyContactList();
});
});
function typeStateFormatter(el, options, rowData){
if(rowData.operationtType==1){//短信提示语的操作类型为办理
var typeshow = "办理-";
if(rowData.dealType==1001){
return typeshow+"办理中";
}else if(rowData.dealType==1011){
return typeshow+"交办";
}else if(rowData.dealType==1021){
return typeshow+"上报";
}else if(rowData.dealType==1031){
return typeshow+"结案";
}else if(rowData.dealType==1041){
return typeshow+"验证";
}else if(rowData.dealType==1051){
return typeshow+"回退";
}else if(rowData.dealType==1061){
return typeshow+"评分";
}
}else{
if(rowData.operationtType==11){
return "领导批示";
}else if(rowData.operationtType==21){
return "受理";
}else if(rowData.operationtType==31){
return "阅读";
}else if(rowData.operationtType==41){
return "普通督办";
}else if(rowData.operationtType==51){
return "黄牌督办 ";
}else if(rowData.operationtType==61){
return "红牌督办 ";
}else if(rowData.operationtType==71){
return "取消督办 ";
}
}
}
function reloadMyContactList(){
$("#smsMessageMarkList").setGridParam({
url:PATH+"/smsMessageMarkManage/findSmsMessageMarks.action",
datatype: "json",
page:1
});
$("#smsMessageMarkList").trigger("reloadGrid");
}
function viewSmsMessageMark(rowid){
if(rowid==null){
return;
}
var smsMessageMark = $("#smsMessageMarkList").getRowData(rowid);
$("#smsMessageMarkMaintanceDialog").createDialog({
width: 550,
height: 270,
title:'查看短信提示语模版信息',
modal : true,
url:PATH+"/smsMessageMarkManage/dispatch.action?mode=view&smsMessageMark.id="+smsMessageMark.id,
buttons: {
"关闭" : function(){
$(this).dialog("close");
}
}
});
}
function deleteSmsMessageMark(){
var selectedId = $("#smsMessageMarkList").getGridParam("selrow");
if(selectedId==null||selectedId==''){
return;
}
var smsMessageMark=$("#smsMessageMarkList").getRowData(selectedId);
$.ajax({
url:PATH+'/smsMessageMarkManage/deleteSmsMessageMark.action?smsMessageMark.id='+smsMessageMark.id,
success:function(data){
if(data == true){
$("#smsMessageMarkList").delRowData(selectedId);
$.messageBox({ message:"成功删除该短信提示语模版信息!"});
return;
}
$.messageBox({message:data,level: "error"});
}
});
}
}
|
const Nightcrawler = require('@coreycollins/nightcrawler')
const Stream = require('stream')
const readable = new Stream.Readable({ objectMode: true })
let nc = new Nightcrawler()
let qStream = nc.createStream({ sendErrors: false })
// Pipe to standard out
readable.pipe(qStream).toArray((err, resp) => {
if (err) {
console.log(err)
process.exit(1)
}
console.log(resp)
process.exit(0)
})
let q = nc
.go('http://example.com')
.waitFor(nc.$('body'))
.groupBy(nc.$('body > div'))
.select({ title: nc.$('p') })
readable.push(q)
readable.push(null)
|
'use strict';
angular.module('vk').factory('vkontakte', function($q) {
var URL_VARS;
// Public API here
return {
GID: 48475446,
AID: 183475108,
SUBSCRIBE_GID: 48475446,
WIDTH: 720,
getAlbums: function(params, callback) {
return VK.api('photos.getAlbums', params, callback);
},
getPhotos: function(params, callback){
return VK.api('photos.get', params, callback);
},
createAlbum: function(params, callback){
return VK.api('photos.createAlbum', params, callback);
},
createAndUpload: function(params, callback){
var self = this;
self.createAlbum(params, function(data){
self.uploadPhoto(data.response.aid, callback);
});
},
resizeWindow: function(width, height) {
VK.callMethod('resizeWindow', width, height);
},
uploadPhoto: function(aid, callback) {
VK.api('photos.getUploadServer', {aid: aid, gid: this.GID}, function(data){
console.log(data);
callback(data.response.upload_url);
});
},
savePhotos: function(params, callback) {
VK.api('photos.save', params, callback);
},
wallPost: function(params, callback){
VK.api('wall.post', params, callback);
},
getUrlVars: function(){
if (!URL_VARS) {
var vars = new Object(), hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
}
URL_VARS = vars;
}
return URL_VARS;
},
isAdmin: function(){
return parseInt(this.getUrlVars().viewer_type, 10) >= 2;
},
getCurrentUser: function(callback){
return this.getProfiles({
uids: this.getUrlVars().viewer_id,
fields: 'first_name,last_name,sex,photo_big,photo'
}, callback);
},
getProfiles: function(params, callback){
return VK.api('users.get', params, callback);
},
isMember: function(callback){
return VK.api('groups.isMember', {gid: this.SUBSCRIBE_GID}, callback);
},
getLikes: function(posts, scope){
for (var i =0, max = posts.length; i<max; i++) {
(function(index){
var post_id = posts[index].post_id;
VK.api('wall.getLikes', {post_id: post_id}, function(data){
scope.$apply(function(){
posts[index].likes_count = data.response ? data.response.count : 0;
});
})
}(i));
}
}
};
});
|
import { combineReducers } from 'redux';
import gameState from './slices/gameinit';
import quizState from './slices/game';
export default combineReducers(
{
gameState,
quizState
}
);
|
import React from "react";
import {
FormControl,
InputLabel,
MenuItem,
Paper,
Link,
Button,
RadioGroup,
Select,
makeStyles,
TextField
} from "@material-ui/core/";
import { Link as RouterLink } from "react-router-dom";
import { isMobile } from "react-device-detect";
const useStyles = makeStyles(theme => ({
container: {
marginTop: isMobile ? 0 : theme.spacing(6),
padding: theme.spacing(3, 2),
marginBottom: theme.spacing(3),
},
formSpacing: {
marginBottom: theme.spacing(3)
},
name: {
width: "100%",
},
getStartedLink: {
color: "#fff",
display: "inline-block",
padding: theme.spacing(1),
width: "100%",
"&:hover": {
textDecoration: "none",
},
"&:focus": {
textDecoration: "none",
}
},
getStartedButton: {
color: "#fff",
textDecoration: "none",
width: "100%",
marginBottom: theme.spacing(1),
display: "block",
textAlign: "center",
padding: 0,
background:
"linear-gradient(90deg, rgba(251,110,63,1) 0%, rgba(252,70,226,1) 100%)",
borderRadius: theme.spacing(1)
}
}));
const GeneratedLink = React.forwardRef((props, ref) => (
<RouterLink innerRef={ref} {...props} />
));
function SignUpForm() {
const classes = useStyles();
return (
<Paper elevation={3} className={classes.container} id={"sign-up"}>
<TextField
id="standard-basic"
label="My name is"
className={`${classes.name} ${classes.formSpacing}`}
/>
<RadioGroup
aria-label="gender"
name="gender"
className={classes.formSpacing}
>
I am a:
<FormControl>
<Select labelId="demo-simple-select-label">
<MenuItem value={"woman"}>Woman</MenuItem>
<MenuItem value={"man"}>Man</MenuItem>
<MenuItem value={"other"}>Other</MenuItem>
</Select>
</FormControl>
</RadioGroup>
<RadioGroup
aria-label="gender"
name="gender"
className={classes.formSpacing}
>
<FormControl>
<InputLabel id="demo-simple-select-label">In Search of</InputLabel>
<Select labelId="demo-simple-select-label">
<MenuItem value={"adam-ginther"}>Adam Ginther</MenuItem>
<MenuItem value={"sad-life"}>A Sad Life</MenuItem>
</Select>
</FormControl>
</RadioGroup>
<Button className={classes.getStartedButton}>
<Link
to={"/swipe"}
component={GeneratedLink}
className={classes.getStartedLink}
>
Start Swiping
</Link>
</Button>
</Paper>
);
}
export default SignUpForm;
|
var setup = {
options:{
getFunction:function(functions,parameters,callback){
// var parameters = '';
events.ajax({
"url":suite.get().url+'_component/setup/gui/getfunction',
'data':{'function':functions,'parameters':parameters},
success:function(response){
if(callback)
callback(response);
}
});
},
get:function(path,parameters,callback){
events.ajax({
"url":suite.get().url+'_component/setup/gui/get',
"data":{
command:path,
'parameters':parameters
},
success:function(response){
if(callback)
callback(response);
}
});
}
}
}
|
/* jshint node: true */
'use strict';
let babel = require('rollup-plugin-babel'),
includePaths = require('rollup-plugin-includepaths'),
js_ignores = [
'!pages/static/js/build/**',
'!pages/static/js/temp/**',
'!pages/static/js/vendor/**',
],
js_apps = [
'pages/static/js',
'contact/static/js'
],
srcFromApps = function(filepath) {
let src = [];
for (var app of js_apps) {
src.push(app + '/' + filepath);
}
return src;
};
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {
media: {
files: [{
expand: true,
cwd: 'media/images/',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: 'media/images'
}]
}
},
clean: {
build: 'pages/static/js/build/*',
temp: 'pages/static/js/temp/*',
all: [
'pages/static/js/build/*',
'pages/static/js/temp/*'
]
},
bgShell: {
_defaults: {
bg: true
},
livereload: {
cmd: 'python manage.py runserver livereload'
},
runserver: {
cmd: 'python manage.py runserver'
}
},
jshint: {
options: {
esversion: 6
},
all: {
src: srcFromApps('**/*.js').concat(js_ignores)
}
},
concat: {
js: {
src: srcFromApps('**/app.js').concat(js_ignores),
dest: 'pages/static/js/temp/main.js'
}
},
rollup: {
dev: {
options: {
format: 'es',
plugins: function() {
return [
includePaths({
paths: js_apps
})
];
}
},
files: [{
src: 'pages/static/js/temp/main.js', // May only contain 1 src.
dest: 'pages/static/js/build/main.js',
}]
},
build: {
options: {
format: 'es',
sourceMap: true,
plugins: function() {
return [
includePaths({
paths: js_apps
}),
babel({compact: false})
];
}
},
files: [{
src: 'pages/static/js/temp/main.js', // May only contain 1 src.
dest: 'pages/static/js/build/main.js',
}]
}
},
watch: {
js: {
tasks: ['diff_dev'],
files: srcFromApps('**/*.js').concat(js_ignores)
}
}
});
grunt.loadNpmTasks('grunt-bg-shell');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rollup');
grunt.loadNpmTasks('grunt-newer');
grunt.registerTask('diff_dev',
"Join and rollup all the ES6, but don't transpile.",
['newer:jshint:all', 'clean:build', 'concat:js', 'rollup:dev']
);
grunt.registerTask('build',
"Join, rollup, transpile, and uglify static JavaScript assets",
['jshint:all', 'clean:all', 'concat:js', 'rollup:build']
);
grunt.registerTask('dev',
['bgShell:livereload', 'watch']
);
// From project
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('default', ['imagemin']);
};
|
define([
'AppView',
'text!./AdvancedForm.html',
'text!./SimpleInputFieldView.html',
'text!./ButtonView.html',
'text!./DropDownView.html',
'text!./SliderInputFieldView.html',
'text!./DateInputFieldView.html',
'text!./RadioButtonView.html',
'text!./CheckBoxView.html',
'text!./ColorPickerView.html'
],
function(
AppView,
template,
SimpleInputFieldView,
ButtonView,
DropDownView,
SliderInputFieldView,
DateInputFieldView,
RadioButtonView,
CheckBoxView,
ColorPickerView
) {
var events = [];
events['click .helpIcon'] = 'onclickHelp';
events['keypress .sliderValue'] = 'onkeyPressSliderInput';
events['change .sliderValue'] = 'onChangeSliderInput';
var FormView = AppView.extend({
start : function() {
this.delegateEvents(events);
this.setReady(true);
},
render : function() {
var self= this;
this.applyTemplate(template);
this.sectionTag = $(this.el)[0].children[0];
this.displayForm(this.formData);
// Setup mouse listener to close help popups
$(document).mouseup(function (e) {
var container = $('.helpTextContainer');
if (!container.is(e.target) // if the target of the click isn't the container
&& container.has(e.target).length === 0) // or a descendant of the container
{
container.hide();
}
});
$(function() {
$(".date-picker").datepicker();
// To add support for CSS3 in IE8
if (window.PIE) {
$('.ui-slider-handle').each(function() {
PIE.attach(this);
});
$('.helpIcon').each(function() {
PIE.attach(this);
});
}
$.getScript("../../core/js/vendor/jscolor.js");
});
},
setData: function (data) {
this.formData = data;
},
getValues: function () {
var inputList = $(this.sectionTag).find('input, select, textarea'),
inputListLength = inputList.length,
i,
valuesData = {};
for (i = 0; i < inputListLength; i++) {
valuesData[inputList[i].name] = inputList[i].value;
}
return valuesData;
},
setValues: function (values) {
for (var key in values) {
this.$('[name="'+key+'"]').val(values[key]);
};
},
displayForm: function (formData) {
var form = formData.form,
formLength = form.length;
self.container = $(".advance-form-container");
self.formItems = self.container.find(".advance-form-item-container");
if (formData.formDescription != undefined && formData.formDescription != '') {
var formDesc = self.container.find('.form-desc');
formDesc.html(formData.formDescription);
formDesc.show();
}
var sliderCount = 0;
for (var i=0; i< formLength; i++) {
var formField = form[i];
if (formField == undefined || formField == null) {
continue;
}
var label = formField.label;
if (label == undefined || label == '') {
label = '';
}
var name = formField.formItem;
if (name == undefined || name == '') {
name = '';
}
var value = formField.value;
if (value == undefined || value == '') {
value = '';
}
var required = formField.required;
if (required == undefined || required == '') {
required = false;
}
if (formField.formElement == 'input') {
var simpleInputFieldView = _.template(SimpleInputFieldView, {"label": label, "value": value, "type":"input", "required":required});
self.formItems.append(simpleInputFieldView);
} else if (formField.formElement == 'button') {
var buttonView = _.template(ButtonView, {"value": label, "name": name});
self.formItems.append(buttonView);
var button = self.container.find(".button-view-container button").last();
$(button).click({viewRef: this}, formField.clickHandler);
} else if (formField.formElement == 'select') {
var dropDownView = _.template(DropDownView, {"label": label, "name": name, "options":formField.options, "required": required });
self.formItems.append(dropDownView);
} else if (formField.formElement == 'slider') {
var min = formField.minValue;
var max = formField.maxValue;
var sliderInputFieldView = _.template(SliderInputFieldView, {"label": label, "name": name, "value": value, "required": required});
self.formItems.append(sliderInputFieldView);
// Fix the alignment issue with label and slider
var labelContainer = self.formItems.find(".label-container").last();
var label = $(labelContainer).find("label");
var labelWidth = $(label).width();
if(labelWidth > 120) {
labelContainer.css("float", "none");
}
var sliderContainer = self.formItems.find(".slider-input-container")[sliderCount];
var slider = $(sliderContainer).find(".slider-bar");
$(slider).width(formField.width+"px");
$(slider).data("min", min);
$(slider).data("max", max);
$(sliderContainer).find(".slider-bar").slider({
orientation: "horizontal",
range: "min",
min: min,
max: max,
value: formField.value,
slide: function( event, ui ) {
var target = event.target;
$(target).parent().parent().find(".sliderValue").val( ui.value );
}
});
sliderCount++;
} else if (formField.formElement == 'date') {
var dateInputFieldView = _.template(DateInputFieldView, {"label": label, "name": name, "value": value, "required": required});
self.formItems.append(dateInputFieldView);
} else if (formField.formElement == 'radio') {
if (formField.options == undefined || formField.options.length == undefined) {
console.error("Options are mandatory for radio inputs.");
} else {
var radioButtonView = _.template(RadioButtonView, {"label": label, "name": name, "options":formField.options, "required": required });
self.formItems.append(radioButtonView);
}
} else if (formField.formElement == 'checkbox') {
if (formField.options == undefined || formField.options.length == undefined) {
console.error("Options are mandatory for checkbox inputs.");
} else {
var checkBoxView = _.template(CheckBoxView, {"label": label, "name": name, "options":formField.options, "required": required });
self.formItems.append(checkBoxView);
}
} else if (formField.formElement == 'color') {
var colorPickerView = _.template(ColorPickerView, {"label": label, "name": name, "value": value, "required": required });
self.formItems.append(colorPickerView);
}
var helpText = formField.helpText;
if (helpText != undefined && helpText != '' && formField.formElement != 'button') {
var fieldContainer = self.container.find(".advanceFormItem").last();
this.addHelp(fieldContainer, helpText);
}
}
var footNote = self.container.find(".required-footnote");
if (footNote.html() == undefined) {
self.container.find(".required-footnote-container").hide();
}
},
onclickHelp : function (event) {
var icon = $(event.currentTarget);
var popup = icon.siblings(".helpTextContainer");
var position = icon.position();
popup.css("top", position.top +"px");
popup.css("left", position.left+25+"px");
popup.toggle();
},
onkeyPressSliderInput : function (event) {
var self = this;
self.allowNumericInput(event);
},
onChangeSliderInput : function (event) {
var slider = $(event.currentTarget).parent().parent().find(".slider-bar");
var minValue = $(slider).data("min");
var maxValue = $(slider).data("max");
var userValue = $(event.currentTarget).val();
if (userValue < minValue ){
userValue = minValue;
$(event.currentTarget).val(minValue);
}
if (userValue > maxValue) {
userValue = maxValue;
$(event.currentTarget).val(maxValue);
}
$(slider).slider("value", userValue);
},
addHelp: function (fieldContainer, helpText) {
var helpIconElement = document.createElement('div');
$(helpIconElement).addClass("helpIcon");
$(helpIconElement).text("?");
$(fieldContainer).append(helpIconElement);
var helpPopup = document.createElement('div');
$(helpPopup).addClass("helpTextContainer");
$(helpPopup).text(helpText);
$(fieldContainer).append(helpPopup);
},
/**
* This function will restrict user to enter only numeric or decimal value in the input box.
* Should be called on keypress event
* @param event
*/
allowNumericInput: function (event) {
var isDotAllowed = true;
if ($(event.currentTarget).val().indexOf(".") > -1){
isDotAllowed = false;
}
if(event.which != 8 && isNaN(String.fromCharCode(event.which))){
if (String.fromCharCode(event.which) != ".") {
if (String.fromCharCode(event.which) == "-" && $(event.currentTarget).val().indexOf("-") == -1){
return;
}
event.preventDefault();
} else {
if (isDotAllowed == false) {
event.preventDefault();
} else {
isDotAllowed = false;
}
}
}
}
});
return FormView;
});
|
const Rem = (() => {
let iScale = 1 / window.devicePixelRatio
document.querySelectorAll('meta')[1].setAttribute('content', `width=device-width, user-scalable=no, initial-scale=${iScale}, minimum-scale=${iScale}, maximum-scale=${iScale}`)
let iWidth = document.documentElement.clientWidth
let rootStyle
rootStyle = `font-size: ${iWidth / 10}px; width=100%; height: 100%; overflow: hidden;`
document.querySelector('html').setAttribute('style', rootStyle)
})()
export default Rem
|
const fs = require('fs');
var files = fs.readdirSync("./lib");
console.log (files)
fs.readdir("./lib/spawn", function(err, document) {
if (err) {
throw err;
};
console.log(document);
});
console.log("Reading files in 'lib' directory.");
|
define([
'Backbone',
'jquery',
'exercises/1/ItemView'
], function(
Backbone,
$,
ItemView
) {
var PageView = Backbone.View.extend({
/**
* Template function for create HTML from this view
*
* @type {function}
*/
template: _.template($('#page-template').html()),
/**
* Renders this view.
*
* @return {Backbone.View} a reference to this view
*/
render: function() {
// First render the container template to set up the inital empty $el. Look at the
// page-template in index.html to see what info we can pass to the template. Lets pass
// in the title 'Exercise 1'.
this.$el.html(this.template({
title: 'Exercise 1'
}));
// Now that our $el is filled with the template, we want to loop through the collection
// and create an ItemView for each model in the list, render it, and append it to the .items ul
// keep a reference to our container to put the models in. by doing
// this.$(selector) it is shorthand for this.$el.find(selector) which looks for that
// selector but scopes its search only to this.$el.
var $container = this.$('.items');
// loop through each item in the collection and create a view for it
// Create a view for the current model and render it.
// add the rendered views el to the DOM
// Always return this
return this;
}
});
return PageView;
});
|
export const SIGNUP_ERROR = 'SIGNUP_ERROR';
export const SIGNUP_SUCCESS = 'SIGNUP_SUCCESS';
|
import React from 'react'; // eslint-disable-line no-unused-vars
import { ParagraphEditor as ParagraphEditorComponent } from '../../../components/paragraph/components/paragraph-editor';
export const ParagraphEditor = ({ attributes, actions }) => {
const {
blockClass,
paragraph,
} = attributes;
const {
onChangeParagraphContent,
} = actions;
const paragraphObject = (typeof paragraph === 'undefined') || paragraph;
return (
<ParagraphEditorComponent
blockClass={blockClass}
paragraph={paragraphObject}
onChangeContent={onChangeParagraphContent}
/>
);
};
|
/* eslint-env node, mocha */
'use strict';
var chai = require('chai'),
sinonChai = require('sinon-chai'),
path = require('path'),
architect = require('../pipe/architect'),
expect = chai.expect;
chai.use(sinonChai);
describe('pipe architect', function () {
it('should resolve the default buildDir correctly', function (done) {
architect.initializeConfig().then(function (data) {
expect(data.buildDir).to.equal(path.resolve('build'));
done();
});
});
it('should resolve a custom buildDir correctly', function (done) {
architect.initializeConfig({
buildDir: 'my-custom-build-dir'
}).then(function (data) {
expect(data.buildDir).to.equal(path.resolve('my-custom-build-dir'));
done();
});
});
it('should resolve the default contentDir correctly', function (done) {
architect.initializeConfig().then(function (data) {
expect(data.contentDir).to.equal(path.resolve('content'));
done();
});
});
it('should resolve a custom contentDir correctly', function (done) {
architect.initializeConfig({
contentDir: 'my-custom-content-dir'
}).then(function (data) {
expect(data.contentDir).to.equal(path.resolve('my-custom-content-dir'));
done();
});
});
it('should resolve the themesDir correctly', function (done) {
architect.initializeConfig().then(function (data) {
expect(data.themesDir).to.equal(path.resolve('themes'));
done();
});
});
it('should resolve a custom themesDir correctly', function (done) {
architect.initializeConfig({
themesDir: 'my-custom-themes-dir'
}).then(function (data) {
expect(data.themesDir).to.equal(path.resolve('my-custom-themes-dir'));
done();
});
});
it('should resolve a custom content structure', function (done) {
architect.initializeConfig({
contentDir: 'test/content',
content: {
'test-category-two/': {
type: 'pages'
}
}
}).then(architect.loadCustoms).then(function (data) {
expect(data.content).to.deep.equal({
'./': {
type: 'pages'
},
'static/': {
type: 'statics'
},
'test-category-two/': {
type: 'pages'
}
});
done();
});
});
});
|
var t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
return typeof t;
} : function(t) {
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
};
(global.webpackJsonp = global.webpackJsonp || []).push([ [ "pages/messages/main" ], {
"08c1": function(t, e, n) {
var o = n("4d6b");
n.n(o).a;
},
"0f5c": function(e, n, o) {
function i(e) {
return (i = "function" == typeof Symbol && "symbol" === t(Symbol.iterator) ? function(e) {
return void 0 === e ? "undefined" : t(e);
} : function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : void 0 === e ? "undefined" : t(e);
})(e);
}
function r() {
if ("function" != typeof WeakMap) return null;
var t = new WeakMap();
return r = function() {
return t;
}, t;
}
function c(t) {
return t && t.__esModule ? t : {
default: t
};
}
function a(t, e, n, o, i, r, c) {
try {
var a = t[r](c), s = a.value;
} catch (t) {
return void n(t);
}
a.done ? e(s) : Promise.resolve(s).then(o, i);
}
function s(t) {
return function() {
var e = this, n = arguments;
return new Promise(function(o, i) {
function r(t) {
a(s, o, i, r, c, "next", t);
}
function c(t) {
a(s, o, i, r, c, "throw", t);
}
var s = t.apply(e, n);
r(void 0);
});
};
}
function u(t, e) {
var n = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(t);
e && (o = o.filter(function(e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable;
})), n.push.apply(n, o);
}
return n;
}
function l(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {};
e % 2 ? u(Object(n), !0).forEach(function(e) {
f(t, e, n[e]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : u(Object(n)).forEach(function(e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
});
}
return t;
}
function f(t, e, n) {
return e in t ? Object.defineProperty(t, e, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[e] = n, t;
}
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = void 0;
var _, d = c(o("a34a")), h = o("2f62"), p = c(o("8e44")), g = c(o("12bf")), m = (c(o("41f4")),
c(o("9998"))), b = c(o("9554")), v = function(t) {
if (t && t.__esModule) return t;
if (null === t || "object" !== i(t) && "function" != typeof t) return {
default: t
};
var e = r();
if (e && e.has(t)) return e.get(t);
var n = {}, o = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var c in t) if (Object.prototype.hasOwnProperty.call(t, c)) {
var a = o ? Object.getOwnPropertyDescriptor(t, c) : null;
a && (a.get || a.set) ? Object.defineProperty(n, c, a) : n[c] = t[c];
}
return n.default = t, e && e.set(t, n), n;
}(o("cbd7")), y = o("07d2"), w = o("a177"), O = "chat_list", S = {
"开盘消息": "open",
"互动消息": "interac",
"置业顾问通知": "con",
"最新动态": "dynamic"
}, P = {
mixins: [ c(o("f832")).default ],
name: O,
data: function() {
return {
no_more: !1,
page: 1,
loading: !0,
list_loading: !0,
is_login: v.IM_STORE.login,
chats: [],
is_consultant_user: !1,
show_top_tip: !1,
top_tip_link: "",
notices: [],
swipeActionOptions: [ {
text: "删除",
style: {
backgroundColor: "#E64340"
}
} ],
hot_list: [],
hot_time: "",
categories: []
};
},
computed: l({}, (0, h.mapState)([ "wxArticle" ])),
onLoad: function() {
var t = this;
this.is_login || wx.showLoading({
title: "请稍等",
mask: !0
}), p.default.init().then(function() {
w.App_User.get().then(function(e) {
var n = e.is_consultant, o = e.weixin_subscribed, i = e.consultant_weixin_subscribed;
t.is_consultant_user = n;
var r = n ? 6 : 3, c = t.wxArticle[r], a = c.url, s = c.title, u = c.share;
return t.show_top_tip = n ? !i : !o, t.top_tip_link = "/pages/web_page/main?link=".concat(encodeURIComponent(a), "&title=").concat(s, "&shareShow=").concat(u),
n;
}), t.addListener();
}), this.getHotList();
},
watch: {
is_login: function(t) {
t && wx.hideLoading();
}
},
onShow: function() {
this.list_loading || (this.page = 1, this.getHotList(), this.getSessions()), this.getCategories();
},
onUnload: function() {
v.IM_STORE.remove_login_watcher(O), v.IM_STORE.remove_chatList_watcher(O), v.IM_STORE.remove_noMore_watcher(O),
_ && clearTimeout(_);
},
onPullDownRefresh: function() {
this.list_loading || (this.page = 1, this.getHotList(), this.getSessions()), _ = setTimeout(function() {
wx.stopPullDownRefresh();
}, 1e3);
},
methods: {
getCategories: function() {
var t = this;
return s(d.default.mark(function e() {
var n;
return d.default.wrap(function(e) {
for (;;) switch (e.prev = e.next) {
case 0:
return e.next = 2, m.default.getChatListCategories();
case 2:
(n = e.sent).items.forEach(function(t) {
t.key = S[t.name];
}), t.categories = n.items;
case 5:
case "end":
return e.stop();
}
}, e);
}))();
},
getHotList: function() {
var t = this;
g.default.getHotSearchList().then(function(e) {
t.hot_list = e.items, t.hot_time = e.refreshed_at;
});
},
getSessions: function() {
this.list_loading = !0, console.error("_____________getSession_____________", this.page),
v.default.getSessions({
page: this.page
});
},
addListener: function() {
var t = this;
v.IM_STORE.add_login_watcher(O, function(e) {
console.error("login status", e), e === y.LOGIN_STATUS.NONE && v.default.getSessions(),
setTimeout(function() {
t.is_login = e === y.LOGIN_STATUS.DONE;
}, 1e3);
}), v.IM_STORE.add_chatList_watcher(O, function(e) {
console.error("咨询用户条数_____________________", e.length), t.chats = e.map(function(t) {
var e = "", n = t.last_messsage;
if (n) {
var o = n.msg_style;
e = n.msg_content, "img" === o && (e = "[图片]"), "audio" === o && (e = "[语音]"), "building_card" === o && (e = "[".concat(n.msg_content, "]"));
}
return l(l({}, t), {}, {
messsage_content: e
});
}), t.list_loading = !1;
}), v.IM_STORE.add_chatListLoaded_watcher(O, function(e) {
t.loading = !e;
}), v.IM_STORE.add_no_more_watcher(O, function(e) {
console.error("_____________________no_more", e), t.no_more = e;
});
},
goChat: function(t) {
(0, b.default)(t, function() {
var e = t.currentTarget.dataset.id;
v.default.resetChatMapByConversation(), wx.navigateTo({
url: "/pages/chat_list/chat/main?session_id=".concat(e)
});
}, "需要认证用户信息才进入聊天");
},
readAll: function() {
var t = this;
m.default.readAllMsgs().then(function() {
t.getCategories();
}), p.default.readAllTimMsg(), this.notice_count = 0, this.hideMessageRedDot(),
v.default.getSessions(), v.default.readAll();
},
onSwipeActionClick: function(t, e) {
v.default.delChat(e);
},
onSwipeActionchange: function(t) {}
},
components: {
Loading: function() {
o.e("components/views/loading").then(function() {
return resolve(o("7756"));
}.bind(null, o)).catch(o.oe);
},
uiSwipeAction: function() {
o.e("components/ui/swipeAction").then(function() {
return resolve(o("83f1"));
}.bind(null, o)).catch(o.oe);
},
uiSwipeActionItem: function() {
Promise.all([ o.e("common/vendor"), o.e("components/ui/swipeActionItem/swipeActionItem") ]).then(function() {
return resolve(o("78b7"));
}.bind(null, o)).catch(o.oe);
},
HotList: function() {
o.e("pages/index/top_search/host_list").then(function() {
return resolve(o("305a"));
}.bind(null, o)).catch(o.oe);
},
HotListHeader: function() {
o.e("pages/index/search/_hot_list_header").then(function() {
return resolve(o("27be"));
}.bind(null, o)).catch(o.oe);
}
}
};
n.default = P;
},
"262d": function(t, e, n) {
n.r(e);
var o = n("4db1"), i = n("4501");
for (var r in i) [ "default" ].indexOf(r) < 0 && function(t) {
n.d(e, t, function() {
return i[t];
});
}(r);
n("08c1");
var c = n("f0c5"), a = Object(c.a)(i.default, o.b, o.c, !1, null, "79ff8d16", null, !1, o.a, void 0);
e.default = a.exports;
},
4501: function(t, e, n) {
n.r(e);
var o = n("0f5c"), i = n.n(o);
for (var r in o) [ "default" ].indexOf(r) < 0 && function(t) {
n.d(e, t, function() {
return o[t];
});
}(r);
e.default = i.a;
},
"4d6b": function(t, e, n) {},
"4db1": function(t, e, n) {
n.d(e, "b", function() {
return o;
}), n.d(e, "c", function() {
return i;
}), n.d(e, "a", function() {});
var o = function() {
var t = this;
t.$createElement;
t._self._c;
}, i = [];
},
"5be6": function(t, e, n) {
(function(t) {
function e(t) {
return t && t.__esModule ? t : {
default: t
};
}
n("6cdc"), e(n("66fd")), t(e(n("262d")).default);
}).call(this, n("543d").createPage);
}
}, [ [ "5be6", "common/runtime", "common/vendor" ] ] ]);
|
describe('DatabaseConnection', function() {
var databaseConnection
beforeEach(function() {
databaseConnection = new DatabaseConnection()
})
describe('It connects to the database', function() {
databaseConnection.setup();
var dbo;
expect(dbo = db.db("mydb")).not.toThrowError
})
})
|
const postData = require('../src/server/server');
test("Test if postData id defined", () => {
expect(postData).toBeDefined();
});
|
import React, { Component, PropTypes } from 'react'
import { Link } from "react-router";
export default class HomeFooter extends Component {
render() {
return (
<footer className="home-footer">
<div className="homepage-section homepage-section-social">
<div className="homepage-section-wrapper">
<div className="homepage-section-social-flower">
<img className="homepage-section-social-flower-img" src="/html/src/img/flower.png"/>
</div>
<div className="homepage-section-social-networks">
<Link className="homepage-section-social-networks-link" to='#'>
<svg className="icon icon-facebook">
<use xlinkHref="#icon-facebook"></use>
</svg>
</Link>
<Link className="homepage-section-social-networks-link" to='#'>
<svg className="icon icon-instagram">
<use xlinkHref="#icon-instagram"></use>
</svg>
</Link>
<Link className="homepage-section-social-networks-link" to='#'>
<svg className="icon icon-twitter">
<use xlinkHref="#icon-twitter"></use>
</svg>
</Link>
<Link className="homepage-section-social-networks-link" to='#'>
<svg className="icon icon-pinterest">
<use xlinkHref="#icon-pinterest"></use>
</svg>
</Link>
<Link className="homepage-section-social-networks-link" to='#'>
<svg className="icon icon-youtube">
<use xlinkHref="#icon-youtube"></use>
</svg>
</Link>
</div>
</div>
</div>
<div className="homepage-section homepage-footer">
<div className="homepage-footer-wrapper">
<div><Link to="#">Mentions légales</Link> - MyDressUp © All rights reserved 2016.</div>
</div>
</div>
</footer>
)
}
}
|
const chai = require('chai')
const should = chai.should()
const expect = chai.expect
const chaiHttp = require('chai-http')
const app = require('../app.js')
const Destination = require('../models/Destination')
chai.use(chaiHttp)
var newDestination = {
destination_code: 'd0001',
list_of_destination: ['blok_m','monas']
}
var newDestination2 = {
destination_code: 'd0002',
list_of_destination: ['mangga_dua','lebak_bulus']
}
describe('TESTING CREATE DESTINATION: ', () => {
afterEach(done => {
Destination.remove({_id: newDestination._id})
.then(response => {
Destination.remove({_id: newDestination._id})
.then(() => done())
.catch(err2 => console.log(err2))
})
.catch(err => console.log(err))
})
it ('should return response status 200', (done) => {
chai.request(app)
.post(`/destinations`)
.send(newDestination)
.end((err, response) => {
newDestination._id = response.body._id
response.status.should.equal(200)
done()
})
})
it ('should return response.body as an "object"', (done) => {
chai.request(app)
.post('/destinations')
.send(newDestination)
.end((err, response) => {
newDestination._id = response.body._id
response.body.should.be.an('object')
done()
})
})
it (`should return response.body.destination_code = "${newDestination.destination_code}"`, (done) => {
chai.request(app)
.post('/destinations')
.send(newDestination)
.end((err, response) => {
newDestination._id = response.body._id
response.body.destination_code.should.equal(newDestination.destination_code)
done()
})
})
// it (`should return response.body.destination = "${newDestination.destination}"`, (done) => {
// chai.request(app)
// .post('/destinations')
// .send(newDestination)
// .end((err, response) => {
// newDestination._id = response.body._id
// response.body.destination.should.equal(newDestination.destination)
// done()
// })
// })
})
describe('TESTING DELETE DESTINATION: ', () => {
beforeEach(done => {
Destination.create(newDestination)
.then(response => {
newDestination._id = response._id
done()
})
.catch(err => console.log(err))
})
it ('should return response status = 200', (done) => {
chai.request(app)
.delete(`/destinations/${newDestination._id}`)
.end((err, response) => {
response.status.should.equal(200)
done()
})
})
it ('expect response2.body to not have property "destination_code"', (done) => {
chai.request(app)
.delete(`/destinations/${newDestination._id}`)
.end((err, response) => {
chai.request(app)
.get(`/destinations/${newDestination._id}`)
.end((err2, response2) => {
expect(response2.body).to.not.have.property('destination_code');
done()
})
})
})
it ('expect response2.body to not have property "list_of_destination"', (done) => {
chai.request(app)
.delete(`/destinations/${newDestination._id}`)
.end((err, response) => {
chai.request(app)
.get(`/destinations/${newDestination._id}`)
.end((err2, response2) => {
expect(response2.body).to.not.have.property('list_of_destination');
done()
})
})
})
})
describe('TESTING GET ALL DESTINATIONS: ', () => {
beforeEach(done => {
Destination.create(newDestination)
.then(response => {
newDestination._id = response._id
Destination.create(newDestination2)
.then(response2 => {
newDestination2._id = response2._id
done()
})
.catch(err2 => console.log(err2))
})
.catch(err => console.log(err))
})
afterEach(done => {
Destination.remove({
_id: newDestination._id
})
.then(response => {
Destination.remove({
_id: newDestination2._id
})
.then(response2 => done())
.catch(err2 => console.log(err2))
})
.catch(err => console.log(err))
})
it ('should return response status = 200', (done) => {
chai.request(app)
.get('/destinations')
.end((err, response) => {
response.status.should.equal(200)
done()
})
})
it ('should return response.body as an "array"', (done) => {
chai.request(app)
.get('/destinations')
.end((err, response) => {
response.body.should.be.an('array')
done()
})
})
it (`should return response.body[0].destination_code = ${newDestination.destination_code}`, (done) => {
chai.request(app)
.get('/destinations')
.end((err, response) => {
response.body[0].destination_code.should.equal(newDestination.destination_code)
done()
})
})
// it (`should return response.body[0].list_of_destination = ${newDestination.list_of_destination}`, (done) => {
// chai.request(app)
// .get('/destinations')
// .end((err, response) => {
// response.body[0].list_of_destination.should.equal(newDestination.list_of_destination)
// done()
// })
// })
it (`should return response.body[1].destination_code = ${newDestination2.destination_code}`, (done) => {
chai.request(app)
.get('/destinations')
.end((err, response) => {
response.body[1].destination_code.should.equal(newDestination2.destination_code)
done()
})
})
})
describe('TESTING GET ONE DESTINATION: ', () => {
beforeEach(done => {
Destination.create(newDestination)
.then(response => {
newDestination._id = response._id
done()
})
.catch(err => console.log(err))
})
afterEach(done => {
Destination.remove({
_id: newDestination._id
})
.then(response => done())
.catch(err => console.log(err))
})
it ('should return response status = 200', (done) => {
chai.request(app)
.get(`/destinations/${newDestination._id}`)
.end((err, response) => {
response.status.should.equal(200)
done()
})
})
it ('should return response.body as an "object"', (done) => {
chai.request(app)
.get(`/destinations/${newDestination._id}`)
.end((err, response) => {
response.body.should.be.an('object')
done()
})
})
it (`should return response.body.destination_code = ${newDestination.destination_code}`, (done) => {
chai.request(app)
.get(`/destinations/${newDestination._id}`)
.end((err, response) => {
response.body.destination_code.should.equal(newDestination.destination_code)
done()
})
})
})
describe('TESTING UPDATE DESTINATION: ', () => {
beforeEach(done => {
Destination.create(newDestination)
.then(response => {
newDestination._id = response._id
done()
})
.catch(err => console.log(err))
})
afterEach(done => {
Destination.remove({
_id: newDestination._id
})
.then(response => done())
.catch(err => console.log(err))
})
it ('should return response status = 200', (done) => {
delete newDestination2._id
chai.request(app)
.put(`/destinations/${newDestination._id}`)
.send(newDestination2)
.end((err, response) => {
response.status.should.equal(200)
done()
})
})
it (`should return response2.body.destination_code = "${newDestination2.destination_code}"`, (done) => {
delete newDestination2._id
chai.request(app)
.put(`/destinations/${newDestination._id}`)
.send(newDestination2)
.end((err, response) => {
chai.request(app)
.get(`/destinations/${newDestination._id}`)
.end((err2, response2) => {
response2.body.destination_code.should.equal(newDestination2.destination_code)
done()
})
})
})
})
|
var CreationController = {
$container: undefined,
questionCount: 0,
questionsArray: [],
newQuiz: function($container) {
this.questionCount = 0,
this.questionsArray = [],
this.$container = $container;
$container.html('');
var newQuizView = new NewQuizView($container);
},
addQuestion: function() {
var newQuestion = new CreateQuestionView();
this.questionCount++;
},
saveQuiz: function(quizObject, $container) {
this.$container = $container;
if (localStorage[quizObject.name]) {
alert("Quiz name in use. Please choose another.");
}
else {
quizData = quizObject;
var storedQuizzes = JSON.parse(localStorage['quizzes']);
storedQuizzes.push(quizData.name);
localStorage['quizzes'] = JSON.stringify(storedQuizzes);
localStorage[quizData.name] = JSON.stringify(quizData);
ApplicationController.resetApp($container);
}
}
};
|
import { createPromise } from '../../src/index'
import { expect } from 'chai'
describe('createPromise ()', () => {
beforeEach(() => {
const MockBrowser = require('mock-browser').mocks.MockBrowser
global.document = new MockBrowser().getDocument()
})
afterEach(() => {
global.document = {}
})
it('returns a promise', () => {
// cant really test this... dont want to use rewire
const promise = createPromise({})
expect(promise instanceof Promise).to.be.true
})
})
|
$(document).ready(function() {
console.log("Lets Eat!");
});
// Search Parameters
var title = null;
var thumbnailURL = null;
var ingredient = null;
var credits = null;
var measurements = null;
//Functions
var settings = {
"async": true,
"crossDomain": true,
"url": "https://tasty.p.rapidapi.com/recipes/list?tags=under_30_minutes&q=kale&from=0&sizes=20",
"method": "GET",
"headers": {
"x-rapidapi-host": "tasty.p.rapidapi.com",
"x-rapidapi-key": "ac032b7765msh7b7ea8d251892bbp18630ejsnfccfef5696ae"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
updatePage(response);
document.getElementById
});
|
import React from 'react';
import Data from './Data'
const ACME_App = () => {
console.log(Data.customers);
const MappedNames = Data.customers.map(function(customer, index) {
return (
<div key={index} className="acme-customers">
<h3>{customer.name}</h3>
<p>{customer.email}</p>
<img src={customer.img} alt="dummy alt text" />
</div>
)
})
return (
<div>
<h1>{"ACME data!"}</h1>
<div className="acme-container">
<ul>
{MappedNames}
</ul>
</div>
</div>
)
}
export default ACME_App;
|
import React from 'react'
import {useDrop} from 'react-dnd'
import {Timetable} from './timetable'
const FirstPick = ({timetable, _seeDetails, _changeFirstPick}) => {
const [, drop] = useDrop({
accept: "timetable",
drop: (item) =>{_changeFirstPick(item.timetable)},
})
return(
<div ref = {drop} className = "firstPick">
<Timetable timetable = {timetable} _seeDetails = {_seeDetails}/>
</div>
)
}
export default FirstPick
|
(function($) {
/**
* 按比例缩放图片
* @param ImgD
* @param FitWidth
* @param FitHeight
*/
$.scaleImage = function(ImgD,FitWidth,FitHeight){
var image=new Image();
image.src= $(ImgD).attr('src');
if(image.width>0 && image.height>0){
if(image.width/image.height>= FitWidth/FitHeight){
if(image.width>FitWidth){
$(ImgD).width(FitWidth);
$(ImgD).height((image.height*FitWidth)/image.width);
}else{
$(ImgD).width(image.width);
$(ImgD).height(image.height);
}
} else {
if(image.height>FitHeight) {
$(ImgD).height(FitHeight);
$(ImgD).width((image.width*FitHeight)/image.height);
} else {
$(ImgD).width(image.width);
$(ImgD).height(image.height);
}
}
}
image=null;
}
})(jQuery);
|
/**
* NaN => Not a Number
* IEEE 754-2008 - Padrão de precisão de casas decimais seguido pelo javascript
*/
let num1 = 0.7;
let num2 = 0.1;
num1 += num2; //0.8
num1 += num2; //0.9
num1 += num2; //1.0
num1 += num2; //1.1
num1 += num2; //1.2
num1 += num2; //1.3
num1 += num2; //1.4
num1 += num2; //1.5
//num1 = parseFloat(num1.toFixed(2));
num1 = Number(num1.toFixed(2));
console.log(num1);
console.log(Number.isInteger(num1));
//console.log(num1.toString() + num2);
//num1 = num1.toString();
//console.log(num1.toString(2)); //retorna a representação binária do valor
//console.log(num1.toFixed(2)); //arredonda o valor em 2 casas
//let temp = num1 + 'Olá';
//console.log(Number.isNaN(temp));
|
const axios = require('axios');
const getAllAvatars = () => {
const apiKey = process.env.CLOUDINARY_API_KEY;
const apiSecret = process.env.CLOUDINARY_API_SECRET;
const url = `https://${apiKey}:${apiSecret}@api.cloudinary.com/v1_1/dvdmubcjl/resources/image/upload?prefix=av`;
return axios(url);
};
const getOneAvatar = (avatarId) => {
const apiKey = process.env.CLOUDINARY_API_KEY;
const apiSecret = process.env.CLOUDINARY_API_SECRET;
const url = `https://${apiKey}:${apiSecret}@api.cloudinary.com/v1_1/dvdmubcjl/resources/image/upload/${avatarId}`;
return axios(url);
};
module.exports = {
getAllAvatars,
getOneAvatar,
};
|
import { InboxOutlined } from "@ant-design/icons";
import { Button } from "antd";
import Dragger from "antd/lib/upload/Dragger";
import React from "react";
const ALLOWED_FILE_EXTENSIONS = [".mp4", ".avi", ".mpg", ".m4v"];
const Uploader = (props) => {
const { loading, handleUpload } = props;
const [inputFile, setInputFile] = React.useState([]);
return (
<>
<Dragger
multiple={false}
onRemove={() => setInputFile([])}
beforeUpload={(file) => {
const isValidFile = ALLOWED_FILE_EXTENSIONS.some((ext) =>
String(file.name).endsWith(ext)
);
if (isValidFile) {
setInputFile([file]);
}
return false;
}}
fileList={inputFile}
>
<p className="ant-upload-drag-icon">
<InboxOutlined />
</p>
<p className="ant-upload-text">
Click or drag file to this area to upload
</p>
</Dragger>
<Button
type="primary"
style={{ marginTop: 16 }}
onClick={() =>
handleUpload({
inputFile: inputFile[0],
})
}
>
{loading ? "Processing" : "Start Upload"}
</Button>
</>
);
};
export default Uploader;
|
import React, {Component} from 'react';
import Chart from 'chart.js';
class ChartUsers extends Component {
componentDidMount() {
var ctx = document.getElementById("ChartUsers");
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Ene", "Feb", "Mar", "Abr", "May", "Jun","Jul","Ago","Sep","Oct","Nov", "Dic"],
datasets: [{
label: '# Usuarios',
data: [4, 6, 7, 3, 12, 16, 11, 4, 7, 12, 32, 13],
backgroundColor: [
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107',
'#ffc107'
],
borderColor: [
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00',
'#f8cb00'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
}
render(){
return(
<canvas id="ChartUsers" width="400" height="100"></canvas>
)
}
}
export default ChartUsers
|
/* 🤖 this file was generated by svg-to-ts*/
export const EOSIconsRemoveFromQueue = {
name: 'remove_from_queue',
data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 3H3c-1.11 0-2 .89-2 2v12a2 2 0 002 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5a2 2 0 00-2-2zm0 14H3V5h18v12zm-5-7v2H8v-2h8z"/></svg>`
};
|
// Instantiate a new graph
var Graph = function() {
this.nodes = {};
this.edges = {};
};
// Add a node to the graph, passing in the node's value.
Graph.prototype.addNode = function(node) {
this.nodes[node] = node;
};
// Return a boolean value indicating if the value passed to contains is represented in the graph.
Graph.prototype.contains = function(node) {
if (this.nodes[node]) {
return true;
} else {
return false;
}
};
// Removes a node from the graph.
Graph.prototype.removeNode = function(node) {
var otherIndex;
var currentNode = this.edges[node];
//added and statement in the if statement to check if the node exist before proceeding with removing
if (currentNode && this.contains(node)) {
var nodeIndex = currentNode.indexOf(node);
nodeIndex === 0 ? otherIndex = 1 : otherIndex = 0;
var otherNode = currentNode.splice(otherIndex, 1);
}
delete this.nodes[node];
delete currentNode;
delete this.edges[otherNode];
};
// Returns a boolean indicating whether two specified nodes are connected. Pass in the values contained in each of the two nodes.
Graph.prototype.hasEdge = function(fromNode, toNode) {
if (this.edges[fromNode]) {
if (this.edges[fromNode].includes(toNode)) {
return true;
} else if (this.edges[toNode] && this.edges[toNode].includes(fromNode)) {
return true;
}
}
return false;
};
// Connects two nodes in a graph by adding an edge between them.
Graph.prototype.addEdge = function(fromNode, toNode) {
this.edges[fromNode] = [fromNode, toNode];
this.edges[toNode] = [toNode, fromNode];
};
// Remove an edge between any two specified (by value) nodes.
Graph.prototype.removeEdge = function(fromNode, toNode) {
if (this.hasEdge(fromNode, toNode)) {
delete this.edges[fromNode];
delete this.edges[toNode];
}
};
// Pass in a callback which will be executed on each node of the graph.
Graph.prototype.forEachNode = function(cb) {
for (var node in this.nodes) {
node = parseInt(node);
cb(node);
}
};
/*
* Complexity: What is the time complexity of the above functions?
** .addNode: O(1)
** .contains: O(1)
** .removeNode: O(n)
** .hasEdge: O(n)
** .addEdge: O(1)
** .removeEdge: O(n)
** .forEachNode: O(n)
*/
|
import { useContext, useState } from 'react'
import { Link,useHistory } from "react-router-dom"
import { motion } from 'framer-motion'
import { Context } from '../../../utils/context'
import api from '../../../utils/api'
import { PageAnimation } from '../../../utils/PageAnimation'
import PasswordInput from '../Components/PasswordInput'
import { LoginValidation } from '../Utils/Validation'
import { SweetError, SweetInfo, SweetWait, SweetWelcome, SweetWrong } from '../../../SweetAlert'
const Login = () => {
const [state, dispatch] = useContext(Context)
const history = useHistory()
const [UserDetails, setUserDetails] = useState({
username:'',
password:''
})
const handleSubmit = async (e) => {
e.preventDefault()
if(LoginValidation(UserDetails)) {
try {
SweetWait()
const res = await api.post('/login',UserDetails)
const { success , info , error ,user,token } = res.data
if(success){
SweetWelcome(success)
dispatch({type:'SET_USER',user,token})
history.push('/orders')
}
else if(info)
SweetInfo(info)
else
SweetError(error)
}catch (error){
SweetWrong()
}
}
}
const handleChange = (e) => {
const {name ,value } = e.target
setUserDetails((prev) => {
return { ...prev,[name]:value }
})
}
return (
<motion.section className="flex justify-center pt-24" initial='in' animate='out' exit='exit'
variants={PageAnimation} transition={{ duration: 0.4 }}>
<div className="w-full max-w-xs">
<form onSubmit={handleSubmit} className="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
<div className="mb-4">
<label className="input-label" htmlFor="username">Email</label>
<input
name="username"
value={UserDetails.username}
onChange={handleChange}
className="input-box"
type="text"
placeholder="Enter your Email" />
</div>
<PasswordInput
value={UserDetails.password}
onChange={handleChange}
/>
<Link className="primary-text align-baseline font-bold text-sm" to="/forgot">
Forgot Password?
</Link>
<button className="btn-primary btn mt-3" type="submit">Log In</button>
<div className="w-full text-center my-4">
<Link className="primary-text align-baseline font-bold text-sm" to="/signup">
Don't have account?
</Link>
</div>
</form>
<p className="text-center text-gray-500 text-xs">©2021 Speedyfood. All rights reserved.</p>
</div>
</motion.section>
)
}
export default Login
|
const fs = require('fs');
let moduleName = process.env.MODULE_NAME;
if (moduleName) {
moduleName = moduleName.trim();
let pascalName = moduleName.substr(0, 1).toLowerCase() + moduleName.substr(1);
let camelName = moduleName.substr(0, 1).toUpperCase() + moduleName.substr(1);
let schemaPath = `${__dirname}/../../../app/dataAccess/schemas/${camelName}Schema.ts`;
let schema = getFileContent(`${__dirname}/schema.tmp`, pascalName, camelName);
let modelDirPath = `${__dirname}/../../../app/model/${pascalName}`;
let modelPath = `${__dirname}/../../../app/model/${pascalName}/${camelName}.ts`;
let model = getFileContent(`${__dirname}/model.tmp`, pascalName, camelName);
let modelCreatePath = `${__dirname}/../../../app/model/${pascalName}/${camelName}Create.ts`;
let modelCreate = getFileContent(`${__dirname}/modelCreate.tmp`, pascalName, camelName);
let modelUpdatePath = `${__dirname}/../../../app/model/${pascalName}/${camelName}Update.ts`;
let modelUpdate = getFileContent(`${__dirname}/modelUpdate.tmp`, pascalName, camelName);
let modelInterfaceDirPath = `${__dirname}/../../../app/model/${pascalName}/interfaces`;
let modelInterfacePath = `${__dirname}/../../../app/model/${pascalName}/interfaces/I${camelName}.ts`;
let modelInterface = getFileContent(`${__dirname}/modelInterface.tmp`, pascalName, camelName);
let repositoryPath = `${__dirname}/../../../app/repository/${camelName}Repository.ts`;
let repository = getFileContent(`${__dirname}/repository.tmp`, pascalName, camelName);
let businessPath = `${__dirname}/../../../app/business/${camelName}Business.ts`;
let business = getFileContent(`${__dirname}/business.tmp`, pascalName, camelName);
let businessInterfacePath = `${__dirname}/../../../app/business/interfaces/I${camelName}Business.ts`;
let businessInterface = getFileContent(`${__dirname}/businessInterface.tmp`, pascalName, camelName);
let controllerPath = `${__dirname}/../../../controllers/${camelName}Controller.ts`;
let controller = getFileContent(`${__dirname}/controller.tmp`, pascalName, camelName);
let initialDataPath = `${__dirname}/../../initialData/${camelName}s.ts`;
let initialData = getFileContent(`${__dirname}/initialData.tmp`, pascalName, camelName);
if (!fs.existsSync(modelDirPath))
fs.mkdirSync(modelDirPath);
if (!fs.existsSync(modelInterfaceDirPath))
fs.mkdirSync(modelInterfaceDirPath);
fs.writeFileSync(schemaPath, schema);
fs.writeFileSync(modelPath, model);
fs.writeFileSync(modelCreatePath, modelCreate);
fs.writeFileSync(modelUpdatePath, modelUpdate);
fs.writeFileSync(modelInterfacePath, modelInterface);
fs.writeFileSync(repositoryPath, repository);
fs.writeFileSync(businessPath, business);
fs.writeFileSync(businessInterfacePath, businessInterface);
fs.writeFileSync(controllerPath, controller);
fs.writeFileSync(initialDataPath, initialData);
}
function getFileContent(path, pascalName, camelName) {
return fs.readFileSync(path, 'utf8').replace(new RegExp('{pascalName}', 'g'), pascalName).replace(new RegExp('{camelName}', 'g'), camelName);
}
|
var util = require('util')
function UnexpectedType (arg) {
// name and message
this.name = this.constructor.name
this.message = util.format('Unexpected type: "%s"', arg.constructor.name)
// V8's stack trace
Error.captureStackTrace && Error.captureStackTrace(this, this.constructor)
}
// inheriting Error
UnexpectedType.prototype = Object.create(Error.prototype)
UnexpectedType.prototype.constructor = UnexpectedType
// here, take it
module.exports = UnexpectedType
|
function brainDump() {
var left = document.getElementById('left');
var containers = $(".brain-dump-category-list").toArray();
containers.push(left)
dragula(containers)
.on('move', function (el, source, handle, sibling) {
if(!el.hasClass("brain-dump-category")) {
return false } else { return true }
}).on('drop', function (el, target, source, sibling) {
var id = $(el).attr('data-id');
var category_id = $(el).closest('ul').attr('data-id');
$.ajax({
type: 'PUT',
url: window.location.origin + '/brain_dumps/' + id,
data: { category_id: category_id }
});
});
}
function progressBar(id, brain_dumps_total, brain_dumps_done) {
$(document).ready(function(){
$('#jqmeter-container_'+id).jQMeter({
goal: brain_dumps_total,
raised: brain_dumps_done,
meterOriengation:'horizontal',
height: '10px;',
bgColor: '#444',
barColor: '#bfd255'
});
});
};
function checkCompletion(category_id) {
var thisItem = $(document).find('li#category_'+category_id);
$(thisItem).removeClass('incomplete').addClass('complete');
$(thisItem).find('a').css('text-decoration','line-through')
}
function progressCircle(value, elem) {
// defaulting to max days of 50, and calculating percentage of it
var percentage = ((50 - parseInt(value)) / 50)
$("#"+elem).circleProgress({
value: percentage,
size: 60,
fill: {
color: "#7B77C9"
}
});
}
|
export const MessageDirection = {
OUTGOING : 'outgoing',
INCOMING : 'incoming'
}
|
/**
* Created by Lorenzo on 03/08/15.
*/
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var enumOrgano = ['TAR Lazio','Consiglio di Stato','Altro'];
var fascicoloSchema = new Schema({
organo:{
type: String,
required: true,
enum: enumOrgano
},
numeroRG:{
type: String,
required: true,
match:/^[0-9]*\/[0-9]{4}$/
},
RUP:{
type: String,
required: true
},
Assegnazione:{
type: String,
require: true
},
Procedura:{
nome:{
type: String,
required: true
},
anno:{
type: String,
required: true,
match: /^[0-9]{4}$/
},
atto:{
type: String,
required: true
},
note:{
type: String,
max: 2000
}
},
Sospensiva:Boolean,
Ricorrente:[
{
nominativo:{
type: String,
required: true
},
recapito:{
type: String,
required: true,
match:/^[0-9]*$/
},
riferimento:{
type: String,
required: true
},
note:{
type: String,
max: 2000
}
}
]
});
fascicoloSchema.path('Ricorrente').validate(function (v) {
return v.length > 0
}, 'Ricorrente è un campo richiesto');
fascicoloSchema.post('save', function(document){
console.log('Documento salvato')
});
module.exports = mongoose.model('Fascicolo',fascicoloSchema,'fascicoli');
|
function onSubmit(){
if(getGrade() !== "please enter percentages that add up too 100") {
document.getElementById("grade").innerHTML = "you have a " + getGrade() + "% in this class, you need a ...";
} else {
document.getElementById("grade").innerHTML = getGrade();
}
}
function getGrade() {
var hw = document.getElementById("hwScores").value;
var hwWeight = parseInt(document.getElementById("hwWeight").value);
var cw = document.getElementById("cwScores").value;
var cwWeight = parseInt(document.getElementById("cwWeight").value);
var test = document.getElementById("testScores").value;
var testWeight = parseInt(document.getElementById("testWeight").value);
var part = document.getElementById("partScores").value;
var partWeight = parseInt(document.getElementById("partWeight").value);
var pro = document.getElementById("proScores").value;
var proWeight = parseInt(document.getElementById("proWeight").value);
var finalWeight = parseInt(document.getElementById("finalWeight").value);
if (finalWeight + hwWeight + cwWeight + testWeight + partWeight + proWeight == 100) {
var hwVar2 = arrSplit(hw);
var cwVar2 = arrSplit(cw);
var testVar2 = arrSplit(test);
var partVar2 = arrSplit(part);
var proVar2 = arrSplit(pro);
var hwAvg = avg(hwVar2);
var cwAvg = avg(cwVar2);
var testAvg = avg(testVar2);
var partAvg = avg(partVar2);
var proAvg = avg(proVar2);
colorRow(1, hwAvg);
colorRow(2, cwAvg);
colorRow(3, testAvg);
colorRow(4, partAvg);
colorRow(5, proAvg);
return calcGrade(hwAvg, hwWeight, cwAvg, cwWeight, testAvg, testWeight, partAvg, partWeight, proAvg, proWeight, finalWeight);
} else {
return "please enter percentages that add up too 100";
}
}
function arrSplit(str){
var arr = str.split(",");
for(i = 0; i < arr.length; i++){
arr[i] = parseInt(arr[i]);
}
return arr;
}
function avg(arr){
var total = 0;
for(i = 0; i < arr.length; i++){
total += arr[i];
}
return total/(arr.length);
}
function fixWeight(weight, finalWeight){
return (weight)/(100-finalWeight);
}
function calcGrade(hwAvg, hwWeight, cwAvg, cwWeight, testAvg, testWeight, partAvg, partWeight, proAvg, proWeight, finalWeight) {
var fixHwWeight = fixWeight(hwWeight, finalWeight);
var fixCwWeight = fixWeight(cwWeight, finalWeight);
var fixTestWeight = fixWeight(testWeight, finalWeight);
var fixPartWeight = fixWeight(partWeight, finalWeight);
var fixProWeight = fixWeight(proWeight, finalWeight);
return Math.round(100*(fixHwWeight * hwAvg + fixCwWeight * cwAvg + fixTestWeight * testAvg + fixPartWeight * partAvg + fixProWeight * proAvg))/100;
}
function onClick(){
var avg = getGrade();
var desGrade = document.getElementById("gradeWanted").value;
var finalWeight = document.getElementById("finalWeight").value;
if((desGrade - (avg * (100-finalWeight)/100))/(finalWeight/100) > 0) {
document.getElementById("finalGrade").innerHTML = "you need a " + Math.round(100*(desGrade - (avg * (100 - finalWeight) / 100)) / (finalWeight / 100))/100 + "% or more too get a " + desGrade + " in this class";
} else {
document.getElementById("finalGrade").innerHTML = "please submit percentages that add up too 100, and make sure that the final percentage isn't zero"
}
}
function reset(){
document.getElementById("grade").innerHTML = "";
document.getElementById("finalGrade").innerHTML = "";
//colors
document.getElementById(1).style.backgroundColor = "#FFFFF0";
document.getElementById(2).style.backgroundColor = "#FFFFF0";
document.getElementById(3).style.backgroundColor = "#FFFFF0";
document.getElementById(4).style.backgroundColor = "#FFFFF0";
document.getElementById(5).style.backgroundColor = "#FFFFF0";
//this is all inputs
var allInputs = document.getElementsByTagName("input");
console.log(allInputs);
for(var i = 0; i<=12; i++){
allInputs[i].value = ""
}
}
function colorRow(row, grade){
if(grade > 100){
document.getElementById(row).style.backgroundColor = "#00FFFF";
}
if(grade >= 90 && grade <= 100){
document.getElementById(row).style.backgroundColor = "#228B22";
}
if(grade < 90 && grade >= 80){
document.getElementById(row).style.backgroundColor = "#7FFF00";
}
if(grade < 80 && grade >= 70){
document.getElementById(row).style.backgroundColor = "#FFD700";
}
if(grade < 70 && grade >= 60){
document.getElementById(row).style.backgroundColor = "#FF8C00";
}
if(grade < 60){
document.getElementById(row).style.backgroundColor = "#FF0000";
}
}
|
import React, { Component } from "react";
import PropTypes from "prop-types";
import classnames from "classnames";
import { Link } from "react-router-dom";
import Moment from "react-moment";
export class DogItem extends Component {
render() {
const { dog } = this.props;
return (
<div className="col s12 m6">
<div
className={classnames(
"card",
{ "light-blue lighten-5": dog.sex === "เพศผู้" },
{ "pink lighten-5": dog.sex === "เพศเมีย" }
)}>
<div className="card-content">
<h4 style={{ marginTop: 0 }}>{dog.name}</h4>
<h6>
<strong>อายุ : </strong>
<Moment from={dog.dateofbirth} ago />
</h6>
<h6>
<strong>สายพันธุ์ : </strong>
{dog.breed}
</h6>
<h6>
<strong>สีหลัก : </strong>
{dog.primarycolor}
</h6>
<h6>
<strong>สีรอง : </strong>
{dog.secondarycolor}
</h6>
</div>
<div className="card-action">
<Link
to={`/dog/${dog._id}`}
className={classnames(
{ "light-blue-text": dog.sex === "เพศผู้" },
{ "pink-text": dog.sex === "เพศเมีย" }
)}>
ข้อมูลวัคซีน
</Link>
</div>
</div>
</div>
);
}
}
DogItem.propTypes = {
dog: PropTypes.object.isRequired
};
export default DogItem;
|
//const webSocketServer = require('./config');
const messageHandler = require('./handler/messageHandler');
const closeHandler = require('./handler/closeHandler');
//const data = require ('../gameData/data');
const sqlUtils = require ('../sql/utils');
const initialize = require ('./initialize');
const Request = require('./Request');
const Account = require('../Account');
const WebSocketServer = new require('ws');
const log = require('./log');
const MSG = require('../constants/messageTypes');
const STATUS = require('../constants/systemStatus');
const webSocketServer = new WebSocketServer.Server({
port: 8082
});
function server(data){
webSocketServer.on('connection', function(ws) {
// let inventoryId = data.createInventory(24);
// let hotBarId = data.createInventory(3);
// let armorInventoryId = data.createInventory(2);
let characterId = null;
let isAutorizated = false;
// sqlUtils.insert('inventories', 'id, size', inventoryId+', 24');
// sqlUtils.insert('characters', 'id, inventoryId, armorInventoryId, hotBarId, activeHotBarCell, isPlayer, column, row, top, left, level, health, strength, viewDistance', characterId+', '+inventoryId+', '+armorInventoryId+', '+hotBarId+', '+null+', 1, 10, 10, 640, 640, 1, 3, 1, 10');
// ws.id = characterId;
// data.clients[characterId] = ws;
console.log("new connection");
ws.on('message', function(message){
if (isAutorizated){
messageHandler(data, message, characterId);
}else{
let json = JSON.parse(message);
log(json.type, message, false, null);
switch (json.type){
case MSG.AUTORIZATION:{
for (let key in data.accounts){
if (data.accounts[key].email===json.request[0]&&data.accounts[key].password===json.request[1]){
console.log("connected " + json.request[0]);
let character = data.accounts[key].getCharacter(data.characters);
if (character === null) break;
if (character.isOnline) {
break;
}
ws.id = parseInt(key);
data.accounts[key].webSocket = ws;
character.isOnline = true;
characterId = character.id;
initialize(data, data.accounts[key].id);
isAutorizated = true;
break;
}
}
if (!isAutorizated)ws.send(JSON.stringify(new Request({type:MSG.SYSTEM_STATUS, request:STATUS.LOGIN_FAILED})));
}
break;
case MSG.REGISTRATION:{
let isExist = false;
for (let key in data.accounts){
if (data.accounts[key].email==json.request[0]){
ws.send(JSON.stringify(new Request({type:MSG.SYSTEM_STATUS, request:STATUS.LOGIN_EXIST})));
isExist = true;
break;
}
}
if (!isExist){
console.log("New registration " + json.request[0]);
let accountId = data.getId('account');
data.accounts[accountId] = new Account(accountId, json.request[0], json.request[1]);
data.createCharacter(accountId, 10, 10);
ws.send(JSON.stringify(new Request({type:MSG.SYSTEM_STATUS, request:STATUS.REG_SUCCESS})));
}
}
break;
case MSG.ISLOGIN_EXIST:{
let isExist = false;
for (let key in data.accounts){
if (data.accounts[key].email===json.request){
ws.send(JSON.stringify(new Request({type:MSG.SYSTEM_STATUS, request:STATUS.LOGIN_NOT_AVAILABLE})));
isExist = true;
break;
}
}
if (!isExist) ws.send(JSON.stringify(new Request({type:MSG.SYSTEM_STATUS, request:STATUS.LOGIN_AVAILABLE})));
}
break;
}
}
});
ws.on('close', function(){
closeHandler(data, ws.id);
})
});
}
module.exports = server;
|
/**
* Linear Search
*
* Given an array and a value, return the first index at which
* the value appears. If the array does not contain the value,
* return -1.
*
* Time complexity: O(n) average and worst cases, O(1) best case
* Space complexity: O(1)
*/
const linearSearch = (arr, val) => {
for (let i = 0; i < arr.length; i++) {
if (arr[i] === val) return i;
}
return -1;
};
module.exports = {
linearSearch
};
|
import Vue from "vue";
import VueCompositionAPI, { ref, reactive } from '@vue/composition-api'
import VueRouter from "vue-router";
import Vuex, { mapState } from "vuex";
import createLogger from "vuex/dist/logger";
import VueMeta from 'vue-meta';
// Vuetify internally imports vue, so we need to include it here.
import Vuetify from "vuetify";
import "vuetify/dist/vuetify.min.css";
import "typeface-roboto";
// Fontawesome is used from vuetify
import "@fortawesome/fontawesome-free/css/all.css";
import "material-design-icons-iconfont/dist/material-design-icons.css";
// Add Vuetify-jsonschema-form
import VJsf from "@koumoul/vjsf";
import "@koumoul/vjsf/dist/main.css";
import "regenerator-runtime/runtime"; // Needed to vjsf file upload support https://github.com/koumoul-dev/vuetify-jsonschema-form/issues/301
// Disable the vue console messages if built with production
Vue.config.productionTip = false;
Vue.use(VueCompositionAPI);
Vue.component("VJsf", VJsf);
Vue.use(VueRouter);
Vue.use(Vuex);
Vue.use(Vuetify);
Vue.use(VueMeta, { keyName: 'head' });
export { ref, reactive, VJsf, VueRouter, Vuex, Vuetify, VueMeta, mapState, createLogger };
export default Vue;
|
/*jslint nomen: true, debug: true, evil: true, vars: true, browser: true,
devel: true */
/*global Backbone: true, _: true, $: true, Autor: true */
var SelectAutoresView = Backbone.View.extend({
el: '#autores_selector_modal',
initialize: function(router){
this.router = router;
this.template = _.template($('#autores_template').html());
this.footerTemplate = _.template($('#modal_footer_template').html());
},
events : {
'click .list-autores .list-group-item' : 'select',
'click #new_autor button.btn': 'addAutor',
'click button.commit-autor': 'commit',
'keydown #search_autor': 'search'
},
setAutores: function(autores){
this.autores = autores;
this.listenTo(this.autores, 'change', this.render);
},
search: function(e){
var term = e.target.value;
if (e.keyCode === 13) {
if (term) {
this.autores.search(term);
} else {
this.autores.clearList();
}
}
},
select: function(e){
this.autores.select(e.target.getAttribute('data'));
},
addAutor: function(e){
e.preventDefault();
console.debug('Add Autor', e);
var autor = new Autor();
var form = document.getElementById('new_autor');
autor.set('fullname', form.fullname.value);
if (autor.isValid(true)) {
autor.save(
null,
{
success: _.bind(this.addAutorSuccess, this)
}
);
} else {
alert('Falto ingresar el nombre del autor');
}
},
addAutorSuccess: function(model){
this.autores.add([model]);
this.autores.select(model.id);
},
render: function(){
console.debug('Rendering Autores Selector', this.autores);
var currentId = null;
if (this.autores.current) {
this.autor = this.autores.current;
currentId = this.autores.current.id;
}
this.$el.
find('.list-autores').
html(
this.template({
autores: this.autores.toJSON(),
currentId: currentId
})
);
this.$('.modal-footer').html(
this.footerTemplate({
currentId: currentId,
commit: 'autor'
})
);
this.$el.modal('show');
},
show: function(){
console.debug('Show Autores Selector');
if (!this.autores.length) {
this.autores.fetch({
success: _.bind(this.render, this)
});
} else {
this.render();
}
},
commit: function(e){
console.debug('Commit Select Autor', e);
var titulos = this.router.titulosCollection;
titulos.current.set({
autor_name: this.autor.get('fullname'),
autor_id: this.autor.id
});
this.router.tituloEditorView.render();
this.$el.modal('hide');
}
});
|
// SVG Dimensions
var svgWidth = 960;
var svgHeight = 500;
var margin = {
top: 20,
right: 40,
bottom: 80,
left: 100
};
// Plot Dimensions
var plotWidth = svgWidth - margin.left - margin.right;
var plotHeight = svgHeight - margin.top - margin.bottom;
// Create SVG wrapper
var svg = d3.select("#scatter")
.append("svg")
.attr("width", svgWidth)
.attr("height", svgHeight);
// Append svg group that contains our chart
var chartGroup = svg.append("g")
.attr("transform", `translate(${margin.left}, ${margin.right})`);
// CSV file path
var censusData = "/assets/data/data.csv"
// read in csv data
d3.csv(censusData).then(function(data) {
// Declare the data as a numeral
data.forEach(function(dataset) {
console.log(dataset);
dataset.smokes = +dataset.smokes;
dataset.age = +dataset.age;
console.log(dataset.smokes);
console.log(dataset.age);
});
// Create Scale for X Coordinate
var xScale = d3.scaleLinear()
.domain([d3.min(data, d => d.age) - 2, d3.max(data, d => d.age) + 2])
.range([0, plotWidth]);
// Create Scale for Y Coordinate
var yScale = d3.scaleLinear()
.domain([d3.min(data, d => d.smokes) - 2, d3.max(data, d => d.smokes) + 2])
.range([plotHeight, 0]);
// Create Axis Functions
var xAxis = d3.axisBottom(xScale);
var yAxis = d3.axisLeft(yScale);
// Append Axis to the chart
chartGroup.append("g")
.attr("transform", `translate(0, ${plotHeight})`)
.call(xAxis);
chartGroup.append("g")
.call(yAxis);
// Add the data points to the chart
var circlesGroup = chartGroup.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("class", "stateCircle")
.attr("cx", d => xScale(d.age))
.attr("cy", d => yScale(d.smokes))
.attr("r", 15)
.attr("opacity", 0.75);
// Add State Abbreviations to the circles
var stateText = chartGroup.selectAll("label")
.data(data)
.enter()
.append("text")
.attr("class", "stateText")
.attr("x", d => xScale(d.age))
.attr("y", d => yScale(d.smokes))
.attr("font-size", 10)
// Text was misaligned, this fixed the issue
.attr("dy", 4)
.text(d => d.abbr);
// Label both of the Axis
chartGroup.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 0 - margin.left + 40)
.attr("x", 0 - (plotHeight / 2))
.attr("dy", "1em")
.attr("class", "aText")
.attr("class", "active")
.text("Percentage of Smokers(%)");
chartGroup.append("text")
.attr("transform", `translate(${plotWidth / 2}, ${plotHeight + margin.top + 30})`)
.attr("class", "aText")
.attr("class", "active")
.text("Age (Median)");
// Initialize tooltip
var toolTip = d3.tip()
.attr("class", "d3-tip")
.html(function(d) {
return (`State: ${d.state}<br>Age (Median): ${d.age}<br>Percentage of Smokers: ${d.smokes}%`)
})
// Create the tooltip in chartGroup
chartGroup.call(toolTip);
// Mouseover event for circle objects
circlesGroup.on("mouseover", function(d) {
toolTip.show(d, this);
})
// Mouseout event for circle objects
.on("mouseout", function(d) {
toolTip.hide(d);
});
// Had to add handlers for text as the previous mouseout event triggers on going on text
// Mouseover event for text
stateText.on("mouseover", function(d) {
toolTip.show(d, this);
})
// Mouseout event for text
.on("mouseout", function(d) {
toolTip.hide(d);
});
});
|
// Taken from the event tickets excercise at https://github.com/ConsenSys-Academy/event-ticket-exercise
const errorString = 'VM Exception while processing transaction: ';
async function tryCatch(promise, reason) {
try {
await promise;
throw null;
} catch (error) {
assert(error, 'Expected a VM exception but did not get one');
assert(
error.message.search(errorString + reason) >= 0,
`Expected an error containing '${errorString}${reason}' but got '${error.message}' instead`,
);
}
}
module.exports = {
async catchRevert(promise) {
await tryCatch(promise, 'revert');
},
async catchOutOfGas(promise) {
await tryCatch(promise, 'out of gas');
},
async catchInvalidJump(promise) {
await tryCatch(promise, 'invalid JUMP');
},
async catchInvalidOpcode(promise) {
await tryCatch(promise, 'invalid opcode');
},
async catchStackOverflow(promise) {
await tryCatch(promise, 'stack overflow');
},
async catchStackUnderflow(promise) {
await tryCatch(promise, 'stack underflow');
},
async catchStaticStateChange(promise) {
await tryCatch(promise, 'static state change');
},
};
|
/**
*
*/
$(document).ready(function() {menu.getMenu(0); menu.getListBody();});
var font = "系统设置";
var valids = ["网站名称", "网址", "优化标题", "关键词", "描述", "最后修改时间", "最后修改人"];
var sizes = [100, 100, 100, 100, 100, 100, 100];
var contents = ["网站名称", "网址", "优化标题", "关键词", "描述", "最后修改时间", "最后修改人"];
var keys = ["websit_name", "internet_address", "title_", "keyword", "description", "last_update_time", "last_update_by"];
|
const app = getApp()
Page({
data: {
date:'2018-7-20',
clothesSelect:[0,0,0,0,0,0,0],
selectImg: '../../image/select1.png',
selectCount:0,
selectAll: 0,
clothes_color: 0,
clothesColor: ['../../image/lv2.png','../../image/lan1.png'],
clothes: ['../../image/w1.png', '../../image/d1.png', '../../image/j1.png', '../../image/y1.png', '../../image/m1.png', '../../image/k1.png', '../../image/q1.png',],
index1: 0,
array1: ['西苑一舍', '西苑二舍', '西苑三舍', '西苑四舍', '西苑五舍', '西苑六舍', '西苑七舍', '西苑八舍', '西苑九舍', '西苑十舍', '西苑十一舍', '西苑十二舍', '西苑十三舍', '西苑十四舍', '西苑十五舍', '西苑十六舍', '西苑十七舍', '西苑十八舍', '西苑十九舍', '西苑二十舍', '西苑二十一舍', '西苑二十二舍',],
index2: 0,
array2: ['一单元', '二单元', '三单元', '四单元', '五单元', '六单元', '七单元', '八单元', '九单元', '十单元', '十一单元', '十二单元'],
index3: 0,
array3: ['101A', '101B', '101C', '102A', '102B', '102C', '201A', '201B', '201C', '202A', '202B', '202C', '301A', '301B', '301C', '302A', '302B', '302C', '401A', '401B', '401C', '402A', '402B', '402C', '501A', '501B', '501C', '502A', '502B', '502C', '601A', '601B', '601C', '602A', '602B', '602C'],
noteImg:'../../image/select1.png',
noteRead:0
},
onLoad: function () {
},
bindDateChange: function (e) {
this.setData({
date: e.detail.value
})
},
bindPickerChange1: function (e) {
this.setData({
index1: e.detail.value
})
},
bindPickerChange2: function (e) {
this.setData({
index2: e.detail.value
})
},
bindPickerChange3: function (e) {
this.setData({
index3: e.detail.value
})
},
selectClothes:function(e){
if (e.target.dataset['index'] == null) return;
var index = e.target.dataset['index']-'0';
var clothes = this.data.clothesSelect;
var clothesSrc = this.data.clothes;
var count = this.data.selectCount;
if (clothes[index]){
clothes[index] = 0;
clothesSrc[index] = clothesSrc[index].replace("2","1");
count--;
}else{
clothes[index] = 1;
clothesSrc[index] = clothesSrc[index].replace("1", "2");
count++;
}
var b = false;
for (var i = 0; i < 7; i++) {
if (clothes[i] == 0) b = true;
}
this.setData({
clothesSelect: clothes,
clothes: clothesSrc,
selectCount: count,
selectImg: !b ? '../../image/select2.png' : '../../image/select1.png',
selectAll: b ? 0 : 1
})
},
selectAllClothes:function(e){
var index = this.data.selectAll;
var clothes = this.data.clothesSelect;
var clothesSrc = this.data.clothes;
index = index==1?0:1;
for(var i = 0;i < 7;i++){
if(index){
clothes[i] = 1;
clothesSrc[i] = clothesSrc[i].replace("1", "2");
}else{
clothes[i] = 0;
clothesSrc[i] = clothesSrc[i].replace("2", "1");
}
}
this.setData({
selectCount: index == 1?7:0,
selectAll: index,
clothesSelect: clothes,
clothes: clothesSrc,
selectImg: index==1?'../../image/select2.png':'../../image/select1.png'
})
},
selectColor: function(){
var index = this.data.clothes_color;
index = index==1?0:1;
this.setData({
clothes_color:index,
clothesColor: index == 1 ? ['../../image/lv1.png', '../../image/lan2.png'] : ['../../image/lv2.png', '../../image/lan1.png']
})
},
noteSelect: function(){
var img = this.data.noteImg;
var index = this.data.noteRead;
index = index == 1 ? 0 : 1;
if (img.search("1")!=-1){
img = img.replace("1", "2");
}
else
img = img.replace("2", "1");
this.setData({
noteImg:img,
noteRead: index
})
},
showNote:function(){
console.log(1);
wx.showModal({
title: '捐赠须知',
content: '感谢你的支持',
showCancel: false,
})
},
formSubmit: function(e){
var stu_id = e.detail.value['stu_id'];
var phone = e.detail.value['stu_phone'];
var date = this.data.date;
var address = this.data.array1[this.data.index1] + this.data.array2[this.data.index2] + this.data.array3[this.data.index3];
var color = this.data.clothes_color==0?'绿':'蓝';
var gender = this.data.clothes_color == 0 ? '男' : '女';
var selectClothes = this.data.clothesSelect;
var b1 = false, b2 = false, b3 = false, b4 = true;
var content;
if(stu_id.length < 13){
b1 = true;
content = '输入学号有误';
}
else if(phone < 11){
b2 = true;
content = '输入电话有误';
}
else {
for(var i = 0;i < 7;i++){
if (this.data.clothesSelect[i] == 1){
b4 = false;
}
}
if(b4){
content = '请至少选择一种物品捐赠';
}
}
if(this.data.noteRead == 0) {
b3 = true;
if(!b1 && !b2 && !b4)
content = '请先勾选捐赠须知';
}
if(b1||b2||b3||b4){
wx.showModal({
title: '',
content: content,
showCancel: false,
success: function (res) {
}
})
}
else{
console.log(this.data.clothesSelect[0]);
wx.request({
url: 'https://lightingx.top/donate',
method: 'POST',
data:{
stu_id:stu_id,
phone:phone,
address:address,
date:date,
color:color,
gender:gender,
coat: this.data.clothesSelect[0],
shirt: this.data.clothesSelect[1],
shoe: this.data.clothesSelect[2],
belt: this.data.clothesSelect[3],
cap: this.data.clothesSelect[4],
trouser: this.data.clothesSelect[5],
glove: this.data.clothesSelect[6],
},
success: function(res){
wx.showModal({
title: '',
content: '捐赠成功,感谢你的支持',
showCancel: false,
})
},
fail: function(){
wx.showModal({
title: '',
content: '捐赠失败,请再试一次或联系工作人员',
showCancel: false,
})
}
})
}
}
})
|
import * as types from 'kitsu/store/types';
const initialState = {};
export const usersReducer = (state = initialState, action) => {
switch (action.type) {
case types.CAPTURE_USERS_DATA: {
const users = {};
action.payload.filter(u => u.type !== 'user').map(u => (users[u.id] = u));
return {
...state,
...users,
};
}
case types.USER_FOLLOW_SUCCESS: {
const { id } = action.payload;
state[id] = { ...state[id], following: true };
return {
...state,
};
}
default:
return state;
}
};
|
window.LGMaps.maps.algeria = {
"config": {
"mapWidth": 700.400,
"mapHeight": 678.200,
"displayAbbreviations": false,
"defaultText": "<h1>Algeria</h1><br /><p>Algeria is a North African country with a Mediterranean coastline and a Saharan desert interior. Many empires have left legacies here, such as the ancient Roman ruins in seaside Tipaza. In the capital, Algiers, Ottoman landmarks like circa-1612 Ketchaoua Mosque line the hillside Casbah quarter, with its narrow alleys and stairways. The city’s Neo-Byzantine basilica Notre Dame d’Afrique dates to French colonial rule.</p>"
},
"paths": [
{
"enable": true,
"name": "Mila",
"abbreviation": "ML",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Mila</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M497.4,34.9 L494.1,37.1 L493.9,40.2 L486.8,43.6 L486.6,45.2 L484.1,45.6 L481.3,44.8 L481.3,39.5 L477.6,32.2 L477.6,26.8 L474.3,25.0 L473.3,21.1 L478.4,21.4 L481.3,19.1 L487.2,19.7 L490.0,18.0 L495.0,19.5 L496.4,19.6 L495.5,25.4 L492.0,26.4 L497.6,33.5 Z"
},
{
"enable": true,
"name": "Oum el Bouaghi",
"abbreviation": "OB",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Oum el Bouaghi</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M486.6,45.2 L486.8,43.6 L493.9,40.2 L494.1,37.1 L497.4,34.9 L499.1,36.9 L505.5,33.7 L509.0,36.7 L512.3,34.7 L514.6,38.9 L518.5,35.1 L521.9,35.4 L523.4,40.0 L529.7,45.8 L532.1,46.0 L535.5,42.0 L538.8,44.6 L537.8,49.2 L538.5,53.8 L529.8,60.5 L527.4,57.4 L521.7,54.7 L517.4,54.6 L514.5,56.3 L512.6,54.3 L507.5,54.8 L505.7,52.7 L501.9,48.6 L497.0,49.3 L496.6,47.1 L492.7,45.6 Z"
},
{
"enable": true,
"name": "Souk Ahras",
"abbreviation": "SA",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Souk Ahras</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M538.8,44.6 L535.5,42.0 L532.1,46.0 L529.7,45.8 L523.4,40.0 L521.9,35.4 L524.4,33.2 L536.9,27.6 L535.6,23.2 L541.3,21.1 L542.1,23.7 L546.8,20.5 L552.3,21.8 L551.5,29.5 L552.0,33.2 L550.9,39.8 L548.7,38.7 L542.8,40.2 Z"
},
{
"enable": true,
"name": "Tébessa",
"abbreviation": "TB",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tébessa</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M529.8,60.5 L538.5,53.8 L537.8,49.2 L538.8,44.6 L542.8,40.2 L548.7,38.7 L550.9,39.8 L550.3,45.2 L553.2,51.6 L553.9,57.0 L552.7,61.0 L553.7,65.2 L557.3,66.8 L554.0,72.2 L552.4,79.8 L553.3,84.9 L552.5,89.3 L548.3,94.0 L540.4,98.7 L538.9,104.5 L534.6,107.0 L531.9,110.3 L525.3,110.8 L519.2,109.1 L521.2,104.0 L522.9,94.7 L526.5,87.6 L525.0,78.7 L520.6,80.0 L525.5,73.1 L526.2,62.5 Z"
},
{
"enable": true,
"name": "Illizi",
"abbreviation": "IL",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Illizi</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M597.9,260.4 L604.2,268.3 L608.5,275.4 L614.7,293.0 L616.3,305.8 L614.9,325.3 L621.1,340.1 L618.0,353.8 L615.1,362.0 L619.3,375.7 L622.4,378.4 L622.3,385.6 L620.5,391.3 L608.9,397.6 L605.7,404.6 L606.6,406.7 L627.3,432.6 L629.3,437.2 L630.4,452.6 L636.2,456.3 L638.8,462.7 L643.5,466.1 L654.6,462.8 L682.2,470.1 L684.4,471.8 L689.9,481.5 L586.7,486.7 L579.8,478.5 L575.4,478.3 L565.1,474.5 L560.3,474.1 L548.8,465.9 L538.1,462.3 L531.2,455.3 L529.6,447.3 L532.3,440.6 L526.1,432.8 L524.6,423.2 L516.2,421.1 L509.5,417.9 L502.2,408.6 L497.8,406.3 L498.0,402.4 L500.6,395.7 L498.3,390.3 L489.6,382.9 L484.7,365.9 L486.4,360.8 L499.0,348.9 L509.1,344.1 L507.0,336.6 L488.2,322.1 L503.4,312.7 L515.3,307.2 L527.1,307.9 Z"
},
{
"enable": true,
"name": "Aïn Témouchent",
"abbreviation": "AT",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Aïn Témouchent</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M257.3,65.5 L260.3,63.0 L263.0,56.5 L265.6,54.5 L270.0,61.6 L276.6,60.2 L279.7,62.6 L278.6,65.9 L271.7,69.0 L271.9,71.4 L268.0,74.7 L259.9,70.3 L258.0,70.5 Z"
},
{
"enable": true,
"name": "Oran",
"abbreviation": "OR",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Oran</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M278.6,65.9 L279.7,62.6 L276.6,60.2 L270.0,61.6 L265.6,54.5 L267.9,52.4 L274.4,49.4 L278.7,51.5 L283.6,49.4 L285.1,45.3 L289.1,44.8 L291.7,48.2 L296.1,49.4 L296.1,49.6 L286.9,57.2 L282.4,63.1 L280.6,66.4 Z"
},
{
"enable": true,
"name": "Sidi Bel Abbès",
"abbreviation": "SB",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Sidi Bel Abbès</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M268.0,74.7 L271.9,71.4 L271.7,69.0 L278.6,65.9 L280.6,66.4 L282.4,63.1 L284.3,64.5 L292.7,67.2 L292.2,71.4 L293.7,74.3 L291.0,75.5 L289.8,82.6 L287.3,83.7 L291.9,87.3 L296.6,94.4 L295.9,96.5 L282.7,107.3 L278.8,104.1 L271.8,107.5 L263.1,105.0 L270.3,98.5 L270.3,95.6 L274.8,89.3 L270.7,87.0 L271.1,83.9 L268.8,80.9 L270.0,76.1 Z"
},
{
"enable": true,
"name": "Tlemcen",
"abbreviation": "TL",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tlemcen</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M268.0,74.7 L270.0,76.1 L268.8,80.9 L271.1,83.9 L270.7,87.0 L274.8,89.3 L270.3,95.6 L270.3,98.5 L263.1,105.0 L259.2,107.2 L251.8,107.6 L245.7,111.0 L243.7,103.5 L241.9,100.3 L245.4,96.4 L240.4,91.8 L243.8,86.6 L231.2,76.1 L230.5,72.9 L235.7,73.7 L244.7,72.1 L252.7,66.2 L257.3,65.5 L258.0,70.5 L259.9,70.3 Z"
},
{
"enable": true,
"name": "Tindouf",
"abbreviation": "TN",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tindouf</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M97.1,424.9 L0.0,349.8 L5.1,297.7 L6.4,295.6 L14.5,291.6 L15.9,289.7 L26.9,284.1 L42.9,273.9 L51.7,274.9 L58.8,270.7 L65.0,271.3 L70.6,274.1 L73.6,271.8 L87.8,270.5 L96.7,271.3 L117.2,324.5 L168.3,314.2 L191.4,366.6 L97.5,424.5 Z"
},
{
"enable": true,
"name": "Béchar",
"abbreviation": "BC",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Béchar</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M168.3,314.2 L117.2,324.5 L96.7,271.3 L104.8,270.6 L105.7,274.1 L111.7,274.5 L115.5,270.3 L121.4,261.5 L124.8,258.3 L135.2,251.4 L143.6,248.1 L148.4,244.7 L152.3,240.2 L159.6,237.8 L170.1,236.9 L176.4,234.1 L176.2,229.4 L179.8,225.1 L177.5,219.7 L174.1,216.3 L171.5,217.6 L172.1,211.0 L177.0,208.7 L178.0,199.0 L192.3,197.2 L204.9,195.1 L201.9,185.4 L215.5,183.0 L255.8,186.7 L257.1,183.9 L254.1,184.0 L255.2,181.1 L262.3,180.9 L266.3,186.1 L268.7,186.1 L294.5,178.8 L282.0,212.0 L282.9,215.5 L289.6,223.6 L307.0,239.6 L286.7,275.1 L265.3,302.0 L260.9,305.0 L230.5,309.3 L222.5,312.8 L207.0,323.2 L198.8,326.0 L191.9,324.3 L174.8,314.0 Z"
},
{
"enable": true,
"name": "Naâma",
"abbreviation": "NA",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Naâma</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M294.5,178.8 L268.7,186.1 L266.3,186.1 L262.3,180.9 L255.2,181.1 L257.2,175.1 L260.3,174.3 L262.8,170.7 L251.3,161.8 L247.3,154.4 L249.4,149.8 L244.2,142.9 L244.1,138.0 L246.6,132.4 L245.2,127.7 L242.8,126.0 L244.2,122.9 L243.9,118.2 L245.7,111.0 L251.8,107.6 L259.2,107.2 L263.1,105.0 L271.8,107.5 L278.8,104.1 L282.7,107.3 L282.5,110.0 L286.6,119.0 L290.5,114.1 L295.1,113.2 L295.8,116.8 L300.3,114.6 L298.6,130.5 L299.0,139.7 L295.5,153.7 L296.1,160.5 L292.9,168.9 L295.7,172.9 Z"
},
{
"enable": true,
"name": "Adrar",
"abbreviation": "AR",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Adrar</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M168.3,314.2 L174.8,314.0 L191.9,324.3 L198.8,326.0 L207.0,323.2 L222.5,312.8 L230.5,309.3 L260.9,305.0 L265.3,302.0 L286.7,275.1 L307.0,239.6 L318.5,227.9 L327.8,221.6 L361.7,205.0 L361.0,234.8 L356.6,263.3 L360.7,302.8 L362.3,323.2 L361.8,330.7 L359.9,338.8 L355.4,385.9 L349.4,393.3 L344.6,394.4 L341.6,398.3 L336.9,400.0 L326.0,400.2 L317.7,405.6 L326.2,416.7 L327.2,427.2 L333.6,432.9 L331.9,554.9 L334.2,558.4 L410.9,603.7 L417.2,610.8 L418.3,619.3 L418.8,674.8 L401.8,677.8 L394.5,671.4 L399.7,663.5 L397.8,655.0 L398.5,647.5 L388.9,642.0 L373.1,639.1 L369.7,637.7 L365.5,631.7 L362.1,629.4 L358.2,631.8 L351.9,631.1 L343.4,624.3 L343.2,620.2 L338.9,616.6 L333.5,615.1 L331.1,612.2 L326.6,612.2 L327.2,602.4 L326.0,598.4 L134.6,453.7 L97.1,424.9 L97.5,424.5 L191.4,366.6 Z"
},
{
"enable": true,
"name": "Annaba",
"abbreviation": "AN",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Annaba</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M518.5,0.0 L525.3,0.5 L528.4,2.8 L534.7,2.3 L534.1,6.2 L533.8,10.2 L530.8,14.9 L528.3,16.9 L522.7,12.9 L521.8,7.1 L520.0,5.4 Z"
},
{
"enable": true,
"name": "El Tarf",
"abbreviation": "ET",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>El Tarf</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M530.8,14.9 L533.8,10.2 L534.1,6.2 L538.2,7.5 L542.4,6.3 L547.8,3.0 L555.8,4.5 L558.9,3.0 L560.3,6.3 L553.4,9.8 L555.1,11.0 L553.7,14.5 L546.7,19.2 L546.8,20.5 L542.1,23.7 L541.3,21.1 L535.0,18.0 Z"
},
{
"enable": true,
"name": "Jijel",
"abbreviation": "JJ",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Jijel</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M463.9,17.3 L468.3,13.6 L473.7,10.7 L482.0,9.7 L488.2,6.5 L492.0,13.6 L495.5,16.5 L495.0,19.5 L490.0,18.0 L487.2,19.7 L481.3,19.1 L478.4,21.4 L473.3,21.1 L467.9,22.5 L465.4,20.0 L464.1,19.4 Z"
},
{
"enable": true,
"name": "Skikda",
"abbreviation": "SK",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Skikda</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M496.4,19.6 L495.0,19.5 L495.5,16.5 L492.0,13.6 L488.2,6.5 L490.8,1.4 L494.5,0.3 L498.2,4.1 L505.4,5.2 L508.2,7.3 L515.6,6.2 L518.5,0.0 L520.0,5.4 L521.8,7.1 L522.7,12.9 L520.4,16.0 L515.1,18.5 L513.8,21.7 L509.7,24.5 L506.2,23.6 L509.0,19.8 L504.7,20.0 L500.9,18.3 Z"
},
{
"enable": true,
"name": "El Bayadh",
"abbreviation": "EB",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>El Bayadh</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M361.7,205.0 L327.8,221.6 L318.5,227.9 L307.0,239.6 L289.6,223.6 L282.9,215.5 L282.0,212.0 L294.5,178.8 L295.7,172.9 L292.9,168.9 L296.1,160.5 L295.5,153.7 L299.0,139.7 L298.6,130.5 L300.3,114.6 L305.4,108.0 L308.4,107.9 L319.6,101.1 L321.5,100.6 L329.9,104.5 L330.0,110.1 L336.6,110.4 L339.2,114.7 L340.8,118.2 L344.9,120.7 L352.2,123.4 L360.2,136.3 L360.7,139.1 L358.7,144.0 L361.9,152.1 L364.9,155.9 L368.5,166.3 L368.6,178.2 L370.0,187.4 L366.3,194.1 L366.6,200.8 Z"
},
{
"enable": true,
"name": "Tamanghasset",
"abbreviation": "TM",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tamanghasset</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M488.2,322.1 L507.0,336.6 L509.1,344.1 L499.0,348.9 L486.4,360.8 L484.7,365.9 L489.6,382.9 L498.3,390.3 L500.6,395.7 L498.0,402.4 L497.8,406.3 L502.2,408.6 L509.5,417.9 L516.2,421.1 L524.6,423.2 L526.1,432.8 L532.3,440.6 L529.6,447.3 L531.2,455.3 L538.1,462.3 L548.8,465.9 L560.3,474.1 L565.1,474.5 L575.4,478.3 L579.8,478.5 L586.7,486.7 L689.9,481.5 L700.0,499.1 L548.0,605.1 L530.8,620.9 L491.1,658.4 L488.1,660.2 L418.8,674.8 L418.3,619.3 L417.2,610.8 L410.9,603.7 L334.2,558.4 L331.9,554.9 L333.6,432.9 L327.2,427.2 L326.2,416.7 L317.7,405.6 L326.0,400.2 L336.9,400.0 L341.6,398.3 L344.6,394.4 L349.4,393.3 L355.4,385.9 L359.9,338.8 L361.8,330.7 L362.3,323.2 L360.7,302.8 L390.4,299.7 L417.7,321.2 L448.6,324.0 Z"
},
{
"enable": true,
"name": "Ghardaïa",
"abbreviation": "GR",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Ghardaïa</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M390.4,299.7 L360.7,302.8 L356.6,263.3 L361.0,234.8 L361.7,205.0 L366.6,200.8 L366.3,194.1 L370.0,187.4 L368.6,178.2 L368.5,166.3 L379.8,164.3 L387.3,162.1 L394.0,161.4 L399.2,163.2 L404.3,159.7 L414.0,155.1 L418.7,155.6 L427.8,153.7 L453.2,160.4 L445.8,172.1 L439.7,178.0 L435.2,181.0 L432.8,184.7 L426.3,200.0 L424.4,208.9 L416.9,267.3 L414.3,272.0 L406.5,280.5 L403.8,290.7 L402.1,292.9 Z"
},
{
"enable": true,
"name": "Laghouat",
"abbreviation": "LG",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Laghouat</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M427.8,153.7 L418.7,155.6 L414.0,155.1 L404.3,159.7 L399.2,163.2 L394.0,161.4 L387.3,162.1 L379.8,164.3 L368.5,166.3 L364.9,155.9 L361.9,152.1 L358.7,144.0 L360.7,139.1 L360.2,136.3 L352.2,123.4 L344.9,120.7 L340.8,118.2 L339.2,114.7 L348.7,107.9 L351.1,103.5 L354.8,100.2 L359.4,98.6 L367.4,92.3 L371.0,91.8 L369.5,96.6 L369.3,102.3 L374.8,113.4 L375.0,120.8 L379.7,120.9 L380.5,113.8 L385.5,112.2 L388.8,108.2 L394.1,109.2 L395.8,115.8 L398.1,119.7 L410.9,133.9 L423.1,144.4 Z"
},
{
"enable": true,
"name": "Ouargla",
"abbreviation": "OG",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Ouargla</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M488.2,322.1 L448.6,324.0 L417.7,321.2 L390.4,299.7 L402.1,292.9 L403.8,290.7 L406.5,280.5 L414.3,272.0 L416.9,267.3 L424.4,208.9 L426.3,200.0 L432.8,184.7 L435.2,181.0 L439.7,178.0 L445.8,172.1 L453.2,160.4 L452.1,145.5 L453.7,138.0 L490.9,139.5 L496.8,141.5 L499.7,147.4 L507.4,171.3 L513.0,181.3 L519.0,188.0 L528.1,189.6 L583.8,187.0 L602.3,252.4 L595.0,257.0 L597.9,260.4 L527.1,307.9 L515.3,307.2 L503.4,312.7 Z"
},
{
"enable": true,
"name": "Alger",
"abbreviation": "AL",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Alger</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M390.4,12.6 L393.9,15.0 L396.1,15.3 L396.1,15.4 L397.8,17.5 L393.8,18.8 L391.6,16.5 L389.8,15.1 Z"
},
{
"enable": true,
"name": "Boumerdès",
"abbreviation": "BM",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Boumerdès</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M397.8,17.5 L396.1,15.4 L396.1,15.3 L398.0,12.7 L404.7,14.1 L410.4,12.2 L415.7,8.8 L422.0,9.4 L418.9,14.2 L418.5,17.9 L413.3,18.5 L412.9,20.3 L410.2,20.6 L411.2,17.6 L405.2,17.3 L402.0,16.5 Z"
},
{
"enable": true,
"name": "Tizi Ouzou",
"abbreviation": "TO",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tizi Ouzou</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M412.9,20.3 L413.3,18.5 L418.5,17.9 L418.9,14.2 L422.0,9.4 L424.0,9.9 L434.1,8.7 L438.6,9.2 L440.2,12.3 L436.9,21.5 L432.2,25.1 L419.1,25.2 Z"
},
{
"enable": true,
"name": "Tipaza",
"abbreviation": "TP",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tipaza</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M351.0,24.2 L351.7,22.4 L362.5,21.6 L372.0,19.3 L374.5,21.0 L379.8,20.4 L390.4,12.6 L389.8,15.1 L391.6,16.5 L389.7,19.2 L386.2,19.1 L375.0,27.3 L364.3,26.6 L360.8,27.6 L354.9,26.7 L351.8,29.1 L350.0,26.2 Z"
},
{
"enable": true,
"name": "Aïn Defla",
"abbreviation": "AD",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Aïn Defla</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M350.0,26.2 L351.8,29.1 L354.9,26.7 L360.8,27.6 L364.3,26.6 L375.0,27.3 L376.4,29.4 L380.6,29.5 L375.3,34.0 L376.7,35.9 L380.0,35.6 L377.9,39.3 L374.7,41.3 L369.9,47.9 L366.4,46.3 L360.7,46.0 L356.0,48.1 L351.7,45.7 L352.0,44.1 L348.1,36.6 L349.3,35.7 L347.3,28.5 Z"
},
{
"enable": true,
"name": "Chlef",
"abbreviation": "CH",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Chlef</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M350.0,26.2 L347.3,28.5 L349.3,35.7 L348.1,36.6 L352.0,44.1 L351.7,45.7 L346.8,42.6 L342.5,48.6 L338.6,43.7 L335.4,44.6 L327.8,39.9 L327.2,35.0 L321.3,35.3 L322.4,31.6 L322.6,29.6 L326.4,28.2 L331.9,24.3 L339.2,23.1 L351.7,22.4 L351.0,24.2 Z"
},
{
"enable": true,
"name": "Mascara",
"abbreviation": "MC",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Mascara</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M293.7,74.3 L292.2,71.4 L292.7,67.2 L284.3,64.5 L282.4,63.1 L286.9,57.2 L296.1,49.6 L298.6,52.4 L302.7,50.8 L304.2,53.7 L306.4,53.2 L309.0,58.5 L313.2,58.6 L315.5,60.4 L324.5,63.1 L326.0,65.3 L323.6,68.8 L317.9,69.2 L313.9,76.2 L305.1,78.4 L302.2,75.5 L298.3,76.6 L295.2,73.0 Z"
},
{
"enable": true,
"name": "Mostaganem",
"abbreviation": "MG",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Mostaganem</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M306.4,53.2 L304.2,53.7 L302.7,50.8 L298.6,52.4 L296.1,49.6 L296.1,49.4 L300.7,46.8 L303.7,39.9 L320.2,29.8 L322.6,29.6 L322.4,31.6 L321.3,35.3 L313.5,43.8 L312.8,48.2 Z"
},
{
"enable": true,
"name": "Relizane",
"abbreviation": "RE",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Relizane</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M324.5,63.1 L315.5,60.4 L313.2,58.6 L309.0,58.5 L306.4,53.2 L312.8,48.2 L313.5,43.8 L321.3,35.3 L327.2,35.0 L327.8,39.9 L335.4,44.6 L338.6,43.7 L342.5,48.6 L338.0,51.9 L337.4,55.7 L328.6,59.3 Z"
},
{
"enable": true,
"name": "Saïda",
"abbreviation": "SD",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Saïda</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M321.5,100.6 L319.6,101.1 L308.4,107.9 L305.4,108.0 L300.3,114.6 L295.8,116.8 L295.1,113.2 L290.5,114.1 L286.6,119.0 L282.5,110.0 L282.7,107.3 L295.9,96.5 L296.6,94.4 L291.9,87.3 L287.3,83.7 L289.8,82.6 L291.0,75.5 L293.7,74.3 L295.2,73.0 L298.3,76.6 L302.2,75.5 L305.1,78.4 L313.9,76.2 L318.0,75.9 L321.8,79.3 L322.4,82.1 L319.1,85.0 L319.7,89.4 L324.6,98.3 Z"
},
{
"enable": true,
"name": "Tiaret",
"abbreviation": "TR",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tiaret</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M371.0,91.8 L367.4,92.3 L359.4,98.6 L354.8,100.2 L351.1,103.5 L348.7,107.9 L339.2,114.7 L336.6,110.4 L330.0,110.1 L329.9,104.5 L321.5,100.6 L324.6,98.3 L319.7,89.4 L319.1,85.0 L322.4,82.1 L321.8,79.3 L318.0,75.9 L313.9,76.2 L317.9,69.2 L323.6,68.8 L326.0,65.3 L324.5,63.1 L328.6,59.3 L337.4,55.7 L340.5,54.2 L349.2,59.6 L361.9,58.8 L368.0,59.4 L369.0,63.9 L369.0,68.0 L372.1,72.9 L378.7,78.3 L376.2,80.4 L371.4,88.7 Z"
},
{
"enable": true,
"name": "Tissemsilt",
"abbreviation": "TS",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Tissemsilt</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M351.7,45.7 L356.0,48.1 L360.7,46.0 L366.4,46.3 L369.9,47.9 L367.8,52.5 L365.2,54.2 L368.0,59.4 L361.9,58.8 L349.2,59.6 L340.5,54.2 L337.4,55.7 L338.0,51.9 L342.5,48.6 L346.8,42.6 Z"
},
{
"enable": true,
"name": "Béjaïa",
"abbreviation": "BJ",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Béjaïa</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M432.2,25.1 L436.9,21.5 L440.2,12.3 L438.6,9.2 L444.5,9.1 L454.1,13.2 L453.5,15.0 L458.1,18.0 L463.9,17.3 L464.1,19.4 L465.4,20.0 L465.1,23.3 L461.1,25.4 L460.4,27.7 L456.9,27.1 L457.0,22.9 L453.4,20.9 L449.6,23.8 L448.5,28.2 L445.2,28.4 L444.2,26.7 L440.1,30.3 L439.9,33.4 L433.5,33.8 L431.8,30.1 L433.2,26.8 Z"
},
{
"enable": true,
"name": "Bordj Bou Arréridj",
"abbreviation": "BB",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Bordj Bou Arréridj</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M431.8,30.1 L433.5,33.8 L439.9,33.4 L440.1,30.3 L444.2,26.7 L445.2,28.4 L445.9,31.1 L453.2,31.1 L457.0,33.1 L458.8,36.5 L455.8,44.8 L455.9,47.7 L453.4,50.7 L447.2,47.3 L439.5,49.3 L434.9,48.4 L437.5,45.0 L436.4,41.7 L433.5,43.0 L423.7,41.8 L426.9,36.2 Z"
},
{
"enable": true,
"name": "Blida",
"abbreviation": "BL",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Blida</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M380.6,29.5 L376.4,29.4 L375.0,27.3 L386.2,19.1 L389.7,19.2 L391.6,16.5 L393.8,18.8 L397.8,17.5 L402.0,16.5 L405.2,17.3 L406.2,19.7 L401.0,22.3 L399.4,24.7 L390.7,29.9 L388.1,27.5 L386.2,29.3 Z"
},
{
"enable": true,
"name": "Bouira",
"abbreviation": "BU",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Bouira</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M412.9,20.3 L419.1,25.2 L432.2,25.1 L433.2,26.8 L431.8,30.1 L426.9,36.2 L423.7,41.8 L421.9,47.9 L416.7,48.1 L413.2,45.6 L409.9,45.9 L408.4,43.0 L407.8,27.6 L404.0,27.9 L399.4,24.7 L401.0,22.3 L406.2,19.7 L405.2,17.3 L411.2,17.6 L410.2,20.6 Z"
},
{
"enable": true,
"name": "El Oued",
"abbreviation": "EO",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>El Oued</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M519.2,109.1 L525.3,110.8 L531.9,110.3 L530.4,118.6 L533.0,127.3 L537.8,134.8 L540.0,143.9 L550.8,147.7 L557.4,157.0 L559.1,167.3 L564.5,171.7 L582.2,183.1 L583.8,187.0 L528.1,189.6 L519.0,188.0 L513.0,181.3 L507.4,171.3 L499.7,147.4 L496.8,141.5 L490.9,139.5 L453.7,138.0 L457.2,133.0 L463.6,122.7 L464.6,114.7 L464.1,110.7 L458.5,103.7 L462.5,98.3 L467.5,100.0 L483.7,101.6 L489.7,100.2 L495.2,101.3 L499.5,103.9 L505.3,101.6 L506.9,104.4 L513.8,108.1 Z"
},
{
"enable": true,
"name": "Biskra",
"abbreviation": "BS",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Biskra</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M505.3,101.6 L499.5,103.9 L495.2,101.3 L489.7,100.2 L483.7,101.6 L467.5,100.0 L462.5,98.3 L458.5,103.7 L464.1,110.7 L464.6,114.7 L463.6,122.7 L457.2,133.0 L434.6,120.1 L432.6,118.3 L431.2,112.4 L428.5,108.8 L431.6,108.4 L428.9,103.4 L427.8,97.9 L435.1,88.6 L450.4,85.8 L453.6,82.8 L453.4,76.6 L461.7,78.8 L470.9,75.7 L469.2,72.2 L477.2,68.4 L482.9,70.6 L480.8,73.7 L482.8,79.4 L484.9,76.8 L486.9,78.9 L495.6,76.0 L497.1,77.3 L496.5,83.4 L498.7,86.6 L501.4,86.7 L505.7,86.6 L506.5,89.0 Z"
},
{
"enable": true,
"name": "Djelfa",
"abbreviation": "DJ",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Djelfa</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M428.5,108.8 L431.2,112.4 L432.6,118.3 L434.6,120.1 L457.2,133.0 L453.7,138.0 L452.1,145.5 L453.2,160.4 L427.8,153.7 L423.1,144.4 L410.9,133.9 L398.1,119.7 L395.8,115.8 L394.1,109.2 L388.8,108.2 L385.5,112.2 L380.5,113.8 L379.7,120.9 L375.0,120.8 L374.8,113.4 L369.3,102.3 L369.5,96.6 L371.0,91.8 L371.4,88.7 L376.2,80.4 L378.7,78.3 L372.1,72.9 L369.0,68.0 L369.0,63.9 L376.4,61.6 L379.8,63.9 L387.8,56.9 L387.3,51.2 L390.7,50.8 L393.3,55.3 L397.2,54.1 L399.2,50.7 L402.4,52.3 L404.6,55.8 L411.6,61.8 L410.9,69.7 L405.4,74.5 L411.5,88.2 L418.8,89.1 L423.0,103.7 Z"
},
{
"enable": true,
"name": "Médéa",
"abbreviation": "MD",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Médéa</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M402.4,52.3 L399.2,50.7 L397.2,54.1 L393.3,55.3 L390.7,50.8 L387.3,51.2 L387.8,56.9 L379.8,63.9 L376.4,61.6 L369.0,63.9 L368.0,59.4 L365.2,54.2 L367.8,52.5 L369.9,47.9 L374.7,41.3 L377.9,39.3 L380.0,35.6 L376.7,35.9 L375.3,34.0 L380.6,29.5 L386.2,29.3 L388.1,27.5 L390.7,29.9 L399.4,24.7 L404.0,27.9 L407.8,27.6 L408.4,43.0 L409.9,45.9 L407.3,50.3 L407.4,55.2 L404.0,50.6 Z"
},
{
"enable": true,
"name": "M'Sila",
"abbreviation": "MS",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>M'Sila</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M453.4,76.6 L453.6,82.8 L450.4,85.8 L435.1,88.6 L427.8,97.9 L428.9,103.4 L431.6,108.4 L428.5,108.8 L423.0,103.7 L418.8,89.1 L411.5,88.2 L405.4,74.5 L410.9,69.7 L411.6,61.8 L404.6,55.8 L402.4,52.3 L404.0,50.6 L407.4,55.2 L407.3,50.3 L409.9,45.9 L413.2,45.6 L416.7,48.1 L421.9,47.9 L423.7,41.8 L433.5,43.0 L436.4,41.7 L437.5,45.0 L434.9,48.4 L439.5,49.3 L447.2,47.3 L453.4,50.7 L458.7,54.8 L463.4,55.9 L457.2,60.6 L448.5,60.1 L449.1,65.7 L448.0,70.1 L445.3,73.2 Z"
},
{
"enable": true,
"name": "Sétif",
"abbreviation": "SF",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Sétif</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M463.4,55.9 L458.7,54.8 L453.4,50.7 L455.9,47.7 L455.8,44.8 L458.8,36.5 L457.0,33.1 L453.2,31.1 L445.9,31.1 L445.2,28.4 L448.5,28.2 L449.6,23.8 L453.4,20.9 L457.0,22.9 L456.9,27.1 L460.4,27.7 L461.1,25.4 L465.1,23.3 L465.4,20.0 L467.9,22.5 L473.3,21.1 L474.3,25.0 L477.6,26.8 L477.6,32.2 L481.3,39.5 L481.3,44.8 L473.6,46.7 L474.1,50.4 L469.6,48.6 Z"
},
{
"enable": true,
"name": "Batna",
"abbreviation": "BT",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Batna</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M453.4,76.6 L445.3,73.2 L448.0,70.1 L449.1,65.7 L448.5,60.1 L457.2,60.6 L463.4,55.9 L469.6,48.6 L474.1,50.4 L473.6,46.7 L481.3,44.8 L484.1,45.6 L486.6,45.2 L492.7,45.6 L496.6,47.1 L497.0,49.3 L501.9,48.6 L505.7,52.7 L505.1,59.0 L500.5,62.6 L501.7,67.1 L500.2,69.0 L498.7,76.5 L501.6,82.1 L501.4,86.7 L498.7,86.6 L496.5,83.4 L497.1,77.3 L495.6,76.0 L486.9,78.9 L484.9,76.8 L482.8,79.4 L480.8,73.7 L482.9,70.6 L477.2,68.4 L469.2,72.2 L470.9,75.7 L461.7,78.8 Z"
},
{
"enable": true,
"name": "Constantine",
"abbreviation": "CO",
"textX": 0,
"textY": 0,
"color": "#59798e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Constantine</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M496.4,19.6 L500.9,18.3 L504.7,20.0 L509.0,19.8 L506.2,23.6 L509.7,24.5 L513.2,30.2 L512.3,34.7 L509.0,36.7 L505.5,33.7 L499.1,36.9 L497.4,34.9 L497.6,33.5 L492.0,26.4 L495.5,25.4 Z"
},
{
"enable": true,
"name": "Guelma",
"abbreviation": "GL",
"textX": 0,
"textY": 0,
"color": "#B12401",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Guelma</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M530.8,14.9 L535.0,18.0 L541.3,21.1 L535.6,23.2 L536.9,27.6 L524.4,33.2 L521.9,35.4 L518.5,35.1 L514.6,38.9 L512.3,34.7 L513.2,30.2 L509.7,24.5 L513.8,21.7 L515.1,18.5 L520.4,16.0 L522.7,12.9 L528.3,16.9 Z"
},
{
"enable": true,
"name": "Khenchela",
"abbreviation": "KH",
"textX": 0,
"textY": 0,
"color": "#9a9a68",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io/",
"text": "<h1>Khenchela</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>",
"path": "M519.2,109.1 L513.8,108.1 L506.9,104.4 L505.3,101.6 L506.5,89.0 L505.7,86.6 L501.4,86.7 L501.6,82.1 L498.7,76.5 L500.2,69.0 L501.7,67.1 L500.5,62.6 L505.1,59.0 L505.7,52.7 L507.5,54.8 L512.6,54.3 L514.5,56.3 L517.4,54.6 L521.7,54.7 L527.4,57.4 L529.8,60.5 L526.2,62.5 L525.5,73.1 L520.6,80.0 L525.0,78.7 L526.5,87.6 L522.9,94.7 L521.2,104.0 Z"
}
],
"pins": [
{
"name": "Abalessa",
"xPos": 448,
"yPos": 561,
"color": "#ffc90e",
"hoverColor": "#E32F02",
"selectedColor": "#feb41c",
"url": "http://jsmaps.io",
"text": "<h1>Abalessa</h1><br /><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>"
}
]
}
|
/**
* Does a AJAX request for obtaining questions.
* @param {type} param AJAX parameters.
*/
$.ajax({
type: "GET",
url: "test.xml",
dataType: "xml",
success: function(data) {
saveAnswers($(data)[0]);
renderQuestions($(data)[0]);
},
error: function() {
alert("error");
}
});
/**
* Renders form with questions.
* @param {xml} xml XML with questions.
*/
function renderQuestions(xml) {
var form = document.createElement("form");
form.action = "#";
form.method="get";
form.name = "qForm";
var questions = xml.getElementsByTagName("question");
for(var i=0; i<questions.length; i++) {
form.appendChild(getQuestion(questions[i]));
}
var button = document.createElement("button");
button.id = "submitAnswers";
button.className = "btn btn-default";
//button.type = "submit";
button.addEventListener("click", function(){ return checkAnswers(); });
button.innerHTML = "Submit";
form.appendChild(button);
document.getElementById("output").appendChild(form);
var param = getParameters();
if(param.length > 0) {
for(var i=0; i<param.length; i++) {
document.getElementById(param[i]).checked = true;
}
}
}
/**
* Makes question element.
* @param {type} question Question.
* @returns {getQuestion.task|Element} Element with question.
*/
function getQuestion(question) {
var task = document.createElement("fieldset");
task.id = question.id;
//question.classList.add("question");
var query = document.createElement("legend");
query.innerHTML = question.getElementsByTagName("text")[0].innerHTML;
task.appendChild(query);
var answers = question.getElementsByTagName("answer");
for(var i=0; i<answers.length; i++) {
var answer = document.createElement("div");
answer.classList.add("radio");
var box = document.createElement("input");
box.type = "radio";
box.id = answers[i].id;
box.name = task.id;
box.value = answers[i].id;
var label = document.createElement("label");
label.htmlFor = answers[i].id;
label.appendChild(box);
label.innerHTML += answers[i].innerHTML;
answer.appendChild(label);
task.appendChild(answer);
}
return task;
}
var correctAnswers = [];
/**
* Saves correct answers to an array for later usage.
* @param {xml} xml XML with questions.
*/
function saveAnswers(xml) {
var answers = xml.getElementsByTagName("answer");
for(var i=0; i<answers.length; i++) {
var answer = answers[i];
if(answer.hasAttribute("ok") || answer.attributes.ok === "true") {
correctAnswers.push(answer.id);
}
}
//console.log(correctAnswers);
}
/**
* Checks if given answers are correct.
* @returns {undefined}
*/
function checkAnswers() {
var params = getParameters();
for(var i=0; i<params.length; i++) {
if(document.getElementById(correctAnswers[i]).checked) {
alert(document.getElementById(correctAnswers[i]).value);
document.getElementById(correctAnswers[i]).parentNode.parentNode.classList.add("has-success");
}
}
}
/**
* Returns GET parameters for form.
* @returns {Array|getParameters.parameters} Parameters.
*/
function getParameters() {
var parameters = [];
var array = window.location.search.replace("?", "").split("&");
if(array.length > 0 && array[0] !== "") {
for(var i=0; i<array.length; i++) {
var value = array[i].split("=");
parameters.push(value[1]);
}
}
return parameters;
}
|
import React from 'react';
import { shallow } from 'enzyme';
import DashboardLanding from '../../components/dashboard/DashboardLanding';
describe('Dashboard Landing Page', () => {
it('should render correctly in "debug" mode', () => {
const component = shallow(<DashboardLanding />);
expect(component).toMatchSnapshot();
});
});
|
var variables________________6________8js____8js__8js_8js =
[
[ "variables________6____8js__8js_8js", "variables________________6________8js____8js__8js_8js.html#ab18fa3b83e8f3d4e162b02e58cc08566", null ]
];
|
import React, { Component } from "react";
import { Button, Row, Col, FormGroup, Label, Input } from 'reactstrap';
import { fetchTemplate } from "../util/util";
// Redux
import { connect } from "react-redux";
import { addElement } from "../Redux/actions";
class Reason extends Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(e) {
this.props.dispatch(addElement("reason", e.target.value));
}
render() {
return (
<Row form>
<Col xs={12}><Label for="reason">{"💪 Body"}</Label></Col>
<Col xs={11}>
<FormGroup>
<Input type="text" bsSize="sm" name="reason" list="reason-tmpl" onChange={this.handleChange} placeholder={(this.props.lang === "en") ? "This is where you enter the details of your commit." : "コミット内容の詳細を書くところです。ここは日本語でも構いません。"} value={this.props.reason} autoComplete="off" />
<datalist id="reason-tmpl">
{
fetchTemplate("reason").map((element) => {
return (
<option value={element} key={element}>{element}</option>
)
})
}
</datalist>
</FormGroup>
</Col>
<Col xs={1}>
<Button outline size="sm" color="primary" onClick={(() => { this.props.dispatch(addElement("reason", "")) })} block>Reset</Button>
</Col>
</Row>
);
}
}
const mapStateToProps = (state) => {
return {
reason: state.message.reason,
lang: state.lang.lang
};
};
export default connect(mapStateToProps)(Reason);
|
import React, { useState } from "react";
import { useForm } from 'react-hook-form';
import Form from 'react-bootstrap/Form';
import { Button , Row,Container,Alert} from 'react-bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
import { Link, Redirect } from 'react-router-dom'
import axios from 'axios';
export default function FormUser(){
const { register, handleSubmit, errors } = useForm();
const [stat, setStat] = useState(0);
const [show, setShow] = useState(true);
const onSubmit = data => {
console.log(data);
axios.post('http://localhost:8080/api/addUser', {
firstName: data.firstName,
lastName: data.lastName,
email: data.email,
}).then(res => {
console.log(res);
setStat(1)
}).catch(err => {
console.log(err);
});
};
return(
<Container fluid style={{ backgroundColor:"#B2B2B1"}}>
<Row style={{margin:"30px 100px 0 100px"}}>
<Form onSubmit={handleSubmit(onSubmit)}>
<Form.Group controlId="formBasicfirstName">
<Form.Label>first Name</Form.Label>
<Form.Control type="text" placeholder="Enter first Name" name="firstName" ref={register({required: "first Name Required"})} />
<Form.Text className="text-muted">
{errors.firstName }
</Form.Text>
</Form.Group>
<Form.Group controlId="formBasiclastName">
<Form.Label>last Name</Form.Label>
<Form.Control type="text" placeholder="Enter last Name" name="lastName" ref={register({required: "last Name Required"})} />
<Form.Text className="text-muted">
{errors.lastName }
</Form.Text>
</Form.Group>
<Form.Group controlId="formBasicEmail">
<Form.Label>Email address</Form.Label>
<Form.Control type="text" placeholder="Enter email" name="email" ref={register({required: "email Required"})} />
<Form.Text className="text-muted">
{errors.email }
</Form.Text>
</Form.Group>
<Button variant="primary" type="submit">
Submit
</Button>
<div style={{margin:"15px"}}>
{stat ? <Alert show={show} variant="success" >
<p>User Created!</p>
<hr/>
<div className="d-flex justify-content-end">
<Button onClick={() => setShow(false)} variant="outline-success">
Close me y'all!
</Button>
</div>
</Alert>: null}
</div>
</Form>
</Row>
</Container>
)
}
|
const Discord = require('discord.js');
const client = new Discord.Client();
const { token, default_prefix } = require('./config.json')
const fetch = require('node-fetch')
const { CanvasSenpai } = require("canvas-senpai")
const axios = require("axios")
const canva = new CanvasSenpai();
bot.commands = new Discord.Collection();
const db = require("quick.db")
var jimp = require('jimp');
const prefix = ('c!');
const { readdirSync } = require('fs');
const { join } = require('path')
client.commands= new Discord.Collection();
const { profile } = require('console');
const { config } = require('process');
const { userInfo } = require('os');
const commandFiles = readdirSync(join(__dirname, "commands")).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(join(__dirname, "commands", `${file}`));
client.commands.set(command.name, command);
}
client.user.setActivity("Cubegamers Command", { type: 'LISTENING'}).catch(console.error);
client.on("error", console.error);
client.on('ready', () =>{
console.log('Cubebot is online');
client.user.setActivity("listening to Cube gamers commands :)", { type: 'LISTENING'}).catch(console.error);
});
client.on("message", message => {
if (message.content.toLowerCase() === 'Hello') {
message.channel.send("**Hey! What's Up?**")
}
})
client.on("message", async message => {
if(message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if(!client.commands.has(command)) return;
try {
client.commands.get(command).run(client, message, args);
} catch (error){
console.error(error);
}
}
})
client.on('guildMemberAdd', async member => {
let chx = db.get(`welchannel_${member.guild.id}`); //
let data = await canva.welcome(member, { link: "https://wallpapercave.com/wp/wp5128415.jpg" })
const attachment = new Discord.MessageAttachment(
data,
"welcome-image.png"
);
client.channels.cache.get(chx).send(`Welcome to the server, ${member.user.username}!`,
attachment)
})
let font = await jimp.loadFont(jimp.FONT_SANS_32_BLACK) //We declare a 32px font
let font64 = await jimp.loadFont(jimp.FONT_SANS_64_WHITE) //We declare a 64px font
let bfont64 = await jimp.loadFont(jimp.FONT_SANS_64_BLACK)
let mask = await jimp.read('https://i.imgur.com/552kzaW.png') //We load a mask for the avatar, so we can make it a circle instead of a shape
let welcome = await jimp.read('http://rovettidesign.com/wp-content/uploads/2011/07/clouds2.jpg') //We load the base image
jimp.read(member.user.displayAvatarURL).then(avatar => { //We take the user's avatar
avatar.resize(200, 200) //Resize it
mask.resize(200, 200) //Resize the mask
avatar.mask(mask) //Make the avatar circle
welcome.resize(1000, 300)
welcome.print(font64, 265, 55, `Welcome ${member.user.username}`) //We print the new user's name with the 64px font
welcome.print(bfont64, 265, 125, `To ${member.guild.name}`)
welcome.print(font64, 265, 195, `There are now ${member.guild.memberCount} users`)
welcome.composite(avatar, 40, 55).write('Welcome2.png') //Put the avatar on the image and create the Welcome2.png bot
try{
member.guild.channels.get(wChan).send(``, { files: ["Welcome2.png"] }) //Send the image to the channel
}catch(e){
// dont do anything if error occurs
// if this occurs bot probably can't send images or messages
}
})
client.login('ODAxMTIxNTI4NTU2OTQ1NDc4.YAcEkA.SNwvGqi63BZOSDQQks5D3TcSzHE');
|
/*config */
myApp.config(['$routeProvider', '$httpProvider',
function ($rp, $hp) {
$rp.when('/', {
templateUrl: 'tpl/layout.html',
controller: 'LayoutCtrl',
}).when('/alert/', {
templateUrl: 'tpl/alert_demo.html',
controller: 'AlertDemoCtrl'
}).otherwise({
redirectTo: '/'
});
}
]);
|
import React from 'react';
import ResponseViewContextUtil from './ResponseViewContextUtil.jsx';
import ImageListResponse from './ImageListResponse.jsx';
import ShortTextResponse from './ShortTextResponse.jsx';
export default class ResponseHandler extends React.Component {
constructor() {
super();
this.state = {
responses: [
{
contentType: 'imagelist',
image:'/images/IMG_5774.jpg'
},
{
contentType: 'shorttext',
content:'Lorem ipsum Magna ex cillum mollit voluptate consectetur do sint eu sunt aliqua non aute laboris labore pariatur in in Ut nostrud ad.'
}
],
error: ''
};
}
getResponseRendererMap() {
return {
shorttext: <ShortTextResponse/>,
imagelist: <ImageListResponse/>
};
}
render() {
console.log("inside");
return (
<div>
{
this.state.responses.map((respObj) => {
return (
<div key={respObj.contentType}>
<ResponseViewContextUtil response={respObj}>
{
this.getResponseRendererMap()[respObj.contentType]
}
</ResponseViewContextUtil>
</div>
)
})
}
</div>
);
}
}
|
import React from 'react';
import 'typeface-roboto';
import CityInfo from './CityInfo';
export default {
title: "City Info",
component: CityInfo,
}
export const CityExample = () => (<CityInfo city={"Alajuela"} country={"Costa Rica"}></CityInfo>);
|
exports.up = function(knex, Promise) {
return knex.schema.table('campaigns_log', function (table) {
table.integer('state');
});
};
exports.down = function(knex, Promise) {
return knex.schema.table('campaigns_log', function (table) {
table.dropColumn('state');
});
};
|
import * as types from '../constants/contries';
const INITIAL_STATE = {
requesting: false,
success: false,
error: null,
countries: [],
};
const countries = (state = INITIAL_STATE, action) => {
switch (action.type) {
case types.GET_COUNTRIES_REQUEST:
return Object.assign({}, state, {
requesting: true,
success: false,
error: null,
});
case types.GET_COUNTRIES_SUCCESS:
return Object.assign({}, state, {
requesting: false,
success: true,
error: null,
countries: action.payload,
});
case types.GET_COUNTRIES_FAILURE:
return Object.assign({}, state, {
requesting: false,
success: false,
error: action.payload,
});
default:
return state;
}
};
export default countries;
|
import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { Container, Content, Form, Textarea, Text, Item, Input, Button, Spinner } from 'native-base';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { useDispatch } from 'react-redux';
import * as actions from '../../../actions/receitasActions';
import styles from './styles';
import { ImageBackground, Alert } from 'react-native';
import { showToast } from '../../../utils/utils';
const AddReceita = (props) => {
const dispatch = useDispatch();
const receitaId = props.navigation.state.params.receitaId;
const [title, setTitle] = useState('');
const [autor, setAutor] = useState('');
const [descricao, setDescricao] = useState('');
const loading = useSelector(state => state.receitas.loading);
const error = useSelector(state => state.receitas.error);
const message = useSelector(state => state.receitas.message);
useEffect(() => showMessageToast(), [message]);
function showMessageToast() {
if (error === false && message !== '' && loading === false) {
return Alert.alert('Sucesso', 'Sua receita foi incluída');
}
else if (error === true && message !== '' && loading === false) {
return Alert.alert('Ops!', 'Não foi possível incluir sua receita');
}
}
function salvarReceita() {
const receita = {
descricao: descricao,
titulo: title,
autor: autor,
tipoReceitaId: receitaId
}
dispatch(actions.inserirReceita(receita));
}
if (loading) {
return (<Spinner color="blue" />)
}
return (
<>
<Container>
<ImageBackground style={styles.image} source={require('../../../resources/backgroundFood.jpg')}>
<Content>
<Form>
<Item rounded style={styles.item}>
<Input style={styles.input}
rounded
placeholder="Titulo da Receita"
placeholderTextColor="white"
onChangeText={(e) => setTitle(e)}
/>
</Item>
<Item rounded style={styles.item}>
<Input
style={styles.input}
rounded placeholder="Autor"
placeholderTextColor="white"
onChangeText={(e) => setAutor(e)}
/>
</Item>
<Textarea
style={styles.textArea}
placeholder="Descrição"
onChangeText={(e) => setDescricao(e)}
placeholderTextColor="white" />
</Form>
<Button onPress={() => salvarReceita()} rounded style={styles.button}>
<Text>
Incluir
</Text>
</Button>
</Content>
</ImageBackground>
</Container>
</>
);
}
export default AddReceita;
|
import query from 'query-string';
import { useLocation } from 'react-router-dom';
// eslint-disable-next-line import/prefer-default-export
export const useQueryParams = () => {
const { search } = useLocation();
if (!search) {
return null;
}
return query.parse(search, { ignoreQueryPrefix: true }) || {};
};
|
var tokki = angular.module("excelController", []);
tokki.config(["$stateProvider", "$urlRouterProvider",
function($stateProvider, $urlRouterProvider){
$stateProvider
.state('system.excel', {
url: "/excel",
templateUrl: "pages/excel/excel.html",
controller: 'Excel',
data: {
access: ['admin', 'superuser'],
},
})
}]
)
tokki.controller("Excel", ['$scope', '$rootScope', '$state', '$filter', 'tokkiApi', 'Notification', 'excelService',
function($scope, $rootScope, $state, $filter, tokkiApi, Notification, excelService) {
$rootScope.navigation = "excel";
$scope.excel = [];
$scope.paste = function(text){
$scope.excel = excelService.tojson(text);
}
$scope.save = function(){
$scope.sending = true;
tokkiApi.save({action: "productos", control: "excel", excel: $scope.excel})
.$promise.then(function(response){
Notification.success("Los productos fueron ingresados.");
$state.go('system.admin.productos');
}, function(response){
$scope.sending = false;
Notification.error(response.data);
})
}
}
]);
|
const mongoose = require('mongoose')
const validator = require('validator')
const bcrypt = require('bcryptjs')
const taskSchema = new mongoose.Schema({
description: {
type: String
},
completed: {
type: Boolean
}
})
// task don't have password field
// taskSchema.pre('save', async function(next){
// const task = this
// if(user.isModified('password')){
// task.password = await bcrypt.hash(task.password, 8)
// }
// next()
// })
const Task = mongoose.model('Task', taskSchema)
module.exports = Task
|
(function() {
'use strict';
angular.module('veegam-trials').component('createProject', {
controller: CreateProjectController,
controllerAs: 'vm',
templateUrl: 'app/components/createProject/createProject.html',
});
/** @ngInject */
function CreateProjectController($scope, $mdDialog, $element, $timeout, $rootScope, uploadDataSvc, Guid, errorSvc, customDialog, projects, projectsSvc, utilsService) {
var vm = this;
//create instance of projectCreate from projects model
vm.projectCreate = angular.copy(projects.projectCreate);
vm.projectCreate.terraformVersion = 'latest';
//create instance of gitProjectDetails from projects model
vm.gitProjectDetails = angular.copy(projects.gitProjectDetails);
//create instance of zipProjectDetails from projects model
vm.zipProjectDetails = angular.copy(projects.zipProjectDetails);
vm.orgID = utilsService.getOrganization();
vm.projectMode = localStorage.getItem('ProjectMode');
localStorage.removeItem('ProjectMode');
vm.currentProject = {};
if (projects.projectResponse) {
vm.currentProject = projects.projectResponse;
vm.projectCreate = {
projectName: projects.projectResponse.projectName,
projectDescription: projects.projectResponse.projectDescription,
terraformVersion: 'latest',
projectType: projects.projectResponse.projectType,
projectDetails: projects.projectResponse.projectDetails,
}
if (vm.projectCreate.projectType === 'zip') {
vm.zipProjectDetails = vm.projectCreate.projectDetails;
} else if (vm.projectCreate.projectType === 'github') {
vm.gitProjectDetails = vm.projectCreate.projectDetails;
}
}
//Method call to create new project
vm.createProject = function() {
if (vm.projectCreate.projectType == 'github') {
vm.projectCreate.projectDetails = vm.gitProjectDetails;
} else {
vm.projectCreate.projectDetails = vm.zipProjectDetails;
}
vm.showProjectLoading = true;
// projectSvc call to save project data
projectsSvc.createProjectByOrg(vm.projectCreate).then(function(response) {
//get project_id in response
vm.showProjectLoading = false;
var tmpProjId = response.data.project_id;
$mdDialog.hide({
projectId: tmpProjId,
flag: 'true'
});
}, function(error) {
vm.showProjectLoading = false;
if (error.status == 401 && error.data) {
errorSvc.displayErrorString('labs-service_7', 'error', 5);
} else {
console.log('error createProjectByOrg');
if (error.data != undefined) {
errorSvc.displayErrorString(error.data.errorCode, 'error', 15);
}
}
errorSvc.logProcessing(error, 'error');
});
}
//Method call to update project
vm.updateProject = function() {
if (vm.projectCreate.projectType == 'github') {
vm.projectCreate.projectDetails = vm.gitProjectDetails;
} else {
vm.projectCreate.projectDetails = vm.zipProjectDetails;
}
vm.showProjectLoading = true;
// projectSvc call to save project data
var updateProjectValue = {
orgId: projects.projectResponse.orgId,
project_id: projects.projectResponse.project_id,
Projects: vm.projectCreate
}
projectsSvc.updateProjectByOrg(updateProjectValue.orgId, updateProjectValue).then(function(response) {
//get project_id in response
var tmpProjId = response.data.project_id;
$mdDialog.hide({
projectId: tmpProjId,
flag: 'true'
});
}, function(error) {
vm.showProjectLoading = false;
if (error.status == 401 && error.data) {
errorSvc.displayErrorString('labs-service_7', 'error', 5);
} else {
console.log('error createProjectByOrg');
if (error.data != undefined) {
errorSvc.displayErrorString(error.data.errorCode, 'error', 15);
}
}
errorSvc.logProcessing(error, 'error');
});
}
// Method to delete the project
// Method to show confirm delete overlay for a particular Demo Lab
vm.showConfirmDelete = function(project) {
project.deleteDemoLabFlag = true;
}
vm.deleteProject = function() {
vm.showProjectLoading = true;
projectsSvc.deleteProjectByOrg(vm.currentProject.orgId, vm.currentProject.project_id).then(function(response) {
if (response) {
vm.confirmYes('true');
}
}, function(error) {
console.log(error);
vm.confirmYes('true');
});
}
// enable/disable create project button
vm.getCreateProjectValidity = function() {
if (vm.projectCreate.projectType == 'github' && vm.projectCreate.projectName && vm.projectCreate.projectName !== "" && vm.projectCreate.projectDescription && vm.projectCreate.projectDescription !== "" && vm.projectCreate.terraformVersion && vm.projectCreate.terraformVersion !== "" && vm.gitProjectDetails.githubAccountName && vm.gitProjectDetails.githubAccountName !== "" && vm.gitProjectDetails.githubRepoName && vm.gitProjectDetails.githubRepoName !== "" && vm.gitProjectDetails.githubRepoBranch && vm.gitProjectDetails.githubRepoBranch !== "") {
return false;
} else if (vm.projectCreate.projectType == 'zip' && vm.projectCreate.projectName && vm.projectCreate.projectName !== "" && vm.projectCreate.projectDescription && vm.projectCreate.projectDescription !== "" && vm.projectCreate.terraformVersion && vm.projectCreate.terraformVersion !== "" && vm.zipProjectDetails.title) {
return false;
} else {
return true;
}
}
//Method call to upload Zip for creation of new project
vm.uploadProjectZip = function(e) {
if (vm.zipProjectDetails.title) {
vm.removeZip();
}
vm.showProjectLoading = true;
if (e.files[0].type == "" || e.files[0].type == "application/x-gzip" || e.files[0].type == "application/x-tar" || e.files[0].type == "application/x-zip-compressed" || e.files[0].type == "application/x-rar-compressed" || e.files[0].type == "application/zip" || e.files[0].type == "application/octet-stream" || e.files[0].type == ".7z" || e.files[0].type == ".rar") {
var reader = new FileReader();
var orginalName = e.files[0].name;
var nameArr = e.files[0].name.split('.');
var fileName = Guid.newGuid() + "." + nameArr[nameArr.length - 1];
var type = e.files[0].type;
reader.onload = (function(filename, orginalName, type) {
// var data = reader.result;
return function(loadEvent) {
uploadDataSvc.uploadData(loadEvent.target.result, fileName, type).then(function(response) {
vm.showProjectLoading = false;
console.log('file uploaded successfully');
vm.zipProjectDetails.title = orginalName;
vm.zipProjectDetails.url = '';
//this will add once we retrieve url from api
vm.zipProjectDetails.id = fileName;
}, function(error) {
vm.showProjectLoading = false;
console.log('file uploaded failed');
if (error.data != undefined) {
errorSvc.displayErrorString(error.data.errorCode, 'error', 15);
}
errorSvc.logProcessing(error, 'error');
});
}
})(fileName, orginalName, type);
reader.readAsArrayBuffer(e.files[0]);
} else {
// if(error.data!=undefined)
vm.showProjectLoading = false;
errorSvc.displayErrorString('ui-errors_8', 'error', 15);
}
}
vm.cancel = function(message, flag) {
var objCustomDialog = angular.copy(customDialog.dialog);
objCustomDialog.message = message;
objCustomDialog.buttons = [{
text: 'Yes',
iconText: 'check_circle',
callback: flag === 'discard_changes' ? vm.resetform : vm.deleteProject
},
{
text: 'No',
iconText: 'cancel',
callback: vm.confirmNo
}
];
errorSvc.displayConfirmation(objCustomDialog);
};
vm.confirmYes = function(value) {
errorSvc.closeToastr();
$mdDialog.hide(value);
}
vm.confirmNo = function() {
errorSvc.closeToastr();
}
//Function to reset create new project form to original
vm.resetform = function() {
vm.gitProjectDetails = angular.copy(projects.gitProjectDetails);
vm.zipProjectDetails = angular.copy(projects.zipProjectDetails);
vm.projectCreate = angular.copy(projects.projectCreate);
if ($scope.newProjectForm) {
$scope.newProjectForm.$setPristine(true);
$scope.newProjectForm.$setUntouched();
}
vm.confirmYes('true');
}
//Function to delete Zip selected for creation of new project
vm.removeZip = function() {
vm.zipProjectDetails = angular.copy(projects.zipProjectDetails);
}
//Function to reset create new project with github details form to original
vm.clearProjectGithubDet = function() {
vm.gitProjectDetails = angular.copy(projects.gitProjectDetails);
$scope.newProjectForm.gitAccountName.$setUntouched();
$scope.newProjectForm.repo.$setUntouched();
$scope.newProjectForm.branch.$setUntouched();
}
vm.editProject = function() {
vm.projectMode = 'editable';
}
}
})();
|
// 导入
const fs = require('fs')
const path = require('path')
const http = require('http')
// 使用
// 创建web服务器
const server = http.createServer()
// 启动
server.listen(3000,()=>{
console.log('server is running at port 3000')
})
// 监听
server.on('request',(req,res)=>{
console.log('come')
// res.setHeader('content-type','text/html;charset=utf-8')
if(req.url === '/' || req.url === '/index.html'){
const path1 = path.join(__dirname,'./Clock案例/www/index.html')
const read1 = fs.readFileSync(path1)
res.end(read1)
}else if(req.url === '/clock.css'){
const path2 = path.join(__dirname,'/Clock案例/www/clock.css')
const read2 = fs.readFileSync(path2)
res.end(read2)
}else if(req.url === '/clock.js'){
const path3 = path.join(__dirname,'./Clock案例/www/clock.js')
const read3 = fs.readFileSync(path3)
res.end(read3)
}else{
res.end('<h1>404 not fount</h1>')
}
// req.url
// res.statusCode = 200
// res.serHeader('content-type','text/html;charset=utf-8')
// res.end()
// fs.readFileSync('path','utf-8')
// path.join(__dirname,'')
})
// 注意:
// 1. 请求地址req.url,不仅仅指手动输入在端口后的路径,浏览器遇到 link和script标签 也会发送请求
// 响应数据将文件返回给浏览器时,浏览器解析文件时,link和script标签中引入的路径也是请求地址
// 例如:index.html文件中引入了/clock.css路径和/clock.js路径
// 所以要展示完整的index.html文件样式和特效,还需要根据标签中的路径分别响应clock.css文件clock.js文件
// 2. 不用设置响应头,读取的是html,css,js文件,浏览器能自动识别,不用单独设置响应头
|
function valida(e){
tecla = (document.all) ? e.keyCode : e.which;
// Patron de entrada, en este caso solo acepta numeros
patron =/[0-9]/;
tecla_final = String.fromCharCode(tecla);
if(patron.test(tecla_final)<=0){
swal("Advertencia!", "No se permiten letras en este campo!", "warning");
}
return patron.test(tecla_final);
}
function soloLetras(e){
key = e.keyCode || e.which;
tecla = String.fromCharCode(key).toLowerCase();
letras = " áéíóúabcdefghijklmnñopqrstuvwxyz";
especiales = "8-13-37-39-46";
tecla_especial = false
for(var i in especiales){
if(key == especiales[i]){
tecla_especial = true;
break;
}
}
if(letras.indexOf(tecla)==-1 && !tecla_especial){
swal("Advertencia!", "No se permiten numeros en este campo!", "warning");
return false;
}
}
$(document).ready(function(){
$(".boton1").click(function(){
var valor = [];
var i=0;
// Obtenemos todos los valores contenidos en los <td> de la fila
// seleccionada
$(this).parents("tr").find("td").each(function(){
//valores+=$(this).html()+"\n";
valor[i]=$(this).html();
i++;
});
// for(var a=0;a<=2;a++){
// alert( valor[a]);
//}
$("#modal_idcliente").val(valor[0]);
$("#modal_nombre").val(valor[1]);
$("#modal_documento").val(valor[2]);
$("#modal_telefono").val(valor[5]);
$("#modal_barrio").val(valor[4]);
$("#modal_correo").val(valor[6]);
$("#DocumentoActual").val(valor[2]);
$("#modal_prueba").val(valor[3]);
});
});
$(document).ready(function(){
$(".boton2").click(function(){
var valor = [];
var i=0;
// Obtenemos todos los valores contenidos en los <td> de la fila
// seleccionada
$(this).parents("tr").find("td").each(function(){
//valores+=$(this).html()+"\n";
valor[i]=$(this).html();
i++;
});
// for(var a=0;a<=2;a++){
// alert( valor[a]);
//}
$("#modal_idcliente_eliminar").val(valor[0]);
$("#modal_nombre_eliminar").val(valor[1]);
$("#modal_cedula_eliminar").val(valor[2]);
});
});
|
(function(){
// numlayout();
//alert(1)
/* ----------------- 事件 ----------------- */
$('.red.loy_num').click(function(){ // 红色区域
var cls = $(this).attr('class').indexOf('on');
if(cls>0){
$(this).removeClass('on');
add_Loy('red',$(this).text(),false);
}else{
if(red_num('.red_round')>=6) {
return false;
}else{
$(this).addClass('on');
add_Loy('red',$(this).text(),true);
}
}
});
$('.blue.loy_num').click(function(){ // 蓝色区域
var cls = $(this).attr('class').indexOf('on');
if(cls>0){
$(this).removeClass('on');
add_Loy('blue',$(this).text(),false);
}else{
if(red_num('.blue_round')>=1) {
return false;
}else{
$(this).addClass('on');
add_Loy('blue',$(this).text(),true);
}
}
});
$('.sel_tabel span').click(function(){ // 手动选号和随机选号切换
var n = $('.sel_tabel span').index(this);
$('.sel_tabel span').removeClass('on').eq(n).addClass('on');
if(n==1){
$('.my_num').attr('data-zj',1);
$('.my_num').addClass('on');
$('.sd').css('display','none');
$('.change').css('display','block');
add_round();
}else{
$('.my_num').attr('data-zj',2);
$('.my_num').removeClass('on');
$('.sd').css('display','block');
$('.change').css('display','none');
$('.red_round span').removeClass('on');
$('.blue_round span').removeClass('on');
$('.my_num > span').remove();
}
});
$('.change').click(function(){
add_round();
});
$('.suer').click(function(){
if($('.my_num span').length!=7){
alert('号码不够!');
return false;
}
var numStr = '';
$('.my_num span').each(function(){
var n = $(this).index();
if(n==$('.my_num span').length){
numStr+=$(this).text().substring(0,2);
}else{
numStr+=$(this).text().substring(0,2)+',';
}
});
var type = $('.my_num').attr('data-zj');
window.location.href =ctx+ "/w/saveLottery?betDetail="+numStr+"&numberSelectType="+type+"&username="+username+"&usermsg="+usermsg;
});
/*$('.my_num i').click(function(){
alert('dlt')
var n = parseInt($(this).parent().text());
var str = $(this).parent().attr('class');
if(str.indexOf('red')>-1){
$('.red_round .loy_num').each(function(){
if($(this).text()==n){
$(this).removeClass('on');
}
});
}else{
$('.blue_round .loy_num').each(function(){
if($(this).text()==n){
$(this).removeClass('on');
}
});
}
$(this).parent().remove();
});*/
/* ----------------- 事件 ----------------- */
/* ----------------- 方法 ----------------- */
function red_num(obj){// 返回现在一个选了几个红球
var a_num = 0;
$(obj+' .loy_num').each(function(){
if($(this).attr('class').indexOf('on')>1){
a_num++;
}
});
return a_num;
}
/*function numlayout(){
var w = $('.red_round').width();
for(var i=0;i<$('.red_round .loy_num').length;i++){
}
console.log(parseInt(w/8));
}*/
function add_Loy(color,n,tof){//添加 红球
if(color=='red'){
if(tof){
var htmls = '<span class="red loy_num on">'+n+'<i>×</i></span>';
if($('.my_num .blue.loy_num').length>0){
$('.my_num .blue.loy_num').before(htmls);
}else{
$('.my_num').append(htmls);
}
}else{
$('.my_num .red.loy_num').each(function(){
if(parseInt($(this).text())==n){
$(this).remove();
}
});
}
}else{
if(tof){
var htmls = '<span class="blue loy_num on">'+n+'<i>×</i></span>';
$('.my_num').append(htmls);
}else{
$('.my_num .blue').remove();
}
}
$('.my_num i').unbind('click');
$('.my_num i').click(function(){// 删除已选中的号码
var n = parseInt($(this).parent().text());
var str = $(this).parent().attr('class');
if(str.indexOf('red')>-1){
$('.red_round .loy_num').each(function(){
if($(this).text()==n){
$(this).removeClass('on');
}
});
}else{
$('.blue_round .loy_num').each(function(){
if($(this).text()==n){
$(this).removeClass('on');
}
});
}
$(this).parent().remove();
});
}
function add_round(){ // 把随机出来的数渲染到页面上
$('.my_num > span').remove();
var red = random(6,34);
var blue = random(1,17);
var htmls = '';
for(var i in red){
/*if(red[i]<10){
red[i] = '0'+red[i];
}*/
htmls+='<span class="red loy_num on">'+(red[i]>=10?red[i]:'0'+red[i])+'</span>';
}
htmls+='<span class="blue loy_num on">'+(blue[0]>=10?blue[0]:'0'+blue[0])+'</span>';
$('.my_num p').after(htmls);
}
function random(z,max){// 返回随机数 @z代表几个 @max代表最大数
var numArr = [];
while (true){
var n = parseInt(Math.random()*100);
if(n>0&&n<max){
if(contains(numArr,n)){
numArr.push(n);
if(numArr.length==z){
break;
}
}
}
}
console.log(numArr);
return numArr;
}
function contains(arr,n){// 判断n 有没有存在于arr中
for(var i in arr){
if(arr[i]==n){
return false;
}
}
return true;
}
/* function add_b_Loy(n){// 添加蓝球
console.log(n);
var htmls = '<span class="red loy_num">'+n+'<i>×</i></span>';
if($('.my_num .blue.loy_num').length>0){
$('.my_num .blue.loy_num').before(htmls);
}else{
$('.my_num ').append(htmls);
}
}*/
/* ----------------- 方法 ----------------- */
})();
|
import React, {Component, Fragment} from 'react'
import "./Thing.css"
class Thing extends Component{
render(){
const thing = {
position:'absolute',
overflow:'hidden',
height:100 * this.props.size +'px',
width:100 * this.props.size+'px',
top : this.props.position.top + "%",
left : this.props.position.left + "%",
zIndex :this.props.z
}
return (
<Fragment>
<img style={thing} className={'animated '+ this.props.anim + ' infinite'} src={this.props.img} alt="Responsive person"/>
{this.props.children}
</Fragment>
)
}
}
export default Thing
|
import {
DEFAULT_VIDEO_CONSTRAINTS,
SELECTED_AUDIO_INPUT_KEY,
SELECTED_VIDEO_INPUT_KEY,
} from "../../constants";
import { getDeviceInfo, isPermissionDenied } from "../../utils";
import { useCallback, useState } from "react";
import Video from "twilio-video";
export default function useLocalTracks() {
const [audioTrack, setAudioTrack] = useState();
const [videoTrack, setVideoTrack] = useState();
const [isAcquiringLocalTracks, setIsAcquiringLocalTracks] = useState(false);
const getLocalAudioTrack = useCallback((deviceId?) => {
const options = {};
if (deviceId) {
options.deviceId = deviceId;
}
return Video.createLocalAudioTrack(options).then((newTrack) => {
setAudioTrack(newTrack);
return newTrack;
});
}, []);
const getLocalVideoTrack = useCallback(async () => {
const selectedVideoDeviceId = window.localStorage.getItem(
SELECTED_VIDEO_INPUT_KEY,
);
const { videoInputDevices } = await getDeviceInfo();
const hasSelectedVideoDevice = videoInputDevices.some(
(device) =>
selectedVideoDeviceId && device.deviceId === selectedVideoDeviceId,
);
const options = {
...DEFAULT_VIDEO_CONSTRAINTS,
name: `camera-${Date.now()}`,
...(hasSelectedVideoDevice && { deviceId: selectedVideoDeviceId }),
};
return Video.createLocalVideoTrack(options).then((newTrack) => {
setVideoTrack(newTrack);
return newTrack;
});
}, []);
const removeLocalAudioTrack = useCallback(() => {
if (audioTrack) {
audioTrack.stop();
setAudioTrack(undefined);
}
}, [audioTrack]);
const removeLocalVideoTrack = useCallback(() => {
if (videoTrack) {
videoTrack.stop();
setVideoTrack(undefined);
}
}, [videoTrack]);
const getAudioAndVideoTracks = useCallback(async () => {
const {
audioInputDevices,
videoInputDevices,
hasAudioInputDevices,
hasVideoInputDevices,
} = await getDeviceInfo();
if (!hasAudioInputDevices && !hasVideoInputDevices)
return Promise.resolve();
if (isAcquiringLocalTracks || audioTrack || videoTrack)
return Promise.resolve();
setIsAcquiringLocalTracks(true);
const selectedAudioDeviceId = window.localStorage.getItem(
SELECTED_AUDIO_INPUT_KEY,
);
const selectedVideoDeviceId = window.localStorage.getItem(
SELECTED_VIDEO_INPUT_KEY,
);
const hasSelectedAudioDevice = audioInputDevices.some(
(device) =>
selectedAudioDeviceId && device.deviceId === selectedAudioDeviceId,
);
const hasSelectedVideoDevice = videoInputDevices.some(
(device) =>
selectedVideoDeviceId && device.deviceId === selectedVideoDeviceId,
);
// In Chrome, it is possible to deny permissions to only audio or only video.
// If that has happened, then we don't want to attempt to acquire the device.
const isCameraPermissionDenied = await isPermissionDenied("camera");
const isMicrophonePermissionDenied = await isPermissionDenied("microphone");
const shouldAcquireVideo =
hasVideoInputDevices && !isCameraPermissionDenied;
const shouldAcquireAudio =
hasAudioInputDevices && !isMicrophonePermissionDenied;
const localTrackConstraints = {
video: shouldAcquireVideo && {
...DEFAULT_VIDEO_CONSTRAINTS,
name: `camera-${Date.now()}`,
...(hasSelectedVideoDevice && { deviceId: selectedVideoDeviceId }),
},
audio:
shouldAcquireAudio &&
(hasSelectedAudioDevice
? { deviceId: selectedAudioDeviceId }
: hasAudioInputDevices),
};
return Video.createLocalTracks(localTrackConstraints)
.then((tracks) => {
const newVideoTrack = tracks.find((track) => track.kind === "video");
const newAudioTrack = tracks.find((track) => track.kind === "audio");
if (newVideoTrack) {
setVideoTrack(newVideoTrack);
// Save the deviceId so it can be picked up by the VideoInputList component. This only matters
// in cases where the user's video is disabled.
window.localStorage.setItem(
SELECTED_VIDEO_INPUT_KEY,
newVideoTrack.mediaStreamTrack.getSettings().deviceId ?? "",
);
}
if (newAudioTrack) {
setAudioTrack(newAudioTrack);
}
// These custom errors will be picked up by the MediaErrorSnackbar component.
if (isCameraPermissionDenied && isMicrophonePermissionDenied) {
const error = new Error();
error.name = "NotAllowedError";
throw error;
}
if (isCameraPermissionDenied) {
throw new Error("CameraPermissionsDenied");
}
if (isMicrophonePermissionDenied) {
throw new Error("MicrophonePermissionsDenied");
}
})
.finally(() => setIsAcquiringLocalTracks(false));
}, [audioTrack, videoTrack, isAcquiringLocalTracks]);
const localTracks = [audioTrack, videoTrack].filter(
(track) => track !== undefined,
);
return {
localTracks,
getLocalVideoTrack,
getLocalAudioTrack,
isAcquiringLocalTracks,
removeLocalAudioTrack,
removeLocalVideoTrack,
getAudioAndVideoTracks,
};
}
|
import React from "react";
//import myimage from "../../assets/images/nice-piccy3.jpg";
import { withFirebase } from "../Firebase";
import { compose } from "recompose";
import { withRouter } from "react-router-dom";
import { AuthUserContext } from "../Session";
class ListItem1 extends React.Component {
constructor(props) {
super(props);
this.state = {
article: [],
upvotes: [],
downvotes: [],
calculatedvote: [],
upvotecolor: 'gray',
downvotecolor: 'gray',
username: "",
TotallComment: "",
totalcount: 0,
sortType: 'asc',
photoUrl: " "
};
}
componentDidMount() {
const { article } = this.props
// console.log("this is the new article:", article)
let upvotes = article.upvotes;
// console.log("this is the upvotes:" + upvotes)
let downvotes = article.downvotes;
this.calculatedvote(upvotes, downvotes)
let autherId = article.userId;
this.unsubscribe = this.props.firebase
.user(autherId)
.get()
.then(doc => {
console.log("userdata", doc.data())
let user = doc.data()
this.setState({
username: user.username,
photoUrl: user.photoUrl,
})
})
}
componentDidUpdate = (prevProps) => {
if (prevProps.article !== this.props.article) {
this.calculatedvote(this.props.article.upvotes, this.props.article.downvotes)
}
};
checkurl = () => {
// console.log("check url", this.props.article.url)
if (this.props.article.url === true) {
return <a href="{this.props.article.url}" target="_blank" >Related link</a>
}
else {
return null
}
}
calculatedvote(upvotes, downvotes) {
if (upvotes === 0) {
upvotes = []
}
if (downvotes === 0) {
downvotes = []
}
let upvotesTotal = upvotes.length;
let downvotesTotal = downvotes.length;
let finalTotal = upvotesTotal - downvotesTotal;
// console.log("upvotestotal", upvotesTotal)
//console.log("downvotestotal", downvotesTotal)
this.setState({ calculatedvote: finalTotal })
const { article } = this.props;
this.props.firebase
.article(article.uid)
.set({
...article,
calculatedvote: finalTotal
})
}
handleUpvote = (authUser) => {
const { article } = this.props
let initialvote = [authUser.uid];
if (article.upvotes === 0) {
if (this.checkDownvote(authUser.uid, article.downvotes) === -1) {
this.setState({
downvotecolor: 'gray',
upvotecolor: 'darkred'
})
this.props.firebase
.article(article.uid)
.set({
...article,
upvotes: initialvote,
})
// console.log("upvotes", this.upvotes)
}
else {
let uidIndex = this.checkDownvote(authUser.uid, article.downvotes)
let articlearray = article.downvotes;
articlearray.splice(uidIndex, 1)
this.setState({
downvotecolor: 'gray',
upvotecolor: 'darkred'
})
this.props.firebase
.article(article.uid)
.set({
...article,
upvotes: initialvote,
downvotes: articlearray
})
}
}
else {
if (this.checkUpvote(authUser.uid, article.upvotes) === -1) {
if (this.checkDownvote(authUser.uid, article.downvotes) === -1) {
// console.log(this.checkUpvote)
this.setState({
calculatedvote: this.state.calculatedvote + 1,
upvotecolor: 'darkred',
downvotecolor: 'gray'
})
let upvotes = article.upvotes
let updatedUpvotes = upvotes
updatedUpvotes.push(authUser.uid)
this.props.firebase
.article(article.uid)
.set({
...article,
calculatedvote: this.state.calculatedvote + 1,////here i tried to put the updated calculated vote on firebase
upvotes: updatedUpvotes
})
}
else {
// console.log("checkDownvote")
let uidindex = this.checkDownvote(authUser.uid, article.downvotes)
let articlearray = article.downvotes;
this.setState({
downvotecolor: 'gray',
upvotecolor: 'darkred'
})
articlearray.splice(uidindex, 1)
// console.log("article.upvote", article.upvotes)
//let upvotesarray=article.upvotes.push(authUser.uid)
let upvotes = article.upvotes
let updatedUpvotes = upvotes
updatedUpvotes.push(authUser.uid)
this.props.firebase
.article(article.uid)
.set({
...article,
downvotes: articlearray,
upvotes: updatedUpvotes
})
}
}
else {
// console.log("already upvoted")
}
}
}
handleDownvote = (authUser) => {
const { article } = this.props
let initialvote = [authUser.uid];
if (article.downvotes === 0) {
// console.log("typeof", typeof (article.upvotes))
if (this.checkUpvote(authUser.uid, article.upvotes) === -1) {
this.setState({
downvotecolor: 'dodgerblue',
upvotecolor: 'gray'
})
this.props.firebase
.article(article.uid)
.set({
...article,
downvotes: initialvote
})
}
else {
let uidIndex = this.checkUpvote(authUser.uid, article.upvotes)
let articlearray = article.upvotes;
articlearray.splice(uidIndex, 1)
this.setState({
downvotecolor: 'dodgerblue',
upvotecolor: 'gray'
})
this.props.firebase
.article(article.uid)
.set({
...article,
downvotes: initialvote,
upvotes: articlearray
})
}
}
else {
// console.log("checkdownvote", this.checkDownvote(authUser.uid, article.downvotes));
if (this.checkDownvote(authUser.uid, article.downvotes) === -1) {
if (this.checkUpvote(authUser.uid, article.upvotes) === -1) {
this.setState({
calculatedvote: this.state.calculatedvote - 1,
downvotecolor: 'dodgerblue',
upvotecolor: 'gray'
})
let downvotes = article.downvotes
let updatedDownvotes = downvotes
updatedDownvotes.push(authUser.uid)
this.props.firebase
.article(article.uid)
.set({
...article,
calculatedvote: this.state.calculatedvote - 1,//here i tried to put the updated calculated vote on firebase
downvotes: updatedDownvotes
})
}
else {
// console.log("checkDownvote")
let uidindex = this.checkUpvote(authUser.uid, article.upvotes)
this.setState({
downvotecolor: 'dodgerblue',
upvotecolor: 'gray'
})
// console.log("uid", uidindex)
let articlearray = article.upvotes;
articlearray.splice(uidindex, 1)
// console.log("article.downvote", article.downvotes)
//let downvotearray=article.downvotes.push(authUser.uid)
let downvotes = article.downvotes
let updatedDownvotes = downvotes
updatedDownvotes.push(authUser.uid)
this.props.firebase
.article(article.uid)
.set({
...article,
upvotes: articlearray,
downvotes: updatedDownvotes
})
}
}
else {
// console.log("already upvoted")
}
}
}
checkUpvote = (uid, upvotes) => {
// console.log("filter", upvotes, uid)
if (typeof (upvotes) === "number") {
return -1
}
else {
let filteredUpvote = upvotes.indexOf(uid)
// console.log("filteredvote", filteredUpvote)
return filteredUpvote
}
}
checkDownvote = (uid, downvotes) => {
// console.log("filter", downvotes, uid)
// console.log("typeof1", typeof (downvotes))
if (typeof (downvotes) === "number") {
return -1
}
else {
let filteredDownvote = downvotes.indexOf(uid)
// console.log("filteredvote", filteredDownvote)
return filteredDownvote
}
}
render() {
/*const { article } = this.props;
const {sortType}=this.state
if (article) {
article.sort((a, b) => {
const isReversed = (sortType === 'dsc') ? 1 : -1;
return isReversed * a.calculatedvote.localeCompare(b.calculatedvote)
})
}*/
if (this.props.isIndividualView === true) {
return (
<AuthUserContext.Consumer>
{
authUser => (
<div className="likes-individual">
<div className="likes1">
<span style={{
fontSize: "1em",
marginRight: "auto", marginLeft: "auto"
}}>
<div className="upvote-individual"
onClick={() => this.handleUpvote(authUser)}
>
<i className="fas fa-arrow-alt-up" style={{ color: this.state.upvotecolor }}> </i>
</div>
{this.state.calculatedvote}
<div className="downvote-individual"
onClick={() => this.handleDownvote(authUser)}
>
<i className="fas fa-arrow-alt-down" style={{
color: this.state.downvotecolor
}}> </i>
</div>
</span>
</div>
</div>
)}
</AuthUserContext.Consumer>
)
}
else {
return (
<AuthUserContext.Consumer>
{
authUser => (
<div className="Likis-container">
<div className="likes">
<span style={{
fontSize: "1em",
marginRight: "auto", marginLeft: "auto"
}}>
<div className="upvote"
onClick={() => this.handleUpvote(authUser)}
>
<i className="fas fa-arrow-alt-up" style={{ color: this.state.upvotecolor }}> </i>
</div>
{this.state.calculatedvote}
<div className="downvote"
onClick={() => this.handleDownvote(authUser)}
>
<i className="fas fa-arrow-alt-down" style={{
color: this.state.downvotecolor
}}> </i>
</div>
</span>
</div>
{this.props.children}
</div>
)}
</AuthUserContext.Consumer>
)
}
}
}
export default compose(withFirebase, withRouter)(ListItem1);
|
app.controller("LoginController",function($rootScope,$scope,$window,$location,$http){
$scope.submitCustomer = function(){
var user = $scope.username;
var pass = $scope.password;
$http.post("http://iligtas.ph/smartd/login.php",{username:user,password:pass}).then(onUserCompleteUser, onError);
};
$scope.submitDelivery = function(){
var user = $scope.username;
var pass = $scope.password;
$http.post("http://iligtas.ph/smartd/login2.php",{username:user,password:pass}).then(onUserCompleteDelivery, onError);
};
var onUserCompleteUser = function(response){
$scope.user = response.data;
if($scope.user == "false"){
alert("mali");
}else{
localStorage.setItem("user", JSON.stringify($scope.user));
$location.path("/home");
}
}
var onUserCompleteDelivery = function(response){
$scope.user = response.data;
if($scope.user == "false"){
alert("mali");
}else{
localStorage.setItem("delivery", JSON.stringify($scope.user));
$location.path("/deliveryhome");
}
}
var onError = function(reason){
$scope.error = "Error fetching the data. ";
}
});
|
import React, { useState, useEffect } from "react";
import { Container } from "@material-ui/core";
import Typography from "@material-ui/core/Typography";
import CardContent from "@material-ui/core/CardContent";
import { Card } from "@material-ui/core";
import ISPIRITHALEI from "../../../assets/2.png";
import "../../../components/staff-ui/sidebar/sidebar.css";
import Pdf from "react-to-pdf";
import Button from "@material-ui/core/Button";
import empformServices from "../../../services/empForm.service";
import { useParams } from "react-router-dom";
import Grid from "@material-ui/core/Grid";
const ref = React.createRef();
//date generation
var today = new Date();
// var dd = String(today.getDate()).padStart(2, "0");
// var mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0!
// var yyyy = today.getFullYear();
let longMonth = today.toLocaleString("en-us", { month: "long" }); /* June */
function Payslip() {
const id = useParams();
//salary calculation
function total() {
let salary1 = checkRole1().substring(1);
let totalSalary = Number(salary1) + 6.52;
return "$" + totalSalary;
}
//salary check
function checkRole1() {
let salary = "";
if (employee.role === "Doctor") {
salary = "$2500";
} else if (employee.role === "InventoryManager") {
salary = "$800";
} else if (employee.role === "Labassistant") {
salary = "$600";
} else if (employee.role === "Pharmasist") {
salary = "$1000";
} else if (employee.role === "PaymentAdmin") {
salary = "$700";
} else if (employee.role === "Receptionist") {
salary = "$300";
} else if (employee.role === "SysAdmin") {
salary = "$1100";
}
return salary;
}
const initialEmployee = {
id: "",
role: "",
firstName: "",
lastName: "",
email: "",
mobile: "",
address: "",
};
const [employee, setEmployee] = useState(initialEmployee);
//get employee details by id
const getEmployee = (id) => {
empformServices
.getOneEmployee(id)
.then((response) => {
setEmployee(response.data);
})
.catch((e) => {
console.log(e);
});
};
useEffect(() => {
getEmployee(id.id);
}, [id.id]);
return (
<>
<Container>
<React.Fragment>
<Card style={{ width: "70%", margin: "auto" }}>
<div ref={ref}>
<CardContent>
<Grid container spacing={2}>
<Grid item xs={12}>
<div className="logo">
<a className="logo1" href="/">
<img
src={ISPIRITHALEI}
alt="brandLogo"
className="img-logo"
/>
</a>
</div>
</Grid>
<Grid item xs={12}>
<p>NO 647, Utuwakanda,Mawanella</p>
<p>Ispirithalei@outlook.com</p>
<p>Tel: +9411 2696 696/ +9411 269 696</p>
</Grid>
<Grid item xs={12}>
<p>{employee.role}</p>
<p>
{employee.firstName}
{employee.lastName}
</p>
<p>{employee.email}</p>
<p>{employee.address}</p>
</Grid>
<Grid item xs={12}>
<Typography
style={{ textAlign: "center", marginTop: "40px" }}
>
Payslip for {longMonth}
</Typography>
</Grid>
<Typography style={{ marginTop: "10px" }}>
Earnings
</Typography>
<Grid container style={{ marginTop: "10px" }}>
<Grid item xs={10}>
<p>Basic Salary</p>
</Grid>
<Grid item xs={2}>
<p>{checkRole1()}</p>
</Grid>
</Grid>
<Grid container style={{ marginTop: "2px" }}>
<Grid item xs={10}>
<p>House Rent Allowence</p>
</Grid>
<Grid item xs={2}>
<p>$9.45</p>
</Grid>
</Grid>
<Grid container style={{ marginTop: "2px" }}>
<Grid item xs={10}>
<p>Gas Allowence</p>
</Grid>
<Grid item xs={2}>
<p>$6.51</p>
</Grid>
</Grid>
<Typography style={{ marginTop: "20px" }}>
Deductions
</Typography>
<Grid container style={{ marginTop: "10px" }}>
<Grid item xs={10}>
<p>Professional Tax</p>
</Grid>
<Grid item xs={2}>
<p>$5.99</p>
</Grid>
</Grid>
<Grid container style={{ marginTop: "2px" }}>
<Grid item xs={10}>
<p>VAT</p>
</Grid>
<Grid item xs={2}>
<p>$3.45</p>
</Grid>
</Grid>
<Grid container style={{ marginTop: "30px" }}>
<Grid item xs={10}>
<Typography>Total</Typography>
</Grid>
<Grid item xs={2}>
<p>{total()}</p>
</Grid>
</Grid>
</Grid>
</CardContent>
</div>
</Card>
</React.Fragment>
</Container>
<div style={{ marginTop: 20, textAlign: "center", marginBottom: 10 }}>
<Pdf targetRef={ref} filename={"Payslip for month of " + longMonth}>
{({ toPdf }) => (
<Button
size="large"
variant="contained"
color="primary"
type="submit"
onClick={toPdf}
>
Generate Pay Slip
</Button>
)}
</Pdf>
</div>
</>
);
}
export default Payslip;
|
App.Views.Index = (function (_super) {
__extends(Index, _super);
function Index() {
return Index.__super__.constructor.apply(this, arguments);
}
Index.prototype.template = window['JST']['templates/index'];
Index.prototype.initialize = function () {
Index.__super__.initialize.apply(this, arguments);
this.collection.on("sync", this.render, this);
this.collection.fetch({
headers: App.User.Headers
});
};
Index.prototype.render = function () {
console.log(this.collection.models);
this.resetLayouts();
$(this.el).html(this.template({
users: this.collection.models
}));
return this;
};
return Index;
})(App.Views);
|
import React, { useState, useEffect } from 'react';
import { withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import { isRequired } from 'calidators';
import Index from '../Index/index';
import TextInput from '../../components/TextInput';
import TextArea from '../../components/TextArea';
import Modal from '../../components/Modal';
import MultiSelect from '../../components/MultiSelect';
import RadioButtonGroup from '../../components/RadioButtonGroup';
import Checkbox from '../../components/Checkbox';
import Button from '../../components/Button';
import action from '../../actions';
import '../Index/index.scss';
import './index.scss';
import boostrapImg from '../../assets/bootstrap.svg';
import htmlImg from '../../assets/html.svg';
const CreateProject = ({
history,
user,
tags,
createProject,
getAllTags,
addTag,
}) => {
useEffect(() => {
getAllTags({
token: user.token,
});
}, []);
const privacyOptions = ['公開', '私人'];
const [projectTitle, setProjectTitle] = useState('');
const [projectDesc, setProjectDesc] = useState('');
const [projectTemplate, setProjectTemplate] = useState(['']);
const [projectPrivacy, setProjectPrivacy] = useState('公開');
const [projectTags, setProjectTags] = useState([]);
const projectTitleValidator = isRequired({ message: '請輸入專案標題' })(
projectTitle,
);
const handleSelectProjectTemplate = (template) => {
const index = projectTemplate.indexOf(template);
if (index !== -1) {
setProjectTemplate(projectTemplate.filter((item) => item !== template));
} else {
setProjectTemplate([template, ...projectTemplate]);
}
};
const createProjectHandler = () => {
const projectTagsData = projectTags.map((t) => t.toLowerCase());
const projectData = {
m_no: user.m_no,
token: user.token,
title: projectTitle,
desc: projectDesc,
privacy: projectPrivacy === '公開',
tags: projectTagsData.toString(),
snippets: projectTemplate,
};
if (JSON.stringify(projectTagsData) !== JSON.stringify(tags)) {
projectTagsData.map((tag) => {
if (!tags.includes(tag)) {
addTag({
token: user.token,
tagName: tag,
});
}
});
}
createProject(projectData, history);
};
return (
<div className="CreateProject">
<Index needAuth={false} />
<Modal
isOpen
shouldCloseOnEsc={false}
shouldCloseOnClickOutside={false}
showControlBtn={false}
title="新增專案"
onClose={() => history.goBack()}
className="CreateProjectModal"
>
<div className="createProjectForm">
<div className="createProjectForm__information">
<p className="createProjectForm__information__title">專案資訊</p>
<TextInput
title="標題"
type="text"
text={projectTitle}
onChange={(e) => setProjectTitle(e.target.value)}
required
/>
<MultiSelect
title="類別"
options={tags}
selectedItems={projectTags}
onChange={setProjectTags}
/>
<TextArea
title="描述"
text={projectDesc}
onChange={(e) => setProjectDesc(e.target.value)}
maxHeight={80}
/>
<RadioButtonGroup
title="隱私"
name="privacy"
options={privacyOptions}
value={projectPrivacy}
onChange={setProjectPrivacy}
required
/>
</div>
<div className="createProjectForm__template">
<p className="createProjectForm__template__title">選擇模板</p>
<div className="createProjectForm__template__option">
<Checkbox
name="templateCheckbox"
checked={projectTemplate.indexOf('Bootstrap') !== -1}
onChange={() => handleSelectProjectTemplate('Bootstrap')}
/>
<span className="optionText">
<img src={boostrapImg} alt="bootstrap_icon" />
<div className="iconBackground bootstrap" />
Bootstrap
</span>
</div>
<div className="createProjectForm__template__option">
<Checkbox
name="templateCheckbox"
checked={projectTemplate.indexOf('HTML5') !== -1}
onChange={() => handleSelectProjectTemplate('HTML5')}
/>
<span className="optionText">
<img src={htmlImg} alt="html_icon" />
<div className="iconBackground html" />
HTML5
</span>
</div>
<div className="createProjectForm__template__button-group">
<Button
className="cancel_btn"
text="取消"
type="outline"
size="small"
onClick={() => history.goBack()}
/>
<Button
className="createProject_btn"
text="新增"
type="primary"
size="small"
onClick={createProjectHandler}
disabled={projectTitleValidator !== null}
/>
</div>
</div>
</div>
</Modal>
</div>
);
};
const mapStateToProps = (store) => ({
editor: store.editor,
user: store.user,
project: store.project,
tags: store.tags,
});
export default withRouter(
connect(
mapStateToProps,
action,
)(CreateProject),
);
|
Backbone.Context = Backbone.Model.extend({
initialize: function(attributes, options) {
}
})
var UsersController = Backbone.Controller.extend({
routes: {
"": "index",
"users": "index",
"users/:id": "show"
},
initialize: function(options) {
this.context = new Backbone.Context();
this.context.set({ users: new UserCollection() });
},
index: function() {
this.context.get('users').fetch();
},
show: function(id) {
var self = this;
var collection = this.context.get('users');
var user = collection.get(id);
if (!user) {
user = new User({ id: id });
user.fetch();
};
this.context.set({user: user});
}
});
|
export const AddToDo = async(data)=>{
const bearer = 'Bearer '+ localStorage.getItem('token');
const response = await fetch("http://localhost:5000/user/addTodo",{
method:'post',
headers:{
'Content-Type':'application/json',
'Authorization':bearer
},
body:JSON.stringify({item:data})
});
const json = await response.json();
return json;
}
export const GetTodo = async()=>{
const bearer = 'Bearer '+localStorage.getItem('token');
const response = await fetch("http://localhost:5000/user/getTodo",{
method:'get',
headers:{
'Content-Type':'application/json',
'Authorization':bearer
}
});
const json = await response.json();
return json;
}
export const GetTodoById = async(id)=>{
const bearer = 'Bearer '+localStorage.getItem('token');
const response = await fetch(`http://localhost:5000/user/getTodo/${id}`,{
method:'get',
headers:{
'Content-Type':'application/json',
'Authorization':bearer
}
});
const json = await response.json();
return json;
}
export const UpdateTaskData = async(data)=>{
const bearer = 'Bearer '+localStorage.getItem('token');
const response = await fetch(`http://localhost:5000/user/updateTodo`,{
method:'post',
headers:{
'Content-Type':'application/json',
'Authorization':bearer
},
body:JSON.stringify(data)
});
const json = await response.json();
return json;
}
export const DeleteTodo = async(data)=>{
const bearer = 'Bearer '+localStorage.getItem('token');
const response = await fetch(`http://localhost:5000/user/deleteTodo`,{
method:'post',
headers:{
'Content-Type':'application/json',
'Authorization':bearer
},
body:JSON.stringify({task:data})
});
const json = await response.json();
return json;
}
|
var request = require('request');
var checksum = require('../../model/checksum');
var config = require('../../config/config');
var index = require('../../index');
var session = require('express-session');
module.exports = function (app) {
app.use(session({ secret: 'secretBIT', cookie: { maxAge: 1200000 }}))
app.get('/testtxn', function(req,res){
var sess = req.session;
url = 'http://35.154.28.117:3000/api/blocking/'+req.param("id");
request(url, function(error, response, html){
console.log(response.body);
console.log(config);
console.log('dddddddddddddddddddddddddddd');
sess.bookingId=req.param("id");
sess.seats=req.param("seat");
var seats=req.param("seat");
var noOfSeats=seats.split(',').length;
var movieDetails=JSON.parse(response.body);
movieDetails.noOfSeats=noOfSeats;
movieDetails.bookingId=req.param("id");
movieDetails.seats=seats;
sess.movieDetails=movieDetails;
res.render('testtxn.ejs',{'config' : config,'movieDetails':movieDetails});
});
});
app.post('/testtxn',function(req, res) {
console.log("POST Order start");
var sess = req.session;
var paramlist = req.body;
var paramarray = new Array();
var d = new Date();
var n = Math.random()*100000000000000000;
console.log('randommmmm---------------------------------------------------mmmmmmmmmmmmmmmm',n);
//paramarray['MID']=config.MID;
//paramarray['PAYTM_MERCHANT_KEY']=config.PAYTM_MERCHANT_KEY;
//paramarray['WEBSITE']=config.WEBSITE;
//paramarray['CHANNEL_ID']=config.CHANNEL_ID;
//paramarray['INDUSTRY_TYPE_ID']=config.CHANNEL_ID;
//paramarray['TXN_AMOUNT']=1.00;
sess.name=paramlist.name;
sess.mobile=paramlist.mobile;
sess.email=paramlist.email;
console.log('ppppppppppppppppppppppppppppppppppppppppppp');
console.log(paramlist);
for (name in paramlist)
{
if (name == 'PAYTM_MERCHANT_KEY') {
var PAYTM_MERCHANT_KEY = paramlist[name] ;
}else if (!(name == 'name' ||name == 'mobile'||name == 'email')){
paramarray[name] = paramlist[name] ;
}
}
paramarray['CUST_ID']=n+'bbb';
paramarray['ORDER_ID']=n+'';
console.log('qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq');
console.log(paramarray);
console.log('rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr');
paramarray['CALLBACK_URL'] = 'http://35.154.28.117:3000/response'; // in case if you want to send callback
checksum.genchecksum(paramarray, PAYTM_MERCHANT_KEY, function (err, result)
{
console.log(result);
res.render('pgredirect.ejs',{ 'restdata' : result });
});
});
//vidisha
};
|
function drawMultiLineChart(Data, DivID, RevenueName) {
var margin = {
top: 10,
right: 80,
bottom: 30,
left: 90
},
width = 630 - margin.left - margin.right,
height = 260 - margin.top - margin.bottom;
// var parseDate = d3.time.format("%d-%b");
// var parseDate = d3.time.format("%Y-%m-%d");
var x = d3.scale.ordinal()
.rangeRoundBands([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var colors = ['#69c242', '#64bbe3', '#ffcc00', '#ff7300', '#cf2030'];
// Do not include a domain
var color = d3.scale.ordinal()
.range(colors);
// var color = d3.scale.category10();
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.tickFormat(function (d){
monthname = GetMonthName(d);
return monthname.substring(0, 3);
});
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.ticks(6)
.tickFormat(d3.format("s"));
// .tickFormat(function (d){
// return numberFormat(d, 0);
// });
// xData gives an array of distinct 'Weeks' for which trends chart is going to be made.
var xData = Data[0].values.map(function(d) {
return d.month
});
var line = d3.svg.line()
// .interpolate("basis")
.x(function(d) { return x(d.month) + x.rangeBand() / 2; })
.y(function(d) { return y(d.revenue); });
var svg = d3.select("#" + DivID).append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
//Colors
color.domain(Data.map(function(d) {
return d.key;
}));
x.domain(xData);
var valueMax = d3.max(Data, function(r) {
return d3.max(r.values, function(d) {
return d.revenue;
})
});
var valueMin = d3.min(Data, function(r) {
return d3.min(r.values, function(d) {
return d.revenue;
})
});
y.domain([valueMin, valueMax]);
//Drawing X Axis
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
// Drawing Horizontal grid lines.
svg.append("g")
.attr("class", "GridX")
.selectAll("line.grid").data(y.ticks()).enter()
.append("line")
.attr({
"class": "grid",
"x1": x(xData[0]),
"x2": x(xData[xData.length - 1]) + x.rangeBand() / 2,
"y1": function(d) {
return y(d);
},
"y2": function(d) {
return y(d);
}
});
// Drawing Y Axis
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dx", "-4.5em")
.attr("dy", "-5.5em")
.style("text-anchor", "end")
.text(RevenueName);
// Drawing Lines for each segments
var segment = svg.selectAll(".segment")
.data(Data)
.enter().append("g")
.attr("class", "segment");
segment.append("path")
.attr("id", function(d) {
return d.key; })
.attr("visible", 1)
.attr("d", function(d) {
return line(d.values); })
.style("stroke", function(d) {
if(d.key == "2018"){
colorChange();
}else {
return color(d.key);
}
})
// .attr("stroke", "green")
.attr("stroke-width", 2)
.attr("fill", "none")
.attr('class', 'line');
function colorChange(){
segment.append("path")
.attr("d", function(d) {
return line(d.values.filter(function(d){
return d.DataType == "Actuals" && d.key == "2018";
}))
})
.style("stroke", "#64bbe3")
.attr("stroke-width", 2)
.attr("fill", "none")
.attr('class', 'line');
segment.append("path")
.attr("d", function(d) {
return line(d.values.filter(function(d){
return d.DataType == "Forecast";}))
})
.attr("stroke", "#eed202")
.attr("stroke-width", 2)
.attr("fill", "none");
}
// Creating Dots on line
segment.selectAll("dot")
.data(function(d) {
return d.values;
})
.enter().append("circle")
.attr("r", 5)
.attr("cx", function(d) {
return x(d.month) + x.rangeBand() / 2;
})
.attr("cy", function(d) {
return y(d.revenue);
})
.style("stroke", "white")
.style("fill", function(d) {
if(d.DataType == "Actuals"){
return color(this.parentNode.__data__.key);
}else{
return "#eed202";
}
})
.on("mouseover", mouseover)
// .on('mouseover', tip.show)
.on("mousemove", function(d) {
divToolTip
.text(this.parentNode.__data__.key + " : " + numberFormat(d.revenue, 2)) // here we using numberFormat function from Dashboard-indicator.js
.style("left", (d3.event.pageX + 15) + "px")
.style("top", (d3.event.pageY - 10) + "px");
})
.on("mouseout", mouseout);
// .on('mouseout', tip.hide)
segment.append("text")
.datum(function(d) {
return {
name: d.key,
RevData: d.values[d.values.length - 1]
};
})
.attr("transform", function(d) {
var xpos = x(d.RevData.month) + x.rangeBand() / 2;
return "translate(" + xpos + "," + y(d.RevData.revenue) + ")";
})
.attr("x", 8)
.attr("dy", ".38em")
.attr("class", "segmentText")
.style('font-size','14px')
.style('font-weight', 'bold')
.attr("Segid", function(d) {
return d.name;
})
.text(function(d) {
return d.name;
});
d3.selectAll(".segmentText").on("click", function(d) {
var tempId = d3.select(this).attr("Segid");
var flgVisible = d3.select("#" + tempId).attr("visible");
var newOpacity = flgVisible == 1 ? 0 : 1;
flgVisible = flgVisible == 1 ? 0 : 1;
// Hide or show the elements
d3.select("#" + tempId).style("opacity", newOpacity)
.attr("visible", flgVisible);
});
// Adding Tooltip
var divToolTip = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 1e-6);
function mouseover() {
divToolTip.transition()
.duration(500)
.style("opacity", 1);
}
function mouseout() {
divToolTip.transition()
.duration(500)
.style("opacity", 1e-6);
}
}
//Avgfare Multiline chart start
function drawAvgFareMultiLineChart(Data, DivID, AvgfareName) {
var margin = {
top: 10,
right: 80,
bottom: 30,
left: 80
},
width = 630 - margin.left - margin.right,
height = 260 - margin.top - margin.bottom;
// var parseDate = d3.time.format("%d-%b");
// var parseDate = d3.time.format("%Y-%m-%d");
var x = d3.scale.ordinal()
.rangeRoundBands([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
// var color = d3.scale.category10();
var colors = ['#69c242', '#64bbe3', '#ffcc00', '#ff7300', '#cf2030'];
// Do not include a domain
var color = d3.scale.ordinal()
.range(colors);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.tickFormat(function (d){
monthname = GetMonthName(d);
return monthname.substring(0, 3);
});
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.ticks(6)
.tickFormat(d3.format("s"));
// .tickFormat(function (d){
// return numberFormat(d, 0);
// });
// xData gives an array of distinct 'Weeks' for which trends chart is going to be made.
var xData = Data[0].values.map(function(d) {
return d.month
});
var line = d3.svg.line()
// .interpolate("basis")
.x(function(d) { return x(d.month) + x.rangeBand() / 2; })
.y(function(d) { return y(d.avgfare); });
var svg = d3.select("#" + DivID).append("svg")
// .attr("width", width + margin.left + margin.right)
// .attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
//Colors
color.domain(Data.map(function(d) {
return d.key;
}));
x.domain(xData);
var valueMax = d3.max(Data, function(r) {
return d3.max(r.values, function(d) {
return d.avgfare;
})
});
var valueMin = d3.min(Data, function(r) {
return d3.min(r.values, function(d) {
return d.avgfare;
})
});
y.domain([valueMin, valueMax]);
//Drawing X Axis
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
// Drawing Horizontal grid lines.
svg.append("g")
.attr("class", "GridX")
.selectAll("line.grid").data(y.ticks()).enter()
.append("line")
.attr({
"class": "grid",
"x1": x(xData[0]),
"x2": x(xData[xData.length - 1]) + x.rangeBand() / 2,
"y1": function(d) {
return y(d);
},
"y2": function(d) {
return y(d);
}
});
// Drawing Y Axis
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dx", "-4.5em")
.attr("dy", "-5em")
.style("text-anchor", "end")
.text(AvgfareName);
// Drawing Lines for each segments
var segment = svg.selectAll(".segment")
.data(Data)
.enter().append("g")
.attr("class", "segment");
segment.append("path")
.attr("id", function(d) {
return d.key; })
.attr("visible", 1)
.attr("d", function(d) {
return line(d.values); })
.style("stroke", function(d) {
if(d.key == "2018"){
colorChange();
}else {
return color(d.key);
}
})
// .attr("stroke", "green")
.attr("stroke-width", 2)
.attr("fill", "none")
.attr('class', 'line');
function colorChange(){
segment.append("path")
.attr("d", function(d) {
return line(d.values.filter(function(d){
return d.DataType == "Actuals" && d.key == "2018";
}))
})
.style("stroke", "#64bbe3")
.attr("stroke-width", 2)
.attr("fill", "none")
.attr('class', 'line');
segment.append("path")
.attr("d", function(d) {
return line(d.values.filter(function(d){
return d.DataType == "Forecast";}))
})
.attr("stroke", "#eed202")
.attr("stroke-width", 2)
.attr("fill", "none");
}
// Creating Dots on line
segment.selectAll("dot")
.data(function(d) {
return d.values;
})
.enter().append("circle")
.attr("r", 5)
.attr("cx", function(d) {
return x(d.month) + x.rangeBand() / 2;
})
.attr("cy", function(d) {
return y(d.avgfare);
})
.style("stroke", "white")
.style("fill", function(d) {
if(d.DataType == "Actuals"){
return color(this.parentNode.__data__.key);
}else{
return "#eed202";
}
})
.on("mouseover", mouseover)
// .on('mouseover', tip.show)
.on("mousemove", function(d) {
divToolTip
.text(this.parentNode.__data__.key + " : " + numberFormat(d.avgfare, 2)) // here we using numberFormat function from Dashboard-indicator.js
.style("left", (d3.event.pageX + 15) + "px")
.style("top", (d3.event.pageY - 10) + "px");
})
.on("mouseout", mouseout);
// .on('mouseout', tip.hide)
segment.append("text")
.datum(function(d) {
return {
avgname: d.key,
avgfareData: d.values[d.values.length - 1]
};
})
.attr("transform", function(d) {
var xpos = x(d.avgfareData.month) + x.rangeBand() / 2;
return "translate(" + xpos + "," + y(d.avgfareData.avgfare) + ")";
})
.attr("x", 8)
.attr("dy", ".38em")
.attr("class", "segmentText")
.style('font-size','14px')
.style('font-weight', 'bold')
.attr("Segid", function(d) {
return d.avgname;
})
.text(function(d) {
return d.avgname;
});
d3.selectAll(".segmentText").on("click", function(d) {
var tempId = d3.select(this).attr("Segid");
var flgVisible = d3.select("#" + tempId).attr("visible");
var newOpacity = flgVisible == 1 ? 0 : 1;
flgVisible = flgVisible == 1 ? 0 : 1;
// Hide or show the elements
d3.select("#" + tempId).style("opacity", newOpacity)
.attr("visible", flgVisible);
});
// Adding Tooltip
var divToolTip = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 1e-6);
function mouseover() {
divToolTip.transition()
.duration(500)
.style("opacity", 1);
}
function mouseout() {
divToolTip.transition()
.duration(500)
.style("opacity", 1e-6);
}
}
|
const loader = require('bozoid-command-loader')
exports.eventGroup = 'onMessage'
exports.command = 'listmodules'
exports.description = 'List all modules & status'
function makeString(inStr, text){
let addStr = '`' + text + '` '
/*let split = inStr.split('\n')
console.log(split[split.length-1].length)
if(addStr.length + split[split.length-1].length > 60){
inStr += '\n'
}*/
inStr += addStr
return inStr
}
exports.script = function(cmd, msg){
let erroredStr = ''
let disabledStr = ''
let enabledStr = ''
let numErrored = 0
let numDisabled = 0
let numEnabled = 0
for(let erroredModulePath of loader.erroredModules){
//console.log('Errored: ' + erroredModulePath)
erroredStr = makeString(erroredStr, erroredModulePath)
numErrored++
}
for(let disabledModule of loader.disabledModuleStore){
//console.log('Disabled: ' + disabledModule.path)
disabledStr = makeString(disabledStr, disabledModule.path)
numDisabled++
}
for(let moduleChapter of Object.keys(loader.moduleStore)){
for(let enabledModule of loader.moduleStore[moduleChapter]){
//console.log('Enabled: ' + enabledModule.path)
enabledStr = makeString(enabledStr, enabledModule.path)
numEnabled++
}
}
let oStr = ''
if(erroredStr){
oStr += ':red_circle: ERRORED (' + numErrored +')\n' + erroredStr + '\n'
}
if(disabledStr){
oStr += ':orange_circle: DISABLED (' + numDisabled +')\n' + disabledStr + '\n'
}
if(enabledStr){
oStr += ':green_circle: ENABLED (' + numEnabled +')\n' + enabledStr
}
msg.channel.send(oStr)
}
//EOF
|
self.__precacheManifest = [
{
"revision": "fa3b3379364551d9100a544850f1bf70",
"url": "/lol-builds/static/media/jesusGirando.fa3b3379.gif"
},
{
"revision": "ea683c0c38e54716a743",
"url": "/lol-builds/static/js/runtime~main.84e1de9c.js"
},
{
"revision": "d951ad7de2ffa91d477c",
"url": "/lol-builds/static/js/main.d3cd52a9.chunk.js"
},
{
"revision": "18e5b9e1e3ae700efe5b",
"url": "/lol-builds/static/js/2.fa126bcd.chunk.js"
},
{
"revision": "d951ad7de2ffa91d477c",
"url": "/lol-builds/static/css/main.a8bd8af0.chunk.css"
},
{
"revision": "183418102a770e97954decd8730fe8e3",
"url": "/lol-builds/index.html"
}
];
|
const inputEl = document.querySelector("#validation-input");
let lengthValue = Number(inputEl.dataset.length);
// console.log(typeOf validLength);
inputEl.addEventListener("blur", lengthInput);
function lengthInput(event) {
const inputValue = event.target.value;
if (inputValue.length !== lengthValue) {
inputEl.classList.remove("valid");
inputEl.classList.add("invalid");
} else {
inputEl.classList.remove("invalid");
inputEl.classList.add("valid");
}
}
|
import React from 'react'
import "../styles/Python.css"
function Csharp() {
return (
<div>
{/* cSharp Header, with title and caption START */}
<header className="jumbotron jumbotron-fluid bg-dark">
<div className="container-fluid text-center">
<h1 className="display-3">C# </h1>
<p className="lead pb-4">
C# syntax is highly expressive, yet it's also simple and easy to learn.
</p>
<p>
<a href="#lang" className="btn btn-danger btn-lg mybtn2" role="button">
Scroll
</a>
</p>
</div>
</header>
{/* cSharp Header, with title and caption END */}
{/* FREE COURSES SECTION */}
<section className="language-info" id="lang">
<div className="container">
<br />
{/* title */}
<h3 className="text-center">Free Courses/Tutorials</h3>
<br />
<div className="row">
<div className="col-md-6">
<div className="list-group">
<div className="list-group-item list-group-item-action disabled text-light titleBgCSharp">
C# Basics
</div>
{/* cSharp COURSE LINKS HERE / FIND AND ADD LINK HERE */}
<div className="embed-responsive embed-responsive-16by9">
<iframe className="embed-responsive-item" src="https://www.youtube.com/embed/GhQdlIFylQ8" ></iframe>
</div>
<a href="https://www.youtube.com/watch?v=GhQdlIFylQ8&ab_channel=freeCodeCamp.org" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Tutorial - Full Course for Beginners<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">freeCodeCamp</strong><strong className="badge badge-success p-1 rounded">Beginner</strong></a>
<a href="https://www.codecademy.com/learn/learn-c-sharp" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Learn C#<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">codecademy</strong><strong className="badge badge-success p-1 rounded">Beginner</strong></a>
<a href="https://www.tutorialspoint.com/csharp/csharp_basic_syntax.htm" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# - Basic Syntax<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">tutorialspoint</strong></a>
<a href="https://www.youtube.com/watch?v=gfkTfcpWqAY&ab_channel=ProgrammingwithMosh" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Tutorial For Beginners<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Programming with Mosh</strong></a>
<a href="https://www.w3schools.com/cs/default.asp" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Tutorial<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">w3schools</strong></a>
<a href="https://channel9.msdn.com/Series/C-Fundamentals-for-Absolute-Beginners" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Fundamentals for Absolute Beginners<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">JeffKoch</strong></a>
<a href="https://www.sololearn.com/Course/CSharp/" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Course<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">SoloLearn</strong></a>
<a href="https://www.youtube.com/watch?v=pSiIHe2uZ2w&list=PLPV2KyIb3jR6ZkG8gZwJYSjnXxmfPAl51&index=1&ab_channel=Brackeys" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">How to program in C# - BASICS Beginner Tutorial<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Brackeys</strong></a>
<a href="https://www.learncs.org/en/Welcome" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Learn the Basics - Interactive<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">learnCS</strong></a>
<a href="https://www.youtube.com/watch?v=qOruiBrXlAw&ab_channel=CalebCurry" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Programming All-in-One Tutorial Series (6 HOURS!)<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Caleb Curry</strong></a>
<a href="https://dotnet.microsoft.com/learn/csharp" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Learn C# | dotNet<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">dotnet Microsoft</strong></a>
</div>
<br />
</div>
<div className="col-md-6">
<div className="list-group">
<div className="list-group-item list-group-item-action disabled text-light titleBgCSharp">
Windows applications
</div>
{/* cSharp COURSE LINKS HERE / FIND AND ADD LINK HERE */}
{/* windows development */}
<a href="https://www.youtube.com/watch?v=GcFJjpMFJvI&ab_channel=TraversyMedia" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Build a C# .NET Application in 60 Minutes<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Traversy Media</strong></a>
<a href="https://www.youtube.com/watch?v=BfEjDD8mWYg&ab_channel=freeCodeCamp.org" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">ASP.NET Core Crash Course - C# App in One Hour<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">freeCodeCamp</strong></a>
<a href="https://www.youtube.com/watch?v=FsARbeqMrtw&ab_channel=Udemy" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# For Beginners: Create Your First C# App<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Charlie Chiarelli</strong></a>
<a href="https://www.youtube.com/watch?v=E7Voso411Vs&ab_channel=ProgrammingwithMosh" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Step-by-step ASP.NET MVC Tutorial for Beginners<strong className="courseBy2 text-purple p-1 rounded m-1">Programming with Mosh</strong></a>
</div>
<div className="alert alert-custom p-1 text-center">If you know any more tutorials, please do contact me!</div>
<br />
</div>
<div className="col-md-6">
<div className="list-group">
<div className="list-group-item list-group-item-action disabled text-light titleBgCSharp">
Games Development <i className="fas fa-gamepad-alt"></i>
</div>
{/* cSharp COURSE LINKS HERE / FIND AND ADD LINK HERE */}
{/* game development */}
<div className="embed-responsive embed-responsive-16by9">
<iframe className="embed-responsive-item" src="https://www.youtube.com/embed/N775KsWQVkw"></iframe>
</div>
<a href="https://www.youtube.com/playlist?list=PLPV2KyIb3jR4u6zeBY77WPj0KuFdmv84g" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Make a Game - Unity Course<strong className="brackeys bg-dark p-1 rounded m-1">Brackeys</strong></a>
<a href="https://www.youtube.com/playlist?list=PLPV2KyIb3jR6TFcFuzI2bB7TMNIIBpKMQ" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">How to make a 2D Game<strong className="brackeys bg-dark p-1 rounded m-1">Brackeys</strong></a>
<a href="https://www.youtube.com/playlist?list=PLPV2KyIb3jR53Jce9hP7G5xC4O9AgnOuL" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">How to make a Video Game<strong className="brackeys bg-dark p-1 rounded m-1">Brackeys</strong></a>
<a href="https://learn.unity.com/tutorials" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# Unity Tutorials<strong className="courseBy2 text-white bg-dark p-1 rounded m-1"><i className="fab fa-unity"></i></strong></a>
<a href="https://learn.unity.com/" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Start at the beginning<strong className="courseBy2 text-white bg-dark p-1 rounded m-1"><i className="fab fa-unity"></i></strong></a>
<a href="https://noobtuts.com/unity" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Unity Tutorials<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">noobtuts</strong></a>
<a href="https://www.youtube.com/playlist?list=PLFt_AvWsXl0fnA91TcmkRyhhixX9CO3Lw" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Introduction to Game Development (Unity and C#)<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Sebastian Lague</strong></a>
<a href="https://www.youtube.com/playlist?list=PLb34wPRpZdVevgA60IIJ5pQi4RCR264FU" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Survival Game Tutorials in Unity 5<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">SpeedTutor</strong></a>
<a href="https://catlikecoding.com/" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">C# scripting for Unity<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">catlikecoding <span className="badge bg-dark text-white"><i className="fas fa-paw"></i></span></strong></a>
<a href="https://channel9.msdn.com/Blogs/raw-tech/Make-Your-First-Unity2D-Pong-Game" target="_blank" rel="noopener noreferrer" className="list-group-item list-group-item-action">Make Your First Unity2D Pong Game<strong className="courseBy2 text-purple bg-secondary p-1 rounded m-1">Stacey Mulcahy</strong></a>
</div>
<br />
</div>
</div>
</div>
<br />
</section>
{/* FREE COURSES SECTION end */}
<section id="gameDeveloper">
<div className="container">
<h2 className="text-center">Game Developers</h2>
<center>
<span className="badge subText">Subscribe</span>
</center>
<div className="row col-md-12 justify-content-center gamedev">
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UCYbK_tjZ2OrIZFBvU6CCMiA" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Brackeys
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UCIabPXjvT5BVTxRDPCBBOOQ" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Dani
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UC9Z1XWw1kmnvOOFsj6Bzy2g" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Blackthornprod
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UCORkUj9eaM2aDJM1VYyDDTA" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Sam Hogan
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UCuHVjteDW9tCb8QqMrtGvwQ" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Thomas Brush
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UCd_lJ4zSp9wZDNyeKCWUstg" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Ask Gamedev
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UC_p_9arduPuxM8DHTGIuSOg" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Jonas Tyroller
</div>
</a>
</div>
<div className="card rounded-pill" style={{width:"250px"}}>
<a href="https://www.youtube.com/channel/UCKCTmact-90hXpV2ns8GSsA" target="_blank" rel="noopener noreferrer" style={{textDecoration:"none", color:"black"}}>
<div className="card-body text-center">
Dev Duck
</div>
</a>
</div>
<a href="/developers">visit developers page</a>
</div>
</div>
</section>
<section className="ideForCsharp bg-dark">
<div className="container">
<h2 className="text-center text-light p-4">Recommended IDE for C#</h2>
<div className="row col-md-12 justify-content-center ides">
{/* IDE CARDS */}
<div className="card ideCard" style={{width:"9.5rem"}}>
<img className="card-img-top mx-auto" src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Visual_Studio_2017_Logo.svg/1200px-Visual_Studio_2017_Logo.svg.png" alt="Card image cap" />
<div className="card-body">
<p className="card-text">Microsoft Visual Studio</p>
</div>
</div>
<div className="card ideCard" style={{width:"9.5rem"}}>
<img className="card-img-top mx-auto" src="https://resources.jetbrains.com/storage/products/rider/img/meta/rider_logo_300x300.png" alt="Card image cap" />
<div className="card-body">
<p className="card-text">Rider</p>
</div>
</div>
<div className="card ideCard" style={{width:"9.5rem"}}>
<img className="card-img-top mx-auto" src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/Monodevelop_Logo.svg/1200px-Monodevelop_Logo.svg.png" alt="Card image cap" />
<div className="card-body">
<p className="card-text">MonoDevelop</p>
</div>
</div>
<div className="card ideCard" style={{width:"9.5rem"}}>
<img className="card-img-top mx-auto" src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Visual_Studio_Code_1.18_icon.svg/1200px-Visual_Studio_Code_1.18_icon.svg.png" alt="Card image cap" />
<div className="card-body">
<p className="card-text">Visual Studio Code</p>
</div>
</div>
<div className="card ideCard" style={{width:"9.5rem"}}>
<img className="card-img-top mx-auto" src="https://upload.wikimedia.org/wikipedia/commons/5/59/Sharpdevelop_Logo.jpg" alt="Card image cap" />
<div className="card-body">
<p className="card-text">SharpDevelop</p>
</div>
</div>
</div>
</div>
</section>
</div>
)
}
export default Csharp
|
var async = require('async');
var census = require('./../census');
var db = require('./../database');
module.exports.lookupOutfitsByName = function (name, limit, callback) {
var findParams = {
where: {
$or: [
{ alias: name },
{
name: {
$like: '%' + name + '%'
}
}
]
},
limit: Number(limit) || 12
};
db.Outfit.findAll(findParams)
.then(function (data) {
var jsonData = data.map(function (d) {
return d.toJSON();
});
callback(null, jsonData);
})
.catch(function (error) {
callback(error);
});
};
module.exports.getOutfitById = function (id, callback) {
getOutfitById(id, function (error, outfit) {
callback(error, outfit ? outfit.toJSON() : null);
});
};
module.exports.getOutfitFullById = function (id, callback) {
getOutfitFullById(id, function (error, outfit) {
callback(error, outfit ? outfit.toJSON() : null);
});
};
module.exports.getOutfitMembers = function (id, callback) {
getOutfitById(id, function (error, outfit) {
var options = {
include: [
{
model: db.Character,
include: [
{
model: db.CharacterStat,
where: { profileId: 0 }
},
{
model: db.CharacterStatByFaction,
where: { profileId: 0 }
}
]
}
]
};
outfit.getOutfitMembers(options)
.then(function (results) {
var data = results.map(function (d) {
return d.toJSON();
});
data.forEach(function (d) {
var char = d.Character;
d.name = char.name;
d.battleRank = char.battleRank;
d.certsEarned = char.certsEarned;
d.createdDate = char.createdDate;
d.lastLoginDate = char.lastSaveDate;
d.minutesPlayed = char.minutesPlayed;
d.lifetimeStats = {};
if (char.CharacterStats) {
char.CharacterStats.forEach(function (stat) {
d.lifetimeStats[stat.stat] = Number(stat.valueForever);
});
}
if (char.CharacterStatByFactions) {
char.CharacterStatByFactions.forEach(function (stat) {
d.lifetimeStats[stat.stat] = Number(stat.valueForeverVs) + Number(stat.valueForeverNc) + Number(stat.valueForeverTr);
});
}
delete d.Character;
if (d.lifetimeStats.facility_capture_count && d.lifetimeStats.facility_defended_count) {
d.lifetimeStats.siege_level = d.lifetimeStats.facility_capture_count / d.lifetimeStats.facility_defended_count * 100;
}
});
callback(error, data);
})
.catch(function (error) {
callback(error);
})
});
};
module.exports.updateOutfitById = function (outfitId, callback) {
updateOutfitById(outfitId, callback);
};
module.exports.findOutfits = function (outfitIds, callback) {
var options = {
where: {
id: outfitIds
},
attributes: ['id', 'name', 'alias', 'factionId']
};
db.Outfit.findAll(options).then(function (outfits) {
var jsonData = outfits.map(function (d) {
return d.toJSON();
});
callback(null, jsonData);
}).catch(function (error) {
callback(error);
});
};
function createDateAsUTC(date) {
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
}
function getOutfitById(id, callback) {
db.Outfit.findById(id).then(function (outfit) {
if (outfit) {
return callback(null, outfit);
}
updateOutfitById(id, callback);
}).catch(function (error) {
callback(error);
});
}
function getOutfitFullById(id, callback) {
var options = {
include: [db.World, db.Faction, db.Character]
};
db.Outfit.findById(id, options).then(function (outfit) {
if (outfit) {
return callback(null, outfit);
}
updateOutfitById(id, function (error, outfit) {
if (error) {
return callback(error);
}
db.Outfit.findById(id, options).then(function (outfit) {
callback(null, outfit);
}).catch(function (error) {
callback(error);
});
});
}).catch(function (error) {
callback(error);
});
}
function updateOutfitById(outfitId, callback) {
census.outfit.getOutfit(outfitId, function (error, data) {
if (error) {
return callback(error);
}
if (!data) {
return callback('No Outfit found with this id');
}
census.character.getCharacter(data.leader_character_id, function (error, leaderCharacter) {
if (error) {
return callback(error);
}
if (!leaderCharacter) {
return callback('Outfit leader could not be resolved');
}
db.Outfit.upsert({
id: data.outfit_id,
name: data.name,
alias: data.alias,
createdDate: createDateAsUTC(new Date(data.time_created_date)),
leaderCharacterId: data.leader_character_id,
memberCount: data.member_count,
factionId: leaderCharacter.faction_id,
worldId: leaderCharacter.world_id
}).then(function () {
db.Outfit.findById(outfitId).then(function (outfit) {
callback(null, outfit);
}).catch(function (error) {
callback(error);
});
}).catch(function (error) {
callback(error);
});
});
});
}
|
import {hello} from './logic/greet';
import {reduceFunc} from './logic/reduce';
// console.log(hello());
// console.log(reduceFunc([1,2,3]));
|
export default {
fontRegular: 'Roboto-Regular',
fontBold: 'Roboto-Bold',
fontLight: 'Roboto-Light',
colors: {
today: '#B13B44',
tommorow: '#C9742E',
week: '#15721E',
month: '#1631BE',
primary: '#222',
secondary: '#fff',
mainText: '#222',
subText: '#666'
}
}
|
document.addEventListener("DOMContentLoaded", function(event) {
//mobile menu
let menuOptions=document.querySelector('.nav_buttons')
if (window.matchMedia("(max-width: 768px)").matches) {
menuOptions.classList.add('hidden');
}else {
menuOptions.classList.remove('hidden');
}
let hamburger=document.getElementById('hamburger');
hamburger.addEventListener('click', function(){
menuOptions.classList.toggle('hidden');
});
//location search
let showCities=document.querySelector('.selectLocation').getElementsByTagName('span')[2];
showCities.addEventListener('click', function(){
console.log('działa');
})
let searchInput=document.querySelector('.selectLocation').getElementsByTagName('span')[0];
searchInput.addEventListener('click', function(){
searchInput.contentEditable="true"
})
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.