text
stringlengths
7
3.69M
import React from 'react'; import JavaScriptIcon from '.././assets/images/SkillIcons/javascript.png'; import NodeJSIcon from '.././assets/images/SkillIcons/nodejs2.png'; import ReactIcon from '.././assets/images/SkillIcons/reactIcon.png'; import Vue from '.././assets/images/SkillIcons/vue.png'; import Spring from '.././assets/images/SkillIcons/spring.png'; import Thymeleaf from '.././assets/images/SkillIcons/thymeleaf.png'; import Java from '.././assets/images/SkillIcons/java.png'; import Linux from '.././assets/images/SkillIcons/linux.png'; import Mysql from '.././assets/images/SkillIcons/mysql.png'; import GitIcon from '.././assets/images/SkillIcons/Git-Icon.png'; import Illustrator from '.././assets/images/SkillIcons/illustrator.png'; import photoshop from '.././assets/images/SkillIcons/photoshop.png'; const ImagePool = [ {src : JavaScriptIcon, text : "test"}, {src : NodeJSIcon, text : "test2"}, {src : ReactIcon, text : "test"}, {src : Vue, text : "test"}, {src : Spring, text : "test"}, {src : Thymeleaf, text : "test"}, {src : Java, text : "test"}, {src : Linux, text : "test"}, {src : Mysql, text : "test"}, {src : GitIcon, text : "test"}, {src : Illustrator, text : "test"}, {src : photoshop, text : "test"}, // JavaScriptIcon, NodeJSIcon, ReactIcon, Vue, Spring, Thymeleaf, Java, Mysql ] export default ImagePool;
window.addEventListener('load', () => { getCourse(); var today = new Date(); var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate(); document.getElementById('CurrentDate').value = date; let currentTime = document.getElementById('CurrentTime'); currentTime.value = ConvertTime(today.getHours() + ':' + today.getMinutes()); setInterval(function() { var now = new Date(); currentTime.value = ConvertTime(now.getHours() + ':' + now.getMinutes()); }, 1000); mentorlist = document.getElementById('mentors_list'); if (mentorlist !== undefined && mentorlist !== null) { mentorlist.addEventListener('change', changeMentors); } }); const getMentors = () => { apiCall('get', '/api/mentor/getMentorsData', null, null, response => { const mentorsList = document.getElementById('mentors_list'); const data = JSON.parse(response); data.forEach(mentor => { let option = document.createElement('option'); option.setAttribute('value', mentor.id); option.innerHTML = mentor.name; mentorsList.appendChild(option); }); }); }; const getCourse = () => { apiCall('get', '/api/course/getCourse', null, null, response => { const courseList = document.getElementById('courses'); const data = JSON.parse(response); data.forEach(course => { let link = document.createElement('a'); link.addEventListener('click', getCourseStudent); link.setAttribute('href', course.id); link.classList.add('course'); let icon = document.createElement('i'); icon.classList.add('fas', 'fa-book', 'fa-2x'); let courseName = document.createElement('h2'); courseName.innerHTML = course.name; link.appendChild(icon); link.appendChild(courseName); courseList.appendChild(link); }); getMentors(); }); }; function changeMentors(e) { const mentorList = e.target; const mentorName = mentorList.options[mentorList.selectedIndex].text; const stdtable = document.getElementById('std_table'); for (let i = 0; i < stdtable.rows.length; i++) { let ree = stdtable.rows[i].cells[8].innerHTML; if (stdtable.rows[i].cells[8].innerHTML !== 'ok') { stdtable.rows[i].cells[4].innerHTML = mentorName; } } } function getCourseStudent(e) { e.preventDefault(); const table = document.getElementById('std_table'); //let courseId = e.target.parentNode.pathname; const courseName = 'K3'; const mentorList = document.getElementById('mentors_list'); const mentorName = mentorList.options[mentorList.selectedIndex].text; apiCall('GET', `/api/course/1`, null, null, res => { let data = JSON.parse(res); data.forEach(element => { const row = document.createElement('tr'); const td_id = document.createElement('td'); // id const name = document.createElement('td'); // name const city = document.createElement('td'); // city const course = document.createElement('td'); // course const mentor = document.createElement('td'); // mentor const date = document.createElement('td'); //date const time = document.createElement('td'); // time const btn = document.createElement('td'); const isAdded = document.createElement('td'); const attendbtn = document.createElement('a'); row.setAttribute('id', `row_${element.id}`); td_id.setAttribute('scope', 'col'); name.setAttribute('scope', 'col'); city.setAttribute('scope', 'col'); course.setAttribute('scope', 'col'); mentor.setAttribute('scope', 'col'); mentor.setAttribute('id', `td_mentor_${element.id}`); date.setAttribute('scope', 'col'); date.setAttribute('id', `td_date_${element.id}`); time.setAttribute('scope', 'col'); time.setAttribute('id', `td_time_${element.id}`); btn.setAttribute('scope', 'col'); btn.classList.add('btns'); isAdded.setAttribute('id', `td_add_${element.id}`); isAdded.style.display = 'none'; attendbtn.addEventListener('click', funAddAttendance); attendbtn.setAttribute('href', element.id); attendbtn.setAttribute('id', 'addAttendance'); attendbtn.classList.add('btn', 'btn-blue'); attendbtn.innerHTML = ' Attend'; td_id.innerHTML = element.id; name.innerHTML = element.name; city.innerHTML = element.city; course.innerHTML = courseName; mentor.innerHTML = mentorName; btn.appendChild(attendbtn); row.appendChild(td_id); row.appendChild(name); row.appendChild(city); row.appendChild(course); row.appendChild(mentor); row.appendChild(date); row.appendChild(time); row.appendChild(btn); row.appendChild(isAdded); table.appendChild(row); }); document.getElementById('AddAttendance').style.display = 'block'; }); } function funAddAttendance(e) { e.preventDefault(); var now = new Date(); let attendObj = { stdId: e.target.pathname.replace('/', ''), mentorId: document.getElementById('mentors_list').value, // we have just one course couresId: '1', AttendDate: document.getElementById('CurrentDate').value, AttendTime: ConvertTime( now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds() ) }; apiCall( 'POST', '/api/attendance/TakeAttendance', JSON.stringify(attendObj), 'application/json;charset=UTF-8', res => { const status = JSON.parse(res); console.log(status); const temp = status[0]; if (temp.data === 'error') { alert('Sorry Some Error happened , please try Again later'); console.log(status[1].errorDate); return; } if (temp.data === 'ok') { const stdRow = document.getElementById(`row_${attendObj.stdId}`); if (stdRow !== undefined && stdRow != null) { stdRow.style.backgroundColor = '#28a745'; stdRow.cells[5].innerHTML = attendObj.AttendDate; stdRow.cells[6].innerHTML = attendObj.AttendTime; let sd = stdRow.cells[7].firstChild; stdRow.cells[7].firstChild.style.display = 'none'; stdRow.cells[8].innerHTML = 'ok'; } } } ); } function ConvertTime(time) { // Check correct time format and split into components time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [ time ]; if (time.length > 1) { time = time.slice(1); time[5] = +time[0] < 12 ? ' AM ' : ' PM '; time[0] = +time[0] % 12 || 12; } return time.join(''); }
import express from 'express'; import logger from 'morgan'; import bodyParser from 'body-parser'; import dotenv from 'dotenv'; import path from 'path'; import swagger from 'swagger-jsdoc'; import webpack from 'webpack'; import winston from 'winston'; import webpackMiddleware from 'webpack-dev-middleware'; import validator from 'express-validator'; import webpackConfigDev from './webpack.config.dev'; import userRouter from './server/routes/userRouter'; import bookRouter from './server/routes/bookRouter'; import categoryRouter from './server/routes/categoryRouter'; import searchRouter from './server/routes/searchRouter'; import notificationRouter from './server/routes/notificationRouter'; const server = express(); dotenv.load(); const swaggerJSDoc = swagger; // swagger definition const swaggerDefinition = { info: { title: 'HelloBooks API', version: '1.0.0', description: 'An application that helps manage a library and its processes ' + 'like stocking, tracking and renting of books.' }, host: 'andela-hellobooks.herokuserver.com', basePath: '/api/v1' }; // options for the swagger docs const options = { // import swaggerDefinitions swaggerDefinition, // path to the API docs apis: ['./server/routes/*.js'] }; // initialize swagger-jsdoc const swaggerSpec = swaggerJSDoc( options ); server.use( logger( 'dev' ) ); server.use( express.static( './client/' ) ); // configure static files folder server.use( express.static( './client/public/' ) ); // configure static files folder server .use( '/api/docs/', express.static( path.join( __dirname, 'server/api-docs/' ) ) ); if ( process.env.NODE_ENV === 'development' ) { console.log( 'Hello' ) server.use( webpackMiddleware( webpack( webpackConfigDev ) ) ); } server.use( bodyParser.json() ); server.use( bodyParser.urlencoded( { extended: false } ) ); server.use( validator() ); server.use( '/api/v1', bookRouter ); server.use( '/api/v1/category', categoryRouter ); server.use( '/api/v1/users', userRouter ); server.use( '/api/v1/search', searchRouter ); server.use( '/api/v1/notification', notificationRouter ); // serve swagger server.get( '/api/docs/hellobooks.json', ( req, res ) => { res.setHeader( 'Content-Type', 'application/json' ); res.send( swaggerSpec ); } ); server.get( '*', ( req, res ) => { res.sendFile( path.join( __dirname, './client/index.html' ) ); } ); const port = process.env.PORT || 8000; server.listen( port, () => { winston.info( `Connected on port: ${ port }` ); } ); export default server;
const patient = artifacts.require('./Patient.sol') contract('patient',(accounts) =>{ before(async()=>{ this.patient = await patient.deployed() }) it('Deployed successfully and Patient node functioning', async() =>{ const address = await this.patient.address assert.notEqual(address,null) assert.notEqual(address,0x0) assert.notEqual(address,'') assert.notEqual(address,undefined) }) it('createPatient function test', async() =>{ const result = await this.patient.createPatient('Patient','3',70,10,10,36,5,38,4,1,'') const event = result.logs[0].args console.log(result) assert.equal(event.id.toNumber(),3) }) it('addDiagnosis function test ', async() =>{ const result = await this.patient.addDiagnosis(1,'Anxiety') const event = result.logs[0].args console.log(result) assert.equal(event.pid.toNumber(),1) assert.equal(event.diagnosis,'Anxiety') }) })
// const UNSPLASH_API_KEY = "u6tWjbvOWBGP-qtcuKtMOlRSbJ-_mgw2UhmahMp6nMI"; const body = document.querySelector("body"); const IMG_NUMBER = 2; function paintImage(imgNumber){ // const unsplash = unsplash.photos.getPhoto(`UNSPLASH_API_KEY`); // console.log('unsplash'); const image = new Image(); image.src = `imgs/${imgNumber+1}.jpg`; image.classList.add("bgImage"); body.appendChild(image); } function genRandom(){ const number = Math.floor(Math.random() * IMG_NUMBER); return number; } function init(){ const randomNumber = genRandom(); paintImage(randomNumber); } init();
import { useState, useEffect } from 'react' import { getCountry } from '../Api/index' import { Link, useParams } from 'react-router-dom' import './countryPage.css' const CountryPage = () => { const { country } = useParams() const [countryData, setCountryData] = useState([]) useEffect(() => { getCountry(country) .then( data => { console.log(data) setCountryData(data) } ) }, []) return ( <div className="container"> <Link to="/"><i className="fas fa-arrow-left" />Go Back</Link> <div className="countryDetails"> {countryData.map(c => { const { name, population, capital, region, subregion, tld, languages, flags, currencies } = c return ( <> <div className="flag"> <img src={flags.png} alt="flag" /> </div> <div className="details"> <div className="detail"> <h1>{country}</h1> <p>Native Name: {name.common}</p> <p>Population: {population}</p> <p>Region : {region}</p> <p>Sub Region: {subregion}</p> <p>Capital: {capital}</p> <p>Top Level Domain: {tld}</p> <p>Languages: {Object.values(languages).join(',')}</p> <p>Currencies: {Object.keys(currencies)}</p> </div> </div> </> ) })} </div> </div> ) } export default CountryPage
/** * This is the common script for the ASSET application */ // ***************** GLOBAL VARIABLES ***************** var bldGrp = ''; var gendrVal = ''; var themeID = ''; var HOSP_CNTRLLS= { HOSP_FIELDS : ['txtFldASSETHospName','txtFldASSETHospCode','txtFldASSETHospAddr1','txtFldASSETHospCity', 'txtFldASSETHospAddr2','txtFldASSETHospState','txtFldASSETHospAddr3','txtFldASSETHospCntry', 'txtFldASSETHospRmks'] }; // ***************** END OF GLOBAL VARIABLES ***************** function showLoader(){ $(".loading").show(); $("footer").css("display","none"); } function hideLoader(){ $(".loading").hide(); $("footer").css("display","inline-block"); }//end of hideLoader function showAlert(content,fldtofocus) { $("#alertimg").html(""); $("#alertmsg").html(content); $('#alertmsglogdiv').modal({ backdrop: 'static', keyboard: false, show:true, }); $('#alertmsglogdiv').on('shown.bs.modal', function() { $(this).find(".modal-title").text("Asset System Notification"); $(this).find(".modal-footer").find("button:eq(0)").unbind(); $(this).find(".modal-footer").find("button:eq(0)").click(function (){ if(content == CONSTANTS_VAR.KEYIN_VD_REP || content == CONSTANTS_VAR.KEYIN_VD_NAME || content == CONSTANTS_VAR.KEYIN_VD_EMAIL ){ navToVendor(); } $('#alertmsglogdiv').modal('hide'); if(fldtofocus)fldtofocus.focus(); }); }); } function navToVendor(){ $("#vendornavdiv").find("ul li").removeClass("active"); $("#vendornavdiv").find("ul li[id='li_vd_Vendor']").addClass("active"); $(".tab-content .tab-pane").removeClass("active in"); $(".tab-content").find("div[id='Vendor']").addClass("active in"); } function showTooltip(id,strTooltipContent){ $("#"+id).qtip({ content: {text : strTooltipContent}, // show: 'keypress', // hide: 'keypress', style: { classes: 'qtip-grey qtip-rounded qtip-shadow' }, position: { my: 'top left', at: 'bottom left', viewport: $(window), target: $("#"+id) } }); } function ImgTooltip(obj){ var objval = $(obj).attr("title"); $(obj).isDisabled = true; $(obj).qtip({ content: { text:$(obj).val(), title: { button: false } }, show: {solo: true, ready: false, when: 'mouseover'}, hide: { when: 'mouseout', fixed: true }, style: { classes: 'qtip-grey qtip-rounded qtip-shadow' }, position: { my: 'top left', at: 'bottom left', viewport: $(window), target: $(obj) } }); if(!(objval == "")){ $(obj).qtip('show'); }else { $(obj).qtip('disable'); } } function assetTooltip(obj){ var objval = $(obj).val(); $(obj).isDisabled = true; $(obj).qtip({ content: { text:$(obj).val(), title: { button: false } }, show: {solo: true, ready: false, when: 'mouseover'}, hide: { when: 'mouseout', fixed: true }, style: { classes: 'qtip-grey qtip-rounded qtip-shadow' }, position: { my: 'top left', at: 'bottom left', viewport: $(window), target: $(obj) } }); if(!(objval == "")){ $(obj).qtip('show'); }else{ $(obj).qtip('disable'); } } function removeInfoError(tblid){ $("#"+tblid+"_info").hide(); } function showInfoError(tblid){ $("#"+tblid+"_info").show(); } function ctrlOverFlowDataTable(tblid){ $("#"+tblid+"_wrapper").css("width","98%"); $("#"+tblid+"_wrapper").find(".dataTables_scrollBody").css("width","101.6%"); $("#"+tblid+"_wrapper").find(".dataTables_scrollBody").css("overflow","scroll"); } function tableDeleteRow(tableId,autodelete){ var table = document.getElementById(tableId); var tbody = table.tBodies[0]; var rowCount = tbody.rows.length; var deleteFlag = 0; if(rowCount<1){ showAlert("No rows to delete!"); return; } if(rowCount>=1){ if(!autodelete){ for(var del=0;del<rowCount;del++){ var row = tbody.rows[del]; var chkbox = row.cells[1].childNodes[0]; if(null != chkbox && true == chkbox.checked) { deleteFlag = 1; } }// End of for(del) if(!deleteFlag){ showAlert("Select a row to delete!"); return; } } // to delete the rows checked for(var del=0;del<rowCount;del++){ var row = tbody.rows[del]; mode = row.cells[2].childNodes[0].value; var chkbox = row.cells[1].childNodes[0]; if(((null != chkbox && true == chkbox.checked)||autodelete)) { if(mode == 'I'){ tbody.deleteRow(del); if(isValidObject(document.getElementById('hSelectRow'))){ document.getElementById('hSelectRow').value = ''; } rowCount--; del--; } if(mode == 'Q'){ row.cells[2].childNodes[0].value = 'D'; chkbox.checked = false; } } }// End of for(del) reorderTableRows(tableId,true); } } function isValidObject(objToTest) { if (objToTest == null || objToTest == undefined) { return false; } return true; }//end isValidObject function reorderTableRows(tblName,reorderflg) { if(reorderflg){ var tblObj = document.getElementById(tblName); var rowLen = tblObj.tBodies[0].rows.length; var tBodyObj = tblObj.tBodies[0]; for(var i=0;i<rowLen;i++) { var lclIndex = i+1; if(tBodyObj.rows[i].cells[0].firstChild) tBodyObj.rows[i].cells[0].firstChild.value =lclIndex; } } }//end incrIndex function assetAjax(param) { var response = '';var result=''; $.ajax({ url : 'AssetDetails', data : param, dataType : 'json', type : 'POST', async : false, success :function(data){ response = data; },complete : function(){ setTimeout(function(){ hideLoader(); //hides loader },500); },error : function(){ } }); return response; }//end of assetAjax function selectRowFun(chkObj) { // alert("test"); if(chkObj.checked) { selRowArr.push(chkObj.parentNode.childNodes[1].value) ; }//end of id }//end of selectRowFun function clearRecords(tblId,typ) { var tbl = document.getElementById(tblId), tblBody = tbl.tBodies[0], tblLen = tblBody.rows.length; // var hdrSelObj = document.getElementById('chkHwbox'); if(typ && typ == 'CLR') { if(tblLen <=0) { showAlert(CONSTANTS_VAR.NO_RECORDS); return; }//end of if }//end of if if(tblLen >0) { for(var rmv=0;rmv<tblLen;rmv++) { tblBody.deleteRow(0); }//end of for }//end of if showInfoError(tblId); //if(hdrSelObj.checked)hdrSelObj.checked = false; }//end of clearRecords function validateDate(elmid){ var input = trim($(elmid).val()); var pattern =/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; if(!isEmptyFld(input)){ if(pattern.test(input)==false){ showAlert("Invalid Date Format",$(elmid)); $(elmid).val(""); return false; } } } function submitFun() { document.forms[0].submit(); window.open("hello","ASSET","width=500,height=300,left=400,top=240"); }//end of submitFun function isEmpty(elem) { if(elem.value == '' && elem.value.length <= 0){ return true;} else return false; }//end of isEmpty function setTheme(themeVal) { var i,a,selVal = ''; if(themeVal) { selVal = themeVal; } for(i=0;(a = document.getElementsByTagName('link')[i]);i++) { if(a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title')) { a.disabled = true; if(a.getAttribute('title') == selVal)a.disabled = false; }//end of if }//end of for }//end of setTheme /** * This method is used to disable all the events in the * screen and mainly used before login into the system * @param none */ function assetOnloadFun() { //disableAll(); var layoutHght = document.getElementById('layoutSkeleton'); layoutHght.style.height = parseInt(getHeight())-110+'px'; hideLoader(); }//end of assetOnloadFun function selectFunction(screen) { //alert("TEstr") var assetForm = ''; for(var scr in ASSET_SCREENS) { if(scr == screen) { //alert(screen) var value = ASSET_SCREENS[scr].split('^'), header = value[0], dets = value[1]; $('#sideMenuAboutHeader').html(header); $('#sideMenuAboutDets').html(dets); assetForm = document.getElementById('assetForm'); if(screen == 'ASSETHARD') { assetForm.action = 'AssetHardPre.do'; assetForm.submit(); }//end of if if(screen == 'ASSETSOFT') { assetForm.action = 'AssetSoftPre.do'; assetForm.submit(); }//end of else if if(screen == 'ASSETVENDOR') { assetForm.action = 'AssetVenPre.do'; assetForm.submit(); } if(screen == 'SERVICETRACK') { assetForm.action = 'ServiceTrackPre.do'; assetForm.submit(); } if(screen == 'RENEWALREMAIND') { assetForm.action = 'RenewalRemaindPre.do'; assetForm.submit(); } //alert("screen"+screen) if(screen == 'ASSETATTACHMENTS') { //alert("ASSETATTACHMENTS"); assetForm.action = 'AssetAttachmentsPre.do'; assetForm.submit(); } }//end of if }//end of for }//end of selectFunction function disableAll() { $('.assetToolBarBtnCls').each(function() { $(this).prop({disabled:true}); }); $('.assetSideMenuListCls').each(function() { if($(this).hasClass('assetSideMenuListCls')) { $(this).addClass('ui-state-disabled').prop('onclick',null); } }); }//end of disableAll function enableAll() { $('.assetToolBarBtnCls').each(function() { if($(this).is(':disabled'))$(this).prop({disabled:false}); }); $('.assetSideMenuListCls').each(function() { if($(this).hasClass('assetSideMenuListCls')) { if($(this).hasClass('ui-state-disabled'))$(this).on('click').removeClass('ui-state-disabled'); } }); }//end of enableAll function assignTheme(imgObj) { var themeVal = ''; document.getElementById('hTxtFldASSETThemes').value = ''; if(imgObj) themeVal = imgObj.alt; document.getElementById('hTxtFldASSETThemes').value = themeVal; setTheme(themeVal); }//end of assignTheme function setBldGrp(bldGrpVal,selObj) { var bldGrp = bldGrpVal; var bldTyps = bldGrp.split('^'); selObj.options[0] = new Option('--Select--',''); for(var bld=0;bld<bldTyps.length;bld++) { var bldList = bldTyps[bld].split('='); selObj.options[selObj.options.length] = new Option(bldList[1],bldList[0]); }//end of for }//end of setBldGrp() function setGender(gendrVal,selObj) { var gendr = gendrVal; var gendrTyps = gendr.split('^'); selObj.options[0] = new Option('--Select--',''); for(var gen=0;gen<gendrTyps.length;gen++) { var genList = gendrTyps[gen].split('='); selObj.options[selObj.options.length] = new Option(genList[1],genList[0]); }//end of for }//end of setBldGrp() function getHeight() { if (self.innerHeight) { return self.innerHeight; } if (document.documentElement && document.documentElement.clientHeight) { return document.documentElement.clientHeight; } if (document.body) { return document.body.clientHeight; } }//end of getHeight
StudentCentre.combo.AssignmentStatus = function(config) { config = config || {}; Ext.applyIf(config, { fieldLabel: _('studentcentre.ass_status') ,name: 'status' ,width: 300 ,hiddenName: 'status' ,emptyText: 'Select status...' ,typeAhead: true ,valueField: 'status' ,displayField: 'status' ,fields: ['status'] ,url: StudentCentre.config.connectorUrl ,baseParams: { action: 'mgr/assignments/scAssignmentStatusGetList' } }); StudentCentre.combo.AssignmentStatus.superclass.constructor.call(this, config); }; Ext.extend(StudentCentre.combo.AssignmentStatus, MODx.combo.ComboBox); Ext.reg('assignment-combo-status', StudentCentre.combo.AssignmentStatus);
import angular from 'angular'; import 'bootstrap/dist/css/bootstrap.css'; import angularMeteor from 'angular-meteor'; import template from './assetWarehouse.html'; import { Warehouses } from '../../api/assets/warehouses.js'; class AssetWarehouseCtrl { constructor($scope) { $scope.viewModel(this); this.subscribe('warehouses'); this.helpers({ warehouses(){ return Warehouses.find({}, {sort:{id:-1}}); } }); } addWarehouse(newWarehouse) { Session.set("newWarehouse", newWarehouse); /* * Execute getMaxId method, we need to do this complex logic because Mocha need fake id as input. */ Meteor.call('warehouses.getMaxId', function(error, result){ /* * Get item object which store in session */ var warehouse = Session.get("newWarehouse"); warehouse.id = (parseInt(result) + 1) + ''; warehouse.name = newWarehouse.name; warehouse.description = newWarehouse.description; //warehouse.zones = []; warehouse.createdAt = new Date(); /* * Execute insert method which will be a different scope again. */ Meteor.call('warehouses.insert', warehouse); }); } removeWarehouse(id) { console.log("Remove warehouse id: " + id); Meteor.call('warehouses.remove', id); } } export default angular.module('assetWarehouse', [ angularMeteor ]).component('assetWarehouse', { templateUrl: 'imports/components/assetWarehouse/assetWarehouse.html', controller: ['$scope', AssetWarehouseCtrl] });
import axios from 'axios'; import { SEARCH_FINISHED, LOADING_SEARCH, NEXT_PAGE_LOADED, LOADING_MORE, UPDATE_FILTER, } from './types'; export const searchText = (query) => async (dispatch) => { try { dispatch({ type: LOADING_SEARCH, }); const params = new URLSearchParams(query); const searchString = params.get('query'); const searchResults = await axios.get( `/api/search/searchAll/${searchString}` ); const movieData = searchResults.data.movies; const tvData = searchResults.data.tv; const peopleData = searchResults.data.people; const companyData = searchResults.data.company; const payload = { movies: movieData, tv: tvData, people: peopleData, company: companyData, }; // console.log(movieData); dispatch({ type: SEARCH_FINISHED, payload: payload, }); } catch (err) { console.log(err); } }; export const loadNextPage = (pageNumber, resultType, queryString) => async ( dispatch ) => { dispatch({ type: LOADING_MORE, }); console.log('Action before query: ' + pageNumber); const params = new URLSearchParams(queryString); const searchString = params.get('query'); const body = { resultType: resultType, pageNumber: pageNumber, query: searchString, }; try { let searchResults = await axios.post(`/api/search/searchSingle`, body); console.log(searchResults.data); searchResults.data.resultType = resultType; console.log('Action after query: ' + searchResults.data.page); dispatch({ type: NEXT_PAGE_LOADED, payload: searchResults.data, }); } catch (err) { console.log(err); } }; export const updateSearchFilter = (filterType) => async (dispatch) => { dispatch({ type: UPDATE_FILTER, payload: filterType, }); };
import axios from "axios"; import filterParams from "./filterParams"; export default { getUsers: function() { return axios.get("/api/pets"); }, saveUser: function(userData) { return axios.post("/api/users", userData); }, getPets: function() { return axios.get("/api/pets"); }, savePets: function(petData) { return axios.post("/api/pets", petData); }, getArticles: function(params) { return axios.get("/api/nyt", { params: filterParams(params) }); } };
'use strict'; const bcrypt = require('bcrypt'); module.exports = { up: async (queryInterface, Sequelize) => { return queryInterface.bulkInsert('users', [ { rut: "123456-1", password: bcrypt.hashSync("123456",10), role: "ADMINISTRADOR", } ], { }); }, down: async (queryInterface, Sequelize) => { return queryInterface.bulkDelete('users', null, {}); } };
import {StyleSheet} from "react-native"; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor:"#FFFF" }, input:{ flex:1, fontSize:30, color:"black", marginRight:20, }, inputContainer:{ flexDirection:"row", marginTop:50, margin:20, marginBottom:30, }, flatlistContainer:{ flexGrow:1, }, arrayContainer:{ flex:1, }, textContainerFlatList:{ height:60, marginHorizontal:7, marginVertical:3, justifyContent:"center", backgroundColor:"#999999", }, textContainerFlatListCheck:{ height:60, marginHorizontal:7, marginVertical:3, justifyContent:"center", backgroundColor:"#9FE2BF", }, fontSize30:{ fontSize:30, }, marginLeft10:{ marginLeft:10, } }); export default styles;
var express = require('express'); var router = express.Router(); router.get('/country/:lang?', function(req, res, next) { let select = (req.params.lang && req.params.lang == 'en') ? " country_en country " : " country "; let order = (req.params.lang && req.params.lang == 'en') ? " country_en " : " country "; res.locals.pool.query(`SELECT id, ${select} FROM lu_contry_types WHERE status = 1 order by ${order}`, function(error, results, fields){ if(error){ res.json({"status": 500, "error": error, "response": null}); }else{ res.json({"status": 200, "error": null, "response": results}); } }); }); router.get('/category/', function(req, res, next) { res.locals.pool.query(`SELECT id, category FROM lu_category_types WHERE status = 1`, function(error, results, fields){ if(error){ res.json({"status": 500, "error": error, "response": null}); }else{ res.json({"status": 200, "error": null, "response": results}); } }); }); router.get('/rol/', function(req, res, next) { res.locals.pool.query(`SELECT id, rol FROM lu_rol_types WHERE status = 1`, function(error, results, fields){ if(error){ res.json({"status": 500, "error": error, "response": null}); }else{ res.json({"status": 200, "error": null, "response": results}); } }); }); module.exports = router;
"use strict"; var parser_1 = require("../../src/parser/parser"); var immutable_1 = require("immutable"); var fs = require("fs"); describe("parser", function () { var testData = "$15.05\nmixed fruit,$2.15\nvanilla calamari,$2.15\nfrench fries,$2.75\nside salad,$3.35\nhot wings,$3.55\nmozzarella sticks,$4.20\nsampler plate,$5.80"; var expectedResults = immutable_1.Map.of(215, immutable_1.Set(["mixed fruit", "vanilla calamari"]), 275, immutable_1.Set(["french fries"]), 335, immutable_1.Set(["side salad"]), 355, immutable_1.Set(["hot wings"]), 420, immutable_1.Set(["mozzarella sticks"]), 580, immutable_1.Set(["sampler plate"])); it("can determine the desired price from test data", function () { var p = new parser_1.Parser(testData); expect(p.getParserResults().desiredPrice).toBe(1505); }); it("can create Set of food items from test data", function () { var p = new parser_1.Parser(testData); expect(p.getParserResults().foodEntries.equals(expectedResults)).toEqual(true); }); it("can parse imported data", function () { var data = fs.readFileSync("./spec/helpers/menu.txt", "utf-8"); var p = new parser_1.Parser(data); expect(p.getParserResults().foodEntries.equals(expectedResults)).toEqual(true); }); it("can validate data", function () { expect(parser_1.Parser.validateData(testData)).toBe(true); }); });
import React from 'react'; import { CartItemContainer, CartItemMedia, ItemDetails, ItemName, ItemPrice, } from './cart-item.styles'; /** * Cart Item Component * * @param {*} { Item } * @returns */ const CartItem = ({ item }) => { return ( <CartItemContainer> <CartItemMedia src={item.imageUrl} alt="" /> <ItemDetails> <ItemName>{item.name}</ItemName> <ItemPrice> {item.quantity} X £{item.price} </ItemPrice> </ItemDetails> </CartItemContainer> ); }; export default React.memo(CartItem);
import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const getters = { token: state => state.user.token, name: state => state.user.name, roles: state => state.user.roles, permissionIdents: state => state.user.permissionIdents, permission_routes: state => state.permission.routes, } // https://webpack.js.org/guides/dependency-management/#requirecontext const modulesFiles = require.context('./modules', true, /\.js$/) const modules = modulesFiles.keys().reduce((modules, modulePath) => { const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1') const value = modulesFiles(modulePath) modules[moduleName] = value.default return modules }, {}) const store = new Vuex.Store({ modules, getters }) export default store
import axios from "axios" const apiHost = process.env.VUE_APP_API_HOST||"/"; let baseURL = "api"; if(apiHost){ baseURL=`${apiHost}api` } export default axios.create({baseURL:baseURL});
import React from 'react'; import './search.scss' import Search_nav from './search_nav' import Search_box from './search_box' import Search_nav_left from './search_nav_left' import Content from './content_box' import pic6 from './gengduo.png' import S_Footer from './S_footer' class Search extends React.Component{ render(){ return( <> <Search_nav></Search_nav> <Search_box></Search_box> <div id={'nav_C_box'}> <div id={'nav_top_right'}>按<span>时间</span>排序<br></br><span>热度</span></div> <div id={'nav_top_left'}>相关结果(约119条)</div> <Search_nav_left></Search_nav_left> <Content id={'nav_content_box'}></Content> </div> <div id={'nav_bottom_right'}><div>更多<img src={pic6}></img></div></div> <S_Footer></S_Footer> <div id={'back'}><div>回到顶部</div></div> </> ) } } export default Search;
module.exports = Array.from(Array(5), (_, i) => ({ id: i, name: `dummy_restaurant_${i}` }))
const app = require('./main'); app.listen(process.env.PORT || 3333, () => { console.log(`backend running env: ${process.env.NODE_ENV || 'dev'}`); });
import { MenuItem } from "@material-ui/core"; import { formatRelative, subDays } from "date-fns"; import { useRouter } from "next/router"; const NotificationItem = ({ data }) => { const router = useRouter(); return ( <MenuItem onClick={() => router.push(data.url)}> <div className="w-96 flex items-center justify-between"> <h1 className="text-sm mr-5">{data.message}</h1> <h5 className="text-xs text-gray-500 ml-5"> {formatRelative( subDays(new Date(data.date.toDate()), 0), new Date(), { addSuffix: true } )} </h5> </div> </MenuItem> ); }; export default NotificationItem;
import axios from 'axios' import qs from 'qs' // axios 配置 axios.defaults.timeout = 5000 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' axios.defaults.baseURL = 'https://www.easy-mock.com/mock/590009b5739ac1685205bd59/demo' // POST传参序列化 axios.interceptors.request.use((config) => { if (config.method === 'post') { config.data = qs.stringify(config.data) } return config }, (error) => { console.log('错误的传参', 'fail') return Promise.reject(error) }) // 返回状态判断 axios.interceptors.response.use((res) => { if (!res.data.success) { // _.toast(res.data.msg); return Promise.reject(res) } return res }, (error) => { console.log('网络异常', 'fail') return Promise.reject(error) }) function fetch (url, params) { return new Promise((resolve, reject) => { axios.post(url, params).then(response => { reject(response.data) }).catch((error) => { resolve(error) }) }) } export default { changeData (params) { return fetch('/navbar/list', params) } }
var dir__fdcab30c5f47fb34f64374d4556859fe_8js = [ [ "dir_fdcab30c5f47fb34f64374d4556859fe", "dir__fdcab30c5f47fb34f64374d4556859fe_8js.html#ac7c003f71081e45f67c94956f703b7fa", null ] ];
/** * MailController * To handle Mail related functions */ // const parse5 = require('parse5'); const cheerio = require('cheerio'); const fs = require("fs"); const path = require("path"); const signatures = [ "", "Thanks and Regards, <br>Ashwin P Chandran", "Regards, <br>Ashwin", "Love you,<br>Wolfie" ]; // Import Services const MailService = require("../Services/MailService.js"); module.exports = { /** * Index page action */ index: function (req, res) { res.sendFile(process.env.ROOT_PATH + "/html/index.html"); }, /** * Send Mail Action */ mail: function (req, res) { const params = req.body; fs.readFile('./templates/mail_inlined.html','utf8',(err,html) => { if (err) console.log(err);; // Get Document let $ = cheerio.load(html) // Manipulate document $("#mail-salutation").text(params.salutation); $("#mail-body").text(params.body); $("#mail-signature").html(signatures[parseInt(params.signature)]); MailService.SendMail(params, $("body").html(), function (err, info) { if (err) { console.log(err); return res.send(err); } console.log(info); let url = "/?sent=true&&message=" + "Mail Sent to " + info.accepted.join(", "); res.redirect(encodeURI(url)); }); }); } }
import React from 'react' import PropTypes from 'prop-types' import Radium from '@instacart/radium' import MaskedTextInput from 'react-text-mask' import { colors } from '../../styles' import withTheme from '../../styles/themer/withTheme' import { themePropTypes } from '../../styles/themer/utils' import FormComponent from './FormComponent' import ValidationError from './ValidationError' import FloatingLabel from './FloatingLabel' import TextFieldHint from './TextFieldHint' import ServerError from './ServerError' import HelperText from './HelperText' import spacing from '../../styles/spacing' const NoOp = () => {} // eslint-disable-line no-empty-function const styles = { wrapper: { cursor: 'auto', display: 'inline-block', position: 'relative', width: 343, }, inputContainer: { borderRadius: 4, position: 'relative', }, input: { backgroundColor: colors.WHITE, border: `solid 1px ${colors.GRAY_74}`, borderRadius: 4, boxSizing: 'border-box', color: colors.GRAY_20, fontSize: 16, height: 56, marginTop: 0, marginRight: 0, marginBottom: 0, marginLeft: 0, paddingTop: '25px', paddingRight: spacing.XS, paddingBottom: spacing.XS, paddingLeft: spacing.XS, outline: 'none', position: 'relative', width: '100%', WebkitOpacity: 1, WebkitTapHighlightColor: 'rgba(0,0,0,0)', }, inputDisabled: { border: `1px dashed ${colors.GRAY_74}`, backgroundColor: colors.GRAY_93, color: colors.GRAY_46, cursor: 'not-allowed', }, inputError: { border: `1px solid ${colors.RED_700}`, backgroundColor: '#FDE6EB', }, fullWidth: { width: '100%', }, halfWidth: { width: 162, }, } const getSnackStyles = snacksTheme => { const { action } = snacksTheme.colors return { highlight: { border: `1px solid ${action}`, }, } } const getInputSyles = ({ props, theme, isFocused }) => { const snacksStyles = getSnackStyles(theme) const { disabled, hasError, inputStyle } = props const disabledStlyes = disabled ? styles.inputDisabled : {} const errorStyles = !disabled && hasError ? styles.inputError : {} const focusedStyles = isFocused && !hasError ? snacksStyles.highlight : {} return { ...styles.input, ...inputStyle, ...disabledStlyes, ...errorStyles, ...focusedStyles, } } export const maskedTextFieldPropTypes = { /** Name of the field */ name: PropTypes.string.isRequired, /** Transforms the raw value from the input * * @example strips slashes from a phone number * (value) => value.replace(NON_DIGIT_REGEX, '') * @param {string} value * @returns {string} */ getValue: PropTypes.func.isRequired, /** The mask */ mask: PropTypes.array.isRequired, /** The pipe mask */ pipe: PropTypes.func, /** The mask hint */ maskHint: PropTypes.string.isRequired, /** The type of the input */ type: PropTypes.string.isRequired, /** HTML autocomplete attribute */ autoComplete: PropTypes.string, /** DefaultValue for non controlled component */ defaultValue: PropTypes.any, /** Disable the text field */ disabled: PropTypes.bool, /** Text of label that will animate when TextField is focused */ floatingLabelText: PropTypes.string, /** Sets width to 100% */ fullWidth: PropTypes.bool, /** Sets width to 162px */ halfWidth: PropTypes.bool, /** FormComponent error for validation */ hasError: PropTypes.bool, /** Helper text will show up in bottom right corner below TextField */ helperText: PropTypes.string, /** Uniq id for input */ id: PropTypes.string, /** Style for input */ inputStyle: PropTypes.object, /** Set by FormComponent by default. */ isValid: PropTypes.bool, /** onFocus callback */ onFocus: PropTypes.func, /** onChange callback * * @param {SyntheticEvent} event The react `SyntheticEvent` * @param {String} value The value from the input with `(`, `)`, space, and `-` characters removed * @param {String} rawValue The raw value from the input */ onChange: PropTypes.func, /** onBlur callback */ onBlur: PropTypes.func, /** onKeyDown callback */ onKeyDown: PropTypes.func, /** Mark the field as required. */ required: PropTypes.bool, /** Error from server to show ServerError message */ serverError: PropTypes.string, /** Wrapper styles */ style: PropTypes.object, /** Text to show for validation error */ validationErrorText: PropTypes.string, /** Value will make TextField a controlled component */ value: PropTypes.string, /** Snacks theme attributes provided by `Themer` */ snacksTheme: themePropTypes, } @withTheme({ forwardRef: true }) @FormComponent @Radium class MaskedTextField extends React.Component { static propTypes = maskedTextFieldPropTypes static defaultProps = { autoComplete: 'on', disabled: false, defaultValue: null, onChange: NoOp, onKeyDown: NoOp, onFocus: NoOp, onBlur: NoOp, } state = { hasValue: this.props.defaultValue !== null || Boolean(this.props.value), } componentWillReceiveProps(nextProps) { if (nextProps.disabled && !this.props.disabled) { this.setState({ isFocused: false }) } if (!this.state.hasValue && nextProps.value) { this.setState({ hasValue: true }) } } getValue = () => { if (!this.input) { return null } return this.props.getValue(this.input.value) } triggerFocus = () => this.input.focus() handleInputChange = e => { const { onChange } = this.props const { hasValue } = this.state const { value } = e.target // Limit setState call to only when hasValue changes if (value && !hasValue) { this.setState({ hasValue: true }) } else if (!value && hasValue) { this.setState({ hasValue: false }) } onChange(e, this.props.getValue(value), value) } handleInputFocus = e => { this.setState({ isFocused: true }) this.props.onFocus(e) } handleInputBlur = e => { this.setState({ isFocused: false }) this.props.onBlur(e) } handleKeyDown = e => { this.props.onKeyDown(e) } render() { const { mask, pipe, maskHint, floatingLabelText, defaultValue, disabled, fullWidth, halfWidth, hasError, id: inputId, isValid, name, required, serverError, validationErrorText, style, value, helperText, autoComplete, snacksTheme, } = this.props const { hasValue, isFocused } = this.state return ( <div style={[ styles.wrapper, fullWidth && styles.fullWidth, halfWidth && styles.halfWidth, style, ]} > {serverError && !disabled && !isValid && <ServerError text={serverError} />} <div style={styles.inputContainer}> <FloatingLabel text={floatingLabelText} float={isFocused || hasValue} disabled={disabled} isActive={isFocused} hasError={hasError} htmlFor={inputId} style={{ pointerEvents: 'none' }} snacksTheme={snacksTheme} /> <TextFieldHint inputId={`hint_${inputId}`} text={maskHint} show={!hasValue && isFocused} disabled={disabled} /> <MaskedTextInput mask={mask} pipe={pipe} id={inputId} guide={false} name={name} aria-required={required} aria-invalid={hasError} aria-describedby={hasError ? `hint_${inputId} error_${inputId}` : `hint_${inputId}`} onBlur={this.handleInputBlur} onChange={this.handleInputChange} onFocus={this.handleInputFocus} onKeyDown={this.handleKeyDown} autoComplete={autoComplete} placeholder="" defaultValue={value !== undefined ? undefined : defaultValue} disabled={disabled} keepCharPositions type={this.props.type} render={(ref, props) => ( <input ref={input => { this.input = input ref(input) }} style={getInputSyles({ props: this.props, theme: snacksTheme, isFocused, })} {...props} /> )} /> </div> <ValidationError text={validationErrorText} show={!disabled && !isValid && !serverError} inputId={inputId} /> <HelperText helperText={helperText} /> </div> ) } } export default MaskedTextField
import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import Chart from './Graph'; import CryptoSelected from './CryptoSelected'; const useStyles = makeStyles(theme => ({ box: { width: '100%', marginLeft: '2vw', height: '45vw', position: '-webkit-sticky', position: 'sticky', top: '1rem', background: theme.palette.primary.dark, color: theme.palette.primary.light, border: '1px solid', borderColor: theme.palette.primary.main, }, // cryptoSelected: { // height: '20vw', // }, chart: { padding: '2vw', }, })); const CryptoDescription = ({ selectedCoin, coinsData, handleClickClose }) => { const classes = useStyles(); return ( <div className={classes.box}> {/* if (!coinsData || !coinsData.Data) return null */} {coinsData.Data.map((coin, key) => { console.log(coin.CoinInfo); const info = coin.CoinInfo.FullName; const symbol = coin.CoinInfo.Name; if (info === selectedCoin) { return ( <div key={key}> <div className={classes.CryptoSelected}> <CryptoSelected coinInfo={coin.CoinInfo} coinDetails={coin.DISPLAY.USD} handleClick={handleClickClose} /> </div> <div className={classes.chart}> <Chart symbol={`${symbol}USD`} /> </div> </div> ); } })} </div> ); }; export default CryptoDescription;
import React, {Component} from 'react' import Form from 'react-bootstrap/Form' import FormControl from 'react-bootstrap/FormControl'; import FormGroup from 'react-bootstrap/FormGroup' import Button from 'react-bootstrap/Button'; import PostsService from '../services/posts-service'; import { UserConsumer } from './context/user'; class SearchForm extends Component { constructor(props) { super(props) this.state={ queryString:'' } } static service = new PostsService(); handleChange = ({target}) => { this.setState({ [target.id] : target.value }) } render(){ let {queryString} = this.state return ( <Form inline> <FormGroup controlId="queryString"> <FormControl type="text" value={queryString} onChange={this.handleChange} placeholder="Search posts" className="mr-sm-2"> </FormControl> </FormGroup> <Button href={`/post/search/${queryString}`} variant="outline-success" type="submit">Search</Button> </Form> ) } } const SearchFormWithContext = (props) =>{ return( <UserConsumer> { ()=>( <SearchForm {...props} /> ) } </UserConsumer> ) } export default SearchFormWithContext
import React, {Component} from 'react'; import {View,Text,StyleSheet,Button,TextInput,YellowBox , Keyboard} from 'react-native'; import { connect } from 'react-redux'; import { checkLogin,changeEmail,changeSenha,SignInAction } from '../actions/AuthActions'; import { LoadingItem } from '../components/LoadingItem'; import _ from 'lodash'; export class SignIn extends Component{ static navigationOptions = { title:'Login' } constructor(props){ super(props); this.state = { loading:false }; YellowBox.ignoreWarnings(['Setting a timer']); const _console = _.clone(console); console.warn = message => { if (message.indexOf('Setting a timer') <= -1) { _console.warn(message); } }; } //chamada quando algo na tela muda componentDidUpdate(){ if(this.props.status==1){ //fechar o teclado Keyboard.dismiss(); this.props.navigation.navigate('Conversas'); } } render(){ return( <View style={styles.container}> <Text style={styles.h1}>Digite seu Email</Text> <TextInput style={styles.input} value={this.props.email} onChangeText={this.props.changeEmail}/> <Text style={styles.h1}>Digite sua Senha</Text> <TextInput secureTextEntry={true} style={styles.input} value={this.props.senha} onChangeText={this.props.changeSenha}/> <Button title="Entrar" onPress={()=>{ this.setState({loading:true}); this.props.SignInAction(this.props.email,this.props.senha, ()=>{this.setState({loading:false});} ); }}/> <LoadingItem visible={this.state.loading}/> </View> ); } } const styles = StyleSheet.create({ container: { margin:10, flex:1, justifyContent:'center', alignItems:'center' }, input:{ height:50, width:'80%', fontSize:23, backgroundColor:'#DDDDDD' } }); //retorna user e senha por exemplo const mapStateToProps = (state)=>{ return { //conectar o Reducer do User email:state.auth.email, senha:state.auth.password, uid:state.auth.uid, status:state.auth.status }; }; //checklogin são as ações que podem ser executadas nessa tela, final a tela que vai abrir const SignInConnect = connect(mapStateToProps,{ checkLogin , changeEmail,changeSenha,SignInAction})(SignIn); export default SignInConnect;
$(function() { resetGrid(); $(window).resize(function() { resetGrid(); }); }); function resetGrid() { var w = getWindowWidth(), h = getWindowHeight(), m = 25; $g = $(".grid"), $c = $(".col-13, .col-23"); // set grid width & height to the window width and height - margin * 2 $g.width(w - (m * 2)); $g.height(h - (m * 2)); // set any column heights to the window height - any header elements $c.height(h - (m * 2) - $(".header").outerHeight(true)); } function overlayBar(height) { var el = { $wrapper: $(".overlay-wrapper"), $content: $(".overlay-content") }; $("body").css({'overflow': 'hidden'}); $(document).bind('scroll', function() { window.scrollTo(0,0); }); el.$content.html(""); el.$wrapper.css({ 'top': '50%', 'height': height + "px", 'margin-top': "-" + (height / 2) + "px", 'display': 'block' }); return el; } function closeOverlayBar(animate) { $("body").css({'overflow':'visible'}); $(document).unbind('scroll'); if (animate) { $(".overlay-wrapper").parent().fadeOut(300); } else { var el = overlayBar(0); el.$wrapper.parent().hide(); } } /** * Cross Browser window height & width functions. * from http://www.softcomplex.com/docs/get_window_size_and_scrollbar_position.html * * Copyright ©2002-2010 SoftComplex Inc. All rights reserved. */ function getWindowHeight() // viewport, not document { var windowHeight = 0; if (typeof(window.innerHeight) == 'number') { // DOM compliant, IE9+ windowHeight = window.innerHeight; } else { // IE6-8 workaround, Note: document can be smaller than window var ieStrict = document.documentElement.clientHeight; // w/out DTD gives 0 var ieQuirks = document.body.clientHeight; // w/DTD gives document height windowHeight = (ieStrict > 0) ? ieStrict : ieQuirks; } return windowHeight; } function getWindowWidth() // viewport, not document { var windowWidth = 0; if (typeof(window.innerWidth) == 'number') { // DOM compliant, IE9+ windowWidth = window.innerWidth; } else { // IE6-8 workaround, Note: document can be smaller than window var ieStrict = document.documentElement.clientWidth; // w/out DTD gives 0 var ieQuirks = document.body.clientWidth; // w/DTD gives document width windowWidth = (ieStrict > 0) ? ieStrict : ieQuirks; } return windowWidth; }
/* * Route: /apps/:appId/messages/:appMessageId? */ const AppMessageModel = rootRequire('/models/AppMessage'); const AppSourceContentModel = rootRequire('/models/AppSourceContent'); const appAuthorize = rootRequire('/middlewares/apps/authorize'); const appDeviceAuthorize = rootRequire('/middlewares/apps/devices/authorize'); const router = express.Router({ mergeParams: true, }); /* * GET */ router.get('/', appAuthorize); router.get('/', (request, response, next) => { const { appId, appMessageId } = request.params; let options = { where: { appId }, include: [ { model: AppSourceContentModel, attributes: { exclude: [ 'data' ], }, }, ], }; if (appMessageId) { options.where.id = appMessageId; AppMessageModel.find(options).then(appMessage => { if (!appMessage) { throw new Error('The app message does not exist.'); } response.success(appMessage); }).catch(next); } else { options.order = [ ['id', 'DESC'] ]; options.limit = 25; AppMessageModel.findAll(options).then(appMessages => { response.success(appMessages); }).catch(next); } }); /* * POST */ router.post('/', appAuthorize); router.post('/', appDeviceAuthorize); router.post('/', (request, response, next) => { const { appId } = request.params; const { appDevice } = request; const { appSourceContentId, name, message } = request.body; const chain = (appSourceContentId) ? AppSourceContentModel.count({ where: { id: appSourceContentId, appId, }, }).then(exists => { if (!exists) { throw new Error('The app source content does not exist'); } }) : Promise.resolve(); chain.then(() => { return AppMessageModel.create({ appId, appDeviceId: appDevice.id, appSourceContentId, name, message, }); }).then(appMessage => { // websocket emit response.success(appMessage); }).catch(next); }); /* * WEBSOCKET */ /* * Export */ module.exports = router;
import React, { useEffect, useState } from 'react'; import { ReactComponent as StockIcon } from './../../../static/icons/16_appruved ligh.svg'; import { ReactComponent as BuyIcon } from './../../../static/icons/16_buyed ligh.svg'; import { ReactComponent as QuestionIcon } from './../../../static/icons/24_question light.svg'; import { ReactComponent as CardIcon } from './../../../static/icons/24_bag white.svg'; import Flex from 'components/UI/Flex'; import clsx from 'clsx'; import * as yup from 'yup'; import { truncateString } from 'utils/helpers'; import { useForm } from 'react-hook-form'; import { yupResolver } from '@hookform/resolvers/yup'; import Button from 'components/UI/Button'; import productsSlice from 'store/slices/productsSlice'; import styles from './_products_option.module.scss'; import { useMediaQuery } from 'react-responsive'; import { deviceSize } from 'utils/consts'; import { addItemToCart } from 'utils/cart'; import { notification } from 'antd'; import { openNotification } from 'utils/notifications'; import { useDispatch } from 'react-redux'; import { setCartLength } from 'store/slices/productsSlice'; const memory = { title: 'memory', results: [ { name: '64 гб', value: 64, id: 1, }, { name: '128 гб', value: 128, id: 2, }, { name: '256 гб', value: 256, id: 3, }, ], }; const color = { title: 'color', results: [ { color: '#BFC5D5', id: 453, }, { color: '#DCDA90', id: 132123, }, { color: '#F4422C', id: 3123243521, }, { color: '#FFFFFF', id: 1321234213, }, { color: '#000000', id: 343521, }, ], }; const ProductOptions = ({ product }) => { const [colorChoose, setColorChoose] = useState(null); const [chooseOption, setChooseOption] = useState(null); const [productCount, setProducCount] = useState(1); const dispatch = useDispatch(); const isMobile = useMediaQuery({ maxWidth: deviceSize.mobile }); const handleColorChoose = (id) => { setColorChoose(id); }; const handleChooseOption = (id) => { setChooseOption(id); }; const handleChangeCount = (e) => { let value = e.target.value; if (value === '') { value = ''; setProducCount(''); return; } else if (value == 0) { value = 1; } if (isNaN(+value)) { return; } setProducCount(+value); }; const handleBlur = (e) => { if (e.target.value === '') { setProducCount(1); } }; const handleKeyPress = (e) => { let count = productCount; if (e.key === 'ArrowUp') { if (count === '') { count = 1; setProducCount(count); return; } count += 1; setProducCount(count); } else if (e.key === 'ArrowDown') { if (count === 1 || count === '') { count = 1; setProducCount(count); return; } count -= 1; setProducCount(count); } }; const handleAddToCart = () => { addItemToCart(product, productCount).then((result) => { if (result.type == 'add') { openNotification('success', 'Товар добавлен в корзину', 2); } else { openNotification('success', 'Товар удален из корзины', 2); } dispatch(setCartLength(result.cart.products.length)); }); }; return ( <div className={styles.product}> <h1 className={styles.product__title}>{product.title}</h1> {isMobile && <div className={styles.mobile_price}>{product.price} ₸</div>} <Flex justify="space-between" align="stretch"> <div className={styles.mobile_col}> {/* {isMobile && ( */} <div className={styles.product__article}> Минимальное кол-во для покупки {product.min_purchase} {product.unity}. </div> {/* )} */} <Flex align="center"> <span class={styles.product__icon}> <StockIcon /> </span> <span className={styles.product__stock}> В наличии {product.quantity} {product.unity}. </span> </Flex> </div> <div className={styles.mobile_col}> <Flex align="center"> <span class={styles.product__icon}> <BuyIcon /> </span> <span className={styles.product__sold}>Продано 101</span> </Flex> <div className={styles.product__article}>Артикул: 025 ASE</div> </div> </Flex> <div className={styles.product__mainInfo}> <div className={styles.product__infoCard}> <h3 className={styles.product__infoTitle}>Объем памяти</h3> <div className={styles.product__options}> {memory.results.map((item) => ( <div className={clsx({ [styles.product__optionChoose]: true, [styles.active]: item.id === chooseOption, })} data-value={item.value} data-name={memory.title} onClick={() => handleChooseOption(item.id)} > {item.name} </div> ))} </div> </div> <div className={styles.product__infoCard}> <h3 className={styles.product__infoTitle}>Цвет</h3> <div className={styles.product__options}> {color.results.map((item) => ( <div className={clsx({ [styles.product__color]: color.title, [styles.active]: item.id === colorChoose, })} style={{ background: `${item.color}` }} data-value={item.name} data-name={color.title} onClick={() => handleColorChoose(item.id)} /> ))} </div> </div> <div className={styles.product__infoCard}> <h3 className={styles.product__infoTitle}>Краткое описание</h3> <div className={styles.product__shortInfo}> {truncateString( "Экран 4,7'/ Матрица PS / Память 5,7 ГБ / Рас-ширение 1780х3500 / 2 SIM-карты / Камера 5 Mpx / RAM 1 GB ", 110 )} </div> </div> <div className={styles.product__infoCard}> <h3 className={styles.product__infoTitle}>Колличество</h3> <div className={styles.product__count}> <input type="text" className={styles.product__countInp} value={productCount} onBlur={handleBlur} onKeyDown={handleKeyPress} onChange={handleChangeCount} /> </div> </div> <div className={styles.product__infoCard}> <h3 className={styles.product__infoTitle}>Доставка</h3> <div className={styles.product__shipping}> <span> <QuestionIcon /> </span> </div> </div> <div className={styles.product__infoCard}> <h3 className={styles.product__infoTitle}>{isMobile ? 'Общая стоимость' : 'Цена'}</h3> <div className={styles.product__price}> <span>{product.price} ₸</span> </div> </div> <Button className={styles.product__addToCardBtn} onClick={handleAddToCart}> <CardIcon /> <span>Добавить в корзину</span> </Button> </div> </div> ); }; export default ProductOptions;
import styled from 'styled-components'; export const TipHover = styled.div` padding: 10px 15px; visibility: hidden; opacity: 0; position: absolute; top: ${({ top }) => `${top}px` || 'calc(100% + 10px)'}; background: #252a34; border-radius: 4px; box-shadow: 0 22px 17px 0 rgba(205, 205, 205, 0.5); transition: 0.2s; font-family: Montserrat; font-size: 14px; font-weight: 500; color: #fff; text-transform: none; word-break: break-word; z-index: 40; text-align: center; width: ${({ width }) => width}px; ${({ position }) => { if (position === 'left') { return ` left: 0; `; } if (position === 'right') { return ` right: 0; `; } // center position return ` left: 50%; transform: translateX(-50%); `; }} `; export const Root = styled.div` display: inline-block; vertical-align: middle; position: relative; cursor: pointer; :hover { ${TipHover} { visibility: visible; opacity: 1; transition-delay: 1s; } } `;
$("#role a").click(function() { e.preventDefault(); $('a').removeClass('active'); $(this).addClass("active"); });
import findByEmail from './findByEmail'; export default findByEmail; export * from './findByEmail';
import React, { Component } from 'react'; import './App.css'; class App extends Component { constructor(props) { super(props); this.state = {elementList : []}; this.handleClick = this.handleClick.bind(this); } handleClick() { this.setState( { elementList : this.state.elementList.concat(["element " + this.state.elementList.length]) } ); } render() { return ( <div className="App"> <button onClick={this.handleClick}>Click me</button> <ul> {this.state.elementList.map(x => <li key={x}>{x}</li>)} </ul> </div> ); } } export default App;
const jwt = require('jsonwebtoken'); const jwtGenerator = require('../utils/jwtGenerator'); const keys = require('../config/keys'); module.exports = function (req, res, next) { //parse the cookie to get the refresh token const token = req.cookies.refreshToken; //validate the token try { const decoded = jwt.verify(token, keys.JWT_SECRET); //if successful issue new access token and new refresh token if (decoded) { const userId = decoded.userId; const refreshToken = jwtGenerator({ userId }, '20m'); const accessToken = jwtGenerator({ userId }, '1m'); req.refreshToken = refreshToken; req.accessToken = accessToken; } next(); } catch (err) { return res.status(401).send(err.message); } };
const { resolve } = require('path'); const webpack = require('webpack'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); module.exports = { entry: [ 'whatwg-fetch', 'babel-polyfill', resolve(__dirname, '../src/javascripts/app.jsx') ], mode: 'production', module: { rules: [ { test: /\.scss$/, use: [ { loader: MiniCssExtractPlugin.loader }, { loader: 'css-loader', options: { sourceMap: true, modules: false } }, 'sass-loader' ] }, { test: /\.jsx?$/, exclude: /node_modules/, use: { loader: 'babel-loader' } }, { test: /\.(png|svg|jpg|gif)$/, use: [ 'file-loader' ] }, { test: /\.(woff|woff2|eot|ttf|otf)$/, use: [ 'file-loader' ] } ] }, optimization: { minimizer: [ new TerserPlugin() ] }, plugins: [ new webpack.DefinePlugin({ NODE_ENV: JSON.stringify(process.env.NODE_ENV), config: JSON.stringify(require(`./${process.env.NODE_ENV}.json`)) }), new MiniCssExtractPlugin({ filename: 'style.css', allChunks: true }), new HtmlWebpackPlugin({ template: '../src/index.html', filename: 'index.html' }) ] };
var searchData= [ ['core',['Core',['../namespace_digital_opus_1_1_m_b_1_1_core.html',1,'DigitalOpus::MB']]], ['digitalopus',['DigitalOpus',['../namespace_digital_opus.html',1,'']]], ['mb',['MB',['../namespace_digital_opus_1_1_m_b.html',1,'DigitalOpus']]] ];
var fib = module.exports = function(n) { if (n < 0) { throw new Error('Eh?') } else if (n == 0) { return 0 } else if (n == 1) { return 1 } else if (n == 2) { return 1 } else { return fib(n - 1) + fib(n - 2) } }
import React from "react"; import styled from "@emotion/styled"; import { spacing } from "@mui/system"; import { Avatar as MuiAvatar, Container as MuiContainer, Grid, Typography, } from "@mui/material"; const Wrapper = styled.div` ${spacing}; background: ${(props) => props.theme.palette.background.paper}; text-align: center; `; const Container = styled(MuiContainer)` align-items: center; display: flex; flex-direction: column; `; const Avatar = styled(MuiAvatar)` ${spacing}; width: 48px; height: 48px; `; const AvatarWrapper = styled.div` text-align: left; display: flex; align-items: center; justify-content: center; margin-top: ${(props) => props.theme.spacing(3)}; `; function Testimonial() { return ( <Wrapper pt={10} pb={20}> <Container> <Grid container alignItems="center" justifyContent="center"> <Grid item xs={12} md={8}> <Typography variant="h2" component="h3" gutterBottom> &quot;Mira Pro is one of the best advanced React dashboard templates for developers.&quot; </Typography> <AvatarWrapper> <a href="https://twitter.com/olivtassinari" target="_blank" rel="nofollow noreferrer noopener" > <Avatar src="/static/img/avatars/olivier.jpg" mr={3} /> </a> <Typography color="textSecondary" variant="body2"> Olivier Tassinari, <br /> Co-Founder MUI </Typography> </AvatarWrapper> </Grid> </Grid> </Container> </Wrapper> ); } export default Testimonial;
/** * This is largely s copied with minor stylistic adjustments from Freja 1.1 * I renamed it from Controller.history to distinguish between window.history */ Freja.UndoHistory = function() { this.cache = []; this.maxLength = 5; this._position = 0; this._undoSteps = 0; }; /** * Creates a snapshot of the model and stores it. */ Freja.UndoHistory.prototype.add = function(model) { var historyIndex = this._position % this.maxLength; var modelDoc = model.document; this.cache[historyIndex] = {}; this.cache[historyIndex].model = model; this.cache[historyIndex].document = Freja._aux.cloneXMLDocument(modelDoc); if (!this.cache[historyIndex].document) { throw new Error("Couldn't add to history."); } else { this._position++; // clear rest of the history if undo was used. var clearHistoryIndex = historyIndex; while (this._undoSteps > 0) { clearHistoryIndex = (clearHistoryIndex + 1) % this.maxLength; this.cache[clearHistoryIndex] = {}; this._undoSteps--; } return historyIndex; // what would anybody need this for ? } }; /** * Rolls the state back one step. */ Freja.UndoHistory.prototype.undo = function(steps) { if (this._undoSteps < this.cache.length) { this._undoSteps++; this._position--; if (this._position < 0) { this._position = this.maxLength - 1; } var model = this.cache[this._position].model; if (this.cache[this._position].document) { model.document = this.cache[this._position].document; } else { throw new Error("The model's DOMDocument wasn't properly copied into the history"); } if (typeof(steps) != "undefined" && steps > 1) { this.undo(steps - 1); } } else { throw new Error("Nothing to undo"); } }; /** * Reverts the effects of undo. */ Freja.UndoHistory.prototype.redo = function() { if (this._undoSteps > 0) { this._undoSteps--; this._position = (this._position + 1) % this.maxLength; var model = this.cache[this._position].model; model.document = this.cache[this._position].document; } else { throw new Error("Nothing to redo"); } }; /** * Removes the last entry in the cache */ Freja.UndoHistory.prototype.removeLast = function() { this._position--; if (this._position < 0) { this._position = this.maxLength - 1; } this.cache[this._position] = {}; this._undoSteps = 0; };
const express = require("express"); const Router = express.Router({mergeParams : true}); const catchAsync = require('../utils/catchAsync'); const {isLoggedIn , validateReview , reviewsAuthorise} = require("../middleware"); const review = require("../controllers/reviews"); Router.post("/" , isLoggedIn , validateReview , catchAsync(review.postReview)); Router.delete("/:reviewId" , isLoggedIn , reviewsAuthorise , catchAsync(review.deleteReview)); module.exports = Router;
// pages/news/news.js Page({ /** * 页面的初始数据 */ data: { isOpen: true, array: [{ label: 'sfdf', value: 'aa', children: [{ label: 'eee123', value: 'dsfsfs' }] }, { label: 'sdfdsfdsg', value: 'bb' }, { label: 'sfdsf', value: 'cc' }] }, kindToggle: function () { console.log('$$$$$$$$$', this.data.isOpen) this.setData({ isOpen: !this.data.isOpen }) }, bindPickerChange: function (e) { console.log('picker发送选择改变,携带值为', e.detail) this.setData({ index: e.detail.value }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })
const Intern = require('../intern') describe('adding a school name',()=>{ it('Should add a school name using the constructor',()=>{ const testVal = 'DVC'; const testGuy = new Intern('Marko',888,'email@email.com',testVal); expect(testGuy.school).toBe(testVal); }); }); describe('getSchool',()=>{ it('Should return the school with function',()=>{ const testVal = 'DVC'; const testGuy = new Intern('Marko',888,'email@email.',testVal); expect(testGuy.getSchool()).toBe(testVal); }); }); describe('getRole',()=>{ it('Should return the role with function',()=>{ const testVal = 'Intern'; const testGuy = new Intern('Marko',888,'email@email.com','DVC'); expect(testGuy.getRole()).toBe(testVal); }); });
import ProgressBarDemoRoute from 'routes/ProgressBarDemo' describe('(Route) ProgressBarDemo', () => { let _route beforeEach(() => { _route = ProgressBarDemoRoute({}) }) it('Should return a route configuration object', () => { expect(typeof(_route)).to.equal('object') }) it('Configuration should contain path `demo`', () => { expect(_route.path).to.equal('demo') }) })
const estimateGasCreation = (contractInstance, bytecode, constructorParams) => { return new Promise((resolve, reject) => { if (!contractInstance || !bytecode) { reject('No contract instance or bytecode given') } const input = { data: bytecode } if (constructorParams && constructorParams.length) { input.arguments = [...constructorParams] } contractInstance .deploy(input) .estimateGas() .then(gas => { resolve(gas) }).catch(err => { reject(err) }) }) } const deployContract = ( userAccount, contractInstance, contractBytecode, gasLimit, gasPrice, constructorParams) => { return new Promise((resolve, reject) => { let input = { data: contractBytecode } if (constructorParams && constructorParams.length) { input.arguments = [...constructorParams] } contractInstance .deploy(input) .send({ from: userAccount, gas: gasLimit, gasPrice, }) .then(res => { const data = { ...res.options } resolve(data) }) .catch(err => { reject(err) }) }) } const ContractOperations = { estimateGasCreation, deployContract, } export default ContractOperations
(function() { 'use strict'; angular .module('cyber.services') .factory('EventService', EventService) EventService.$inject = ['$resource']; function EventService($resource) { return $resource('events/:eventId', { eventId: '@eventId' }, { 'query': { method: 'GET', isArray: true } }); } })();
var outer = document.createElement('div') outer.className =('container') var contentcontainer = document.createElement('div') async function catcontent(section) { try { contentcontainer.innerHTML = '' var url = `https://api.nytimes.com/svc/topstories/v2/${section}.json?api-key=3OB0bcgpIW3TVAPG7VwV58Mu1cLp50WP` var data = await fetch(url) var fdata = await data.json() var cont = fdata.results console.log(cont) for(i of cont) { var content = document.createElement("div") content.setAttribute("class","container") content.setAttribute('style','margin:20px;border :1px solid black') var row = document.createElement("div") row.setAttribute("class","row") var card = document.createElement("div") card.setAttribute("class","card") var newscat = document.createElement("div") newscat.setAttribute("class","sectioncard") newscat.innerHTML = section.toUpperCase() var title = document.createElement("div") title.setAttribute("class","titlecard") title.innerHTML = i["title"] var date = document.createElement("div") date.setAttribute("class","datecard") date.innerHTML = i["published_date"] var abstract = document.createElement("div"); abstract.setAttribute("class","abstractcard"); abstract.innerHTML = i["abstract"]; var continuereading = document.createElement("a"); continuereading.setAttribute("class","continuereading"); continuereading.setAttribute("href",`${i["short_url"]}`) continuereading.innerHTML = "<b>Continue reading<b>"; var imagediv =document.createElement("div"); imagediv.setAttribute("class","container") imagediv.setAttribute("style","width:200px;height:150px;float:right") var image = document.createElement("img"); image.className=("img-thumbnail float-right") image.setAttribute("src",`${i["multimedia"][4]["url"]}`); image.setAttribute("style","width:200px;height:150px;float:right") imagediv.append(image) card.append(newscat,title,date,abstract,continuereading,imagediv) row.append(card) content.append(row) contentcontainer.append(content) outer.append(contentcontainer) document.body.append(outer) } } catch{ console.log("ERROR") } }
const fontSize = { fontSize: '35px' }; const Franchising = () => ( <div className="Potato franchising-wrapper w-100" id="franchising"> <h3>Franchise Package</h3> <div className="franchise-container container"> <div className="row"> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-user" style={fontSize}></i> <h1>Use of Trade Name and Logo </h1> <hr/> <p> Includes our inviting concept of "Just shake it!". </p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-hand-holding-usd" style={fontSize}></i> <h1>Affordable Package </h1> <hr/> <p> Low cost of franchise package available with undeniably overwhelming inclusions. </p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-boxes" style={fontSize}></i> <h1>Products </h1> <hr/> <p> Its hot and crispy french fries and potato chips together with its tasty flavors of barbeque, sour cream and cheese. </p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-retweet" style={fontSize}></i> <h1> NO Royalty and Renewal Fees </h1> <hr/> <p> The good news is we do not have Renewal Fee and Royalty Fee which is one of the benefits of being a Franchisee unlike other Companies wherein their Franchise Fee is costly than us or almost P400,000.</p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-chalkboard" style={fontSize}></i> <h1> Training </h1> <hr/> <p> Consists of the orientation of menu, preparation, use of the equipments, making of inventory reports and extensive on-site training during the first days of operation.</p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-cogs" style={fontSize}></i> <h1> Operating Support </h1> <hr/> <p> Continuous monitoring and meticulous maintenance of the concept and operation is needed to assure the quality of service.</p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-handshake" style={fontSize}></i> <h1>Site Assistance </h1> <hr/> <p> For those who would like to seek help in finding the right location. </p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-money-check-alt" style={fontSize}></i> <h1> Extra Income and Enhancement of Entrepreneurial Skills </h1> <hr/> <p> Investing means the need to have additional income for you and your family moreover deciding to invest means unleashing your goal to be an entrepreneur.</p> </div> <div className="col-md-6 col-lg-4 col-12 px-5 px-md-4"> <i className="fas fa-medal" style={fontSize}></i> <h1>Promotion </h1> <hr/> <p> Constantly joins exhibits and events, being featured in Entrepreneur magazine, sponsors TV shows and being endorsed by celebrities.</p> </div> </div> </div> </div> ); export default Franchising;
function craftItem(inventory, stacks, recipe, items){ let result = []; let isEnoughtItem = false; let resourceForCraft = []; /////////Check availability items in inventory by recipe for (let i = 0; i<recipe.ingredients.length; i++) { let findItems = inventory.findItems(recipe.ingredients[i].typeId, stacks); let amount = recipe.ingredients[i].amount; isEnoughtItem= false; if (findItems[0]<amount)break; resourceForCraft.push(findItems[1]); isEnoughtItem= true; } //resourceForCraft = bubbleSort.bubbleSort(resourceForCraft); if (!isEnoughtItem) return 1; /////////Check available space in inventory let freeSpace = inventory.availableFreeSpace(items[recipe.craftedTypeId], stacks); if (freeSpace<recipe.outputAmount) return 2; /////////////Get items from inventory and stacks by recipe for (let i = 0; i<recipe.ingredients.length; i++){ let remove = inventory.removeItem(stacks, recipe.ingredients[i].typeId, recipe.ingredients[i].amount); result = result.concat(remove); } // let tmp = inventory.addStack(inventories, character, stacks, recipe.craftedTypeId, recipe.outputAmount, ); // for (let i = 0; i<tmp.length; i++){ // result.push(tmp[i]); // } return result; } module.exports = craftItem;
import React from 'react'; import PageRoot from '../tags/page-root/page-root.jsx'; import Heading from '../tags/heading/heading.jsx'; import Rhythm from '../tags/rhythm/rhythm.jsx'; import Wrapper from '../tags/wrapper/wrapper.jsx'; import ComponentList from '../styleguide/component-list.jsx'; export default ({ locals }) => ( <PageRoot title="Hello World"> <Wrapper> <Rhythm size="large"> <Heading level="1">Hello World</Heading> <Rhythm size="small" deep="true"> <Heading level="3">Tags</Heading> <ComponentList baseUrl="/styleguide/tags" components={locals.tags} /> </Rhythm> <Rhythm size="small" deep="true"> <Heading level="3">Components</Heading> <ComponentList baseUrl="/styleguide/components" components={locals.components} /> </Rhythm> <Rhythm size="small"> <Heading level="2">Pages</Heading> <p>n/a</p> </Rhythm> </Rhythm> </Wrapper> </PageRoot> )
'use strict' const redux = require('redux'); const createStore = redux.createStore; const initalState = { counter: 0, status: false } //Reducer const rootReducer = (state = initalState, action) => { switch(action.type) { case 'SET_COUNTER': return { ...state, counter: state.counter + 1 } case 'ADD_COUNTER': return { ...state, counter: state.counter + action.value } case 'SET_STATUS': return { ...state, status: action.status } default: return state } } //Store const store = createStore(rootReducer) //Subscription store.subscribe(() => { console.log('[sbuscription]', store.getState()) }) //DispatchReducer store.dispatch({type: 'SET_COUNTER'}) store.dispatch({type: 'ADD_COUNTER', value: 5}) store.dispatch({type: 'SET_STATUS', status: true}) store.dispatch({type: 'SET_STATUS', status: false}) store.dispatch({type: 'ADD_COUNTER', value: 30})
class Game { constructor(canvasId){ this.canvas = document.getElementById(canvasId) this.canvas.width = 450 this.canvas.height = 650 this.ctx = this.canvas.getContext('2d') this.fps = 1000 / 60 this.intervalId = undefined this.background = new Background(this.ctx) this.floor = new Floor(this.ctx) this.bird = new Bird(this.ctx) this.gameStart = false this.pipes = [] this.pipeFrames = 70 this.pipeFramesCount = 0 this.score = 0 this.record = localStorage.getItem("FlappyRecord"); } // Start game start() { if(!this.intervalId){ this.intervalId = setInterval(() => { this.clear() this.draw() this.checkCollisions() this.move() if(this.pipeFramesCount >= this.pipeFrames){ this.newPipes() this.pipeFramesCount = 0 } this.pipeFramesCount++ this.cleanPipes() }, this.fps) } } // Stop game stop() { clearInterval(this.intervalId) this.gameOverScreen() this.gameStart = false } // Draw game elements draw() { this.background.draw() this.floor.draw() this.bird.draw() this.showScore() // Draw Pipes this.pipes.forEach(pipe => { pipe.draw() }) // Check floor collision if(this.bird.y >= 538){ this.stop() } } // Clear canvas clear() { this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height) } // Move game elements move() { if(this.gameStart){ this.floor.move() this.bird.move() // Move Pipes this.pipes.forEach(pipe => { pipe.move() }) } } // Add new pair of pipes to the canvas newPipes() { if(this.gameStart){ let randomTopHeight = Math.floor(Math.random() * 400); let randomBottomHeight = 400 - randomTopHeight this.pipes.push(new Pipe(this.ctx, 455, 0, 55, randomTopHeight, 'top')) this.pipes.push(new Pipe(this.ctx, 455, 566 - randomBottomHeight, 55, randomBottomHeight, 'bottom')) this.updateScore() } } cleanPipes() { this.pipes = this.pipes.filter( pipe => pipe.x + pipe.width >= 0 ) } // Check collisions checkCollisions() { const pipe = this.pipes.some(pipe => this.bird.checkCollisions(pipe)); if (pipe) { this.stop() } } updateScore() { this.pipes.forEach(pipe => { if(pipe.x <= 250){ // Sumamos 1 punto this.score++ } }) } showScore() { this.ctx.save() this.ctx.font = '35px Arial Bold' this.ctx.fillStyle = 'white' this.ctx.textAlign = 'center' this.ctx.fillText( `${this.score / 2}`, 30, 40, ) this.ctx.restore() } // OnKeyEvent -- Start game or move bird onKeyEvent(event) { if(this.gameStart === false){ if(event.keyCode === KEY_UP){ // Start the game this.gameStart = true } } else { // Move Bird this.bird.onKeyEvent(event) } } gameOverScreen() { if (this.score > this.record){ localStorage.setItem("FlappyRecord", this.score); this.record = this.score } this.ctx.save() this.ctx.fillStyle = 'rgba(0, 0, 0, 0.4)' this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height) this.ctx.font = '35px Arial Bold' this.ctx.fillStyle = 'white' this.ctx.textAlign = 'center' this.ctx.fillText( 'Game over!', this.ctx.canvas.width / 2, (this.ctx.canvas.height / 2) - 25, ) this.ctx.font = '25px Arial' this.ctx.fillText( `Your points: ${this.score / 2}`, (this.ctx.canvas.width / 2), (this.ctx.canvas.height / 2) + 15, ) this.ctx.fillText( `Record: ${this.record / 2}`, (this.ctx.canvas.width / 2), (this.ctx.canvas.height / 2) + 45, ) this.ctx.restore() // Reload Game document.addEventListener('keydown', () => { location.reload(); }) this.canvas.addEventListener('touchstart', () => { location.reload(); }); } }
// Given a string, find the length of the longest substring without repeating characters. // Examples: // Given "abcabcbb", the answer is "abc", which the length is 3. // Given "bbbbb", the answer is "b", with the length of 1. // Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring. /** * @param {string} s * @return {number} */ var testString = "abcabbaac"; console.log(lengthOfLongestSubstring(testString)); function lengthOfLongestSubstring(s) { var stringArray = s.split(""); var newArray = []; var returnedArray = []; stringArray.forEach(function(letter) { // console.log(letter) if (newArray.length === 0) { // if the newArray is empty push this letter into it newArray.push(letter); } else { // if newArray is not empty run a loop on newArray newArray.forEach(function(savedLetter) { if (savedLetter === letter && newArray.length > returnedArray.length) { // if one of the letters in newArray is the same as the letter in loop // and the length of the newArray is greater than the returnedArray // set the returnArray to the newArray returnedArray = newArray; newArray = []; console.log("ping", newArray, returnedArray); } if (savedLetter !== letter) { // if letter is different from all savedLetters push letter to newArray newArray.push(letter); } }) } }) return returnedArray; };
'use strict' require('dotenv').config() const express = require('express') const server = express(); const pg = require('pg') const superagent = require('superagent'); const methodOverride = require('method-override'); // const client = new pg.Client(process.env.DATABASE_URL) const client = new pg.Client({ connectionString: process.env.DATABASE_URL, ssl: { rejectUnauthorized: false } }); server.set('view engine','ejs') server.use(methodOverride('_method')) server.use(express.static('./public')) server.use(methodOverride('_method')) server.use(express.urlencoded({extended:true})); // for storing the data inside the body, instead of the url or the form data const PORT = process.env.PORT || 3000; client.connect() .then(()=>{ server.listen(PORT, () => { console.log(`listening to port ${PORT}`) }) }); server.get('/', mainPage) server.get('/search', handleSearch) server.get('/results', renderResults) server.post('/MyList', addToDatabase) server.get('/MyList',renderMyList) server.get('/details/:id', detailsPage) server.delete('/delete/:id', handleDelete) server.put('/update/:id',handleUpdate) function mainPage(req,res){ let jobsArray=[]; let url = `https://jobs.github.com/positions.json?location=usa`; superagent.get(url) .then(jobs=>{ jobs.body.forEach(job=>{ let newJob = new Jobs(job) jobsArray.push(newJob); }) res.render('main',{jobs: jobsArray}) }) } function handleSearch(req,res){ res.render('search') } function renderResults(req,res){ let description = req.query.description; let jobsArray=[]; let url = `https://jobs.github.com/positions.json?description=${description}&location=usa`; superagent.get(url) .then(jobs=>{ jobs.body.forEach(job=>{ let newJob = new Jobs(job) jobsArray.push(newJob); }) res.render('viewResults',{jobs:jobsArray}) }) } function addToDatabase(req,res){ let {title,company,location,url, description}=req.body; let sql = `insert into jobs (title,company,location,url, description) values ($1,$2,$3,$4,$5);` let safeValues = [title,company,location,url, description]; client.query(sql,safeValues) .then(()=>{ res.redirect('/MyList') }) } function renderMyList (req,res){ let sql = `select * from jobs;` client.query(sql) .then(data=>{ res.render('MyList',{jobs:data.rows}) }) } function detailsPage(req,res){ let id= req.params.id; let sql = `select * from jobs where id=$1;` let safeValues=[id]; client.query(sql,safeValues) .then(data=>{ res.render('details',{job:data.rows[0]}) }) } function handleDelete(req,res){ let sql = `delete from jobs where id=$1;` let safeValues=[req.params.id] client.query(sql,safeValues) .then(()=>{ res.redirect('/MyList') }) } function handleUpdate(req,res){ let id= req.params.id; let {title,company,location,url, description}=req.body; let sql = `update jobs set title=$1, company=$2, location=$3, url=$4, description=$5 where id=$6;` let safeValues = [title,company,location,url, description,id] client.query(sql,safeValues) .then(()=>{ res.redirect(`/details/${id}`) }) } function Jobs(element){ this.title=element.title this.company=element.company this.location=element.location this.url=element.url this.description = element.description; } // this was fun
var app = angular.module('distEdit', ['toastr']); app.controller('distEditCtrl', function($scope, distSer,$stateParams,$state,toastr){ $scope.showed=true distSer.gitName().then(function(response){ if(response.data.code == 0){ $scope.names = response.data.data; } }); distSer.getArea().then(function(response){ if(response.data.code == 0){ $scope.areas = response.data.data; } }); distSer.getDeparts().then(function(response){ if(response.data.code == 0){ $scope.departs = response.data.data; } }); $scope.times=function(){ if($scope.dist.taskType=='ADMININSTRATION'){ $scope.dist.timesType='ADMININSTRATIONS' }else if($scope.dist.taskType=='ENGINEERING'){ $scope.dist.timesType='ENGINEERINGS' }else if($scope.dist.taskType=='TRAINING'){ $scope.dist.timesType='TRAININGS' } } $scope.btos =[{questions:[{}]}]; $scope.add = function(){ var obj = {questions:[{}]}; $scope.btos.push(obj); } $scope.del = function(flag){ $scope.btos.splice(flag,1); } var infoData ={id: $stateParams.id}; //获取ID distSer.distriId(infoData).then(function(response){ if(response.data.code== 0){ $scope.dist = response.data.data; if($scope.dist.questions!='' && $scope.dist.questions!=undefined){ $scope.btos=$scope.dist.questions; } }else{ toastr.error( response.data.msg, '温馨提示'); } }); //------------------------------------------接口获取没弄-------------------------------------------- //编辑点击提交 $scope.openEditFun = function(){ for(let i=0;i<$scope.btos.length;i++){ $scope.btos[i].expectTime=angular.element(".expectTime")[i].value; } var data = { id:$stateParams.id, execute:$scope.dist.execute, executeArea:$scope.dist.executeArea, executeDepart:$scope.dist.executeDepart, planNum:$scope.dist.planNum, taskType:$scope.dist.taskType, taskName:$scope.dist.taskName, needTime:$scope.dist.needTime1, needType:$scope.dist.needType, content:$scope.dist.content, planTime:angular.element('.planTime').val(), startTime:angular.element('.startTime').val(), endTime:angular.element('.endTime').val(), startExecute:angular.element('.startExecute').val(), endExecute:angular.element('.endExecute').val(), actualTime:$scope.dist.actualTime1, actualType:$scope.dist.actualType, undoneTime:$scope.dist.undoneTime1, undoneType:$scope.dist.undoneType, taskStatus:$scope.dist.taskStatus, finishTime:angular.element('.finishTime').val(), remark:$scope.dist.remark, notice:$scope.dist.notice, reimbursement:$scope.dist.reimbursement, question:$scope.dist.question, moudle:$scope.dist.moudle, timesType:$scope.dist.timesType, gpriority:$scope.dist.gpriority, questions:angular.copy($scope.btos) } var addData = converFormData(data); distSer.distriEdit(addData).then(function(response){ if(response.data.code == 0){ $state.go('root.allocation.distribution.list[12]'); toastr.success( "编辑成功", '温馨提示'); }else{ toastr.error( response.data.msg, '温馨提示'); } }); }; }); //数据类型转换工具 function converFormData() { var objToFormData = function(obj,obj2,sec,flag){ if(obj){ var count = 0; for(var name in obj){ var val = obj[name]; if(val instanceof Array){ val.forEach(function (item,index) { for(var name2 in item){ var val2 = item[name2]; if(val2 instanceof Array){ val2.forEach(function (dItem,dIndex) { objToFormData(dItem,obj,name+'['+index+'].'+name2,dIndex); }); }else{ if((typeof val2)!='function'){ obj[name+'['+index+'].'+name2] = val2; } } } }); delete obj[name]; }else if(sec){ if((typeof val)!='function'){ obj2[sec+'['+flag+'].'+name] = val; count++; } }else if(typeof val == 'object'){ for(var key in val){ obj[name + '.' + key] = val[key]; } delete obj[name]; } } } } var _obj = $.extend(true,{},arguments[0]); objToFormData(_obj); return _obj; }
import {h,render,patch} from '../../source/vue/vdom' //节约性能 先把真实节点用对象表示出来 ,再通过对象渲染到页面上 // 前端操作dom的时候 排序 -> 正序 反序列 删除 //虚拟dom 只是一个对象 //vue template render函数 s //初始化 将虚拟节点 渲染到页面 //<div id='container><span style='color:red'>hello </span>wz<div> let oldVnode = h('div',{id:'container'}, h('li',{style:{background:'red'},key:'a'},'a'), h('li',{style:{background:'yellow'},key:'b'},'b'), h('li',{style:{background:'pink'},key:'c'},'c'), h('li',{style:{background:'blue'},key:'d'},'d'), ); let newVnode = h('div',{id:'aa'}, h('li',{style:{background:'blue'},key:'e'},'e'), h('li',{style:{background:'red'},key:'a'},'a'), h('li',{style:{background:'green'},key:'f'},'f'), h('li',{style:{background:'pink'},key:'c'},'c'), h('li',{style:{background:'black'},key:'n'},'n'), ) //patchVnode 用新的虚拟节点 和老的虚拟节点 做对比 更新真实dom元素 let container = document.getElementById('app') render(oldVnode,container) setTimeout(() => { patch(oldVnode,newVnode); }, 1000); // let obj = { // tag:'div', // props:{}, // children:[{ // tag:undefined, // props:undefined, // children:undefined, // text:'hello' // }] // } // new Vue({ // render(h){ // return h('div',{},hello) // } // })
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { observer } from 'mobx-react'; import http from 'common/http'; import utils from 'common/utils'; import AsynchronousLinkSelectTree from 'components/AsynchronousLinkSelectTree'; class FlowParameter extends Component { constructor(props) { super(props); // this.popupModel = popupModel; this.state={ loading:true, data:[] } } onSelect=(value)=>{ console.log(value) } onChange=(value,label)=>{ console.log(value) console.log(label) } componentDidMount() { } render(){ return ( <div> <AsynchronousLinkSelectTree style={{ width: 300 }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} placeholder='请选择' onChange={this.onChange} onSelect= {this.onSelect} size= 'small' /> </div> ); } } export default FlowParameter;
import React, { useState } from 'react'; import './style.css'; import API from '../../../Utilities/API'; export default function CreateSprint({ isOpen, toggle }) { const [sprint, setSprint] = useState({ name: null }); const showHideClassName = isOpen ? 'modal display-block' : 'modal display-none'; const formUpdate = (fieldName, value) => { let tempSprint = { ...sprint }; tempSprint[fieldName] = value; setSprint(tempSprint); }; const addSprint = () => { API.createSprint(sprint).then(res => { if (res.status == 200) { toggle(); } else { return false; } }); }; return ( <div className={showHideClassName}> <form id='form' className='form modal-main' onSubmit={e => e.preventDefault()} > <h2 data-test='header'>Create a Sprint</h2> <div className='form-control'> <label for='name' data-test='create-sprint-modal-label-name'> Name </label> <input type='text' id='name' placeholder='Enter sprint name' name='name' data-test='create-sprint-modal-input-name' value={sprint.name} onChange={e => formUpdate(e.target.name, e.target.value)} /> <small className='error' data-test='create-sprint-modal-error-name'> Error message </small> </div> <button type='submit' className='close' data-test='create-sprint-modal-submit-button' onClick={() => addSprint()} > Submit </button> <button type='cancel' className='close' data-test='create-sprint-modal-cancel-button' onClick={() => toggle()} > Cancel </button> </form> </div> ); }
import React from "react"; import { useState } from "react"; import Dialog from "./UI/Dialog/Dialog"; import TextField from "./UI/TextField/TextField"; import { PlusOutlined } from "@ant-design/icons"; function AddGenre({ handleCreate }) { const [name, setName] = useState(""); const [isDialogOpen, setIsDialogOpen] = useState(false); const handleSave = () => { handleCreate({ name }); setIsDialogOpen(false); }; const handleOpen = () => { setIsDialogOpen(true); }; const handleClose = () => { setIsDialogOpen(false); }; return ( <> <div className="genre" onClick={handleOpen}> <PlusOutlined /> Assign genre </div> <Dialog title={"Assign genre"} onSave={handleSave} handleClose={handleClose} open={isDialogOpen} > <TextField placeholder="Enter genre" value={name} onChange={(e) => setName(e.target.value)} /> </Dialog> </> ); } export default AddGenre;
function AccessMap(mapEl, captionEl) { this.accessible = false; this.statistics = false; this._mapEl = mapEl; this._captionEl = captionEl; this._points = []; this._data = undefined; this._lastSelectedPoint = undefined; this._d3Voronoi = d3.geom.voronoi().x(function(d) { return d.x; }).y(function(d) { return d.y; }); this._setupMapbox(); } AccessMap._DISPOTRAINS_STATIONS = "http://dispotrains.membrives.fr/app/GetStations/"; AccessMap._DISPOTRAINS_STATS = "http://dispotrains.membrives.fr/app/AllStats/"; AccessMap._STATIONS_CSV = "full-list.csv"; AccessMap.prototype._setupMapbox = function() { L.mapbox.accessToken = 'pk.eyJ1IjoiZW1lbWJyaXZlcyIsImEiOiIwNDViZWQyODJhNTczNTg4ZWEzNzI4MzllNzk4ODk1NyJ9.ijO7LzQGt_kX1IwAOrUYzA'; this._map = L.mapbox.map(this._mapEl, 'emembrives.d5f86755') .fitBounds([ [ 49.241299, 3.55852 ], [ 48.120319, 1.4467 ] ]); var self = this; var mapLayer = { onAdd : function(map) { map.on('viewreset moveend', function() { self.loadAndDraw(); }); self.loadAndDraw(); } }; this._map.on('ready', function() { self.loadAndDraw(); self._map.addLayer(mapLayer); }); }; AccessMap.prototype._getData = function() { var availabilityPromise = d3.promise.json(AccessMap._DISPOTRAINS_STATIONS) .then(function(stations) { for (var j = 0; j < stations.length; j++) { var d = stations[j]; var good = true; for (var i = 0; i < d.elevators.length; i++) { if (d.elevators[i].status.state != "Disponible") { good = false; break; } } d.good = good; } return stations; }); var statisticsPromise = d3.promise.json(AccessMap._DISPOTRAINS_STATS); var stationsPromise = d3.promise.csv(AccessMap._STATIONS_CSV); return Promise .all([ availabilityPromise, stationsPromise, statisticsPromise ]) .then(this._mergeData); }; AccessMap.prototype._mergeData = function(values) { var availabilities = {}; for (var i = 0; i < values[0].length; i++) { availabilities[values[0][i].name.toLowerCase()] = values[0][i]; } var stations = values[1]; var statistics = {}; for (var i = 0; i < values[2].length; i++) { statistics[values[2][i].name.toLowerCase()] = values[2][i]; } var merged_stations = stations.map(function(d, index) { d.accessible = d.accessible === "True"; if (!d.accessible) { return d; } if (d.name.toLowerCase() in availabilities) { var key = d.name.toLowerCase(); d.name = availabilities[key].displayname; d.dispotrains_id = availabilities[key].name; d.good = availabilities[key].good; d.lines = availabilities[key].lines; d.elevators = availabilities[key].elevators; d.percentfunction = statistics[key].percentfunction; return d; } console.log("Unable to merge station " + d.name); console.log(d); return d; }); return merged_stations; }; AccessMap.prototype.loadAndDraw = function() { var self = this; if (this._data === undefined) { this._data = this._getData(); } return this._data.then(function(p) { self.draw(p); }); }; var metersPerPixel = function(latitude, zoomLevel) { var earthCircumference = 40075017; var latitudeRadians = latitude * (Math.PI / 180); return earthCircumference * Math.cos(latitudeRadians) / Math.pow(2, zoomLevel + 8); }; var pixelValue = function(latitude, meters, zoomLevel) { return meters / metersPerPixel(latitude, zoomLevel); }; AccessMap.prototype.draw = function(points) { var self = this; d3.select('#overlay').remove(); var bounds = this._map.getBounds(); var topLeft = this._map.latLngToLayerPoint(bounds.getNorthWest()); var bottomRight = this._map.latLngToLayerPoint(bounds.getSouthEast()); var existing = d3.set(); var drawLimit = bounds.pad(0.4); filteredPoints = points.filter(function(d, i) { var latlng = new L.LatLng(d.latitude, d.longitude); if (!drawLimit.contains(latlng)) { return false }; if (!d.accessible && self.accessible) { return false; } var point = self._map.latLngToLayerPoint(latlng); key = point.toString(); if (existing.has(key)) { return false }; existing.add(key); d.x = point.x; d.y = point.y; return true; }); var svg = d3.select(this._map.getPanes().overlayPane) .append("svg") .attr('id', 'overlay') .attr("class", "leaflet-zoom-hide") .style("width", this._map.getSize().x + 'px') .style("height", this._map.getSize().y + 'px') .style("margin-left", topLeft.x + "px") .style("margin-top", topLeft.y + "px") .append("g") .attr("transform", "translate(" + (-topLeft.x) + "," + (-topLeft.y) + ")"); var clips = svg.append("svg:g").attr("id", "point-clips"); var points = svg.append("svg:g").attr("id", "points"); var paths = svg.append("svg:g").attr("id", "point-paths"); clips.selectAll("clipPath") .data(filteredPoints) .enter() .append("svg:clipPath") .attr("id", function(d, i) { return "clip-" + i; }) .append("svg:circle") .attr('cx', function(d) { return d.x; }) .attr('cy', function(d) { return d.y; }) .attr('r', pixelValue(48.8534100, 20000, this._map.getZoom())); var datapointFunc = function(datapoint) { return "M" + datapoint.join(",") + "Z"; }; var areaPath = paths.selectAll("path") .data(this._d3Voronoi(filteredPoints)) .enter() .append("svg:path"); areaPath.attr("d", datapointFunc) .attr("id", function(d, i) { return "path-" + i; }) .attr("clip-path", function(d, i) { return "url(#clip-" + i + ")"; }) .style("stroke", d3.rgb(50, 50, 50)) .on('click', function(d) { self._selectPoint(d3.select(this), d); }) .classed("selected", function(d) { return this._lastSelectedPoint == d }) .classed("inaccessible", function(d) { return !d.point.accessible; }) .classed("malfunction", function(d) { return d.point.accessible && ( !d.point.good || self.statistics); }) .classed("ok", function(d) { return d.point.accessible && d.point.good && !self.statistics; }); if (self.statistics) { areaPath.style("opacity", function(d) { return (100 - d.point.percentfunction)/100; }); } paths.selectAll("path") .on("mouseover", function(d, i) { d3.select(this).classed("mouseover", true); }) .on("mouseout", function(d, i) { d3.select(this).classed("mouseover", false); }); points.selectAll("circle") .data(filteredPoints) .enter() .append("svg:circle") .attr("id", function(d, i) { return "point-" + i; }) .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }) .attr("r", 1.5) .attr('stroke', 'none'); }; AccessMap.prototype._selectPoint = function(cell, point) { d3.selectAll('.selected').classed('selected', false); if (this._lastSelectedPoint == point) { this._lastSelectedPoint = null; d3.select('#selected').classed('hidden', true); return; } this._lastSelectedPoint = point; cell.classed('selected', true); d3.select('#selected').classed('hidden', false); d3.select('#selected #header').text(point.point.name); if (!point.point.accessible) { d3.select("#selected #card-inaccessible").style("display", null); d3.select("#selected #card-accessible").style("display", "none"); return; } else { d3.select("#selected #card-inaccessible").style("display", "none"); d3.select("#selected #card-accessible").style("display", null); } d3.select("#selected #line-count").text(point.point.lines.length); d3.select("#selected #lines").text(this._lineStr(point.point.lines)); d3.select("#selected #elevator-count") .text(point.point.elevators.length) d3.select("#selected #broken-elevator-count") .text(this._elevatorStr(point.point.elevators)); d3.select("#selected #function").text(point.point.percentfunction.toFixed(1)); d3.select("#selected a#dispotrains") .attr("href", "/gare/" + point.point.dispotrains_id); }; AccessMap.prototype._lineStr = function(lines) { var s = lines[0].id; for (var i = 1; i < lines.length; i++) { s += ", "; s += lines[i].id; } return s; }; AccessMap.prototype._elevatorStr = function(elevators) { var bad = 0; for (var i in elevators) { if (elevators[i].status.state !== "Disponible") { bad++; } } return bad; };
/** * Created by iyobo on 2017-04-14. */ import React, {Component, PropTypes} from 'react'; import GenericFieldInput from './generic/GenericFieldInput'; import DateInput from './date/DateInput'; import BooleanInput from './boolean/BooleanInput'; import TextAreaInput from './textarea/TextAreaInput'; import RichTextInput from './richtext/RichTextInput'; import ObjectFieldInput from './object/ObjectFieldInput'; import ArrayFieldInput from './array/ArrayFieldInput'; import MapFieldInput from './map/MapFieldInput'; import FileFieldInput from './file/FileFieldInput'; import RefInput from './ref/RefInput'; import PasswordInput from './password/PasswordInput'; import SelectInput from './select/SelectInput'; const _ = require('lodash'); var humanize = require('string-humanize') export default class FormField extends Component { constructor() { super(); } render() { //aa let fieldElem = null; const field = this.props.field; const meta = field.meta; let hideLabel = this.props.hideLabel; //console.log(this.props) if (meta.type === 'Date') { fieldElem = <DateInput {...this.props} /> } else if (meta.type === 'Boolean') { hideLabel = true; fieldElem = <BooleanInput {...this.props} /> } else if (meta.widget === 'password') { fieldElem = <PasswordInput {...this.props} /> } else if (meta.widget === 'textarea') { fieldElem = <TextAreaInput {...this.props} /> } else if (meta.widget === 'ref') { fieldElem = <RefInput {...this.props} /> } else if (meta.widget === 'richtext') { fieldElem = <RichTextInput {...this.props} /> } else if (meta.widget === 'map') { fieldElem = <MapFieldInput {...this.props} /> } else if (meta.widget === 'file') { fieldElem = <FileFieldInput {...this.props} /> } else if (meta.choices) { fieldElem = <SelectInput {...this.props} /> } else if (meta.type === 'Object') { //hideLabel = true; fieldElem = <ObjectFieldInput {...this.props} /> } else if (meta.type === 'Array') { //hideLabel = true; fieldElem = <ArrayFieldInput {...this.props} /> } else { fieldElem = <GenericFieldInput {...this.props} /> } fieldElem = fieldElem || <div>No Matching Field Element found</div> return ( <div class="form-group"> {hideLabel ? '' : <label>{humanize(this.props.name)}</label>} {fieldElem} </div> ); } } FormField.contextTypes = { router: PropTypes.any }
import React , {useRef} from 'react' import {Link , useLocation, useHistory} from "react-router-dom" function Navbar() { const navBtn = useRef(null) const history = useHistory() let location = useLocation() const ToggleNav = () => { navBtn.current.classList.toggle("hidden") } const logout = () => { localStorage.removeItem("token") history.push("/login") } const returnBtn = () =>{ if (localStorage.getItem("token")){ return <button className="py-2 px-4 bg-purple-600 text-white hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-600" onClick={logout}>Logout</button> } return <><Link to="/login"><button className=" py-2 px-4 bg-purple-600 text-white hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-600 ">sign In</button></Link> <Link to="/register"><button className=" py-2 px-4 bg-purple-600 text-white hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-600 ">Sign Up</button></Link></> } return ( <> <nav className="bg-white shadow-lg fixed top-0 right-0 left-0"> <div className="flex justify-between px-4"> <div className="flex space-x-9"> <div className="flex items-center"> <h1 className=" whitespace-nowrap font-semibold text-lg text-gray-600"><Link to="" className="">TheMerSterSTER</Link ></h1> </div> <div className="md:flex hidden items-center space-x-2"> <span className={`px-2 py-4 ${location.pathname == '/' ? "border-b-4":""} border-purple-600 hover:bg-purple-50 w-30 text-center`}> <Link to="/" className="px-2 py-4 hover:text-purple-900 font-semibold transition duration-300">Home</Link > </span> {/* <span className={`px-2 py-4 ${location.pathname == '/products' ? "border-b-4":""} border-purple-600 hover:bg-purple-50 w-30 text-center`}> <Link to="/products" className="px-2 py-4 hover:text-purple-900 font-semibold transition duration-300">Products</Link > </span> */} <span className={`px-2 py-4 ${location.pathname == '/cart' ? "border-b-4":""} border-purple-600 hover:bg-purple-50 w-30 text-center`}> <Link to="/cart" className="px-2 py-4 hover:text-purple-900 font-semibold transition duration-300">Cart</Link > </span> </div> </div> <div className="md:flex hidden items-center space-x-4"> {returnBtn()} </div> <div className="md:hidden flex items-center my-3"> <button className="outline-none mobile-menu-button" onClick={ToggleNav}> <svg className="w-6 h-6 text-gray-500" xshow="!showMenu" fill="none" strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" viewBox="0 0 24 24" stroke="currentColor" > <path d="M4 6h16M4 12h16M4 18h16"></path> </svg> </button> </div> </div> <div ref={navBtn} className="hidden md:hidden p-2"> <ul className="w-full "> <li className="w-full flex justify-center text-md p-2 hover:bg-purple-300 transition duration-300"><Link to="/">Home</Link ></li> {/* <li className="w-full flex justify-center text-md p-2 hover:bg-purple-300 transition duration-300"><Link to="/products">Products</Link ></li> */} <li className="w-full flex justify-center text-md p-2 hover:bg-purple-300 transition duration-300"><Link to="/cart">Cart</Link ></li> </ul> <div className="flex justify-center space-x-3"> {returnBtn()} </div> </div> </nav> </> ) } export default Navbar
import React, { Component } from 'react'; import { connect } from 'react-redux'; import ColorPicker from './color/ColorPicker'; import styles from './joinplayer.less'; class JoinPlayer extends Component { constructor(props) { super(props); this.state = { name: props.playerName || '', color: props.playerColor || '', // color chosen formValid: props.playerName && props.playerColor } } render() { const className = styles['join-player'] return <form className={className} onSubmit= { this.handleSubmit.bind(this) } > <div> <label>name</label> <input type='text' value={this.state.name} id='name' onChange= {this.handleNameChange.bind(this) } /> </div> <div> <label>color</label> <ColorPicker className={styles['input']} selectedColor = { this.state.color } players = { this.props.players } onChange = { this.handleColorChange.bind(this) } /> </div> <div className={styles['info']}> { `${ this.props.players.length} player(s) in lobby`} </div> <div> <input type = 'submit' value='Join' disabled= { !this.state.formValid } /> </div> </form>; } handleNameChange(event) { this.setState({ name: event.target.value, formValid: event.target.value && this.state.color }); } handleColorChange(value) { this.setState({ color: value, formValid: !!this.state.name }); } handleSubmit(event) { event.preventDefault(); const { name, color } = this.state; this.props.submitClick(name, color ); } } const mapStateToProps = state => { return { players: state.players } } export default connect( mapStateToProps )(JoinPlayer);
function populate() { if (quiz.isEnded()) { } else { // show question var element = $(".quiz-screen__title"); element.html(quiz.getQuestionIndex().text); // show options var choices = quiz.getQuestionIndex().choices; for (var i = 0; i < choices.length; i++) { var element = $("#choice" + i); element.html(choices[i]); guess("btn" + i, choices[i]); } } }; //TODO: chenge to jQuery function guess(id, guess) { var button = document.getElementById(id); button.onclick = function() { quiz.guess(guess); makeProgress(); populate(); } }; function makeProgress(){ if(progress <= 100){ progress += 100 / questions.length; progressBar.animate ({width: progress + '%'}); } } var questions = [ new Question("Is a star made of gas?", ["Yeap!", "Naah"], "Yeap!"), new Question("Does a star starts from a black hole", ["Yeap!", "Naah"], "Naah"), new Question("Pulsar is a big collection of matter.", ["Yeap!", "Naah"], "Naah"), ]; var quiz = new Quiz(questions); var progressBar = $(".quizz-screen__progress-bar_progress"); var progress = 0; populate();
const arrayCubeRootToJson = (arr) => { try { let rootJson = {}; arr.map((number) => { let cubeRoot = Math.cbrt(number); if (cubeRoot === 0 || isNaN(number)) throw new Error(); rootJson[number] = cubeRoot; }); return rootJson; } catch (error) { throw new Error(error); } }; module.exports = arrayCubeRootToJson;
import test from 'tape'; const sut = require('../'); test('Validate kid numbers', (t) => { t.plan(3); const correct = sut.kidNumber('270236900527'); const incorrect = sut.kidNumber('-270236900527'); const chars = sut.kidNumber('dsfdfs'); t.ok(correct, 'Given a valid kid number, validation should be successful'); t.notOk(incorrect, 'Given an invalid kid number, validation should not be successful'); t.notOk(chars, 'Kid number should be a number and chars should not be successful'); });
'use strict'; const config = require('../helpers/config'); const apiUrl = config.get('API_ROOT'); module.exports = { login: `${apiUrl}/users/login`, register: `${apiUrl}/users/register`, task: `${apiUrl}/tasks/{id}` };
function Booster() { this.pick = function(boost, total, ordem, cores, total_cor) { var pick = Math.floor(Math.random() * total); var pick_cor = Math.floor(Math.random() * total_cor); var aux = null; var aux2 = null; parc = 0; for (var i = 0; i < boost.length ; i++ ) { if (parc + boost[i][0] >= pick) { aux = i; break; } parc = parc + boost[i][0]; } pick = Math.floor(Math.random() * boost[aux][1].length); if (pick == boost[aux][1].length) { pick = pick - 1; } parc = 0; for (var i = 0; i < cores.length ; i++ ) { if (parc + cores[i] >= pick_cor) { aux2 = i; break; } parc = parc + cores[i]; } deck.all[boost[aux][1][pick]][aux2] ++; tela.pokedex[boost[aux][1][pick]][aux2] ++; tela.pokedex[boost[aux][1][pick]][4] = true; this.write(boost[aux][1][pick], ordem, aux2); } this.write = function(card, slot, cor) { $('.boost_result').append("<div class=\"card\" data-slot=\""+slot+"\"><div id=\"tipo1\"></div><div id=\"tipo2\"></div><img src=\"\" /><ul><li id=\"hp\"><span>HP:</span><span></span></li><li id=\"ataque\"><span>Ataque:</span><span></span></li><li id=\"defesa\"><span>Defesa:</span><span></span></li><li id=\"esp-ataque\"><span>Esp. Ataque:</span><span></span></li><li id=\"esp-defesa\"><span>Esp. Defesa:</span><span></span></li><li id=\"velocidade\"><span>Velocidade:</span><span></span></li></ul><img id=\"mini_img1\" /><img id=\"mini_img2\" /><img id=\"mini_img3\" /><div id=\"nome\">a</div></div>"); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#nome').html(cards[card].id + ' - '+ cards[card].nome); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#hp span:last-child').html(cards[card].hp); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#ataque span:last-child').html(cards[card].ataque); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#defesa span:last-child').html(cards[card].defesa); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#esp-ataque span:last-child').html(cards[card].especial_ataque); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#esp-defesa span:last-child').html(cards[card].especial_defesa); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#velocidade span:last-child').html(cards[card].velocidade); $('.boost_result .card[data-slot="'+(slot)+'"]').find('img').attr('src', 'imagens/'+cards[card].figura); $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-tipo1', cards[card].tipo1.toLowerCase()); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img1').attr('src', 'imagens/tipos/'+cards[card].tipo1.toLowerCase()+'_mini.png'); if (cards[card].tipo2 && cards[card].tipo2 != undefined) { $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-tipo2', cards[card].tipo2.toLowerCase()); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img3').attr('src', 'imagens/tipos/'+cards[card].tipo2.toLowerCase()+'_mini.png'); } else { $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-tipo2', cards[card].tipo1.toLowerCase()); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img3').attr('src', 'imagens/tipos/'+cards[card].tipo1.toLowerCase()+'_mini.png'); } switch (cor) { case 0: $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-cor', 'bronze'); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img2').attr('src', 'imagens/tipos/bronze_mini.png'); break; case 1: $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-cor', 'prata'); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img2').attr('src', 'imagens/tipos/prata_mini.png'); break; case 2: $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-cor', 'ouro'); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img2').attr('src', 'imagens/tipos/ouro_mini.png'); break; case 3: $('.boost_result .card[data-slot="'+(slot)+'"]').attr('data-cor', 'shiny'); $('.boost_result .card[data-slot="'+(slot)+'"]').find('#mini_img2').attr('src', 'imagens/tipos/shiny_mini.png'); break; } } this.abreBooster = function(boost) { switch (boost) { case 1: if (tela.wins < 1 && tela.free_packs[0] == 0) { alert('Você precisa ganhar 1 partida para liberar esse booster. Faltam: '+(1 - tela.wins)); return; } if (tela.dinheiro < 5 && tela.free_packs[0] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[0] > 0) { tela.free_packs[0] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 5; this.abreSimples(); break; case 2: if (tela.wins < 10 && tela.free_packs[1] == 0) { alert('Você precisa ganhar 10 partidas para liberar esse booster. Faltam: '+(10 - tela.wins)); return; } if (tela.dinheiro < 13 && tela.free_packs[1] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[1] > 0) { tela.free_packs[1] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 13; this.abreTriplo(); break; case 3: if (tela.wins < 75 && tela.free_packs[2] == 0) { alert('Você precisa ganhar 75 partidas para liberar esse booster. Faltam: '+(75 - tela.wins)); return; } if (tela.dinheiro < 20 && tela.free_packs[2] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[2] > 0) { tela.free_packs[2] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 20; this.abreQuintuplo(); break; case 4: if (tela.wins < 75 && tela.free_packs[3] == 0) { alert('Você precisa ganhar 75 partidas para liberar esse booster. Faltam: '+(75 - tela.wins)); return; } if (tela.dinheiro < 15 && tela.free_packs[3] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[3] > 0) { tela.free_packs[3] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 15; this.abrePrataSimples(); break; case 5: if (tela.wins < 125 && tela.free_packs[4] == 0) { alert('Você precisa ganhar 125 partidas para liberar esse booster. Faltam: '+(125 - tela.wins)); return; } if (tela.dinheiro < 39 && tela.free_packs[4] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[4] > 0) { tela.free_packs[4] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 39; this.abrePrataTriplo(); break; case 6: if (tela.wins < 200 && tela.free_packs[5] == 0) { alert('Você precisa ganhar 200 partidas para liberar esse booster. Faltam: '+(200 - tela.wins)); return; } if (tela.dinheiro < 60 && tela.free_packs[5] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[5] > 0) { tela.free_packs[5] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 60; this.abrePrataQuintuplo(); break; case 7: if (tela.wins < 150 && tela.free_packs[6] == 0) { alert('Você precisa ganhar 150 partidas para liberar esse booster. Faltam: '+(150 - tela.wins)); return; } if (tela.dinheiro < 50 && tela.free_packs[6] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[6] > 0) { tela.free_packs[6] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 50; this.abreOuroSimples(); break; case 8: if (tela.wins < 200 && tela.free_packs[7] == 0) { alert('Você precisa ganhar 200 partidas para liberar esse booster. Faltam: '+(200 - tela.wins)); return; } if (tela.dinheiro < 130 && tela.free_packs[7] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[7] > 0) { tela.free_packs[7] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 130; this.abreOuroTriplo(); break; case 9: if (tela.wins < 300 && tela.free_packs[8] == 0) { alert('Você precisa ganhar 300 partidas para liberar esse booster. Faltam: '+(300 - tela.wins)); return; } if (tela.dinheiro < 200 && tela.free_packs[8] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[8] > 0) { tela.free_packs[8] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 200; this.abreOuroQuintuplo(); break; case 10: if (tela.wins < 150 && tela.free_packs[9] == 0) { alert('Você precisa ganhar 300 partidas para liberar esse booster. Faltam: '+(300 - tela.wins)); return; } if (tela.dinheiro < 200 && tela.free_packs[9] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[9] > 0) { tela.free_packs[9] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 200; this.abreShinySimples(); break; case 11: if (tela.wins < 400 && tela.free_packs[10] == 0) { alert('Você precisa ganhar 400 partidas para liberar esse booster. Faltam: '+(400 - tela.wins)); return; } if (tela.dinheiro < 520 && tela.free_packs[10] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[10] > 0) { tela.free_packs[10] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 520; this.abreShinyTriplo(); break; case 12: if (tela.wins < 500 && tela.free_packs[11] == 0) { alert('Você precisa ganhar 500 partidas para liberar esse booster. Faltam: '+(500 - tela.wins)); return; } if (tela.dinheiro < 800 && tela.free_packs[11] == 0) { alert("Dinheiro Insuficiente"); return; } if (tela.free_packs[11] > 0) { tela.free_packs[11] --; $('.boost_list .boost[data-id="'+(boost - 1)+'"]').find('#num_pacotes').html(tela.free_packs[boost - 1]); } else tela.dinheiro = tela.dinheiro - 800; this.abreShinyQuintuplo(); break; } tela.salvar(); } this.abreBoosterLider = function(boost) { switch (boost) { case 0: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de um líder de ginásio específico (Brock) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreBrock(); break; case 1: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Misty) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreMisty(); break; case 2: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Lt. Surge) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreSurge(); break; case 3: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Erika) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreErika(); break; case 4: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Koga) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreKoga(); break; case 5: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Sabrina) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreSabrina(); break; case 6: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Blaine) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreBlaine(); break; case 7: if (tela.ownage[boost] == false) { alert('Você precisa ganhar de 15 x 0 de de um líder de ginásio específico (Giovanni) para liberar esse booster.'); return; } if (tela.dinheiro < 15) { alert("Dinheiro Insuficiente"); return; } tela.dinheiro = tela.dinheiro - 15; this.abreGiovanni(); break; } tela.salvar(); } this.abreSimples = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); this.pick(awards, 950, 1, cores, 563); } this.abreTriplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreQuintuplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 5 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abrePrataSimples = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 200; cores[1] = 500; cores[2] = 50; cores[3] = 10; $('.boost_result').html(''); this.pick(awards, 950, 1, cores, 760); } this.abrePrataTriplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 200; cores[1] = 500; cores[2] = 50; cores[3] = 10; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 760); } } this.abrePrataQuintuplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 200; cores[1] = 500; cores[2] = 50; cores[3] = 10; $('.boost_result').html(''); for (var i = 0; i < 5 ; i++ ) { this.pick(awards, 950, i, cores, 760); } } this.abreOuroSimples = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 20; cores[1] = 50; cores[2] = 150; cores[3] = 30; $('.boost_result').html(''); this.pick(awards, 950, 1, cores, 250); } this.abreOuroTriplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 20; cores[1] = 50; cores[2] = 150; cores[3] = 30; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 250); } } this.abreOuroQuintuplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 20; cores[1] = 50; cores[2] = 150; cores[3] = 30; $('.boost_result').html(''); for (var i = 0; i < 5 ; i++ ) { this.pick(awards, 950, i, cores, 250); } } this.abreShinySimples = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 5; cores[1] = 10; cores[2] = 50; cores[3] = 100; $('.boost_result').html(''); this.pick(awards, 950, 1, cores, 160); } this.abreShinyTriplo = function() { console.log('ouro'); var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 5; cores[1] = 10; cores[2] = 50; cores[3] = 100; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 160); } } this.abreShinyQuintuplo = function() { var awards = new Array(); awards[0] = [750, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133]]; awards[1] = [145, [1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40,42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147]]; awards[2] = [50, [3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107,108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148]]; awards[3] = [5, [144,145,146,149,150,151]]; var cores = new Array(); cores[0] = 5; cores[1] = 10; cores[2] = 50; cores[3] = 100; $('.boost_result').html(''); for (var i = 0; i < 5 ; i++ ) { this.pick(awards, 950, i, cores, 160); } } this.abreBrock = function() { var awards = new Array(); awards[0] = [750, [27,50,74]]; awards[1] = [145, [28,51,75,104,111]]; awards[2] = [50, [31,34,76,95,105,112]]; awards[3] = [5, [138,139,140,141,142]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreMisty = function() { var awards = new Array(); awards[0] = [750, [54,60,72,86,90,98,116,118,120,129]]; awards[1] = [145, [1,55,61,73,87,91,99,117,119,121]]; awards[2] = [50, [2,62,131,130]]; awards[3] = [5, [3,138,139,140,141]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreSurge = function() { var awards = new Array(); awards[0] = [750, [81,100]]; awards[1] = [145, [25,82,101]]; awards[2] = [50, [26,125,135]]; awards[3] = [5, [145]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreErika = function() { var awards = new Array(); awards[0] = [750, [43,46,69]]; awards[1] = [145, [1,44,47,70,102]]; awards[2] = [50, [2,45,71,103]]; awards[3] = [5, [3,114]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreKoga = function() { var awards = new Array(); awards[0] = [750, [13,14,23,29,32,41,43,48,69,88,109]]; awards[1] = [145, [1,15,24,30,33,42,44,70,72,92]]; awards[2] = [50, [2,45,49,71,73,89,93,110]]; awards[3] = [5, [3,31,34,94]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreSabrina = function() { var awards = new Array(); awards[0] = [750, [63,79,96]]; awards[1] = [145, [64,102]]; awards[2] = [50, [65,80,97,103,121]]; awards[3] = [5, [122,124,150,151]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreBlaine = function() { var awards = new Array(); awards[0] = [750, [37,59,77]]; awards[1] = [145, [4,38,78]]; awards[2] = [50, [5,59]]; awards[3] = [5, [6,126,136,146]]; var cores = new Array(); cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; $('.boost_result').html(''); for (var i = 0; i < 3 ; i++ ) { this.pick(awards, 950, i, cores, 563); } } this.abreEspecialBooster = function(id) { switch (id) { case 1: if (tela.special_deck[0] <= 0) { alert('Nenhum deck disponível, compre mais no Shop.'); return; } tela.special_deck[0] --; this.abreEspecialRandom(1, 0); break; case 2: if (tela.special_deck[1] <= 0) { alert('Nenhum deck disponível, compre mais no Shop.'); return; } tela.special_deck[1] --; this.abreEspecialRandom(1, 1); break; case 3: if (tela.special_deck[2] <= 0) { alert('Nenhum deck disponível, compre mais no Shop.'); return; } tela.special_deck[2] --; this.abreEspecialRandom(1, 2); break; case 4: if (tela.special_deck[3] <= 0) { alert('Nenhum deck disponível, compre mais no Shop.'); return; } tela.special_deck[3] --; this.abreEspecialRandom(1, 3); break; } } this.abreEspecialRandom = function(multi, cor) { var awards = new Array(); awards[0] = [100, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133,1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40, 42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147,3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107, 108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148,144,145,146,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173, 174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251]]; awards[1] = [100, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133,1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40, 42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147,3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107, 108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148,144,145,146,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173, 174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251]]; awards[2] = [100, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133,1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40, 42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147,3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107, 108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148,144,145,146,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173, 174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251]]; awards[3] = [100, [10,11,13,14,16,17,19,21,23,27,29,32,35,37,39,41,43,46,48,50,52,54,56,60,63,66,69,72,74,79,81,84,90,92,98,100,109,116,118,120,129,133,1,2,4,5,7,8,12,15,18,20,22,24,25,28,30,33,36,38,40, 42,44,47,49,53,55,57,58,61,64,67,70,73,75,77,80,82,83,86,88,91,93,96,99,101,102,104,110,111,117,119,134,135,136,138,140,147,3,6,9,26,31,34,45,51,59,62,65,68,71,76,78,85,87,89,94,95,97,103,105,106,107, 108,112,113,114,115,121,122,123,124,124,125,127,128,130,131,132,137,139,141,142,143,148,144,145,146,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173, 174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251]]; var cores = new Array(); var total = 0; switch (cor) { case 3: cores[0] = 5; cores[1] = 10; cores[2] = 50; cores[3] = 100; total = 164; break; case 2: cores[0] = 20; cores[1] = 50; cores[2] = 150; cores[3] = 30; total = 249; break; case 1: cores[0] = 200; cores[1] = 500; cores[2] = 50; cores[3] = 10; total = 759; break; case 0: cores[0] = 500; cores[1] = 50; cores[2] = 10; cores[3] = 3; total = 662; break; } $('.boost_result').html(''); for (var i = 0; i < multi ; i++ ) { this.pick(awards, 400, i, cores, total); } } }
const express = require('express'); const cookieParser = require('cookie-parser'); const next = require('next'); const errorHandler = require('./catsapi/middleware/error'); const connectDB = require('./config/db'); const dev = process.env.NODE_ENV !== 'production'; const app = next({ dev }); const handle = app.getRequestHandler(); const port = process.env.PORT || 5040; const catsAPI = require('./catsapi/index'); app .prepare() .then(() => { const server = express(); // Body parser server.use(express.json()); // Cookie Parser server.use(cookieParser()); // DB used for storing BofA referrals connectDB(); server.use('/catsapi', catsAPI); server.use(errorHandler); server.all('*', (req, res) => handle(req, res)); server.listen(port, err => { if (err) throw err; console.log(`> Ready on http://localhost:${port}`); }); }) .catch(ex => { console.error(ex.stack); process.exit(1); });
const webBaseTransformGroup = require(".."); const webJSTransformGroup = { name: "web/js", transforms: [ ...webBaseTransformGroup.transforms, "name/ti/camel", ], }; module.exports = webJSTransformGroup;
import React, {Component} from 'react'; import { Input, Select, Button,Icon,Table } from 'antd'; const Option = Select.Option; const Search = Input.Search; import './css/sellerList.css'; export default class SellerList extends Component{ constructor(props){ super(props); this.supplierName=''; // this.handleBlur=this.handleBlur.bind(this); this.handleChange=this.handleChange.bind(this) // this.handleFocus=this.handleFocus.bind(this) } // 下拉框切換 handleChange(value) { this.props.changeTable(value); } // handleBlur() { // console.log('blur'); // } // handleFocus() { // console.log('focus'); // } // 展示更多搜索條件 componentDidMount(){ } // 保存搜索条件 handlesupplierName = (value)=>{ console.log(value) // this.value = value; this.props.handleSearch({supplierName:value}) } render(){ return( <div className='topSearch'> <Select className='selectDown' showSearch style={{ width: 200 }} placeholder="按供应商显示" optionFilterProp="children" onChange={this.handleChange} defaultValue='2' // onFocus={this.handleFocus} // onBlur={this.handleBlur} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} > <Option value="1">按物料显示</Option> <Option value="2">按供应商显示</Option> </Select> <Search placeholder="按供应商名称物料名称进行搜索" onSearch={this.handlesupplierName} style={{ width: 300 }} size="default" enterButton="搜索" /> <div className='Buttons'> {/* <Button type="primary" className='exportOut'>导出</Button> <Button type="primary" className='printOut'>打印</Button> */} </div> </div> ) } }
import React from 'react'; import PropTypes from 'prop-types'; import {Redirect, Route, Switch} from 'react-router-dom'; import {Answer} from './answer'; import {Article} from './article'; import {Creation} from './index'; //import {Review} from './review'; import {languageHelper} from '../../../tool/language-helper'; import {removeUrlSlashSuffix} from '../../../tool/remove-url-slash-suffix'; class CreationSwitchReact extends React.Component { constructor(props) { super(props); // state this.state = {}; // i18n this.text = CreationSwitchReact.i18n[languageHelper()]; } render() { const pathname = removeUrlSlashSuffix(this.props.location.pathname); if (pathname) { return (<Redirect to={pathname} />); } return ( <Switch> <Route path={this.props.match.url} exact component={routeProps => <Creation {...routeProps} />} /> <Route path={`${this.props.match.url}/answer`} component={routeProps => <Answer {...routeProps} />} /> <Route path={`${this.props.match.url}/article`} component={routeProps => <Article {...routeProps} />} /> {/*<Route*/} {/*path={`${this.props.match.url}/review`}*/} {/*component={routeProps => <Review {...routeProps} />}*/} {/*/>*/} <Redirect to={this.props.match.url} /> </Switch> ); } } CreationSwitchReact.i18n = [ {}, {} ]; CreationSwitchReact.propTypes = { // self // React Router match: PropTypes.object.isRequired, history: PropTypes.object.isRequired, location: PropTypes.object.isRequired }; export const CreationSwitch = CreationSwitchReact;
define([ // Application. "app" ], function(app) { var User = app.module(); User.Collection = Backbone.Collection.extend({ url: function() { console.log("user getdata"); return "https://api.github.com/orgs/" + this.org + "/members?callback=?"; }, cache: true, parse: function(obj) { // Safety check ensuring only valid data is used. if (obj.data.message !== "Not Found") { this.status = "valid"; console.log("obj.data parse" + obj.data); return obj.data; } this.status = "invalid"; console.log("obj parse" + obj); return obj; }, initialize: function(models, options) { if (options) { console.log("user-collection initialize if"); this.org = options.org; } console.log("user-collection initialize"); } }); User.Views.Item = Backbone.View.extend({ template: "user/item", tagName: "li", serialize: function() { console.log("user-views-item serialize"); return { model: this.model }; }, initialize: function() { console.log("user-views-item initialize"); this.listenTo(this.model, "change", this.render); } }); User.Views.List = Backbone.View.extend({ template: "user/list", serialize: function() { console.log("user-views-list serialize"); return { collection: this.options.users }; }, beforeRender: function() { console.log("user-views-list beforeRender"); this.options.users.each(function(user) { this.insertView("ul", new User.Views.Item({ model: user })); }, this); }, afterRender: function() { // Only re-focus if invalid. console.log("user-views-list afterRender"); this.$("input.invalid").focus(); }, initialize: function() { console.log("user-views-list initialize"); this.listenTo(this.options.users, { "reset": this.render, "fetch": function() { console.log("user fetch listened"); this.$("ul").parent().html("<img src='/app/img/spinner-gray.gif'>"); } }); }, events: { "submit form": "updateOrg" }, updateOrg: function(ev) { app.router.go("org", this.$(".org").val()); return false; } }); // Required, return the module for AMD compliance. return User; });
import React, { Component } from 'react'; import { Link, NavLink } from 'react-router-dom'; import {Navbar, Nav, NavDropdown, Container, Button} from 'react-bootstrap'; import './Nav.css'; import Logo from '../../Assets/logo.png'; class Navigation extends Component { render() { return ( <Navbar bg="light" expand="lg"> <Container> <Navbar.Brand><Link to="/home"><img className="logo" src={Logo} alt="logo"/></Link></Navbar.Brand> <Navbar.Toggle aria-controls="basic-navbar-nav" /> <Navbar.Collapse id="basic-navbar-nav"> <Nav className="mr-auto"> <Nav><NavLink to="/home">News</NavLink></Nav> <Nav><NavLink to="/fixtures">Fixtures</NavLink></Nav> <Nav><NavLink to="/competitions">Competitions</NavLink></Nav> <Nav><NavLink to="/teams">Teams</NavLink></Nav> <Nav><NavLink to="/transfer">Transfer</NavLink></Nav> </Nav> <Button>Login/Sign Up</Button> {/* <NavDropdown title="Dropdown" id="basic-nav-dropdown"> <NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item> <NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item> <NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item> <NavDropdown.Divider /> <NavDropdown.Item href="#action/3.4">Separated link</NavDropdown.Item> </NavDropdown> */} </Navbar.Collapse> </Container> </Navbar> ); } } export default Navigation;
import axios from "axios"; import {setAlert} from "./alert"; import { GET_POSTS, POST_ERROR, UPDATE_LIKES, DELETE_POST, ADD_POST, GET_POST, ADD_COMMENT, } from "./types"; import { Redirect } from "react-router-dom"; //Get posts export const getPosts = () => dispatch => { axios.get("/posts") .then(res => { dispatch({ type: GET_POSTS, payload: res.data }); }) .catch(err => { dispatch({ type: POST_ERROR, payload: {msg: err, status: err} }); }) } //Update likes from post export const updateLike = (postId, type) => dispatch => { const config = { headers: { "Content-Type":"application/json" } } const body = type === "dislike" ? JSON.stringify({dislike: true}) : JSON.stringify({like: true}) axios.put(`/posts/${postId}`,body, config) .then(res => { console.log(res.data); dispatch({ type: UPDATE_LIKES, payload: {id: postId, likes: res.data.likes, dislikes: res.data.dislikes} }); }) .catch(err => { dispatch({ type: POST_ERROR, payload: {msg: err.response.statusText, status: err.response.status} }); }) } //Delete post export const deletePost = (postId) => async dispatch => { try{ const res = await axios.delete(`/posts/${postId}`); dispatch({ type: DELETE_POST, payload: postId }); dispatch(setAlert("Se borró la publicación", "success")); return true; } catch(err) { console.log(err); dispatch({ type: POST_ERROR, payload: {msg: err.response.statusText, status: err.response.status} }); } } //Add post export const addPost = formData => dispatch => { const config = { headers: { "Content-Type":"application/json" } } axios.post(`/posts/`, formData, config) .then(res => { dispatch({ type: ADD_POST, payload: res.data }); dispatch(setAlert("Se creó la publicación", "success")); }) .catch(err => { console.log(err); dispatch({ type: POST_ERROR, payload: {msg: err.response.statusText, status: err.response.status} }); }) } //Get post export const getPost = postId => dispatch => { axios.get(`/posts/${postId}`) .then(res => { dispatch({ type: GET_POST, payload: res.data[0] }); }) .catch(err => { dispatch({ type: POST_ERROR, payload: {msg: err, status: err} }); }) } //Add post export const updateComment = (postId, text) => async dispatch => { const config = { headers: { "Content-Type":"application/json" } } const body = JSON.stringify({"comment": text}); try { const res = await axios.put(`/posts/${postId}`, body, config); dispatch({ type: ADD_COMMENT, payload: res.data.comments }); dispatch(setAlert("Se añadió el comentario", "success")); } catch (error) { console.log(error); dispatch({ type: POST_ERROR, payload: {msg: error.response.statusText, status: error.response.status} }); } }
const chai = require('chai'); const chaiHttp = require('chai-http'); const should = chai.should(); const app = require('../../express_server.js'); chai.use(chaiHttp); describe('/---Index Route Tests---/', () => { it('should return 200 and render text when / is called', () => { return chai.request(app) .get('/') .then((response) => { response.should.have.status(200); response.should.be.html; }) .catch((error) => { throw error; }); }); it('should return 200 and render JSON when /json is called', () => { return chai.request(app) .get('/json') .then((response) => { response.should.have.status(200); response.should.be.json; }) .catch((error) => { throw error; }); }); /* it('should return 302 and redirect to youtube when /u/b2xV2n is called', () => { return chai.request(app) .get('/u/b2xV2n') .then((response) => { response.should.have.status(200); }) .catch((error) => { throw error; }); }); TODO Figure out redirect logic it('should return 302 and redirect to google when /u/h1h1h1 is called', () => { return chai.request(app) .get('/u/h1h1h1') .then((response) => { response.should.have.status(200); }) .catch((error) => { throw error; }); }); */ it('should return 200 and render text when /login is called', () => { return chai.request(app) .get('/login') .then((response) => { response.should.have.status(200); response.should.be.html; }) .catch((error) => { throw error; }); }); it('should return 200 and render text when /register is called', () => { return chai.request(app) .get('/register') .then((response) => { response.should.have.status(200); response.should.be.html; }) .catch((error) => { throw error; }); }); });
function register(env) { env.addGlobal("blog_tag_url", handler); } function handler(selected_blog, tag_slug) { return `http://blog.hubspot.com/marketing/tag/inbound-marketing`; } export { handler, register as default };
import { Component } from "react"; class Bubble extends Component { getNumber(n) { if (!n) { return ""; } return n > 9 ? "9+" : n; } render() { return ( <span style={styles.bubble}>{this.getNumber(this.props.value)}</span> ); } } export default Bubble; const styles = { bubble: { backgroundColor: "#E9725A", borderRadius: "15px", color: "#fff", fontSize: "0.9rem", width: "20px", padding: "5px 10px", }, };
import React from 'react'; import {StyleSheet, View, Image } from 'react-native'; import fourImage from '../assets/image/4285.jpg' export default class Picture extends React.Component { render() { return ( <View style={styles.container}> <Image source={fourImage} style={{width:300, height:300,}}/> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, inputBox: { height: 40, borderColor: 'gray', borderWidth: 1, width: 150, padding: 10, }, });
'use strict'; /** * @author ankostyuk */ describe('app travel ui', function(){ var $controller, $httpBackend; function createAppTravelFormController(scope) { return $controller('appTravelFormController', { $scope: scope }); } beforeEach(angular.mock.module('app')); beforeEach(inject(function($injector) { $controller = $injector.get('$controller'); $httpBackend = $injector.get('$httpBackend'); // $httpBackend.whenGET(/places.aviasales.ru\/match/).respond(function(method, url, data, headers, params){ return [200, require('../places-aviasales-match--' + params.term + '.json')]; }); })); afterEach(function() { $httpBackend.verifyNoOutstandingExpectation(); $httpBackend.verifyNoOutstandingRequest(); }); it('appTravelFormController.searchDepartures("lon"), locale = en', function() { var $scope = {}, controller = createAppTravelFormController($scope); $scope.searchDepartures('lon'); $httpBackend.flush(); expect($scope).to.have.deep.property('departures.length', 9); // LON expect($scope).to.have.deep.property('departures[0].iata', 'LON'); expect($scope).to.have.deep.property('departures[0]._type', 'city'); expect($scope).to.have.deep.property('departures[0]._level', 1); expect($scope).to.have.deep.property('departures[0]._shortDisplayName', 'London, United Kingdom (LON)'); expect($scope).to.have.deep.property('departures[0]._fullDisplayName', 'London, United Kingdom (LON)'); // LON -> LHR expect($scope).to.have.deep.property('departures[1].iata', 'LHR'); expect($scope).to.have.deep.property('departures[1]._type', 'airport'); expect($scope).to.have.deep.property('departures[1]._level', 2); expect($scope).to.have.deep.property('departures[1]._shortDisplayName', 'Heathrow (LHR)'); expect($scope).to.have.deep.property('departures[1]._fullDisplayName', 'Heathrow, London, United Kingdom (LHR)'); // LON -> LGW expect($scope).to.have.deep.property('departures[2].iata', 'LGW'); expect($scope).to.have.deep.property('departures[2]._type', 'airport'); expect($scope).to.have.deep.property('departures[2]._level', 2); expect($scope).to.have.deep.property('departures[2]._shortDisplayName', 'Gatwick (LGW)'); expect($scope).to.have.deep.property('departures[2]._fullDisplayName', 'Gatwick, London, United Kingdom (LGW)'); // LON -> STN expect($scope).to.have.deep.property('departures[3].iata', 'STN'); expect($scope).to.have.deep.property('departures[3]._type', 'airport'); expect($scope).to.have.deep.property('departures[3]._level', 2); expect($scope).to.have.deep.property('departures[3]._shortDisplayName', 'Stansted (STN)'); expect($scope).to.have.deep.property('departures[3]._fullDisplayName', 'Stansted, London, United Kingdom (STN)'); // LON -> LTN expect($scope).to.have.deep.property('departures[4].iata', 'LTN'); expect($scope).to.have.deep.property('departures[4]._type', 'airport'); expect($scope).to.have.deep.property('departures[4]._level', 2); expect($scope).to.have.deep.property('departures[4]._shortDisplayName', 'Luton Airport (LTN)'); expect($scope).to.have.deep.property('departures[4]._fullDisplayName', 'Luton Airport, London, United Kingdom (LTN)'); // LON -> LCY expect($scope).to.have.deep.property('departures[5].iata', 'LCY'); expect($scope).to.have.deep.property('departures[5]._type', 'airport'); expect($scope).to.have.deep.property('departures[5]._level', 2); expect($scope).to.have.deep.property('departures[5]._shortDisplayName', 'London City Airport (LCY)'); expect($scope).to.have.deep.property('departures[5]._fullDisplayName', 'London City Airport, London, United Kingdom (LCY)'); // LON -> SEN expect($scope).to.have.deep.property('departures[6].iata', 'SEN'); expect($scope).to.have.deep.property('departures[6]._type', 'airport'); expect($scope).to.have.deep.property('departures[6]._level', 2); expect($scope).to.have.deep.property('departures[6]._shortDisplayName', 'Southend (SEN)'); expect($scope).to.have.deep.property('departures[6]._fullDisplayName', 'Southend, London, United Kingdom (SEN)'); // LGB expect($scope).to.have.deep.property('departures[7].iata', 'LGB'); expect($scope).to.have.deep.property('departures[7]._type', 'airport'); expect($scope).to.have.deep.property('departures[7]._level', 1); expect($scope).to.have.deep.property('departures[7]._shortDisplayName', 'Long Beach Municipal, Long Beach, CA, United States (LGB)'); expect($scope).to.have.deep.property('departures[7]._fullDisplayName', 'Long Beach Municipal, Long Beach, CA, United States (LGB)'); // YXU expect($scope).to.have.deep.property('departures[8].iata', 'YXU'); expect($scope).to.have.deep.property('departures[8]._type', 'airport'); expect($scope).to.have.deep.property('departures[8]._level', 1); expect($scope).to.have.deep.property('departures[8]._shortDisplayName', 'London International, London, ON, Canada (YXU)'); expect($scope).to.have.deep.property('departures[8]._fullDisplayName', 'London International, London, ON, Canada (YXU)'); }); it('appTravelFormController.searchArrivals("мос"), locale = ru', function() { var $scope = {}, controller = createAppTravelFormController($scope); $scope.searchArrivals('мос'); $httpBackend.flush(); expect($scope).to.have.deep.property('arrivals.length', 9); // MOW expect($scope).to.have.deep.property('arrivals[0].iata', 'MOW'); expect($scope).to.have.deep.property('arrivals[0]._type', 'city'); expect($scope).to.have.deep.property('arrivals[0]._level', 1); expect($scope).to.have.deep.property('arrivals[0]._shortDisplayName', 'Москва, Россия (MOW)'); expect($scope).to.have.deep.property('arrivals[0]._fullDisplayName', 'Москва, Россия (MOW)'); // MOW -> DME expect($scope).to.have.deep.property('arrivals[1].iata', 'DME'); expect($scope).to.have.deep.property('arrivals[1]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[1]._level', 2); expect($scope).to.have.deep.property('arrivals[1]._shortDisplayName', 'Домодедово (DME)'); expect($scope).to.have.deep.property('arrivals[1]._fullDisplayName', 'Домодедово, Москва, Россия (DME)'); // MOW -> SVO expect($scope).to.have.deep.property('arrivals[2].iata', 'SVO'); expect($scope).to.have.deep.property('arrivals[2]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[2]._level', 2); expect($scope).to.have.deep.property('arrivals[2]._shortDisplayName', 'Шереметьево (SVO)'); expect($scope).to.have.deep.property('arrivals[2]._fullDisplayName', 'Шереметьево, Москва, Россия (SVO)'); // MOW -> VKO expect($scope).to.have.deep.property('arrivals[3].iata', 'VKO'); expect($scope).to.have.deep.property('arrivals[3]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[3]._level', 2); expect($scope).to.have.deep.property('arrivals[3]._shortDisplayName', 'Внуково (VKO)'); expect($scope).to.have.deep.property('arrivals[3]._fullDisplayName', 'Внуково, Москва, Россия (VKO)'); // MOW -> ZIA expect($scope).to.have.deep.property('arrivals[4].iata', 'ZIA'); expect($scope).to.have.deep.property('arrivals[4]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[4]._level', 2); expect($scope).to.have.deep.property('arrivals[4]._shortDisplayName', 'Жуковский (ZIA)'); expect($scope).to.have.deep.property('arrivals[4]._fullDisplayName', 'Жуковский, Москва, Россия (ZIA)'); // OMO expect($scope).to.have.deep.property('arrivals[5].iata', 'OMO'); expect($scope).to.have.deep.property('arrivals[5]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[5]._level', 1); expect($scope).to.have.deep.property('arrivals[5]._shortDisplayName', 'Мостар, Босния и Герцеговина (OMO)'); expect($scope).to.have.deep.property('arrivals[5]._fullDisplayName', 'Мостар, Босния и Герцеговина (OMO)'); // OSM expect($scope).to.have.deep.property('arrivals[6].iata', 'OSM'); expect($scope).to.have.deep.property('arrivals[6]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[6]._level', 1); expect($scope).to.have.deep.property('arrivals[6]._shortDisplayName', 'Мосул, Ирак (OSM)'); expect($scope).to.have.deep.property('arrivals[6]._fullDisplayName', 'Мосул, Ирак (OSM)'); // LAX expect($scope).to.have.deep.property('arrivals[7].iata', 'LAX'); expect($scope).to.have.deep.property('arrivals[7]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[7]._level', 1); expect($scope).to.have.deep.property('arrivals[7]._shortDisplayName', 'Лос-Анджелес, CA, США (LAX)'); expect($scope).to.have.deep.property('arrivals[7]._fullDisplayName', 'Лос-Анджелес, CA, США (LAX)'); // KGS expect($scope).to.have.deep.property('arrivals[8].iata', 'KGS'); expect($scope).to.have.deep.property('arrivals[8]._type', 'airport'); expect($scope).to.have.deep.property('arrivals[8]._level', 1); expect($scope).to.have.deep.property('arrivals[8]._shortDisplayName', 'Гиппократес, Кос, Греция (KGS)'); expect($scope).to.have.deep.property('arrivals[8]._fullDisplayName', 'Гиппократес, Кос, Греция (KGS)'); }); it('appTravelFormController -> 3 passengers from London City to Moscow Domodedovo airport', function() { var $scope = {}, controller = createAppTravelFormController($scope); // departures $scope.searchDepartures('lon'); $httpBackend.flush(); $scope.travel.departure = $scope.departures[0]; // arrivals $scope.searchArrivals('мос'); $httpBackend.flush(); $scope.travel.arrival = $scope.arrivals[1]; // passengers $scope.travel.numberOfPassengers = 3; // Let's fly :) $scope.submit(); expect($scope).to.have.deep.property('travelData.departure.iata', 'LON'); expect($scope).to.have.deep.property('travelData.arrival.iata', 'DME'); expect($scope).to.have.deep.property('travelData.numberOfPassengers', 3); }); });
import Title from 'antd/lib/typography/Title'; import Checkbox from 'components/UI/Checkbox'; import Flex from 'components/UI/Flex'; import React from 'react'; import styles from './_filter_box.module.scss'; import { ReactComponent as ArrowActive } from './../../static/icons/16_arrow_active.svg'; import { ReactComponent as ArrowDisactive } from './../../static/icons/16_arrow_diactive.svg'; import { useState } from 'react'; import { Collapse } from 'antd'; import CustomScrollbar from 'components/CustomScrollbar/CustomScrollbar'; import { isCheckedFilter } from 'utils/helpers'; const { Panel } = Collapse; const FilterBox = ({ data, title, handleCheck, params }) => { return ( <div className={styles.filter}> <div className={styles.filter_divider} /> <div className="collapser"> <Collapse defaultActiveKey={['1']} ghost expandIconPosition="right" expandIcon={({ isActive }) => { return ( <ArrowActive className={styles.arrow} style={{ transform: isActive ? 'translateY(-50%) rotate(180deg)' : 'translateY(-50%) rotate(0deg)', }} /> ); }} > <Panel header={ <Title level={4} className={`${styles.filter_title}`}> {title}: </Title> } key="1" > <CustomScrollbar style={{ width: 500, height: 300 }}> {data.map((item) => ( <Checkbox key={item.id} title={item.value} count={item.feature} checked={isCheckedFilter(item.value, params)} onChange={handleCheck} /> ))} </CustomScrollbar> </Panel> </Collapse> </div> </div> ); }; export default FilterBox;
module.exports = function(grunt) { "use strict"; grunt.initConfig({ //Read the package.json (optional) pkg: grunt.file.readJSON('package.json'), // Metadata. meta: { basePath: '.', srcPath: 'src/', deployPath: 'www/' }, jade: { debug: { options: { data: { debug: true, pretty: true, } }, files: [{ expand: true, cwd: '<%= meta.srcPath %>', src: '**/*.jade', dest: '<%= meta.deployPath %>', ext: '.html' }] }, release: { options: { data: { debug: true, pretty: true, //если false то все минифицирует } }, files: [{ expand: true, cwd: '<%= meta.srcPath %>', src: '**/*.jade', dest: '<%= meta.deployPath %>', ext: '.html' }] } }, stylus: { debug: { options: { compress: false }, files: { "<%= meta.deployPath %>css/style.css": "<%= meta.srcPath %>styles/style.styl" } }, release: { options: { compress: true //use: [ // require('csso-stylus') //] }, files: { "<%= meta.deployPath %>css/style.css": "<%= meta.srcPath %>styles/style.styl" } } }, concat: { // Склеить js: { files: { // Все файлы разом, подключаются в алфавитном порядке '<%= meta.deployPath %>js/all.js': '<%= meta.srcPath %>scripts/**/*.js' } }, css: { files: { // Можно указывать конкретный порядок '<%= meta.deployPath %>css/all.css': [ '<%= meta.srcPath %>styles/layout.css', '<%= meta.srcPath %>styles/typo.css', '<%= meta.srcPath %>styles/gradient.css', '<%= meta.deployPath %>css/style.css' ]} } }, autoprefixer: { // Расставить необходимые префиксы в ЦСС main: { files: { '<%= meta.deployPath %>css/all.css': '<%= meta.deployPath %>css/all.css' } } }, uglify: { // Сжать скрипты main: { files: { '<%= meta.deployPath %>js/all.min.js': '<%= meta.deployPath %>js/all.js' } } }, htmlhint: { options: { htmlhintrc: '.htmlhintrc' }, html: { src: ['<%= meta.deployPath %>/**/*.html'] } }, csso: { // Cжать стили // Ссылаемся на autoprefixer, чтобы не повторяться main: { files: { '<%= meta.deployPath %>css/all.min.css': '<%= meta.deployPath %>css/all.css' } } }, imagemin: { png: { options: { optimizationLevel: 7 }, files: [{ // Set to true to enable the following options… expand: true, // cwd is 'current working directory' cwd: '<%= meta.srcPath %>images/', src: ['**/*.png'], // Could also match cwd line above. i.e. project-directory/img/ dest: '<%= meta.deployPath %>img/', ext: '.png' }] }, jpg: { options: { progressive: true }, files: [{ // Set to true to enable the following options… expand: true, // cwd is 'current working directory' cwd: '<%= meta.srcPath %>images/', src: ['**/*.jpg'], // Could also match cwd. i.e. project-directory/img/ dest: '<%= meta.deployPath %>img/', ext: '.jpg' }] } }, svgmin: { // Task options: { // Configuration that will be passed directly to SVGO plugins: [{ removeViewBox: false }] }, dist: { // Target files: [{ // Dictionary of files expand: true, // Enable dynamic expansion. cwd: '<%= meta.srcPath %>images/', // Src matches are relative to this path. src: ['**/*.svg'], // Actual pattern(s) to match. dest: '<%= meta.deployPath %>img/', // Destination path prefix. ext: '.svg' // Dest filepaths will have this extension. // ie: optimise img/src/branding/logo.svg and store it in img/branding/logo.min.svg }] } }, // Веб-сервер connect: { server: { options: { port: 9001, base: 'www' } } }, compress: { default: { options: { archive: '<%= meta.deployPath %>archive.zip' }, files: [ { expand: true, src: ['<%= meta.deployPath %>css/*.css'], dest: '.' }, { expand: true, src: ['<%= meta.deployPath %>img/**'], dest: '.' }, { expand: true, src: ['<%= meta.deployPath %>js/**'], dest: '.' }, { expand: true, src: ['<%= meta.deployPath %>*.html'], dest: '.' } ]} }, watch: { debug: { // Следим за файлами, выполняем таски при каждом изменении options: { // При вызове в терминале `grunt watch` // сначала выполнятся все таски и потом начнётся слежение atBegin: true, livereload: true, spawn: false }, files: ['<%= meta.srcPath %>**/*.jade', '<%= meta.srcPath %>**/*.html', '<%= meta.srcPath %>styles/*.styl', '<%= meta.srcPath %>styles/*.css', '<%= meta.srcPath %>scripts/**/*.js'], tasks: ['jade:debug', 'stylus:debug', /*'concat',*/ 'autoprefixer', /*'uglify', 'csso',*/ 'htmlhint', 'connect'] } //options: { // atBegin: true, // livereload: true //}, //js: { // files: '<%= meta.srcPath %>scripts/**/*.js', // tasks: ['concat:js'] //}, //css: { // files: [ // '<%= meta.srcPath %>styles/**/*.css' // ], // tasks: ['concat:css', 'stylus:debug', 'autoprefixer'] //}, //html: { // files: ['<%= meta.deployPath %>/**/*.html'], // tasks: ['htmlhint'] //} }, }); // Загружаем установленные задачи require('load-grunt-tasks')(grunt, {scope: ['devDependencies', 'dependencies']}); // Задача по умолчанию (`grunt` в терминале) grunt.registerTask('default', [/*'jshint', */'jade:release', 'stylus:release', 'concat', 'autoprefixer', 'uglify', 'csso', 'htmlhint']); grunt.registerTask('dev', [/*'jshint', */'jade:debug', 'stylus:debug', 'concat', 'autoprefixer', 'uglify', 'csso', 'htmlhint']); grunt.registerTask('build', ['jade:release', 'stylus:release', 'concat', 'autoprefixer', 'uglify', 'csso', 'imagemin', 'compress']); grunt.registerTask('svg', ['svgmin']); };
function botao(){ document.getElementById("agradecimento").innerHTML = "Obrigado por clicar" } function clicou() { window.open("https://google.com") window.location.href = "https://www.uol.com.br" } function trocar() { document.getElementById("trocar").innerHTML = "Olha que bacana!" } function voltar() { document.getElementById("trocar").innerHTML = "Olha aqui que legal!" } function load(){ alert("Página carregada!") } function funcaoChange(elemento) { console.log(elemento.value) } /* function soma(n1, n2) { return n1+n2 } alert(soma(5, 10)) */ /* function validaIdade (idade){ var validar if(idade>=18){ validar = true }else{ validar = false } return validar } var idade = prompt("Qual a sua idade?") console.log(validaIdade(idade)) */ /* function setReplace(frase, nome, novo_nome) { return frase.replace(nome, novo_nome) } alert(frase="Vai Japão!") alert("Opa!") alert(setReplace("Vai Japão", "Japão", "Brasil")) */ /* var d = new Date() alert(d.getDay + d.getMonth) */ /*var count for (count = 0; count <=5; count++) { alert(count) } */ /* var count = 0 while (count <= 5) { alert(count) count++ } */ /*var idade = prompt("Qual a sua idade?") //var idade = 18 if (idade >= 18) { alert("Maior de idade") }else{ alert("Menor de idade") } */ //var nome = "Bernard Braun" //var idade = 32 //var idade2 = 15 //alert(nome + " tem " + idade + " anos.") //alert(idade + idade2) //var frutas = ["Pera", "Uva", "Maçã"] //var fruta = {nome:"maçã,", cor:"vermelha"} //var frutas = [{nome:"maçã,", cor:"vermelha"}, {nome:"uva,", cor:"roxa"}]; //console.log(frutas[1].nome) //console.log(nome) //console.log(idade) //console.log(idade2) //frutas.push("Banana") //alert(frutas) //frutas.pop() //console.log(frutas.length) //console.log(frutas) //console.log(frutas.reverse()) //console.log(frutas.toString()) //console.log(frutas.join(" - ")) //console.log(fruta.cor)
/* eslint-disable jsx-a11y/anchor-is-valid */ import styled from 'styled-components'; import React from 'react'; const StyledDesignCardContainer = styled.div` width: 32.7rem; height: 47.8rem; border-radius: 1.5rem; background-color: var(--extra-light-peach-color); transition: 0.2s ease-in-out; display: flex; flex-direction: column; align-items: center; &:hover { transform: scale(1.02); background-color: var(--peach-color); } cursor: pointer; .design-img { width: 100%; height: 32rem; border-top-left-radius: 1.5rem; border-top-right-radius: 1.5rem; } .design-card-desc { width: 26.8rem; height: 9.4rem; text-align: center; margin-top: 3rem; display: flex; flex-direction: column; justify-content: space-between; } h3 { color: var(--peach-color); font-weight: 500; font-size: 2rem; line-height: 2.6rem; letter-spacing: 0.5rem; text-transform: uppercase; } &:hover h3, &:hover p { color: white; transition: 0.2s ease-in-out; } p { color: var(--dark-grey-color); font-size: 1.6rem; font-weight: 400; line-height: 2.6rem; } @media screen and (min-width: 768px) { width: 69rem; height: 31rem; flex-direction: row; .design-img { width: 33.8rem; height: 100%; border-top-left-radius: 1.5rem; border-top-right-radius: 0; border-bottom-left-radius: 1.5rem; } .design-card-desc { margin-top: 0; margin-left: 3.1rem; } } @media screen and (min-width: 1444px) { width: 35rem; height: 47.8rem; flex-direction: column; .design-img { width: 100%; height: 32rem; border-top-left-radius: 1.5rem; border-top-right-radius: 1.5rem; border-bottom-left-radius: 0; } .design-card-desc { margin-top: 3.1rem; margin-left: 0; } } `; const DesignBanner = ({ design, title, desc, fileName, className }) => { const curImg = require(`../assets/images/${design}/desktop/image-${fileName}.jpg`) .default; return ( <StyledDesignCardContainer className={className}> <img src={curImg} alt="title" className="design-img" /> <div className="design-card-desc"> <h3>{title}</h3> <p>{desc}</p> </div> </StyledDesignCardContainer> ); }; export default DesignBanner;
import React, { Component } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import s from './Login.css' import { changeField } from '../../actions/Login/actions' class Login extends Component{ render(){ return( <div className={`${s.wrapper}`}> <div className={`${s.conteiner}`}> <div className={`${s.wrap_content}`}> <div className={`${s.wrap_logo}`}> <img src="img/html-5.svg" alt="logo" /> <div className={`${s.info_site}`}> <h1>DevExp<small>™</small></h1> <p>Share your exprience</p> </div> </div> <div className={`${s.msg}`}> <h4>Bem vindo!</h4> <p>faça login e desfrute desses esplêndidos topicos.</p> </div> <div className={`${s.field_form}`}> <div className={`${s.form_ctrl}`}> <input type="email" placeholder="Username" value={this.props.emailField} onChange={this.props.changeField} /> </div> <div className={`${s.forget}`}> <a href="#">Esqueçeu o seu nome de usuário?</a> </div> </div> <div className={`${s.action_form}`}> <div className={`${s.form_ctrl}`}> <button className={`${s.btn_next}`}>Proximo</button> </div> </div> </div> </div> </div> ) } } const mapStateToProps = (state) => { return { emailField: state.login.emailField } } const mapDispatchToProps = (dispatch) => bindActionCreators({ changeField }, dispatch) export default connect(mapStateToProps, mapDispatchToProps)(Login)
import React from "react"; import JobCard from './JobCard'; // render list of job cards function JobList({ rightJobs }) { if (!rightJobs) { return (<div><p>No jobs available</p></div>) } return ( <div className="col-md-4"> {rightJobs.map(job => (<JobCard job={job} />))} </div> ); } export default JobList;
import React, { Component } from 'react'; import { RootNavigator } from "./config/navigation"; import { isSignedIn } from "./auth"; export default class App extends Component { constructor(props) { super(props); this.state = { signedIn: false, checkedSignIn: false }; } componentWillMount() { isSignedIn() .then(response => this.setState({ signedIn: response, checkedSignIn: true })) .catch(error => alert("Oops! Something broked")); } render() { const { checkedSignIn, signedIn } = this.state; const Layout = RootNavigator(signedIn); if(checkedSignIn){ return( <Layout /> ); }else{ return null; } } }
import React from "react"; export default class UnknownPath extends React.Component { render() { return (<h1>Sorry, this page doesn't exist</h1>) } }
/* * @lc app=leetcode.cn id=396 lang=javascript * * [396] 旋转函数 */ // @lc code=start /** * @param {number[]} nums * @return {number} */ var maxRotateFunction = function(nums) { let rotateNum = []; let maxNum = Number.MIN_SAFE_INTEGER; // 求出旋转数组 for (let i = 0; i < nums.length; i++) { rotateNum = getRotateNums(nums, i); maxNum = Math.max(getNumsSum(rotateNum), maxNum) } return maxNum; }; var getRotateNums = (nums, k) => { if (k === 0) return nums; const temp = nums.pop(); nums.unshift(temp); return nums; } var getNumsSum = (nums) => { var result = 0; for (var i = 0; i < nums.length; i++) { result += i * nums[i]; } return result; } // @lc code=end
class LRMove { constructor(element, leftCallback, rightCallback) { this.el = element this.oldX = 0 this.flag = false this.leftCallback = leftCallback ? leftCallback : ()=>{} this.rightCallback = rightCallback ? rightCallback : ()=>{} } init() { this.el.addEventListener("touchstart", (e) => { this.oldX = e.changedTouches[0].pageX this.flag = true this.el.addEventListener("touchmove", this.fnCallback.bind(this)) }) this.el.addEventListener("touchend", (e) => { this.oldX = 0 }) } fnCallback(e) { if (this.flag === true) { if (e.changedTouches[0].pageX > this.oldX && e.changedTouches[0].pageX - this.oldX > 150) { this.rightCallback() this.flag = false } if (e.changedTouches[0].pageX < this.oldX && this.oldX - e.changedTouches[0].pageX > 150) { this.leftCallback() this.flag = false } } } } export default LRMove
const Header = ({ round, currentScore, time }) => { return ( <> <h1 className="game-title">Reaction Time</h1> <div id="game-header"> <h2 className="game-progress">Round: {round}</h2> <h2 className="game-progress">Score: {currentScore}</h2> </div> <h2 id="reaction-time-header">Reaction Time:</h2><br /> {time ? <h2 id="reaction-time">{time}ms</h2> : <h2 id="initial-screen">N/A</h2>} </> ) } export default Header
'use strict'; module.exports = function (grunt) { // Load grunt tasks automatically require('load-grunt-tasks')(grunt); // Time how long tasks take. Can help when optimizing build times require('time-grunt')(grunt); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { express: { files: [ 'app/**/*.js' ], tasks: [ 'jshint:all', 'express' ], options: { spawn: false } } }, express: { app: { options: { script: 'app/index.js', port: 3010 } } }, jshint: { options: { jshintrc: '.jshintrc', reporter: require('jshint-stylish') }, all: [ 'Gruntfile.js', 'app/**/*.js' ] } }); grunt.registerTask('serve', [ 'express', 'watch:express' ]); };
const Discord = require("discord.js") const botconfig = require("../../botconfig.json"); exports.run = async (bot, message, args) => { if (message.channel.id !== botconfig["verify_setup"].verify_channel) { // If the channel it wasn't verification channel, ignore it. return; } await await message.member.addRole(botconfig["verify_setup"].verify_role); // Use this if you want to remove the role from the user. await message.member.removeRole(botconfig["join_roles"].role); return; } exports.help = { name: "verify", description: "Verify yourself to make sure you are not a robot." } exports.conf = { aliases: [], cooldown: 20 }
var assert = require('assert'); var Queue = require('../dist/queue.js').Queue; describe('Testing queue.js', function () { var queue = new Queue(); it('Add 1 into queue and its size should be 1', function () { queue.enqueue(1); assert.equal(1, queue.getSize()); }); it('Push 2 and 3 into queue and call dequeue function should return 1', function () { queue.enqueue(2); queue.enqueue(3); assert.equal(1, queue.dequeue()); }); it('Dequeue all elements from queue and it should be empty', function () { queue.dequeue(); queue.dequeue(); assert.equal(true, queue.isEmpty()); }); it('Call dequeue function of an empty queue should throw error', function () { assert.throws(queue.dequeue, Error); }); });
export function square(x) { if (typeof x !== 'number') { throw TypeError('The param should be number!') } else { return x * x } } export function cube(x) { if (typeof x !== 'number') { throw TypeError('The param should be number!') } else { return x * x * x } }
import axios from 'axios' import qs from 'qs' import { defaturl } from './apiUrl' axios.defaults.baseURL = defaturl axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded' // 修改默认配置 // axios.defaults.headers.post['Content-Type'] = 'application/json' // axios.defaults.headers.get['Content-Type'] = 'application/json' // axios.defaults.withCredentials = true // 表示是否跨域访问请求 // 首页数据 export const indexData = (params, callback) => { return axios.get('/homePage/searchCount', { params }).then((data) => { callback(data) }).catch(function () { }) } export const indexnameData = (params, callback) => { return axios.get('/ll/getAllByNowYear', { params }).then((data) => { callback(data) }).catch(function () { }) } export const getDatabyChange = (params, callback) => { return axios.post('/target/getDataByDistrictId', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 首页获取经济指标全年目标数据 export const getEcoData = (params, callback) => { return axios.get('/target/getNewDataByEconomicId', { params }).then((data) => { callback(data) }).catch(function () { }) } // 总数据 export const getAllNumber = (params, callback) => { return axios.post('/homePage/getTransNumber', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 首页项目地图数据 export const getMapData = (params, callback) => { return axios.post('/homePage/getMapParam', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 首页牵头单位预警信息 export const getLeaderEarly = (params, callback) => { return axios.post('/leaderPersonnal/warnAndAuditMsg', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 首页数据统计牵头单位 export const getLeaderDatas = (params, callback) => { return axios.post('/leaderPersonnal/countLeaderStatus', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 登录 export const login = (params, callback) => { return axios.post('/login', qs.stringify({ ...params })).then((data) => { callback(data) }) } // 退出 export const logout = (params, callback) => { return axios.get('/logout', { params }).then((data) => { callback(data) }) } // 修改密码 export const changePwd = (params, callback) => { return axios.post('/users/updateUser', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // export const changePwd = (params, callback) => { return axios.post('/users/updatePassword', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 判断用户名是否重复 export const changeUsername = (params, callback) => { return axios.post('/users/userLogName', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 组织机构 export const organizeList = (params, callback) => { return axios.get('/organization/searchAll', { params }).then((data) => { callback(data) }).catch(function () { }) } // 新增组织机构 export const addOrganize = (params, callback) => { return axios.post('/organization/addOrg', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 编辑组织机构 export const editOrganize = (params, callback) => { return axios.post('/organization/updateOrg', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 删除组织机构 export const delOrganize = (params, callback) => { return axios.post('/organization/delOrg', qs.stringify({ ...params })).then((data) => { callback(data) }) } // 部门类别 export const deptypeList = (params, callback) => { return axios.get('/searchAll', { params }).then((data) => { callback(data) }).catch(function () { }) } // 新增部门类别 export const addDeptype = (params, callback) => { return axios.post('/addDept', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 编辑部门类别 export const editDepttype = (params, callback) => { return axios.post('/updateDept', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 删除部门类别 export const delDepttype = (params, callback) => { return axios.post('/delDept', qs.stringify({ ...params })).then((data) => { callback(data) }) } // 部门管理 export const deptList = (params, callback) => { return axios.get('/commom/searchAll', { params }).then((data) => { callback(data) }) } // 获取所有部门列表 export const alldeptList = (params, callback) => { return axios.get('/commom/searchAllUserDept', { params }).then((data) => { callback(data) }) } // 新增部门 export const addDept = (params, callback) => { return axios.post('/commom/addDept', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 编辑部门 export const editDept = (params, callback) => { return axios.post('/commom/updateDept', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 删除部门 export const delDept = (params, callback) => { return axios.post('/commom/delDept', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 部门详情 export const detailDept = (params, callback) => { return axios.post('/commom/searchByDeptid', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 用户列表 export const userList = (params, callback) => { return axios.get('/users/condList', { params }).then((data) => { callback(data) }) } // 获取领导用户列表 export const leaderList = (params, callback) => { return axios.get('/users/leader', { params }).then((data) => { callback(data) }) } // 获取街道 export const streetList = (params, callback) => { return axios.get('/commom/searchAllStreet', { params }).then((data) => { callback(data) }) } // 所有用户列表 export const getAllusers = (params, callback) => { return axios.get('/users/userDrop', { 'params': params }).then((data) => { callback(data) }) } export const allusers = (params, callback) => { return axios.get('/users/userDrop', { 'params': params }).then((data) => { callback(data) }) } // 新增用户 export const addUser = (params, callback) => { return axios.post('/users/addUser', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 验证登录名是否存在 export const validUser = (params, callback, errorback) => { return axios.post('/users/userLogName', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 用户编辑 export const editUser = (params, callback) => { return axios.post('/users/updateUser', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(() => { }) } // 职务列表 export const jobList = (params, callback) => { return axios.get('/job/jobList', { ...params }).then((data) => { callback(data) }) } // 新增职务 export const addJob = (params, callback) => { return axios.post('/job/addJob', qs.stringify({ ...params })).then(function (data) { callback(data) }).catch(function () { }) } // 更改用户状态 export const updateUserStatus = (params, callback) => { return axios.post('/users/updateUserStatus', { params: params }).then(function (data) { callback(data) }) } // 系统设置 export const systemSetting = (params, callback) => { return axios.post('/system/addSystem', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 查询 export const systemDetail = (params, callback) => { return axios.get('/system/searchAll', { ...params }).then((data) => { callback(data) }).catch(function () { }) } // 隐藏列查询 export const isHidden = (params, callback) => { return axios.post('/line/searchByUserIdAndCatagory', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 隐藏列修改 export const editHidden = (params, callback) => { return axios.post('/line/changeLine', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 个人中心修改密码 export const updatePsw = (params, callback) => { return axios.post('/users/updateUserLogNameAndPassWord', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 首页获取决策督查数据 export const getworkDatas = (params, callback) => { return axios.post('/homePage/getDuchaParam', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 进展汇报验证 export const reportTerm = (params, callback) => { return axios.post('/allReport/searchTerm', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 保存进展汇报 export const savereportInfo = (params, callback) => { return axios.post('/allReport/submitAllReport', qs.stringify({ ...params })).then((data) => { callback(data) }).catch(function () { }) } // 批量重置密码 export const resetPassword = (params, callback, errorback) => { return axios.post('/users/resetPasswordList', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 项目确定导入 export const projectImportFileData = (params, callback, errorback) => { return axios.post('/project/batchAddProject', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 三年行动计划导入 export const threePlanImportFileData = (params, callback, errorback) => { return axios.post('/importData2/addThreeList', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 重要工作导入 export const keyWorkImportFileData = (params, callback, errorback) => { return axios.post('/tripleWorkProgress/addTripleWorkProgressList', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 重要片区 export const keyAreaImportFileData = (params, callback, errorback) => { return axios.post('/tripleAreaProgress/addTripleAreaProgressList', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 重大项目 export const keyItemImportFileData = (params, callback, errorback) => { return axios.post('/yy/batchAddSituation', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) } // 重点工作导入 export const zhongWorkImportFileData = (params, callback, errorback) => { return axios.post('/importDataPoint/addPointList', (params), {headers: {'Content-Type': 'application/json'}}).then((data) => { callback(data) }).catch(function (error) { errorback(error) }) }
angular.module('ngApp.payment', [ 'ui.router', 'ngApp.common' ]) /** * Each section or module of the site can also have its own routes. AngularJS * will handle ensuring they are all available at run-time, but splitting it * this way makes each module more "self-contained". */ .config(function config($stateProvider, $locationProvider) { //$locationProvider.html5Mode(true); $stateProvider .state('payment', { url: '/payment', controller: 'PaymentController', templateUrl: 'payment/payment.tpl.html', data: { pageTitle: 'Payment' } }) .state('payment-success', { url: '/payment-success', //controller: 'PaymentController', templateUrl: 'payment/payment_success.tpl.html', data: { pageTitle: 'Payment-Success' } }) .state('payment-error', { url: '/payment-error', //controller: 'PaymentController', templateUrl: 'payment/paymentError.tpl.html', data: { pageTitle: 'Payment-Error' } }) ; });
'use strict'; module.exports = ['eslint:recommended', { rules: { 'eol-last': 'error', 'no-undef': 'off' } }];