code
stringlengths
2
1.05M
declare export default function foo(x: number, y: string): void;
var util = require('util'); var Filterer = require('./Filterer'); /** * @typedef {Object} module:py-logging.LogRecord * @property {number} created Time when this record was created. * @property {string} name Name of the logger. * @property {number} levelno Numeric logging level. * @property {string} levelname Text logging level. * @property {string} message The logged message. * @property {Object} [error] The logged error. * @property {Object} [extra] Extra data. * @property {number} [process] Process ID (if available). * @property {string} [processname] Process title (if available). */ /** * @constructor Logger * @extends Filterer * @param {Manager} manager * @param {string} name * @param {Logger} [parent] * @param {number} [level=NOTSET] */ function Logger(manager, name, parent, level) { level = level || Logger.NOTSET; if (Logger.getLevelName(level) === '') { throw new Error('Argument 3 of Logger.constructor has unsupported value' + ' \'' + level + '\''); } Filterer.call(this); /** * Name of this logger. * * @private * @type {string} */ this._name = name; /** * The threshold for this logger. * * @private * @type {number} */ this._level = level; /** * Parent logger. * * @private * @type {Manager} */ this._manager = manager; /** * Parent logger. * * @private * @type {(Logger|null)} */ this._parent = parent; /** * Array of set handlers. * * @private * @type {Array} */ this._handlers = []; /** * If this evaluates to true, events logged to this logger will be ignored. * * @memberof Logger.prototype * @type {boolean} */ this.disabled = false; /** * If this evaluates to true, events logged to this logger will be passed * to the handlers of higher level loggers. * * @memberof Logger.prototype * @type {boolean} */ this.propagate = true; } util.inherits(Logger, Filterer); Logger.NOTSET = 0; Logger.DEBUG = 10; Logger.INFO = 20; Logger.WARNING = 30; Logger.ERROR = 40; Logger.CRITICAL = 50; /** * Return the textual representation of logging level. * * @static * @param {number} level * @return {string} */ Logger.getLevelName = function(level) { var levelName = ''; if (level === Logger.DEBUG) { levelName = 'DEBUG'; } else if (level === Logger.INFO) { levelName = 'INFO'; } else if (level === Logger.WARNING) { levelName = 'WARNING'; } else if (level === Logger.ERROR) { levelName = 'ERROR'; } else if (level === Logger.CRITICAL) { levelName = 'CRITICAL'; } else if (level === Logger.NOTSET) { levelName = 'NOTSET'; } return levelName; }; /** * Return value of the level name. * * @static * @param {string} levelName * @return {number} */ Logger.getLevelByName = function(levelName) { var level = ''; if (levelName === 'DEBUG') { level = Logger.DEBUG; } else if (levelName === 'INFO') { level = Logger.INFO; } else if (levelName === 'WARNING') { level = Logger.WARNING; } else if (levelName === 'ERROR') { level = Logger.ERROR; } else if (levelName === 'CRITICAL') { level = Logger.CRITICAL; } else if (levelName === 'NOTSET') { level = Logger.NOTSET; } return level; }; /** * Return the text representation of this logger. * * @return {string} */ Logger.prototype.toString = function() { return '[object Logger <' + this._name + '>]'; }; /** * Return the name of this logger. * * @return {string} */ Logger.prototype.getName = function() { return this._name; }; /** * Return a logger which is a descendant to this one. * * @param {string} suffix * @return {Object} */ Logger.prototype.getChild = function(suffix) { if (!suffix) { throw new Error('Argument 1 of Logger.getChild is not specified.'); } var base = this._name === 'root' ? '' : this._name + '.'; return this._manager.getLogger(base + suffix); }; /** * Return the effective level for this logger. * * @return {number} */ Logger.prototype.getEffectiveLevel = function() { var logger = this; while (logger) { if (logger._level) { return logger._level; } logger = logger._parent; } return Logger.NOTSET; }; /** * Is this logger enabled for specified level? * * @param {number} level * @return {boolean} */ Logger.prototype.isEnabledFor = function(level) { return level >= this.getEffectiveLevel(); }; /** * Set the logging level of this logger. * * @param {number} level */ Logger.prototype.setLevel = function(level) { if (Logger.getLevelName(level) === '') { throw new Error('Argument 1 of Logger.setLevel has unsupported value' + ' \'' + level + '\''); } this._level = level; }; /** * Add the specified handler to this logger. * * @param {Handler} handler */ Logger.prototype.addHandler = function(handler) { if (typeof handler !== 'object') { throw new Error('Argument 1 of Logger.addHandler is not an object.'); } this._handlers.push(handler); }; /** * Remove the specified handler from this logger. * * @param {Handler} handler */ Logger.prototype.removeHandler = function(handler) { var index = this._handlers.indexOf(handler); if (index > -1) { this._handlers.splice(index, 1); } }; /** * See if this logger has any handlers configured. * * @return {boolean} */ Logger.prototype.hasHandlers = function() { var logger = this; while (logger) { if (logger._handlers.length) { return true; } if (logger.propagate) { logger = logger._parent; } else { logger = null; } } return false; }; /** * Log msg with severity 'DEBUG'. * * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype.debug = function(msg, error, extra) { error = error || null; extra = extra || null; if (this.isEnabledFor(Logger.DEBUG)) { this._log(Logger.DEBUG, msg, error, extra); } }; /** * Log msg with severity 'INFO'. * * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype.info = function(msg, error, extra) { error = error || null; extra = extra || null; if (this.isEnabledFor(Logger.INFO)) { this._log(Logger.INFO, msg, error, extra); } }; /** * Log msg with severity 'WARNING'. * * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype.warning = function(msg, error, extra) { error = error || null; extra = extra || null; if (this.isEnabledFor(Logger.WARNING)) { this._log(Logger.WARNING, msg, error, extra); } }; /** * Log msg with severity 'ERROR'. * * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype.error = function(msg, error, extra) { error = error || null; extra = extra || null; if (this.isEnabledFor(Logger.ERROR)) { this._log(Logger.ERROR, msg, error, extra); } }; /** * Log msg with severity 'CRITICAL'. * * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype.critical = function(msg, error, extra) { error = error || null; extra = extra || null; if (this.isEnabledFor(Logger.CRITICAL)) { this._log(Logger.CRITICAL, msg, error, extra); } }; /** * Log msg with specified severity. * * @param {number} level * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype.log = function(level, msg, error, extra) { error = error || null; extra = extra || null; if (this.isEnabledFor(level)) { this._log(level, msg, error, extra); } }; /** * Create a LogRecord object. * * @param {number} level * @param {string} msg * @param {Object} [error] * @param {Object} [extra] * @return {module:py-logging.LogRecord} */ Logger.prototype.makeRecord = function(level, msg, error, extra) { error = error || null; extra = extra || null; var record = { created: Date.now(), name: this._name, levelno: level, levelname: Logger.getLevelName(level), message: msg, }; if (typeof global === 'object' && global.process && global.process.pid) { record.process = global.process.pid; record.processname = global.process.title; } if (error) { record.error = error; } if (extra) { record = Object.assign(record, extra); } return record; }; /** * @private * @param {number} level * @param {string} msg * @param {Object} [error] * @param {Object} [extra] */ Logger.prototype._log = function(level, msg, error, extra) { var record = this.makeRecord(level, msg, error, extra); if (!this.disabled && this.filter(record)) { this._callHandlers(record); } }; /** * @private * @param {module:py-logging.LogRecord} record */ Logger.prototype._callHandlers = function(record) { var logger = this; while (logger) { logger._handlers.forEach(function(handler) { if (handler.isEnabledFor(record.levelno)) { handler.handle(record); } }); if (logger.propagate) { logger = logger._parent; } else { logger = null; } } }; module.exports = Logger;
import firebase from '../firebase/firebase'; export function getReservations() { return dispatch => { dispatch(onGetReservations()); return firebase.database().ref('reservations').on('value', function (snap) { const resevations = snap.val(); if (resevations) dispatch(getReservationsFulfilledAction(resevations)) else dispatch(getReservationsFulfilledAction(null)) }); } } function onGetReservations() { return { type: "GET_RESERVATIONS" }; } function getReservationsFulfilledAction(reservations) { return { type: "FULL_FILL_RESERVATIONS", reservations }; } function getReservationsRejected() { return { type: "GET_RESERVATIONS_REJECTED" } }
const td = require('testdouble'); const expect = require('../../../../helpers/expect'); const Promise = require('rsvp').Promise; const adbPath = 'adbPath'; const emulatorName = 'emulator-fake'; const spawnArgs = [adbPath, ['-s', emulatorName, 'emu', 'kill']]; describe('Android Kill Emulator', () => { let killEmulator; let spawn; beforeEach(() => { let sdkPaths = td.replace('../../../../../lib/targets/android/utils/sdk-paths'); td.when(sdkPaths()).thenReturn({ adb: adbPath }); spawn = td.replace('../../../../../lib/utils/spawn'); td.when(spawn(...spawnArgs)) .thenReturn(Promise.resolve({ code: 0 })); killEmulator = require('../../../../../lib/targets/android/tasks/kill-emulator'); }); afterEach(() => { td.reset(); }); it('calls spawn with correct arguments', () => { td.config({ ignoreWarnings: true }); td.when(spawn(), { ignoreExtraArgs: true }) .thenReturn(Promise.resolve({ code: 0 })); return killEmulator(emulatorName).then(() => { td.verify(spawn(...spawnArgs)); td.config({ ignoreWarnings: false }); }); }); it('spawns adb kill and resolves with exit code', () => { return expect(killEmulator(emulatorName)) .to.eventually.deep.equal({ code: 0 }) }); it('rejects with same error message when spawned command rejects', () => { td.when(spawn(...spawnArgs)).thenReject('spawn error'); return expect(killEmulator(emulatorName)) .to.eventually.be.rejectedWith('spawn error'); }); });
const each = require('apr-engine-each'); /** * <a id="for-each"></a> * Applies the function `iteratee` to each item in `coll`, in parallel. * * [![](https://img.shields.io/npm/v/apr-for-each.svg?style=flat-square)](https://www.npmjs.com/package/apr-for-each) [![](https://img.shields.io/npm/l/apr-for-each.svg?style=flat-square)](https://www.npmjs.com/package/apr-for-each) * * @kind function * @name for-each * @param {Array|Object|Iterable} input * @param {Function} iteratee * @returns {Promise} * * @example * import awaitify from 'apr-awaitify'; * import forEach from 'apr-for-each'; * * const writeFile = awaitify(fs.writeFile); * const files = [ * '/home/.vimrc', * '/home/.zshrc' * ]; * * await forEach(files, async (file) => * await writeFile(file, 'boom') * ); */ module.exports = (input, fn, opts) => each({ input, fn, opts }); module.exports.series = require('./series'); module.exports.limit = require('./limit');
import React from 'react' import { shallow, mount } from 'enzyme' import { expect, assert } from 'chai' import sinon from 'sinon' import HeroSection from '../../public/lib/components/HeroSection' import Button from '../../public/lib/components/Button' describe('HeroSection', () => { it('should show title "Adopt Fund"', () => { const wrapper = shallow(<HeroSection />); expect(wrapper.find('h1').text()).to.equal('Adopt Fund'); }); it('should have a handleClick', () => { const handleClick = sinon.spy() const wrapper = shallow(<Button handleClick={handleClick} />) wrapper.find('button').simulate('click'); expect(handleClick.calledOnce).to.equal(true) }); it('should trigger "click"', () => { const click = sinon.spy() const wrapper = mount(<Button handleClick={click} />) wrapper.simulate('click') expect(click.calledOnce).to.equal(true) }); it('should have a link', () => { const wrapper = shallow(<HeroSection />); expect(wrapper.find('Link').prop('to')).to.equal('/list'); }); });
'use strict'; module.exports = function () { for (var i = 0; i < arguments.length; ++i) { if (arguments[i] != null) { return arguments[i]; } } };
var EventEmitter = require('events').EventEmitter; var utils = require('../../util/utils'); var logger = require('pomelo-logger').getLogger('pomelo-rpc', __filename); var exp = module.exports = new EventEmitter(); exp.connect = function(tracer, cb) { tracer.info('client', __filename, 'connect', 'connect to blackhole'); process.nextTick(function() { utils.invokeCallback(cb, new Error('fail to connect to remote server and switch to blackhole.')); }); }; exp.close = function(cb) { }; exp.send = function(tracer, msg, opts, cb) { tracer.info('client', __filename, 'send', 'send rpc msg to blackhole'); logger.info('message into blackhole: %j', msg); process.nextTick(function() { utils.invokeCallback(cb, tracer, new Error('message was forward to blackhole.')); }); };
(function() { 'use strict'; var _ = require('lodash'); var express = require('express'); var router = express.Router(); var userAuth = require('../helpers/authentication'); var Beer = require('../../models/beer-model'); var TapRoom = require('../../models/taproom-model.js'); router.get('/user', function(req, res) { if (userAuth.userValidated(req, res, true)) { //first lets get the user's active taprooms TapRoom.get(req.user.id).then(function(taprooms) { //but we only care about the beers that are on tap taprooms.mapThen(function(entry) { return { id: entry.get('id'), beerId: entry.get('beerId') }; }).then(function(taproomBeerMapping) { //now let's do our query for all the user's beers Beer.get(req.user.id).then(function(beers) { //but let's mark the ones that are also on tap beers.mapThen(function(beer) { var beerId = beer.get('id'); var activeTap = _.find(taproomBeerMapping, { beerId: beerId }); beer.set('hasActiveTap', false); if (activeTap) { beer.set('hasActiveTap', true); } return beer; }).then(function(beers) { //now we can return the annotated beer objects res.json({ error: false, data: beers }); }); }).catch(function(err) { res.json({ error: true, message: err }); }); }); }) .catch(function(err) { res.json({ error: true, message: err }); }); } }); router.post('/new', function(req, res) { if (userAuth.userValidated(req, res, true)) { var beerObj = req.body.beer; Beer.create(req.user.id, beerObj) .then(function(newBeer) { res.json({ error: false, id: newBeer.get('id') }); }) .otherwise(function() { res.status(500).json({ error: true, msg: 'There was an error saving your beer' }); }); } }); router.post('/edit/:beerId', function(req, res) { if (userAuth.userValidated(req, res, true)) { var beerObj = req.body.beer; Beer.update(req.user.id, req.params.beerId, beerObj) .then(function() { res.json({ error: false, id: req.params.beerId }); }) .otherwise(function() { res.status(500).json({ error: true, msg: 'There was an error editing your beer' }); }); } }); router.post('/remove', function(req, res) { if (userAuth.userValidated(req, res, true)) { var beerId = req.body.id; Beer.remove(req.user.id, beerId).then(function() { res.json({ error: false, id: beerId }); }) .otherwise(function() { res.status(500).json({ error: true, msg: 'There was an error removing your beer' }); }); } }); module.exports = router; })();
var wechat = require('wechat'); var wxConf = require('../../../conf').wechat; var express = require('express'); var router = express.Router(); var config = { token: wxConf.token, appid: wxConf.appid }; router.use(express.query()); router.use('/', wechat(config, function(req, res, next) { var message = req.weixin; res.reply({ content: 'text object', type: 'text' }); })); module.exports = router;
/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(['jquery.sap.global'], function(jQuery) { "use strict"; /** * ColumnsPanel renderer. * @namespace */ var P13nColumnsPanelRenderer = {}; /** * Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}. * * @param {sap.ui.core.RenderManager} * oRm the RenderManager that can be used for writing to the render output buffer * @param {sap.ui.core.Control} * oControl an object representation of the control that should be rendered */ P13nColumnsPanelRenderer.render = function(oRm, oControl) { oRm.write("<div"); oRm.writeControlData(oControl); oRm.addClass("sapMP13nColumnsPanel"); oRm.writeClasses(); oRm.write(">"); // div element var aContent = oControl.getAggregation("content"); if (aContent) { aContent.forEach(function(oContent){ oRm.renderControl(oContent); }); } oRm.write("</div>"); }; return P13nColumnsPanelRenderer; }, /* bExport= */ true);
var popbill = require('./'); popbill.config({ LinkID :'TESTER', SecretKey : 'SwWxqU+0TErBXy/9TVjIPEnI0VTUMMSQZtJf3Ed8q3I=', IsTest : true, defaultErrorHandler : function(Error) { console.log('Error Occur : [' + Error.code + '] ' + Error.message); } }); var accountCheckService = popbill.AccountCheckService(); accountCheckService.getChargeInfo('1234567890', function(response){ console.log(response); }, function(error){ console.log(error); }); accountCheckService.getChargeInfo('1234567890', 'testkorea', function(response){ console.log(response); }, function(error){ console.log(error); }); accountCheckService.getChargeInfo('1234567890','성명', '', function(response){ console.log(response); }, function(error){ console.log(error); }); accountCheckService.getChargeInfo('1234567890','실명', 'testkorea', function(response){ console.log(response); }, function(error){ console.log(error); }); accountCheckService.getUnitCost('1234567890', function(response){ console.log('Unitcost : ' + response); }, function(error){ console.log(error); }); accountCheckService.getUnitCost('1234567890','성명', function(response){ console.log('Unitcost : ' + response); }, function(error){ console.log(error); }); accountCheckService.getUnitCost('1234567890','실명', function(response){ console.log('Unitcost : ' + response); }, function(error){ console.log(error); }); accountCheckService.getBalance('1234567890', function(response){ console.log('Balance : ' + response); }, function(error){ console.log(error); }); accountCheckService.checkAccountInfo('1234567890', '0004', '1234567890', function(response){ console.log(response); }, function(error){ console.log(error); }); accountCheckService.checkDepositorInfo('1234567890', '0004', '1234567890','B','1234567890', function(response){ console.log(response); }, function(error){ console.log(error); });
import React from 'react'; import Control from './Control'; class ZoomComponent extends React.Component { zoomIn(e) { this.props.map.zoomIn(e.shiftKey ? 3 : 1); } zoomOut(e) { this.props.map.zoomOut(e.shiftKey ? 3 : 1); } render() { return ( <div className="leaflet-bar"> <a className="control-button" onClick={this.zoomIn.bind(this)} title="Zoom in"> <svg width="16" height="16" className="icon" viewBox="0 0 32 32"> <polyline points="8,16 24,16" strokeLinecap="round" strokeWidth="5" shapeRendering="crispEdges" className="stroke crisp"/> <polyline points="16,8 16,24" strokeLinecap="round" strokeWidth="5" shapeRendering="crispEdges" className="stroke crisp"/> </svg> </a> <a className="control-button" onClick={this.zoomOut.bind(this)} title="Zoom out"> <svg width="16" height="16" className="icon" viewBox="0 0 32 32"> <polyline points="8,16 24,16" strokeLinecap="round" strokeWidth="5" shapeRendering="crispEdges" className="stroke crisp" /> </svg> </a> </div> ); } } export default Control.extend({ getComponentClass() { return ZoomComponent; } });
webpackJsonp([3],{ /***/ 16: /***/ function(module, exports) { console.log("非ADM规范js, foo2.js, 有个全局变量FOO"); var FOO = "FOO2.js" /*** EXPORTS FROM exports-loader ***/ module.exports = FOO; /***/ } });
/* booking.js * * Handles interactions on the bookings page including async booking actions. */ var timepicker; var datepicker; // Initilaise the time and date pickers including disabling clots that have already // been booked. var init_booking_form = function(){ // initialise the time and date picker components datepicker = $(".datepicker").pickadate({ onSet: function(){ update_disabled_timeslots(); update_booking_form(); }, min: true }); timepicker = $(".timepicker").pickatime({ onSet: update_booking_form, interval: 60, format: "HH:i" }); // Settup the booking form to clean up the data and post the booking requests $("#new-booking-form").on('submit', function(event){ event.preventDefault(); var date = $("#new-booking-date").val(); var time = $("#new-booking-time").val(); var datetime = date + " " + time; data = { datetime_str: datetime}; $.post("/students/booking/", data, function(response){ Materialize.toast(response, 4000); update_booking_list(); update_disabled_timeslots(); timepicker.pickatime("picker").clear(); datepicker.pickadate("picker").clear(); }).fail(function(response){ Materialize.toast("Sorry, failed! " + response.responseText, 4000); }); }); update_booking_form(); }; // Disables all the booked timeslots for the currently selected date var update_disabled_timeslots = function(){ // read the currently selected date var date = $("#new-booking-date").val(); date = moment(new Date(date)).format("DD.MMMM.YYYY"); if(date === "Invalid date"){ return; } // get all the booked timeslots for the currently selected date adn disable them // in the time picker $.getJSON("/students/booking/listall/" + date + "/", function(bookings){ if(bookings.length > 0){ var booked_slots = []; $.each(bookings, function(index, booking){ start_time = moment(booking.fields.start_time).format("H"); booked_slots.push(start_time); }); booked_slots = booked_slots.map(function(str){ return parseInt(str); }); timepicker.pickatime("picker").set("disable", false); timepicker.pickatime("picker").set("enable", true); timepicker.pickatime("picker").set("disable", booked_slots); } }).fail(function(){ console.log("Failed to retrieve json for all bookings for date:" + date); }); }; // set up the list of user bookings var init_booking_list = function(){ update_booking_list(); $("#user-bookings-list").on("click", ".secondary-content", delete_booking); }; // update the booking form to enable/disable the submit button based on whether // the date and time inputs have been populated var update_booking_form = function(){ var date = $("#new-booking-date").val(); var time = $("#new-booking-time").val(); $("#submit-new-booking").toggleClass("disabled", !(date && time)); if(!(date && time)){ $("#submit-new-booking").attr("disabled"); }else{ $("#submit-new-booking").removeAttr("disabled"); } }; // async update of the list of user bookings. Used after any booking additions // and deletions to update the list of bookings. var update_booking_list = function(){ $("#user-bookings-list").empty(); $.getJSON("/students/booking/list/", function(user_bookings){ if(user_bookings.length === 0){ help_text = "<li class=\"collection-item avatar\"><div><span class=\"subtext\" style=\"color:darkgrey;\">You have no upcoming bookings.</span></div></li>"; $("#user-bookings-list").append(help_text); }else{ $.each(user_bookings, function(index, booking){ booking_id = booking.pk; date = moment(booking.fields.start_time).format("Do MMM YYYY"); current_time = moment(); start_time = moment(booking.fields.start_time); is_current = start_time.isBefore(current_time)? "current-booking": ""; delete_icon = start_time.isBefore(current_time)? "": "<a id=\"delete-booking_" + booking_id + "\" href=\"#\" class=\"secondary-content\"><i class=\"material-icons md-18\">delete</i></a>"; start_time = start_time.format("HH:mm"); end_time = moment(booking.fields.end_time).format("HH:mm"); booking_info = start_time + " - " + end_time; list_item_html = "<li class=\"collection-item avatar "+ is_current +" \"><div><span class=\"title\">" + date + "</span><p id=\"booking_" + booking_id + "\" class=\"subtext\">" + booking_info + "</p>" + delete_icon + "<div></li>"; $("#user-bookings-list").append(list_item_html); }); } }).fail(function(){ Materialize.toast("Sorry, could not load your bookings", 4000); }); }; // deletes the required booking var delete_booking = function(event){ event.preventDefault(); source_btn = $(this); booking_id = source_btn.attr("id").match(/\d+/g); if(booking_id.length === 0){ Materialize.toast("Sorry, booking not found", 4000); return false; }else{ booking_id = booking_id[0]; } // POST to delete the specified booking $.post("/students/booking/" + booking_id + "/delete/", function(response){ Materialize.toast("Successfully deleted booking", 4000); update_booking_list(); }).fail(function(response){ Materialize.toast("Could not delete booking", 4000); }); }; // initialises the booking form and the list of bookings when the page has // completed loading $(function(){ init_booking_form(); init_booking_list(); });
import {chai, assert} from 'chai'; import FirebaseAPI from '../../public/js/api/firebase.api'; import {registerHELP, registerFirebase, loginFirebase} from '../../public/js/api/student.api'; //TO-DO: ADD SHOULD ASSERTIONS INSTEAD OF LOGGING TO CONSOLE describe('Registering as a student', function(){ this.timeout(20000); beforeEach(() => { //Nothing to do here }); it('should fail at registering as a student Jason Shin', async () => { const response = await registerHELP({ studentId: '123456', dob: '1 January 1995', degreeType: 'UG', studentStatus: 'International', firstLang: 'English', countryOrigin: 'Australia', creatorId: '123456', gender: 'M', background: 'Degree', degreeDetails: '1st', altContact: '0405294958', preferredName: 'Tom', completedHsc: 'true', hscMark: '100' }); }); it('should fail creating user in firebase', async () => { const response = await registerFirebase({ email: 'jasonshin8123@yoghu.com.au', password: 'giewjgi' }); }); it('should register to firebase', async () => { const response = await registerFirebase({ email: 'jasonshin8123@yoghu.com.au', password: 'giewjgi' }); }); it('should login as yong.j.shin@help.com.au', async () => { const response = await loginFirebase({ email: 'yong.j.shin@help.com.au', password: 'test123' }); }); after(() => { }); });
import React from 'react' import PropTypes from 'prop-types' import { Helmet } from 'react-helmet' import { StaticQuery, graphql } from 'gatsby' import Header from './header' import './layout.css' const Layout = ({ children }) => ( <StaticQuery query={graphql` query SiteTitleQuery { site { siteMetadata { title } } } `} render={data => ( <> <Helmet title={data.site.siteMetadata.title} meta={[ { name: `description`, content: `Sample` }, { name: `keywords`, content: `sample, something` }, ]} > <html lang="en" /> </Helmet> <Header siteTitle={data.site.siteMetadata.title} /> <div style={{ margin: `0 auto`, maxWidth: 960, padding: `0px 1.0875rem 1.45rem`, paddingTop: 0, }} > {children} </div> </> )} /> ) Layout.propTypes = { children: PropTypes.node.isRequired, } export default Layout
angular.module('shoppingBasketItem', []) .directive('shoppingBasketItem', function () { return { restrict: '', template: '/shoppingBasketItem.tpl.html', replace: true, link: function ($scope, $element, attr) { var _ minQuantity = 1, maxQuantity = 10/*, quantity = 1, price = 1*/; $scope.quantity = 1; $scope.price = 10; $scope.description = 'Product Description goes here'; /* $scope.quantity = function(value) { if (angular.isDefined(value)) { _quantity = value; } return _quantity; }; $scope.price = function(value) { if (angular.isDefined(value)) { _price = value; } return _price; };*/ $scope.add = function () { if($scope.quantity < maxQuantity) { $scope.quantity+=1; } }; $scope.remove = function () { if($scope.quantity > minQuantity) { $scope.quantity-=1; } }; $scope.cost = function () { return $scope.quantity * $scope.price; }; } }; });
'use strict'; var Message = require('../../lib/message'); module.exports = function(app) { var MessagesController = { create: function(req, res, next) { var message = new Message({ type: req.body.type, body: req.body.body }); app.services.queue.sendMessage(message, function(err, data) { if (err) { return next(err); } else { res.status(201).json(data); } }); } }; return MessagesController; };
// @flow const Promise = require('bluebird'); const _ = require('lodash'); const tryRequire = require('../utilities/try_require'); const serviceControl = require('../service_control'); const knex = tryRequire('knex'); const neutralDatabaseName = { maria: 'information_schema', mssql: 'information_schema', mysql: 'information_schema', mysql2: 'information_schema', oracle: null, oracledb: null, postgres: 'postgres', sqlite3: null, 'strong-oracle': null, websql: null, // client name aliases mariadb: 'information_schema', mariasql: 'information_schema', pg: 'postgres', postgresql: 'postgres', sqlite: null, }; let databaseCounter = 0; module.exports = serviceControl.addBoilerPlate('knex', { launch(config: Object = {}) { const defaultKnexConfig = { client: 'sqlite3', connection: { filename: ':memory:', }, useNullAsDefault: true, }; const knexConfig = _.defaultsDeep({}, config, defaultKnexConfig); const neutralDbName = neutralDatabaseName[knexConfig.client]; if (neutralDbName === null) { throw new Error(`createDatabaseService is not supported for ${knexConfig.client} clients`); } if (!neutralDbName) { throw new Error(`createDatabaseService: unknown client: ${knexConfig.client}`); } const name = knexConfig.name || knexConfig.connection.database || `database_${databaseCounter += 1}`; const neutralConfig = _.defaultsDeep({ connection: { database: neutralDbName } }, knexConfig); const start = Promise.coroutine(function* () { const startConn = knex(neutralConfig); yield startConn.raw(`DROP DATABASE IF EXISTS ${name}`); yield startConn.raw(`CREATE DATABASE ${name}`); yield startConn.destroy(); const stop = () => { const stopConn = knex(neutralConfig); return stopConn.raw(`DROP DATABASE ${name}`) .then(stopConn.destroy.bind(stopConn)); }; return { name, stop, config: knexConfig }; }); return serviceControl.launchService(`createDatabase.${name}`, start) .catch((err) => { if (err.code === 'ER_DBACCESS_DENIED_ERROR') { const dbAccessError = new Error(`createDatabaseService: ${err.message}`); _.assign(dbAccessError, _.pick(err, ['code', 'errno', 'sqlState'])); throw dbAccessError; } throw err; }); }, });
var expect = require('expect.js'); var util = require('../shared/Util.js'); describe('Testing Server side Util class.', function () { it("getTypeString test", function(done) { expect(util.getTypeString("0000000000000000000")).to.be(""); expect(util.getTypeString("1000000000000000000")).to.be("conferences"); expect(util.getTypeString("0100000000000000000")).to.be("conventions"); expect(util.getTypeString("0010000000000000000")).to.be("entertainment"); expect(util.getTypeString("0001000000000000000")).to.be("fairs"); expect(util.getTypeString("0000100000000000000")).to.be("food"); expect(util.getTypeString("0000010000000000000")).to.be("fundraisers"); expect(util.getTypeString("0000001000000000000")).to.be("meetings"); expect(util.getTypeString("0000000100000000000")).to.be("music"); expect(util.getTypeString("0000000010000000000")).to.be("performances"); expect(util.getTypeString("0000000001000000000")).to.be("recreation"); expect(util.getTypeString("0000000000100000000")).to.be("religion"); expect(util.getTypeString("0000000000010000000")).to.be("reunions"); expect(util.getTypeString("0000000000001000000")).to.be("sales"); expect(util.getTypeString("0000000000000100000")).to.be("seminars"); expect(util.getTypeString("0000000000000010000")).to.be("social"); expect(util.getTypeString("0000000000000001000")).to.be("sports"); expect(util.getTypeString("0000000000000000100")).to.be("tradeshows"); expect(util.getTypeString("0000000000000000010")).to.be("travel"); expect(util.getTypeString("0000000000000000001")).to.be("other"); expect(util.getTypeString("1100000000000000000")).to.be("conferences, conventions"); expect(util.getTypeString("1100000000000000010")).to.be("conferences, conventions, travel"); expect(util.getTypeString(null)).to.be('conferences, conventions, entertainment, fairs, food, fundraisers, meetings, music, performances, recreation, religion, reunions, sales, seminars, social, sports, tradeshows, travel, other'); done(); }); it("getEventbriteDateFormat test", function(done) { expect(util.getEventbriteDateFormat("01/02/2012")).to.be("2012-01-02"); expect(util.getEventbriteDateFormat(null)).to.be(null); done(); }); it("PrettyDate function test", function(done) { var date = new Date(2014, 0, 1); expect(util.getPrettyDate(date)).to.be("01/01/2014"); date = new Date(2014, 0, 10); expect(util.getPrettyDate(date)).to.be("01/10/2014"); date = new Date(2014, 9, 10); expect(util.getPrettyDate(date)).to.be("10/10/2014"); date = new Date(2014, 9, 9); expect(util.getPrettyDate(date)).to.be("10/09/2014"); date = new Date(2014, 8, 9); expect(util.getPrettyDate(date)).to.be("09/09/2014"); date = null; expect(util.getPrettyDate(date)).to.be(null); done(); }); });
import React from 'react' import css from './style.scss' export const ENTER_CLASS_WORD = 'enterClassWord' export const CONFIRMING_CLASS_WORD = 'confirmClassWord' export const JOIN_CLASS = 'joinClass' export const JOINING_CLASS = 'joiningClass' export class JoinClass extends React.Component { constructor (props) { super(props) this.state = { classWord: '', error: null, teacherName: null, formState: 'enterClassWord' } this.handleSubmit = this.handleSubmit.bind(this) this.handleCancelJoin = this.handleCancelJoin.bind(this) this.classWordRef = React.createRef() } handleCancelJoin () { this.setState({ formState: ENTER_CLASS_WORD }) } handleSubmit (e) { e.preventDefault() let { formState, classWord } = this.state const onError = (err) => { this.setState({ error: err.message || 'Unable to join class!' }) this.setState({ formState: ENTER_CLASS_WORD }) } switch (formState) { case ENTER_CLASS_WORD: classWord = this.classWordRef.current ? this.classWordRef.current.value.trim() : '' if (classWord.length > 0) { this.setState({ formState: CONFIRMING_CLASS_WORD }, () => { const onSuccess = (result) => this.setState({ error: null, classWord, teacherName: result.teacher_name, formState: JOIN_CLASS }) this.apiCall('confirm', { data: { class_word: classWord }, onSuccess, onError }) }) } break case JOIN_CLASS: this.setState({ formState: JOINING_CLASS }, () => { const onSuccess = () => this.props.afterJoin() this.apiCall('join', { data: { class_word: classWord }, onSuccess, onError }) }) break } } showError (err, message) { this.setState({ error: err.message || message }) } apiCall (action, options) { const basePath = '/api/v1/students' const { data, onSuccess, onError } = options const { url, type } = { confirm: { url: `${basePath}/confirm_class_word`, type: 'POST' }, join: { url: `${basePath}/join_class`, type: 'POST' } }[action] jQuery.ajax({ url, data: JSON.stringify(data), type, dataType: 'json', contentType: 'application/json', success: json => { if (!json.success) { onError && onError(json) } else { onSuccess && onSuccess(json.data) } }, error: (jqXHR, textStatus, error) => { try { error = JSON.parse(jqXHR.responseText) } catch (e) {} onError && onError(error) } }) } renderEnterClassWord () { const { formState } = this.state const confirmingClassWord = formState === CONFIRMING_CLASS_WORD return ( <> <ul> <li> <label htmlFor='classWord'>New Class Word: </label> <p>Not case sensitive</p> <input type='text' live='false' name='classWord' ref={this.classWordRef} size={30} disabled={confirmingClassWord} /> </li> <li> <input type='submit' disabled={confirmingClassWord} value={confirmingClassWord ? 'Submitting ...' : 'Submit'} /> </li> </ul> <p> A Class Word is created by a Teacher when he or she creates a new class. If you have been given the Class Word you can enter that word here to become a member of that class. </p> </> ) } renderJoinClass () { const { teacherName, formState } = this.state const { allowDefaultClass } = this.props const joiningClass = formState === JOINING_CLASS return ( <> <p> {allowDefaultClass ? `By joining this class, the teacher ${teacherName} will be able to see all of your current and future work. If do not want to share your work, but do want to join the class please create a second account and use it to join the class.` : `The teacher of this class is ${teacherName}. Is this the class you want to join?` } </p> <p> Click 'Join' to continue registering for this class. </p> <p> <input type='submit' disabled={joiningClass} value={joiningClass ? 'Joining ...' : 'Join'} /> <button onClick={this.handleCancelJoin}>Cancel</button> </p> </> ) } render () { const { error, formState } = this.state return ( <form className={css.form} onSubmit={this.handleSubmit}> <fieldset> { error ? <p className={css.error}>{error.toString()}</p> : undefined } <legend>Class Word</legend> {(formState === ENTER_CLASS_WORD) || (formState === CONFIRMING_CLASS_WORD) ? this.renderEnterClassWord() : this.renderJoinClass() } </fieldset> </form> ) } } export default JoinClass
'use strict' const Joi = require('@hapi/joi') const Chalk = require('chalk') const RestHapi = require('rest-hapi') const errorHelper = require('../utilities/error-helper') const Config = require('../../config') const authStrategy = Config.get('/restHapiConfig/authStrategy') const headersValidation = Joi.object({ authorization: Joi.string().required() }).options({ allowUnknown: true }) module.exports = function(server, mongoose, logger) { // Get Available Permissions Endpoint ;(function() { const Log = logger.bind(Chalk.magenta('Get Available Permissions')) const Permission = mongoose.model('permission') Log.note('Get Available Permissions endpoint') const getAvailablePermissionsHandler = async function(request, h) { try { Log.log('query(%s)', JSON.stringify(request.query)) const roleName = request.auth.credentials.user.roleName const where = { assignScope: { $elemMatch: { $eq: roleName } } } request.query.$where = Object.assign(where, request.query.$where) return await RestHapi.list(Permission, request.query, Log) } catch (err) { errorHelper.handleError(err, Log) } } const queryModel = RestHapi.joiHelper.generateJoiListQueryModel( Permission, Log ) server.route({ method: 'GET', path: '/permission/available', config: { handler: getAvailablePermissionsHandler, auth: { strategy: authStrategy, scope: [ 'root', 'readAvailableNotifications', '!-readAvailableNotifications' ] }, description: 'Get the permissions available for the current user to assign.', tags: ['api', 'Available Permissions'], validate: { headers: headersValidation, query: queryModel }, plugins: { 'hapi-swagger': { responseMessages: [ { code: 200, message: 'Success' }, { code: 400, message: 'Bad Request' }, { code: 404, message: 'Not Found' }, { code: 500, message: 'Internal Server Error' } ] } }, response: { schema: Joi.object({ docs: Joi.array().items( RestHapi.joiHelper.generateJoiReadModel(Permission, Log) ), pages: Joi.any(), items: Joi.any() }) } } }) })() }
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import withStyles from '../styles/withStyles'; import ListContext from '../List/ListContext'; export var styles = { /* Styles applied to the root element. */ root: { minWidth: 56, flexShrink: 0 }, /* Styles applied to the root element when the parent `ListItem` uses `alignItems="flex-start"`. */ alignItemsFlexStart: { marginTop: 8 } }; /** * A simple wrapper to apply `List` styles to an `Avatar`. */ var ListItemAvatar = React.forwardRef(function ListItemAvatar(props, ref) { var classes = props.classes, className = props.className, other = _objectWithoutProperties(props, ["classes", "className"]); var context = React.useContext(ListContext); return React.createElement("div", _extends({ className: clsx(classes.root, context.alignItems === 'flex-start' && classes.alignItemsFlexStart, className), ref: ref }, other)); }); process.env.NODE_ENV !== "production" ? ListItemAvatar.propTypes = { /** * The content of the component – normally `Avatar`. */ children: PropTypes.element.isRequired, /** * Override or extend the styles applied to the component. * See [CSS API](#css) below for more details. */ classes: PropTypes.object.isRequired, /** * @ignore */ className: PropTypes.string } : void 0; export default withStyles(styles, { name: 'MuiListItemAvatar' })(ListItemAvatar);
module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //Minify the JavaScript into the build folder uglify: { options: { banner: '/**\n' + '* @preserve <%= pkg.name %> v<%= pkg.version %> | <%= pkg.author %> | <%= pkg.license %> Licensed\n' + '*/\n' }, scripts: { files: { 'dist/console.protect.min.js' : ['src/console.protect.js'] } } } }); // Load uglify task. grunt.loadNpmTasks('grunt-contrib-uglify'); // Default task(s). grunt.registerTask('default', [ 'uglify' ]); };
var FFI = require('ffi'), ref = require('ref'), os = require('os'); var voidPtr = ref.refType(ref.types.void); exports.CONSTANTS = { }; var libFile; if (os.platform() == "darwin") { libFile = 'step2stl.so.dylib'; } else if (os.platform() == "linux") { libFile = 'step2stl.so'; } exports.step2stl = new FFI.Library(libFile, { step2stl: [ref.types.int32, [ ref.types.CString, ref.types.CString, ]], });
require("./94.js"); require("./188.js"); require("./376.js"); require("./752.js"); module.exports = 753;
var isFB = require('./isFB') var promisify = require('./promisify') module.exports = function get (fb, $e, callback) { if (isFB(this)) { callback = $e $e = fb fb = this } callback = callback || promisify() fb.q([['?e', '?a', '?v']], { e: $e }, [], function (err, results) { if (err) return callback(err) var entity = { $e: $e } results.forEach(function (result) { entity[result.a] = result.v }) callback(null, entity) }) return callback.promise }
/** * @param {number[]} findNums * @param {number[]} nums * @return {number[]} */ const nextGreaterElement = function (findNums, nums) { let numsMap = new Map(); for (let i = 0; i < nums.length; ++i) { numsMap.set(nums[i], i); } let ret = new Array(findNums.length); for (let i = 0; i < findNums.length; ++i) { let posInNums = numsMap.get(findNums[i]); ret[i] = -1; for (let j = posInNums + 1; j < nums.length; ++j) { if (nums[j] > findNums[i]) { ret[i] = nums[j]; break; } } } return ret; }; module.exports = nextGreaterElement;
/* jshint node: true, esversion: 6 */ /* globals describe: false, expect: false, it: false */ import { Codec } from "../src/codec"; import { Util } from "../src/util"; import { Data } from "./testdata"; describe("Codec", () => { it("should initialize properly", () => { let codec; expect(() => codec = new Codec()).not.toThrow(); expect(codec).toBeDefined(); }); it("should wrap in a crc-32", () => { const codec = new Codec(); const inBytes = [ 0x01, 0x02, 0x03, 0x04, 0x05 ]; const exp = [ 0x01, 0x02, 0x03, 0x04, 0x05, 0xF4, 0x99, 0x0B, 0x47 ]; const res = codec.wrapBytes(inBytes); expect(res).toEqual(exp); }); it("should generate scrambling bits correctly", () => { const codec = new Codec(); const scrambleBits = Data.scrambleBits; codec.generateScrambler(0xff); expect(codec.scrambleBits.length).toEqual(scrambleBits.length); expect(codec.scrambleBits).toEqual(scrambleBits); }); it("should scramble correctly", () => { const codec = new Codec(); codec.generateScrambler(0x5d); const inbits = Util.bytesToBitsBE(Data.servicePrepended1); const scrambled = codec.scramble(inbits); const res = Util.bitsToBytesBE(scrambled); expect(res).toEqual(Data.scrambled1); }); it("should convert inputMessage1 to inputBytes1", () => { const codec = new Codec(); const messageBytes = Data.inputMessage1; const inputMacBytes = Data.inputMac1.slice(); const inbytes = inputMacBytes.concat(messageBytes); const inputBytes1Short = Data.inputBytes1.slice(0, 96); expect(inbytes).toEqual(inputBytes1Short); const res = codec.wrapBytes(inbytes); expect(res).toEqual(Data.inputBytes1); }); it("should pad for shortening properly", () => { const codec = new Codec(); codec.selectCode("3/4", "1944"); const bits = Util.bytesToBitsBE(Data.scrambled1); const shortened = codec.padForShortening(bits); const res = Util.bitsToBytesBE(shortened); expect(res).toEqual(Data.shortened1); }) it("should shorten properly", () => { const codec = new Codec(); codec.selectCode("3/4", "1944"); const bits = Util.bytesToBitsBE(Data.encoded1); const shortened = codec.shorten(bits, 816); //from above // we need to think the next step const punctured = shortened.slice(0, shortened.length - 54); const res = Util.bitsToBytesBE(punctured); expect(res).toEqual(Data.final1); }) it("should encode correctly", () => { const codec = new Codec(); codec.selectCode("3/4", "1944"); const bits = codec.encode(Data.inputMessage1); // again, we need to know more about puncturing the check bits const punctured = bits.slice(0, bits.length - 54); const bytes = Util.bitsToBytesBE(punctured); expect(bytes).toEqual(Data.final1); }); xit("should encode a string without exceptions", () => { const codec = new Codec(); codec.selectCode("1/2", "648"); const plain = "quick brown fox"; expect(() => codec.encodeString(plain)).not.toThrow(); }); });
import { combineReducers } from 'redux' import app from './modules/app' const rootReducer = asyncReducers => combineReducers({ app, ...asyncReducers, }) export const injectReducer = (store, { key, reducer }) => { if (Object.hasOwnProperty.call(store.asyncReducers, key)) return /* eslint no-param-reassign: 0 */ store.asyncReducers[key] = reducer store.replaceReducer(rootReducer(store.asyncReducers)) } export default rootReducer
import { Lbryio } from 'lbryinc'; import { ACTIONS, doToast, doUpdateBalance } from 'lbry-redux'; import { selectUnclaimedRewards } from 'redux/selectors/rewards'; import { selectUserIsRewardApproved } from 'redux/selectors/user'; import { doFetchInviteStatus } from 'redux/actions/user'; import rewards from 'rewards'; export function doRewardList() { return dispatch => { dispatch({ type: ACTIONS.FETCH_REWARDS_STARTED, }); Lbryio.call('reward', 'list', { multiple_rewards_per_type: true }) .then(userRewards => { dispatch({ type: ACTIONS.FETCH_REWARDS_COMPLETED, data: { userRewards }, }); }) .catch(() => { dispatch({ type: ACTIONS.FETCH_REWARDS_COMPLETED, data: { userRewards: [] }, }); }); }; } export function doClaimRewardType(rewardType, options = {}) { return (dispatch, getState) => { const state = getState(); const userIsRewardApproved = selectUserIsRewardApproved(state); const unclaimedRewards = selectUnclaimedRewards(state); const reward = rewardType === rewards.TYPE_REWARD_CODE || rewardType === rewards.TYPE_NEW_ANDROID ? { reward_type: rewards.TYPE_REWARD_CODE } : unclaimedRewards.find(ur => ur.reward_type === rewardType); // Try to claim the email reward right away, even if we haven't called reward_list yet if ( rewardType !== rewards.TYPE_REWARD_CODE && rewardType !== rewards.TYPE_CONFIRM_EMAIL && rewardType !== rewards.TYPE_DAILY_VIEW && rewardType !== rewards.TYPE_NEW_ANDROID ) { if (!reward || reward.transaction_id) { // already claimed or doesn't exist, do nothing return; } } if ( !userIsRewardApproved && rewardType !== rewards.TYPE_CONFIRM_EMAIL && rewardType !== rewards.TYPE_REWARD_CODE && rewardType !== rewards.TYPE_NEW_ANDROID ) { if (!options || (!options.failSilently && rewards.callbacks.rewardApprovalRequested)) { rewards.callbacks.rewardApprovalRequested(); } return; } // Set `claim_code` so the api knows which reward to give if there are multiple of the same type const params = options.params || {}; if (!params.claim_code && reward) { params.claim_code = reward.claim_code; } dispatch({ type: ACTIONS.CLAIM_REWARD_STARTED, data: { reward }, }); const success = successReward => { // Temporary timeout to ensure the sdk has the correct balance after claiming a reward setTimeout(() => { dispatch(doUpdateBalance()).then(() => { dispatch({ type: ACTIONS.CLAIM_REWARD_SUCCESS, data: { reward: successReward, }, }); if (successReward.reward_type === rewards.TYPE_NEW_USER && rewards.callbacks.claimFirstRewardSuccess) { rewards.callbacks.claimFirstRewardSuccess(); } else if (successReward.reward_type === rewards.TYPE_REFERRAL) { dispatch(doFetchInviteStatus()); } dispatch(doRewardList()); if (options.callback) { options.callback(); } }); }, 2000); }; const failure = error => { dispatch({ type: ACTIONS.CLAIM_REWARD_FAILURE, data: { reward, error: !options || !options.failSilently ? error : undefined, }, }); if (options.notifyError) { dispatch(doToast({ message: error.message, isError: true })); } if (options.callback) { options.callback(error); } }; return rewards.claimReward(rewardType, params).then(success, failure); }; } export function doClaimEligiblePurchaseRewards() { return (dispatch, getState) => { const state = getState(); const unclaimedRewards = selectUnclaimedRewards(state); const userIsRewardApproved = selectUserIsRewardApproved(state); if (!userIsRewardApproved || !Lbryio.enabled) { return; } if (unclaimedRewards.find(ur => ur.reward_type === rewards.TYPE_FIRST_STREAM)) { dispatch(doClaimRewardType(rewards.TYPE_FIRST_STREAM)); } else { [rewards.TYPE_MANY_DOWNLOADS, rewards.TYPE_DAILY_VIEW].forEach(type => { dispatch(doClaimRewardType(type, { failSilently: true })); }); } }; } export function doClaimRewardClearError(reward) { return dispatch => { dispatch({ type: ACTIONS.CLAIM_REWARD_CLEAR_ERROR, data: { reward }, }); }; } export function doFetchRewardedContent() { return dispatch => { const success = nameToClaimId => { dispatch({ type: ACTIONS.FETCH_REWARD_CONTENT_COMPLETED, data: { claimIds: Object.values(nameToClaimId), success: true, }, }); }; const failure = () => { dispatch({ type: ACTIONS.FETCH_REWARD_CONTENT_COMPLETED, data: { claimIds: [], success: false, }, }); }; Lbryio.call('reward', 'list_featured').then(success, failure); }; }
// jQuery & Bootstrap init var $ = window.$ = window.jQuery = require('jquery'); var Bootstrap = require('bootstrap-sass'); // vue.js init var Vue = require('vue'); var VueResource = require('vue-resource'); Vue.use(VueResource); $(document).ready( function() { if ($('#store-form').length) { let data = require('./modules/store.data'), methods = require('./modules/store.methods'), computed = require('./modules/store.computed'), created = require('./modules/store.created'); // Cria uma instância do Vue const storeVue = new Vue({ el: '#store-form', data: data, computed: computed, methods: methods, created: created.do, }); } });
import React, { Component, PropTypes } from 'react'; import dispatcher from 'focus-core/dispatcher'; import Button from 'focus-components/components/button'; import { navigate } from '../../utilities/router'; import backgrounds from '../../stores/backgrounds'; import Article from '../../components/article'; import Section from '../../components/article/section'; const defaultProps = { }; const propTypes = { backgroundName: PropTypes.string.isRequired }; class BackgroundShortDetail extends Component { selectBackground() { dispatcher.handleViewAction({ data: { builderBackground: backgrounds.filter(elt => elt.name === this.props.backgroundName)[0] }, type: 'update' }); } render() { return ( <div> <div className='button-bar'> <Button label={'action.validate'} onClick={() => { this.selectBackground(); navigate('generator/class'); } } /> </div> <Article title={'backgrounds.' + this.props.backgroundName}> <Section title={'Lorem ipsum dolor'}> <p> {'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas rutrum vehicula ligula, ut ultrices dui molestie at. Suspendisse potenti. Mauris commodo gravida semper. Pellentesque porta ultrices nisi, non pellentesque neque iaculis id. Sed finibus quam nec nisi mollis, malesuada placerat nisl laoreet. Nullam sit amet condimentum ligula. Nam volutpat gravida turpis et aliquam.'}</p> <p> {' Aenean varius vestibulum pretium. Donec lacinia magna ultrices placerat consectetur. Nulla facilisi. Fusce ex mauris, efficitur non ornare lacinia, ornare nec turpis. Sed justo purus, finibus non venenatis eget, ultricies a turpis. Etiam quam nisl, ultrices nec convallis a, semper a lectus. Ut quam tortor, dictum in sollicitudin eget, elementum maximus ex. Sed feugiat dignissim nunc, et ornare tellus laoreet sed. Mauris ac purus condimentum, molestie nunc eget, imperdiet tellus. Sed at ligula sed turpis bibendum vulputate sed id lectus. Integer placerat diam non pulvinar gravida. Fusce accumsan tellus vestibulum, consectetur leo ultricies, interdum augue. Nullam nec justo eu tortor dignissim fermentum. Aliquam tincidunt est ac tortor feugiat, at bibendum mi lobortis. '}</p> </Section> </Article> </div> ); } } BackgroundShortDetail.displayName = 'BackgroundShortDetail'; BackgroundShortDetail.defaultProps = defaultProps; BackgroundShortDetail.propTypes = propTypes; export default BackgroundShortDetail;
lengths = { "chapter1":2, "chapter2":4, "chapter10"14 } ng-repeat for i in range(lengths[chapterSelected] : build element "<a href=/"" + chapterSelect + "//#section" + {i+1} + ">"Section" + (i+1) + "/""</a> var populateStates = function () { angular.forEach(lengths, function(chapter) { chapter.forEach(function(num) { $stateProvider.state("chapter{chapter}section{num}", {url:{chapter/section{num}, templateurl: "templates/chapters/{chapter}/section{num}.html", controller: chapter{chapter}section{num}Ctrl ); }; };
/* * (Creazione scheda) javascript functions * * @ author: Luca90 * @ homepage: http://www.luca90.netsons.org/ext.php (sooner) * @ email: lucavall90@gmail.com * @ subversion: 0.1 * @ last modified: 30th July 2007 16:36 pm * * Notes: * Check functionality * Check comments language */ function getBS(bSTRING) { getBundleService("xpi", bSTRING); } function analizeXpi() { var xpiFile = null; var xpiSize = null; /* open and read xpi file */ var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); fp.init(window, "getBS(\"openFilterPicker\")", nsIFilePicker.modeOpen); fp.appendFilter("getBS(\"xpiFilterTitle\")", "*.xpi"); if (fp.show() == nsIFilePicker.returnOK) { xpiFile = fp.file; xpiSize = fp.fileSize; var zp = Components.classes["@mozilla.org/libjar/zip-reader;1"] .createInstance(Components.interfaces.nsIZipReader); zp.init(xpiFile); zp.open(); /* read items init zip file and generate schedule */ var installrdf = zp.findEntries("install.rdf"); return installrdf; return xpiSize; /* close zip reader */ zp.close(); } } function returnSchedule() { analizeXpi(); alert(xpiSize); alert(installrdf); }
'use strict'; var test = require('tape'); var aar = require('./'); test('should call the callback when all async stuff is done', function (t) { var next = aar(function (err, results) { t.error(err); t.equal(results.length, 2); t.deepEqual(results, [1, 2]); t.end(); }); process.nextTick(next().bind(null, null, 1)); process.nextTick(next().bind(null, null, 2)); }); test('should pass on arguments to nested callbacks', function (t) { var next = aar(function (err, results) { t.equal(results.length, 1); t.end(); }); var cb = next(function (a1, a2, a3) { t.equal(a1, 1); t.equal(a2, 2); t.equal(a3, 3); }); process.nextTick(cb.bind(null, 1, 2, 3)); }); test('should call the callback with the first error after all async stuff is done', function (t) { var next = aar(function (err, results) { t.equal(err.message, 'first'); t.equal(results.length, 2); t.end(); }); setTimeout(next().bind(null, new Error('second')), 20); setTimeout(next().bind(null, new Error('first')), 10); }); test('should handle multiple async batches', function (t) { var calledNext1 = false; var next1 = aar(function (err, results) { t.error(err); t.equal(results.length, 1); calledNext1 = true; }); var next2 = aar(function (err, results) { t.error(err); t.equal(results.length, 1); t.ok(calledNext1); t.end(); }); setTimeout(next1(), 10); setTimeout(next2(), 20); }); test('should call the callback even if no calls to next() have been made', function (t) { aar(function (err, results) { t.deepEqual(results, []); t.end(); }); }); test('should not care if one next-callback is called on the same tick', function (t) { var next = aar(function (err, results) { t.equal(results.length, 2); t.end(); }); next()(); setTimeout(next(), 10); });
/* global QUnit */ import { WebGLProperties } from '../../../../../src/renderers/webgl/WebGLProperties'; export default QUnit.module( 'Renderers', () => { QUnit.module( 'WebGL', () => { QUnit.module( 'WebGLProperties', () => { // INSTANCING QUnit.todo( 'Instancing', ( assert ) => { assert.ok( false, 'everything\'s gonna be alright' ); } ); // PUBLIC STUFF QUnit.todo( 'get', ( assert ) => { assert.ok( false, 'everything\'s gonna be alright' ); } ); QUnit.todo( 'remove', ( assert ) => { assert.ok( false, 'everything\'s gonna be alright' ); } ); QUnit.todo( 'clear', ( assert ) => { assert.ok( false, 'everything\'s gonna be alright' ); } ); } ); } ); } );
// @flow const path = require( "path" ); opaque type AliasName = string; opaque type ActualName = string; opaque type Spec = string; opaque type ExactVersion = string; opaque type RangeVersion = string; opaque type Resolved = string; opaque type Integrity = string; export type DepType = "deps" | "devDeps" | "optionalDeps"; export type PartialResolvedObj = { name: ActualName, version: ExactVersion, resolved: Resolved, integrity: Integrity }; export type ResolvedObj = PartialResolvedObj & { deps: { [name: AliasName]: Spec } }; export type { AliasName, ActualName, Spec, ExactVersion, RangeVersion, Resolved, Integrity }; export function toStr( str: AliasName | ActualName | Spec | ExactVersion | RangeVersion | Resolved | Integrity ): string { return str; } export function pathJoin( a: string, b: string, c: AliasName ) { return path.join( a, b, c ); } export type Options = { folder: string, store: string, cache: string, offline: ?boolean, preferOffline: ?boolean, preferOnline: ?boolean, frozenLockfile: boolean, production: ?boolean, global: boolean, type: ?( "prod" | "dev" | "optional" ) }; export type Warning = { code: string, message: string, [key: string]: any };
var dataViews = require('../'); /** * @param {Playlists} group * @constructor */ var Playlists = function(group) { goog.base(this, group); }; goog.inherits(Playlists, dataViews.Abstract); /** * @return {Promise.<Array.<dataViews.Playlist>>} */ Playlists.prototype.getChildren = function() { return app.api.vk .getAudioAlbums(null, 100) .then(function(albums) { return albums.map(function(album) { return new dataViews.Playlist(album); }); }); }; /** * @inheritDoc */ Playlists.prototype.toString = function() { return 'Playlists'; }; /** * @type {Playlists} */ Playlists.prototype._data; module.exports = Playlists;
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '@material-ui/core/SvgIcon'; function createSvgIcon(path, displayName) { let Icon = props => ( <SvgIcon {...props}> {path} </SvgIcon> ); Icon.displayName = `${displayName}Icon`; Icon = pure(Icon); Icon.muiName = 'SvgIcon'; return Icon; }; export default createSvgIcon;
import {UPDATE_FILTER} from '../actions/updateFilter' export default function (state = {}, action) { switch (action.type) { case UPDATE_FILTER: return action.tags default: return state } }
//Made by Not American var shop = { host: "109.54.53.110", port: 8000, currency: "Johto Bucks", symbol: "$", dailyLogins: new Object(), gains: { battle: 0.5, perHour: 1, twistWin: 0.1, rebusWin: 0.25, dailyLogins: 2, tour: "johto bucks won = number of players in tournaments" }, items: { "symbol": { name: "Custom Symbol", cost: 25, daily: 2.5, desc: "Get a symbol by your name (Cannot be a symbol of authority)" }, "avatar": { name: "Custom Avatar", cost: 100, daily: 10, desc: "Get your own avatar (/buy avatar, url) (if animated 25 daily)" }, "glow": { name: "Name Glow", cost: 50, daily: 15, desc: "Adds a 'glow' effect to your name of your specified color. (/buy glow, color)" }, "room": { name: "Room", cost: 300, daily: 50, desc: "Get a room for yourself. Contact an admin once it's made. (NOT DONE)" }, }, userInit: function(name, connection) { var oneDayMilliseconds = 1000 * 1 * 60 * 60 * 24; var cmilliseconds = (new Date() / 1); if (typeof name == "object" && name.name) name = name.name; var uid = toId(name); //daily join shit if (!this.dailyLogins[uid]) { this.dailyLogins[uid] = { firstJoinOfDay: cmilliseconds, lastSeen: cmilliseconds }; this.giveMoney(uid, this.gains.dailyLogins, connection); } else { this.dailyLogins[uid].lastSeen = cmilliseconds; var lastTime = this.dailyLogins[uid].firstJoinOfDay; if (cmilliseconds - lastTime >= oneDayMilliseconds) { //a day or more since last coming this.dailyLogins[uid].firstJoinOfDay = cmilliseconds; this.giveMoney(uid, this.gains.dailyLogins, connection); } } //set up their shit var user = Users.get(name); if (!user) return false; var wallet = this.wallets[uid]; if (!wallet) return; //avatar if (wallet.items.avatar) { var changeAvy = true; if (cmilliseconds - wallet.items.avatar.lastPayment >= oneDayMilliseconds) { if (wallet.money < wallet.items.avatar.daily) { user.send('You don\'t have anymore funds to maintain your custom avatar.'); changeAvy = false; delete wallet.items.avatar; } else { //take out funds wallet.money = wallet.money - wallet.items.avatar.daily; wallet.items.avatar.lastPayment = cmilliseconds; user.send(wallet.items.avatar.daily + shop.avatar + '\'s were taken from your wallet to maintain your custom avatar.'); } } if (changeAvy) user.avatar = wallet.items.avatar.val; } //symbol if (wallet.items.symbol) { if (cmilliseconds - wallet.items.symbol.lastPayment >= oneDayMilliseconds) { if (wallet.money < wallet.items.symbol.daily) { user.send('You don\'t have anymore funds to maintain your custom symbol.'); wallet.items.symbol.val = " "; } else { //take out funds wallet.money = wallet.money - wallet.items.symbol.daily; wallet.items.symbol.lastPayment = cmilliseconds; user.send(wallet.items.symbol.daily + shop.symbol + '\'s were taken from your wallet to maintain your custom symbol.'); } } user.getIdentity = function (roomid) { if (!roomid) roomid = 'lobby'; var name = this.name + (this.away ? " - \u0410\u051d\u0430\u0443" : ""); if (this.locked) { return '‽' + name; } if (this.mutedRooms[roomid]) { return '!' + name; } var room = Rooms.rooms[roomid]; if (room.auth) { if (room.auth[this.userid]) { return room.auth[this.userid] + name; } if (room.isPrivate) return ' ' + name; } return wallet.items.symbol.val + name; }; user.updateIdentity(); if (wallet.items.symbol.val == " ") { delete wallet.items.symbol; } } //name glow if (wallet.items.glow) { if (cmilliseconds - wallet.items.glow.lastPayment >= oneDayMilliseconds) { if (wallet.money < wallet.items.glow.daily) { user.send('You don\'t have anymore funds to maintain your custom name glow.'); wallet.items.glow.val = " "; delete wallet.items.glow; } else { //take out funds wallet.money = wallet.money - wallet.items.glow.daily; wallet.items.glow.lastPayment = cmilliseconds; user.send(wallet.items.glow.daily + shop.symbol + '\'s were taken from your wallet to maintain your name glow.'); } } } }, wallets: new Object(), openWallets: function() { if (typeof fs == "undefined") fs = require('fs'); fs.readFile('./config/wallets.txt', function(err, data) { data = '' + data; var wallets = new Object(); //import wallets //ITEMS = Glow]red]1403095657559|Symbol]M]123456789 //"johtobot":{"money":87,"items":{"glow":{"name":"glow","val":"red","lastPayment":1403095657559,"daily":15},"symbol":{"name":"Symbol","val":"M","lastPayment":123456789,"daily":3}},"hours":87,"minutes":46} //^that === johtobot^[87[ITEMS[87[46@ var usersRay = data.split('@'); for (var i in usersRay) { var ray = usersRay[i].split('['); var items = new Object(); var itemsRay = ray[2].split('|'); if (itemsRay.length) { for (var x in itemsRay) { var itemRay = itemsRay[x].split(']'); if (itemRay.length) { if (shop.items[toId(itemRay[0])]) { items[toId(itemRay[0])] = { name: itemRay[0], val: itemRay[1], lastPayment: Math.abs(itemRay[2]), daily: shop.items[toId(itemRay[0])].daily }; } } } } wallets[ray[0]] = { money: Math.abs(ray[1]), items: items, hours: Math.abs(ray[3]), minutes: Math.abs(ray[4]) }; } //add parsed data wallets to shop.wallets for (var i in wallets) { shop.wallets[i] = new Object(); for (var x in wallets[i]) { if (x == "items") { //items is an object, maybe we can loop? idk shop.wallets[i].items = JSON.parse(JSON.stringify(wallets[i].items)); } else { shop.wallets[i][x] = wallets[i][x]; } } } }); }, loopitaFunk: function() { var loopita = function() { for (var i in Users.users) { var u = Users.users[i]; if (u.connected) { var wallet = shop.wallets[u.userid]; if (!wallet) shop.newWallet(u.userid); wallet = shop.wallets[u.userid]; wallet.minutes = wallet.minutes + 1; if (wallet.minutes == 60) { shop.giveMoney(u.userid, shop.gains.perHour); wallet.minutes = 0; wallet.hours = wallet.hours + 1; } } } shop.loopitaFunk(); }; shopLoopita = setTimeout(loopita, 1000 * 60); }, money: function(name) { if (typeof name == "object" && name.name) name = name.name; var uid = toId(name); var wallet = this.wallets[uid]; if (!wallet) return 0; return wallet.money; }, userItems: function(name) { if (typeof name == "object" && name.name) name = name.name; var uid = toId(name); var wallet = this.wallets[uid]; if (!wallet) return 0; return Object.keys(wallet.items); }, minutes: function(name) { if (typeof name == "object" && name.name) name = name.name; var uid = toId(name); var wallet = this.wallets[uid]; if (!wallet) return 0; return wallet.hours + " hour(s) and " + wallet.minutes + " minutes"; }, newWallet: function(uid) { var uid = toId(uid); if (!Users.get(uid)) return "That user doesn't exist."; this.wallets[uid] = { money: 0, items: new Object(), hours: 0, minutes: 0, }; return this.wallets[uid]; }, round: function(num, places) { if (typeof places == "undefined") places = 2; //because money only has two decimals :3 var multiplier = Math.pow(10, places); return Math.round(num * multiplier) / multiplier; }, giveMoney: function(name, amount, connection) { if (typeof name == "object" && name.name) name = name.name; var uid = toId(name); if (!this.wallets[uid]) this.newWallet(name); var wallet = this.wallets[uid]; if (typeof wallet == "string") return wallet; if (typeof amount == "string") amount = Math.abs(amount); if (isNaN(amount)) return "Not a number."; if (amount < 0) return "Less than 0."; if (!wallet) return "no wallet still :s"; wallet.money = this.round(Math.abs(wallet.money) + Math.abs(amount)); var socket; if (Users.get(uid)) socket = Users.get(uid); if (connection) socket = connection; if (socket.send) socket.send('|raw|+' + amount + this.currency + '\'s. You now have <b>' + wallet.money + this.currency + '\'s</b>'); return wallet.money; }, takeMoney: function(name, amount, item) { if (typeof name == "object" && name.name) name = name.name; var uid = toId(name); var wallet = this.wallets[uid]; if (!wallet) return "User has no wallet."; if (typeof amount == "string") amount = Math.abs(amount); if (isNaN(amount)) return "Not a number."; if (amount < 0) return "Less than 0."; wallet.money = this.round(wallet.money - amount); if (wallet.money < 0) wallet.money = 0; if (item) wallet.items[item.name] = item; return wallet.money; }, stringifyWallets: function() { var insides = '', wallets = this.wallets, currentWallet = 0, lastWallet = Object.keys(this.wallets).length; for (var i in wallets) { currentWallet++; if (i.substr(0, 5) == "guest") delete wallets[i]; else { //ITEMS = Glow]red]1403095657559|Symbol]M]123456789 //"bootybot":{"money":87,"items":{"glow":{"name":"glow","val":"red","lastPayment":1403095657559,"daily":15},"symbol":{"name":"Symbol","val":"M","lastPayment":123456789,"daily":3}},"hours":87,"minutes":46} //^that === bootybot[87[ITEMS[87[46@ var wallet = wallets[i], items = ''; for (var x in wallet.items) { var item = wallet.items[x]; items += item.name + "]"; items += item.val + "]"; items += item.lastPayment; items += "|"; } items = items.slice(0, -1); insides += i + "["; //userid insides += wallet.money + "["; //money insides += items + "["; //items insides += wallet.hours + "["; //hours insides += wallet.minutes; //minutes if (lastWallet != currentWallet) insides += "@"; } } insides = insides.slice(0, -1); return insides; }, commands: { givemoney: function(target, room, user) { if (!this.can('hotpatch')) return this.sendReply('Not enough auth.'); if (!target) return this.sendReply('User does not exist.'); if (target.split(',').length != 2) return this.sendReply('The correct syntax for this command is /givemoney user, amount'); var tar = user, targ = target.split(',')[0], amount = Math.abs(target.split(',')[1]); if (tar) tar = Users.get(targ); if (!tar) return this.sendReply('user does not exist.'); if (isNaN(amount)) return this.sendReply('That\'s not a number.'); if (amount == 0) return this.sendReply('You can\'t give 0' + shop.currency + '\'s.'); room.add(user.name + ' just gave ' + tar.name + ' ' + amount + shop.currency + '\'s. They now have ' + shop.giveMoney(tar.userid, amount) + shop.currency + '\'s.'); }, takemoney: function(target, room, user) { if (!this.can('hotpatch')) return this.sendReply('Not enough auth.'); if (!target) return this.sendReply('User does not exist.'); if (target.split(',').length != 2) return this.sendReply('The correct syntax for this command is /takemoney user, amount'); var tar = user, targ = target.split(',')[0], amount = Math.abs(target.split(',')[1]); if (tar) tar = Users.get(targ); if (!tar) return this.sendReply('user does not exist.'); if (isNaN(amount)) return this.sendReply('That\'s not a number.'); if (amount == 0) return this.sendReply('You can\'t take 0' + shop.currency + '\'s.'); room.add(user.name + ' just took from ' + tar.name + ' ' + amount + shop.currency + '\'s. They now have ' + shop.takeMoney(tar.userid, amount) + shop.currency + '\'s.'); }, seen: function(target, room, user) { if (!this.canBroadcast()) return; var tar = user; if (target) tar = Users.get(target); if (!tar) return this.sendReply('user does not exist.'); var uid = tar.userid; this.sendReply(((shop.dailyLogins[uid]) ? ("Last seen: " + (((new Date() / 1 - shop.dailyLogins[uid].lastSeen) / 1000 / 60)) + " minutes ago.") : "Hasn't come... :c")); }, profile: function(target, room, user) { if (!this.canBroadcast()) return; var tar = user; if (target) tar = Users.get(target); if (!tar) return this.sendReply('user does not exist.'); var uid = tar.userid; var avvy, name, group, lastSeen, money, items; if (!isNaN(Math.abs(tar.avatar))) avvy = 'http://play.pokemonshowdown.com/sprites/trainers/' + tar.avatar + '.png'; else { avvy = 'http://' + shop.host + ':' + shop.port + '/avatars/' + tar.avatar; } name = tar.name; group = Config.groups[tar.group]; if (group) group = group.name; if (!group) group = 'User'; lastSeen = "Hasn't been seen"; money = 0; if (shop.wallets[uid]) { if (shop.dailyLogins[uid]) { var minutes = (new Date() / 1 - shop.dailyLogins[uid].lastSeen) / 1000 / 60; lastSeen = minutes + " minutes ago"; } money = shop.wallets[uid].money + shop.currency + '\'s'; } if (tar.connected) lastSeen = "Currently Online"; items = shop.userItems(tar.name); if (!items || items.length == 0) items = 'None'; var insides = ''; insides += '<img src="' + avvy + '" align="left" height="80" />'; insides += '&nbsp;&nbsp;<font color="blue"><b>Name:</b></font> ' + name; insides += '<br />&nbsp;&nbsp;<font color="blue"><b>Group:</b></font> ' + group; insides += '<br />&nbsp;&nbsp;<font color="blue"><b>Last Seen:</b></font> ' + lastSeen; insides += '<br />&nbsp;&nbsp;<font color="blue"><b>Money:</b></font> ' + money; insides += '<br />&nbsp;&nbsp;<font color="blue"><b>Items:</b></font> ' + items; insides += '<br /><br />'; this.sendReplyBox(insides); }, updateshop: function(target, room, user) { if (!this.can('hotpatch')) return false; var funky = this.sendReply; var cachewallets = shop.wallets; var cachedailyLogins = shop.dailyLogins; shop = undefined; clearTimeout(shopLoopita); CommandParser.uncacheTree('./shop.js'); shop = require('./shop.js').shop; shop.wallets = cachewallets; shop.dailyLogins = cachedailyLogins; funky('Updated shop.'); fs.writeFile('./config/wallets.txt', shop.stringifyWallets()); }, minutes: function(target, room, user) { if (!this.canBroadcast()) return; var tar = user; if (target) tar = Users.get(target); if (!tar) return this.sendReply('user does not exist.'); this.sendReply(shop.minutes(tar.name)); }, wallet: 'purse', money: 'purse', purse: function(target, room, user, connection, cmd) { if (!this.canBroadcast()) return; var purse = 'http://www.pursepage.com/wp-content/uploads/2008/02/gucci-hysteria-top-handle-bag.gif'; if (cmd == "wallet" || cmd == "money") purse = 'http://informationng.com/wp-content/uploads/2013/11/wallet.jpg'; //if command == wallet var tar = user; if (target) tar = Users.get(target); if (!tar) return this.sendReply('user does not exist.'); var insides = ''; insides += '<img src="' + purse + '" height="100" align="left" />'; insides += '&nbsp;&nbsp;Money: ' + shop.money(tar.name) + '<br />'; insides += '&nbsp;&nbsp;Items: ' + shop.userItems(tar.name) + '<br /><br /><br /><br /><br /><br /><br />'; this.sendReplyBox(insides); }, shop: function(target, room, user) { if (!this.canBroadcast()) return; var insides = ''; insides += '<center><h4><u>Shop</h4></b></center>'; insides += '<table border="1" width="100%" cellspacing="0" cellpadding="5">'; insides += '<tr bgcolor="#947bff"><th>Item</th><th>Description</th><th>Cost</th><th>Daily Cost</th></tr>'; for (var i in shop.items) { insides += '<tr>' insides += '<td>' + shop.items[i].name + '</td>'; insides += '<td>' + shop.items[i].desc + '</td>'; insides += '<td align="center">' + shop.items[i].cost + '</td>'; insides += '<td align="center">' + shop.items[i].daily + '</td>'; insides += '</tr>'; } insides += '</table>'; insides += 'You have: ' + shop.money(user.name) + shop.currency + '\'s'; this.sendReply('|raw|' + insides); }, buy: function(target, room, user) { if (!target) return this.sendReply('Invalid item.'); var item = target; if (item.split(',').length - 1 > 0) item = toId(target.split(',')[0]); var alternateNames = { "customavatar": "avatar", "custom avatar": "avatar", "avvy": "avatar", "customsymbol": "symbol", "custom symbol": "symbol", "group": "symbol", "nameglow": "glow", "name glow": "glow", "namecolor": "glow", "name color": "glow", }; if (alternateNames[toId(item)]) item = alternateNames[toId(item)]; if (!shop.items[item]) return this.sendReply('Invalid item.'); var value = target.substr(item.length + 1); if (!value) return this.sendReply('You\'re not gonna tell me HOW you want the item?'); function in_it(needle, haystack) { if (typeof needle != "string" || typeof haystack != "string") return 0; return haystack.toLowerCase().split(needle.toLowerCase()).length - 1; } if (item == "avatar") { if (!in_it(".jpg", value) && !in_it(".png", value) && !in_it(".gif", value)) return this.sendReply('The image has to be a png, jpg, or gif. (gif = 25' + shop.symbol + '\'s/day, rest = 10' + shop.symbol + '\'s/day)'); var daily = shop.items[item].daily; var cost = shop.items[item].cost; if (in_it(".gif")) daily = 25; var rightnowcost = daily + cost; if (shop.money(user.name) < rightnowcost) return this.sendReply('You don\'t have enough ' + shop.currency + '\'s'); if (!global.fs) global.fs = require('fs'); if (!global.request) global.request = require('request'); var download = function(uri, filename, callback) { request.head(uri, function(err, res, body) { if (err) return false; console.log('content-type:', res.headers['content-type']); console.log('content-length:', res.headers['content-length']); request(uri).pipe(fs.createWriteStream(filename)).on('close', callback); }); }; var type; if (in_it(".jpg", value)) type = ".jpg"; if (in_it(".png", value)) type = ".png"; if (in_it(".gif", value)) type = ".gif"; shop.takeMoney(user.name, rightnowcost, { name: item, val: user.userid + type, lastPayment: new Date() / 1, daily: daily }); var that = this; function doneDownload(that, user, fileType) { user.avatar = user.userid + fileType; that.sendReply('Download complete. Your avatar is set.'); } download(value, "./config/avatars/" + user.userid + type, function() {doneDownload(that, user, type);}); } if (item == "symbol") { var symbol = value.substr(0, 1); if (symbol == " ") symbol = value.substr(1, 2); if (symbol == "") return this.sendReply('Well, actually pick a symbol now.'); if (Config.groups[symbol] || symbol.match(/[A-Za-z\d]+/g) || '‽!+%@\u2605&~#'.indexOf(symbol) >= 0) return this.sendReply('You can\'t use that symbol... sorry!'); var daily = shop.items[item].daily; var cost = shop.items[item].cost; var rightnowcost = daily + cost; if (shop.money(user.name) < rightnowcost) return this.sendReply('You don\'t have enough ' + shop.currency + '\'s'); shop.takeMoney(user.name, rightnowcost, { name: item, val: symbol, lastPayment: new Date() / 1, daily: daily }); this.sendReply('Now just refresh and your new symbol will be set!'); } if (item == "glow") { var color = toId(value); var colorsAvailable = { "yellow": true, "red": true, "black": true, "pink": true, "salmon": true, "lightgreen": true, "green": true, "orange": true, }; if (color == "") return this.sendReply('Well, actually pick a color now.'); if (!colorsAvailable[color]) return this.sendReply('We don\'t have that color... sorry! Maybe you should suggest it? We only have... ' + Object.keys(colorsAvailable).join(', ')); var daily = shop.items[item].daily; var cost = shop.items[item].cost; var rightnowcost = daily + cost; if (shop.money(user.name) < rightnowcost) return this.sendReply('You don\'t have enough ' + shop.currency + '\'s'); shop.takeMoney(user.name, rightnowcost, { name: item, val: color, lastPayment: new Date() / 1, daily: daily }); this.sendReply('Your name glow has been set. Talk away!'); } room.add("|c|Shop [Automatic Response]|" + user.name + " just bought a " + shop.items[item].name + ". (" + value + ")"); }, } }; exports.shop = shop; Users.User.prototype.rename = (function() { if (typeof cached_renameFunction == "undefined") cached_renameFunction = Users.User.prototype.rename; return function(name, token, auth, connection) { //shop line if (toId(name).substr(0, 5) != "guest") shop.userInit(name, connection); cached_renameFunction.apply(this, arguments); }; }()); if (global.CommandParser) for (var i in exports.shop.commands) global.CommandParser.commands[i] = exports.shop.commands[i]; if (typeof shopLoopita != "undefined") clearTimeout(shopLoopita); shop.loopitaFunk(); shop.openWallets();
const string = { _regex: { alphanumeric: /^[a-zA-Z0-9]*$/ }, default: context => { if (typeof context.value !== 'string' || context.value.length === 0) { context.fail('Value must be a string') } }, alphanumeric: context => { if (context.value === null || context.value && !context.value.toString().match(string._regex.alphanumeric)) { context.fail('Value must contain only letters and/or numbers') } } } module.exports = string
/** * * DATA: index * * * * DESCRIPTION: * - * * * API: * - * * * NOTES: * [1] * * * TODO: * [1] * * * HISTORY: * - 2014/05/26: Created. [AReines]. * * * DEPENDENCIES: * [1] * * * LICENSE: * MIT * * Copyright (c) 2014. Athan Reines. * * * AUTHOR: * Athan Reines. athan@nodeprime.com. 2014. * * */ (function() { 'use strict'; // MODULES // var // Filesystem module: fs = require( 'fs' ), // Path module: path = require( 'path' ); // FUNCTIONS // /** * FUNCTION: filter( file ) * */ function filter( file ) { return file.substr( -5 ) === '.json'; } // end FUNCTION filter() /** * FUNCTION: sort( a, b ) * */ function sort( a, b ) { var val1, val2; val1 = parseInt( a.substr( 0, a.length-5 ), 10 ); val2 = parseInt( b.substr( 0, b.length-5 ), 10 ); return val1 - val2; } // end FUNCTION sort() // INDEX // /** * FUNCTION: Index() * Index constructor. * * @returns {object} index instance */ function Index() { return this; } // and FUNCTION Index() /** * METHOD: list() * Lists available directory indices. * * @returns {array} list of directory indices */ Index.prototype.list = function() { var list = [], dirs, dir_path, stats; // Get the directory names: dirs = fs.readdirSync( __dirname ); for ( var i = 0; i < dirs.length; i++ ) { if ( dirs[ i ][ 0 ] !== '.' ) { // Assemble the path: dir_path = path.join( __dirname, dirs[ i ] ); // Get the file/directory stats: stats = fs.statSync( dir_path ); // Is the "directory" actually a directory? if ( stats.isDirectory() ) { // Add the directory to our list: list.push( dirs[ i ] ); } // end IF directory } // end IF !hidden directory } // end FOR i return list; }; // end METHOD list() /** * METHOD: get( name ) * Assembles an index of all data files, hashed by parent directory. * * @param {string} name - top-level directory in which to look for datasets and subsequent data files. * @returns {object} data file hash */ Index.prototype.get = function( name ) { var index = {}, parent_path, dirs, dir_path, stats, files; // Assemble the parent data directory path: parent_path = path.join( __dirname, name ); // Get the directory names: dirs = fs.readdirSync( parent_path ); for ( var i = 0; i < dirs.length; i++ ) { if ( dirs[ i ][ 0 ] !== '.' ) { // Assemble the path: dir_path = path.join( parent_path, dirs[ i ] ); // Get the file/directory stats: stats = fs.statSync( dir_path ); // Is the "directory" actually a directory? if ( stats.isDirectory() ) { // Get the file names within the directory, filtering for *.json files: files = fs.readdirSync( dir_path ) .filter( filter ); // Sort the filenames: files.sort( sort ); // Store the directory and the associated data filenames in a hash: index[ dirs[ i ] ] = files; } // end IF directory } // end IF !hidden directory } // end FOR i return index; }; // end METHOD get() // EXPORTS // module.exports = new Index(); })();
/* Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ CKEDITOR.plugins.setLang( 'stylescombo', 'nl', { label: 'Stijl', panelTitle: 'Opmaakstijlen', panelTitle1: 'Blok stijlen', panelTitle2: 'Inline stijlen', panelTitle3: 'Object stijlen' } );
import test from "ava"; import path from "path"; import sinon from "sinon"; import Eloquent from "../../lib"; // constructor test("Eloquent returns a constructor", (t) => { t.is(typeof Eloquent, "function"); }); test("Eloquent constructor should works", (t) => { Eloquent("."); t.pass(); }); test("Eloquent constructor should store directory", (t) => { const eloquent = Eloquent("."); t.deepEqual(eloquent.directory, path.resolve(".")); }); test.failing("Eloquent constructor should break if a directory isn't informed", () => { Eloquent(); }); // directory test("set directory", (t) => { const eloquent = Eloquent("."); eloquent.setDirectory("directory"); t.deepEqual(eloquent.directory, path.resolve("directory")); }); test.failing("don't set invalid directory - null", () => { const eloquent = Eloquent("."); eloquent.setDirectory(null); }); test.failing("don't set invalid directory - non-string", () => { const eloquent = Eloquent("."); eloquent.setDirectory(5); }); test("get directory", (t) => { const eloquent = Eloquent("."); const directory = path.resolve("directory"); eloquent.directory = directory; t.deepEqual(eloquent.getDirectory(), directory); }); // metadata test("set metadata", (t) => { const eloquent = Eloquent("."); const metadata = { metadata: "", }; eloquent.setMetadata(metadata); t.deepEqual(eloquent.metadata, metadata); }); test.failing("don't set invalid metadata", () => { const eloquent = Eloquent("."); eloquent.setMetadata(null); }); test.failing("don't set invalid metadata", () => { const eloquent = Eloquent("."); eloquent.setMetadata("metadata"); }); test("get metadata", (t) => { const eloquent = Eloquent("."); const metadata = { metadata: "", }; eloquent.metadata = metadata; t.deepEqual(eloquent.getMetadata(), metadata); }); // source test("set source", (t) => { const eloquent = Eloquent("."); eloquent.setSource("source"); t.deepEqual(eloquent.source, path.resolve("source")); }); test.failing("don't set invalid source", () => { const eloquent = Eloquent("."); eloquent.setSource(null); }); test.failing("don't set invalid source", () => { const eloquent = Eloquent("."); eloquent.setSource(5); }); test("get source", (t) => { const eloquent = Eloquent("."); const source = path.resolve("source"); eloquent.source = source; t.deepEqual(eloquent.getSource(), source); }); // concurrency test("set concurrency", (t) => { const eloquent = Eloquent("."); eloquent.setConcurrency(0); t.is(eloquent.concurrency, 0); }); test.failing("don't set invalid concurrency", () => { const eloquent = Eloquent("."); eloquent.setConcurrency(null); }); test.failing("don't set invalid concurrency", () => { const eloquent = Eloquent("."); eloquent.setConcurrency("concurrency"); }); test("get concurrency", (t) => { const eloquent = Eloquent("."); eloquent.concurrency = 0; t.is(eloquent.getConcurrency(), 0); }); // ignore test("set ignore", (t) => { const eloquent = Eloquent("."); eloquent.setIgnore(["file"]); t.deepEqual(eloquent.ignores, ["file"]); }); test("get ignore", (t) => { const eloquent = Eloquent("."); eloquent.ignores = "file"; t.deepEqual(eloquent.getIgnore(), "file"); }); // use test("Use function should add a valid plugin to the stack", (t) => { const plugin = function (files, eloquent, donePlugin) { donePlugin(); }; const eloquent = Eloquent("."); eloquent.use(plugin); t.true(eloquent.plugins.length > 0); t.deepEqual(eloquent.plugins[0], plugin); }); test.failing("Use function shouldn't add a undefined value to the stack", () => { const eloquent = Eloquent("."); eloquent.use(null); }); // path test("Eloquent path method resolves paths relative to directory", (t) => { const eloquent = Eloquent("."); t.deepEqual(eloquent.path("path"), path.resolve("./path")); }); // process test.cb("process read and run files", (t) => { const eloquent = Eloquent("."); const files = ["files"]; const read = sinon.stub(eloquent, "read").returns(files); const run = sinon.stub(eloquent, "run").returns(files); eloquent.process((err, resp) => { t.deepEqual(resp, files); t.true(read.called); t.true(run.called); t.end(); }); }); test.cb("runs plugins with files", (t) => { const eloquent = Eloquent("."); const files = ["files1"]; const plugin = function (filesArg, el, donePlugin) { filesArg.push("files2"); donePlugin(); }; eloquent.run(files, [plugin], (err, resp) => { t.deepEqual(resp, ["files1", "files2"]); t.end(); }); }); test("", (t) => { const eloquent = Eloquent("."); const expectedPath = "file"; eloquent.getAbsolutePath(expectedPath); t.deepEqual(eloquent.getAbsolutePath("file"), path.resolve(".", expectedPath)); }); test("", (t) => { const eloquent = Eloquent("."); const expectedPath = path.resolve(".", "file"); eloquent.getAbsolutePath(expectedPath); t.deepEqual(eloquent.getAbsolutePath("file"), expectedPath); });
module.exports = function (base){ var base2 = base[2]; var byte_255_str = '11111111'; var code = "\n" + "for(var i = 0; i < 500000; i++)\n" + " base2.js[10](byte_255_str);" ; console.log(code); var start = new Date().getTime(); for(var i = 0; i < 500000; i++) base2.js[10](byte_255_str); console.log('\ntakes', new Date().getTime() - start + 'ms\n'); var code = "\n" + "for(var i = 0; i < 500000; i++)\n" + " base2.cpp[10](byte_255_str);" ; console.log(code); var start = new Date().getTime(); for(var i = 0; i < 500000; i++) base2.cpp[10](byte_255_str); console.log('\ntakes', new Date().getTime() - start + 'ms\n'); } /** loop 50000 base2.base10('11111111') js: 0ms cpp: 0ms */
import React, { Component } from 'react'; import { Tooltip } from 'antd'; import classNames from 'classnames'; import styles from './index.less'; /* eslint react/no-did-mount-set-state: 0 */ /* eslint no-param-reassign: 0 */ const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined; const EllipsisText = ({ text, length, tooltip, ...other }) => { if (typeof text !== 'string') { throw new Error('Ellipsis children must be string.'); } if (text.length <= length || length < 0) { return <span {...other}>{text}</span>; } const tail = '...'; let displayText; if (length - tail.length <= 0) { displayText = ''; } else { displayText = text.slice(0, length - tail.length); } if (tooltip) { return ( <Tooltip overlayStyle={{ wordBreak: 'break-all' }} title={text}> <span> {displayText} {tail} </span> </Tooltip> ); } return ( <span {...other}> {displayText} {tail} </span> ); }; export default class Ellipsis extends Component { state = { text: '', targetCount: 0, }; componentDidMount() { if (this.node) { this.computeLine(); } } componentWillReceiveProps(nextProps) { if (this.props.lines !== nextProps.lines) { this.computeLine(); } } computeLine = () => { const { lines } = this.props; if (lines && !isSupportLineClamp) { const text = this.shadowChildren.innerText; const lineHeight = parseInt(getComputedStyle(this.root).lineHeight, 10); const targetHeight = lines * lineHeight; this.content.style.height = `${targetHeight}px`; const totalHeight = this.shadowChildren.offsetHeight; const shadowNode = this.shadow.firstChild; if (totalHeight <= targetHeight) { this.setState({ text, targetCount: text.length, }); return; } // bisection const len = text.length; const mid = Math.floor(len / 2); const count = this.bisection(targetHeight, mid, 0, len, text, shadowNode); this.setState({ text, targetCount: count, }); } }; bisection = (th, m, b, e, text, shadowNode) => { const suffix = '...'; let mid = m; let end = e; let begin = b; shadowNode.innerHTML = text.substring(0, mid) + suffix; let sh = shadowNode.offsetHeight; if (sh <= th) { shadowNode.innerHTML = text.substring(0, mid + 1) + suffix; sh = shadowNode.offsetHeight; if (sh > th) { return mid; } else { begin = mid; mid = Math.floor((end - begin) / 2) + begin; return this.bisection(th, mid, begin, end, text, shadowNode); } } else { if (mid - 1 < 0) { return mid; } shadowNode.innerHTML = text.substring(0, mid - 1) + suffix; sh = shadowNode.offsetHeight; if (sh <= th) { return mid - 1; } else { end = mid; mid = Math.floor((end - begin) / 2) + begin; return this.bisection(th, mid, begin, end, text, shadowNode); } } }; handleRoot = (n) => { this.root = n; }; handleContent = (n) => { this.content = n; }; handleNode = (n) => { this.node = n; }; handleShadow = (n) => { this.shadow = n; }; handleShadowChildren = (n) => { this.shadowChildren = n; }; render() { const { text, targetCount } = this.state; const { children, lines, length, className, tooltip, ...restProps } = this.props; const cls = classNames(styles.ellipsis, className, { [styles.lines]: lines && !isSupportLineClamp, [styles.lineClamp]: lines && isSupportLineClamp, }); if (!lines && !length) { return ( <span className={cls} {...restProps}> {children} </span> ); } // length if (!lines) { return ( <EllipsisText className={cls} length={length} text={children || ''} tooltip={tooltip} {...restProps} /> ); } const id = `antd-pro-ellipsis-${`${new Date().getTime()}${Math.floor(Math.random() * 100)}`}`; // support document.body.style.webkitLineClamp if (isSupportLineClamp) { const style = `#${id}{-webkit-line-clamp:${lines};-webkit-box-orient: vertical;}`; return ( <div id={id} className={cls} {...restProps}> <style>{style}</style> {tooltip ? ( <Tooltip overlayStyle={{ wordBreak: 'break-all' }} title={children}> {children} </Tooltip> ) : ( children )} </div> ); } const childNode = ( <span ref={this.handleNode}> {targetCount > 0 && text.substring(0, targetCount)} {targetCount > 0 && targetCount < text.length && '...'} </span> ); return ( <div {...restProps} ref={this.handleRoot} className={cls}> <div ref={this.handleContent}> {tooltip ? ( <Tooltip overlayStyle={{ wordBreak: 'break-all' }} title={text}> {childNode} </Tooltip> ) : ( childNode )} <div className={styles.shadow} ref={this.handleShadowChildren}> {children} </div> <div className={styles.shadow} ref={this.handleShadow}> <span>{text}</span> </div> </div> </div> ); } }
console.log("Linked."); // Dramatis Personae var hobbits = [ 'Frodo Baggins', 'Samwise \'Sam\' Gamgee', 'Meriadoc \'Merry\' Brandybuck', 'Peregrin \'Pippin\' Took' ]; var buddies = [ 'Gandalf the Grey', 'Legolas', 'Gimli', 'Strider', 'Boromir' ]; var lands = ['The Shire', 'Rivendell', 'Mordor']; var body = document.body; //manipulate the document // Did this timeout so that the page could load before any of the story begins $(window).on('load', function() { makeMiddleEarth(); makeHobbits(); keepItSecretKeepItSafe(); makeBuddies(); beautifulStranger(); leaveTheShire(); forgeTheFellowShip(); theBalrog(); hornOfGondor(); itsDangerousToGoAlone(); weWantsIt(); thereAndBackAgain(); }); //Part 1 var makeMiddleEarth = function () { // create a section tag with an id of `middle-earth` // add each land as an `article` tag // AND.. inside each `article` tag include an `h1` with the name of the land // append `middle-earth` to your document `body` $('.overlay').after('<section id="middle-earth"></section>'); window.$middleearth = $('#middle-earth'); for (var land in lands) { $middleearth.append('<article id="' + lands[land].split(" ").join("_") + '"><h1>' + lands[land] + '</h1></article>'); } }; //Part 2 var makeHobbits = function () { // display an `unordered list` of hobbits in the shire // (which is the second article tag on the page) // give each hobbit a class of `hobbit` window.$theShire = $('#The_Shire'); window.$theShire.append('<ul class="hobbits"></ul>'); for (var hobbit in hobbits) { $('#The_Shire ul').append('<li class="hobbit" id="' + hobbits[hobbit].split(" ").join("_").replace(/\'/g, "") + '">' + hobbits[hobbit] + '</li>'); } }; //Part 3 var keepItSecretKeepItSafe = function () { // create a div with an id of `'the-ring'` // give the div a class of `'magic-imbued-jewelry'` // add the ring as a child of `Frodo` $('#Frodo_Baggins').append('<div class="magic-imbued-jewelry" id="the-ring"></div>'); }; //Part 4 var makeBuddies = function () { // create an `aside` tag // attach an `unordered list` of the `'buddies'` in the aside // insert your aside as a child element of `rivendell` $('#Rivendell').append('<aside><ul></ul></aside>'); for (var buddy in buddies) { $('#Rivendell ul').append('<li class="buddy" id="' + buddies[buddy].split(" ").join("_").replace(/\'/g, "") + '">' + buddies[buddy] + '</li>'); } }; //Part 5 var beautifulStranger = function () { // change the `'Strider'` text to `'Aragorn'` $('#Strider').html('Aragorn'); }; //Part 6 var leaveTheShire = function () { // assemble the `hobbits` and move them to `rivendell` $('.hobbit').detach().appendTo("#Rivendell aside ul"); }; //Part 7 var forgeTheFellowShip = function () { // create a new div called `'the-fellowship'` within `rivendell` // add each `hobbit` and `buddy` one at a time to `'the-fellowship'` // after each character is added make an alert that they // have joined your party $('<div id="the-fellowship"><ul></ul></div>').appendTo('#Rivendell'); window.$hobbitsAndBuddies = $('#Rivendell aside ul li'); window.$hobbitsAndBuddies.detach(); window.$hobbitsAndBuddies.each(function(index) { $this = $(this); $($this).appendTo('#the-fellowship ul'); alert($this.text() + ' has joined the fellowship!'); }); }; //Part 8 var theBalrog = function () { // change the `'Gandalf'` text to `'Gandalf the White'` // apply the following style to the element, make the // background 'white', add a grey border $('#Gandalf_the_Grey').html('Gandalf the White'); $('#Gandalf_the_Grey').css({"background-color": "white", "border": "2px solid grey"}); }; //Part 9 var hornOfGondor = function () { // pop up an alert that the horn of gondor has been blown // Boromir's been killed by the Uruk-hai! // Remove `Boromir` from the Fellowship alert('the horn of gondor has been blown!!!!!'); $('#Boromir').remove(); }; //Part 10 var itsDangerousToGoAlone = function (){ // take `Frodo` and `Sam` out of the fellowship and move // them to `Mordor` // add a div with an id of `'mount-doom'` to `Mordor` $('#Mordor').append('<ul></ul>'); $('#Frodo_Baggins, #Samwise_Sam_Gamgee').detach().appendTo('#Mordor ul'); $('<div id="mount-doom"></div>').appendTo('#Mordor'); }; //Part 11 var weWantsIt = function () { // Create a div with an id of `'gollum'` and add it to Mordor // Remove `the ring` from `Frodo` and give it to `Gollum` // Move Gollum into Mount Doom $('<div id="gollum"></div>').appendTo('#Mordor'); $('#the-ring').detach().appendTo('#gollum'); $('#gollum').detach().appendTo('#mount-doom'); }; //Part 12 var thereAndBackAgain = function () { // remove `Gollum` and `the Ring` from the document // Move all the `hobbits` back to `the shire` $('#gollum, #the-ring').detach(); $('.hobbit').detach().appendTo('#The_Shire .hobbits'); };
const http = require('http') const express = require('express') const bodyParser = require('body-parser') const asyncExpress = require('./asyncExpress') module.exports = class WebApp { constructor({ todoList, serveClient }) { this._todoList = todoList this._serveClient = serveClient } async buildApp() { const app = express() app.use(bodyParser.json()) app.use(express.static('./public')) if (this._serveClient) { const browserify = require('browserify-middleware') app.get('/client.js', browserify(__dirname + '/../client/client.js')) } const asyncApp = asyncExpress(app) asyncApp.post('/todos', async (req, res) => { const { text } = req.body await this._todoList.addTodo({ text }) res.status(201).end() }) asyncApp.get('/todos', async (req, res) => { res.setHeader('Content-Type', 'application/json') const todos = await this._todoList.getTodos() res.status(200).end(JSON.stringify(todos)) }) return app } async listen(port) { const app = await this.buildApp() this._server = http.createServer(app) return new Promise((resolve, reject) => { this._server.listen(port, err => { if (err) return reject(err) resolve(this._server.address().port) }) }) } async stop() { await new Promise((resolve, reject) => { this._server.close(err => { if (err) return reject(err) resolve() }) }) } }
"use strict"; // Project const messages = require("./messages"); const predicates = require("./predicates"); module.exports = [ { message: messages.mustBePositiveInteger, predicate: predicates.isPositiveInteger, property: "apiVersion" }, { message: messages.mustBePopulatedString, predicate: predicates.isPopulatedString, property: "host" }, { message: messages.mustBePopulatedString, predicate: predicates.isPopulatedString, property: "password" }, { message: messages.mustBePopulatedString, predicate: predicates.isPopulatedString, property: "username" } ];
/* * grunt-hexo * https://github.com/4nduril/grunt-hexo * * Copyright (c) 2015 Tobias Barth * Licensed under the MIT license. */ 'use strict'; module.exports = function(grunt) { // Project configuration. grunt.initConfig({ jshint: { all: [ 'Gruntfile.js', 'tasks/*.js', '<%= mochaTest.test.src %>' ], options: { jshintrc: '.jshintrc' } }, // Unit tests. mochaTest: { test: { options: { reporter: 'nyan', }, src: ['test/*_test.js'] } } }); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-mocha-test'); grunt.registerTask('test', ['mochaTest']); // By default, lint and run all tests. grunt.registerTask('default', ['jshint', 'test']); };
// https://www.codewars.com/kata/first-non-repeating-character/javascript function firstNonRepeatingLetter(s) { let map = {}; let len = s.length; for(let i=0;i<len;i++){ let ch = s.charAt(i).toLowerCase(); if(map[ch]==null){ map[ch]={ pos:i, isDistinct:true } } else{ map[ch].isDistinct=false; } } let minPos = Number.MAX_SAFE_INTEGER; for(let [key,value] of Object.entries(map)){ if(value.isDistinct && minPos>value.pos) minPos=value.pos; } return s.charAt(minPos); }
/** @constructor */ ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp = (function() { ScalaJS.c.scala_runtime_AbstractPartialFunction.call(this) }); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype = new ScalaJS.inheritable.scala_runtime_AbstractPartialFunction(); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.constructor = ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp; ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.apply__I__Z = (function(x$2) { return this.apply$mcZI$sp__I__Z(x$2) }); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.apply$mcZI$sp__I__Z = (function(x) { return ScalaJS.uZ(this.applyOrElse__O__Lscala_Function1__O(ScalaJS.bI(x), ScalaJS.modules.scala_PartialFunction().empty__Lscala_PartialFunction())) }); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.apply__O__O = (function(x) { return ScalaJS.bZ(this.apply__I__Z(ScalaJS.uI(x))) }); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.init___ = (function() { ScalaJS.c.scala_runtime_AbstractPartialFunction.prototype.init___.call(this); ScalaJS.impls.scala_Function1$mcZI$sp$class__$init$__Lscala_Function1$mcZI$sp__V(this); return this }); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.apply__I__ = (function(x) { return ScalaJS.bZ(this.apply__I__Z(x)) }); /** @constructor */ ScalaJS.inheritable.scala_runtime_AbstractPartialFunction$mcZI$sp = (function() { /*<skip>*/ }); ScalaJS.inheritable.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype = ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype; ScalaJS.is.scala_runtime_AbstractPartialFunction$mcZI$sp = (function(obj) { return (!(!((obj && obj.$classData) && obj.$classData.ancestors.scala_runtime_AbstractPartialFunction$mcZI$sp))) }); ScalaJS.as.scala_runtime_AbstractPartialFunction$mcZI$sp = (function(obj) { if ((ScalaJS.is.scala_runtime_AbstractPartialFunction$mcZI$sp(obj) || (obj === null))) { return obj } else { ScalaJS.throwClassCastException(obj, "scala.runtime.AbstractPartialFunction$mcZI$sp") } }); ScalaJS.isArrayOf.scala_runtime_AbstractPartialFunction$mcZI$sp = (function(obj, depth) { return (!(!(((obj && obj.$classData) && (obj.$classData.arrayDepth === depth)) && obj.$classData.arrayBase.ancestors.scala_runtime_AbstractPartialFunction$mcZI$sp))) }); ScalaJS.asArrayOf.scala_runtime_AbstractPartialFunction$mcZI$sp = (function(obj, depth) { if ((ScalaJS.isArrayOf.scala_runtime_AbstractPartialFunction$mcZI$sp(obj, depth) || (obj === null))) { return obj } else { ScalaJS.throwArrayCastException(obj, "Lscala.runtime.AbstractPartialFunction$mcZI$sp;", depth) } }); ScalaJS.data.scala_runtime_AbstractPartialFunction$mcZI$sp = new ScalaJS.ClassTypeData({ scala_runtime_AbstractPartialFunction$mcZI$sp: 0 }, false, "scala.runtime.AbstractPartialFunction$mcZI$sp", ScalaJS.data.scala_runtime_AbstractPartialFunction, { scala_runtime_AbstractPartialFunction$mcZI$sp: 1, scala_Function1$mcZI$sp: 1, scala_runtime_AbstractPartialFunction: 1, scala_PartialFunction: 1, scala_Function1: 1, java_lang_Object: 1 }); ScalaJS.c.scala_runtime_AbstractPartialFunction$mcZI$sp.prototype.$classData = ScalaJS.data.scala_runtime_AbstractPartialFunction$mcZI$sp; //@ sourceMappingURL=AbstractPartialFunction$mcZI$sp.js.map
import React from 'react'; import MobilePage from '../containers/MobilePage'; import TradeTypePickerContainer from './TradeTypePickerContainer'; export default (props) => ( <MobilePage toolbarShown={false} backBtnBarTitle="Trade Type"> <TradeTypePickerContainer {...props} /> </MobilePage> );
/* global angular:false MyCtrl:false */ angular .module('myApp', []) .service('myService', () => ({ getText: () => 'Test text', })) .controller('MyController', [ 'myService', (myService) => { MyCtrl.message = myService.getText(); }, ]) .directive('myDirective', () => ({ restrict: 'E', controller: 'MyController', controllerAs: 'MyCtrl', scope: { foo: '=', }, bindToController: true, templateUrl: 'app.tpl.html', }));
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__css_main_css__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__css_main_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__css_main_css__); /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a <style> tag // load the styles var content = __webpack_require__(2); if(typeof content === 'string') content = [[module.i, content, '']]; // Prepare cssTransformation var transform; var options = {} options.transform = transform // add the styles to the DOM var update = __webpack_require__(4)(content, options); if(content.locals) module.exports = content.locals; // Hot Module Replacement if(false) { // When the styles change, update the <style> tags if(!content.locals) { module.hot.accept("!!../node_modules/css-loader/index.js!./main.css", function() { var newContent = require("!!../node_modules/css-loader/index.js!./main.css"); if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; update(newContent); }); } // When the module is disposed, remove the <style> tags module.hot.dispose(function() { update(); }); } /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(3)(undefined); // imports // module exports.push([module.i, "body {\r\n background-color: gray;\r\n}", ""]); // exports /***/ }), /* 3 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}; var memoize = function (fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }; var isOldIE = memoize(function () { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 return window && document && document.all && !window.atob; }); var getElement = (function (fn) { var memo = {}; return function(selector) { if (typeof memo[selector] === "undefined") { memo[selector] = fn.call(this, selector); } return memo[selector] }; })(function (target) { return document.querySelector(target) }); var singleton = null; var singletonCounter = 0; var stylesInsertedAtTop = []; var fixUrls = __webpack_require__(5); module.exports = function(list, options) { if (typeof DEBUG !== "undefined" && DEBUG) { if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; options.attrs = typeof options.attrs === "object" ? options.attrs : {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (!options.singleton) options.singleton = isOldIE(); // By default, add <style> tags to the <head> element if (!options.insertInto) options.insertInto = "head"; // By default, add <style> tags to the bottom of the target if (!options.insertAt) options.insertAt = "bottom"; var styles = listToStyles(list, options); addStylesToDom(styles, options); return function update (newList) { var mayRemove = []; for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if(newList) { var newStyles = listToStyles(newList, options); addStylesToDom(newStyles, options); } for (var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if(domStyle.refs === 0) { for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; }; function addStylesToDom (styles, options) { for (var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if(domStyle) { domStyle.refs++; for(var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for(; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles (list, options) { var styles = []; var newStyles = {}; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement (options, style) { var target = getElement(options.insertInto) if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); } var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; if (options.insertAt === "top") { if (!lastStyleElementInsertedAtTop) { target.insertBefore(style, target.firstChild); } else if (lastStyleElementInsertedAtTop.nextSibling) { target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); } else { target.appendChild(style); } stylesInsertedAtTop.push(style); } else if (options.insertAt === "bottom") { target.appendChild(style); } else { throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); } } function removeStyleElement (style) { if (style.parentNode === null) return false; style.parentNode.removeChild(style); var idx = stylesInsertedAtTop.indexOf(style); if(idx >= 0) { stylesInsertedAtTop.splice(idx, 1); } } function createStyleElement (options) { var style = document.createElement("style"); options.attrs.type = "text/css"; addAttrs(style, options.attrs); insertStyleElement(options, style); return style; } function createLinkElement (options) { var link = document.createElement("link"); options.attrs.type = "text/css"; options.attrs.rel = "stylesheet"; addAttrs(link, options.attrs); insertStyleElement(options, link); return link; } function addAttrs (el, attrs) { Object.keys(attrs).forEach(function (key) { el.setAttribute(key, attrs[key]); }); } function addStyle (obj, options) { var style, update, remove, result; // If a transform function was defined, run it on the css if (options.transform && obj.css) { result = options.transform(obj.css); if (result) { // If transform returns a value, use that instead of the original css. // This allows running runtime transformations on the css. obj.css = result; } else { // If the transform function returns a falsy value, don't add this css. // This allows conditional loading of css return function() { // noop }; } } if (options.singleton) { var styleIndex = singletonCounter++; style = singleton || (singleton = createStyleElement(options)); update = applyToSingletonTag.bind(null, style, styleIndex, false); remove = applyToSingletonTag.bind(null, style, styleIndex, true); } else if ( obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function" ) { style = createLinkElement(options); update = updateLink.bind(null, style, options); remove = function () { removeStyleElement(style); if(style.href) URL.revokeObjectURL(style.href); }; } else { style = createStyleElement(options); update = applyToTag.bind(null, style); remove = function () { removeStyleElement(style); }; } update(obj); return function updateStyle (newObj) { if (newObj) { if ( newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap ) { return; } update(obj = newObj); } else { remove(); } }; } var replaceText = (function () { var textStore = []; return function (index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; })(); function applyToSingletonTag (style, index, remove, obj) { var css = remove ? "" : obj.css; if (style.styleSheet) { style.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = style.childNodes; if (childNodes[index]) style.removeChild(childNodes[index]); if (childNodes.length) { style.insertBefore(cssNode, childNodes[index]); } else { style.appendChild(cssNode); } } } function applyToTag (style, obj) { var css = obj.css; var media = obj.media; if(media) { style.setAttribute("media", media) } if(style.styleSheet) { style.styleSheet.cssText = css; } else { while(style.firstChild) { style.removeChild(style.firstChild); } style.appendChild(document.createTextNode(css)); } } function updateLink (link, options, obj) { var css = obj.css; var sourceMap = obj.sourceMap; /* If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled and there is no publicPath defined then lets turn convertToAbsoluteUrls on by default. Otherwise default to the convertToAbsoluteUrls option directly */ var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; if (options.convertToAbsoluteUrls || autoFixUrls) { css = fixUrls(css); } if (sourceMap) { // http://stackoverflow.com/a/26603875 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = link.href; link.href = URL.createObjectURL(blob); if(oldSrc) URL.revokeObjectURL(oldSrc); } /***/ }), /* 5 */ /***/ (function(module, exports) { /** * When source maps are enabled, `style-loader` uses a link element with a data-uri to * embed the css on the page. This breaks all relative urls because now they are relative to a * bundle instead of the current page. * * One solution is to only use full urls, but that may be impossible. * * Instead, this function "fixes" the relative urls to be absolute according to the current page location. * * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. * */ module.exports = function (css) { // get current location var location = typeof window !== "undefined" && window.location; if (!location) { throw new Error("fixUrls requires window.location"); } // blank or null? if (!css || typeof css !== "string") { return css; } var baseUrl = location.protocol + "//" + location.host; var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); // convert each url(...) /* This regular expression is just a way to recursively match brackets within a string. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens ( = Start a capturing group (?: = Start a non-capturing group [^)(] = Match anything that isn't a parentheses | = OR \( = Match a start parentheses (?: = Start another non-capturing groups [^)(]+ = Match anything that isn't a parentheses | = OR \( = Match a start parentheses [^)(]* = Match anything that isn't a parentheses \) = Match a end parentheses ) = End Group *\) = Match anything and then a close parens ) = Close non-capturing group * = Match anything ) = Close capturing group \) = Match a close parens /gi = Get all matches, not the first. Be case insensitive. */ var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { // strip quotes (if they exist) var unquotedOrigUrl = origUrl .trim() .replace(/^"(.*)"$/, function(o, $1){ return $1; }) .replace(/^'(.*)'$/, function(o, $1){ return $1; }); // already a full url? no change if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) { return fullMatch; } // convert the url to a full url var newUrl; if (unquotedOrigUrl.indexOf("//") === 0) { //TODO: should we add protocol? newUrl = unquotedOrigUrl; } else if (unquotedOrigUrl.indexOf("/") === 0) { // path should be relative to the base url newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' } else { // path should be relative to current directory newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' } // send back the fixed url(...) return "url(" + JSON.stringify(newUrl) + ")"; }); // send back the fixed css return fixedCss; }; /***/ }) /******/ ]);
//jshint strict: false module.exports = function(config) { config.set({ basePath: './www', files: [ 'bower_components/angular/angular.js', 'bower_components/angular-route/angular-route.js', 'bower_components/angular-mocks/angular-mocks.js', 'app/**/*.js', 'cocktail/**/*.js', 'source/**/*.js' ], autoWatch: true, frameworks: ['jasmine'], browsers: ['Firefox'], // 'Chrome' plugins: [ 'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-jasmine', 'karma-junit-reporter' ], junitReporter: { outputFile: 'test_out/unit.xml', suite: 'unit' } }); };
import { expect } from 'chai'; import { describeModule, it } from 'ember-mocha'; describeModule( 'controller:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { // Specify the other units that are required for this test. // needs: ['controller:foo'] }, function () { // TODO: Replace this with your real tests. it('exists', function () { let controller = this.subject(); expect(controller).to.be.ok; }); } );
(function() { var adminboxLink; var adminbox; var adminboxShutdown = false; var animationDuration = 350; $(document).ready(function() { adminboxLink = $("#admin-menu-link"); adminboxLink.on("click", function(event) { event.preventDefault(); if (! adminbox) { event.stopPropagation(); loadAdminbox( adminboxLink.attr("href") ); } else { removeAdminbox(); } }); $(window).resize(updateAdminbox); $("body").on("click", function(event) { if (adminbox) { var target = $(event.target); if (target[0] !== adminbox[0] && target.closest(".panel")[0] !== adminbox[0]) { removeAdminbox(); } } }); }); function loadAdminbox(href) { var calendarSquareboxTemplate = $("#calendar-squarebox-template"); if (calendarSquareboxTemplate.length) { populateAdminbox( calendarSquareboxTemplate.html() ); } adminbox.queue(function() { $.ajax({ "cache": false, "data": { "ajax": true }, "dataType": "html", "error": function() { if (adminbox && ! adminboxShutdown) { window.location.href = href; } }, "success": function (data) { if (adminbox && ! adminboxShutdown) { populateAdminbox(data); adminbox.find(".no-ajax").remove(); updateAdminbox(); } }, "url": href }); $(this).dequeue(); }); } function prepareAdminbox() { if (! adminbox) { adminbox = $('<div class="panel"></div>').css({ "position": "absolute", "z-index": 1536 }); $("body").prepend(adminbox); } } function populateAdminbox(content) { prepareAdminbox(); adminbox.clearQueue(); adminbox.css("opacity", 0.01); adminbox.html(content); updateAdminbox(); adminbox.fadeTo(animationDuration, 1.00); } function updateAdminbox() { if (adminbox) { adminbox.position({ "my": "center top+8", "at": "center bottom", "of": adminboxLink }); } } function removeAdminbox() { if (adminbox) { adminboxShutdown = true; adminbox.clearQueue().fadeOut(animationDuration, function() { adminbox.remove(); adminbox = undefined; adminboxShutdown = false; }); } } })();
const _ = require('lodash'); module.exports = { find: async function (params = {}, populate) { return this .find(params.where) .limit(Number(params.limit)) .sort(params.sort) .skip(Number(params.skip)) .populate(populate || this.associations.map(x => x.alias).join(' ')) .lean(); }, count: async function (params = {}) { return Number(await this .count(params)); }, findOne: async function (params, populate) { const primaryKey = params[this.primaryKey] || params.id; if (primaryKey) { params = { [this.primaryKey]: primaryKey }; } return this .findOne(params) .populate(populate || this.associations.map(x => x.alias).join(' ')) .lean(); }, create: async function (params) { return this.create(Object.keys(params).reduce((acc, current) => { if (_.get(this._attributes, [current, 'type']) || _.get(this._attributes, [current, 'model'])) { acc[current] = params[current]; } return acc; }, {})) .catch((err) => { if (err.message.indexOf('index:') !== -1) { const message = err.message.split('index:'); const field = _.words(_.last(message).split('_')[0]); const error = { message: `This ${field} is already taken`, field }; throw error; } throw err; }); }, update: async function (search, params = {}) { if (_.isEmpty(params)) { params = search; } const primaryKey = search[this.primaryKey] || search.id; if (primaryKey) { search = { [this.primaryKey]: primaryKey }; } return this.update(search, params, { strict: false }) .catch((error) => { const field = _.last(_.words(error.message.split('_')[0])); const err = { message: `This ${field} is already taken`, field }; throw err; }); }, delete: async function (params) { // Delete entry. return this .remove({ [this.primaryKey]: params[this.primaryKey] || params.id }); }, deleteMany: async function (params) { // Delete entry. return this .remove({ [this.primaryKey]: { $in: params[this.primaryKey] || params.id } }); }, search: async function (params) { const re = new RegExp(params.id); return this .find({ '$or': [ { username: re }, { email: re } ] }); }, addPermission: async function (params) { return this .create(params); }, removePermission: async function (params) { return this .remove(params); } };
function oddOrEven(num) { if (num % 2 === 0) console.log('even'); else if (num % 2 !== 0 && num % 1 === 0) console.log('odd'); else console.log('invalid'); } oddOrEven(1.5);
__history = [{"date":"Sun, 15 Aug 2021 07:44:17 GMT","sloc":32,"lloc":7,"functions":2,"deliveredBugs":0.107,"difficulty":8.13,"maintainability":79.955,"lintErrors":3}]
window.twttr = (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], t = window.twttr || {}; if (d.getElementById(id)) return t; js = d.createElement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); t._e = []; t.ready = function(f) { t._e.push(f); }; return t; }(document, "script", "twitter-wjs")); (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,"script","//www.google-analytics.com/analytics.js","ga");ga("create", "UA-4603832-6", "auto");ga("send", "pageview");
/** * Gets the command and options from argv. */ var colors = require('colors/safe'); var yargs = require('yargs') .usage('Usage: $0 <command> [options]') .command('init', 'init the baselines of configured databases') .command('up', 'migrate the configured databases up from the baselines') .command('backup', 'backup the configured databases') .command('restore', 'restore the specified configured database') .demand(1, colors.red('error: missing command to use, specify --help for available command and options')) .options({ 'config': { alias: 'c', describe: 'the database configurations to use with baseline' }, 'database': { alias: 'd', describe: 'the target database to use with the command' }, 'force': { alias: 'f', describe: 'used with init command, force init if baseline exists' }, 'production': { alias: 'p', describe: 'use production config (`.baselinerc.production`)' }, 'log-level': { describe: 'logging level: ' + colors.underline('verbose') + ' (default), ' + ['debug', 'info', 'warn', 'error'].map(level => colors.underline(level)).join(', ') }, 'output': { alias: 'o', describe: 'the output path of the database backup' }, 'output-file': { describe: 'the output file name of the database backup' }, 'input': { alias: 'i', describe: 'input backup file used for database restore' }, 'drop-database': { type: 'boolean', describe: 'drop database before restore' } }) .help('help', 'show help information') .showHelpOnFail(false) .version(function () { return require('../package').version; }) .epilog('Copyright 2015, MIT licensed. '); // remove the boolean type annoations at the usage option lines. // see https://github.com/bcoe/yargs/issues/319 yargs.getOptions().boolean.splice(-2); var argv = yargs.argv; module.exports = { command: argv._[0], config: argv.config, production: !!argv.production, database: argv.database, force: !!argv.force, logLevel: argv['log-level'] || 'verbose', output: argv.output, outputFile: argv.outputFile, input: argv.input, dropDatabase: argv.dropDatabase, yargs };
var sudokuSamples = { simple: [ [0, 9, 1, 6, 0, 0, 4, 7, 0], [0, 2, 0, 4, 9, 0, 0, 5, 0], [5, 0, 4, 8, 0, 0, 0, 0, 3], [1, 0, 6, 0, 0, 0, 8, 3, 0], [9, 0, 0, 0, 0, 0, 0, 0, 7], [0, 7, 3, 0, 0, 0, 1, 0, 9], [2, 0, 0, 0, 0, 4, 7, 0, 6], [0, 4, 0, 0, 1, 2, 0, 8, 0], [0, 1, 9, 0, 0, 7, 3, 2, 0] ], page3: [ [0, 0, 2, 6, 0, 3, 0, 0, 0], [0, 7, 0, 1, 0, 0, 4, 0, 0], [0, 0, 0, 4, 0, 0, 6, 2, 0], [0, 0, 7, 8, 0, 0, 1, 3, 0], [0, 0, 1, 0, 9, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 4, 7], [0, 0, 3, 0, 0, 0, 0, 0, 6], [9, 8, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 3, 5, 0, 0, 0, 0] ], test: [ [0, 0, 5, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 5, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 5, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0] ] }; module.exports = sudokuSamples;
'use strict'; /** * @ngdoc service * @name kordingApp.scaler * @description * # scaler * Factory in the kordingApp to store the current Scale Model and expose functions * to manipulate the current scale. */ angular.module('kordingApp') .factory('scaler', function() { var TONICS = ['C', 'D', 'E', 'F', 'G', 'A', 'B']; var ACCIDENTALS = [ { 'name': 'natural', 'value': '' }, { 'name': 'sharp', 'value': '#' }, { 'name': 'flat', 'value': 'b' } ]; //var SCALE_TYPES = teoria.Scale.KNOWN_SCALES; var SCALE_TYPES = ['aeolian', 'blues', 'chromatic', 'dorian', 'doubleharmonic', 'harmonicminor', 'ionian', 'locrian', 'lydian', 'majorpentatonic', 'melodicminor', 'minorpentatonic', 'mixolydian', 'phrygian', 'wholetone', 'harmonicchromatic', 'minor', 'major', 'flamenco' ]; var selected = { 'tonic': 'C', 'accidental': { 'name': 'natural', 'value': '' }, 'scaleType': 'major' }; function getCurrentScale() { return selected; } function getTonics() { return TONICS; } function getAccidentals() { return ACCIDENTALS; } function getScaleTypes() { return SCALE_TYPES; } function setTonic(tonic) { selected.tonic = tonic; } function getTonic() { return selected.tonic; } function setAccidental(accidental) { selected.accidental = accidental; } function getAccidental() { return selected.accidental; } function setScaleType(scaleType) { selected.scaleType = scaleType; } function getScaleType() { return selected.scaleType; } // Public API here return { getCurrentScale: getCurrentScale, getTonics: getTonics, getAccidentals: getAccidentals, getScaleTypes: getScaleTypes, getTonic: getTonic, setTonic: setTonic, getAccidental: getAccidental, setAccidental: setAccidental, getScaleType: getScaleType, setScaleType: setScaleType }; });
var fs = require('fs'); var path = require('path'); var file = module.exports = {}; // True if the file path exists. file.exists = function () { var filepath = path.join.apply(path, arguments); return fs.existsSync(filepath); }; file.isDir = function () { var filepath = path.join.apply(path, arguments); return file.exists(filepath) && fs.statSync(filepath).isDirectory(); };
var Sequelize = require('sequelize'); var scrypt = require('scrypt'); // configure scrypt var scryptParameters = scrypt.params(0.1); scrypt.hash.config.keyEncoding = "ascii"; scrypt.verify.config.keyEncoding = "ascii"; scrypt.hash.config.outputEncoding = "base64"; scrypt.verify.config.hashEncoding = "base64"; module.exports = function(db){ return db.define('User', { id: { type: Sequelize.UUID, primaryKey: true, defaultValue: Sequelize.UUIDV4 }, createdAt: { type: Sequelize.DATE }, updatedAt: { type: Sequelize.DATE }, email: { type: Sequelize.STRING, unique: true, allowNull: true, validate: { isEmail: true } }, name: { type: Sequelize.STRING, unique: true, allowNull: false }, phone: { type: Sequelize.STRING, unique: true, allowNull: false }, lat: { type: Sequelize.FLOAT, unique: false, allowNull: true }, lon: { type: Sequelize.FLOAT, unique: false, allowNull: true } }, { paranoid: true, freezeTableName: true, instanceMethods: { getReturnable: function() { var self = this; var ret = { id: self.id, name: self.name, phone: self.PhoneNumber }; return ret; } } }); };
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var components_1 = require("../components"); var events_1 = require("../events"); var LayoutPlugin = (function (_super) { __extends(LayoutPlugin, _super); function LayoutPlugin() { return _super !== null && _super.apply(this, arguments) || this; } LayoutPlugin.prototype.initialize = function () { this.listenTo(this.owner, events_1.PageEvent.END, this.onRendererEndPage); }; LayoutPlugin.prototype.onRendererEndPage = function (page) { var layout = this.owner.theme.resources.layouts.getResource('default').getTemplate(); page.contents = layout(page); }; LayoutPlugin = __decorate([ components_1.Component({ name: 'layout' }) ], LayoutPlugin); return LayoutPlugin; }(components_1.RendererComponent)); exports.LayoutPlugin = LayoutPlugin; //# sourceMappingURL=LayoutPlugin.js.map
const Collector = require('./interfaces/Collector'); const Collection = require('../util/Collection'); const { Events } = require('../util/Constants'); /** * @typedef {CollectorOptions} ReactionCollectorOptions * @property {number} max The maximum total amount of reactions to collect * @property {number} maxEmojis The maximum number of emojis to collect * @property {number} maxUsers The maximum number of users to react */ /** * Collects reactions on messages. * @extends {Collector} */ class ReactionCollector extends Collector { /** * @param {Message} message The message upon which to collect reactions * @param {CollectorFilter} filter The filter to apply to this collector * @param {ReactionCollectorOptions} [options={}] The options to apply to this collector */ constructor(message, filter, options = {}) { super(message.client, filter, options); /** * The message upon which to collect reactions * @type {Message} */ this.message = message; /** * The users which have reacted to this message * @type {Collection} */ this.users = new Collection(); /** * The total number of reactions collected * @type {number} */ this.total = 0; this.empty = this.empty.bind(this); this.client.on(Events.MESSAGE_REACTION_ADD, this.handleCollect); this.client.on(Events.MESSAGE_REACTION_REMOVE, this.handleDispose); this.client.on(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty); this.once('end', () => { this.client.removeListener(Events.MESSAGE_REACTION_ADD, this.handleCollect); this.client.removeListener(Events.MESSAGE_REACTION_REMOVE, this.handleDispose); this.client.removeListener(Events.MESSAGE_REACTION_REMOVE_ALL, this.empty); }); this.on('collect', (collected, reaction, user) => { this.total++; this.users.set(user.id, user); }); this.on('dispose', (disposed, reaction, user) => { this.total--; if (!this.collected.some(r => r.users.has(user.id))) this.users.delete(user.id); }); } /** * Handles an incoming reaction for possible collection. * @param {MessageReaction} reaction The reaction to possibly collect * @returns {?{key: Snowflake, value: MessageReaction}} * @private */ collect(reaction) { if (reaction.message.id !== this.message.id) return null; return { key: ReactionCollector.key(reaction), value: reaction, }; } /** * Handles a reaction deletion for possible disposal. * @param {MessageReaction} reaction The reaction to possibly dispose * @returns {?Snowflake|string} */ dispose(reaction) { return reaction.message.id === this.message.id && !reaction.count ? ReactionCollector.key(reaction) : null; } /** * Empties this reaction collector. */ empty() { this.total = 0; this.collected.clear(); this.users.clear(); this.checkEnd(); } endReason() { if (this.options.max && this.total >= this.options.max) return 'limit'; if (this.options.maxEmojis && this.collected.size >= this.options.maxEmojis) return 'emojiLimit'; if (this.options.maxUsers && this.users.size >= this.options.maxUsers) return 'userLimit'; return null; } /** * Gets the collector key for a reaction. * @param {MessageReaction} reaction The message reaction to get the key for * @returns {Snowflake|string} */ static key(reaction) { return reaction.emoji.id || reaction.emoji.name; } } module.exports = ReactionCollector;
module.exports.fogbugzUser = '' module.exports.fogbugzPassword = '' module.exports.fogbugzURL = ''
import expect from 'expect'; import { LOAD_REPOS, LOAD_REPOS_SUCCESS, LOAD_REPOS_ERROR, } from '../constants'; import { loadRepos, reposLoaded, repoLoadingError, } from '../actions'; describe('App Actions', () => { describe('loadRepos', () => { it('should return the correct type', () => { const expectedResult = { type: LOAD_REPOS, }; expect(loadRepos()).toEqual(expectedResult); }); }); describe('reposLoaded', () => { it('should return the correct type and the passed repos', () => { const fixture = ['Test']; const username = 'test'; const expectedResult = { type: LOAD_REPOS_SUCCESS, repos: fixture, username, }; expect(reposLoaded(fixture, username)).toEqual(expectedResult); }); }); describe('repoLoadingError', () => { it('should return the correct type and the error', () => { const fixture = { msg: 'Something went wrong!', }; const expectedResult = { type: LOAD_REPOS_ERROR, error: fixture, }; expect(repoLoadingError(fixture)).toEqual(expectedResult); }); }); });
/* eslint max-len: 0 */ import webpack from 'webpack'; import path from 'path'; import merge from 'webpack-merge'; import autoprefixer from 'autoprefixer'; import baseConfig from './webpack.config.base'; import ExtractTextPlugin from 'extract-text-webpack-plugin'; const port = process.env.PORT || 3000; export default merge(baseConfig, { debug: true, devtool: 'cheap-module-eval-source-map', entry: [ `webpack-hot-middleware/client?path=http://localhost:${port}/__webpack_hmr`, 'babel-polyfill', './app/index' ], output: { publicPath: `http://localhost:${port}/dist/` }, //TODO:: Learn about css-loader webpack module: { loaders: [ { test: /\.global\.css$/, loaders: [ 'style-loader', 'css-loader?sourceMap' ] }, { test: /(\.scss)$/, loader: ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass?sourceMap') }, { test: /^((?!\.global).)*\.css$/, loaders: [ 'style-loader', 'css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]' ] } ] }, postcss: [autoprefixer], sassLoader: { data: '@import "theme/_config.scss";', includePaths: [path.resolve(__dirname, './app')] }, plugins: [ new ExtractTextPlugin('style.css', { allChunks: true }), new webpack.HotModuleReplacementPlugin(), new webpack.NoErrorsPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development') }) ], target: 'electron-renderer' });
/** * @file bbn-splashscreen component * @description bbn-splashscreen. * @author BBN Solutions * @copyright BBN Solutions */ (function (bbn, Vue) { "use strict"; Vue.component('bbn-splashscreen', { /** * @mixin bbn.vue.basicComponent * @mixin bbn.vue.listComponent * @mixin bbn.vue.eventsComponent * @mixin bbn.vue.resizerComponent */ mixins: [ bbn.vue.basicComponent, bbn.vue.listComponent, bbn.vue.eventsComponent, bbn.vue.resizerComponent ], props: { /** * @prop {Array} source */ source: { type: Array }, /** * @prop {Boolean} [true] arrows */ arrows: { type: Boolean, default: true }, /** * @prop {(Boolean|String)} ['outsideBottom'] dots */ dots: { type: [Boolean, String], default: 'outsideBottom', validator: d => [true, false, 'insideTop', 'insideBottom', 'outsideTop', 'outsideBottom'].includes(d) }, /** * @prop {Boolean} [true] loop */ loop: { type: Boolean, default: true }, /** * @prop {String} header */ header: { type: String }, /** * @prop {(String|Object|Vue)} headerComponent */ headerComponent: { type: [String, Object, Vue] }, /** * @prop {String} footer */ footer: { type: String }, /** * @prop {(String|Object|Vue)} footerComponent */ footerComponent: { type: [String, Object, Vue] } }, data(){ return { currentSwipeClass: 'bbn-splashscreen-swipe-left', currentIndex: 0 } }, computed: { dotsPosition(){ return this.dots === true ? 'outsideBottom' : this.dots; }, currentIndexes(){ return bbn.fn.map(this.filteredData, d => d.index); }, currentStyle(){ let style = {}; if (this.currentData.length) { let item = this.currentData[this.currentIndex].data; if (item.background) { style.backgroundColor = item.background; } if (item.image) { style.backgroundImage = `url(${item.image})`; style.backgroundPosition = 'center'; style.backgroundRepeat = 'no-repeat'; style.backgroundSize = 'cover'; } } return style; }, showNextArrow(){ let i = this.currentIndexes.indexOf(this.currentIndex); return (i > -1) && (!!this.loop || (this.currentIndexes[i+1] !== undefined)); }, showPrevArrow(){ let i = this.currentIndexes.indexOf(this.currentIndex); return (i > -1) && (!!this.loop || (this.currentIndexes[i-1] !== undefined)); } }, methods: { prev(){ if (this.currentIndexes.length) { let i = this.currentIndexes.indexOf(this.currentIndex); if (i > -1) { if (this.currentIndexes[i-1] !== undefined) { this.currentIndex = this.currentIndexes[i-1] } else if (this.loop) { this.currentIndex = this.currentIndexes[this.currentIndexes.length-1] } } } }, next(){ if (this.currentIndexes.length) { let i = this.currentIndexes.indexOf(this.currentIndex); if (i > -1) { if (this.currentIndexes[i+1] !== undefined) { this.currentIndex = this.currentIndexes[i+1] } else if (this.loop) { this.currentIndex = this.currentIndexes[0] } } } }, _map(data) { if ( bbn.fn.isArray(data) ){ data = data.map(a => { let o = bbn.fn.extend(true, {}, a); if (!o.headerComponent && (!bbn.fn.isString(o.header) || (bbn.fn.substr(o.header, 0,1) !== '<'))) { o.headerComponent = o.header; delete o.header; } if (!o.headerComponent && (!bbn.fn.isString(o.body) || (bbn.fn.substr(o.body, 0,1) !== '<'))) { o.bodyComponent = o.body; delete o.body; } if (!o.footerComponent && (!bbn.fn.isString(o.footer) || (bbn.fn.substr(o.footer, 0,1) !== '<'))) { o.footerComponent = o.footer; delete o.footer; } return o; }); return (this.map ? data.map(this.map) : data).slice(); } return []; }, _getStyle(item){ let style = {}; if (item.background) { style.backgroundColor = item.background; } if (item.image) { style.backgroundImage = `url(${item.image})`; style.backgroundPosition = 'center'; style.backgroundRepeat = 'no-repeat'; style.backgroundSize = 'cover'; } return style; }, _swipeLeft(){ this.currentSwipeClass = 'bbn-splashscreen-swipe-left'; this.next(); }, _swipeRight(){ this.currentSwipeClass = 'bbn-splashscreen-swipe-right'; this.prev(); } }, created(){ this.$on('swipeleft', this._swipeLeft); this.$on('swiperight', this._swipeRight); }, mounted(){ this.ready = true; }, beforeDestroy() { this.$off('swipeleft', this._swipeLeft); this.$off('swiperight', this._swipeRight); }, watch: { source:{ deep: true, handler(){ this.updateData(); } }, currentIndex(idx){ this.$emit('change', idx, this.source[idx]); } }, components: { dots: { template: ` <div class="bbn-splashscreen-dots bbn-c"> <i v-for="idx in indexes" @click="select(idx)" :class="['bbn-padded', 'bbn-p', 'nf nf-fa-circle', { ' bbn-primary-text': value !== idx, 'bbn-primary-text-alt': value === idx }]" style="width: 02em; height: 0.2em"/> </div> `, props: { value: { type: Number }, indexes: { type: Array } }, methods: { select(idx){ this.$emit('input', idx); } } } } }) })(window.bbn, window.Vue);
/*! * froala_editor v4.0.1 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2021 Froala Labs */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) : typeof define === 'function' && define.amd ? define(['froala-editor'], factory) : (factory(global.FroalaEditor)); }(this, (function (FE) { 'use strict'; FE = FE && FE.hasOwnProperty('default') ? FE['default'] : FE; /** * Hebrew */ FE.LANGUAGE['he'] = { translation: { // Place holder 'Type something': "\u05D4\u05E7\u05DC\u05D3 \u05DB\u05D0\u05DF", // Basic formatting 'Bold': "\u05DE\u05D5\u05D3\u05D2\u05E9", 'Italic': "\u05DE\u05D5\u05D8\u05D4", 'Underline': "\u05E7\u05D5 \u05EA\u05D7\u05EA\u05D9", 'Strikethrough': "\u05E7\u05D5 \u05D0\u05DE\u05E6\u05E2\u05D9", // Main buttons 'Insert': "\u05D4\u05D5\u05E1\u05E4\u05EA", 'Delete': "\u05DE\u05D7\u05D9\u05E7\u05D4", 'Cancel': "\u05D1\u05D9\u05D8\u05D5\u05DC", 'OK': "\u05D1\u05E6\u05E2", 'Back': "\u05D1\u05D7\u05D6\u05E8\u05D4", 'Remove': "\u05D4\u05E1\u05E8", 'More': "\u05D9\u05D5\u05EA\u05E8", 'Update': "\u05E2\u05D3\u05DB\u05D5\u05DF", 'Style': "\u05E1\u05D2\u05E0\u05D5\u05DF", // Font 'Font Family': "\u05D2\u05D5\u05E4\u05DF", 'Font Size': "\u05D2\u05D5\u05D3\u05DC \u05D4\u05D2\u05D5\u05E4\u05DF", // Colors 'Colors': "\u05E6\u05D1\u05E2\u05D9\u05DD", 'Background': "\u05E8\u05E7\u05E2", 'Text': "\u05D4\u05D8\u05E1\u05D8", 'HEX Color': 'צבע הקס', // Paragraphs 'Paragraph Format': "\u05E4\u05D5\u05E8\u05DE\u05D8", 'Normal': "\u05E8\u05D2\u05D9\u05DC", 'Code': "\u05E7\u05D5\u05D3", 'Heading 1': "1 \u05DB\u05D5\u05EA\u05E8\u05EA", 'Heading 2': "2 \u05DB\u05D5\u05EA\u05E8\u05EA", 'Heading 3': "3 \u05DB\u05D5\u05EA\u05E8\u05EA", 'Heading 4': "4 \u05DB\u05D5\u05EA\u05E8\u05EA", // Style 'Paragraph Style': "\u05E1\u05D2\u05E0\u05D5\u05DF \u05E4\u05E1\u05E7\u05D4", 'Inline Style': "\u05E1\u05D2\u05E0\u05D5\u05DF \u05DE\u05D5\u05D1\u05E0\u05D4", // Alignment 'Align': "\u05D9\u05D9\u05E9\u05D5\u05E8", 'Align Left': "\u05D9\u05D9\u05E9\u05D5\u05E8 \u05DC\u05E9\u05DE\u05D0\u05DC", 'Align Center': "\u05D9\u05D9\u05E9\u05D5\u05E8 \u05DC\u05DE\u05E8\u05DB\u05D6", 'Align Right': "\u05D9\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D9\u05DE\u05D9\u05DF", 'Align Justify': "\u05D9\u05D9\u05E9\u05D5\u05E8 \u05DE\u05DC\u05D0", 'None': "\u05D0\u05E3 \u05D0\u05D7\u05D3", // Lists 'Ordered List': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05E8\u05E9\u05D9\u05DE\u05D4 \u05DE\u05DE\u05D5\u05E1\u05E4\u05E8\u05EA", 'Unordered List': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05E8\u05E9\u05D9\u05DE\u05D4", // Indent 'Decrease Indent': "\u05D4\u05E7\u05D8\u05E0\u05EA \u05DB\u05E0\u05D9\u05E1\u05D4", 'Increase Indent': "\u05D4\u05D2\u05D3\u05DC\u05EA \u05DB\u05E0\u05D9\u05E1\u05D4", // Links 'Insert Link': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05E7\u05D9\u05E9\u05D5\u05E8", 'Open in new tab': "\u05DC\u05E4\u05EA\u05D5\u05D7 \u05D1\u05D8\u05D0\u05D1 \u05D7\u05D3\u05E9", 'Open Link': "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05E4\u05EA\u05D5\u05D7", 'Edit Link': "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05E2\u05E8\u05D9\u05DB\u05D4", 'Unlink': "\u05D4\u05E1\u05E8\u05EA \u05D4\u05E7\u05D9\u05E9\u05D5\u05E8", 'Choose Link': "\u05DC\u05D1\u05D7\u05D5\u05E8 \u05E7\u05D9\u05E9\u05D5\u05E8", // Images 'Insert Image': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05EA\u05DE\u05D5\u05E0\u05D4", 'Upload Image': "\u05EA\u05DE\u05D5\u05E0\u05EA \u05D4\u05E2\u05DC\u05D0\u05D4", 'By URL': "URL \u05E2\u05DC \u05D9\u05D3\u05D9", 'Browse': "\u05DC\u05D2\u05DC\u05D5\u05E9", 'Drop image': "\u05E9\u05D7\u05E8\u05E8 \u05D0\u05EA \u05D4\u05EA\u05DE\u05D5\u05E0\u05D4 \u05DB\u05D0\u05DF", 'or click': "\u05D0\u05D5 \u05DC\u05D7\u05E5", 'Manage Images': "\u05E0\u05D9\u05D4\u05D5\u05DC \u05D4\u05EA\u05DE\u05D5\u05E0\u05D5\u05EA", 'Loading': "\u05D8\u05E2\u05D9\u05E0\u05D4", 'Deleting': "\u05DE\u05D7\u05D9\u05E7\u05D4", 'Tags': "\u05EA\u05D2\u05D9\u05DD", 'Are you sure? Image will be deleted.': "\u05D4\u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D8\u05D5\u05D7? \u05D4\u05EA\u05DE\u05D5\u05E0\u05D4 \u05EA\u05DE\u05D7\u05E7.", 'Replace': "\u05DC\u05D4\u05D7\u05DC\u05D9\u05E3", 'Uploading': "\u05D4\u05E2\u05DC\u05D0\u05D4", 'Loading image': "\u05EA\u05DE\u05D5\u05E0\u05EA \u05D8\u05E2\u05D9\u05E0\u05D4", 'Display': "\u05EA\u05E6\u05D5\u05D2\u05D4", 'Inline': "\u05D1\u05E9\u05D5\u05E8\u05D4", 'Break Text': "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05E4\u05E1\u05E7\u05D4", 'Alternative Text': "\u05D8\u05E7\u05E1\u05D8 \u05D7\u05DC\u05D5\u05E4\u05D9", 'Change Size': "\u05D2\u05D5\u05D3\u05DC \u05E9\u05D9\u05E0\u05D5\u05D9", 'Width': "\u05E8\u05D5\u05D7\u05D1", 'Height': "\u05D2\u05D5\u05D1\u05D4", 'Something went wrong. Please try again.': "\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9. \u05D1\u05D1\u05E7\u05E9\u05D4 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1.", 'Image Caption': 'כיתוב תמונה', 'Advanced Edit': 'עריכה מתקדמת', // Video 'Insert Video': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05D5\u05D9\u05D3\u05D9\u05D0\u05D5", 'Embedded Code': "\u05E7\u05D5\u05D3 \u05DE\u05D5\u05D8\u05D1\u05E2", 'Paste in a video URL': 'הדבק בכתובת אתר של סרטון', 'Drop video': 'ירידה וידאו', 'Your browser does not support HTML5 video.': 'הדפדפן שלך אינו תומך וידאו html5.', 'Upload Video': 'להעלות וידאו', // Tables 'Insert Table': "\u05D4\u05DB\u05E0\u05E1 \u05D8\u05D1\u05DC\u05D4", 'Table Header': "\u05DB\u05D5\u05EA\u05E8\u05EA \u05D8\u05D1\u05DC\u05D4", 'Remove Table': "\u05D4\u05E1\u05E8 \u05E9\u05D5\u05DC\u05D7\u05DF", 'Table Style': "\u05E1\u05D2\u05E0\u05D5\u05DF \u05D8\u05D1\u05DC\u05D4", 'Horizontal Align': "\u05D0\u05D5\u05E4\u05E7\u05D9\u05EA \u05DC\u05D9\u05D9\u05E9\u05E8", 'Row': "\u05E9\u05D5\u05E8\u05D4", 'Insert row above': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05E9\u05D5\u05E8\u05D4 \u05DC\u05E4\u05E0\u05D9", 'Insert row below': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05E9\u05D5\u05E8\u05D4 \u05D0\u05D7\u05E8\u05D9", 'Delete row': "\u05DE\u05D7\u05D9\u05E7\u05EA \u05E9\u05D5\u05E8\u05D4", 'Column': "\u05D8\u05D5\u05E8", 'Insert column before': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05D8\u05D5\u05E8 \u05DC\u05E4\u05E0\u05D9", 'Insert column after': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05D8\u05D5\u05E8 \u05D0\u05D7\u05E8\u05D9", 'Delete column': "\u05DE\u05D7\u05D9\u05E7\u05EA \u05D8\u05D5\u05E8", 'Cell': "\u05EA\u05D0", 'Merge cells': "\u05DE\u05D6\u05D2 \u05EA\u05D0\u05D9\u05DD", 'Horizontal split': "\u05E4\u05E6\u05DC \u05D0\u05D5\u05E4\u05E7\u05D9", 'Vertical split': "\u05E4\u05E6\u05DC \u05D0\u05E0\u05DB\u05D9", 'Cell Background': "\u05E8\u05E7\u05E2 \u05EA\u05D0", 'Vertical Align': "\u05D9\u05D9\u05E9\u05D5\u05E8 \u05D0\u05E0\u05DB\u05D9", 'Top': "\u05E2\u05B6\u05DC\u05B4\u05D9\u05D5\u05B9\u05DF", 'Middle': "\u05EA\u05B4\u05D9\u05DB\u05D5\u05B9\u05E0\u05B4\u05D9", 'Bottom': "\u05EA\u05D7\u05EA\u05D5\u05DF", 'Align Top': "\u05DC\u05D9\u05D9\u05E9\u05E8 \u05E2\u05B6\u05DC\u05B4\u05D9\u05D5\u05B9\u05DF", 'Align Middle': "\u05DC\u05D9\u05D9\u05E9\u05E8 \u05EA\u05B4\u05D9\u05DB\u05D5\u05B9\u05E0\u05B4\u05D9", 'Align Bottom': "\u05DC\u05D9\u05D9\u05E9\u05E8 \u05EA\u05D7\u05EA\u05D5\u05DF", 'Cell Style': "\u05E1\u05D2\u05E0\u05D5\u05DF \u05EA\u05D0", // Files 'Upload File': "\u05D4\u05E2\u05DC\u05D0\u05EA \u05E7\u05D5\u05D1\u05E5", 'Drop file': "\u05D6\u05E8\u05D5\u05E7 \u05E7\u05D5\u05D1\u05E5 \u05DB\u05D0\u05DF", // Emoticons 'Emoticons': "\u05E1\u05DE\u05D9\u05D9\u05DC\u05D9\u05DD", 'Grinning face': "\u05D7\u05D9\u05D9\u05DA \u05E4\u05E0\u05D9\u05DD", 'Grinning face with smiling eyes': "\u05D7\u05D9\u05D9\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05DE\u05D7\u05D9\u05D9\u05DB\u05D5\u05EA", 'Face with tears of joy': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05D3\u05DE\u05E2\u05D5\u05EA \u05E9\u05DC \u05E9\u05DE\u05D7\u05D4", 'Smiling face with open mouth': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7", 'Smiling face with open mouth and smiling eyes': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7 \u05D5\u05DE\u05D7\u05D9\u05D9\u05DA \u05E2\u05D9\u05E0\u05D9\u05D9\u05DD", 'Smiling face with open mouth and cold sweat': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7 \u05D5\u05D6\u05D9\u05E2\u05D4 \u05E7\u05E8\u05D4", 'Smiling face with open mouth and tightly-closed eyes': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7 \u05D5\u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05D1\u05D7\u05D5\u05D6\u05E7\u05D4-\u05E1\u05D2\u05D5\u05E8\u05D5\u05EA", 'Smiling face with halo': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05D4\u05D9\u05DC\u05D4", 'Smiling face with horns': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E7\u05E8\u05E0\u05D5\u05EA", 'Winking face': "\u05E7\u05E8\u05D9\u05E6\u05D4 \u05E4\u05E0\u05D9\u05DD", 'Smiling face with smiling eyes': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05DE\u05D7\u05D9\u05D9\u05DB\u05D5\u05EA", 'Face savoring delicious food': "\u05E4\u05E0\u05D9\u05DD \u05DE\u05EA\u05E2\u05E0\u05D2 \u05D0\u05D5\u05DB\u05DC \u05D8\u05E2\u05D9\u05DD", 'Relieved face': "\u05E4\u05E0\u05D9\u05DD \u05E9\u05DC \u05D4\u05E7\u05DC\u05D4", 'Smiling face with heart-shaped eyes': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05D1\u05E6\u05D5\u05E8\u05EA \u05DC\u05D1", 'Smiling face with sunglasses': "\u05D7\u05D9\u05D5\u05DA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05DE\u05E9\u05E7\u05E4\u05D9 \u05E9\u05DE\u05E9", 'Smirking face': "\u05D4\u05D9\u05D0 \u05D7\u05D9\u05D9\u05DB\u05D4 \u05D7\u05D9\u05D5\u05DA \u05E0\u05D1\u05D6\u05D4 \u05E4\u05E0\u05D9\u05DD", 'Neutral face': "\u05E4\u05E0\u05D9\u05DD \u05E0\u05D9\u05D8\u05E8\u05DC\u05D9", 'Expressionless face': "\u05D1\u05E4\u05E0\u05D9\u05DD \u05D7\u05EA\u05D5\u05DD", 'Unamused face': "\u05E4\u05E0\u05D9\u05DD \u05DC\u05D0 \u05DE\u05E9\u05D5\u05E2\u05E9\u05E2\u05D9\u05DD", 'Face with cold sweat': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05D6\u05D9\u05E2\u05D4 \u05E7\u05E8\u05D4", 'Pensive face': "\u05D1\u05E4\u05E0\u05D9\u05DD \u05DE\u05D4\u05D5\u05E8\u05D4\u05E8", 'Confused face': "\u05E4\u05E0\u05D9\u05DD \u05DE\u05D1\u05D5\u05DC\u05D1\u05DC\u05D9\u05DD", 'Confounded face': "\u05E4\u05E0\u05D9\u05DD \u05DE\u05D1\u05D5\u05DC\u05D1\u05DC", 'Kissing face': "\u05E0\u05E9\u05D9\u05E7\u05D5\u05EA \u05E4\u05E0\u05D9\u05DD", 'Face throwing a kiss': "\u05E4\u05E0\u05D9\u05DD \u05DC\u05D6\u05E8\u05D5\u05E7 \u05E0\u05E9\u05D9\u05E7\u05D4", 'Kissing face with smiling eyes': "\u05E0\u05E9\u05D9\u05E7\u05D5\u05EA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05DE\u05D7\u05D9\u05D9\u05DB\u05D5\u05EA", 'Kissing face with closed eyes': "\u05E0\u05E9\u05D9\u05E7\u05D5\u05EA \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05E1\u05D2\u05D5\u05E8\u05D5\u05EA", 'Face with stuck out tongue': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05DC\u05E9\u05D5\u05DF \u05D1\u05DC\u05D8\u05D5", 'Face with stuck out tongue and winking eye': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05DC\u05E9\u05D5\u05DF \u05EA\u05E7\u05D5\u05E2\u05D4 \u05D4\u05D7\u05D5\u05E6\u05D4 \u05D5\u05E2\u05D9\u05DF \u05E7\u05D5\u05E8\u05E6\u05EA", 'Face with stuck out tongue and tightly-closed eyes': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05DC\u05E9\u05D5\u05DF \u05EA\u05E7\u05D5\u05E2\u05D4 \u05D4\u05D7\u05D5\u05E6\u05D4 \u05D5\u05E2\u05D9\u05E0\u05D9\u05D9\u05DD \u05D1\u05D7\u05D5\u05D6\u05E7\u05D4-\u05E1\u05D2\u05D5\u05E8\u05D5\u05EA", 'Disappointed face': "\u05E4\u05E0\u05D9\u05DD \u05DE\u05D0\u05D5\u05DB\u05D6\u05D1\u05D9\u05DD", 'Worried face': "\u05E4\u05E0\u05D9\u05DD \u05DE\u05D5\u05D3\u05D0\u05D2\u05D9\u05DD", 'Angry face': "\u05E4\u05E0\u05D9\u05DD \u05DB\u05D5\u05E2\u05E1\u05D9\u05DD", 'Pouting face': "\u05DE\u05E9\u05D5\u05E8\u05D1\u05D1 \u05E4\u05E0\u05D9\u05DD", 'Crying face': "\u05D1\u05DB\u05D9 \u05E4\u05E0\u05D9\u05DD", 'Persevering face': "\u05D4\u05EA\u05DE\u05D3\u05EA \u05E4\u05E0\u05D9\u05DD", 'Face with look of triumph': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05DE\u05D1\u05D8 \u05E9\u05DC \u05E0\u05E6\u05D7\u05D5\u05DF", 'Disappointed but relieved face': "\u05DE\u05D0\u05D5\u05DB\u05D6\u05D1 \u05D0\u05D1\u05DC \u05D4\u05D5\u05E7\u05DC \u05E4\u05E0\u05D9\u05DD", 'Frowning face with open mouth': "\u05E7\u05DE\u05D8 \u05D0\u05EA \u05DE\u05E6\u05D7 \u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7", 'Anguished face': "\u05E4\u05E0\u05D9\u05DD \u05DE\u05D9\u05D5\u05E1\u05E8\u05D9\u05DD", 'Fearful face': "\u05E4\u05E0\u05D9\u05DD \u05E9\u05D7\u05E9\u05E9\u05D5", 'Weary face': "\u05E4\u05E0\u05D9\u05DD \u05D5\u05D9\u05E8\u05D9", 'Sleepy face': "\u05E4\u05E0\u05D9\u05DD \u05E9\u05DC \u05E1\u05DC\u05D9\u05E4\u05D9", 'Tired face': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05D9\u05D9\u05E4\u05D9\u05DD", 'Grimacing face': "\u05D4\u05D5\u05D0 \u05D4\u05E2\u05D5\u05D5\u05D4 \u05D0\u05EA \u05E4\u05E0\u05D9 \u05E4\u05E0\u05D9\u05DD", 'Loudly crying face': "\u05D1\u05E7\u05D5\u05DC \u05E8\u05DD \u05D1\u05D5\u05DB\u05D4 \u05E4\u05E0\u05D9\u05DD", 'Face with open mouth': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7", 'Hushed face': "\u05E4\u05E0\u05D9\u05DD \u05E9\u05D5\u05E7\u05D8\u05D9\u05DD", 'Face with open mouth and cold sweat': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05E4\u05D4 \u05E4\u05EA\u05D5\u05D7 \u05D5\u05D6\u05D9\u05E2\u05D4 \u05E7\u05E8\u05D4\"", 'Face screaming in fear': "\u05E4\u05E0\u05D9\u05DD \u05E6\u05D5\u05E8\u05D7\u05D9\u05DD \u05D1\u05E4\u05D7\u05D3", 'Astonished face': "\u05E4\u05E0\u05D9\u05D5 \u05E0\u05D3\u05D4\u05DE\u05D5\u05EA", 'Flushed face': "\u05E4\u05E0\u05D9\u05D5 \u05E1\u05DE\u05D5\u05E7\u05D5\u05EA", 'Sleeping face': "\u05E9\u05D9\u05E0\u05D4 \u05E4\u05E0\u05D9\u05DD", 'Dizzy face': "\u05E4\u05E0\u05D9\u05DD \u05E9\u05DC \u05D3\u05D9\u05D6\u05D9", 'Face without mouth': "\u05E4\u05E0\u05D9\u05DD \u05DC\u05DC\u05D0 \u05E4\u05D4", 'Face with medical mask': "\u05E4\u05E0\u05D9\u05DD \u05E2\u05DD \u05DE\u05E1\u05DB\u05D4 \u05E8\u05E4\u05D5\u05D0\u05D9\u05EA", // Line breaker 'Break': "\u05D4\u05E4\u05E1\u05E7\u05D4", // Math 'Subscript': "\u05DB\u05EA\u05D1 \u05EA\u05D7\u05EA\u05D9", 'Superscript': "\u05E2\u05D9\u05DC\u05D9", // Full screen 'Fullscreen': "\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0", // Horizontal line 'Insert Horizontal Line': "\u05D4\u05D5\u05E1\u05E4\u05EA \u05E7\u05D5 \u05D0\u05D5\u05E4\u05E7\u05D9", // Clear formatting 'Clear Formatting': "\u05DC\u05D4\u05E1\u05D9\u05E8 \u05E2\u05D9\u05E6\u05D5\u05D1", // Save 'Save': "\u05DC\u05D4\u05E6\u05D9\u05DC", // Undo, redo 'Undo': "\u05D1\u05D9\u05D8\u05D5\u05DC", 'Redo': "\u05D1\u05E6\u05E2 \u05E9\u05D5\u05D1", // Select all 'Select All': "\u05D1\u05D7\u05E8 \u05D4\u05DB\u05DC", // Code view 'Code View': "\u05EA\u05E6\u05D5\u05D2\u05EA \u05E7\u05D5\u05D3", // Quote 'Quote': "\u05E6\u05D9\u05D8\u05D5\u05D8", 'Increase': "\u05DC\u05D4\u05D2\u05D1\u05D9\u05E8", 'Decrease': "\u05D9\u05E8\u05D9\u05D3\u05D4", // Quick Insert 'Quick Insert': "\u05DB\u05E0\u05E1 \u05DE\u05D4\u05D9\u05E8", // Spcial Characters 'Special Characters': 'תווים מיוחדים', 'Latin': 'לָטִינִית', 'Greek': 'יווני', 'Cyrillic': 'קירילית', 'Punctuation': 'פיסוק', 'Currency': 'מַטְבֵּעַ', 'Arrows': 'חצים', 'Math': 'מתמטיקה', 'Misc': 'שונות', // Print. 'Print': 'הדפס', // Spell Checker. 'Spell Checker': 'בודק איות', // Help 'Help': 'עֶזרָה', 'Shortcuts': 'קיצורי דרך', 'Inline Editor': 'עורך מוטבע', 'Show the editor': 'להראות את העורך', 'Common actions': 'פעולות נפוצות', 'Copy': 'עותק', 'Cut': 'גזירה', 'Paste': 'לְהַדבִּיק', 'Basic Formatting': 'עיצוב בסיסי', 'Increase quote level': 'רמת ציטוט', 'Decrease quote level': 'רמת ציטוט ירידה', 'Image / Video': 'תמונה / וידאו', 'Resize larger': 'גודל גדול יותר', 'Resize smaller': 'גודל קטן יותר', 'Table': 'שולחן', 'Select table cell': 'בחר תא תא - -', 'Extend selection one cell': 'להאריך את הבחירה תא אחד', 'Extend selection one row': 'להאריך את הבחירה שורה אחת', 'Navigation': 'ניווט', 'Focus popup / toolbar': 'מוקד קופץ / סרגל הכלים', 'Return focus to previous position': 'חזרה להתמקד קודם', // Embed.ly 'Embed URL': 'כתובת אתר להטביע', 'Paste in a URL to embed': 'הדבק כתובת אתר להטביע', // Word Paste. 'The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?': 'התוכן המודבק מגיע ממסמך Word של Microsoft. האם ברצונך לשמור את הפורמט או לנקות אותו?', 'Keep': 'לִשְׁמוֹר', 'Clean': 'לְנַקוֹת', 'Word Paste Detected': 'הדבק מילה זוהתה', // Character Counter 'Characters': 'תווים', // More Buttons 'More Text': 'עוד טקסט', 'More Paragraph': 'עוד סעיף', 'More Rich': 'עוד עשיר', 'More Misc': 'שונות עוד' }, direction: 'rtl' }; }))); //# sourceMappingURL=he.js.map
module.exports = { entry: './webapp/src/index.js', output: { path: './webapp/bin', filename: 'index.bundle.js' }, module:{ loaders: [ { test: /\.js?$/, loader: 'babel-loader', query: { presets: ['es2015', 'react'], plugins: [['antd', {'style': true}]] } }, { test: /\.less$/, loader: 'style!css!less' }, { test: /\.css$/, loader: 'style!css' }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" }, { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, { test: /\.(png|jpg|)$/, loader: 'url-loader?limit=200000' } ] } };
'use strict'; // Lessons controller angular.module('lessons').controller('BookLessonModalController', ['$scope', '$modalInstance', 'Students', function($scope, $modalInstance, Students) { // Get Students list $scope.students = Students.query(); // Book Lesson $scope.book = function() { $modalInstance.close($scope.student); }; // Cancel Lesson Booking $scope.cancel = function() { $modalInstance.dismiss(false); }; } ]);
/* ============================================================ * File: config.js * Configure routing * ============================================================ */ angular.module('app') .config(['$stateProvider', '$urlRouterProvider', '$ocLazyLoadProvider', function($stateProvider, $urlRouterProvider, $ocLazyLoadProvider) { $urlRouterProvider .otherwise('/app/dashboard'); $stateProvider .state('app', { abstract: true, url: "/app", templateUrl: "tpl/app.html" }) .state('app.dashboard', { url: "/dashboard", templateUrl: "tpl/dashboard.html", controller: 'DashboardCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'nvd3', 'mapplic', 'rickshaw', 'metrojs', 'sparkline', 'skycons', 'switchery' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load([ 'assets/js/controllers/dashboard.js' ]); }); }] } }) // Email app .state('app.email', { abstract: true, url: '/email', templateUrl: 'tpl/apps/email/email.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'menuclipper', 'wysihtml5' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load([ 'assets/js/apps/email/service.js', 'assets/js/apps/email/email.js' ]) }); }] } }) .state('app.email.inbox', { url: '/inbox/:emailId', templateUrl: 'tpl/apps/email/email_inbox.html' }) .state('app.email.compose', { url: '/compose', templateUrl: 'tpl/apps/email/email_compose.html' }) // Social app .state('app.social', { url: '/social', templateUrl: 'tpl/apps/social/social.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'isotope', 'stepsForm' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load([ 'pages/js/pages.social.min.js', 'assets/js/apps/social/social.js' ]) }); }] } }) //Calendar app .state('app.calendar', { url: '/calendar', templateUrl: 'tpl/apps/calendar/calendar.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'switchery', 'jquery-ui', 'moment', 'hammer' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load([ 'pages/js/pages.calendar.min.js', 'assets/js/apps/calendar/calendar.js' ]) }); }] } }) .state('app.builder', { url: '/builder', template: '<div></div>', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'assets/js/controllers/builder.js', ]); }] } }) // UI Elements .state('app.ui', { url: '/ui', template: '<div ui-view></div>' }) .state('app.ui.color', { url: '/color', templateUrl: 'tpl/ui_color.html' }) .state('app.ui.typo', { url: '/typo', templateUrl: 'tpl/ui_typo.html' }) .state('app.ui.icons', { url: '/icons', templateUrl: 'tpl/ui_icons.html', controller: 'IconsCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'sieve', 'line-icons' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load([ 'assets/js/controllers/icons.js' ]) }); }] } }) .state('app.ui.buttons', { url: '/buttons', templateUrl: 'tpl/ui_buttons.html' }) .state('app.ui.notifications', { url: '/notifications', templateUrl: 'tpl/ui_notifications.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'assets/js/controllers/notifications.js' ]); }] } }) .state('app.ui.modals', { url: '/modals', templateUrl: 'tpl/ui_modals.html', controller: 'ModalsCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'assets/js/controllers/modals.js' ]); }] } }) .state('app.ui.progress', { url: '/progress', templateUrl: 'tpl/ui_progress.html' }) .state('app.ui.tabs', { url: '/tabs', templateUrl: 'tpl/ui_tabs.html' }) .state('app.ui.sliders', { url: '/sliders', templateUrl: 'tpl/ui_sliders.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'noUiSlider', 'ionRangeSlider' ], { insertBefore: '#lazyload_placeholder' }); }] } }) .state('app.ui.treeview', { url: '/treeview', templateUrl: 'tpl/ui_treeview.html', controller: 'TreeCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'navTree' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/treeview.js'); }); }] } }) .state('app.ui.nestables', { url: '/nestables', templateUrl: 'tpl/ui_nestable.html', controller: 'NestableCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'nestable' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/nestable.js'); }); }] } }) // Form elements .state('app.forms', { url: '/forms', template: '<div ui-view></div>' }) .state('app.forms.elements', { url: '/elements', templateUrl: 'tpl/forms_elements.html', controller: 'FormElemCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'switchery', 'select', 'moment', 'datepicker', 'daterangepicker', 'timepicker', 'inputMask', 'autonumeric', 'wysihtml5', 'summernote', 'tagsInput', 'dropzone' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/forms_elements.js'); }); }] } }) .state('app.forms.layouts', { url: '/layouts', templateUrl: 'tpl/forms_layouts.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'datepicker', ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/forms_layouts.js'); }); }] } }) .state('app.forms.wizard', { url: '/wizard', templateUrl: 'tpl/forms_wizard.html', controller: 'FormWizardCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'wizard' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/forms_wizard.js'); }); }] } }) // Portlets .state('app.portlets', { url: '/portlets', templateUrl: 'tpl/portlets.html', controller: 'PortletCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'assets/js/controllers/portlets.js' ]); }] } }) // Tables .state('app.tables', { url: '/tables', template: '<div ui-view></div>' }) .state('app.tables.basic', { url: '/basic', templateUrl: 'tpl/tables_basic.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'dataTables' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/tables.js'); }); }] } }) .state('app.tables.dataTables', { url: '/dataTables', templateUrl: 'tpl/tables_dataTables.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'dataTables' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/dataTables.js'); }); }] } }) // Maps .state('app.maps', { url: '/maps', template: '<div class="full-height full-width" ui-view></div>' }) .state('app.maps.google', { url: '/google', templateUrl: 'tpl/maps_google_map.html', controller: 'GoogleMapCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'google-map' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/google_map.js') .then(function() { return loadGoogleMaps(); }); }); }] } }) .state('app.maps.vector', { url: '/vector', templateUrl: 'tpl/maps_vector_map.html', controller: 'VectorMapCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'mapplic', 'select' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/vector_map.js'); }); }] } }) // Charts .state('app.charts', { url: '/charts', templateUrl: 'tpl/charts.html', controller: 'ChartsCtrl', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'nvd3', 'rickshaw', 'sparkline' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/charts.js'); }); }] } }) // Extras .state('app.extra', { url: '/extra', template: '<div ui-view></div>' }) .state('app.extra.invoice', { url: '/invoice', templateUrl: 'tpl/extra_invoice.html' }) .state('app.extra.blank', { url: '/blank', templateUrl: 'tpl/extra_blank.html' }) .state('app.extra.gallery', { url: '/gallery', templateUrl: 'tpl/extra_gallery.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'isotope', 'codropsDialogFx', 'metrojs', 'owlCarousel', 'noUiSlider' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/gallery.js'); }); }] } }) .state('app.extra.timeline', { url: '/timeline', templateUrl: 'tpl/extra_timeline.html' }) // Users .state('app.users', { url: '/users', template: '<div ui-view></div>' }) .state('app.users.manage', { url: '/manage', templateUrl: 'tpl/users/manage.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'dataTables' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/dataTables.js'); }); }] } }) .state('app.users.add', { url: '/add', templateUrl: 'tpl/users/add.html' }) .state('app.users.edit', { url: '/edit', templateUrl: 'tpl/users/edit.html' }) // Car Inventory .state('app.car-inventory',{ url: '/car-inventory', template: '<div ui-view></div>' }) .state('app.car-inventory.cars',{ url: '/cars', templateUrl:'tpl/car-inventory/cars.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'dataTables' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/dataTables.js'); }); }] } }) .state('app.car-inventory.add',{ url: '/add', templateUrl:'tpl/car-inventory/add.html' }) .state('app.car-inventory.update',{ url: '/update', templateUrl:'tpl/car-inventory/update.html' }) // Types and Rates .state('app.types-rates',{ url: '/types-rates', template: '<div ui-view></div>' }) .state('app.types-rates.type',{ url: '/types', templateUrl:'tpl/types-rates/types.html', resolve: { deps: ['$ocLazyLoad', function($ocLazyLoad) { return $ocLazyLoad.load([ 'dataTables' ], { insertBefore: '#lazyload_placeholder' }) .then(function() { return $ocLazyLoad.load('assets/js/controllers/dataTables.js'); }); }] } }) .state('app.types-rates.update', { url: '/update', templateUrl: 'tpl/types-rates/update.html' }) // Extra - Others .state('access', { url: '/access', template: '<div class="full-height" ui-view></div>' }) .state('access.404', { url: '/404', templateUrl: 'tpl/extra_404.html' }) .state('access.500', { url: '/500', templateUrl: 'tpl/extra_500.html' }) .state('access.login', { url: '/login', templateUrl: 'tpl/extra_login.html' }) .state('access.register', { url: '/register', templateUrl: 'tpl/extra_register.html' }) .state('access.lock_screen', { url: '/lock_screen', templateUrl: 'tpl/extra_lock_screen.html' }) } ]);
// This is example of task function var gulp = require('gulp'); var notify = require('gulp-notify'); var changed = require('gulp-changed'); var notifier = require('../helpers/notifier'); var tarsConfig = require('../../tars-config'); s3 = require('gulp-s3-upload')({ accessKeyId: "AKIAJFQTWH2R6RS3XZSA", secretAccessKey: "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" }); // Include browserSync, if you need to reload browser // var browserSync = require('browser-sync'); // require('./ path to task file, which have to be done before current task'); // require('./required-task-name'); /** * Task description * @param {object} buildOptions */ // gt = gulp.task("upload-s3", function() { // gulp.src("./build/*/**") // .pipe(s3({ // Bucket: 'akadosoho', // Required // ACL: 'public-read' // Needs to be user-defined // })); // }); module.exports = function(buildOptions) { return gulp.task('upload-s3', /*['required-task-name'],*/ function(cb) { return gulp.src('./builds/build/**') // Do stuff here .pipe(s3({ Bucket: 'akadosoho', // Required ACL: 'public-read' // Needs to be user-defined })) // If you need to reload browser, uncomment the row below // .pipe(browserSync.reload({stream:true})) .pipe( // You can change text of success message notifier('Example task is finished') // if you need notify after each file will be processed, you have to use // notifier('Example task is finished', false) ); // You can return callback, if you can't return pipe // cb(null); }); };
"use strict"; /////////////////////////////////////////////////////////////////////////////////// // Developer notes /////////////////////////////////////////////////////////////////////////////////// // Exceptions: // =========== // When Crypto operation fail, it produce exception. It also produce exception if // password is wrong. So every exception does not have to be an error. /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// // Constructor / Class definition /////////////////////////////////////////////////////////////////////////////////// /** * @class * @classdesc Crypter class */ function Crypter() { this.crypto = window.crypto || window.msCrypto; // for IE 11 if (this.crypto == null) { throw new Error("Crypto API is not supported in this browser"); } this.subtle = this.crypto.subtle; if (this.subtle == null) { throw new Error("Crypto API is not supported in this browser"); } }; /////////////////////////////////////////////////////////////////////////////////// // Properties /////////////////////////////////////////////////////////////////////////////////// Crypter.prototype.crypto = null; Crypter.prototype.subtle = null; /////////////////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////////////////// /** * @description Provides complex decrytion of ciphertext * @param {dictionary} algorithm Ciphername, iv, tag and others * @param {CryptoKey} key Crypto key * @param {string} secret Secret in hex string * @returns {Promise} Promise contains plaintext */ Crypter.prototype.Decrypt = function (algorithm, key, secret) { var self = this; var ciphername = algorithm.name; return new Promise(function (resolve, reject) { if (ciphername == "AES-GCM") { self.DecrypAesGcm(algorithm.iv, algorithm.tag, secret, key).then(function (plaintext) { resolve(plaintext); }).catch(function (error) { reject(error); }); } else if (ciphername == "RSA-OAEP") { self.DecrypRsaOaep(secret, key).then(function (plaintext) { resolve(plaintext); }).catch(function (error) { reject(error); }); } else { reject("[CRYPTER] Algorithm " + ciphername + "is not supported."); } }); }; /** * @description Provides key derivation * @param {array} algorithm Key derivation algorithm * @param {string} password Password * @returns {Promise} Promise contains cryptoKey */ Crypter.prototype.DeriveKey = function (algortithm, password) { var self = this; return new Promise(function (resolve, reject) { resolve(); }); } /** * @description Provides hash function * @param {array} algorithm Key derivation algorithm * @param {string} plaintext Plaintext * @returns {Promise} Promise contains cryptoKey */ Crypter.prototype.Hash = function (algortithm, plaintext) { var self = this; return new Promise(function (resolve, reject) { resolve(); }); } /** * @description Provides decryption of AES-GCM algorithm * @param {string} iv Init vector in hex string * @param {number} tag Tag length * @param {string} secret Secret in hex string * @param {CryptoKey} key CryptoKey for AES-GCM * @returns {Promise} Promise contains decrypted plaintext */ Crypter.prototype.DecrypAesGcm = function (iv, tag, secret, key) { // Where the tag actualy is? Tag is added on end of the ciphertext. // So it looks like: ciphertext + tag (and this is it - no magic) var self = this; const ivBuffered = self.HexStrToByteArray(iv); const secretBufferd = self.HexStrToByteArray(secret); const alg = { name: 'AES-GCM', iv: ivBuffered, tagLength: tag }; return new Promise(function (resolve, reject) { self.subtle.decrypt(alg, key, secretBufferd).then(function (plainBuffer) { try { resolve(new TextDecoder().decode(plainBuffer)); } catch (error) { resolve(self.ArrayBufferToString(plainBuffer)); } }).catch(function (error) { console.log("[CRYPTER] Exception: "); console.log(error); reject(error); }); }); } /** * @description Provides decryption of RSA-OAEP algorithm * @param {string} secret Secret in hex string * @param {CryptoKey} key CryptoKey for RSA-OAEP * @returns {Promise} Promise contains decrypted plaintext */ Crypter.prototype.DecrypRsaOaep = function (secret, key) { var self = this; const alg = { name: 'RSA-OAEP' }; const secretBufferd = self.HexStrToByteArray(secret); return new Promise(function (resolve, reject) { self.subtle.decrypt(alg, key, secretBufferd).then(function (plainBuffer) { try { resolve(new TextDecoder().decode(plainBuffer)); } catch (error) { resolve(self.ArrayBufferToString(plainBuffer)); } }).catch(function (error) { console.log("[CRYPTER] Exception: "); console.log(error); reject(error); }); }); } /** * @description Provides SHA-256 hash * @param {string} plaintext Input plaintext * @returns {Promise} Promise contains hash */ Crypter.prototype.Sha256 = function (plaintext) { var self = this; return new Promise(function (resolve, reject) { var plaintextUtf8 = null; try { plaintextUtf8 = new TextEncoder().encode(plaintext); } catch (error) { plaintextUtf8 = self.StrToByteArray(plaintext); } //const plaintextUtf8 = new TextEncoder().encode(plaintext); self.subtle.digest('SHA-256', plaintextUtf8).then(function (hash) { resolve(hash); }).catch(function (error) { reject(error); }); }); }; /** * @description Provides SHA-512 hash * @param {string} plaintext Input plaintext * @returns {Promise} Promise contains hash */ Crypter.prototype.Sha512 = function (plaintext) { var self = this; return new Promise(function (resolve, reject) { var plaintextUtf8 = null; try { plaintextUtf8 = new TextEncoder().encode(plaintext); } catch (error) { plaintextUtf8 = self.StrToByteArray(plaintext); } //const plaintextUtf8 = new TextEncoder().encode(plaintext); self.subtle.digest('SHA-512', plaintextUtf8).then(function (hash) { resolve(hash); }).catch(function (error) { reject(error); }); }); }; /** * @description Provides PBKDF2 key derivation (not working now) * @returns {Promise} Promise contains CryptoKey */ Crypter.prototype.Pbkdf2Key = function (password, salt, cipher) { var self = this; return new Promise(function (resolve, reject) { // Import password as new key self.subtle.importKey( "raw", // Import type self.StrToByteArray(password), // Raw password { name: "PBKDF2" }, // Key type false, // If is extractable ["deriveKey", "deriveBits"] // Future usage ).then(function (key) { // Derive key for specified crypto algo self.subtle.deriveKey( { "name": "PBKDF2", // Key type salt: self.HexStrToByteArray(salt), // Salt iterations: 1000, // Iterations hash: "SHA-256", // Hash type }, key, // Key { name: cipher, // Future use crypto algo length: 256, // Future crypto algo length }, false, // If is extractabe ["encrypt", "decrypt"] // Future usage ).then(function (key) { resolve(key); }).catch(function (err) { reject(err); }); }).catch(function (err) { console.error(err); }); }); }; /** * @description Creates crypto key from SHA-256 hash (for cipher with 256 bit long key) * @param {string} password Plaintext password * @param {string} ciphername Specification of output key cipher type * @returns {Promise} Promise contains CryptoKey */ Crypter.prototype.Sha256Key = function (password, ciphername) { var self = this; var pwdUtf8 = ""; try { pwdUtf8 = new TextEncoder().encode(password); } catch (error) { pwdUtf8 = self.StrToByteArray(password); } //const pwdUtf8 = new TextEncoder().encode(password); const alg = { name: ciphername }; return new Promise(function (resolve, reject) { self.subtle.digest('SHA-256', pwdUtf8).then(function (pwdHash) { self.subtle.importKey('raw', pwdHash, alg, false, ['encrypt', 'decrypt']).then(function (key) { resolve(key); }).catch(function (error) { reject(error); }); }).catch(function (error) { reject(error); }); }); }; /** * @description Creates crypto key from raw hex key (for cipher with 256 bit long key) * @param {string} rawKey Raw key in hex string * @param {string} ciphername Specification of output key cipher type * @returns {Promise} Promise contains CryptoKey */ Crypter.prototype.RawKey = function (rawKey, ciphername) { var self = this; const alg = { name: ciphername }; return new Promise(function (resolve, reject) { self.subtle.importKey('raw', self.HexStrToByteArray(rawKey), alg, false, ['encrypt', 'decrypt']).then(function (key) { resolve(key); }).catch(function (error) { reject(error); }); }); } /** * @description Creates crypto key from PKCS#8 format * @param {string} pkcs8Key PKCS#8 key * @param {string} ciphername Specification of output key cipher type * @returns {Promise} Promise contains CryptoKey */ Crypter.prototype.Pkcs8Key = function (pemPrivateKey, ciphername) { var self = this; return new Promise(function (resolve, reject) { self.subtle.importKey( "pkcs8", self.PemToByteArray(pemPrivateKey), { name: ciphername, hash: { name: "SHA-256" } // or SHA-512 }, true, ["decrypt"] ).then(function (key) { resolve(key); }).catch(function (error) { reject(error); }); }); } /** * @description Provides conversion from ByteArray to Hex string (source: MDN documantation) * @param {ByteArray} buffer Input ByteArray * @returns {string} Hex string */ Crypter.prototype.ArrayBufferToHexString = function (buffer) { var hexCodes = []; var view = new DataView(buffer); for (var i = 0; i < view.byteLength; i += 4) { // Using getUint32 reduces the number of iterations needed (we process 4 bytes each time) var value = view.getUint32(i) // toString(16) will give the hex representation of the number without padding var stringValue = value.toString(16) // We use concatenation and slice for padding var padding = '00000000' var paddedValue = (padding + stringValue).slice(-padding.length) hexCodes.push(paddedValue); } // Join all the hex strings into one return (hexCodes.join("")).toLocaleUpperCase(); }; /** * @description Provides conversion from ByteArray to Hex string * @param {ByteArray} buffer Input ByteArray * @returns {string} String */ Crypter.prototype.ArrayBufferToString = function (buffer) { return String.fromCharCode.apply(null, new Uint8Array(buffer)); }; /** * @description Provides conversion from Hex string to Uint8Array (ByteArray) * @param {string} hex String hex value * @returns {Uint8Array} */ Crypter.prototype.HexStrToByteArray = function (hex) { var bufferLength = Math.floor(hex.length / 2); var byteArray = new Uint8Array(bufferLength); if (Math.floor(hex.length % 2) == 0) { for (var i = 0, y = 0; i < hex.length; i += 2, y++) { var strHexTuple = hex.substr(i, 2) byteArray[y] = parseInt(strHexTuple, 16); } } else { throw new Error("Hexadecimal string length error!"); } return byteArray; }; /** * @description Provides conversion from String to Uint8Array (ByteArray) * @param {string} str String value * @returns {Uint8Array} */ Crypter.prototype.StrToByteArray = function (str) { var bufferLength = Math.floor(str.length); var byteArray = new Uint8Array(bufferLength); for (var i = 0; i < str.length; i++) { byteArray[i] = str.charCodeAt(i); } return byteArray; }; /** * @description Provides conversion from String encoded in Base64 to Uint8Array (ByteArray) * @param {string} base64String Input Base64String * @returns {Uint8Array} */ Crypter.prototype.Base64ToByteArray = function (base64String) { var byteString = window.atob(base64String); var byteArray = new Uint8Array(byteString.length); for (var i = 0; i < byteString.length; i++) { byteArray[i] = byteString.charCodeAt(i); } return byteArray; } /** * @description Provides conversion (unpacking) from PEM to PKCS8 DER format * @param {string} pem PEM certificate (private key) * @returns {Uint8Array} */ Crypter.prototype.PemToByteArray = function (pem) { // Remove new lines var b64Lines = pem.replace(/\r?\n|\r/g, ""); // Remove header var b64Prefix = b64Lines.replace('-----BEGIN PRIVATE KEY-----', ''); // Remove footer var b64Final = b64Prefix.replace('-----END PRIVATE KEY-----', ''); return this.Base64ToByteArray(b64Final); } // Browserify export module.exports = Crypter;
import type from 'sanctuary-type-identifiers'; import show from 'sanctuary-show'; import jsc from 'jsverify'; import {ordinal} from '../../src/internal/const.js'; import {eq, error, throws, test} from './util.js'; import { any, anyFuture, anyNonFuture, anyParallel, anyFunction, anyResolvedFuture, FutureArb, } from '../arbitraries.js'; export * from '../arbitraries.js'; export var array = jsc.array; export var nearray = jsc.nearray; export var bool = jsc.bool; export var constant = jsc.constant; export var falsy = jsc.falsy; export var fn = jsc.fn; export var letrec = jsc.letrec; export var nat = jsc.nat; export var number = jsc.number; export var oneof = jsc.oneof; export var string = jsc.string; export var elements = jsc.elements; export var suchthat = jsc.suchthat; export function _of (rarb){ return FutureArb(string, rarb); } export function property (name){ const args = Array.from(arguments).slice(1); test(name, () => { return jsc.assert(jsc.forall.apply(null, args)); }); } export function f (x){ return {f: x}; } export function g (x){ return {g: x}; } export var altArg = { name: 'have Alt implemented', valid: anyFuture, invalid: anyNonFuture, }; export var applyArg = { name: 'have Apply implemented', valid: anyFuture, invalid: anyNonFuture, }; export var bifunctorArg = { name: 'have Bifunctor implemented', valid: anyFuture, invalid: anyNonFuture, }; export var chainArg = { name: 'have Chain implemented', valid: anyFuture, invalid: anyNonFuture, }; export var functorArg = { name: 'have Functor implemented', valid: anyFuture, invalid: anyNonFuture, }; export var functionArg = { name: 'be a Function', valid: anyFunction, invalid: oneof(number, string, bool, falsy, constant(error)), }; export var futureArg = { name: 'be a valid Future', valid: anyFuture, invalid: anyNonFuture, }; export var resolvedFutureArg = { name: 'be a valid Future', valid: anyResolvedFuture, invalid: anyNonFuture, }; export var positiveIntegerArg = { name: 'be a positive Integer', valid: suchthat(nat, function (x){ return x > 0 }), invalid: oneof(bool, constant(0.5)), }; export var futureArrayArg = { name: 'be an Array of valid Futures', valid: array(anyFuture), invalid: oneof(nearray(anyNonFuture), any), }; export var parallelArg = { name: 'be a ConcurrentFuture', valid: anyParallel, invalid: any, }; export var anyArg = { name: 'be anything', valid: any, invalid: null, }; var getValid = function (x){ return x.valid }; var generateValid = function (x){ return getValid(x).generator(1) }; var capply = function (f, args){ return args.reduce(function (g, x){ return g(x) }, f); }; export function testFunction (name, func, args, assert){ var validArbs = args.map(getValid); var validArgs = args.map(generateValid); test('is a curried ' + args.length + '-ary function', function (){ eq(typeof func, 'function'); eq(func.length, 1); validArgs.slice(0, -1).forEach(function (_, idx){ var partial = capply(func, validArgs.slice(0, idx + 1)); eq(typeof partial, 'function'); eq(partial.length, 1); }); }); args.forEach(function (arg, idx){ var priorArgs = args.slice(0, idx); var followingArgs = args.slice(idx + 1); var validPriorArgs = priorArgs.map(generateValid); var validFollowingArgs = followingArgs.map(generateValid); if(arg !== anyArg){ property('throws when the ' + ordinal[idx] + ' argument is invalid', arg.invalid, function (value){ throws(function (){ capply(func, validPriorArgs.concat([value]).concat(validFollowingArgs)); }, new TypeError( name + '() expects its ' + ordinal[idx] + ' argument to ' + arg.name + '.\n' + ' Actual: ' + show(value) + ' :: ' + type.parse(type(value)).name )); return true; }); property('throws when the ' + ordinal[idx] + ' invocation has more than one argument', arg.valid, function (value){ throws(function (){ var partial = capply(func, validPriorArgs); partial(value, 42); }, new TypeError( name + '() expects to be called with a single argument per invocation\n' + ' Saw: 2 arguments\n' + ' First: ' + show(value) + ' :: ' + type.parse(type(value)).name + '\n' + ' Second: 42 :: Number' )); return true; }); } }); property.apply(null, ['returns valid output when given valid input'].concat(validArbs).concat([function (){ return assert(capply(func, Array.from(arguments))); }])); }
/** * skylark-jquery - The skylark plugin library for fully compatible API with jquery. * @author Hudaokeji Co.,Ltd * @version v0.9.0 * @link www.skylarkjs.org * @license MIT */ (function(factory,globals) { var define = globals.define, require = globals.require, isAmd = (typeof define === 'function' && define.amd), isCmd = (!isAmd && typeof exports !== 'undefined'); // Set up Backbone appropriately for the environment. Start with AMD. if (!isAmd && !define) { var map = {}; define = globals.define = function(id, deps, factory) { if (typeof factory == 'function') { map[id] = { factory: factory, deps: deps, exports: null }; require(id); } else { resolved[id] = factory; } }; require = globals.require = function(id) { if (!map.hasOwnProperty(id)) { throw new Error('Module ' + id + ' has not been defined'); } var module = map[id]; if (!module.exports) { var args = []; module.deps.forEach(function(dep){ args.push(require(dep)); }) module.exports = module.factory.apply(window, args); } return module.exports; }; } factory(define,require); if (isAmd) { define([ "skylark-jquery/core", "skylark-jquery/callbacks", "skylark-jquery/deferred", "skylark-jquery/ajax" ],function($){ return $; }); } else { var jQuery ; require([ "skylark-jquery/core", "skylark-jquery/callbacks", "skylark-jquery/deferred", "skylark-jquery/ajax" ],function($){ jQuery = $; }); if (isCmd) { exports = jQuery; } else { globals.jQuery = globals.$ = jQuery; } } })(function(define,require) { define("skylark-jquery/core",[ "skylark/langx", "skylark/noder", "skylark/datax", "skylark/eventer", "skylark/finder", "skylark/styler", "skylark/query" ],function(langx,noder,datax,eventer,finder,styler,query){ var filter = Array.prototype.filter, slice = Array.prototype.slice; (function($){ $.fn.jquery = '2.2.0'; $.camelCase = langx.camelCase; $.each = langx.each; $.extend = function(target) { var deep, args = slice.call(arguments, 1); if (typeof target == 'boolean') { deep = target target = args.shift() } if (args.length == 0) { args = [target]; target = this; } args.forEach(function(arg) { langx.mixin(target, arg, deep); }); return target; }; $.grep = function(elements, callback) { return filter.call(elements, callback) }; $.isArray = langx.isArray; $.isEmptyObject = langx.isEmptyObject; $.isFunction = langx.isFunction; $.isWindow = langx.isWindow; $.isPlainObject = langx.isPlainObject; $.inArray = langx.inArray; $.makeArray = langx.makeArray; $.map = langx.map; $.noop = function() { }; $.parseJSON = window.JSON.parse; $.proxy = langx.proxy; $.trim = langx.trim; $.type = langx.type; $.fn.extend = function(props) { langx.mixin($.fn, props); }; $.fn.serializeArray = function() { var name, type, result = [], add = function(value) { if (value.forEach) return value.forEach(add) result.push({ name: name, value: value }) } if (this[0]) langx.each(this[0].elements, function(_, field) { type = field.type, name = field.name if (name && field.nodeName.toLowerCase() != 'fieldset' && !field.disabled && type != 'submit' && type != 'reset' && type != 'button' && type != 'file' && ((type != 'radio' && type != 'checkbox') || field.checked)) add($(field).val()) }) return result }; $.fn.serialize = function() { var result = [] this.serializeArray().forEach(function(elm) { result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value)) }) return result.join('&') }; })(query); (function($){ $.Event = function Event(type, props) { if (type && !langx.isString(type)) { props = type; type = props.type; } return eventer.create(type, props); }; $.event = {}; $.fn.submit = function(callback) { if (0 in arguments) this.bind('submit', callback) else if (this.length) { var event = $.Event('submit') this.eq(0).trigger(event) if (!event.isDefaultPrevented()) this.get(0).submit() } return this }; // event $.fn.triggerHandler = $.fn.trigger; $.fn.delegate = function(selector, event, callback) { return this.on(event, selector, callback) }; $.fn.undelegate = function(selector, event, callback) { return this.off(event, selector, callback) }; $.fn.live = function(event, callback) { $(document.body).delegate(this.selector, event, callback) return this }; $.fn.die = function(event, callback) { $(document.body).undelegate(this.selector, event, callback) return this }; $.fn.bind = function(event, selector, data, callback) { return this.on(event, selector, data, callback) }; $.fn.unbind = function(event, callback) { return this.off(event, callback) }; $.fn.ready = function(callback) { eventer.ready(callback); return this; }; $.fn.hover = function(fnOver, fnOut) { return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); }; $.fn.stop = function() { // todo return this; }; $.fn.moveto = function(x, y) { return this.animate({ left: x + "px", top: y + "px" }, 0.4); }; $.ready = eventer.ready; $.on = eventer.on; $.off = eventer.off; })(query); (function($){ // plugin compatibility $.uuid = 0; $.support = {}; $.expr = {}; $.expr[":"] = $.expr.pseudos = $.expr.filters = finder.pseudos; $.contains = noder.contains; $.css = styler.css; $.data = datax.data; $.offset = {}; $.offset.setOffset = function(elem, options, i) { var position = $.css(elem, "position"); // set position first, in-case top/left are set even on static elem if (position === "static") { elem.style.position = "relative"; } var curElem = $(elem), curOffset = curElem.offset(), curCSSTop = $.css(elem, "top"), curCSSLeft = $.css(elem, "left"), calculatePosition = (position === "absolute" || position === "fixed") && $.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if (calculatePosition) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat(curCSSTop) || 0; curLeft = parseFloat(curCSSLeft) || 0; } if ($.isFunction(options)) { options = options.call(elem, i, curOffset); } if (options.top != null) { props.top = (options.top - curOffset.top) + curTop; } if (options.left != null) { props.left = (options.left - curOffset.left) + curLeft; } if ("using" in options) { options.using.call(elem, props); } else { curElem.css(props); } }; })(query); (function($){ /** * @license Copyright 2013 Enideo. Released under dual MIT and GPL licenses. * https://github.com/Enideo/zepto-events-special */ $.event.special = $.event.special || {}; var bindBeforeSpecialEvents = $.fn.on; // $.fn.on = function (eventName, data, callback) { $.fn.on = function(eventName, selector, data, callback, one) { if (typeof eventName === "object") return bindBeforeSpecialEvents.apply(this, [eventName, selector, data, callback, one]); var el = this, $this = $(el), specialEvent, bindEventName = eventName; if (callback == null) { callback = data; data = null; } $.each(eventName.split(/\s/), function(i, eventName) { eventName = eventName.split(/\./)[0]; if ((eventName in $.event.special)) { specialEvent = $.event.special[eventName]; bindEventName = specialEvent.bindType || bindEventName; /// init enable special events on Zepto if (!specialEvent._init) { specialEvent._init = true; /// intercept and replace the special event handler to add functionality specialEvent.originalHandler = specialEvent.handler || specialEvent.handle; specialEvent.handler = function() { /// make event argument writeable, like on jQuery var args = Array.prototype.slice.call(arguments); args[0] = $.extend({}, args[0]); /// define the event handle, $.event.dispatch is only for newer versions of jQuery $.event.handle = function() { /// make context of trigger the event element var args = Array.prototype.slice.call(arguments), event = args[0], $target = $(event.target); $target.trigger.apply($target, arguments); } specialEvent.originalHandler.apply(this, args); } } /// setup special events on Zepto specialEvent.setup && specialEvent.setup.apply(el, [data]); } }); return bindBeforeSpecialEvents.apply(this, [bindEventName, selector, data, callback, one]); }; })(query); return window.jQuery = window.$ = query; }); define("skylark-jquery/deferred",[ "skylark-jquery/core" ], function($) { /* (function ($) { $.Deferred = async.Deferred; $.when = async.when; })(Zepto); */ // This module is borrow from zepto.deferred.js // (c) 2010-2014 Thomas Fuchs // Zepto.js may be freely distributed under the MIT license. // // Some code (c) 2005, 2013 jQuery Foundation, Inc. and other contributors var slice = Array.prototype.slice function Deferred(func) { var tuples = [ // action, add listener, listener list, final state ["resolve", "done", $.Callbacks({ once: 1, memory: 1 }), "resolved"], ["reject", "fail", $.Callbacks({ once: 1, memory: 1 }), "rejected"], ["notify", "progress", $.Callbacks({ memory: 1 })] ], state = "pending", promise = { state: function() { return state }, always: function() { deferred.done(arguments).fail(arguments) return this }, then: function( /* fnDone [, fnFailed [, fnProgress]] */ ) { var fns = arguments return Deferred(function(defer) { $.each(tuples, function(i, tuple) { var fn = $.isFunction(fns[i]) && fns[i] deferred[tuple[1]](function() { var returned = fn && fn.apply(this, arguments) if (returned && $.isFunction(returned.promise)) { returned.promise() .done(defer.resolve) .fail(defer.reject) .progress(defer.notify) } else { var context = this === promise ? defer.promise() : this, values = fn ? [returned] : arguments defer[tuple[0] + "With"](context, values) } }) }) fns = null }).promise() }, promise: function(obj) { return obj != null ? $.extend(obj, promise) : promise } }, deferred = {} $.each(tuples, function(i, tuple) { var list = tuple[2], stateString = tuple[3] promise[tuple[1]] = list.add if (stateString) { list.add(function() { state = stateString }, tuples[i ^ 1][2].disable, tuples[2][2].lock) } deferred[tuple[0]] = function() { deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments) return this } deferred[tuple[0] + "With"] = list.fireWith }) promise.promise(deferred) if (func) func.call(deferred, deferred) return deferred } $.when = function(sub) { var resolveValues = slice.call(arguments), len = resolveValues.length, i = 0, remain = len !== 1 || (sub && $.isFunction(sub.promise)) ? len : 0, deferred = remain === 1 ? sub : Deferred(), progressValues, progressContexts, resolveContexts, updateFn = function(i, ctx, val) { return function(value) { ctx[i] = this val[i] = arguments.length > 1 ? slice.call(arguments) : value if (val === progressValues) { deferred.notifyWith(ctx, val) } else if (!(--remain)) { deferred.resolveWith(ctx, val) } } } if (len > 1) { progressValues = new Array(len) progressContexts = new Array(len) resolveContexts = new Array(len) for (; i < len; ++i) { if (resolveValues[i] && $.isFunction(resolveValues[i].promise)) { resolveValues[i].promise() .done(updateFn(i, resolveContexts, resolveValues)) .fail(deferred.reject) .progress(updateFn(i, progressContexts, progressValues)) } else { --remain } } } if (!remain) deferred.resolveWith(resolveContexts, resolveValues) return deferred.promise() } $.Deferred = Deferred return $; }); define("skylark-jquery/callbacks",[ "skylark-jquery/core" ], function($) { // This module is borrow from zepto.callback.js // (c) 2010-2014 Thomas Fuchs // Zepto.js may be freely distributed under the MIT license. // Create a collection of callbacks to be fired in a sequence, with configurable behaviour // Option flags: // - once: Callbacks fired at most one time. // - memory: Remember the most recent context and arguments // - stopOnFalse: Cease iterating over callback list // - unique: Permit adding at most one instance of the same callback $.Callbacks = function(options) { options = $.extend({}, options) var memory, // Last fire value (for non-forgettable lists) fired, // Flag to know if list was already fired firing, // Flag to know if list is currently firing firingStart, // First callback to fire (used internally by add and fireWith) firingLength, // End of the loop when firing firingIndex, // Index of currently firing callback (modified by remove if needed) list = [], // Actual callback list stack = !options.once && [], // Stack of fire calls for repeatable lists fire = function(data) { memory = options.memory && data fired = true firingIndex = firingStart || 0 firingStart = 0 firingLength = list.length firing = true for (; list && firingIndex < firingLength; ++firingIndex) { if (list[firingIndex].apply(data[0], data[1]) === false && options.stopOnFalse) { memory = false break } } firing = false if (list) { if (stack) stack.length && fire(stack.shift()) else if (memory) list.length = 0 else Callbacks.disable() } }, Callbacks = { add: function() { if (list) { var start = list.length, add = function(args) { $.each(args, function(_, arg) { if (typeof arg === "function") { if (!options.unique || !Callbacks.has(arg)) list.push(arg) } else if (arg && arg.length && typeof arg !== 'string') add(arg) }) } add(arguments) if (firing) firingLength = list.length else if (memory) { firingStart = start fire(memory) } } return this }, remove: function() { if (list) { $.each(arguments, function(_, arg) { var index while ((index = $.inArray(arg, list, index)) > -1) { list.splice(index, 1) // Handle firing indexes if (firing) { if (index <= firingLength) --firingLength if (index <= firingIndex) --firingIndex } } }) } return this }, has: function(fn) { return !!(list && (fn ? $.inArray(fn, list) > -1 : list.length)) }, empty: function() { firingLength = list.length = 0 return this }, disable: function() { list = stack = memory = undefined return this }, disabled: function() { return !list }, lock: function() { stack = undefined; if (!memory) Callbacks.disable() return this }, locked: function() { return !stack }, fireWith: function(context, args) { if (list && (!fired || stack)) { args = args || [] args = [context, args.slice ? args.slice() : args] if (firing) stack.push(args) else fire(args) } return this }, fire: function() { return Callbacks.fireWith(this, arguments) }, fired: function() { return !!fired } } return Callbacks }; return $; }); define("skylark-jquery/ajax",[ "skylark-jquery/core", "skylark-jquery/deferred" ], function($) { // zepto.ajax.js // (c) 2010-2014 Thomas Fuchs // Zepto.js may be freely distributed under the MIT license. var jsonpID = 0, document = window.document, key, name, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, scriptTypeRE = /^(?:text|application)\/javascript/i, xmlTypeRE = /^(?:text|application)\/xml/i, jsonType = 'application/json', htmlType = 'text/html', blankRE = /^\s*$/, originAnchor = document.createElement('a'); originAnchor.href = window.location.href; // trigger a custom event and return false if it was cancelled function triggerAndReturn(context, eventName, data) { var event = $.Event(eventName) $(context).trigger(event, data) return !event.isDefaultPrevented() } // trigger an Ajax "global" event function triggerGlobal(settings, context, eventName, data) { if (settings.global) return triggerAndReturn(context || document, eventName, data) } // Number of active Ajax requests $.active = 0; function ajaxStart(settings) { if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart') } function ajaxStop(settings) { if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop') } // triggers an extra global event "ajaxBeforeSend" that's like "ajaxSend" but cancelable function ajaxBeforeSend(xhr, settings) { var context = settings.context if (settings.beforeSend.call(context, xhr, settings) === false || triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false) return false triggerGlobal(settings, context, 'ajaxSend', [xhr, settings]) } function ajaxSuccess(data, xhr, settings, deferred) { var context = settings.context, status = 'success' settings.success.call(context, data, status, xhr) if (deferred) deferred.resolveWith(context, [data, status, xhr]) triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data]) ajaxComplete(status, xhr, settings) } // type: "timeout", "error", "abort", "parsererror" function ajaxError(error, type, xhr, settings, deferred) { var context = settings.context settings.error.call(context, xhr, type, error) if (deferred) deferred.rejectWith(context, [xhr, type, error]) triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type]) ajaxComplete(type, xhr, settings) } // status: "success", "notmodified", "error", "timeout", "abort", "parsererror" function ajaxComplete(status, xhr, settings) { var context = settings.context settings.complete.call(context, xhr, status) triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings]) ajaxStop(settings) } // Empty function, used as default callback function empty() {} $.ajaxJSONP = function(options, deferred) { if (!('type' in options)) return $.ajax(options) var _callbackName = options.jsonpCallback, callbackName = ($.isFunction(_callbackName) ? _callbackName() : _callbackName) || ('jsonp' + (++jsonpID)), script = document.createElement('script'), originalCallback = window[callbackName], responseData, abort = function(errorType) { $(script).triggerHandler('error', errorType || 'abort') }, xhr = { abort: abort }, abortTimeout if (deferred) deferred.promise(xhr) $(script).on('load error', function(e, errorType) { clearTimeout(abortTimeout) $(script).off().remove() if (e.type == 'error' || !responseData) { ajaxError(null, errorType || 'error', xhr, options, deferred) } else { ajaxSuccess(responseData[0], xhr, options, deferred) } window[callbackName] = originalCallback if (responseData && $.isFunction(originalCallback)) originalCallback(responseData[0]) originalCallback = responseData = undefined }) if (ajaxBeforeSend(xhr, options) === false) { abort('abort') return xhr } window[callbackName] = function() { responseData = arguments } script.src = options.url.replace(/\?(.+)=\?/, '?$1=' + callbackName) document.head.appendChild(script) if (options.timeout > 0) abortTimeout = setTimeout(function() { abort('timeout') }, options.timeout) return xhr; } $.ajaxSettings = { // Default type of request type: 'GET', // Callback that is executed before request beforeSend: empty, // Callback that is executed if the request succeeds success: empty, // Callback that is executed the the server drops error error: empty, // Callback that is executed on request complete (both: error and success) complete: empty, // The context for the callbacks context: null, // Whether to trigger "global" Ajax events global: true, // Transport xhr: function() { return new window.XMLHttpRequest() }, // MIME types mapping // IIS returns Javascript as "application/x-javascript" accepts: { script: 'text/javascript, application/javascript, application/x-javascript', json: jsonType, xml: 'application/xml, text/xml', html: htmlType, text: 'text/plain' }, // Whether the request is to another domain crossDomain: false, // Default timeout timeout: 0, // Whether data should be serialized to string processData: true, // Whether the browser should be allowed to cache GET responses cache: true } function mimeToDataType(mime) { if (mime) mime = mime.split(';', 2)[0] return mime && (mime == htmlType ? 'html' : mime == jsonType ? 'json' : scriptTypeRE.test(mime) ? 'script' : xmlTypeRE.test(mime) && 'xml') || 'text' } function appendQuery(url, query) { if (query == '') return url return (url + '&' + query).replace(/[&?]{1,2}/, '?') } // serialize payload and append it to the URL for GET requests function serializeData(options) { if (options.processData && options.data && $.type(options.data) != "string") options.data = $.param(options.data, options.traditional) if (options.data && (!options.type || options.type.toUpperCase() == 'GET')) options.url = appendQuery(options.url, options.data), options.data = undefined } $.ajax = function(options) { var settings = $.extend({}, options || {}), deferred = $.Deferred && $.Deferred(), urlAnchor for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key] ajaxStart(settings) if (!settings.crossDomain) { urlAnchor = document.createElement('a') urlAnchor.href = settings.url urlAnchor.href = urlAnchor.href settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host) } if (!settings.url) settings.url = window.location.toString() serializeData(settings) var dataType = settings.dataType, hasPlaceholder = /\?.+=\?/.test(settings.url) if (hasPlaceholder) dataType = 'jsonp' if (settings.cache === false || ( (!options || options.cache !== true) && ('script' == dataType || 'jsonp' == dataType) )) settings.url = appendQuery(settings.url, '_=' + Date.now()) if ('jsonp' == dataType) { if (!hasPlaceholder) settings.url = appendQuery(settings.url, settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?') return $.ajaxJSONP(settings, deferred) } var mime = settings.accepts[dataType], headers = {}, setHeader = function(name, value) { headers[name.toLowerCase()] = [name, value] }, protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol, xhr = settings.xhr(), nativeSetHeader = xhr.setRequestHeader, abortTimeout if (deferred) deferred.promise(xhr) if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest') setHeader('Accept', mime || '*/*') if (mime = settings.mimeType || mime) { if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0] xhr.overrideMimeType && xhr.overrideMimeType(mime) } if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET')) setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded') if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name]) xhr.setRequestHeader = setHeader xhr.onreadystatechange = function() { if (xhr.readyState == 4) { xhr.onreadystatechange = empty clearTimeout(abortTimeout) var result, error = false if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) { dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type')) result = xhr.responseText try { // http://perfectionkills.com/global-eval-what-are-the-options/ if (dataType == 'script')(1, eval)(result) else if (dataType == 'xml') result = xhr.responseXML else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result) } catch (e) { error = e } if (error) ajaxError(error, 'parsererror', xhr, settings, deferred) else ajaxSuccess(result, xhr, settings, deferred) } else { ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred) } } } if (ajaxBeforeSend(xhr, settings) === false) { xhr.abort() ajaxError(null, 'abort', xhr, settings, deferred) return xhr } if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name] var async = 'async' in settings ? settings.async : true xhr.open(settings.type, settings.url, async, settings.username, settings.password) for (name in headers) nativeSetHeader.apply(xhr, headers[name]) if (settings.timeout > 0) abortTimeout = setTimeout(function() { xhr.onreadystatechange = empty xhr.abort() ajaxError(null, 'timeout', xhr, settings, deferred) }, settings.timeout) // avoid sending empty string (#319) xhr.send(settings.data ? settings.data : null) return xhr } // handle optional data/success arguments function parseArguments(url, data, success, dataType) { if ($.isFunction(data)) dataType = success, success = data, data = undefined if (!$.isFunction(success)) dataType = success, success = undefined return { url: url, data: data, success: success, dataType: dataType } } $.get = function( /* url, data, success, dataType */ ) { return $.ajax(parseArguments.apply(null, arguments)) } $.post = function( /* url, data, success, dataType */ ) { var options = parseArguments.apply(null, arguments) options.type = 'POST' return $.ajax(options) } $.getJSON = function( /* url, data, success */ ) { var options = parseArguments.apply(null, arguments) options.dataType = 'json' return $.ajax(options) } $.fn.load = function(url, data, success) { if (!this.length) return this var self = this, parts = url.split(/\s/), selector, options = parseArguments(url, data, success), callback = options.success if (parts.length > 1) options.url = parts[0], selector = parts[1] options.success = function(response) { self.html(selector ? $('<div>').html(response.replace(rscript, "")).find(selector) : response) callback && callback.apply(self, arguments) } $.ajax(options) return this } var escape = encodeURIComponent function serialize(params, obj, traditional, scope) { var type, array = $.isArray(obj), hash = $.isPlainObject(obj) $.each(obj, function(key, value) { type = $.type(value) if (scope) key = traditional ? scope : scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']' // handle data in serializeArray() format if (!scope && array) params.add(value.name, value.value) // recurse into nested objects else if (type == "array" || (!traditional && type == "object")) serialize(params, value, traditional, key) else params.add(key, value) }) } $.param = function(obj, traditional) { var params = [] params.add = function(key, value) { if ($.isFunction(value)) value = value() if (value == null) value = "" this.push(escape(key) + '=' + escape(value)) } serialize(params, obj, traditional) return params.join('&').replace(/%20/g, '+') }; var /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, rnotwhite = (/\S+/g); // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports(structure) { // dataTypeExpression is optional and defaults to "*" return function(dataTypeExpression, func) { if (typeof dataTypeExpression !== "string") { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || []; if (jQuery.isFunction(func)) { // For each dataType in the dataTypeExpression while ((dataType = dataTypes[i++])) { // Prepend if requested if (dataType[0] === "+") { dataType = dataType.slice(1) || "*"; (structure[dataType] = structure[dataType] || []).unshift(func); // Otherwise append } else { (structure[dataType] = structure[dataType] || []).push(func); } } } }; } $.ajaxPrefilter = addToPrefiltersOrTransports(prefilters); $.ajaxTransport = addToPrefiltersOrTransports(transports); // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend(target, src) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for (key in src) { if (src[key] !== undefined) { (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; } } if (deep) { jQuery.extend(true, target, deep); } return target; } // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. $.ajaxSetup = function(target, settings) { return settings ? // Building a settings object ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : // Extending ajaxSettings ajaxExtend(jQuery.ajaxSettings, target); }; // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { var inspected = {}, seekingTransport = (structure === transports); function inspect(dataType) { var selected; inspected[dataType] = true; jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) { var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { options.dataTypes.unshift(dataTypeOrTransport); inspect(dataTypeOrTransport); return false; } else if (seekingTransport) { return !(selected = dataTypeOrTransport); } }); return selected; } return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); } return $; }); },this);
var gameTitle = function(game){} gameTitle.prototype = { create: function(){ var gameTitle = this.game.add.sprite(160,160,"gametitle"); gameTitle.anchor.setTo(0.5,0.5); var playButton = this.game.add.button(160,320,"play",this.playTheGame,this); playButton.anchor.setTo(0.5,0.5); }, playTheGame: function(){ this.game.state.start("TheGame"); } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.asecDependencies = void 0; var _dependenciesTyped = require("./dependenciesTyped.generated"); var _factoriesNumber = require("../../factoriesNumber.js"); /** * THIS FILE IS AUTO-GENERATED * DON'T MAKE CHANGES HERE */ var asecDependencies = { typedDependencies: _dependenciesTyped.typedDependencies, createAsec: _factoriesNumber.createAsec }; exports.asecDependencies = asecDependencies;
'use strict'; var fs = require('fs'); var path = require('path'); module.exports = convert; function convert(options, cb) { var instance = this; options = options || {}; options.alg = options.alg || 'aes-256-ctr'; var convertAllProperties = function (oldPwd, newPwd, backupOldValue) { var keys = instance.getKeys(); keys.forEach(function (k) { var v = instance.getProp(k, oldPwd); instance.setProp(k, v, options.alg, newPwd, backupOldValue); }); }; var privateKey = options.privateKeyPath || instance.config._.privateKeyPath; var fullPrivateKeyPath; if (typeof cb === 'function') { if (typeof privateKey !== 'string') { return void cb(new Error('options.privateKeyPath required')); } fullPrivateKeyPath = path.resolve(privateKey); fs.readFile(fullPrivateKeyPath, { encoding: 'utf8' }, function (err, newPwd) { if (err) { return void cb(err); } convertAllProperties(instance.pwd, newPwd); instance.config._.privateKeyPath = fullPrivateKeyPath; instance.pwd = newPwd; return void cb(null, instance); }); } else { if (typeof privateKey !== 'string') { throw new Error('options.privateKeyPath required'); } fullPrivateKeyPath = path.resolve(privateKey); var newPwd = fs.readFileSync(fullPrivateKeyPath, { encoding: 'utf8' }); convertAllProperties(instance.pwd, newPwd, options.backup === true); instance.config._.privateKeyPath = fullPrivateKeyPath; instance.pwd = newPwd; } return instance; }
module("tinymce.html.Schema"); test('Valid elements global rule', function() { expect(1); var schema = new tinymce.html.Schema({valid_elements: '@[id|style],img[src|-style]'}); deepEqual(schema.getElementRule('img'), {"attributes": {"id": {}, "src": {}}, "attributesOrder": ["id", "src"]}); }); test('Whildcard element rule', function() { var schema; expect(17); schema = new tinymce.html.Schema({valid_elements: '*[id|class]'}); deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]); schema = new tinymce.html.Schema({valid_elements: 'b*[id|class]'}); deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]); deepEqual(schema.getElementRule('body').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('body').attributesOrder, ["id", "class"]); equal(schema.getElementRule('img'), undefined); schema = new tinymce.html.Schema({valid_elements: 'b?[id|class]'}); deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]); deepEqual(schema.getElementRule('bx').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('bx').attributesOrder, ["id", "class"]); equal(schema.getElementRule('body'), undefined); schema = new tinymce.html.Schema({valid_elements: 'b+[id|class]'}); deepEqual(schema.getElementRule('body').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('body').attributesOrder, ["id", "class"]); deepEqual(schema.getElementRule('bx').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('bx').attributesOrder, ["id", "class"]); equal(schema.getElementRule('b'), undefined); }); test('Whildcard attribute rule', function() { var schema; expect(13); schema = new tinymce.html.Schema({valid_elements: 'b[id|class|*]'}); deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]); ok(schema.getElementRule('b').attributePatterns[0].pattern.test('x')); schema = new tinymce.html.Schema({valid_elements: 'b[id|class|x?]'}); deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]); ok(schema.getElementRule('b').attributePatterns[0].pattern.test('xy')); ok(!schema.getElementRule('b').attributePatterns[0].pattern.test('xba')); ok(!schema.getElementRule('b').attributePatterns[0].pattern.test('a')); schema = new tinymce.html.Schema({valid_elements: 'b[id|class|x+]'}); deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} }); deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]); ok(!schema.getElementRule('b').attributePatterns[0].pattern.test('x')); ok(schema.getElementRule('b').attributePatterns[0].pattern.test('xb')); ok(schema.getElementRule('b').attributePatterns[0].pattern.test('xba')); }); test('Valid attributes and attribute order', function() { var schema; expect(3); schema = new tinymce.html.Schema({valid_elements: 'div,a[href|title],b[title]'}); deepEqual(schema.getElementRule('div'), {"attributes": {}, "attributesOrder": []}); deepEqual(schema.getElementRule('a'), {"attributes": {"href": {}, "title": {}}, "attributesOrder": ["href", "title"]}); deepEqual(schema.getElementRule('b'), {"attributes": {"title": {}}, "attributesOrder": ["title"]}); }); test('Required any attributes', function() { var schema; expect(1); schema = new tinymce.html.Schema({valid_elements: 'a![id|style|href]'}); deepEqual(schema.getElementRule('a'), {"attributes": {"href": {}, "id": {}, "style": {}}, "attributesOrder": ["id", "style", "href"], "removeEmptyAttrs": true}); }); test('Required attributes', function() { var schema; expect(1); schema = new tinymce.html.Schema({valid_elements: 'a[!href|!name]'}); deepEqual(schema.getElementRule('a'), {"attributes": {"href": {"required": true}, "name": {"required": true}}, "attributesOrder": ["href", "name"], "attributesRequired": ["href", "name"]}); }); test('Default attribute values', function() { var schema; expect(1); schema = new tinymce.html.Schema({valid_elements: 'img[border=0]'}); deepEqual(schema.getElementRule('img'), {"attributes": {"border": {"defaultValue": "0"}}, "attributesOrder": ["border"], "attributesDefault": [{"name": "border", "value": "0"}]}); }); test('Forced attribute values', function() { var schema; expect(1); schema = new tinymce.html.Schema({valid_elements: 'img[border:0]'}); deepEqual(schema.getElementRule('img'), {"attributes": {"border": {"forcedValue": "0"}}, "attributesOrder": ["border"], "attributesForced": [{"name": "border", "value": "0"}]}); }); test('Required attribute values', function() { var schema; expect(1); schema = new tinymce.html.Schema({valid_elements: 'span[dir<ltr?rtl]'}); deepEqual(schema.getElementRule('span'), {"attributes": {"dir": {"validValues": {"rtl": {}, "ltr": {}}}}, "attributesOrder": ["dir"]}); }); test('Remove empty elements', function() { var schema; expect(2); schema = new tinymce.html.Schema({valid_elements: '-span'}); deepEqual(schema.getElementRule('span'), {"attributes": {}, "attributesOrder": [], "removeEmpty": true}); schema = new tinymce.html.Schema({valid_elements: '#span'}); deepEqual(schema.getElementRule('span'), {"attributes": {}, "attributesOrder": [], "paddEmpty": true}); }); test('addValidElements', function() { var schema; expect(1); schema = new tinymce.html.Schema({valid_elements: '@[id|style],img[src|-style]'}); schema.addValidElements('b[class]'); deepEqual(schema.getElementRule('b'), {"attributes": {"id": {}, "style": {}, "class": {}}, "attributesOrder": ["id", "style", "class"]}); }); test('setValidElements', function() { var schema; expect(3); schema = new tinymce.html.Schema({valid_elements: '@[id|style],img[src|-style]'}); schema.setValidElements('b[class]'); equal(schema.getElementRule('img'), undefined); deepEqual(schema.getElementRule('b'), {"attributes": {"class": {}}, "attributesOrder": ["class"]}); schema = new tinymce.html.Schema({valid_elements: 'img[src]'}); schema.setValidElements('@[id|style],img[src]'); deepEqual(schema.getElementRule('img'), {"attributes": {"id": {}, "style": {}, "src": {}}, "attributesOrder": ["id", "style", "src"]}); }); test('getBoolAttrs', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getBoolAttrs(), { // WP: include three additional bool attributes used in the "media" plugin. "CONTROLS": {}, "LOOP": {}, "AUTOPLAY": {}, "SELECTED": {}, "READONLY": {}, "NOWRAP": {}, "NOSHADE": {}, "NORESIZE": {}, "NOHREF": {}, "MULTIPLE": {}, "ISMAP": {}, "DISABLED": {}, "DEFER": {}, "DECLARE": {}, "COMPACT": {}, "CHECKED": {}, "allowfullscreen": {}, "controls": {}, "loop": {}, "autoplay": {}, "selected": {}, "readonly": {}, "mozallowfullscreen": {}, "nowrap": {}, "noshade": {}, "noresize": {}, "nohref": {}, "multiple": {}, "ismap": {}, "disabled": {}, "defer": {}, "declare": {}, "compact": {}, "checked": {}, "webkitallowfullscreen": {} }); }); test('getBlockElements', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getBlockElements(), { ASIDE: {}, HGROUP: {}, SECTION: {}, ARTICLE: {}, FOOTER: {}, HEADER: {}, ISINDEX: {}, MENU: {}, NOSCRIPT: {}, FIELDSET: {}, DIR: {}, DD: {}, DT: {}, DL: {}, CENTER: {}, BLOCKQUOTE: {}, CAPTION: {}, UL: {}, OL: {}, LI: {}, TD: {}, TR: {}, TH: {}, TFOOT: {}, THEAD: {}, TBODY: {}, TABLE: {}, FORM: {}, PRE: {}, ADDRESS: {}, DIV: {}, P: {}, HR: {}, H6: {}, H5: {}, H4: {}, H3: {}, H2: {}, H1: {}, NAV: {}, FIGURE: {}, DATALIST: {}, OPTGROUP: {}, OPTION: {}, SELECT: {}, aside: {}, hgroup: {}, section: {}, article: {}, footer: {}, header: {}, isindex: {}, menu: {}, noscript: {}, fieldset: {}, dir: {}, dd: {}, dt: {}, dl: {}, center: {}, blockquote: {}, caption: {}, ul: {}, ol: {}, li: {}, td: {}, tr: {}, th: {}, tfoot: {}, thead: {}, tbody: {}, table: {}, form: {}, pre: {}, address: {}, div: {}, p: {}, hr: {}, h6: {}, h5: {}, h4: {}, h3: {}, h2: {}, h1: {}, nav: {}, figure: {}, datalist: {}, optgroup: {}, option: {}, select: {} }); }); test('getShortEndedElements', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getShortEndedElements(), { "EMBED": {}, "PARAM": {}, "META": {}, "LINK": {}, "ISINDEX": {}, "INPUT": {}, "IMG": {}, "HR": {}, "FRAME": {}, "COL": {}, "BR": {}, "BASEFONT": {}, "BASE": {}, "AREA": {}, "SOURCE" : {}, "WBR" : {}, "TRACK" : {}, "embed": {}, "param": {}, "meta": {}, "link": {}, "isindex": {}, "input": {}, "img": {}, "hr": {}, "frame": {}, "col": {}, "br": {}, "basefont": {}, "base": {}, "area": {}, "source" : {}, "wbr" : {}, "track" : {} }); }); test('getNonEmptyElements', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getNonEmptyElements(), { "EMBED": {}, "PARAM": {}, "META": {}, "LINK": {}, "ISINDEX": {}, "INPUT": {}, "IMG": {}, "HR": {}, "FRAME": {}, "COL": {}, "BR": {}, "BASEFONT": {}, "BASE": {}, "AREA": {}, "SOURCE" : {}, "TD": {}, "TH": {}, "IFRAME": {}, "VIDEO": {}, "AUDIO": {}, "OBJECT": {}, "WBR": {}, "TRACK" : {}, "SCRIPT" : {}, "embed": {}, "param": {}, "meta": {}, "link": {}, "isindex": {}, "input": {}, "img": {}, "hr": {}, "frame": {}, "col": {}, "br": {}, "basefont": {}, "base": {}, "area": {}, "source" : {}, "td": {}, "th": {}, "iframe": {}, "video": {}, "audio": {}, "object": {}, "wbr" : {}, "track" : {}, "script" : {} }); }); test('getWhiteSpaceElements', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getWhiteSpaceElements(), { "IFRAME": {}, "NOSCRIPT": {}, "OBJECT": {}, "PRE": {}, "SCRIPT": {}, "STYLE": {}, "TEXTAREA": {}, "VIDEO": {}, "AUDIO": {}, "iframe": {}, "noscript": {}, "object": {}, "pre": {}, "script": {}, "style": {}, "textarea": {}, "video": {}, "audio": {} }); }); test('getTextBlockElements', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getTextBlockElements(), { "ADDRESS": {}, "ARTICLE": {}, "ASIDE": {}, "BLOCKQUOTE": {}, "CENTER": {}, "DIR": {}, "DIV": {}, "FIELDSET": {}, "FIGURE": {}, "FOOTER": {}, "FORM": {}, "H1": {}, "H2": {}, "H3": {}, "H4": {}, "H5": {}, "H6": {}, "HEADER": {}, "HGROUP": {}, "NAV": {}, "P": {}, "PRE": {}, "SECTION": {}, "address": {}, "article": {}, "aside": {}, "blockquote": {}, "center": {}, "dir": {}, "div": {}, "fieldset": {}, "figure": {}, "footer": {}, "form": {}, "h1": {}, "h2": {}, "h3": {}, "h4": {}, "h5": {}, "h6": {}, "header": {}, "hgroup": {}, "nav": {}, "p": {}, "pre": {}, "section": {} }); }); test('getTextInlineElements', function() { var schema; expect(1); schema = new tinymce.html.Schema(); deepEqual(schema.getTextInlineElements(), { "B": {}, "CITE": {}, "CODE": {}, "DFN": {}, "EM": {}, "FONT": {}, "I": {}, "MARK": {}, "Q": {}, "SAMP": {}, "SPAN": {}, "STRIKE": {}, "STRONG": {}, "SUB": {}, "SUP": {}, "U": {}, "VAR": {}, "b": {}, "cite": {}, "code": {}, "dfn": {}, "em": {}, "font": {}, "i": {}, "mark": {}, "q": {}, "samp": {}, "span": {}, "strike": {}, "strong": {}, "sub": {}, "sup": {}, "u": {}, "var": {} }); }); test('isValidChild', function() { var schema; expect(4); schema = new tinymce.html.Schema(); ok(schema.isValidChild('body', 'p')); ok(schema.isValidChild('p', 'img')); ok(!schema.isValidChild('body', 'body')); ok(!schema.isValidChild('p', 'body')); }); test('getElementRule', function() { var schema; expect(3); schema = new tinymce.html.Schema(); ok(schema.getElementRule('b')); ok(!schema.getElementRule('bx')); ok(!schema.getElementRule(null)); }); test('addCustomElements', function() { var schema; expect(5); schema = new tinymce.html.Schema({valid_elements:'inline,block'}); schema.addCustomElements('~inline,block'); ok(schema.getElementRule('inline')); ok(schema.getElementRule('block')); ok(schema.isValidChild('body', 'block')); ok(schema.isValidChild('block', 'inline')); ok(schema.isValidChild('p', 'inline')); }); test('addValidChildren', function() { var schema; expect(7); schema = new tinymce.html.Schema(); ok(schema.isValidChild('body', 'p')); ok(!schema.isValidChild('body', 'body')); ok(!schema.isValidChild('body', 'html')); schema.addValidChildren('+body[body|html]'); ok(schema.isValidChild('body', 'body')); ok(schema.isValidChild('body', 'html')); schema = new tinymce.html.Schema(); ok(schema.isValidChild('body', 'p')); schema.addValidChildren('-body[p]'); ok(!schema.isValidChild('body', 'p')); }); test('addCustomElements/getCustomElements', function() { var schema; expect(4); schema = new tinymce.html.Schema(); schema.addCustomElements('~inline,block'); ok(schema.getBlockElements().block); ok(!schema.getBlockElements().inline); ok(schema.getCustomElements().inline); ok(schema.getCustomElements().block); }); test('whitespaceElements', function() { var schema; expect(3); schema = new tinymce.html.Schema({whitespace_elements : 'pre,p'}); ok(schema.getWhiteSpaceElements().pre); ok(!schema.getWhiteSpaceElements().span); schema = new tinymce.html.Schema({whitespace_elements : 'code'}); ok(schema.getWhiteSpaceElements().code); }); test('selfClosingElements', function() { var schema; expect(3); schema = new tinymce.html.Schema({self_closing_elements : 'pre,p'}); ok(schema.getSelfClosingElements().pre); ok(schema.getSelfClosingElements().p); ok(!schema.getSelfClosingElements().li); }); test('shortEndedElements', function() { var schema; expect(3); schema = new tinymce.html.Schema({short_ended_elements : 'pre,p'}); ok(schema.getShortEndedElements().pre); ok(schema.getShortEndedElements().p); ok(!schema.getShortEndedElements().img); }); test('booleanAttributes', function() { var schema; expect(3); schema = new tinymce.html.Schema({boolean_attributes : 'href,alt'}); ok(schema.getBoolAttrs().href); ok(schema.getBoolAttrs().alt); ok(!schema.getBoolAttrs().checked); }); test('nonEmptyElements', function() { var schema; expect(3); schema = new tinymce.html.Schema({non_empty_elements : 'pre,p'}); ok(schema.getNonEmptyElements().pre); ok(schema.getNonEmptyElements().p); ok(!schema.getNonEmptyElements().img); }); test('blockElements', function() { var schema; expect(3); schema = new tinymce.html.Schema({block_elements : 'pre,p'}); ok(schema.getBlockElements().pre); ok(schema.getBlockElements().p); ok(!schema.getBlockElements().h1); }); test('isValid', function() { var schema; schema = new tinymce.html.Schema({valid_elements : 'a[href],i[*]'}); ok(schema.isValid('a')); ok(schema.isValid('a', 'href')); ok(!schema.isValid('b')); ok(!schema.isValid('b', 'href')); ok(!schema.isValid('a', 'id')); ok(schema.isValid('i')); ok(schema.isValid('i', 'id')); }); test('validStyles', function() { var schema; schema = new tinymce.html.Schema({valid_styles: 'color,font-size'}); deepEqual(schema.getValidStyles(), { "*": [ "color", "font-size" ] }); schema = new tinymce.html.Schema({valid_styles: 'color font-size'}); deepEqual(schema.getValidStyles(), { "*": [ "color", "font-size" ] }); schema = new tinymce.html.Schema({ valid_styles: { '*': 'color font-size', 'a': 'background font-family' } }); deepEqual(schema.getValidStyles(), { "*": [ "color", "font-size" ], "a": [ "background", "font-family" ], "A": [ "background", "font-family" ] }); }); test('invalidStyles', function() { var schema; schema = new tinymce.html.Schema({invalid_styles: 'color,font-size'}); deepEqual(schema.getInvalidStyles(), { '*': { 'color': {}, 'font-size': {} } }); schema = new tinymce.html.Schema({invalid_styles: 'color font-size'}); deepEqual(schema.getInvalidStyles(), { '*': { 'color': {}, 'font-size': {} } }); schema = new tinymce.html.Schema({ invalid_styles: { '*': 'color font-size', 'a': 'background font-family' } }); deepEqual(schema.getInvalidStyles(), { '*': { 'color': {}, 'font-size': {} }, 'a': { 'background': {}, 'font-family': {} }, 'A': { 'background': {}, 'font-family': {} } }); }); test('validClasses', function() { var schema; schema = new tinymce.html.Schema({valid_classes: 'classA,classB'}); deepEqual(schema.getValidClasses(), { '*': { 'classA': {}, 'classB': {} } }); schema = new tinymce.html.Schema({valid_classes: 'classA classB'}); deepEqual(schema.getValidClasses(), { '*': { 'classA': {}, 'classB': {} } }); schema = new tinymce.html.Schema({ valid_classes: { '*': 'classA classB', 'a': 'classC classD' } }); deepEqual(schema.getValidClasses(), { '*': { 'classA': {}, 'classB': {} }, 'a': { 'classC': {}, 'classD': {} }, 'A': { 'classC': {}, 'classD': {} } }); });
const root = __dirname const Http = require("http") const Path = require("path") const Express = require("express") const Es6Renderer = require('express-es6-template-engine') const Fs = require("fs") const app = Express() let server = null process.on("uncaughtException", err => { console.log("uncaughtException: ", err.stack) process.exit(1) }); process.on("exit", function() { server.close() }) process.on("SIGTERM", () => { server.close() }) const getContextFor = async(req) => { return new Promise((resolve, reject) => { resolve({}) }) } app.set("view engine", "html") app.engine("html", Es6Renderer) app.use("/public", Express.static(Path.resolve(root, "views/default"))) app.use((req, res, next) => { let ext = Path.extname(req._parsedUrl.pathname || ".html") if (ext.length === 0) { ext = ".html" } req.viewExtension = ext next() }) app.get(["/", "/ratings", "/todos"], async(req, res) => { let folder = req.url.replace(/^\//, "") if (folder.length === 0) folder = "home" let context = await getContextFor(req) Es6Renderer(Path.resolve(`${root}/views/default/${folder}/index${req.viewExtension}`), context, (err, content) => { if(err) return err context.view = content res.render(`default/layouts/default${req.viewExtension}`, {locals: context}) }) }) module.exports = { start(port) { server = Http.createServer(app) server.listen(port, () => { console.log(`http://localhost:${server.address().port}`) }) return server }, stop() { if (server) server.close() } }
import { VectorMap } from "@react-jvectormap/core"; import { thMill, thMerc } from "@react-jvectormap/thailand"; import { MapTemplate } from "../components/MapContainer/MapTemplate"; export default { title: "maps/Map/Thailand", component: VectorMap, argTypes: {}, }; export const Miller = MapTemplate.bind({}); Miller.args = { map: thMill, fileName: "thMill", country: "thailand", }; export const Mercator = MapTemplate.bind({}); Mercator.args = { map: thMerc, fileName: "thMerc", country: "thailand", };
Meteor.publish('tableVisibilityModeSettings', function() { return TableVisibilityModeSettings.find(); });
function musicTypeFromFile(file){ var extention=file.substr(file.indexOf('.')+1); if(extention=='ogg'){ return 'oga' } //TODO check for more specific cases return extention; } function playAudio(filename){ loadPlayer(musicTypeFromFile(filename),function(){ PlayList.add($('#dir').val()+'/'+filename); PlayList.play(PlayList.items.length-1); }); } function addAudio(filename){ loadPlayer(musicTypeFromFile(filename),function(){ PlayList.add($('#dir').val()+'/'+filename); }); } function loadPlayer(type,ready){ if(!loadPlayer.done){ loadPlayer.done=true; OC.addStyle('media','player'); OC.addScript('media','jquery.jplayer.min',function(){ OC.addScript('media','player',function(){ var navItem=$('#apps a[href="'+OC.linkTo('media','index.php')+'"]'); navItem.height(navItem.height()); navItem.load(OC.filePath('media','templates','player.php'),function(){ PlayList.init(type,ready); }); }); }); }else{ ready(); } } $(document).ready(function() { loadPlayer.done=false // FileActions.register('audio','Add to playlist','',addAudio); // FileActions.register('application/ogg','Add to playlist','',addAudio); if(typeof FileActions!=='undefined'){ FileActions.register('audio','Play','',playAudio); FileActions.register('application/ogg','','Play',playAudio); FileActions.setDefault('audio','Play'); FileActions.setDefault('application/ogg','Play'); } var oc_current_user=OC.currentUser; if(typeof PlayList==='undefined'){ if(typeof localStorage !== 'undefined' && localStorage){ if(localStorage.getItem(oc_current_user+'oc_playlist_items') && localStorage.getItem(oc_current_user+'oc_playlist_items')!='[]' && localStorage.getItem(oc_current_user+'oc_playlist_active')!='true'){ loadPlayer(); } } } });
'use strict'; /** * Module dependencies */ var path = require('path'), mongoose = require('mongoose'), Investigation = mongoose.model('Investigation'), errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')); /** * Create an investigation */ exports.create = function (req, res) { var investigation = new Investigation(req.body); investigation.user = req.user; investigation.save(function (err) { if (err) { return res.status(422).send({ message: errorHandler.getErrorMessage(err) }); } else { res.json(investigation); } }); }; /** * Show the current investigation */ exports.read = function (req, res) { // convert mongoose document to JSON var investigation = req.investigation ? req.investigation.toJSON() : {}; // Add a custom field to the investigation, for determining if the current User is the "owner". // NOTE: This field is NOT persisted to the database, since it doesn't exist in the investigation model. investigation.isCurrentUserOwner = !!(req.user && investigation.user && investigation.user._id.toString() === req.user._id.toString()); res.json(investigation); }; /** * Update an investigation */ exports.update = function (req, res) { var investigation = req.investigation; investigation.title = req.body.title; investigation.station = req.body.station; investigation.case = req.body.case; investigation.amount = req.body.amount; investigation.vehicleInfo = req.body.vehicleInfo; investigation.date = req.body.date; investigation.save(function (err) { if (err) { return res.status(422).send({ message: errorHandler.getErrorMessage(err) }); } else { res.json(investigation); } }); }; /** * Delete an investigation */ exports.delete = function (req, res) { var investigation = req.investigation; investigation.remove(function (err) { if (err) { return res.status(422).send({ message: errorHandler.getErrorMessage(err) }); } else { res.json(investigation); } }); }; /** * List of Investigations */ exports.list = function (req, res) { Investigation.find().sort('-created').populate('user', 'displayName').exec(function (err, investigations) { if (err) { return res.status(422).send({ message: errorHandler.getErrorMessage(err) }); } else { res.json(investigations); } }); }; /** * List of Investigations */ exports.top = function (req, res) { Investigation.find().sort('-created').limit(3).populate('user', 'displayName').exec(function (err, investigations) { if (err) { return res.status(422).send({ message: errorHandler.getErrorMessage(err) }); } else { res.json(investigations); } }); }; /** * Investigation middleware */ exports.investigationByID = function (req, res, next, id) { if (!mongoose.Types.ObjectId.isValid(id)) { return res.status(400).send({ message: 'Investigation is invalid' }); } Investigation.findById(id).populate('user', 'displayName').exec(function (err, investigation) { if (err) { return next(err); } else if (!investigation) { return res.status(404).send({ message: 'No investigation with that identifier has been found' }); } req.investigation = investigation; next(); }); };
module.exports = [ { id: '01', name: 'user 1', email: 'name1@my.com' }, { id: '02', name: 'user 2', email: 'name2@my.com' }, { id: '03', name: 'user 3', email: 'name3@my.com' }, ]
export default { name: 'foreignObject', buttons: [ { title: 'Foreign Object Tool' }, { title: 'Edit ForeignObject Content' } ], contextTools: [ { title: "Change foreignObject's width", label: 'w' }, { title: "Change foreignObject's height", label: 'h' }, { title: "Change foreignObject's font size", label: 'font-size' } ] };
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function (mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror"], mod); else // Plain browser env mod(CodeMirror); })(function (CodeMirror) { "use strict"; CodeMirror.defineMode("pascal", function () { function words(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } var keywords = words("and array begin case const div do downto else end file for forward integer " + "boolean char function goto if in label mod nil not of or packed procedure " + "program record repeat set string then to type until var while with"); var atoms = {"null": true}; var isOperatorChar = /[+\-*&%=<>!?|\/]/; function tokenBase(stream, state) { var ch = stream.next(); if (ch == "#" && state.startOfLine) { stream.skipToEnd(); return "meta"; } if (ch == '"' || ch == "'") { state.tokenize = tokenString(ch); return state.tokenize(stream, state); } if (ch == "(" && stream.eat("*")) { state.tokenize = tokenComment; return tokenComment(stream, state); } if (/[\[\]{}\(\),;\:\.]/.test(ch)) { return null; } if (/\d/.test(ch)) { stream.eatWhile(/[\w\.]/); return "number"; } if (ch == "/") { if (stream.eat("/")) { stream.skipToEnd(); return "comment"; } } if (isOperatorChar.test(ch)) { stream.eatWhile(isOperatorChar); return "operator"; } stream.eatWhile(/[\w\$_]/); var cur = stream.current(); if (keywords.propertyIsEnumerable(cur)) return "keyword"; if (atoms.propertyIsEnumerable(cur)) return "atom"; return "variable"; } function tokenString(quote) { return function (stream, state) { var escaped = false, next, end = false; while ((next = stream.next()) != null) { if (next == quote && !escaped) { end = true; break; } escaped = !escaped && next == "\\"; } if (end || !escaped) state.tokenize = null; return "string"; }; } function tokenComment(stream, state) { var maybeEnd = false, ch; while (ch = stream.next()) { if (ch == ")" && maybeEnd) { state.tokenize = null; break; } maybeEnd = (ch == "*"); } return "comment"; } // Interface return { startState: function () { return {tokenize: null}; }, token: function (stream, state) { if (stream.eatSpace()) return null; var style = (state.tokenize || tokenBase)(stream, state); if (style == "comment" || style == "meta") return style; return style; }, electricChars: "{}" }; }); CodeMirror.defineMIME("text/x-pascal", "pascal"); });
var loadJson = require('load-json-xhr'); var Branch = require('./Branch'); function JsonExplorer(params) { params = params || {}; var _this = this; loadJson(params.jsonPath, function(err, data) { Branch.call(_this, 'ROOT', data ? data : {}); document.body.appendChild(_this.domElement); if(err) { var listItemLabel = document.createTextNode(err.message); var listItem = document.createElement('li'); listItem.appendChild(listItemLabel); _this.domElement.appendChild(listItem); return; } _this.expand(); _this.autoExpandPath(); }); } JsonExplorer.prototype = Object.create(Branch.prototype); JsonExplorer.prototype.autoExpandPath = function() { var path = window.location.hash; if(!path) return; path = path.replace('#/', ''); this.expandPath(path); } module.exports = JsonExplorer;
/** * Chrome Javascript API stub * * @author <a href="mailto:linux_china@hotmail.com">Jacky Chan</a> */ /** * Chrome API's base object * @type {Object} */ var chrome = { "alarms":{ /** * Clears the alarm with the given name * @param {String} name The name of the alarm to clear */ "clear":function (name) { }, "demo":"" }, /** * the chrome.bookmarks module to create, organize, and otherwise manipulate bookmarks */ "bookmarks":{ }, /** * browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar */ "browserAction":{ }, /** * the chrome.browsingData module to remove browsing data from a user's local profile */ "browsingData":{ }, /** * The content settings module allows you to change settings that control whether websites can use features such as cookies, JavaScript, and plug-ins */ "contentSettings":{ }, /** * The context menus module allows you to add items to Google Chrome's context menu. */ "contextMenus":{ }, /** * The cookies module allows you to operate cookie */ "cookies":{ }, /** * The chrome.extension module has utilities that can be used by any extension page */ "extension":{ /** * get background page */ "getBackgroundPage":function () { } } }; /** * webkit notifications * @type {Object} */ var webkitNotifications = { /** * Causes the notification to displayed to the user */ "show":function () { }, /** * Causes the notification to not be displayed */ "cancel":function () { }, /** * Creates a new notification object with the provided content * @param {String} iconUrl icon url * @param {String} title title * @param {String} body body */ "createNotification":function (iconUrl, title, body) { }, /** * The parameter url contains the URL of a resource which contains HTML content to be shown as the content of the notification * @param {String} url page url */ "createHTMLNotification":function (url) { } }
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { fetchQuestions, choseAnswer, submitForSolutions } from '../actions'; import Footer from '../components/Footer'; import Header from '../components/Header'; import Questions from '../components/Questions'; import styles from '../styles/app.css'; class App extends Component { constructor(props) { super(props); } componentDidMount() { const { dispatch } = this.props; dispatch(fetchQuestions()); } render() { const { dispatch, questions, isFetching, answers, isSubmitForSolutions} = this.props; const isDisabled = (questions.length && Object.keys(answers).length) && (questions.length === Object.keys(answers).length); return ( <div className={styles.container}> <Header /> {isFetching && questions.length === 0 && <h2>Loading...</h2> } <Questions isSubmitForSolutions={isSubmitForSolutions} questions={questions} answers={answers} onChoseOption={(questionId, answerId) => dispatch(choseAnswer(questionId, answerId))} /> <Footer submitForSolutions={(flag) => dispatch(submitForSolutions(flag))} isDisabled={!isDisabled} /> </div> ); } } function mapStateToProps(state) { const { items, answers, solutions } = state; const { questions, isFetching } = items; const { isSubmitForSolutions } = solutions; return { questions, isFetching, answers, isSubmitForSolutions }; } export default connect(mapStateToProps)(App);
var Helpers = require("../Helpers"); exports.code = 0x01; exports.buildRequest = Helpers.buildAddressQuantity; exports.parseRequest = Helpers.parseAddressQuantity; exports.buildResponse = Helpers.bitsToBuffer; exports.parseResponse = Helpers.bufferToBits;