code
stringlengths
2
1.05M
/* * Favorites * Favorites landing page */ import React, { Component } from 'react' import NavBar from '../NavBar.react' export default class Favorites extends Component { render() { return ( <div> <div className="p2 overflow-scroll mt4 mb4"> <div className="center mb3"> <button className="btn bg-purple-3 white regular py1 px3">Import from Spotify</button> </div> <div className="h6 caps white">Your favorites</div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Let's Dance</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Lazarus</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Let's Dance</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Lazarus</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Let's Dance</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Lazarus</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Let's Dance</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> <div className="border-bottom border-muted py2 mrn2 relative"> <div className="white h4 mb1">Lazarus</div> <div className="white muted h6 semibold">David Bowie</div> <span className="white absolute right-0 h2 mr3" style={{top: '23px'}}> <span className="inline-block h6 bg-teal rounded mr2 relative" style={{padding: '3px 12px', top: '-3px'}}>5 events</span> › </span> </div> </div> <NavBar activeTab="favorites"/> </div> ) } }
function generateList(people, template){ var i, result = '', len = people.length; result += '<ul>'; for(i = 0; i < len; i += 1){ result += '<li>'; result += template; result = result.replace('-{name}-', people[i]['name']); result = result.replace('-{age}-', people[i]['age']); result += '</li>'; } result += '</ul>'; return result; } var people = [ { name: 'Pehso', age: 20}, { name: 'Gosho', age: 30}, { name: 'Stamat', age: 25} ]; var template = document.getElementById('list-item').innerHTML; document.getElementById('list-item').innerHTML = generateList(people, template);
const admin = require('firebase-admin'); const DATABASE_URL = process.env.DATABASE_URL || 'https://dailyjack-8a930.firebaseio.com'; // const DATABASE_URL = 'https://dailyjack-d2fa0.firebaseio.com'; const jackDB = (config = {}) => { const app = admin.initializeApp({ credential: admin.credential.cert({ projectId: config.projectId, clientEmail: config.clientEmail, privateKey: config.privateKey, }), databaseURL: DATABASE_URL, }); const db = admin.database(); const jacksRef = db.ref('jacks'); const totalJacksRef = db.ref('totalJacks'); const usersRef = db.ref('users'); const insert = jack => ( jacksRef .child(jack.id) .set({ id: jack.id, title: jack.title, contents: jack.contents || [], author: jack.author || null, createdTime: Date.now(), isLimited: Boolean(jack.isLimited), isSpecial: Boolean(jack.isSpecial), }) .then(() => ( totalJacksRef.transaction(total => (total || 0) + 1) )) ); const filter = (jacks = [], filterOptions = {}) => jacks.filter( jack => (!filterOptions.shouldExcludeLimited || !jack.isLimited) && (!filterOptions.shouldExcludeSpecial || !jack.isSpecial) ); const all = (filterOptions = {}) => ( jacksRef.once('value') .then(snapshot => snapshot.val()) .then(jacks => (jacks || []).filter(Boolean)) .then(jacks => filter(jacks, filterOptions)) ); const get = id => ( jacksRef.child(id) .once('value') .then(snapshot => snapshot.val()) ); const random = (filterOptions = {}) => ( all(filterOptions) .then(jacks => jacks[Math.floor(Math.random() * jacks.length)]) ); const upvote = (id, user) => ( jacksRef.child(id) .child('ratedUsers') .child(user) .set(true) ); const downvote = (id, user) => ( jacksRef.child(id) .child('ratedUsers') .remove(user) ); const togglevote = (id, user) => ( jacksRef.child(id) .child('ratedUsers') .child(user) .transaction(rate => (rate ? null : true)) ); const getRate = id => ( jacksRef.child(id) .child('ratedUsers') .once('value') .then(snapshot => snapshot.val()) .then(rate => Object.keys(rate || {}) .filter(Boolean) .length ) ); const setUser = user => ( usersRef.child(user.name) .set(user) ); const updateUser = user => ( usersRef.child(user.name) .update(user) ); const getUser = userName => ( usersRef.child(userName) .once('value') .then(snapshot => snapshot.val()) ); const exit = () => { db.goOffline(); app.delete(); }; return { all, get, random, insert, exit, upvote, downvote, togglevote, getRate, setUser, updateUser, getUser, }; }; module.exports = { default: jackDB, };
//TODO : socket.ioコネクション処理を1.0推奨の非同期方式にする describe('serverクラスのテスト', function() { var SERVER_PORT = process.env.PORT || 3000; var SERVER_URL = 'http://localhost:'+SERVER_PORT; var assert = require('chai').assert; var io = require('socket.io-client'); var server = require('../../../server/server.js'); var http = require('http'); var dbMock = require('./../testData/dbMock.js')(); var app; var testServer; var option = { 'forceNew' : true }; beforeEach(function() { app = http.createServer().listen(SERVER_PORT); testServer = server({ httpServer : app, dao : dbMock }); }); afterEach(function() { app.close(); }); describe('退室系テスト',function(){ it('入室後に退室する',function(done){ var client = io(SERVER_URL, option); client.on('connect',doAuth); function doAuth() { client.emit('auth',{ userId : '[email protected]' }); client.once('successAuth',enterRoom); } function enterRoom() { client.emit('enterRoom',{ roomId : 0 }); client.on('succesEnterRoom',leaveRoom); } function leaveRoom() { client.emit('leaveRoom'); client.on('successLeaveRoom',done); } }); }); });
// eslint-disable-next-line import/prefer-default-export export const serializePlaylist = model => ({ _id: model.id, name: model.name, author: model.author, createdAt: model.createdAt, description: model.description, shared: model.shared, nsfw: model.nsfw, size: model.media.length, });
class NotFoundError extends Error { constructor(message) { super(); if (Error.hasOwnProperty('captureStackTrace')) { Error.captureStackTrace(this, this.constructor); } else { Object.defineProperty(this, 'stack', { value : (new Error()).stack }); } Object.defineProperty(this, 'message', { value : message }); } get name() { return this.constructor.name; } } export default { NotFoundError }
"use strict"; /* global describe it before */ const { assert } = require("chai"); const Database = require("./lib/database"); const testcases = (env) => { describe("Basic operations", () => { before(async () => { await Database.start(); }); it("should list zero objects", async () => { const list = await env.client.list("thing"); assert.isArray(list); assert.equal(list.length, 0); }); it("should create one object", async () => { const thing = await env.client.create("thing", { _id: "1", thingy: "Hello" }); assert.equal(thing.type, "scom.thing"); assert.equal(thing.thingy, "Hello"); }); it("should list one object", async () => { const list = await env.client.list("thing"); assert.isArray(list); assert.equal(list.length, 1); }); it("should update one object", async () => { const thing = await env.client.update("thing", "1", { thingy: "World" }); assert.equal(thing.type, "scom.thing"); assert.equal(thing.thingy, "World"); }); it("should delete one object", async () => { const thing = await env.client.remove("thing", "1"); assert.equal(thing.type, "scom.thing"); assert.equal(thing.thingy, "World"); }); it("should list zero objects", async () => { const list = await env.client.list("thing"); assert.isArray(list); assert.equal(list.length, 0); }); }); describe("Action operations", () => { before(async () => { await Database.start(); }); it("should create an object and tag it", async () => { await env.client.create("thing", { _id: "1", thingy: "Hello" }); const thing2 = await env.client.tag("thing", "1", { tag: [ "tag1", "tag2" ] }); assert.equal(thing2.type, "scom.thing"); assert.equal(thing2.thingy, "Hello"); assert.deepEqual(thing2.tags, [ "tag1", "tag2" ]); }); it("should get error with invalid action", async () => { try { await env.client.stuff("thing", "1", { 1: 0 }); assert(false, "Should have thrown"); } catch (error) { assert.equal(error.status, 400); } }); }); describe("Getter operations", () => { before(async () => { await Database.start(); }); it("should create an object and get something on it", async () => { await env.client.create("thing", { _id: "1", thingy: "Hello" }); const value = await env.client.thingy("thing", "1"); assert.equal(value, "Hello"); }); it("should get error with invalid getter", async () => { try { await env.client.stuff("thing", "1"); assert(false, "Should have thrown"); } catch (error) { assert.equal(error.status, 400); } }); }); }; module.exports = testcases;
var fs = require('fs') var parseTorrent = require('parse-torrent') var test = require('tape') var WebTorrent = require('../') var DHT = require('bittorrent-dht/client') var parallel = require('run-parallel') var bufferEqual = require('buffer-equal') var leaves = fs.readFileSync(__dirname + '/torrents/leaves.torrent') var leavesTorrent = parseTorrent(leaves) var leavesBook = fs.readFileSync(__dirname + '/content/Leaves of Grass by Walt Whitman.epub') var leavesMagnetURI = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=http%3A%2F%2Ftracker.thepiratebay.org%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ffr33domtracker.h33t.com%3A3310%2Fannounce&tr=http%3A%2F%2Ftracker.bittorrent.am%2Fannounce' test('client.add (magnet uri, torrent file, info hash, and parsed torrent)', function (t) { // magnet uri (utf8 string) var client1 = new WebTorrent({ dht: false, tracker: false }) var torrent1 = client1.add('magnet:?xt=urn:btih:' + leavesTorrent.infoHash) t.equal(torrent1.infoHash, leavesTorrent.infoHash) t.equal(torrent1.magnetURI, 'magnet:?xt=urn:btih:' + leavesTorrent.infoHash) client1.destroy() // torrent file (buffer) var client2 = new WebTorrent({ dht: false, tracker: false }) var torrent2 = client2.add(leaves) t.equal(torrent2.infoHash, leavesTorrent.infoHash) t.equal(torrent2.magnetURI, leavesMagnetURI) client2.destroy() // info hash (hex string) var client3 = new WebTorrent({ dht: false, tracker: false }) var torrent3 = client3.add(leavesTorrent.infoHash) t.equal(torrent3.infoHash, leavesTorrent.infoHash) t.equal(torrent3.magnetURI, 'magnet:?xt=urn:btih:' + leavesTorrent.infoHash) client3.destroy() // info hash (buffer) var client4 = new WebTorrent({ dht: false, tracker: false }) var torrent4 = client4.add(new Buffer(leavesTorrent.infoHash, 'hex')) t.equal(torrent4.infoHash, leavesTorrent.infoHash) t.equal(torrent4.magnetURI, 'magnet:?xt=urn:btih:' + leavesTorrent.infoHash) client4.destroy() // parsed torrent (from parse-torrent) var client5 = new WebTorrent({ dht: false, tracker: false }) var torrent5 = client5.add(leavesTorrent) t.equal(torrent5.infoHash, leavesTorrent.infoHash) t.equal(torrent5.magnetURI, leavesMagnetURI) client5.destroy() t.end() }) test('client.seed (Buffer, Blob)', function (t) { t.plan(typeof Blob !== 'undefined' ? 4 : 2) var opts = { name: 'Leaves of Grass by Walt Whitman.epub', announce: [ 'http://tracker.thepiratebay.org/announce', 'udp://tracker.openbittorrent.com:80', 'udp://tracker.ccc.de:80', 'udp://tracker.publicbt.com:80', 'udp://fr33domtracker.h33t.com:3310/announce', 'http://tracker.bittorrent.am/announce' ] } // torrent file (Buffer) var client1 = new WebTorrent({ dht: false, tracker: false }) client1.seed(leavesBook, opts, function (torrent1) { t.equal(torrent1.infoHash, leavesTorrent.infoHash) t.equal(torrent1.magnetURI, leavesMagnetURI) client1.destroy() }) // Blob if (typeof Blob !== 'undefined') { var client2 = new WebTorrent({ dht: false, tracker: false }) client2.seed(new Blob([ leavesBook ]), opts, function (torrent2) { t.equal(torrent2.infoHash, leavesTorrent.infoHash) t.equal(torrent2.magnetURI, leavesMagnetURI) client2.destroy() }) } else { console.log('Skipping Blob test because missing `Blob` constructor') } }) test('after client.destroy(), throw on client.add() or client.seed()', function (t) { t.plan(3) var client = new WebTorrent({ dht: false, tracker: false }) client.destroy(function () { t.pass('client destroyed') }) t.throws(function () { client.add('magnet:?xt=urn:btih:' + leavesTorrent.infoHash) }) t.throws(function () { client.seed(new Buffer('sup')) }) }) test('after client.destroy(), no "torrent" or "ready" events emitted', function (t) { t.plan(1) var client = new WebTorrent({ dht: false, tracker: false }) client.add(leaves, function () { t.fail('unexpected "torrent" event (from add)') }) client.seed(leavesBook, function () { t.fail('unexpected "torrent" event (from seed)') }) client.on('ready', function () { t.fail('unexpected "ready" event') }) client.destroy(function () { t.pass('client destroyed') }) }) test('download via DHT', function (t) { t.plan(2) var data = new Buffer('blah blah') var dhts = [] // need 3 because nodes don't advertise themselves as peers for (var i = 0; i < 3; i++) { dhts.push(new DHT({ bootstrap: false })) } parallel(dhts.map(function (dht) { return function (cb) { dht.listen(function (port) { cb(null, port) }) } }), function () { for (var i = 0; i < dhts.length; i++) { for (var j = 0; j < dhts.length; j++) { if (i !== j) dhts[i].addNode('127.0.0.1:' + getDHTPort(dhts[j]), dhts[j].nodeId) } } var client1 = new WebTorrent({ dht: dhts[0], tracker: false }) var client2 = new WebTorrent({ dht: dhts[1], tracker: false }) client1.seed(data, { name: 'blah' }, function (torrent1) { client2.download(torrent1.infoHash, function (torrent2) { t.equal(torrent2.infoHash, torrent1.infoHash) torrent2.on('done', function () { t.ok(bufferEqual(getFileData(torrent2), data)) dhts.forEach(function (d) { d.destroy() }) client1.destroy() client2.destroy() }) }) }) }) }) test('don\'t kill passed in DHT on destroy', function (t) { t.plan(1) var dht = new DHT({ bootstrap: false }) var destroy = dht.destroy var okToDie dht.destroy = function () { t.equal(okToDie, true) dht.destroy = destroy.bind(dht) dht.destroy() } var client = new WebTorrent({ dht: dht, tracker: false }) client.destroy(function () { okToDie = true dht.destroy() }) }) function getFileData (torrent) { var pieces = torrent.files[0].pieces return Buffer.concat(pieces.map( function (piece) { return piece.buffer } )) } function getDHTPort (dht) { return dht.address().port }
export const state = () => ({ visits:[] }) export const mutations = { ADD_VISIT (state,path) { state.visits.push({ path, date:new Date().toJSON() }) } }
Menubar.Add = function ( editor ) { var meshCount = 0; var lightCount = 0; // event handlers function onObject3DOptionClick () { var mesh = new THREE.Object3D(); mesh.name = 'Object3D ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Plane function onPlaneOptionClick () { var width = 200; var height = 200; var widthSegments = 1; var heightSegments = 1; var geometry = new THREE.PlaneGeometry( width, height, widthSegments, heightSegments ); var material = new THREE.MeshPhongMaterial(); var mesh = new THREE.Mesh( geometry, material ); mesh.name = 'Plane ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); }; //Triangle function onTriangleOptionClick (){ var geometry = new THREE.Geometry(); var v1 = new THREE.Vector3(-100,0,0); var v2 = new THREE.Vector3(100,0,0); var v3 = new THREE.Vector3(0,100,0); geometry.vertices.push(v1); geometry.vertices.push(v2); geometry.vertices.push(v3); geometry.faces.push(new THREE.Face3(0,2,1)); var material = new THREE.MeshBasicMaterial({color:0xff0000}); var mesh = new THREE.Mesh(geometry, material); mesh.name = 'Triangle ' + (++ meshCount); editor.addObject( mesh ); editor.select(mesh); }; //Box function onBoxOptionClick () { var width = 100; var height = 100; var depth = 100; var widthSegments = 1; var heightSegments = 1; var depthSegments = 1; var geometry = new THREE.BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Box ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Circle function onCircleOptionClick () { var radius = 20; var segments = 32; var geometry = new THREE.CircleGeometry( radius, segments ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Circle ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Cylinder function onCylinderOptionClick () { var radiusTop = 20; var radiusBottom = 20; var height = 100; var radiusSegments = 32; var heightSegments = 1; var openEnded = false; var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Cylinder ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Sphere function onSphereOptionClick () { var radius = 75; var widthSegments = 32; var heightSegments = 16; var geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Sphere ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Icosahedron function onIcosahedronOptionClick () { var radius = 75; var detail = 2; var geometry = new THREE.IcosahedronGeometry ( radius, detail ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Icosahedron ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Torus function onTorusOptionClick () { var radius = 100; var tube = 40; var radialSegments = 8; var tubularSegments = 6; var arc = Math.PI * 2; var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'Torus ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Torus Knot function onTorusKnotOptionClick () { var radius = 100; var tube = 40; var radialSegments = 64; var tubularSegments = 8; var p = 2; var q = 3; var heightScale = 1; var geometry = new THREE.TorusKnotGeometry( radius, tube, radialSegments, tubularSegments, p, q, heightScale ); var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); mesh.name = 'TorusKnot ' + ( ++ meshCount ); editor.addObject( mesh ); editor.select( mesh ); } //Sprite function onSpriteOptionClick () { var sprite = new THREE.Sprite( new THREE.SpriteMaterial() ); sprite.name = 'Sprite ' + ( ++ meshCount ); editor.addObject( sprite ); editor.select( sprite ); } function onPointLightOptionClick () { var color = 0xffffff; var intensity = 1; var distance = 0; var light = new THREE.PointLight( color, intensity, distance ); light.name = 'PointLight ' + ( ++ lightCount ); editor.addObject( light ); editor.select( light ); } function onSpotLightOptionClick () { var color = 0xffffff; var intensity = 1; var distance = 0; var angle = Math.PI * 0.1; var exponent = 10; var light = new THREE.SpotLight( color, intensity, distance, angle, exponent ); //.distance // light will attenuate linearly from maximum intensity at light position down to zero at distance. // .angle // Maximum extent of the spotlight, in radians, from its direction. Should be no more than Math.PI/2. // Default — Math.PI/3. // .exponent // Rapidity of the falloff of light from its target direction. // Default — 10.0. light.name = 'SpotLight ' + ( ++ lightCount ); light.target.name = 'SpotLight ' + ( lightCount ) + ' Target'; light.position.set( 0, 1, 0 ).multiplyScalar( 200 ); editor.addObject( light ); editor.select( light ); } function onDirectionalLightOptionClick () { var color = 0xffffff; var intensity = 1; var light = new THREE.DirectionalLight( color, intensity ); light.name = 'DirectionalLight ' + ( ++ lightCount ); light.target.name = 'DirectionalLight ' + ( lightCount ) + ' Target'; light.position.set( 1, 1, 1 ).multiplyScalar( 200 ); editor.addObject( light ); editor.select( light ); } function onHemisphereLightOptionClick () { var skyColor = 0x00aaff; var groundColor = 0xffaa00; var intensity = 1; var light = new THREE.HemisphereLight( skyColor, groundColor, intensity ); light.name = 'HemisphereLight ' + ( ++ lightCount ); light.position.set( 1, 1, 1 ).multiplyScalar( 200 ); editor.addObject( light ); editor.select( light ); } function onAmbientLightOptionClick() { var color = 0x222222; var light = new THREE.AmbientLight( color ); light.name = 'AmbientLight ' + ( ++ lightCount ); editor.addObject( light ); editor.select( light ); } // configure menu contents var createOption = UI.MenubarHelper.createOption; var createDivider = UI.MenubarHelper.createDivider; var menuConfig = [ //createOption( 'Object3D', onObject3DOptionClick ), //createDivider(), createOption( 'Plane', onPlaneOptionClick ), createOption('Triangle',onTriangleOptionClick), createOption( 'Box', onBoxOptionClick ), createOption( 'Circle', onCircleOptionClick ), createOption( 'Cylinder', onCylinderOptionClick ), createOption( 'Sphere', onSphereOptionClick ), //createOption( 'Icosahedron', onIcosahedronOptionClick ), //createOption( 'Torus', onTorusOptionClick ), //createOption( 'Torus Knot', onTorusKnotOptionClick ), createDivider(), //createOption( 'Sprite', onSpriteOptionClick ), createDivider(), createOption( 'Point light', onPointLightOptionClick ), createOption( 'Spot light', onSpotLightOptionClick ), createOption( 'Directional light', onDirectionalLightOptionClick ), createOption( 'Hemisphere light', onHemisphereLightOptionClick ), createOption( 'Ambient light', onAmbientLightOptionClick ) ]; var optionsPanel = UI.MenubarHelper.createOptionsPanel( menuConfig ); return UI.MenubarHelper.createMenuContainer( 'Add', optionsPanel ); }
import React, { PropTypes } from 'react'; const ProductList = (props) => { const pl = props.productList; const products = Object.keys(pl); return (<ul> {products.map(key => <li key={key}><a href={`#/product/${key}`} >{pl[key].name}</a></li>)} </ul>); }; ProductList.propTypes = { productList: PropTypes.object.isRequired }; export default ProductList;
//Variables var chrome_points = 0; //Functions function test_chromepoints() { chrome_points = chrome_points + 1; } //HTML Updates window.setInterval(function(){ document.getElementById("chrome_points").innerHTML = chrome_points; }, 1000);
ace.define("ace/snippets/sqlserver", ["require", "exports", "module"], function(require, exports, module) { "use strict"; exports.snippetText = "# ISNULL\n\ snippet isnull\n\ ISNULL(${1:check_expression}, ${2:replacement_value})\n\ # FORMAT\n\ snippet format\n\ FORMAT(${1:value}, ${2:format})\n\ # CAST\n\ snippet cast\n\ CAST(${1:expression} AS ${2:data_type})\n\ # CONVERT\n\ snippet convert\n\ CONVERT(${1:data_type}, ${2:expression})\n\ # DATEPART\n\ snippet datepart\n\ DATEPART(${1:datepart}, ${2:date})\n\ # DATEDIFF\n\ snippet datediff\n\ DATEDIFF(${1:datepart}, ${2:startdate}, ${3:enddate})\n\ # DATEADD\n\ snippet dateadd\n\ DATEADD(${1:datepart}, ${2:number}, ${3:date})\n\ # DATEFROMPARTS \n\ snippet datefromparts\n\ DATEFROMPARTS(${1:year}, ${2:month}, ${3:day})\n\ # OBJECT_DEFINITION\n\ snippet objectdef\n\ SELECT OBJECT_DEFINITION(OBJECT_ID('${1:sys.server_permissions /*object name*/}'))\n\ # STUFF XML\n\ snippet stuffxml\n\ STUFF((SELECT ', ' + ${1:ColumnName}\n\ FROM ${2:TableName}\n\ WHERE ${3:WhereClause}\n\ FOR XML PATH('')), 1, 1, '') AS ${4:Alias}\n\ ${5:/*https://msdn.microsoft.com/en-us/library/ms188043.aspx*/}\n\ # Create Procedure\n\ snippet createproc\n\ -- =============================================\n\ -- Author: ${1:Author}\n\ -- Create date: ${2:Date}\n\ -- Description: ${3:Description}\n\ -- =============================================\n\ CREATE PROCEDURE ${4:Procedure_Name}\n\ ${5:/*Add the parameters for the stored procedure here*/}\n\ AS\n\ BEGIN\n\ -- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.\n\ SET NOCOUNT ON;\n\ \n\ ${6:/*Add the T-SQL statements to compute the return value here*/}\n\ \n\ END\n\ GO\n\ # Create Scalar Function\n\ snippet createfn\n\ -- =============================================\n\ -- Author: ${1:Author}\n\ -- Create date: ${2:Date}\n\ -- Description: ${3:Description}\n\ -- =============================================\n\ CREATE FUNCTION ${4:Scalar_Function_Name}\n\ -- Add the parameters for the function here\n\ RETURNS ${5:Function_Data_Type}\n\ AS\n\ BEGIN\n\ DECLARE @Result ${5:Function_Data_Type}\n\ \n\ ${6:/*Add the T-SQL statements to compute the return value here*/}\n\ \n\ END\n\ GO"; exports.scope = "sqlserver"; }); (function() { ace.require(["ace/snippets/sqlserver"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } }); })();
module.exports = { 'handles belongsTo (blog, site)': { mysql: { result: { id: 2, name: 'bookshelfjs.org' } }, postgresql: { result: { id: 2, name: 'bookshelfjs.org' } }, sqlite3: { result: { id: 2, name: 'bookshelfjs.org' } } }, 'handles hasMany (posts)': { mysql: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }, postgresql: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }, sqlite3: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] } }, 'handles hasOne (meta)': { mysql: { result: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } }, postgresql: { result: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } }, sqlite3: { result: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } }, 'handles belongsToMany (posts)': { mysql: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 1, _pivot_post_id: 1 }] }, postgresql: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 1, _pivot_post_id: 1 }] }, sqlite3: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 1, _pivot_post_id: 1 }] } }, 'eager loads "hasOne" relationships correctly (site -> meta)': { mysql: { result: { id: 1, name: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } }, postgresql: { result: { id: 1, name: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } }, sqlite3: { result: { id: 1, name: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } } }, 'eager loads "hasMany" relationships correctly (site -> authors, blogs)': { mysql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }], blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog' },{ id: 2, site_id: 1, name: 'Alternate Site Blog' }] } }, postgresql: { result: { id: 1, name: 'knexjs.org', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog' },{ id: 2, site_id: 1, name: 'Alternate Site Blog' }], authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } }, sqlite3: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }], blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog' },{ id: 2, site_id: 1, name: 'Alternate Site Blog' }] } } }, 'eager loads "belongsTo" relationships correctly (blog -> site)': { mysql: { result: { id: 3, site_id: 2, name: 'Main Site Blog', site: { id: 2, name: 'bookshelfjs.org' } } }, postgresql: { result: { id: 3, site_id: 2, name: 'Main Site Blog', site: { id: 2, name: 'bookshelfjs.org' } } }, sqlite3: { result: { id: 3, site_id: 2, name: 'Main Site Blog', site: { id: 2, name: 'bookshelfjs.org' } } } }, 'eager loads "belongsToMany" models correctly (post -> tags)': { mysql: { result: { id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', tags: [{ id: 1, name: 'cool', _pivot_post_id: 1, _pivot_tag_id: 1 },{ id: 2, name: 'boring', _pivot_post_id: 1, _pivot_tag_id: 2 },{ id: 3, name: 'exciting', _pivot_post_id: 1, _pivot_tag_id: 3 }] } }, postgresql: { result: { id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', tags: [{ id: 1, name: 'cool', _pivot_post_id: 1, _pivot_tag_id: 1 },{ id: 2, name: 'boring', _pivot_post_id: 1, _pivot_tag_id: 2 },{ id: 3, name: 'exciting', _pivot_post_id: 1, _pivot_tag_id: 3 }] } }, sqlite3: { result: { id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', tags: [{ id: 1, name: 'cool', _pivot_post_id: 1, _pivot_tag_id: 1 },{ id: 2, name: 'boring', _pivot_post_id: 1, _pivot_tag_id: 2 },{ id: 3, name: 'exciting', _pivot_post_id: 1, _pivot_tag_id: 3 }] } } }, 'Attaches an empty related model or collection if the `EagerRelation` comes back blank': { mysql: { result: { id: 3, name: 'backbonejs.org', meta: { }, blogs: [], authors: [] } }, postgresql: { result: { id: 3, name: 'backbonejs.org', meta: { }, authors: [], blogs: [] } }, sqlite3: { result: { id: 3, name: 'backbonejs.org', meta: { }, blogs: [], authors: [] } } }, 'eager loads "hasOne" models correctly (sites -> meta)': { mysql: { result: [{ id: 1, name: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } },{ id: 2, name: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } },{ id: 3, name: 'backbonejs.org', meta: { } }] }, postgresql: { result: [{ id: 1, name: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } },{ id: 2, name: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } },{ id: 3, name: 'backbonejs.org', meta: { } }] }, sqlite3: { result: [{ id: 1, name: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } },{ id: 2, name: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } },{ id: 3, name: 'backbonejs.org', meta: { } }] } }, 'eager loads "belongsTo" models correctly (blogs -> site)': { mysql: { result: [{ id: 1, site_id: 1, name: 'Main Site Blog', site: { id: 1, name: 'knexjs.org' } },{ id: 2, site_id: 1, name: 'Alternate Site Blog', site: { id: 1, name: 'knexjs.org' } },{ id: 3, site_id: 2, name: 'Main Site Blog', site: { id: 2, name: 'bookshelfjs.org' } },{ id: 4, site_id: 2, name: 'Alternate Site Blog', site: { id: 2, name: 'bookshelfjs.org' } }] }, postgresql: { result: [{ id: 1, site_id: 1, name: 'Main Site Blog', site: { id: 1, name: 'knexjs.org' } },{ id: 2, site_id: 1, name: 'Alternate Site Blog', site: { id: 1, name: 'knexjs.org' } },{ id: 3, site_id: 2, name: 'Main Site Blog', site: { id: 2, name: 'bookshelfjs.org' } },{ id: 4, site_id: 2, name: 'Alternate Site Blog', site: { id: 2, name: 'bookshelfjs.org' } }] }, sqlite3: { result: [{ id: 1, site_id: 1, name: 'Main Site Blog', site: { id: 1, name: 'knexjs.org' } },{ id: 2, site_id: 1, name: 'Alternate Site Blog', site: { id: 1, name: 'knexjs.org' } },{ id: 3, site_id: 2, name: 'Main Site Blog', site: { id: 2, name: 'bookshelfjs.org' } },{ id: 4, site_id: 2, name: 'Alternate Site Blog', site: { id: 2, name: 'bookshelfjs.org' } }] } }, 'eager loads "hasMany" models correctly (site -> blogs)': { mysql: { result: { id: 1, name: 'knexjs.org', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog' },{ id: 2, site_id: 1, name: 'Alternate Site Blog' }] } }, postgresql: { result: { id: 1, name: 'knexjs.org', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog' },{ id: 2, site_id: 1, name: 'Alternate Site Blog' }] } }, sqlite3: { result: { id: 1, name: 'knexjs.org', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog' },{ id: 2, site_id: 1, name: 'Alternate Site Blog' }] } } }, 'eager loads "belongsToMany" models correctly (posts -> tags)': { mysql: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', tags: [{ id: 1, name: 'cool', _pivot_post_id: 1, _pivot_tag_id: 1 },{ id: 2, name: 'boring', _pivot_post_id: 1, _pivot_tag_id: 2 },{ id: 3, name: 'exciting', _pivot_post_id: 1, _pivot_tag_id: 3 }] },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.', tags: [] }] }, postgresql: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', tags: [{ id: 1, name: 'cool', _pivot_post_id: 1, _pivot_tag_id: 1 },{ id: 2, name: 'boring', _pivot_post_id: 1, _pivot_tag_id: 2 },{ id: 3, name: 'exciting', _pivot_post_id: 1, _pivot_tag_id: 3 }] },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.', tags: [] }] }, sqlite3: { result: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', tags: [{ id: 1, name: 'cool', _pivot_post_id: 1, _pivot_tag_id: 1 },{ id: 2, name: 'boring', _pivot_post_id: 1, _pivot_tag_id: 2 },{ id: 3, name: 'exciting', _pivot_post_id: 1, _pivot_tag_id: 3 }] },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.', tags: [] }] } }, 'eager loads "hasMany" -> "hasMany" (site -> authors.ownPosts)': { mysql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }] } }, postgresql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }] } }, sqlite3: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }] } } }, 'eager loads "hasMany" -> "belongsToMany" (site -> authors.posts)': { mysql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 1, _pivot_post_id: 1 }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 2, _pivot_post_id: 1 },{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.', _pivot_author_id: 2, _pivot_post_id: 2 }] }] } }, postgresql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 1, _pivot_post_id: 1 }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 2, _pivot_post_id: 1 },{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.', _pivot_author_id: 2, _pivot_post_id: 2 }] }] } }, sqlite3: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 1, _pivot_post_id: 1 }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', posts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.', _pivot_author_id: 2, _pivot_post_id: 2 },{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.', _pivot_author_id: 2, _pivot_post_id: 1 }] }] } } }, 'does multi deep eager loads (site -> authors.ownPosts, authors.site, blogs.posts)': { mysql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }], site: { id: 1, name: 'knexjs.org' } },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }], site: { id: 1, name: 'knexjs.org' } }], blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] },{ id: 2, site_id: 1, name: 'Alternate Site Blog', posts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' }] }] } }, postgresql: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', site: { id: 1, name: 'knexjs.org' }, ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', site: { id: 1, name: 'knexjs.org' }, ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }], blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] },{ id: 2, site_id: 1, name: 'Alternate Site Blog', posts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' }] }] } }, sqlite3: { result: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }], site: { id: 1, name: 'knexjs.org' } },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }], site: { id: 1, name: 'knexjs.org' } }], blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', posts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] },{ id: 2, site_id: 1, name: 'Alternate Site Blog', posts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' }] }] } } }, 'eager loads "hasMany" -> "hasMany" (sites -> authors.ownPosts)': { mysql: { result: [{ id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }] },{ id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown', ownPosts: [{ id: 4, owner_id: 3, blog_id: 3, name: 'This is a new Title 4!', content: 'Lorem ipsum Anim sed eu sint aute.' }] },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy', ownPosts: [{ id: 5, owner_id: 4, blog_id: 4, name: 'This is a new Title 5!', content: 'Lorem ipsum Commodo consectetur eu ea amet laborum nulla eiusmod minim veniam ullamco nostrud sed mollit consectetur veniam mollit Excepteur quis cupidatat.' }] }] },{ id: 3, name: 'backbonejs.org', authors: [] }] }, postgresql: { result: [{ id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }] },{ id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown', ownPosts: [{ id: 4, owner_id: 3, blog_id: 3, name: 'This is a new Title 4!', content: 'Lorem ipsum Anim sed eu sint aute.' }] },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy', ownPosts: [{ id: 5, owner_id: 4, blog_id: 4, name: 'This is a new Title 5!', content: 'Lorem ipsum Commodo consectetur eu ea amet laborum nulla eiusmod minim veniam ullamco nostrud sed mollit consectetur veniam mollit Excepteur quis cupidatat.' }] }] },{ id: 3, name: 'backbonejs.org', authors: [] }] }, sqlite3: { result: [{ id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', ownPosts: [{ id: 1, owner_id: 1, blog_id: 1, name: 'This is a new Title!', content: 'Lorem ipsum Labore eu sed sed Excepteur enim laboris deserunt adipisicing dolore culpa aliqua cupidatat proident ea et commodo labore est adipisicing ex amet exercitation est.' }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', ownPosts: [{ id: 2, owner_id: 2, blog_id: 2, name: 'This is a new Title 2!', content: 'Lorem ipsum Veniam ex amet occaecat dolore in pariatur minim est exercitation deserunt Excepteur enim officia occaecat in exercitation aute et ad esse ex in in dolore amet consequat quis sed mollit et id incididunt sint dolore velit officia dolor dolore laboris dolor Duis ea ex quis deserunt anim nisi qui culpa laboris nostrud Duis anim deserunt esse laboris nulla qui in dolor voluptate aute reprehenderit amet ut et non voluptate elit irure mollit dolor consectetur nisi adipisicing commodo et mollit dolore incididunt cupidatat nulla ut irure deserunt non officia laboris fugiat ut pariatur ut non aliqua eiusmod dolor et nostrud minim elit occaecat commodo consectetur cillum elit laboris mollit dolore amet id qui eiusmod nulla elit eiusmod est ad aliqua aute enim ut aliquip ex in Ut nisi sint exercitation est mollit veniam cupidatat adipisicing occaecat dolor irure in aute aliqua ullamco.' },{ id: 3, owner_id: 2, blog_id: 1, name: 'This is a new Title 3!', content: 'Lorem ipsum Reprehenderit esse esse consectetur aliquip magna.' }] }] },{ id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown', ownPosts: [{ id: 4, owner_id: 3, blog_id: 3, name: 'This is a new Title 4!', content: 'Lorem ipsum Anim sed eu sint aute.' }] },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy', ownPosts: [{ id: 5, owner_id: 4, blog_id: 4, name: 'This is a new Title 5!', content: 'Lorem ipsum Commodo consectetur eu ea amet laborum nulla eiusmod minim veniam ullamco nostrud sed mollit consectetur veniam mollit Excepteur quis cupidatat.' }] }] },{ id: 3, name: 'backbonejs.org', authors: [] }] } }, 'eager loads relations on a populated model (site -> blogs, authors.site)': { mysql: { result: { id: 1, name: 'knexjs.org' } }, postgresql: { result: { id: 1, name: 'knexjs.org' } }, sqlite3: { result: { id: 1, name: 'knexjs.org' } } }, 'eager loads attributes on a collection (sites -> blogs, authors.site)': { mysql: { result: [{ id: 1, name: 'knexjs.org' },{ id: 2, name: 'bookshelfjs.org' },{ id: 3, name: 'backbonejs.org' }] }, postgresql: { result: [{ id: 1, name: 'knexjs.org' },{ id: 2, name: 'bookshelfjs.org' },{ id: 3, name: 'backbonejs.org' }] }, sqlite3: { result: [{ id: 1, name: 'knexjs.org' },{ id: 2, name: 'bookshelfjs.org' },{ id: 3, name: 'backbonejs.org' }] } }, 'works with many-to-many (user -> roles)': { mysql: { result: [{ rid: 4, name: 'admin', _pivot_uid: 1, _pivot_rid: 4 }] }, postgresql: { result: [{ rid: 4, name: 'admin', _pivot_uid: 1, _pivot_rid: 4 }] }, sqlite3: { result: [{ rid: 4, name: 'admin', _pivot_uid: 1, _pivot_rid: 4 }] } }, 'works with eager loaded many-to-many (user -> roles)': { mysql: { result: { uid: 1, username: 'root', roles: [{ rid: 4, name: 'admin', _pivot_uid: 1, _pivot_rid: 4 }] } }, postgresql: { result: { uid: 1, username: 'root', roles: [{ rid: 4, name: 'admin', _pivot_uid: 1, _pivot_rid: 4 }] } }, sqlite3: { result: { uid: 1, username: 'root', roles: [{ rid: 4, name: 'admin', _pivot_uid: 1, _pivot_rid: 4 }] } } }, 'handles morphOne (photo)': { mysql: { result: { id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors' } }, postgresql: { result: { id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors' } }, sqlite3: { result: { id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors' } } }, 'handles morphMany (photo)': { mysql: { result: [{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' }] }, postgresql: { result: [{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' }] }, sqlite3: { result: [{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' }] } }, 'handles morphTo (imageable "authors")': { mysql: { result: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } }, postgresql: { result: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } }, sqlite3: { result: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } } }, 'handles morphTo (imageable "sites")': { mysql: { result: { id: 1, name: 'knexjs.org' } }, postgresql: { result: { id: 1, name: 'knexjs.org' } }, sqlite3: { result: { id: 1, name: 'knexjs.org' } } }, 'eager loads morphMany (sites -> photos)': { mysql: { result: [{ id: 1, name: 'knexjs.org', photos: [{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' }] },{ id: 2, name: 'bookshelfjs.org', photos: [{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites' },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites' }] },{ id: 3, name: 'backbonejs.org', photos: [] }] }, postgresql: { result: [{ id: 1, name: 'knexjs.org', photos: [{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' }] },{ id: 2, name: 'bookshelfjs.org', photos: [{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites' },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites' }] },{ id: 3, name: 'backbonejs.org', photos: [] }] }, sqlite3: { result: [{ id: 1, name: 'knexjs.org', photos: [{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites' }] },{ id: 2, name: 'bookshelfjs.org', photos: [{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites' },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites' }] },{ id: 3, name: 'backbonejs.org', photos: [] }] } }, 'eager loads morphTo (photos -> imageable)': { mysql: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageable: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageable: { id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org' } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org' } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org' } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org' } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageable: { } }] }, postgresql: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageable: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageable: { id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org' } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org' } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org' } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org' } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageable: { } }] }, sqlite3: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageable: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageable: { id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org' } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org' } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org' } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org' } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageable: { } }] } }, 'eager loads beyond the morphTo, where possible': { mysql: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageable: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageable: { id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown' },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy' }] } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown' },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy' }] } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageable: { } }] }, postgresql: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageable: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageable: { id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown' },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy' }] } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown' },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy' }] } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageable: { } }] }, sqlite3: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageable: { id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageable: { id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageable: { id: 1, name: 'knexjs.org', authors: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser' },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe' }] } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown' },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy' }] } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageable: { id: 2, name: 'bookshelfjs.org', authors: [{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown' },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy' }] } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageable: { } }] } }, 'handles hasMany `through`': { mysql: { result: [{ id: 1, post_id: 1, name: '(blank)', email: '[email protected]', comment: 'this is neat.', _pivot_id: 1, _pivot_blog_id: 1 }] }, postgresql: { result: [{ id: 1, post_id: 1, name: '(blank)', email: '[email protected]', comment: 'this is neat.', _pivot_id: 1, _pivot_blog_id: 1 }] }, sqlite3: { result: [{ id: 1, post_id: 1, name: '(blank)', email: '[email protected]', comment: 'this is neat.', _pivot_id: 1, _pivot_blog_id: 1 }] } }, 'eager loads hasMany `through`': { mysql: { result: [{ id: 1, site_id: 1, name: 'Main Site Blog', comments: [{ id: 1, post_id: 1, name: '(blank)', email: '[email protected]', comment: 'this is neat.', _pivot_id: 1, _pivot_blog_id: 1 }] },{ id: 2, site_id: 1, name: 'Alternate Site Blog', comments: [] }] }, postgresql: { result: [{ id: 1, site_id: 1, name: 'Main Site Blog', comments: [{ id: 1, post_id: 1, name: '(blank)', email: '[email protected]', comment: 'this is neat.', _pivot_id: 1, _pivot_blog_id: 1 }] },{ id: 2, site_id: 1, name: 'Alternate Site Blog', comments: [] }] }, sqlite3: { result: [{ id: 1, site_id: 1, name: 'Main Site Blog', comments: [{ id: 1, post_id: 1, name: '(blank)', email: '[email protected]', comment: 'this is neat.', _pivot_id: 1, _pivot_blog_id: 1 }] },{ id: 2, site_id: 1, name: 'Alternate Site Blog', comments: [] }] } }, 'handles hasOne `through`': { mysql: { result: { id: 1, meta_id: 1, other_description: 'This is an info block for hasOne -> through test', _pivot_id: 1, _pivot_site_id: 1 } }, postgresql: { result: { id: 1, meta_id: 1, other_description: 'This is an info block for hasOne -> through test', _pivot_id: 1, _pivot_site_id: 1 } }, sqlite3: { result: { id: 1, meta_id: 1, other_description: 'This is an info block for hasOne -> through test', _pivot_id: 1, _pivot_site_id: 1 } } }, 'eager loads hasOne `through`': { mysql: { result: [{ id: 1, name: 'knexjs.org', info: { id: 1, meta_id: 1, other_description: 'This is an info block for hasOne -> through test', _pivot_id: 1, _pivot_site_id: 1 } },{ id: 2, name: 'bookshelfjs.org', info: { id: 2, meta_id: 2, other_description: 'This is an info block for an eager hasOne -> through test', _pivot_id: 2, _pivot_site_id: 2 } }] }, postgresql: { result: [{ id: 1, name: 'knexjs.org', info: { id: 1, meta_id: 1, other_description: 'This is an info block for hasOne -> through test', _pivot_id: 1, _pivot_site_id: 1 } },{ id: 2, name: 'bookshelfjs.org', info: { id: 2, meta_id: 2, other_description: 'This is an info block for an eager hasOne -> through test', _pivot_id: 2, _pivot_site_id: 2 } }] }, sqlite3: { result: [{ id: 1, name: 'knexjs.org', info: { id: 1, meta_id: 1, other_description: 'This is an info block for hasOne -> through test', _pivot_id: 1, _pivot_site_id: 1 } },{ id: 2, name: 'bookshelfjs.org', info: { id: 2, meta_id: 2, other_description: 'This is an info block for an eager hasOne -> through test', _pivot_id: 2, _pivot_site_id: 2 } }] } }, 'eager loads belongsToMany `through`': { mysql: { result: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', _pivot_id: 1, _pivot_owner_id: 1, _pivot_blog_id: 1 }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', _pivot_id: 3, _pivot_owner_id: 2, _pivot_blog_id: 1 },{ id: 2, site_id: 1, name: 'Alternate Site Blog', _pivot_id: 2, _pivot_owner_id: 2, _pivot_blog_id: 2 }] },{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown', blogs: [{ id: 3, site_id: 2, name: 'Main Site Blog', _pivot_id: 4, _pivot_owner_id: 3, _pivot_blog_id: 3 }] },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy', blogs: [{ id: 4, site_id: 2, name: 'Alternate Site Blog', _pivot_id: 5, _pivot_owner_id: 4, _pivot_blog_id: 4 }] }] }, postgresql: { result: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', _pivot_id: 1, _pivot_owner_id: 1, _pivot_blog_id: 1 }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', _pivot_id: 3, _pivot_owner_id: 2, _pivot_blog_id: 1 },{ id: 2, site_id: 1, name: 'Alternate Site Blog', _pivot_id: 2, _pivot_owner_id: 2, _pivot_blog_id: 2 }] },{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown', blogs: [{ id: 3, site_id: 2, name: 'Main Site Blog', _pivot_id: 4, _pivot_owner_id: 3, _pivot_blog_id: 3 }] },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy', blogs: [{ id: 4, site_id: 2, name: 'Alternate Site Blog', _pivot_id: 5, _pivot_owner_id: 4, _pivot_blog_id: 4 }] }] }, sqlite3: { result: [{ id: 1, site_id: 1, first_name: 'Tim', last_name: 'Griesser', blogs: [{ id: 1, site_id: 1, name: 'Main Site Blog', _pivot_id: 1, _pivot_owner_id: 1, _pivot_blog_id: 1 }] },{ id: 2, site_id: 1, first_name: 'Bazooka', last_name: 'Joe', blogs: [{ id: 2, site_id: 1, name: 'Alternate Site Blog', _pivot_id: 2, _pivot_owner_id: 2, _pivot_blog_id: 2 },{ id: 1, site_id: 1, name: 'Main Site Blog', _pivot_id: 3, _pivot_owner_id: 2, _pivot_blog_id: 1 }] },{ id: 3, site_id: 2, first_name: 'Charlie', last_name: 'Brown', blogs: [{ id: 3, site_id: 2, name: 'Main Site Blog', _pivot_id: 4, _pivot_owner_id: 3, _pivot_blog_id: 3 }] },{ id: 4, site_id: 2, first_name: 'Ron', last_name: 'Burgundy', blogs: [{ id: 4, site_id: 2, name: 'Alternate Site Blog', _pivot_id: 5, _pivot_owner_id: 4, _pivot_blog_id: 4 }] }] } }, '#65 - should eager load correctly for models': { mysql: { result: { hostname: 'google.com', instance_id: 3, route: null, instance: { id: 3, name: 'search engine' } } }, postgresql: { result: { hostname: 'google.com', instance_id: 3, route: null, instance: { id: '3', name: 'search engine' } } }, sqlite3: { result: { hostname: 'google.com', instance_id: 3, route: null, instance: { id: 3, name: 'search engine' } } } }, '#65 - should eager load correctly for collections': { mysql: { result: [{ hostname: 'google.com', instance_id: 3, route: null, instance: { id: 3, name: 'search engine' } },{ hostname: 'apple.com', instance_id: 10, route: null, instance: { id: 10, name: 'computers' } }] }, postgresql: { result: [{ hostname: 'google.com', instance_id: 3, route: null, instance: { id: '3', name: 'search engine' } },{ hostname: 'apple.com', instance_id: 10, route: null, instance: { id: '10', name: 'computers' } }] }, sqlite3: { result: [{ hostname: 'google.com', instance_id: 3, route: null, instance: { id: 3, name: 'search engine' } },{ hostname: 'apple.com', instance_id: 10, route: null, instance: { id: 10, name: 'computers' } }] } }, 'parses eager-loaded morphTo relations (model)': { mysql: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageableParsed: { id_parsed: 1, site_id_parsed: 1, first_name_parsed: 'Tim', last_name_parsed: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageableParsed: { id_parsed: 2, site_id_parsed: 1, first_name_parsed: 'Bazooka', last_name_parsed: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageableParsed: { id_parsed: 1, name_parsed: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageableParsed: { id_parsed: 1, name_parsed: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageableParsed: { id_parsed: 2, name_parsed: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageableParsed: { id_parsed: 2, name_parsed: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageableParsed: { } }] }, postgresql: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageableParsed: { id_parsed: 1, site_id_parsed: 1, first_name_parsed: 'Tim', last_name_parsed: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageableParsed: { id_parsed: 2, site_id_parsed: 1, first_name_parsed: 'Bazooka', last_name_parsed: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageableParsed: { id_parsed: 1, name_parsed: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageableParsed: { id_parsed: 1, name_parsed: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageableParsed: { id_parsed: 2, name_parsed: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageableParsed: { id_parsed: 2, name_parsed: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageableParsed: { } }] }, sqlite3: { result: [{ id: 1, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'authors', imageableParsed: { id_parsed: 1, site_id_parsed: 1, first_name_parsed: 'Tim', last_name_parsed: 'Griesser' } },{ id: 2, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'authors', imageableParsed: { id_parsed: 2, site_id_parsed: 1, first_name_parsed: 'Bazooka', last_name_parsed: 'Joe' } },{ id: 3, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageableParsed: { id_parsed: 1, name_parsed: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } },{ id: 4, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 1, imageable_type: 'sites', imageableParsed: { id_parsed: 1, name_parsed: 'knexjs.org', meta: { id: 1, site_id: 1, description: 'This is a description for the Knexjs Site' } } },{ id: 5, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageableParsed: { id_parsed: 2, name_parsed: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } } },{ id: 6, url: 'https://www.google.com/images/srpr/logo4w.png', caption: 'Lorem ipsum Quis Ut eu nostrud ea sint aute non aliqua ut ullamco cupidatat exercitation nisi nisi.', imageable_id: 2, imageable_type: 'sites', imageableParsed: { id_parsed: 2, name_parsed: 'bookshelfjs.org', meta: { id: 2, site_id: 2, description: 'This is a description for the Bookshelfjs Site' } } },{ id: 7, url: 'http://image.dev', caption: 'this is a test image', imageable_id: 10, imageable_type: 'sites', imageableParsed: { } }] } } };
/** * Module dependencies */ var Server = require('annex-ws-node').Server; var http = require('http'); var stack = require('connect-stack'); var pns = require('pack-n-stack'); module.exports = function createServer(opts) { var server = http.createServer(); server.stack = []; server.handle = stack(server.stack); server.use = function(fn) { fn.handle = fn; server.stack.push(fn); return server; }; var routes = server.routes = {}; var hasPushedRouter = false; server.register = server.fn = function(modName, fnName, cb) { var mod = routes[modName] = routes[modName] || {}; var fn = mod[fnName] = mod[fnName] || []; fn.push(cb); server.emit('register:call', modName, fnName); if (hasPushedRouter) return server; server.use(router); hasPushedRouter = true; return server; }; function router(req, res, next) { var mod = routes[req.module]; if (!mod) return next(); var fn = mod[req.method]; if (!fn) return next(); // TODO support next('route') fn[0](req, res, next); } var wss = new Server({server: server, marshal: opts.marshal}); wss.listen(function(req, res) { // TODO do a domain here server.handle(req, res, function(err) { if (!res._sent) { err ? res.error(err.message) : res.error(req.module + ':' + req.method + ' not implemented'); if (err) console.error(err.stack || err.message); } }); }); return server; }
(function () { 'use strict'; /* Controllers */ var pollsControllers = angular.module('pollsControllers', []); var author = 'Patrick Nicholls'; pollsControllers.controller('PollListCtrl', ['$scope', '$http', function ($scope, $http) { var resource = "/~pjn59/365/polls/index.php/services/polls"; $scope.polls = undefined; $scope.author = author; $http.get(resource) .success(function(data){ $scope.polls = data; }) .error(function(){ console.log("Couldn't get data"); }); }]); pollsControllers.controller('PollDetailCtrl', ['$scope', '$routeParams', '$http', function($scope, $routeParams, $http) { $scope.pollId = $routeParams.pollId; $scope.title = undefined; $scope.quesiton = undefined; $scope.choice = undefined; var base_url = "/~pjn59/365/polls/index.php/services/"; $http.get(base_url + "polls/" + $scope.pollId) .success(function(data){ console.log(data); var choices = []; for (var i = 0; i < data.choices.length; i++) { choices[i] = { 'choice': data.choices[i], 'votes' : parseInt(data.votes[i]) }; } $scope.choices = choices; $scope.question = data.question; $scope.title = data.title; console.log($scope.choices); }) .error(function(){ console.log("Couldn't get data"); }); $scope.vote = function() { //Increment database through PHP somehow $scope.choices[$scope.choice-1].votes += 1; $http.post(base_url + "votes/" + $scope.pollId + "/" + $scope.choice) .success(function(data){ console.log("Vote succeeded") }) .error(function(){ console.log("Vote unsuccessful"); }); }; $scope.reset = function() { for (var i = 0; i < $scope.choices.length; i++) { $scope.choices[i].votes = 0; } $http.delete(base_url + "votes/" + $scope.pollId) .success(function(data){ console.log("Reset succeeded") }) .error(function(){ console.log("Reset unsuccessful"); }); } }]); pollsControllers.controller('AboutCtrl', ['$scope', function ($scope) { $scope.author = author; }]); }())
// Generated by CoffeeScript 1.7.1 (function() { var ERROR, IGNORE, WARN; ERROR = 'error'; WARN = 'warn'; IGNORE = 'ignore'; module.exports = { coffeescript_error: { level: ERROR, message: '' } }; }).call(this);
/** * Run the APP */ app.run();
/* * slush-ml-3t * https://github.com/edmacabebe/slush-ml-3t * * Copyright (c) 2017, edmacabebe * Licensed under the MIT license. */ 'use strict'; var gulp = require('gulp'), install = require('gulp-install'), conflict = require('gulp-conflict'), template = require('gulp-template'), rename = require('gulp-rename'), _ = require('underscore.string'), inquirer = require('inquirer'), path = require('path'); function format(string) { var username = string.toLowerCase(); return username.replace(/\s/g, ''); } var defaults = (function () { var workingDirName = path.basename(process.cwd()), homeDir, osUserName, configFile, user; if (process.platform === 'win32') { homeDir = process.env.USERPROFILE; osUserName = process.env.USERNAME || path.basename(homeDir).toLowerCase(); } else { homeDir = process.env.HOME || process.env.HOMEPATH; osUserName = homeDir && homeDir.split('/').pop() || 'root'; } configFile = path.join(homeDir, '.gitconfig'); user = {}; if (require('fs').existsSync(configFile)) { user = require('iniparser').parseSync(configFile).user; } return { appName: workingDirName, userName: osUserName || format(user.name || ''), authorName: user.name || '', authorEmail: user.email || '' }; })(); gulp.task('default', function (done) { var prompts = [{ name: 'appName', message: 'What is the name of your project?', default: defaults.appName }, { name: 'appDescription', message: 'What is the description?' }, { name: 'appVersion', message: 'What is the version of your project?', default: '0.1.0' }, { name: 'authorName', message: 'What is the author name?', default: defaults.authorName }, { name: 'authorEmail', message: 'What is the author email?', default: defaults.authorEmail }, { name: 'userName', message: 'What is the github username?', default: defaults.userName }, { type: 'confirm', name: 'moveon', message: 'Continue?' }]; //Ask inquirer.prompt(prompts, function (answers) { if (!answers.moveon) { return done(); } answers.appNameSlug = _.slugify(answers.appName); gulp.src(__dirname + '/templates/**') .pipe(template(answers)) .pipe(rename(function (file) { if (file.basename[0] === '_') { file.basename = '.' + file.basename.slice(1); } })) .pipe(conflict('./')) .pipe(gulp.dest('./')) .pipe(install()) .on('end', function () { done(); }); }); });
angular.module('streama').controller('adminVideosCtrl', ['$scope', 'apiService', 'modalService', '$state', function ($scope, apiService, modalService, $state) { $scope.loading = true; apiService.genericVideo.list().then(function (response) { $scope.videos = response.data; $scope.loading = false; }); $scope.openGenericVideoModal = function () { modalService.genericVideoModal(null, function (data) { $state.go('admin.video', {videoId: data.id}); }); }; $scope.addFromSuggested = function (movie, redirect) { var tempMovie = angular.copy(movie); var apiId = tempMovie.id; delete tempMovie.id; tempMovie.apiId = apiId; apiService.movie.save(tempMovie).then(function (response) { if(redirect){ $state.go('admin.movie', {movieId: response.data.id}); }else{ $scope.movies.push(response.data); } }); }; $scope.alreadyAdded = function (movie) { console.log('%c movie', 'color: deeppink; font-weight: bold; text-shadow: 0 0 5px deeppink;', movie); return movie.id && _.find($scope.movies, {apiId: movie.id.toString()}); }; }]);
var cookie = require('../index'); chai.should(); describe('cookie monster', function() { it('sets a cookie', function (){ cookie.setItem('cookieKey', 'cookieVal'); document.cookie.should.contain('cookieKey=cookieVal'); }); it('gets a cookie', function (){ document.cookie = 'dumby=mcdumberson;'; cookie.getItem('dumby').should.equal('mcdumberson'); }); it('sets and gets cookie with `=` in value', function (){ cookie.setItem('key', 'val=ue'); cookie.getItem('key').should.equal('val=ue'); }); it('removes a cookie', function (){ document.cookie = 'dumby=mcdumberson;'; document.cookie.should.contain('dumby=mcdumberson'); cookie.removeItem('dumby'); document.cookie.should.not.contain('dumby=mcdumberson'); }); it('sets 30 cookies and clears all of them', function (){ for (var i = 0; i++; i < 30){ cookie.setItem('key' + i, 'value' + i); } for (var i = 0; i++; i < 30){ cookie.getItem('key' + i).should.equal('value' + i); } cookie.clear(); document.cookie.should.equal(''); }); });
/** * * Store transaction * * Programmer By Emay Komarudin. * 2013 * * Description Store transaction * * **/ var data_gen = generate_transaction_list(30); Ext.define('App.store.transaction.sListTrx',{ extend : 'Ext.data.Store', // groupField: 'trx_no', // model : 'App.model.transaction.mOrders', fields : ['trx_no','user_name','status','count_orders','count_items','order_no'], data : data_gen });
'use strict' const { Message: MessageModel } = require('../model') module.exports = exports = { sendAtMessage: (masterId, authorId, topicId, replyId) => { return exports.sendMessage('at', masterId, authorId, topicId, replyId) }, sendReplyMessage: (masterId, authorId, topicId, replyId) => { return exports.sendMessage('reply', masterId, authorId, topicId, replyId) }, sendMessage: (type, masterId, authorId, topicId, replyId) => { return new MessageModel({ type: type, master_id: masterId, author_id: authorId, topic_id: topicId, reply_id: replyId }).save() } }
export { default as Toolbar } from './Toolbar'; export { default as ToolbarSection } from './ToolbarSection'; export { default as ToolbarTitle } from './ToolbarTitle'; export { default as ToolbarRow } from './ToolbarRow'; export { default as ToolbarIcon } from './ToolbarIcon';
var SanctuaryApp = angular.module('SanctuaryApp', [ 'ngRoute', 'SanctuaryControllers' ]); SanctuaryApp.config(['$routeProvider', function($routeProvider) { $routeProvider .when('/youtubelist', { templateUrl: 'partials/youtubelist.html', controller: 'YoutubeListController' }) .otherwise({ redirectTo: '/youtubelist' }); }]);
/* * stylie.treeview * https://github.com/typesettin/stylie.treeview * * Copyright (c) 2015 Yaw Joseph Etse. All rights reserved. */ 'use strict'; var extend = require('util-extend'), CodeMirror = require('codemirror'), StylieModals = require('stylie.modals'), editorModals, events = require('events'), classie = require('classie'), util = require('util'); require('../../node_modules/codemirror/addon/edit/matchbrackets'); require('../../node_modules/codemirror/addon/hint/css-hint'); require('../../node_modules/codemirror/addon/hint/html-hint'); require('../../node_modules/codemirror/addon/hint/javascript-hint'); require('../../node_modules/codemirror/addon/hint/show-hint'); require('../../node_modules/codemirror/addon/lint/css-lint'); require('../../node_modules/codemirror/addon/lint/javascript-lint'); // require('../../node_modules/codemirror/addon/lint/json-lint'); require('../../node_modules/codemirror/addon/lint/lint'); // require('../../node_modules/codemirror/addon/lint/html-lint'); require('../../node_modules/codemirror/addon/comment/comment'); require('../../node_modules/codemirror/addon/comment/continuecomment'); require('../../node_modules/codemirror/addon/fold/foldcode'); require('../../node_modules/codemirror/addon/fold/comment-fold'); require('../../node_modules/codemirror/addon/fold/indent-fold'); require('../../node_modules/codemirror/addon/fold/brace-fold'); require('../../node_modules/codemirror/addon/fold/foldgutter'); require('../../node_modules/codemirror/mode/css/css'); require('../../node_modules/codemirror/mode/htmlembedded/htmlembedded'); require('../../node_modules/codemirror/mode/htmlmixed/htmlmixed'); require('../../node_modules/codemirror/mode/javascript/javascript'); var saveSelection = function () { if (window.getSelection) { var sel = window.getSelection(); if (sel.getRangeAt && sel.rangeCount) { return sel.getRangeAt(0); } } else if (document.selection && document.selection.createRange) { return document.selection.createRange(); } return null; }; var restoreSelection = function (range) { if (range) { if (window.getSelection) { var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range); } else if (document.selection && range.select) { range.select(); } } }; var getInsertTextModal = function (orignialid, mtype) { var returnDiv = document.createElement('div'), modaltype = (mtype === 'image') ? 'image' : 'text', // execcmd = (mtype === 'image') ? 'insertImage' : 'createLink', samplelink = (mtype === 'image') ? 'https://developers.google.com/+/images/branding/g+138.png' : 'http://example.com', linktype = (mtype === 'image') ? 'image' : 'link'; returnDiv.setAttribute('id', orignialid + '-insert' + modaltype + '-modal'); returnDiv.setAttribute('data-name', orignialid + '-insert' + modaltype + '-modal'); returnDiv.setAttribute('class', 'ts-modal ts-modal-effect-1 insert' + modaltype + '-modal'); var divInnerHTML = '<section class="ts-modal-content ts-bg-text-primary-color ts-no-heading-margin ts-padding-lg ts-shadow ">'; divInnerHTML += '<div class="ts-form">'; divInnerHTML += '<div class="ts-row">'; divInnerHTML += '<div class="ts-col-span12">'; divInnerHTML += '<h6>Insert a link</h6>'; divInnerHTML += '</div>'; divInnerHTML += '</div>'; // divInnerHTML += '<div class="ts-row">'; // divInnerHTML += '<div class="ts-col-span4">'; // divInnerHTML += '<label class="ts-label">text</label>'; // divInnerHTML += '</div>'; // divInnerHTML += '<div class="ts-col-span8">'; // divInnerHTML += '<input type="text" name="link_url" placeholder="some web link" value="some web link"/>'; // divInnerHTML += '</div>'; // divInnerHTML += '</div>'; divInnerHTML += '<div class="ts-row">'; divInnerHTML += '<div class="ts-col-span4">'; divInnerHTML += '<label class="ts-label">url</label>'; divInnerHTML += '</div>'; divInnerHTML += '<div class="ts-col-span8">'; divInnerHTML += '<input type="text" class="ts-input ts-' + linktype + '_url" name="' + linktype + '_url" placeholder="' + samplelink + '" value="' + samplelink + '"/>'; divInnerHTML += '</div>'; divInnerHTML += '</div>'; divInnerHTML += '<div class="ts-row ts-text-center">'; divInnerHTML += '<div class="ts-col-span6">'; // divInnerHTML += '<button type="button" class="ts-button ts-modal-close ts-button-primary-color" onclick="document.execCommand(\'insertImage\', false, \'http://lorempixel.com/40/20/sports/\');">insert link</button>'; divInnerHTML += '<button type="button" class="ts-button ts-modal-close ts-button-primary-color add-' + linktype + '-button" >insert ' + linktype + '</button>'; divInnerHTML += '</div>'; divInnerHTML += '<div class="ts-col-span6">'; divInnerHTML += '<a class="ts-button ts-modal-close">close</a>'; divInnerHTML += '</div>'; divInnerHTML += '</div>'; divInnerHTML += '</div>'; divInnerHTML += '</section>'; returnDiv.innerHTML = divInnerHTML; return returnDiv; }; /** * A module that represents a StylieTextEditor object, a componentTab is a page composition tool. * @{@link https://github.com/typesettin/stylie.treeview} * @author Yaw Joseph Etse * @copyright Copyright (c) 2015 Typesettin. All rights reserved. * @license MIT * @constructor StylieTextEditor * @requires module:util-extent * @requires module:util * @requires module:events * @param {object} el element of tab container * @param {object} options configuration options */ var StylieTextEditor = function (options) { events.EventEmitter.call(this); var defaultOptions = { type: 'html', updateOnChange: true }; this.options = extend(defaultOptions, options); return this; // this.getTreeHTML = this.getTreeHTML; }; util.inherits(StylieTextEditor, events.EventEmitter); var createButton = function (options) { var buttonElement = document.createElement('button'); buttonElement.setAttribute('class', 'ts-button ts-text-xs ' + options.classes); buttonElement.setAttribute('type', 'button'); buttonElement.innerHTML = options.innerHTML; for (var key in options) { if (key !== 'classes' && key !== 'innerHTML' && key !== 'innerhtml') { buttonElement.setAttribute(key, options[key]); } } return buttonElement; }; StylieTextEditor.prototype.addMenuButtons = function () { this.options.buttons.boldButton = createButton({ classes: ' flaticon-bold17 ', title: 'Bold text', innerHTML: ' ', 'data-attribute-action': 'bold' }); this.options.buttons.italicButton = createButton({ classes: ' flaticon-italic9 ', title: 'Italic text', innerHTML: ' ', 'data-attribute-action': 'italic' }); this.options.buttons.underlineButton = createButton({ classes: ' flaticon-underlined5 ', title: 'Underline text', innerHTML: ' ', 'data-attribute-action': 'underline' }); this.options.buttons.unorderedLIButton = createButton({ classes: ' flaticon-list82 ', innerHTML: ' ', title: ' Insert unordered list ', 'data-attribute-action': 'unorderedLI' }); this.options.buttons.orderedLIButton = createButton({ classes: ' flaticon-numbered8 ', title: ' Insert ordered list ', innerHTML: ' ', 'data-attribute-action': 'orderedLI' }); this.options.buttons.lefttextalignButton = createButton({ classes: ' flaticon-text141 ', innerHTML: ' ', title: ' left align text ', 'data-attribute-action': 'left-textalign' }); //flaticon-text141 this.options.buttons.centertextalignButton = createButton({ classes: ' flaticon-text136 ', innerHTML: ' ', title: ' center align text ', 'data-attribute-action': 'center-textalign' }); //flaticon-text136 this.options.buttons.righttextalignButton = createButton({ classes: ' flaticon-text134 ', innerHTML: ' ', title: ' right align text ', 'data-attribute-action': 'right-textalign' }); //flaticon-text134 this.options.buttons.justifytextalignButton = createButton({ classes: ' flaticon-text146 ', innerHTML: ' ', title: ' justify align text ', 'data-attribute-action': 'justify-textalign' }); //flaticon-text146 //flaticon-characters - font this.options.buttons.textcolorButton = createButton({ classes: ' flaticon-text137 ', innerHTML: ' ', title: ' change text color ', 'data-attribute-action': 'text-color' }); //flaticon-text137 - text color this.options.buttons.texthighlightButton = createButton({ classes: ' flaticon-paintbrush13 ', innerHTML: ' ', title: ' change text highlight ', 'data-attribute-action': 'text-highlight' }); //flaticon-paintbrush13 - text background color(highlight) this.options.buttons.linkButton = createButton({ classes: ' flaticon-link56 ', title: ' Insert a link ', innerHTML: ' ', 'data-attribute-action': 'link' }); this.options.buttons.imageButton = createButton({ classes: ' flaticon-images25 ', title: ' Insert image ', innerHTML: ' ', 'data-attribute-action': 'image' }); this.options.buttons.codeButton = createButton({ innerHTML: ' ', classes: ' flaticon-code39 ', title: 'Source code editor', 'data-attribute-action': 'code' }); this.options.buttons.fullscreenButton = createButton({ title: 'Maximize and fullscreen editor', classes: ' flaticon-logout18 ', innerHTML: ' ', 'data-attribute-action': 'fullscreen' }); this.options.buttons.outdentButton = createButton({ title: 'Outdent button', classes: ' flaticon-paragraph19 ', innerHTML: ' ', 'data-attribute-action': 'outdent' }); this.options.buttons.indentButton = createButton({ title: 'Indent button', classes: ' flaticon-right195 ', innerHTML: ' ', 'data-attribute-action': 'indent' }); }; var button_gobold = function () { document.execCommand('bold', false, ''); }; var button_gounderline = function () { document.execCommand('underline', false, ''); }; var button_goitalic = function () { document.execCommand('italic', false, ''); }; var button_golink = function () { document.execCommand('createLink', true, ''); }; var button_golist = function () { document.execCommand('insertOrderedList', true, ''); }; var button_gobullet = function () { document.execCommand('insertUnorderedList', true, ''); }; var button_goimg = function () { // document.execCommand('insertImage', false, 'http://lorempixel.com/40/20/sports/'); this.saveSelection(); window.editorModals.show(this.options.elementContainer.getAttribute('data-original-id') + '-insertimage-modal'); }; var button_gotextlink = function () { // console.log(this.options.elementContainer.getAttribute('data-original-id')); this.saveSelection(); window.editorModals.show(this.options.elementContainer.getAttribute('data-original-id') + '-inserttext-modal'); }; var add_link_to_editor = function () { this.restoreSelection(); document.execCommand('createLink', false, this.options.forms.add_link_form.querySelector('.ts-link_url').value); }; var add_image_to_editor = function () { this.restoreSelection(); document.execCommand('insertImage', false, this.options.forms.add_image_form.querySelector('.ts-image_url').value); }; var button_gofullscreen = function () { // console.log('button_gofullscreen this', this); // if() classie.toggle(this.options.elementContainer, 'ts-editor-fullscreen'); classie.toggle(this.options.buttons.fullscreenButton, 'ts-button-primary-text-color'); }; var button_togglecodeeditor = function () { classie.toggle(this.options.codemirror.getWrapperElement(), 'ts-hidden'); classie.toggle(this.options.buttons.codeButton, 'ts-button-primary-text-color'); this.options.codemirror.refresh(); }; var button_gotext_left = function () { document.execCommand('justifyLeft', true, ''); }; var button_gotext_center = function () { document.execCommand('justifyCenter', true, ''); }; var button_gotext_right = function () { document.execCommand('justifyRight', true, ''); }; var button_gotext_justifyfull = function () { document.execCommand('justifyFull', true, ''); }; // var button_gotext_left = function () { // document.execCommand('justifyLeft', true, ''); // }; var button_go_outdent = function () { document.execCommand('outdent', true, ''); }; var button_go_indent = function () { document.execCommand('indent', true, ''); }; StylieTextEditor.prototype.initButtonEvents = function () { this.options.buttons.boldButton.addEventListener('click', button_gobold, false); this.options.buttons.underlineButton.addEventListener('click', button_gounderline, false); this.options.buttons.italicButton.addEventListener('click', button_goitalic, false); this.options.buttons.linkButton.addEventListener('click', button_golink, false); this.options.buttons.unorderedLIButton.addEventListener('click', button_gobullet, false); this.options.buttons.orderedLIButton.addEventListener('click', button_golist, false); this.options.buttons.imageButton.addEventListener('click', button_goimg.bind(this), false); this.options.buttons.linkButton.addEventListener('click', button_gotextlink.bind(this), false); this.options.buttons.lefttextalignButton.addEventListener('click', button_gotext_left, false); this.options.buttons.centertextalignButton.addEventListener('click', button_gotext_center, false); this.options.buttons.righttextalignButton.addEventListener('click', button_gotext_right, false); this.options.buttons.justifytextalignButton.addEventListener('click', button_gotext_justifyfull, false); this.options.buttons.outdentButton.addEventListener('click', button_go_outdent, false); this.options.buttons.indentButton.addEventListener('click', button_go_indent, false); this.options.buttons.fullscreenButton.addEventListener('click', button_gofullscreen.bind(this), false); this.options.buttons.codeButton.addEventListener('click', button_togglecodeeditor.bind(this), false); this.options.buttons.addlinkbutton.addEventListener('click', add_link_to_editor.bind(this), false); this.options.buttons.addimagebutton.addEventListener('click', add_image_to_editor.bind(this), false); }; StylieTextEditor.prototype.init = function () { try { var previewEditibleDiv = document.createElement('div'), previewEditibleMenu = document.createElement('div'), insertImageURLModal = getInsertTextModal(this.options.element.getAttribute('id'), 'image'), insertTextLinkModal = getInsertTextModal(this.options.element.getAttribute('id'), 'text'), previewEditibleContainer = document.createElement('div'); this.options.buttons = {}; this.addMenuButtons(); previewEditibleMenu.appendChild(this.options.buttons.boldButton); previewEditibleMenu.appendChild(this.options.buttons.italicButton); previewEditibleMenu.appendChild(this.options.buttons.underlineButton); previewEditibleMenu.appendChild(this.options.buttons.unorderedLIButton); previewEditibleMenu.appendChild(this.options.buttons.orderedLIButton); previewEditibleMenu.appendChild(this.options.buttons.lefttextalignButton); previewEditibleMenu.appendChild(this.options.buttons.centertextalignButton); previewEditibleMenu.appendChild(this.options.buttons.righttextalignButton); previewEditibleMenu.appendChild(this.options.buttons.justifytextalignButton); // previewEditibleMenu.appendChild(this.options.buttons.textcolorButton); // previewEditibleMenu.appendChild(this.options.buttons.texthighlightButton); previewEditibleMenu.appendChild(this.options.buttons.outdentButton); previewEditibleMenu.appendChild(this.options.buttons.indentButton); previewEditibleMenu.appendChild(this.options.buttons.linkButton); previewEditibleMenu.appendChild(this.options.buttons.imageButton); previewEditibleMenu.appendChild(this.options.buttons.codeButton); previewEditibleMenu.appendChild(this.options.buttons.fullscreenButton); previewEditibleMenu.setAttribute('class', 'ts-input ts-editor-menu ts-padding-sm'); previewEditibleMenu.setAttribute('style', 'font-family: monospace, Arial,"Times New Roman";'); previewEditibleDiv.setAttribute('class', 'ts-input ts-texteditor'); previewEditibleDiv.setAttribute('contenteditable', 'true'); previewEditibleDiv.setAttribute('tabindex', '1'); previewEditibleContainer.setAttribute('id', this.options.element.getAttribute('id') + '_container'); previewEditibleContainer.setAttribute('data-original-id', this.options.element.getAttribute('id')); previewEditibleContainer.setAttribute('class', 'ts-editor-container'); previewEditibleContainer.appendChild(previewEditibleMenu); previewEditibleContainer.appendChild(previewEditibleDiv); document.querySelector('.ts-modal-hidden-container').appendChild(insertTextLinkModal); document.querySelector('.ts-modal-hidden-container').appendChild(insertImageURLModal); this.options.element = this.options.element || document.querySelector(this.options.elementSelector); previewEditibleDiv.innerHTML = this.options.element.innerText; this.options.previewElement = previewEditibleDiv; this.options.forms = { add_link_form: document.querySelector('.inserttext-modal .ts-form'), add_image_form: document.querySelector('.insertimage-modal .ts-form') }; this.options.buttons.addlinkbutton = document.querySelector('.inserttext-modal').querySelector('.add-link-button'); this.options.buttons.addimagebutton = document.querySelector('.insertimage-modal').querySelector('.add-image-button'); //now add code mirror this.options.elementContainer = previewEditibleContainer; this.options.element.parentNode.appendChild(previewEditibleContainer); previewEditibleContainer.appendChild(this.options.element); this.options.codemirror = CodeMirror.fromTextArea( this.options.element, { lineNumbers: true, lineWrapping: true, matchBrackets: true, autoCloseBrackets: true, mode: (this.options.type === 'ejs') ? 'text/ejs' : 'text/html', indentUnit: 2, indentWithTabs: true, 'overflow-y': 'hidden', 'overflow-x': 'auto', lint: true, gutters: [ 'CodeMirror-linenumbers', 'CodeMirror-foldgutter', // 'CodeMirror-lint-markers' ], foldGutter: true } ); // this.options.element.parentNode.insertBefore(previewEditibleDiv, this.options.element); this.options.codemirror.on('blur', function (instance) { // console.log('editor lost focuss', instance, change); this.options.previewElement.innerHTML = instance.getValue(); }.bind(this)); this.options.previewElement.addEventListener('blur', function () { this.options.codemirror.getDoc().setValue(this.options.previewElement.innerHTML); }.bind(this)); if (this.options.updateOnChange) { this.options.codemirror.on('change', function (instance) { // console.log('editor lost focuss', instance, change); // console.log('document.activeElement === this.options.previewElement', document.activeElement === this.options.previewElement); setTimeout(function () { if (document.activeElement !== this.options.previewElement) { this.options.previewElement.innerHTML = instance.getValue(); } }.bind(this), 5000); }.bind(this)); this.options.previewElement.addEventListener('change', function () { this.options.codemirror.getDoc().setValue(this.options.previewElement.innerHTML); }.bind(this)); } //set initial code mirror this.options.codemirror.getDoc().setValue(this.options.previewElement.innerHTML); this.options.codemirror.refresh(); classie.add(this.options.codemirror.getWrapperElement(), 'ts-hidden'); // setTimeout(this.options.codemirror.refresh, 1000); this.initButtonEvents(); editorModals = new StylieModals({}); window.editorModals = editorModals; return this; } catch (e) { console.error(e); } }; StylieTextEditor.prototype.getValue = function () { return this.options.previewElement.innerText || this.options.codemirror.getValue(); }; StylieTextEditor.prototype.saveSelection = function () { this.options.selection = (saveSelection()) ? saveSelection() : null; }; StylieTextEditor.prototype.restoreSelection = function () { this.options.preview_selection = this.options.selection; restoreSelection(this.options.selection); }; module.exports = StylieTextEditor;
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ShapeType_1 = require("../Enums/ShapeType"); var Updater_1 = require("./Particle/Updater"); var Utils_1 = require("../Utils/Utils"); var PolygonMaskType_1 = require("../Enums/PolygonMaskType"); var RotateDirection_1 = require("../Enums/RotateDirection"); var ColorUtils_1 = require("../Utils/ColorUtils"); var Particles_1 = require("../Options/Classes/Particles/Particles"); var SizeAnimationStatus_1 = require("../Enums/SizeAnimationStatus"); var OpacityAnimationStatus_1 = require("../Enums/OpacityAnimationStatus"); var Shape_1 = require("../Options/Classes/Particles/Shape/Shape"); var StartValueType_1 = require("../Enums/StartValueType"); var CanvasUtils_1 = require("../Utils/CanvasUtils"); var Particle = (function () { function Particle(container, position, overrideOptions) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; this.container = container; this.fill = true; this.close = true; this.links = []; this.lastNoiseTime = 0; this.destroyed = false; var options = container.options; var particlesOptions = new Particles_1.Particles(); particlesOptions.load(options.particles); if ((overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.shape) !== undefined) { var shapeType = (_a = overrideOptions.shape.type) !== null && _a !== void 0 ? _a : particlesOptions.shape.type; this.shape = shapeType instanceof Array ? Utils_1.Utils.itemFromArray(shapeType) : shapeType; var shapeOptions = new Shape_1.Shape(); shapeOptions.load(overrideOptions.shape); if (this.shape !== undefined) { var shapeData = shapeOptions.options[this.shape]; if (shapeData !== undefined) { this.shapeData = Utils_1.Utils.deepExtend({}, shapeData instanceof Array ? Utils_1.Utils.itemFromArray(shapeData) : shapeData); this.fill = (_c = (_b = this.shapeData) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this.fill; this.close = (_e = (_d = this.shapeData) === null || _d === void 0 ? void 0 : _d.close) !== null && _e !== void 0 ? _e : this.close; } } } else { var shapeType = particlesOptions.shape.type; this.shape = shapeType instanceof Array ? Utils_1.Utils.itemFromArray(shapeType) : shapeType; var shapeData = particlesOptions.shape.options[this.shape]; if (shapeData) { this.shapeData = Utils_1.Utils.deepExtend({}, shapeData instanceof Array ? Utils_1.Utils.itemFromArray(shapeData) : shapeData); this.fill = (_g = (_f = this.shapeData) === null || _f === void 0 ? void 0 : _f.fill) !== null && _g !== void 0 ? _g : this.fill; this.close = (_j = (_h = this.shapeData) === null || _h === void 0 ? void 0 : _h.close) !== null && _j !== void 0 ? _j : this.close; } } if (overrideOptions !== undefined) { particlesOptions.load(overrideOptions); } this.particlesOptions = particlesOptions; var noiseDelay = this.particlesOptions.move.noise.delay; this.noiseDelay = (noiseDelay.random.enable ? Utils_1.Utils.randomInRange(noiseDelay.random.minimumValue, noiseDelay.value) : noiseDelay.value) * 1000; container.retina.initParticle(this); var color = this.particlesOptions.color; var sizeValue = ((_k = this.sizeValue) !== null && _k !== void 0 ? _k : container.retina.sizeValue); var randomSize = typeof this.particlesOptions.size.random === "boolean" ? this.particlesOptions.size.random : this.particlesOptions.size.random.enable; this.size = { value: randomSize && this.randomMinimumSize !== undefined ? Utils_1.Utils.randomInRange(this.randomMinimumSize, sizeValue) : sizeValue, }; this.direction = this.particlesOptions.move.direction; this.bubble = {}; this.angle = this.particlesOptions.rotate.random ? Math.random() * 360 : this.particlesOptions.rotate.value; if (this.particlesOptions.rotate.direction == RotateDirection_1.RotateDirection.random) { var index = Math.floor(Math.random() * 2); if (index > 0) { this.rotateDirection = RotateDirection_1.RotateDirection.counterClockwise; } else { this.rotateDirection = RotateDirection_1.RotateDirection.clockwise; } } else { this.rotateDirection = this.particlesOptions.rotate.direction; } if (this.particlesOptions.size.animation.enable) { switch (this.particlesOptions.size.animation.startValue) { case StartValueType_1.StartValueType.min: if (!randomSize) { var pxRatio = container.retina.pixelRatio; this.size.value = this.particlesOptions.size.animation.minimumValue * pxRatio; } break; } this.size.status = SizeAnimationStatus_1.SizeAnimationStatus.increasing; this.size.velocity = ((_l = this.sizeAnimationSpeed) !== null && _l !== void 0 ? _l : container.retina.sizeAnimationSpeed) / 100; if (!this.particlesOptions.size.animation.sync) { this.size.velocity = this.size.velocity * Math.random(); } } if (this.particlesOptions.rotate.animation.enable) { if (!this.particlesOptions.rotate.animation.sync) { this.angle = Math.random() * 360; } } this.position = this.calcPosition(this.container, position); if (options.polygon.enable && options.polygon.type === PolygonMaskType_1.PolygonMaskType.inline) { this.initialPosition = { x: this.position.x, y: this.position.y, }; } this.offset = { x: 0, y: 0, }; if (this.particlesOptions.collisions.enable) { this.checkOverlap(position); } if (color instanceof Array) { this.color = ColorUtils_1.ColorUtils.colorToRgb(Utils_1.Utils.itemFromArray(color)); } else { this.color = ColorUtils_1.ColorUtils.colorToRgb(color); } var randomOpacity = this.particlesOptions.opacity.random; var opacityValue = this.particlesOptions.opacity.value; this.opacity = { value: randomOpacity.enable ? Utils_1.Utils.randomInRange(randomOpacity.minimumValue, opacityValue) : opacityValue, }; if (this.particlesOptions.opacity.animation.enable) { this.opacity.status = OpacityAnimationStatus_1.OpacityAnimationStatus.increasing; this.opacity.velocity = this.particlesOptions.opacity.animation.speed / 100; if (!this.particlesOptions.opacity.animation.sync) { this.opacity.velocity *= Math.random(); } } this.initialVelocity = this.calculateVelocity(); this.velocity = { horizontal: this.initialVelocity.horizontal, vertical: this.initialVelocity.vertical, }; var drawer = container.drawers[this.shape]; if (!drawer) { drawer = CanvasUtils_1.CanvasUtils.getShapeDrawer(this.shape); container.drawers[this.shape] = drawer; } if (this.shape === ShapeType_1.ShapeType.image || this.shape === ShapeType_1.ShapeType.images) { var shape = this.particlesOptions.shape; var imageDrawer = drawer; var imagesOptions = shape.options[this.shape]; var images = imageDrawer.getImages(container).images; var index = Utils_1.Utils.arrayRandomIndex(images); var image_1 = images[index]; var optionsImage = (imagesOptions instanceof Array ? imagesOptions.filter(function (t) { return t.src === image_1.source; })[0] : imagesOptions); this.image = { data: image_1, ratio: optionsImage.width / optionsImage.height, replaceColor: (_m = optionsImage.replaceColor) !== null && _m !== void 0 ? _m : optionsImage.replace_color, source: optionsImage.src, }; if (!this.image.ratio) { this.image.ratio = 1; } this.fill = (_o = optionsImage.fill) !== null && _o !== void 0 ? _o : this.fill; this.close = (_p = optionsImage.close) !== null && _p !== void 0 ? _p : this.close; } this.stroke = this.particlesOptions.stroke instanceof Array ? Utils_1.Utils.itemFromArray(this.particlesOptions.stroke) : this.particlesOptions.stroke; this.strokeColor = typeof this.stroke.color === "string" ? ColorUtils_1.ColorUtils.stringToRgb(this.stroke.color) : ColorUtils_1.ColorUtils.colorToRgb(this.stroke.color); this.shadowColor = typeof this.particlesOptions.shadow.color === "string" ? ColorUtils_1.ColorUtils.stringToRgb(this.particlesOptions.shadow.color) : ColorUtils_1.ColorUtils.colorToRgb(this.particlesOptions.shadow.color); this.updater = new Updater_1.Updater(this.container, this); } Particle.prototype.update = function (index, delta) { this.links = []; this.updater.update(delta); }; Particle.prototype.draw = function (delta) { this.container.canvas.drawParticle(this, delta); }; Particle.prototype.isOverlapping = function () { var container = this.container; var p = this; var collisionFound = false; var iterations = 0; for (var _i = 0, _a = container.particles.array.filter(function (t) { return t != p; }); _i < _a.length; _i++) { var p2 = _a[_i]; iterations++; var pos1 = { x: p.position.x + p.offset.x, y: p.position.y + p.offset.y }; var pos2 = { x: p2.position.x + p2.offset.x, y: p2.position.y + p2.offset.y }; var dist = Utils_1.Utils.getDistanceBetweenCoordinates(pos1, pos2); if (dist <= p.size.value + p2.size.value) { collisionFound = true; break; } } return { collisionFound: collisionFound, iterations: iterations, }; }; Particle.prototype.checkOverlap = function (position) { var container = this.container; var p = this; var overlapResult = p.isOverlapping(); if (overlapResult.iterations >= container.particles.count) { container.particles.remove(this); } else if (overlapResult.collisionFound) { p.position.x = position ? position.x : Math.random() * container.canvas.size.width; p.position.y = position ? position.y : Math.random() * container.canvas.size.height; p.checkOverlap(); } }; Particle.prototype.startInfection = function (stage) { var container = this.container; var options = container.options; var stages = options.infection.stages; var stagesCount = stages.length; if (stage > stagesCount || stage < 0) { return; } this.infectionDelay = 0; this.infectionDelayStage = stage; }; Particle.prototype.updateInfectionStage = function (stage) { var container = this.container; var options = container.options; var stagesCount = options.infection.stages.length; if (stage > stagesCount || stage < 0 || (this.infectionStage !== undefined && this.infectionStage > stage)) { return; } if (this.infectionTimeout !== undefined) { window.clearTimeout(this.infectionTimeout); } this.infectionStage = stage; this.infectionTime = 0; }; Particle.prototype.updateInfection = function (delta) { var container = this.container; var options = container.options; var infection = options.infection; var stages = options.infection.stages; var stagesCount = stages.length; if (this.infectionDelay !== undefined && this.infectionDelayStage !== undefined) { var stage = this.infectionDelayStage; if (stage > stagesCount || stage < 0) { return; } if (this.infectionDelay > infection.delay * 1000) { this.infectionStage = stage; this.infectionTime = 0; delete this.infectionDelay; delete this.infectionDelayStage; } else { this.infectionDelay += delta; } } else { delete this.infectionDelay; delete this.infectionDelayStage; } if (this.infectionStage !== undefined && this.infectionTime !== undefined) { var infectionStage = stages[this.infectionStage]; if (infectionStage.duration !== undefined && infectionStage.duration >= 0) { if (this.infectionTime > infectionStage.duration * 1000) { this.nextInfectionStage(); } else { this.infectionTime += delta; } } else { this.infectionTime += delta; } } else { delete this.infectionStage; delete this.infectionTime; } }; Particle.prototype.nextInfectionStage = function () { var container = this.container; var options = container.options; var stagesCount = options.infection.stages.length; if (stagesCount <= 0 || this.infectionStage === undefined) { return; } this.infectionTime = 0; if (stagesCount <= ++this.infectionStage) { if (options.infection.cure) { delete this.infectionStage; delete this.infectionTime; return; } else { this.infectionStage = 0; this.infectionTime = 0; } } }; Particle.prototype.destroy = function () { this.destroyed = true; }; Particle.prototype.calcPosition = function (container, position) { for (var _i = 0, _a = container.plugins; _i < _a.length; _i++) { var plugin = _a[_i]; var pluginPos = plugin.particlePosition !== undefined ? plugin.particlePosition(position) : undefined; if (pluginPos !== undefined) { return pluginPos; } } var pos = { x: 0, y: 0 }; pos.x = position ? position.x : Math.random() * container.canvas.size.width; pos.y = position ? position.y : Math.random() * container.canvas.size.height; if (pos.x > container.canvas.size.width - this.size.value * 2) { pos.x -= this.size.value; } else if (pos.x < this.size.value * 2) { pos.x += this.size.value; } if (pos.y > container.canvas.size.height - this.size.value * 2) { pos.y -= this.size.value; } else if (pos.y < this.size.value * 2) { pos.y += this.size.value; } return pos; }; Particle.prototype.calculateVelocity = function () { var baseVelocity = Utils_1.Utils.getParticleBaseVelocity(this); var res = { horizontal: 0, vertical: 0, }; if (this.particlesOptions.move.straight) { res.horizontal = baseVelocity.x; res.vertical = baseVelocity.y; if (this.particlesOptions.move.random) { res.horizontal *= Math.random(); res.vertical *= Math.random(); } } else { res.horizontal = baseVelocity.x + Math.random() - 0.5; res.vertical = baseVelocity.y + Math.random() - 0.5; } return res; }; return Particle; }()); exports.Particle = Particle;
'use strict'; require('angular/angular'); angular.module('<%= name %>Module', []) .directive('<%= name %>', [ function() { return { restrict: 'E', replace: true, templateUrl: 'src/<%= name %>/<%= name %>.tpl.html', scope: {}, link: function(scope, element, attrs) { scope.directiveTitle = 'dummy'; } }; } ]);
import Ember from 'ember'; import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin'; import InfinityRoute from "../../../../mixins/infinity-route"; export default Ember.Route.extend(InfinityRoute, AuthenticatedRouteMixin, { _listName: 'model', model: function() { return this.infinityModel("report", { perPage: 10, startingPage: 1}); }, actions: { remove: function(model) { if(confirm('Are you sure?')) { model.destroyRecord(); } }, search: function () { this.set('_listName', 'model.content'); var filter = { perPage: 10, startingPage: 1}; this.get('controller').set('model', this.infinityModel("report", filter)) } } });
/** * @file theme loader * * @desc 向每个.vue文件中注入样式相关的变量,不需要手动import * @author echaoo([email protected]) */ /* eslint-disable fecs-no-require, fecs-prefer-destructure */ 'use strict'; const theme = require('../../config/theme'); const loaderUtils = require('loader-utils'); const STYLE_TAG_REG = /(\<style.*?lang="styl(?:us)?".*?\>)([\S\s]*?)(\<\/style\>)/g; // 定义在vuetify中默认的两组stylus hash:主题色和material相关 let defaultVuetifyVariables = { themeColor: { primary: '$blue.darken-2', accent: '$blue.accent-2', secondary: '$grey.darken-3', info: '$blue.base', warning: '$amber.base', error: '$red.accent-2', success: '$green.base' }, materialDesign: { 'bg-color': '#fff', 'fg-color': '#000', 'text-color': '#000', 'primary-text-percent': .87, 'secondary-text-percent': .54, 'disabledORhints-text-percent': .38, 'divider-percent': .12, 'active-icon-percent': .54, 'inactive-icon-percent': .38 } }; // 使用用户定义在config/theme.js中的变量覆盖默认值 let themeColor = Object.assign( {}, defaultVuetifyVariables.themeColor, theme.theme.themeColor ); // 最终输出的stylus hash(themeColor部分) let themeColorTemplate = ` $theme := { primary: ${themeColor.primary} accent: ${themeColor.accent} secondary: ${themeColor.secondary} info: ${themeColor.info} warning: ${themeColor.warning} error: ${themeColor.error} success: ${themeColor.success} } `; let materialDesign = Object.assign( {}, defaultVuetifyVariables.materialDesign, theme.theme.materialDesign ); let materialDesignTemplate = ` $material-custom := { bg-color: ${materialDesign['bg-color']} fg-color: ${materialDesign['fg-color']} text-color: ${materialDesign['text-color']} primary-text-percent: ${materialDesign['primary-text-percent']} secondary-text-percent: ${materialDesign['secondary-text-percent']} disabledORhints-text-percent: ${materialDesign['disabledORhints-text-percent']} divider-percent: ${materialDesign['divider-percent']} active-icon-percent: ${materialDesign['active-icon-percent']} inactive-icon-percent: ${materialDesign['inactive-icon-percent']} } $material-theme := $material-custom `; // 引入项目变量和vuetify中使用的颜色变量 let importVariablesTemplate = ` @import '~@/assets/styles/variables'; @import '~vuetify/src/stylus/settings/_colors'; `; let injectedTemplate = importVariablesTemplate + themeColorTemplate + materialDesignTemplate; module.exports = function (source) { this.cacheable(); let options = loaderUtils.getOptions(this); if (options && options.injectInVueFile) { // 向每一个.vue文件的<style>块中注入 return source.replace(STYLE_TAG_REG, `$1${injectedTemplate}$2$3`); } return injectedTemplate + source; };
/* * Kendo UI v2014.2.1008 (http://www.telerik.com/kendo-ui) * Copyright 2014 Telerik AD. All rights reserved. * * Kendo UI commercial licenses may be obtained at * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete * If you do not own a commercial license, this file shall be governed by the trial license terms. */ (function(f, define){ define([], f); })(function(){ (function( window, undefined ) { var kendo = window.kendo || (window.kendo = { cultures: {} }); kendo.cultures["ms-BN"] = { name: "ms-BN", numberFormat: { pattern: ["-n"], decimals: 2, ",": ".", ".": ",", groupSize: [3], percent: { pattern: ["-n %","n %"], decimals: 2, ",": ".", ".": ",", groupSize: [3], symbol: "%" }, currency: { pattern: ["($n)","$n"], decimals: 0, ",": ".", ".": ",", groupSize: [3], symbol: "$" } }, calendars: { standard: { days: { names: ["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"], namesAbbr: ["Ahad","Isnin","Sel","Rabu","Khamis","Jumaat","Sabtu"], namesShort: ["A","I","S","R","K","J","S"] }, months: { names: ["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember",""], namesAbbr: ["Jan","Feb","Mac","Apr","Mei","Jun","Jul","Ogos","Sept","Okt","Nov","Dis",""] }, AM: [""], PM: [""], patterns: { d: "dd/MM/yyyy", D: "dd MMMM yyyy", F: "dd MMMM yyyy H:mm:ss", g: "dd/MM/yyyy H:mm", G: "dd/MM/yyyy H:mm:ss", m: "dd MMMM", M: "dd MMMM", s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss", t: "H:mm", T: "H:mm:ss", u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", y: "MMMM yyyy", Y: "MMMM yyyy" }, "/": "/", ":": ":", firstDay: 1 } } } })(this); return window.kendo; }, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
// This file was automatically generated. Do not modify. 'use strict'; goog.provide('Blockly.Msg.az-latn'); goog.require('Blockly.Msg'); Blockly.Msg.ADD_COMMENT = "Şərh əlavə et"; Blockly.Msg.CHANGE_VALUE_TITLE = "Qiyməti dəyiş:"; Blockly.Msg.COLLAPSE_ALL = "Blokları yığ"; Blockly.Msg.COLLAPSE_BLOCK = "Bloku yığ"; Blockly.Msg.COLOUR_BLEND_COLOUR1 = "rəng 1"; Blockly.Msg.COLOUR_BLEND_COLOUR2 = "rəng 2"; Blockly.Msg.COLOUR_BLEND_HELPURL = "http://meyerweb.com/eric/tools/color-blend/"; Blockly.Msg.COLOUR_BLEND_RATIO = "nisbət"; Blockly.Msg.COLOUR_BLEND_TITLE = "qarışdır"; Blockly.Msg.COLOUR_BLEND_TOOLTIP = "İki rəngi verilmiş nisbətdə (0,0 - 1,0) qarışdırır."; Blockly.Msg.COLOUR_PICKER_HELPURL = "https://en.wikipedia.org/wiki/Color"; Blockly.Msg.COLOUR_PICKER_TOOLTIP = "Palitradan bir rəng seçin."; Blockly.Msg.COLOUR_RANDOM_HELPURL = "http://randomcolour.com"; Blockly.Msg.COLOUR_RANDOM_TITLE = "təsadüfi rəng"; Blockly.Msg.COLOUR_RANDOM_TOOLTIP = "Təsadüfi bir rəng seçin."; Blockly.Msg.COLOUR_RGB_BLUE = "mavi"; Blockly.Msg.COLOUR_RGB_GREEN = "yaşıl"; Blockly.Msg.COLOUR_RGB_HELPURL = "http://www.december.com/html/spec/colorper.html"; Blockly.Msg.COLOUR_RGB_RED = "qırmızı"; Blockly.Msg.COLOUR_RGB_TITLE = "rəngin komponentləri:"; Blockly.Msg.COLOUR_RGB_TOOLTIP = "Qırmızı, yaşıl və mavinin göstərilən miqdarı ilə bir rəng düzəlt. Bütün qiymətlər 0 ilə 100 arasında olmalıdır."; Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL = "https://code.google.com/p/blockly/wiki/Loops#Loop_Termination_Blocks"; Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK = "dövrdən çıx"; Blockly.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE = "dövrün növbəti addımından davam et"; Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK = "Cari dövrdən çıx."; Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE = "Bu dövrün qalanını ötür və növbəti addımla davam et."; Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING = "Xəbərdarlıq: Bu blok ancaq dövr daxilində istifadə oluna bilər."; Blockly.Msg.CONTROLS_FOREACH_HELPURL = "https://code.google.com/p/blockly/wiki/Loops#for_each"; Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST = "siyahıda"; Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL = ""; Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM = "hər element üçün"; Blockly.Msg.CONTROLS_FOREACH_TOOLTIP = "Siyahıdakı hər element üçün \"%1\" dəyişənini elementə mənimsət və bundan sonra bəzi əmrləri yerinə yetir."; Blockly.Msg.CONTROLS_FOR_HELPURL = "https://code.google.com/p/blockly/wiki/Loops#count_with"; Blockly.Msg.CONTROLS_FOR_INPUT_FROM_TO_BY = "%1 ilə başlayıb, %2 qiymətinə kimi %3 qədır dəyiş"; Blockly.Msg.CONTROLS_FOR_INPUT_WITH = "say:"; Blockly.Msg.CONTROLS_FOR_TOOLTIP = "%1 dəyişəni başlanğıc ədəddən son ədədə qədər göstərilən aralıqla qiymətlər aldıqca göstərilən blokları yerinə yetir."; Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP = "\"Əgər\" blokuna bir şərt əlavə et."; Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP = "\"Əgər\" blokuna qalan bütün halları əhatə edəb son bir şərt əlavə et."; Blockly.Msg.CONTROLS_IF_HELPURL = "http://code.google.com/p/blockly/wiki/If_Then"; Blockly.Msg.CONTROLS_IF_IF_TOOLTIP = "Bu \"əgər\" blokunu dəyişdirmək üçün bölümlərin yenisini əlavə et, sil və ya yerini dəyiş."; Blockly.Msg.CONTROLS_IF_MSG_ELSE = "əks halda"; Blockly.Msg.CONTROLS_IF_MSG_ELSEIF = "əks halda əgər"; Blockly.Msg.CONTROLS_IF_MSG_IF = "əgər"; Blockly.Msg.CONTROLS_IF_TOOLTIP_1 = "Əgər qiymət doğrudursa, onda bəzi əmrləri yerinə yetir."; Blockly.Msg.CONTROLS_IF_TOOLTIP_2 = "Əgər qiymət doğrudursa, onda birinci əmrlər blokunu yerinə yetir. Əks halda isə ikinci əmrlər blokunu yerinə yetir."; Blockly.Msg.CONTROLS_IF_TOOLTIP_3 = "Əgər birinci qiymət doğrudursa, onda birinci əmrlər blokunu yerinə yetir. Əks halda əgər ikinci qiymət doğrudursa, onda ikinci əmrlər blokunu yerinə yetir."; Blockly.Msg.CONTROLS_IF_TOOLTIP_4 = "Əgər birinci qiymət doğrudursa, onda birinci əmrlər blokunu yerinə yetir. Əks halda əgər ikinci qiymət doğrudursa, onda ikinci əmrlər blokunu yerinə yetir. Əgər qiymətlərdən heç biri doğru deyilsə, onda axırıncı əmrlər blokunu yerinə yetir."; Blockly.Msg.CONTROLS_REPEAT_HELPURL = "https://en.wikipedia.org/wiki/For_loop"; Blockly.Msg.CONTROLS_REPEAT_INPUT_DO = "yerinə yetir"; Blockly.Msg.CONTROLS_REPEAT_TITLE = "%1 dəfə təkrar et"; Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT = "təkrar et"; Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES = "dəfə"; Blockly.Msg.CONTROLS_REPEAT_TOOLTIP = "Bəzi əmrləri bir neçə dəfə yerinə yetir."; Blockly.Msg.CONTROLS_WHILEUNTIL_HELPURL = "http://code.google.com/p/blockly/wiki/Repeat"; Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL = "təkrar et, o vaxta qədər ki"; Blockly.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE = "təkrar et, hələ ki"; Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL = "Hələ ki, qiymət \"yalan\"dır, bəzi əmrləri yerinə yetir."; Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE = "Hələ ki, qiymət \"doğru\"dur, bəzi əmrləri yerinə yetir."; Blockly.Msg.DELETE_BLOCK = "Bloku sil"; Blockly.Msg.DELETE_X_BLOCKS = "%1 bloku sil"; Blockly.Msg.DISABLE_BLOCK = "Bloku söndür"; Blockly.Msg.DUPLICATE_BLOCK = "Dublikatını düzəlt"; Blockly.Msg.ENABLE_BLOCK = "Bloku aktivləşdir"; Blockly.Msg.EXPAND_ALL = "Blokları aç"; Blockly.Msg.EXPAND_BLOCK = "Bloku aç"; Blockly.Msg.EXTERNAL_INPUTS = "Xarici girişlər"; Blockly.Msg.HELP = "Kömək"; Blockly.Msg.INLINE_INPUTS = "Sətiriçi girişlər"; Blockly.Msg.LISTS_CREATE_EMPTY_HELPURL = "https://en.wikipedia.org/wiki/Linked_list#Empty_lists"; Blockly.Msg.LISTS_CREATE_EMPTY_TITLE = "boş siyahı düzəlt"; Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP = "Heç bir verilən qeyd olunmamış, uzunluğu 0 olan bir siyahı verir"; Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD = "siyahı"; Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP = "Bu siyahı blokunu yenidən konfigurasiya etmək üçün bölmələri əlavə edin, silin və ya yerlərini dəyişin."; Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH = "bunlardan siyahı düzəlt"; Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP = "Siyahıya element əlavə edin."; Blockly.Msg.LISTS_CREATE_WITH_TOOLTIP = "İstənilən ölçülü siyahı yaradın."; Blockly.Msg.LISTS_GET_INDEX_FIRST = "birinci"; Blockly.Msg.LISTS_GET_INDEX_FROM_END = "sondan # nömrəli"; Blockly.Msg.LISTS_GET_INDEX_FROM_START = "#"; Blockly.Msg.LISTS_GET_INDEX_GET = "Götürün"; Blockly.Msg.LISTS_GET_INDEX_GET_REMOVE = "Götür və sil"; Blockly.Msg.LISTS_GET_INDEX_LAST = "axırıncı"; Blockly.Msg.LISTS_GET_INDEX_RANDOM = "təsadüfi"; Blockly.Msg.LISTS_GET_INDEX_REMOVE = "Sil"; Blockly.Msg.LISTS_GET_INDEX_TAIL = ""; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST = "Siyahının ilk elementini qaytarır."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM_END = "Siyahıdan təyin olunmuş indeksli elementi qaytarır. #1 son elementdir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM_START = "Siyahıdan təyin olunmuş indeksli elementi qaytarır. #1 ilk elementdir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST = "Siyahının son elementini qaytarır."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM = "Siyahıdan hər hansı təsadüfi elementi qaytarır."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST = "Siyahıdan ilk elementi silir və qaytarır."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_END = "Siyahıdan təyin olunmuş indeksli elementi silir və qaytarır. #1 son elementdir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM_START = "Siyahıdan təyin olunmuş indeksli elementi silir və qaytarır. #1 ilk elementdir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST = "Siyahıdan son elementi silir və qaytarır."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM = "Siyahıdan təsadufi elementi silir və qaytarır."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST = "Siyahıdan ilk elementi silir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_END = "Siyahıdan təyin olunmuş indeksli elementi silir. #1 son elementdir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM_START = "Siyahıdan təyin olunmuş indeksli elementi silir. #1 ilk elementdir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST = "Siyahıdan son elementi silir."; Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM = "Siyahıdan təsadüfi elementi silir."; Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_END = "sondan # nömrəliyə"; Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START = "# nömrəliyə"; Blockly.Msg.LISTS_GET_SUBLIST_END_LAST = "Sonuncuya"; Blockly.Msg.LISTS_GET_SUBLIST_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#Getting_a_sublist"; Blockly.Msg.LISTS_GET_SUBLIST_START_FIRST = "Birincidən alt-siyahını alın"; Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_END = "# sonuncudan alt-siyahını alın"; Blockly.Msg.LISTS_GET_SUBLIST_START_FROM_START = "# - dən alt-siyahını alın"; Blockly.Msg.LISTS_GET_SUBLIST_TAIL = ""; Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP = "Siyahının təyin olunmuş hissəsinin surətini yaradın."; Blockly.Msg.LISTS_INDEX_OF_FIRST = "Element ilə ilk rastlaşma indeksini müəyyən edin"; Blockly.Msg.LISTS_INDEX_OF_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#Getting_Items_from_a_List"; Blockly.Msg.LISTS_INDEX_OF_LAST = "Element ilə son rastlaşma indeksini müəyyən edin"; Blockly.Msg.LISTS_INDEX_OF_TOOLTIP = "Siyahıda element ilə ilk/son rastlaşma indeksini qaytarır. Əgər tekst siyahıda tapılmazsa, 0 qaytarılır."; Blockly.Msg.LISTS_INLIST = "siyahıda"; Blockly.Msg.LISTS_IS_EMPTY_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#is_empty"; Blockly.Msg.LISTS_IS_EMPTY_TITLE = "%1 boşdur"; Blockly.Msg.LISTS_LENGTH_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#length_of"; Blockly.Msg.LISTS_LENGTH_TITLE = "%1 siyahısının uzunluğu"; Blockly.Msg.LISTS_LENGTH_TOOLTIP = "Siyahının uzunluğunu verir."; Blockly.Msg.LISTS_REPEAT_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#create_list_with"; Blockly.Msg.LISTS_REPEAT_TITLE = "%1 elementinin siyahıda %2 dəfə təkrarlandığı siyahı yaradım"; Blockly.Msg.LISTS_REPEAT_TOOLTIP = "Təyin olunmuş elementin/qiymətin təyin olunmuş sayda təkrarlandığı siyahını yaradır."; Blockly.Msg.LISTS_SET_INDEX_HELPURL = "https://code.google.com/p/blockly/wiki/Lists#in_list_..._set"; Blockly.Msg.LISTS_SET_INDEX_INPUT_TO = "Kimi"; Blockly.Msg.LISTS_SET_INDEX_INSERT = "daxil et"; Blockly.Msg.LISTS_SET_INDEX_SET = "təyin et"; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST = "Elementi siyahının əvvəlinə daxil edir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_END = "Elementi siyahıda göstərilən yerə daxil edir. #1 axırıncı elementdir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM_START = "Elementi siyahıda göstərilən yerə daxil edir. #1 birinci elementdir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST = "Elementi siyahının sonuna artırır."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM = "Elementi siyahıda təsadüfi seçilmiş bir yerə atır."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST = "Siyahıda birinci elementi təyin edir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM_END = "Siyahının göstərilən yerdəki elementini təyin edir. #1 axırıncı elementdir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM_START = "Siyahının göstərilən yerdəki elementini təyin edir. #1 birinci elementdir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST = "Siyahının sonuncu elementini təyin edir."; Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM = "Siyahının təsadüfi seçilmiş bir elementini təyin edir."; Blockly.Msg.LISTS_TOOLTIP = "Siyahı boşdursa \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_BOOLEAN_FALSE = "yalan"; Blockly.Msg.LOGIC_BOOLEAN_HELPURL = "http://code.google.com/p/blockly/wiki/True_False"; Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP = "\"doğru\" və ya \"yalan\" cavanını qaytarır."; Blockly.Msg.LOGIC_BOOLEAN_TRUE = "doğru"; Blockly.Msg.LOGIC_COMPARE_HELPURL = "https://en.wikipedia.org/wiki/Inequality_(mathematics)"; Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ = "Girişlər bir birinə bərabərdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GT = "Birinci giriş ikincidən böyükdürsə \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_COMPARE_TOOLTIP_GTE = "Birinci giriş ikincidən böyük və ya bərarbərdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LT = "Birinci giriş ikincidən kiçikdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_COMPARE_TOOLTIP_LTE = "Birinci giriş ikincidən kiçik və ya bərarbərdirsə \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ = "Girişlər bərabər deyillərsə \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_NEGATE_HELPURL = "http://code.google.com/p/blockly/wiki/Not"; Blockly.Msg.LOGIC_NEGATE_TITLE = "%1 deyil"; Blockly.Msg.LOGIC_NEGATE_TOOLTIP = "Giriş \"yalan\"-dursa \"doğru\" cavabını qaytarır. Giriş \"doğru\"-dursa \"yalan\" cavabını qaytarır."; Blockly.Msg.LOGIC_NULL = "boş"; Blockly.Msg.LOGIC_NULL_HELPURL = "https://en.wikipedia.org/wiki/Nullable_type"; Blockly.Msg.LOGIC_NULL_TOOLTIP = "Boş cavab qaytarır."; Blockly.Msg.LOGIC_OPERATION_AND = "və"; Blockly.Msg.LOGIC_OPERATION_HELPURL = "http://code.google.com/p/blockly/wiki/And_Or"; Blockly.Msg.LOGIC_OPERATION_OR = "və ya"; Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND = "Hər iki giriş \"doğru\"-dursa \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR = "Girişlərdən heç olmasa biri \"doğru\"-dursa \"doğru\" cavabını qaytarır."; Blockly.Msg.LOGIC_TERNARY_CONDITION = "yoxla"; Blockly.Msg.LOGIC_TERNARY_HELPURL = "https://en.wikipedia.org/wiki/%3F:"; Blockly.Msg.LOGIC_TERNARY_IF_FALSE = "əgər yalandırsa"; Blockly.Msg.LOGIC_TERNARY_IF_TRUE = "əgər doğrudursa"; Blockly.Msg.LOGIC_TERNARY_TOOLTIP = "'Yoxla' əmrindəki şərtə nəzər yetirin. Əgər şərt \"doğru\"-dursa \"əgər doğru\", əks halda isə \"əgər yalan\" cavabını qaytarır."; Blockly.Msg.MATH_ADDITION_SYMBOL = "+"; Blockly.Msg.MATH_ARITHMETIC_HELPURL = "https://az.wikipedia.org/wiki/Hesab"; Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD = "İki ədədin cəmini qaytarır."; Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE = "İki ədədin nisbətini qaytarır."; Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS = "İki ədədin fərqini qaytarır."; Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY = "İki ədədin hasilini verir."; Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_POWER = "Birinci ədədin ikinci ədəd dərəcəsindən qüvvətini qaytarır."; Blockly.Msg.MATH_CHANGE_HELPURL = "https://en.wikipedia.org/wiki/Programming_idiom#Incrementing_a_counter"; Blockly.Msg.MATH_CHANGE_INPUT_BY = "buna:"; Blockly.Msg.MATH_CHANGE_TITLE_CHANGE = "dəyiş:"; Blockly.Msg.MATH_CHANGE_TOOLTIP = "'%1' dəyişəninin üzərinə bir ədəd artır."; Blockly.Msg.MATH_CONSTANT_HELPURL = "https://en.wikipedia.org/wiki/Mathematical_constant"; Blockly.Msg.MATH_CONSTANT_TOOLTIP = "Ümumi sabitlərdən birini qaytarır π (3.141…), e (2.718…), φ (1.618…), sqrt(2) (1.414…), sqrt(½) (0.707…), və ya ∞ (sonsuzluq)."; Blockly.Msg.MATH_CONSTRAIN_HELPURL = "https://en.wikipedia.org/wiki/Clamping_%28graphics%29"; Blockly.Msg.MATH_CONSTRAIN_TITLE = "%1 üçün ən aşağı %2, ən yuxarı %3 olmağı tələb et"; Blockly.Msg.MATH_CONSTRAIN_TOOLTIP = "Bir ədədin verilmiş iki ədəd arasında olmasını tələb edir (sərhədlər də daxil olmaqla)."; Blockly.Msg.MATH_DIVISION_SYMBOL = "÷"; Blockly.Msg.MATH_IS_DIVISIBLE_BY = "bölünür"; Blockly.Msg.MATH_IS_EVEN = "cütdür"; Blockly.Msg.MATH_IS_NEGATIVE = "mənfidir"; Blockly.Msg.MATH_IS_ODD = "təkdir"; Blockly.Msg.MATH_IS_POSITIVE = "müsətdir"; Blockly.Msg.MATH_IS_PRIME = "sadədir"; Blockly.Msg.MATH_IS_TOOLTIP = "Bir ədədin cüt, tək, sadə, mürəkkəb, mənfi, müsbət olmasını və ya müəyyən bir ədədə bölünməsini yoxlayır. \"Doğru\" və ya \"yalan\" cavablarını qaytarır."; Blockly.Msg.MATH_IS_WHOLE = "mürəkkəbdir"; Blockly.Msg.MATH_MODULO_HELPURL = "https://en.wikipedia.org/wiki/Modulo_operation"; Blockly.Msg.MATH_MODULO_TITLE = "%1 ÷ %2 bölməsinin qalığı"; Blockly.Msg.MATH_MODULO_TOOLTIP = "İki ədədin nisbətindən alınan qalığı qaytarır."; Blockly.Msg.MATH_MULTIPLICATION_SYMBOL = "×"; Blockly.Msg.MATH_NUMBER_HELPURL = "https://en.wikipedia.org/wiki/Number"; Blockly.Msg.MATH_NUMBER_TOOLTIP = "Ədəd."; Blockly.Msg.MATH_ONLIST_HELPURL = ""; Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE = "siyahının ədədi ortası"; Blockly.Msg.MATH_ONLIST_OPERATOR_MAX = "siyahının maksimumu"; Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN = "siyahının medianı"; Blockly.Msg.MATH_ONLIST_OPERATOR_MIN = "siyahının minimumu"; Blockly.Msg.MATH_ONLIST_OPERATOR_MODE = "Siyahı modları( Ən çox rastlaşılan elementləri)"; Blockly.Msg.MATH_ONLIST_OPERATOR_RANDOM = "siyahıdan təsadüfi seçilmiş bir element"; Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV = "Siyahının standart deviasiyası"; Blockly.Msg.MATH_ONLIST_OPERATOR_SUM = "Siyahının cəmi"; Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE = "Siyahıdaki ədədlərin ədədi ortasını qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX = "Siyahıdaki ən böyük elementi qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN = "Siyahının median elementini qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN = "Siyahıdaki ən kiçik ədədi qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE = "Siyahıdaki ən çox rastlanan element(lər)dən ibarət siyahı qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_RANDOM = "Siyahıdan təsadüfi bir element qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV = "Siyahının standart deviasiyasını qaytarır."; Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM = "Siyahıdakı bütün ədədlərin cəmini qaytarır."; Blockly.Msg.MATH_POWER_SYMBOL = "^"; Blockly.Msg.MATH_RANDOM_FLOAT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation"; Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM = "təsadüfi kəsr"; Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP = "0.0 (daxil olmaqla) və 1.0 (daxil olmamaqla) ədədlərinin arasından təsadüfi bir kəsr ədəd qaytarır."; Blockly.Msg.MATH_RANDOM_INT_HELPURL = "https://en.wikipedia.org/wiki/Random_number_generation"; Blockly.Msg.MATH_RANDOM_INT_TITLE = "%1 ilə %2 arasından təsadüfi tam ədəd"; Blockly.Msg.MATH_RANDOM_INT_TOOLTIP = "Verilmiş iki ədəd arasından (ədədrlər də daxil olmaqla) təsadüfi bir tam ədəd qaytarır."; Blockly.Msg.MATH_ROUND_HELPURL = "https://en.wikipedia.org/wiki/Rounding"; Blockly.Msg.MATH_ROUND_OPERATOR_ROUND = "yuvarlaq"; Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN = "aşağı yuvarlaqlaşdır"; Blockly.Msg.MATH_ROUND_OPERATOR_ROUNDUP = "yuxarı yuvarlaqlaşdır"; Blockly.Msg.MATH_ROUND_TOOLTIP = "Ədədi aşağı və ya yuxari yuvarlaqşdır."; Blockly.Msg.MATH_SINGLE_HELPURL = "https://en.wikipedia.org/wiki/Square_root"; Blockly.Msg.MATH_SINGLE_OP_ABSOLUTE = "modul"; Blockly.Msg.MATH_SINGLE_OP_ROOT = "kvadrat kök"; Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS = "Ədədin modulunu qaytarır."; Blockly.Msg.MATH_SINGLE_TOOLTIP_EXP = "e sabitinin verilmiş ədədə qüvvətini qaytarır."; Blockly.Msg.MATH_SINGLE_TOOLTIP_LN = "Ədədin natural loqarifmini tapır."; Blockly.Msg.MATH_SINGLE_TOOLTIP_LOG10 = "Ədədin 10-cu dərəcədən loqarifmini tapır."; Blockly.Msg.MATH_SINGLE_TOOLTIP_NEG = "Ədədin əksini qaytarır."; Blockly.Msg.MATH_SINGLE_TOOLTIP_POW10 = "10-un verilmiş ədədə qüvvətini qaytarır."; Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT = "Ədədin kvadrat kökünü qaytarır."; Blockly.Msg.MATH_SUBTRACTION_SYMBOL = "-"; Blockly.Msg.MATH_TRIG_ACOS = "arccos"; Blockly.Msg.MATH_TRIG_ASIN = "arcsin"; Blockly.Msg.MATH_TRIG_ATAN = "arctan"; Blockly.Msg.MATH_TRIG_COS = "cos"; Blockly.Msg.MATH_TRIG_HELPURL = "https://en.wikipedia.org/wiki/Trigonometric_functions"; Blockly.Msg.MATH_TRIG_SIN = "sin"; Blockly.Msg.MATH_TRIG_TAN = "tg"; Blockly.Msg.MATH_TRIG_TOOLTIP_ACOS = "Ədədin arccosinusunu qaytarır."; Blockly.Msg.MATH_TRIG_TOOLTIP_ASIN = "Ədədin arcsinusunu qaytarır."; Blockly.Msg.MATH_TRIG_TOOLTIP_ATAN = "Ədədin arctanqensini qaytarır."; Blockly.Msg.MATH_TRIG_TOOLTIP_COS = "Dərəcənin kosinusunu qaytarır (radianın yox)."; Blockly.Msg.MATH_TRIG_TOOLTIP_SIN = "Dərəcənin sinusunu qaytar (radianın yox)."; Blockly.Msg.MATH_TRIG_TOOLTIP_TAN = "Dərəcənin tangensini qaytar (radianın yox)."; Blockly.Msg.NEW_VARIABLE = "Yeni dəyişən..."; Blockly.Msg.NEW_VARIABLE_TITLE = "Yeni dəyişənin adı:"; Blockly.Msg.ORDINAL_NUMBER_SUFFIX = ""; Blockly.Msg.PROCEDURES_BEFORE_PARAMS = "ilə:"; Blockly.Msg.PROCEDURES_CALLNORETURN_CALL = ""; Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP = "Yaradılmış '%1' funksiyasını çalışdır."; Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP = "Yaradılmış '%1' funksiyasını çalışdır və nəticəni istifadə et."; Blockly.Msg.PROCEDURES_CREATE_DO = "'%1' yarat"; Blockly.Msg.PROCEDURES_DEFNORETURN_DO = ""; Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE = "hansısa əməliyyat"; Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE = "icra et:"; Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP = "Nəticəsi olmayan funksiya yaradır."; Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL = "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29"; Blockly.Msg.PROCEDURES_DEFRETURN_RETURN = "qaytar"; Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP = "Nəticəsi olan funksiya yaradır."; Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING = "Xəbərdarlıq: Bu funksiyanın təkrar olunmuş parametrləri var."; Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF = "Funksiyanın təyinatını vurğula"; Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP = "Əgər bir dəyər \"doğru\"-dursa onda ikinci dəyəri qaytar."; Blockly.Msg.PROCEDURES_IFRETURN_WARNING = "Xəbərdarlıq: Bu blok ancaq bir funksiyanın təyinatı daxilində işlədilə bilər."; Blockly.Msg.PROCEDURES_MUTATORARG_TITLE = "Giriş adı:"; Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE = "girişlər"; Blockly.Msg.REMOVE_COMMENT = "Şərhi sil"; Blockly.Msg.RENAME_VARIABLE = "Dəyişənin adını dəyiş..."; Blockly.Msg.RENAME_VARIABLE_TITLE = "Bütün '%1' dəyişənlərinin adını buna dəyiş:"; Blockly.Msg.TEXT_APPEND_APPENDTEXT = "bu mətni əlavə et:"; Blockly.Msg.TEXT_APPEND_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_modification"; Blockly.Msg.TEXT_APPEND_TO = "bu mətnin sonuna:"; Blockly.Msg.TEXT_APPEND_TOOLTIP = "'%1' dəyişəninin sonuna nəsə əlavə et."; Blockly.Msg.TEXT_CHANGECASE_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Adjusting_text_case"; Blockly.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE = "kiçik hərflərlə"; Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE = "Baş Hərflərlə"; Blockly.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE = "BÖYÜK HƏRFLƏRLƏ"; Blockly.Msg.TEXT_CHANGECASE_TOOLTIP = "Mətndə hərflərin böyük-kiçikliyini dəyiş."; Blockly.Msg.TEXT_CHARAT_FIRST = "birinci hərfi götür"; Blockly.Msg.TEXT_CHARAT_FROM_END = "axırdan bu nömrəli hərfi götür"; Blockly.Msg.TEXT_CHARAT_FROM_START = "bu nömrəli hərfi götür"; Blockly.Msg.TEXT_CHARAT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Extracting_text"; Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT = "növbəti mətndə"; Blockly.Msg.TEXT_CHARAT_LAST = "axırıncı hərfi götür"; Blockly.Msg.TEXT_CHARAT_RANDOM = "təsadüfi hərf götür"; Blockly.Msg.TEXT_CHARAT_TAIL = ""; Blockly.Msg.TEXT_CHARAT_TOOLTIP = "Göstərilən mövqedəki hərfi qaytarır."; Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP = "Mətnə bir element əlavə et."; Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN = "birləşdir"; Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP = "Bu mətn blokunu yenidən konfigurasiya etmək üçün bölmələri əlavə edin, silin və ya yerlərini dəyişin."; Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_END = "axırdan bu nömrəli hərfə qədər"; Blockly.Msg.TEXT_GET_SUBSTRING_END_FROM_START = "bu nömrəli hərfə qədər"; Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST = "son hərfə qədər"; Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL = "http://code.google.com/p/blockly/wiki/Text#Extracting_a_region_of_text"; Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT = "mətndə"; Blockly.Msg.TEXT_GET_SUBSTRING_START_FIRST = "Mətnin surətini ilk hərfdən"; Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_END = "Mətnin surətini sondan bu nömrəli # hərfdən"; Blockly.Msg.TEXT_GET_SUBSTRING_START_FROM_START = "Mətnin surətini bu nömrəli hərfdən"; Blockly.Msg.TEXT_GET_SUBSTRING_TAIL = ""; Blockly.Msg.TEXT_GET_SUBSTRING_TOOLTIP = "Mətnin təyin olunmuş hissəsini qaytarır."; Blockly.Msg.TEXT_INDEXOF_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Finding_text"; Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT = "mətndə"; Blockly.Msg.TEXT_INDEXOF_OPERATOR_FIRST = "Bu mətn ilə ilk rastlaşmanı tap:"; Blockly.Msg.TEXT_INDEXOF_OPERATOR_LAST = "Bu mətn ilə son rastlaşmanı tap:"; Blockly.Msg.TEXT_INDEXOF_TAIL = ""; Blockly.Msg.TEXT_INDEXOF_TOOLTIP = "Birinci mətnin ikinci mətndə ilk/son rastlaşma indeksini qaytarır. Əgər rastlaşma baş verməzsə, 0 qaytarır."; Blockly.Msg.TEXT_ISEMPTY_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Checking_for_empty_text"; Blockly.Msg.TEXT_ISEMPTY_TITLE = "%1 boşdur"; Blockly.Msg.TEXT_ISEMPTY_TOOLTIP = "Verilmiş mətn boşdursa, doğru qiymətini qaytarır."; Blockly.Msg.TEXT_JOIN_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_creation"; Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH = "Verilmişlərlə mətn yarat"; Blockly.Msg.TEXT_JOIN_TOOLTIP = "İxtiyari sayda elementlərinin birləşməsi ilə mətn parçası yarat."; Blockly.Msg.TEXT_LENGTH_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Text_modification"; Blockly.Msg.TEXT_LENGTH_TITLE = "%1 - ın uzunluğu"; Blockly.Msg.TEXT_LENGTH_TOOLTIP = "Verilmiş mətndəki hərflərin(sözlər arası boşluqlar sayılmaqla) sayını qaytarır."; Blockly.Msg.TEXT_PRINT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Printing_text"; Blockly.Msg.TEXT_PRINT_TITLE = "%1 - i çap elə"; Blockly.Msg.TEXT_PRINT_TOOLTIP = "Təyin olunmuş mətn, ədəd və ya hər hansı bir başqa elementi çap elə."; Blockly.Msg.TEXT_PROMPT_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Getting_input_from_the_user"; Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER = "İstifadəçiyə ədəd daxil etməsi üçün sorğu/tələb göndərin."; Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT = "İstifadəçiyə mətn daxil etməsi üçün sorğu/tələb göndərin."; Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER = "İstifadəçiyə ədəd daxil etməsi üçün sorğunu/tələbi ismarıc kimi göndərin"; Blockly.Msg.TEXT_PROMPT_TYPE_TEXT = "İstifadəçiyə mətn daxil etməsi üçün sorğunu/tələbi ismarıc ilə göndərin"; Blockly.Msg.TEXT_TEXT_HELPURL = "https://en.wikipedia.org/wiki/String_(computer_science)"; Blockly.Msg.TEXT_TEXT_TOOLTIP = "Mətndəki hərf, söz və ya sətir."; Blockly.Msg.TEXT_TRIM_HELPURL = "https://code.google.com/p/blockly/wiki/Text#Trimming_%28removing%29_spaces"; Blockly.Msg.TEXT_TRIM_OPERATOR_BOTH = "Boşluqları hər iki tərəfdən pozun"; Blockly.Msg.TEXT_TRIM_OPERATOR_LEFT = "Boşluqlari yalnız sol tərəfdən pozun"; Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT = "Boşluqları yalnız sağ tərəfdən pozun"; Blockly.Msg.TEXT_TRIM_TOOLTIP = "Mətnin hər iki və ya yalnız bir tərəfdən olan boşluqları pozulmuş surətini qaytarın."; Blockly.Msg.VARIABLES_DEFAULT_NAME = "element"; Blockly.Msg.VARIABLES_GET_CREATE_SET = "'%1 - i təyin et' - i yarat"; Blockly.Msg.VARIABLES_GET_HELPURL = "http://code.google.com/p/blockly/wiki/Variables#Get"; Blockly.Msg.VARIABLES_GET_TAIL = ""; Blockly.Msg.VARIABLES_GET_TITLE = ""; Blockly.Msg.VARIABLES_GET_TOOLTIP = "Bu dəyişənin qiymətini qaytarır."; Blockly.Msg.VARIABLES_SET_CREATE_GET = "'%1 - i götür' - ü yarat"; Blockly.Msg.VARIABLES_SET_HELPURL = "http://code.google.com/p/blockly/wiki/Variables#Set"; Blockly.Msg.VARIABLES_SET_TAIL = "- i bu qiymət ilə təyin et:"; Blockly.Msg.VARIABLES_SET_TITLE = " "; Blockly.Msg.VARIABLES_SET_TOOLTIP = "Bu dəyişəni daxil edilmiş qiymətə bərabər edir."; Blockly.Msg.PROCEDURES_DEFRETURN_TITLE = Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE; Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST; Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST; Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE = Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE; Blockly.Msg.VARIABLES_SET_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME; Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE = Blockly.Msg.VARIABLES_DEFAULT_NAME; Blockly.Msg.MATH_CHANGE_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME; Blockly.Msg.VARIABLES_GET_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME; Blockly.Msg.PROCEDURES_DEFRETURN_DO = Blockly.Msg.PROCEDURES_DEFNORETURN_DO; Blockly.Msg.LISTS_GET_INDEX_HELPURL = Blockly.Msg.LISTS_INDEX_OF_HELPURL; Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM = Blockly.Msg.VARIABLES_DEFAULT_NAME; Blockly.Msg.CONTROLS_IF_MSG_THEN = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO; Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST; Blockly.Msg.PROCEDURES_CALLRETURN_CALL = Blockly.Msg.PROCEDURES_CALLNORETURN_CALL; Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST = Blockly.Msg.LISTS_INLIST; Blockly.Msg.CONTROLS_FOR_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO; Blockly.Msg.CONTROLS_FOREACH_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO; Blockly.Msg.CONTROLS_IF_IF_TITLE_IF = Blockly.Msg.CONTROLS_IF_MSG_IF; Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO = Blockly.Msg.CONTROLS_REPEAT_INPUT_DO; Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF = Blockly.Msg.CONTROLS_IF_MSG_ELSEIF; Blockly.Msg.TEXT_APPEND_VARIABLE = Blockly.Msg.VARIABLES_DEFAULT_NAME; Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE = Blockly.Msg.CONTROLS_IF_MSG_ELSE;
"use strict"; var m = require("mithril"), assign = require("lodash.assign"), id = require("./lib/id"), hide = require("./lib/hide"), label = require("./lib/label"), css = require("./textarea.css"); module.exports = { controller : function(options) { var ctrl = this; ctrl.id = id(options); ctrl.text = options.data || ""; ctrl.resize = function(opt, value) { opt.update(opt.path, value); ctrl.text = value; }; }, view : function(ctrl, options) { var field = options.field, hidden = hide(options); if(hidden) { return hidden; } return m("div", { class : options.class }, label(ctrl, options), m("div", { class : css.expander }, m("pre", { class : css.shadow }, m("span", ctrl.text), m("br")), m("textarea", assign({ // attrs id : ctrl.id, class : css.textarea, required : field.required ? "required" : null, // events oninput : m.withAttr("value", ctrl.resize.bind(null, options)) }, field.attrs || {} ), options.data || "") ) ); } };
(function() { "use strict"; angular .module('app.users', [ 'app.core' ]); })();
var Plugin = require('./baseplugin'), request = require('request-promise'); class Spotify extends Plugin { init() { this.httpRegex = /(?:https?:\/\/)?open\.spotify\.com\/(album|track|user\/[^\/]+\/playlist)\/([a-zA-Z0-9]+)/; this.uriRegex = /^spotify:(album|track|user:[^:]+:playlist):([a-zA-Z0-9]+)$/; } canHandle(url) { return this.httpRegex.test(url) || this.uriRegex.test(url); } run(url) { var options = { url: `https://embed.spotify.com/oembed/?url=${url}`, headers: {'User-Agent': 'request'} }; return request.get(options) .then(body => JSON.parse(body).html) .then(html => ({ type: 'spotify', html: html })); } } module.exports = Spotify;
'use strict'; const fs = require('fs'), _ = require('lodash'); let config = require('./_default'); const ENV_NAME = process.env.NODE_ENV || process.env.ENV; const ENVIRONMENT_FILE = `${__dirname}/_${ENV_NAME}.js`; // Merge with ENV file if exits. if (fs.existsSync(ENVIRONMENT_FILE)) { const env = require(ENVIRONMENT_FILE); config = _.mergeWith(config, env); } module.exports = config;
import now from './now.js'; /** * This function transforms stored pixel values into a canvas image data buffer * by using a LUT. * * @param {Image} image A Cornerstone Image Object * @param {Array} lut Lookup table array * @param {Uint8ClampedArray} canvasImageDataData canvasImageData.data buffer filled with white pixels * * @returns {void} */ export default function (image, lut, canvasImageDataData) { let start = now(); const pixelData = image.getPixelData(); image.stats.lastGetPixelDataTime = now() - start; const numPixels = pixelData.length; const minPixelValue = image.minPixelValue; let canvasImageDataIndex = 0; let storedPixelDataIndex = 0; let pixelValue; // NOTE: As of Nov 2014, most javascript engines have lower performance when indexing negative indexes. // We have a special code path for this case that improves performance. Thanks to @jpambrun for this enhancement // Added two paths (Int16Array, Uint16Array) to avoid polymorphic deoptimization in chrome. start = now(); if (pixelData instanceof Int16Array) { if (minPixelValue < 0) { while (storedPixelDataIndex < numPixels) { pixelValue = lut[pixelData[storedPixelDataIndex++] + (-minPixelValue)]; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = 255; // Alpha } } else { while (storedPixelDataIndex < numPixels) { pixelValue = lut[pixelData[storedPixelDataIndex++]]; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = 255; // Alpha } } } else if (pixelData instanceof Uint16Array) { while (storedPixelDataIndex < numPixels) { pixelValue = lut[pixelData[storedPixelDataIndex++]]; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = 255; // Alpha } } else if (minPixelValue < 0) { while (storedPixelDataIndex < numPixels) { pixelValue = lut[pixelData[storedPixelDataIndex++] + (-minPixelValue)]; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = 255; // Alpha } } else { while (storedPixelDataIndex < numPixels) { pixelValue = lut[pixelData[storedPixelDataIndex++]]; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = pixelValue; canvasImageDataData[canvasImageDataIndex++] = 255; // Alpha } } image.stats.lastStoredPixelDataToCanvasImageDataTime = now() - start; }
module.exports = function() { function CreditsCommand() { return { name: 'credits', params: '[none]', execute: function(data, sandbox) { var msg = '\nCREDITS:\n'; msg += 'Hack Bot\n'; msg += 'version: v1\n'; msg += 'created by: R.M.C. (hacktastic)\n\n\n'; sandbox.sendChannelMessage(msg); } }; } return new CreditsCommand(); };
'use strict'; const Bluebird = require('bluebird'); const Book = require('./helpers/book'); const Counter = require('../lib/counter'); const Genre = require('./helpers/genre'); const Redis = require('./helpers/redis'); describe('counter', () => { describe('count', () => { it('returns the count for a model without a filter function', () => { const request = {}; return Counter.count(Genre, request) .then((count) => { expect(count).to.eql(3); }); }); it('returns the count for a model with a filter function', () => { const request = { query: { filter: { year: 1984 } }, auth: { credentials: {} } }; return Counter.count(Book, request) .then((count) => { expect(count).to.eql(2); }); }); it('saves the count to redis under the given key with a ttl when a redis client is given', () => { const key = 'key'; const ttl = () => 10; const request = { query: { filter: { year: 1984 } }, auth: { credentials: {} } }; return Counter.count(Book, request, Redis, key, ttl) .then(() => { return Bluebird.all([ Redis.getAsync(key), Redis.ttlAsync(key) ]); }) .spread((cachedCount, cachedTtl) => { expect(cachedCount).to.eql('2'); expect(cachedTtl).to.eql(10); }); }); }); });
// Dependencies let builder = require('focus').component.builder; let React = require('react'); let checkIsNotNull = require('focus').util.object.checkIsNotNull; let type = require('focus').component.types; let find = require('lodash/collection/find'); // Mixins let translationMixin = require('../../common/i18n').mixin; let infiniteScrollMixin = require('../mixin/infinite-scroll').mixin; let referenceMixin = require('../../common/mixin/reference-property'); // Components let Button = require('../../common/button/action').component; let listMixin = { /** * Display name. */ displayName: 'selection-list', /** * Mixin dependancies. */ mixins: [translationMixin, infiniteScrollMixin, referenceMixin], /** * Default properties for the list. * @returns {{isSelection: boolean}} the default properties */ getDefaultProps: function getListDefaultProps(){ return { data: [], isSelection: true, selectionStatus: 'partial', selectionData: [], isLoading: false, operationList: [], idField: 'id' }; }, /** * list property validation. * @type {Object} */ propTypes: { data: type('array'), idField: type('string'), isLoading: type('bool'), isSelection: type('bool'), lineComponent: type('func', true), loader: type('func'), onLineClick: type('func'), onSelection: type('func'), operationList: type('array'), selectionData: type('array'), selectionStatus: type('string') }, /** * called before component mount */ componentWillMount() { checkIsNotNull('lineComponent', this.props.lineComponent); }, /** * Return selected items in the list. * @return {Array} selected items */ getSelectedItems() { let selected = []; for(let i = 1; i < this.props.data.length + 1; i++){ let lineName = 'line' + i; let lineValue = this.refs[lineName].getValue(); if(lineValue.isSelected){ selected.push(lineValue.item); } } return selected; }, /** * Render lines of the list. * @returns {*} DOM for lines */ _renderLines() { let lineCount = 1; let {data, lineComponent, selectionStatus, idField, isSelection, selectionData, onSelection, onLineClick, operationList} = this.props; return data.map((line) => { let isSelected; let selection = find(selectionData, {[idField]: line[idField]}); if (selection) { isSelected = selection.isSelected; } else { switch(selectionStatus){ case 'none': isSelected = false; break; case 'selected': isSelected = true; break; case 'partial': isSelected = undefined; break; default: isSelected = false; } } return React.createElement(lineComponent, { key: line[idField], data: line, ref: `line${lineCount++}`, isSelection: isSelection, isSelected: isSelected, onSelection: onSelection, onLineClick: onLineClick, operationList: operationList, reference: this._getReference() }); }); }, _renderLoading() { if(this.props.isLoading){ if(this.props.loader){ return this.props.loader(); } return ( <li className='sl-loading'>{this.i18n('list.loading')} ...</li> ); } }, _renderManualFetch() { if(this.props.isManualFetch && this.props.hasMoreData){ let style = {className: 'primary'}; return ( <li className='sl-button'> <Button handleOnClick={this.handleShowMore} label='list.button.showMore' style={style} type='button' /> </li> ); } }, /** * Render the list. * @returns {XML} DOM of the component */ render() { return ( <ul data-focus='selection-list'> {this._renderLines()} {this._renderLoading()} {this._renderManualFetch()} </ul> ); } }; module.exports = builder(listMixin);
import { createAction } from 'redux-actions'; import axios from '../../../utils/APIHelper'; export const CATEGORY_FORM_UPDATE = 'CATEGORY_FORM_UPDATE'; export const CATEGORY_FORM_RESET = 'CATEGORY_FORM_RESET'; export const categoryFormUpdate = createAction(CATEGORY_FORM_UPDATE); export const categoryFormReset = createAction(CATEGORY_FORM_RESET); export function requestCreateCategory(attrs) { return (dispatch) => { dispatch(categoryFormUpdate()); return axios.post('/api/categories', { category: attrs }) .then(response => { dispatch(categoryFormReset()); return response.data.category; }, e => dispatch(categoryFormUpdate(e))); }; }
'use strict'; /** * Module dependencies */ var forumsPolicy = require('../policies/forums.server.policy'), forums = require('../controllers/forums.server.controller'); module.exports = function (app) { // Forums collection routes app.route('/api/forums').all(forumsPolicy.isAllowed) .get(forums.list) .post(forums.create); // Single forum routes app.route('/api/forums/:forumId').all(forumsPolicy.isAllowed) .get(forums.read) .put(forums.update) .delete(forums.delete); // Finish by binding the forum middleware app.param('forumId', forums.forumByID); };
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _index = _interopRequireDefault(require("../../index")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var Custom = /*#__PURE__*/ function (_Smooth) { _inherits(Custom, _Smooth); function Custom(opt) { var _this; _classCallCheck(this, Custom); _this = _possibleConstructorReturn(this, _getPrototypeOf(Custom).call(this, opt)); _this.perfs = { now: null, last: null }; _this.dom.section = opt.section; return _this; } _createClass(Custom, [{ key: "init", value: function init() { _get(_getPrototypeOf(Custom.prototype), "init", this).call(this); } }, { key: "run", value: function run() { this.perfs.now = window.performance.now(); _get(_getPrototypeOf(Custom.prototype), "run", this).call(this); this.dom.section.style[this.prefix] = this.getTransform(-this.vars.current.toFixed(2)); console.log(this.perfs.now - this.perfs.last); this.perfs.last = this.perfs.now; } }, { key: "resize", value: function resize() { this.vars.bounding = this.dom.section.getBoundingClientRect().height - this.vars.height; _get(_getPrototypeOf(Custom.prototype), "resize", this).call(this); } }]); return Custom; }(_index["default"]); var _default = Custom; exports["default"] = _default; },{"../../index":3}],2:[function(require,module,exports){ "use strict"; var _custom = _interopRequireDefault(require("./custom")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var scroll = new _custom["default"]({ "extends": true, section: document.querySelector('.vs-section') }); scroll.init(); },{"./custom":1}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _domClasses = _interopRequireDefault(require("dom-classes")); var _domCreateElement = _interopRequireDefault(require("dom-create-element")); var _prefix = _interopRequireDefault(require("prefix")); var _virtualScroll = _interopRequireDefault(require("virtual-scroll")); var _domEvents = _interopRequireDefault(require("dom-events")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var Smooth = /*#__PURE__*/ function () { function Smooth() { var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, Smooth); this.createBound(); this.options = opt; this.prefix = (0, _prefix["default"])('transform'); this.rAF = undefined; // It seems that under heavy load, Firefox will still call the RAF callback even though the RAF has been canceled // To prevent that we set a flag to prevent any callback to be executed when RAF is removed this.isRAFCanceled = false; var constructorName = this.constructor.name ? this.constructor.name : 'Smooth'; this["extends"] = typeof opt["extends"] === 'undefined' ? this.constructor !== Smooth : opt["extends"]; this.callback = this.options.callback || null; this.vars = { direction: this.options.direction || 'vertical', "native": this.options["native"] || false, ease: this.options.ease || 0.075, preload: this.options.preload || false, current: 0, last: 0, target: 0, height: window.innerHeight, width: window.innerWidth, bounding: 0, timer: null, ticking: false }; this.vs = this.vars["native"] ? null : new _virtualScroll["default"]({ limitInertia: this.options.vs && this.options.vs.limitInertia || false, mouseMultiplier: this.options.vs && this.options.vs.mouseMultiplier || 1, touchMultiplier: this.options.vs && this.options.vs.touchMultiplier || 1.5, firefoxMultiplier: this.options.vs && this.options.vs.firefoxMultiplier || 30, preventTouch: this.options.vs && this.options.vs.preventTouch || true }); this.dom = { listener: this.options.listener || document.body, section: this.options.section || document.querySelector('.vs-section') || null, scrollbar: this.vars["native"] || this.options.noscrollbar ? null : { state: { clicked: false, x: 0 }, el: (0, _domCreateElement["default"])({ selector: 'div', styles: "vs-scrollbar vs-".concat(this.vars.direction, " vs-scrollbar-").concat(constructorName.toLowerCase()) }), drag: { el: (0, _domCreateElement["default"])({ selector: 'div', styles: 'vs-scrolldrag' }), delta: 0, height: 50 } } }; } _createClass(Smooth, [{ key: "createBound", value: function createBound() { var _this = this; ['run', 'calc', 'debounce', 'resize', 'mouseUp', 'mouseDown', 'mouseMove', 'calcScroll', 'scrollTo'].forEach(function (fn) { return _this[fn] = _this[fn].bind(_this); }); } }, { key: "init", value: function init() { this.addClasses(); this.vars.preload && this.preloadImages(); this.vars["native"] ? this.addFakeScrollHeight() : !this.options.noscrollbar && this.addFakeScrollBar(); this.addEvents(); this.resize(); } }, { key: "addClasses", value: function addClasses() { var type = this.vars["native"] ? 'native' : 'virtual'; var direction = this.vars.direction === 'vertical' ? 'y' : 'x'; _domClasses["default"].add(this.dom.listener, "is-".concat(type, "-scroll")); _domClasses["default"].add(this.dom.listener, "".concat(direction, "-scroll")); } }, { key: "preloadImages", value: function preloadImages() { var _this2 = this; var images = Array.prototype.slice.call(this.dom.listener.querySelectorAll('img'), 0); images.forEach(function (image) { var img = document.createElement('img'); _domEvents["default"].once(img, 'load', function () { images.splice(images.indexOf(image), 1); images.length === 0 && _this2.resize(); }); img.src = image.getAttribute('src'); }); } }, { key: "calc", value: function calc(e) { var delta = this.vars.direction == 'horizontal' ? e.deltaX : e.deltaY; this.vars.target += delta * -1; this.clampTarget(); } }, { key: "debounce", value: function debounce() { var _this3 = this; var win = this.dom.listener === document.body; this.vars.target = this.vars.direction === 'vertical' ? win ? window.scrollY || window.pageYOffset : this.dom.listener.scrollTop : win ? window.scrollX || window.pageXOffset : this.dom.listener.scrollLeft; clearTimeout(this.vars.timer); if (!this.vars.ticking) { this.vars.ticking = true; _domClasses["default"].add(this.dom.listener, 'is-scrolling'); } this.vars.timer = setTimeout(function () { _this3.vars.ticking = false; _domClasses["default"].remove(_this3.dom.listener, 'is-scrolling'); }, 200); } }, { key: "run", value: function run() { if (this.isRAFCanceled) return; this.vars.current += (this.vars.target - this.vars.current) * this.vars.ease; this.vars.current < .1 && (this.vars.current = 0); this.requestAnimationFrame(); if (!this["extends"]) { this.dom.section.style[this.prefix] = this.getTransform(-this.vars.current.toFixed(2)); } if (!this.vars["native"] && !this.options.noscrollbar) { var size = this.dom.scrollbar.drag.height; var bounds = this.vars.direction === 'vertical' ? this.vars.height : this.vars.width; var value = Math.abs(this.vars.current) / (this.vars.bounding / (bounds - size)) + size / .5 - size; var clamp = Math.max(0, Math.min(value - size, value + size)); this.dom.scrollbar.drag.el.style[this.prefix] = this.getTransform(clamp.toFixed(2)); } if (this.callback && this.vars.current !== this.vars.last) { this.callback(this.vars.current); } this.vars.last = this.vars.current; } }, { key: "getTransform", value: function getTransform(value) { return this.vars.direction === 'vertical' ? "translate3d(0,".concat(value, "px,0)") : "translate3d(".concat(value, "px,0,0)"); } }, { key: "on", value: function on() { var requestAnimationFrame = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; if (this.isRAFCanceled) { this.isRAFCanceled = false; } var node = this.dom.listener === document.body ? window : this.dom.listener; this.vars["native"] ? _domEvents["default"].on(node, 'scroll', this.debounce) : this.vs && this.vs.on(this.calc); requestAnimationFrame && this.requestAnimationFrame(); } }, { key: "off", value: function off() { var cancelAnimationFrame = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; var node = this.dom.listener === document.body ? window : this.dom.listener; this.vars["native"] ? _domEvents["default"].off(node, 'scroll', this.debounce) : this.vs && this.vs.off(this.calc); cancelAnimationFrame && this.cancelAnimationFrame(); } }, { key: "requestAnimationFrame", value: function (_requestAnimationFrame) { function requestAnimationFrame() { return _requestAnimationFrame.apply(this, arguments); } requestAnimationFrame.toString = function () { return _requestAnimationFrame.toString(); }; return requestAnimationFrame; }(function () { this.rAF = requestAnimationFrame(this.run); }) }, { key: "cancelAnimationFrame", value: function (_cancelAnimationFrame) { function cancelAnimationFrame() { return _cancelAnimationFrame.apply(this, arguments); } cancelAnimationFrame.toString = function () { return _cancelAnimationFrame.toString(); }; return cancelAnimationFrame; }(function () { this.isRAFCanceled = true; cancelAnimationFrame(this.rAF); }) }, { key: "addEvents", value: function addEvents() { this.on(); _domEvents["default"].on(window, 'resize', this.resize); } }, { key: "removeEvents", value: function removeEvents() { this.off(); _domEvents["default"].off(window, 'resize', this.resize); } }, { key: "addFakeScrollBar", value: function addFakeScrollBar() { this.dom.listener.appendChild(this.dom.scrollbar.el); this.dom.scrollbar.el.appendChild(this.dom.scrollbar.drag.el); _domEvents["default"].on(this.dom.scrollbar.el, 'click', this.calcScroll); _domEvents["default"].on(this.dom.scrollbar.el, 'mousedown', this.mouseDown); _domEvents["default"].on(document, 'mousemove', this.mouseMove); _domEvents["default"].on(document, 'mouseup', this.mouseUp); } }, { key: "removeFakeScrollBar", value: function removeFakeScrollBar() { _domEvents["default"].off(this.dom.scrollbar.el, 'click', this.calcScroll); _domEvents["default"].off(this.dom.scrollbar.el, 'mousedown', this.mouseDown); _domEvents["default"].off(document, 'mousemove', this.mouseMove); _domEvents["default"].off(document, 'mouseup', this.mouseUp); this.dom.listener.removeChild(this.dom.scrollbar.el); } }, { key: "mouseDown", value: function mouseDown(e) { e.preventDefault(); e.which == 1 && (this.dom.scrollbar.state.clicked = true); } }, { key: "mouseUp", value: function mouseUp(e) { this.dom.scrollbar.state.clicked = false; _domClasses["default"].remove(this.dom.listener, 'is-dragging'); } }, { key: "mouseMove", value: function mouseMove(e) { this.dom.scrollbar.state.clicked && this.calcScroll(e); } }, { key: "addFakeScrollHeight", value: function addFakeScrollHeight() { this.dom.scroll = (0, _domCreateElement["default"])({ selector: 'div', styles: 'vs-scroll-view' }); this.dom.listener.appendChild(this.dom.scroll); } }, { key: "removeFakeScrollHeight", value: function removeFakeScrollHeight() { this.dom.listener.removeChild(this.dom.scroll); } }, { key: "calcScroll", value: function calcScroll(e) { var client = this.vars.direction == 'vertical' ? e.clientY : e.clientX; var bounds = this.vars.direction == 'vertical' ? this.vars.height : this.vars.width; var delta = client * (this.vars.bounding / bounds); _domClasses["default"].add(this.dom.listener, 'is-dragging'); this.vars.target = delta; this.clampTarget(); this.dom.scrollbar && (this.dom.scrollbar.drag.delta = this.vars.target); } }, { key: "scrollTo", value: function scrollTo(offset) { if (this.vars["native"]) { this.vars.direction == 'vertical' ? window.scrollTo(0, offset) : window.scrollTo(offset, 0); } else { this.vars.target = offset; this.clampTarget(); } } }, { key: "resize", value: function resize() { var prop = this.vars.direction === 'vertical' ? 'height' : 'width'; this.vars.height = window.innerHeight; this.vars.width = window.innerWidth; if (!this["extends"]) { var bounding = this.dom.section.getBoundingClientRect(); this.vars.bounding = this.vars.direction === 'vertical' ? bounding.height - (this.vars["native"] ? 0 : this.vars.height) : bounding.right - (this.vars["native"] ? 0 : this.vars.width); } if (!this.vars["native"] && !this.options.noscrollbar) { this.dom.scrollbar.drag.height = this.vars.height * (this.vars.height / (this.vars.bounding + this.vars.height)); this.dom.scrollbar.drag.el.style[prop] = "".concat(this.dom.scrollbar.drag.height, "px"); } else if (this.vars["native"]) { this.dom.scroll.style[prop] = "".concat(this.vars.bounding, "px"); } !this.vars["native"] && this.clampTarget(); } }, { key: "clampTarget", value: function clampTarget() { this.vars.target = Math.round(Math.max(0, Math.min(this.vars.target, this.vars.bounding))); } }, { key: "destroy", value: function destroy() { if (this.vars["native"]) { _domClasses["default"].remove(this.dom.listener, 'is-native-scroll'); this.removeFakeScrollHeight(); } else { _domClasses["default"].remove(this.dom.listener, 'is-virtual-scroll'); !this.options.noscrollbar && this.removeFakeScrollBar(); } this.vars.direction === 'vertical' ? _domClasses["default"].remove(this.dom.listener, 'y-scroll') : _domClasses["default"].remove(this.dom.listener, 'x-scroll'); this.vars.current = 0; this.vs && (this.vs.destroy(), this.vs = null); this.removeEvents(); } }]); return Smooth; }(); exports["default"] = Smooth; window.Smooth = Smooth; },{"dom-classes":5,"dom-create-element":6,"dom-events":7,"prefix":11,"virtual-scroll":17}],4:[function(require,module,exports){ 'use strict'; var toString = Object.prototype.toString, hasOwnProperty = Object.prototype.hasOwnProperty; module.exports = function(object) { if(!object) return console.warn('bindAll requires at least one argument.'); var functions = Array.prototype.slice.call(arguments, 1); if (functions.length === 0) { for (var method in object) { if(hasOwnProperty.call(object, method)) { if(typeof object[method] == 'function' && toString.call(object[method]) == "[object Function]") { functions.push(method); } } } } for(var i = 0; i < functions.length; i++) { var f = functions[i]; object[f] = bind(object[f], object); } }; /* Faster bind without specific-case checking. (see https://coderwall.com/p/oi3j3w). bindAll is only needed for events binding so no need to make slow fixes for constructor or partial application. */ function bind(func, context) { return function() { return func.apply(context, arguments); }; } },{}],5:[function(require,module,exports){ /** * Module dependencies. */ var index = require('indexof'); /** * Whitespace regexp. */ var whitespaceRe = /\s+/; /** * toString reference. */ var toString = Object.prototype.toString; module.exports = classes; module.exports.add = add; module.exports.contains = has; module.exports.has = has; module.exports.toggle = toggle; module.exports.remove = remove; module.exports.removeMatching = removeMatching; function classes (el) { if (el.classList) { return el.classList; } var str = el.className.replace(/^\s+|\s+$/g, ''); var arr = str.split(whitespaceRe); if ('' === arr[0]) arr.shift(); return arr; } function add (el, name) { // classList if (el.classList) { el.classList.add(name); return; } // fallback var arr = classes(el); var i = index(arr, name); if (!~i) arr.push(name); el.className = arr.join(' '); } function has (el, name) { return el.classList ? el.classList.contains(name) : !! ~index(classes(el), name); } function remove (el, name) { if ('[object RegExp]' == toString.call(name)) { return removeMatching(el, name); } // classList if (el.classList) { el.classList.remove(name); return; } // fallback var arr = classes(el); var i = index(arr, name); if (~i) arr.splice(i, 1); el.className = arr.join(' '); } function removeMatching (el, re, ref) { var arr = Array.prototype.slice.call(classes(el)); for (var i = 0; i < arr.length; i++) { if (re.test(arr[i])) { remove(el, arr[i]); } } } function toggle (el, name) { // classList if (el.classList) { return el.classList.toggle(name); } // fallback if (has(el, name)) { remove(el, name); } else { add(el, name); } } },{"indexof":8}],6:[function(require,module,exports){ /* `dom-create-element` var create = require('dom-create-element'); var el = create({ selector: 'div', styles: 'preloader', html: '<span>Text</span>' }); */ module.exports = create; function create(opt) { opt = opt || {}; var el = document.createElement(opt.selector); if(opt.attr) for(var index in opt.attr) opt.attr.hasOwnProperty(index) && el.setAttribute(index, opt.attr[index]); "a" == opt.selector && opt.link && ( el.href = opt.link, opt.target && el.setAttribute("target", opt.target) ); "img" == opt.selector && opt.src && ( el.src = opt.src, opt.lazyload && ( el.style.opacity = 0, el.onload = function(){ el.style.opacity = 1; } ) ); opt.id && (el.id = opt.id); opt.styles && (el.className = opt.styles); opt.html && (el.innerHTML = opt.html); opt.children && (el.appendChild(opt.children)); return el; }; },{}],7:[function(require,module,exports){ var synth = require('synthetic-dom-events'); var on = function(element, name, fn, capture) { return element.addEventListener(name, fn, capture || false); }; var off = function(element, name, fn, capture) { return element.removeEventListener(name, fn, capture || false); }; var once = function (element, name, fn, capture) { function tmp (ev) { off(element, name, tmp, capture); fn(ev); } on(element, name, tmp, capture); }; var emit = function(element, name, opt) { var ev = synth(name, opt); element.dispatchEvent(ev); }; if (!document.addEventListener) { on = function(element, name, fn) { return element.attachEvent('on' + name, fn); }; } if (!document.removeEventListener) { off = function(element, name, fn) { return element.detachEvent('on' + name, fn); }; } if (!document.dispatchEvent) { emit = function(element, name, opt) { var ev = synth(name, opt); return element.fireEvent('on' + ev.type, ev); }; } module.exports = { on: on, off: off, once: once, emit: emit }; },{"synthetic-dom-events":12}],8:[function(require,module,exports){ var indexOf = [].indexOf; module.exports = function(arr, obj){ if (indexOf) return arr.indexOf(obj); for (var i = 0; i < arr.length; ++i) { if (arr[i] === obj) return i; } return -1; }; },{}],9:[function(require,module,exports){ // Generated by CoffeeScript 1.9.2 (function() { var root; root = typeof exports !== "undefined" && exports !== null ? exports : this; root.Lethargy = (function() { function Lethargy(stability, sensitivity, tolerance, delay) { this.stability = stability != null ? Math.abs(stability) : 8; this.sensitivity = sensitivity != null ? 1 + Math.abs(sensitivity) : 100; this.tolerance = tolerance != null ? 1 + Math.abs(tolerance) : 1.1; this.delay = delay != null ? delay : 150; this.lastUpDeltas = (function() { var i, ref, results; results = []; for (i = 1, ref = this.stability * 2; 1 <= ref ? i <= ref : i >= ref; 1 <= ref ? i++ : i--) { results.push(null); } return results; }).call(this); this.lastDownDeltas = (function() { var i, ref, results; results = []; for (i = 1, ref = this.stability * 2; 1 <= ref ? i <= ref : i >= ref; 1 <= ref ? i++ : i--) { results.push(null); } return results; }).call(this); this.deltasTimestamp = (function() { var i, ref, results; results = []; for (i = 1, ref = this.stability * 2; 1 <= ref ? i <= ref : i >= ref; 1 <= ref ? i++ : i--) { results.push(null); } return results; }).call(this); } Lethargy.prototype.check = function(e) { var lastDelta; e = e.originalEvent || e; if (e.wheelDelta != null) { lastDelta = e.wheelDelta; } else if (e.deltaY != null) { lastDelta = e.deltaY * -40; } else if ((e.detail != null) || e.detail === 0) { lastDelta = e.detail * -40; } this.deltasTimestamp.push(Date.now()); this.deltasTimestamp.shift(); if (lastDelta > 0) { this.lastUpDeltas.push(lastDelta); this.lastUpDeltas.shift(); return this.isInertia(1); } else { this.lastDownDeltas.push(lastDelta); this.lastDownDeltas.shift(); return this.isInertia(-1); } return false; }; Lethargy.prototype.isInertia = function(direction) { var lastDeltas, lastDeltasNew, lastDeltasOld, newAverage, newSum, oldAverage, oldSum; lastDeltas = direction === -1 ? this.lastDownDeltas : this.lastUpDeltas; if (lastDeltas[0] === null) { return direction; } if (this.deltasTimestamp[(this.stability * 2) - 2] + this.delay > Date.now() && lastDeltas[0] === lastDeltas[(this.stability * 2) - 1]) { return false; } lastDeltasOld = lastDeltas.slice(0, this.stability); lastDeltasNew = lastDeltas.slice(this.stability, this.stability * 2); oldSum = lastDeltasOld.reduce(function(t, s) { return t + s; }); newSum = lastDeltasNew.reduce(function(t, s) { return t + s; }); oldAverage = oldSum / lastDeltasOld.length; newAverage = newSum / lastDeltasNew.length; if (Math.abs(oldAverage) < Math.abs(newAverage * this.tolerance) && (this.sensitivity < Math.abs(newAverage))) { return direction; } else { return false; } }; Lethargy.prototype.showLastUpDeltas = function() { return this.lastUpDeltas; }; Lethargy.prototype.showLastDownDeltas = function() { return this.lastDownDeltas; }; return Lethargy; })(); }).call(this); },{}],10:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @license MIT */ 'use strict'; /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; },{}],11:[function(require,module,exports){ // check document first so it doesn't error in node.js var style = typeof document != 'undefined' ? document.createElement('p').style : {} var prefixes = ['O', 'ms', 'Moz', 'Webkit'] var upper = /([A-Z])/g var memo = {} /** * prefix `key` * * prefix('transform') // => WebkitTransform * * @param {String} key * @return {String} * @api public */ function prefix(key){ // Camel case key = key.replace(/-([a-z])/g, function(_, char){ return char.toUpperCase() }) // Without prefix if (style[key] !== undefined) return key // With prefix var Key = key.charAt(0).toUpperCase() + key.slice(1) var i = prefixes.length while (i--) { var name = prefixes[i] + Key if (style[name] !== undefined) return name } return key } /** * Memoized version of `prefix` * * @param {String} key * @return {String} * @api public */ function prefixMemozied(key){ return key in memo ? memo[key] : memo[key] = prefix(key) } /** * Create a dashed prefix * * @param {String} key * @return {String} * @api public */ function prefixDashed(key){ key = prefix(key) if (upper.test(key)) { key = '-' + key.replace(upper, '-$1') upper.lastIndex = 0 } return key.toLowerCase() } module.exports = prefixMemozied module.exports.dash = prefixDashed },{}],12:[function(require,module,exports){ // for compression var win = window; var doc = document || {}; var root = doc.documentElement || {}; // detect if we need to use firefox KeyEvents vs KeyboardEvents var use_key_event = true; try { doc.createEvent('KeyEvents'); } catch (err) { use_key_event = false; } // Workaround for https://bugs.webkit.org/show_bug.cgi?id=16735 function check_kb(ev, opts) { if (ev.ctrlKey != (opts.ctrlKey || false) || ev.altKey != (opts.altKey || false) || ev.shiftKey != (opts.shiftKey || false) || ev.metaKey != (opts.metaKey || false) || ev.keyCode != (opts.keyCode || 0) || ev.charCode != (opts.charCode || 0)) { ev = document.createEvent('Event'); ev.initEvent(opts.type, opts.bubbles, opts.cancelable); ev.ctrlKey = opts.ctrlKey || false; ev.altKey = opts.altKey || false; ev.shiftKey = opts.shiftKey || false; ev.metaKey = opts.metaKey || false; ev.keyCode = opts.keyCode || 0; ev.charCode = opts.charCode || 0; } return ev; } // modern browsers, do a proper dispatchEvent() var modern = function(type, opts) { opts = opts || {}; // which init fn do we use var family = typeOf(type); var init_fam = family; if (family === 'KeyboardEvent' && use_key_event) { family = 'KeyEvents'; init_fam = 'KeyEvent'; } var ev = doc.createEvent(family); var init_fn = 'init' + init_fam; var init = typeof ev[init_fn] === 'function' ? init_fn : 'initEvent'; var sig = initSignatures[init]; var args = []; var used = {}; opts.type = type; for (var i = 0; i < sig.length; ++i) { var key = sig[i]; var val = opts[key]; // if no user specified value, then use event default if (val === undefined) { val = ev[key]; } used[key] = true; args.push(val); } ev[init].apply(ev, args); // webkit key event issue workaround if (family === 'KeyboardEvent') { ev = check_kb(ev, opts); } // attach remaining unused options to the object for (var key in opts) { if (!used[key]) { ev[key] = opts[key]; } } return ev; }; var legacy = function (type, opts) { opts = opts || {}; var ev = doc.createEventObject(); ev.type = type; for (var key in opts) { if (opts[key] !== undefined) { ev[key] = opts[key]; } } return ev; }; // expose either the modern version of event generation or legacy // depending on what we support // avoids if statements in the code later module.exports = doc.createEvent ? modern : legacy; var initSignatures = require('./init.json'); var types = require('./types.json'); var typeOf = (function () { var typs = {}; for (var key in types) { var ts = types[key]; for (var i = 0; i < ts.length; i++) { typs[ts[i]] = key; } } return function (name) { return typs[name] || 'Event'; }; })(); },{"./init.json":13,"./types.json":14}],13:[function(require,module,exports){ module.exports={ "initEvent" : [ "type", "bubbles", "cancelable" ], "initUIEvent" : [ "type", "bubbles", "cancelable", "view", "detail" ], "initMouseEvent" : [ "type", "bubbles", "cancelable", "view", "detail", "screenX", "screenY", "clientX", "clientY", "ctrlKey", "altKey", "shiftKey", "metaKey", "button", "relatedTarget" ], "initMutationEvent" : [ "type", "bubbles", "cancelable", "relatedNode", "prevValue", "newValue", "attrName", "attrChange" ], "initKeyboardEvent" : [ "type", "bubbles", "cancelable", "view", "ctrlKey", "altKey", "shiftKey", "metaKey", "keyCode", "charCode" ], "initKeyEvent" : [ "type", "bubbles", "cancelable", "view", "ctrlKey", "altKey", "shiftKey", "metaKey", "keyCode", "charCode" ] } },{}],14:[function(require,module,exports){ module.exports={ "MouseEvent" : [ "click", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout" ], "KeyboardEvent" : [ "keydown", "keyup", "keypress" ], "MutationEvent" : [ "DOMSubtreeModified", "DOMNodeInserted", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMNodeInsertedIntoDocument", "DOMAttrModified", "DOMCharacterDataModified" ], "HTMLEvents" : [ "load", "unload", "abort", "error", "select", "change", "submit", "reset", "focus", "blur", "resize", "scroll" ], "UIEvent" : [ "DOMFocusIn", "DOMFocusOut", "DOMActivate" ] } },{}],15:[function(require,module,exports){ function E () { // Keep this empty so it's easier to inherit from // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) } E.prototype = { on: function (name, callback, ctx) { var e = this.e || (this.e = {}); (e[name] || (e[name] = [])).push({ fn: callback, ctx: ctx }); return this; }, once: function (name, callback, ctx) { var self = this; function listener () { self.off(name, listener); callback.apply(ctx, arguments); }; listener._ = callback return this.on(name, listener, ctx); }, emit: function (name) { var data = [].slice.call(arguments, 1); var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); var i = 0; var len = evtArr.length; for (i; i < len; i++) { evtArr[i].fn.apply(evtArr[i].ctx, data); } return this; }, off: function (name, callback) { var e = this.e || (this.e = {}); var evts = e[name]; var liveEvents = []; if (evts && callback) { for (var i = 0, len = evts.length; i < len; i++) { if (evts[i].fn !== callback && evts[i].fn._ !== callback) liveEvents.push(evts[i]); } } // Remove event from queue to prevent memory leak // Suggested by https://github.com/lazd // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 (liveEvents.length) ? e[name] = liveEvents : delete e[name]; return this; } }; module.exports = E; },{}],16:[function(require,module,exports){ 'use strict'; module.exports = function(source) { return JSON.parse(JSON.stringify(source)); }; },{}],17:[function(require,module,exports){ 'use strict'; var objectAssign = require('object-assign'); var Emitter = require('tiny-emitter'); var Lethargy = require('lethargy').Lethargy; var support = require('./support'); var clone = require('./clone'); var bindAll = require('bindall-standalone'); var EVT_ID = 'virtualscroll'; module.exports = VirtualScroll; var keyCodes = { LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, SPACE: 32 }; function VirtualScroll(options) { bindAll(this, '_onWheel', '_onMouseWheel', '_onTouchStart', '_onTouchMove', '_onKeyDown'); this.el = window; if (options && options.el) { this.el = options.el; delete options.el; } this.options = objectAssign({ mouseMultiplier: 1, touchMultiplier: 2, firefoxMultiplier: 15, keyStep: 120, preventTouch: false, unpreventTouchClass: 'vs-touchmove-allowed', limitInertia: false }, options); if (this.options.limitInertia) this._lethargy = new Lethargy(); this._emitter = new Emitter(); this._event = { y: 0, x: 0, deltaX: 0, deltaY: 0 }; this.touchStartX = null; this.touchStartY = null; this.bodyTouchAction = null; if (this.options.passive !== undefined) { this.listenerOptions = {passive: this.options.passive}; } } VirtualScroll.prototype._notify = function(e) { var evt = this._event; evt.x += evt.deltaX; evt.y += evt.deltaY; this._emitter.emit(EVT_ID, { x: evt.x, y: evt.y, deltaX: evt.deltaX, deltaY: evt.deltaY, originalEvent: e }); }; VirtualScroll.prototype._onWheel = function(e) { var options = this.options; if (this._lethargy && this._lethargy.check(e) === false) return; var evt = this._event; // In Chrome and in Firefox (at least the new one) evt.deltaX = e.wheelDeltaX || e.deltaX * -1; evt.deltaY = e.wheelDeltaY || e.deltaY * -1; // for our purpose deltamode = 1 means user is on a wheel mouse, not touch pad // real meaning: https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent#Delta_modes if(support.isFirefox && e.deltaMode == 1) { evt.deltaX *= options.firefoxMultiplier; evt.deltaY *= options.firefoxMultiplier; } evt.deltaX *= options.mouseMultiplier; evt.deltaY *= options.mouseMultiplier; this._notify(e); }; VirtualScroll.prototype._onMouseWheel = function(e) { if (this.options.limitInertia && this._lethargy.check(e) === false) return; var evt = this._event; // In Safari, IE and in Chrome if 'wheel' isn't defined evt.deltaX = (e.wheelDeltaX) ? e.wheelDeltaX : 0; evt.deltaY = (e.wheelDeltaY) ? e.wheelDeltaY : e.wheelDelta; this._notify(e); }; VirtualScroll.prototype._onTouchStart = function(e) { var t = (e.targetTouches) ? e.targetTouches[0] : e; this.touchStartX = t.pageX; this.touchStartY = t.pageY; }; VirtualScroll.prototype._onTouchMove = function(e) { var options = this.options; if(options.preventTouch && !e.target.classList.contains(options.unpreventTouchClass)) { e.preventDefault(); } var evt = this._event; var t = (e.targetTouches) ? e.targetTouches[0] : e; evt.deltaX = (t.pageX - this.touchStartX) * options.touchMultiplier; evt.deltaY = (t.pageY - this.touchStartY) * options.touchMultiplier; this.touchStartX = t.pageX; this.touchStartY = t.pageY; this._notify(e); }; VirtualScroll.prototype._onKeyDown = function(e) { var evt = this._event; evt.deltaX = evt.deltaY = 0; var windowHeight = window.innerHeight - 40 switch(e.keyCode) { case keyCodes.LEFT: case keyCodes.UP: evt.deltaY = this.options.keyStep; break; case keyCodes.RIGHT: case keyCodes.DOWN: evt.deltaY = - this.options.keyStep; break; case keyCodes.SPACE && e.shiftKey: evt.deltaY = windowHeight; break; case keyCodes.SPACE: evt.deltaY = - windowHeight; break; default: return; } this._notify(e); }; VirtualScroll.prototype._bind = function() { if(support.hasWheelEvent) this.el.addEventListener('wheel', this._onWheel, this.listenerOptions); if(support.hasMouseWheelEvent) this.el.addEventListener('mousewheel', this._onMouseWheel, this.listenerOptions); if(support.hasTouch) { this.el.addEventListener('touchstart', this._onTouchStart, this.listenerOptions); this.el.addEventListener('touchmove', this._onTouchMove, this.listenerOptions); } if(support.hasPointer && support.hasTouchWin) { this.bodyTouchAction = document.body.style.msTouchAction; document.body.style.msTouchAction = 'none'; this.el.addEventListener('MSPointerDown', this._onTouchStart, true); this.el.addEventListener('MSPointerMove', this._onTouchMove, true); } if(support.hasKeyDown) document.addEventListener('keydown', this._onKeyDown); }; VirtualScroll.prototype._unbind = function() { if(support.hasWheelEvent) this.el.removeEventListener('wheel', this._onWheel); if(support.hasMouseWheelEvent) this.el.removeEventListener('mousewheel', this._onMouseWheel); if(support.hasTouch) { this.el.removeEventListener('touchstart', this._onTouchStart); this.el.removeEventListener('touchmove', this._onTouchMove); } if(support.hasPointer && support.hasTouchWin) { document.body.style.msTouchAction = this.bodyTouchAction; this.el.removeEventListener('MSPointerDown', this._onTouchStart, true); this.el.removeEventListener('MSPointerMove', this._onTouchMove, true); } if(support.hasKeyDown) document.removeEventListener('keydown', this._onKeyDown); }; VirtualScroll.prototype.on = function(cb, ctx) { this._emitter.on(EVT_ID, cb, ctx); var events = this._emitter.e; if (events && events[EVT_ID] && events[EVT_ID].length === 1) this._bind(); }; VirtualScroll.prototype.off = function(cb, ctx) { this._emitter.off(EVT_ID, cb, ctx); var events = this._emitter.e; if (!events[EVT_ID] || events[EVT_ID].length <= 0) this._unbind(); }; VirtualScroll.prototype.reset = function() { var evt = this._event; evt.x = 0; evt.y = 0; }; VirtualScroll.prototype.destroy = function() { this._emitter.off(); this._unbind(); }; },{"./clone":16,"./support":18,"bindall-standalone":4,"lethargy":9,"object-assign":10,"tiny-emitter":15}],18:[function(require,module,exports){ 'use strict'; module.exports = (function getSupport() { return { hasWheelEvent: 'onwheel' in document, hasMouseWheelEvent: 'onmousewheel' in document, hasTouch: 'ontouchstart' in document, hasTouchWin: navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 1, hasPointer: !!window.navigator.msPointerEnabled, hasKeyDown: 'onkeydown' in document, isFirefox: navigator.userAgent.indexOf('Firefox') > -1 }; })(); },{}]},{},[2]);
var NAVTREEINDEX3 = { "d4/db5/array_8hpp.html":[3,0,1,11], "d4/db5/array_8hpp.html#a0048463a9200ce90a34092d719fe9922":[3,0,1,11,1], "d4/db5/array_8hpp.html#a311d0610601290b2bb98f1808fc56d24":[3,0,1,11,3], "d4/db5/array_8hpp.html#a44c20174c4360e3d4ec9373839c493e2":[3,0,1,11,2], "d4/db5/array_8hpp.html#a66c2e9bfacf2a266d988285089c50705":[3,0,1,11,5], "d4/db5/array_8hpp.html#ae74917955a3fa69cd29c43493f75fef3":[3,0,1,11,4], "d4/de8/classstd_1_1basic__string.html":[2,0,0,16], "d4/de8/classstd_1_1basic__string.html#a048145b966ec41fbaa4714140308167a":[2,0,0,16,28], "d4/de8/classstd_1_1basic__string.html#a11da29d044d50af12ad86730e077c349":[2,0,0,16,37], "d4/de8/classstd_1_1basic__string.html#a155d2fa939e5c2c45b68db675a5fa86a":[2,0,0,16,6], "d4/de8/classstd_1_1basic__string.html#a19700f17170ad1f72867c379b2d0d75e":[2,0,0,16,44], "d4/de8/classstd_1_1basic__string.html#a1f4ccdd026fe166b90dd52cb7be634c9":[2,0,0,16,8], "d4/de8/classstd_1_1basic__string.html#a26f9a2e19f6933f947bee0132e3aae81":[2,0,0,16,27], "d4/de8/classstd_1_1basic__string.html#a366ac2380d95d352498c88278a7a9d8b":[2,0,0,16,24], "d4/de8/classstd_1_1basic__string.html#a37d7594eca3b2c47b5f0bc2447a982c9":[2,0,0,16,34], "d4/de8/classstd_1_1basic__string.html#a42961d0cef0f670eb1a2462a2b8f08c8":[2,0,0,16,15], "d4/de8/classstd_1_1basic__string.html#a43bb85d9b8916f484babb7b92d10cb42":[2,0,0,16,42], "d4/de8/classstd_1_1basic__string.html#a44aa7597b00eed7606f7952989ac6ed1":[2,0,0,16,21], "d4/de8/classstd_1_1basic__string.html#a4a618a1d6343243652cc9123e6d26593":[2,0,0,16,4], "d4/de8/classstd_1_1basic__string.html#a52b9d0b393063fdb59585f80ac803191":[2,0,0,16,5], "d4/de8/classstd_1_1basic__string.html#a5339b8e4151978ad8f67fb23a1da93a7":[2,0,0,16,0], "d4/de8/classstd_1_1basic__string.html#a55b6e4d56823c8de8ab5fbf9e33dfce5":[2,0,0,16,18], "d4/de8/classstd_1_1basic__string.html#a56c4648661953fc5e9269b4a89ed7441":[2,0,0,16,33], "d4/de8/classstd_1_1basic__string.html#a59f4cc8315d514e52ecdc743e0451e27":[2,0,0,16,41], "d4/de8/classstd_1_1basic__string.html#a5f93368f7fb6a2874bf8da801aa526d1":[2,0,0,16,43], "d4/de8/classstd_1_1basic__string.html#a617bd833ddf33273bb8049b83fc4b254":[2,0,0,16,1], "d4/de8/classstd_1_1basic__string.html#a6d31b891369dbaa90962ecf4cddf078a":[2,0,0,16,40], "d4/de8/classstd_1_1basic__string.html#a7ec81f393c688621e7857ace949111eb":[2,0,0,16,9], "d4/de8/classstd_1_1basic__string.html#a8493d62f43e0ef6a8c18adc283618ee9":[2,0,0,16,36], "d4/de8/classstd_1_1basic__string.html#a8db97eff295c3b6a6bf4631d6ec5dfdf":[2,0,0,16,23], "d4/de8/classstd_1_1basic__string.html#a8e26341ef4a38db673b8a986d881824b":[2,0,0,16,31], "d4/de8/classstd_1_1basic__string.html#a91a0362fdb3c542e2aa27c88d74370e3":[2,0,0,16,10], "d4/de8/classstd_1_1basic__string.html#a9ae54e7e4d3f24e11e92bf28ab4e7555":[2,0,0,16,38], "d4/de8/classstd_1_1basic__string.html#a9e4d69675aff6909e70935e4368ca859":[2,0,0,16,39], "d4/de8/classstd_1_1basic__string.html#a9e89f6285c48714f17596dc9b5183def":[2,0,0,16,29], "d4/de8/classstd_1_1basic__string.html#aa25030581cb9824576b8bee02eaba540":[2,0,0,16,17], "d4/de8/classstd_1_1basic__string.html#aa40b7059ca42243c7bbb557bea09336c":[2,0,0,16,2], "d4/de8/classstd_1_1basic__string.html#aa4b716dd9157b8dba708c56c89be5dc4":[2,0,0,16,26], "d4/de8/classstd_1_1basic__string.html#aa5f40b761e880a93fd8c6c3db5c0df72":[2,0,0,16,35], "d4/de8/classstd_1_1basic__string.html#aa97a7b633573d24a9944a57986800d71":[2,0,0,16,16], "d4/de8/classstd_1_1basic__string.html#ab1b0a7a408203f0126955b874de27352":[2,0,0,16,7], "d4/de8/classstd_1_1basic__string.html#ab2c981bafcfc423d2dd847c0e5fc35fd":[2,0,0,16,19], "d4/de8/classstd_1_1basic__string.html#ab66e0321e01c4483cfbef4f845f0d35c":[2,0,0,16,32], "d4/de8/classstd_1_1basic__string.html#ab8a99058684557be228b91b498e8a3e9":[2,0,0,16,12], "d4/de8/classstd_1_1basic__string.html#ac04ce8c34135d3576f1f639c8917d138":[2,0,0,16,30], "d4/de8/classstd_1_1basic__string.html#ac08e1b13601baa3477b970ebd35ebf99":[2,0,0,16,3], "d4/de8/classstd_1_1basic__string.html#ac74c043d5388cc66d0f922526f4cd395":[2,0,0,16,22], "d4/de8/classstd_1_1basic__string.html#ad0e792c2a8a518722c3e6fef0000e68f":[2,0,0,16,14], "d4/de8/classstd_1_1basic__string.html#ad9e4f9545f7d760a0975a6c3c0a75a20":[2,0,0,16,13], "d4/de8/classstd_1_1basic__string.html#ada7d4480f4f216b45818c2952042b3bd":[2,0,0,16,25], "d4/de8/classstd_1_1basic__string.html#aebc27f736e76a55864f508077c3f56d8":[2,0,0,16,20], "d4/de8/classstd_1_1basic__string.html#afec7916221582f548d4ed0656f871806":[2,0,0,16,11], "d4/de8/classstd_1_1map.html":[2,0,0,111], "d4/de8/classstd_1_1map.html#a2340c924a5187f1a63cfdf0687216763":[2,0,0,111,18], "d4/de8/classstd_1_1map.html#a2c6eaa30025b6bbcbb0cfc5963ee237c":[2,0,0,111,8], "d4/de8/classstd_1_1map.html#a3b6a55862b5d793f47b0023f53eab748":[2,0,0,111,6], "d4/de8/classstd_1_1map.html#a4b6b2b79140050d718dc72d1f1c9f0ad":[2,0,0,111,5], "d4/de8/classstd_1_1map.html#a58706f0166408a04c60bdba751d1a98d":[2,0,0,111,4], "d4/de8/classstd_1_1map.html#a73ea071e7772e050444541652f732083":[2,0,0,111,1], "d4/de8/classstd_1_1map.html#a873685a9110c9219265f1e3201282581":[2,0,0,111,3], "d4/de8/classstd_1_1map.html#a8c523966f8bbd00039d0f2b5cc3c77e5":[2,0,0,111,19], "d4/de8/classstd_1_1map.html#a8f93152ce41f03543187d01c98c034ff":[2,0,0,111,17], "d4/de8/classstd_1_1map.html#a97bf18d62e8afe85c3739cbc62abbbc6":[2,0,0,111,14], "d4/de8/classstd_1_1map.html#a9bcac17c36254c93e37f06d966d32773":[2,0,0,111,21], "d4/de8/classstd_1_1map.html#aa77322ea3800895f483a5a863a2f9356":[2,0,0,111,10], "d4/de8/classstd_1_1map.html#aa9af2db3e9feccee588c59852c389319":[2,0,0,111,0], "d4/de8/classstd_1_1map.html#ab85e6b3f71a6cd66e4c7920f6b141423":[2,0,0,111,7], "d4/de8/classstd_1_1map.html#ab8c8abbc1c9afb13828d3a04a46d9b4c":[2,0,0,111,11], "d4/de8/classstd_1_1map.html#ac8005e666248dfa867980a0d2a7d433d":[2,0,0,111,12], "d4/de8/classstd_1_1map.html#ac9e60107a51138e82a8a66d2c3bca0bf":[2,0,0,111,2], "d4/de8/classstd_1_1map.html#ad4354abcb3f30dae394e199f1230d681":[2,0,0,111,16], "d4/de8/classstd_1_1map.html#adf709df841b651865a6aa361ad6a9763":[2,0,0,111,15], "d4/de8/classstd_1_1map.html#ae02b3d1d336a42ab76f5e187ae9ef5d4":[2,0,0,111,20], "d4/de8/classstd_1_1map.html#ae82d0b4bd0fec70cc51778722e2d760a":[2,0,0,111,9], "d4/de8/classstd_1_1map.html#ae9dcf18d95d45bef7b48ddf28503c60f":[2,0,0,111,13], "d4/dfa/classstd_1_1fixed__sorted__vector.html":[2,0,0,40], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a2ce3d1d05f733abbbf1bf5b42707f51a":[2,0,0,40,4], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a3554132678255108808abcfb93cd9a6b":[2,0,0,40,14], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a3d1973321125b85937c51627cecf7526":[2,0,0,40,15], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a481527c0df696268826e6932ebce476e":[2,0,0,40,0], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a4d7c31d322d6b796ef3bc3a150d9e4b6":[2,0,0,40,3], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a5340ed31349b4ad6bc2010cece895c61":[2,0,0,40,8], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a5a3d349013a3a8b429c8c17d01fc3a73":[2,0,0,40,13], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a616d38b84b146a28959b47d3d3c457ca":[2,0,0,40,1], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a6a5879b6815b4d99155138bb46333a88":[2,0,0,40,6], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a71c9a896bf7d257a85c24d65789efa7d":[2,0,0,40,17], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a7827372b61d7a779057d11a2f2fc7287":[2,0,0,40,10], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a80357d89e033ef0e8213b3b14e675b61":[2,0,0,40,11], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a819e554776546c42857db0bb4fbc474c":[2,0,0,40,16], "d4/dfa/classstd_1_1fixed__sorted__vector.html#a8dd3ad604c8a45f3a514cedf70ed0c1d":[2,0,0,40,2], "d4/dfa/classstd_1_1fixed__sorted__vector.html#abab718a13944985143bc2a882aeea657":[2,0,0,40,7], "d4/dfa/classstd_1_1fixed__sorted__vector.html#ad3a09470b09ced0d1e9b2dfe4999dcb4":[2,0,0,40,9], "d4/dfa/classstd_1_1fixed__sorted__vector.html#ad55e670afba8c3b8a947c2007188ebe8":[2,0,0,40,12], "d4/dfa/classstd_1_1fixed__sorted__vector.html#ad8536b6a839c0f97ed486f1e87871179":[2,0,0,40,5], "d4/dff/classstd_1_1list.html":[2,0,0,106], "d4/dff/classstd_1_1list.html#a012d703d9498bb5379aefab4cbd793fc":[2,0,0,106,10], "d4/dff/classstd_1_1list.html#a068c5ba29eb4c5784417063041db9876":[2,0,0,106,26], "d4/dff/classstd_1_1list.html#a11c4f88fd223f0d6f69e9812409148ac":[2,0,0,106,3], "d4/dff/classstd_1_1list.html#a1b5cf608d0dfc92d253ad2b2c61ffe92":[2,0,0,106,4], "d4/dff/classstd_1_1list.html#a25f54f28c1f8d88247acb96bdcea6816":[2,0,0,106,7], "d4/dff/classstd_1_1list.html#a3131c7319678df9ca4a822a04cf7fb6c":[2,0,0,106,29], "d4/dff/classstd_1_1list.html#a39dd6f17e8be7b52b109f62295528b5c":[2,0,0,106,2], "d4/dff/classstd_1_1list.html#a3a37b706d3d0b2f13b2428e3ca1c699c":[2,0,0,106,1], "d4/dff/classstd_1_1list.html#a3e9ec15c28ddebc1953662e58ec510ca":[2,0,0,106,19], "d4/dff/classstd_1_1list.html#a3f6fac6aa256c5db949f84a0cd2efcac":[2,0,0,106,0], "d4/dff/classstd_1_1list.html#a40e6feb7cf0b64094287e5827597da81":[2,0,0,106,8], "d4/dff/classstd_1_1list.html#a41a418c3113d8c12fe012f774be80597":[2,0,0,106,24], "d4/dff/classstd_1_1list.html#a4354c4728b382544e06fce4fc9bcc312":[2,0,0,106,20], "d4/dff/classstd_1_1list.html#a551b830dafee1df29c1140d6f313a18b":[2,0,0,106,22], "d4/dff/classstd_1_1list.html#a5ae1a58a6b82d43f7cd07e9109333d57":[2,0,0,106,14], "d4/dff/classstd_1_1list.html#a5b9334ad92fc00e1e85ea89b0897abf1":[2,0,0,106,17], "d4/dff/classstd_1_1list.html#a6ce0ffc7ab23dbf139a9cad3847cca65":[2,0,0,106,25], "d4/dff/classstd_1_1list.html#a79d4760b4b044e86ccc18f418c2dfbd5":[2,0,0,106,18], "d4/dff/classstd_1_1list.html#a7ea2991023c95d6082a982639d589122":[2,0,0,106,16], "d4/dff/classstd_1_1list.html#a8309c19812be5d7699bae2cb74b23498":[2,0,0,106,6], "d4/dff/classstd_1_1list.html#a845d0da013d055fa9d8a5fba3c83451f":[2,0,0,106,12], "d4/dff/classstd_1_1list.html#a9016e842ec79a98cfbe4af8253025cda":[2,0,0,106,21], "d4/dff/classstd_1_1list.html#a9e4100a74107d8bfdf64836fd395c428":[2,0,0,106,23], "d4/dff/classstd_1_1list.html#aa2a48b9d9d42da5c02daeecaa24f1f6b":[2,0,0,106,11], "d4/dff/classstd_1_1list.html#acad7862b982e5d322e4f43256e64094c":[2,0,0,106,27], "d4/dff/classstd_1_1list.html#adce674f11895530210a08dd9feb8221f":[2,0,0,106,9], "d4/dff/classstd_1_1list.html#adf28a3cd2d000c2e9dbb2f31d140189b":[2,0,0,106,28], "d4/dff/classstd_1_1list.html#ae9e3042311db99b0ed187cf26bcedb09":[2,0,0,106,30], "d4/dff/classstd_1_1list.html#aec0f8c316d3702cf37f24968429eec63":[2,0,0,106,15], "d4/dff/classstd_1_1list.html#af24365dafd4b435765afc393959c72da":[2,0,0,106,5], "d4/dff/classstd_1_1list.html#afd9bdd4dc99526ea4f79c9bf5cb9c006":[2,0,0,106,13], "d5/d05/classstd_1_1ramakrishna.html":[2,0,0,127], "d5/d05/classstd_1_1ramakrishna.html#a6441f28b4ef0e44eb62726b5c61ba8e0":[2,0,0,127,1], "d5/d05/classstd_1_1ramakrishna.html#aa74c6cbb95ea33a3f5343a91f34004cb":[2,0,0,127,0], "d5/d27/applications__events_8hpp.html":[3,0,1,9], "d5/d2c/smath_8hpp.html":[3,0,1,62], "d5/d38/classstd_1_1independent__bits__engine.html":[2,0,0,59], "d5/d38/classstd_1_1independent__bits__engine.html#a1daa4f3fdd1c4a805931b678d3fae5fe":[2,0,0,59,3], "d5/d38/classstd_1_1independent__bits__engine.html#a32f151de85e10db3c7818333e543d1cb":[2,0,0,59,5], "d5/d38/classstd_1_1independent__bits__engine.html#a3f7b409af91a4364b2adca735cb6f34a":[2,0,0,59,4], "d5/d38/classstd_1_1independent__bits__engine.html#a43d68292f4b0693e304146b9a32ddcb3":[2,0,0,59,2], "d5/d38/classstd_1_1independent__bits__engine.html#a569ea2356722f0905ea3abb74bb2cd6b":[2,0,0,59,1], "d5/d38/classstd_1_1independent__bits__engine.html#a5bf120f126dd5ca1964d01a4ce8d5bef":[2,0,0,59,6], "d5/d38/classstd_1_1independent__bits__engine.html#a5d7b0d9168fd124a290e25ea93541c96":[2,0,0,59,8], "d5/d38/classstd_1_1independent__bits__engine.html#a60306c9881c5ce4dc0d055d32571ac03":[2,0,0,59,9], "d5/d38/classstd_1_1independent__bits__engine.html#a7ec88d4d053d1852f3fe16f5f8610365":[2,0,0,59,0], "d5/d38/classstd_1_1independent__bits__engine.html#af31e73ded39f92a9a9c714092f6a6556":[2,0,0,59,7], "d5/d40/structstd_1_1internal_1_1slist__base__node.html":[2,0,0,1,7], "d5/d40/structstd_1_1internal_1_1slist__base__node.html#a0e1fe1f53aeebb7d860d8630a02d71ec":[2,0,0,1,7,0], "d5/d40/structstd_1_1internal_1_1slist__base__node.html#a3ad27932e24383eba50bf6e8ddefb9d9":[2,0,0,1,7,4], "d5/d40/structstd_1_1internal_1_1slist__base__node.html#a5059f904e47e8ee44777fd9f8026efb8":[2,0,0,1,7,2], "d5/d40/structstd_1_1internal_1_1slist__base__node.html#a9c43ac315223c45502b3e85c040d4a12":[2,0,0,1,7,1], "d5/d40/structstd_1_1internal_1_1slist__base__node.html#aad3c6a04ad23efc497a7a5a1b576b103":[2,0,0,1,7,3], "d5/d40/structstd_1_1internal_1_1slist__base__node.html#ab51c452c73a63bded6db92d617ac441e":[2,0,0,1,7,5], "d5/d46/classstd_1_1event.html":[2,0,0,31], "d5/d46/classstd_1_1event.html#a2555ea55a19f7438c11b448a4da310be":[2,0,0,31,0], "d5/d46/classstd_1_1event.html#a3127439e3b1ae53ff82ffbd6eb1cdb74":[2,0,0,31,1], "d5/d46/classstd_1_1event.html#a60162e40f032fd335c8f63923b4ef002":[2,0,0,31,2], "d5/d46/classstd_1_1event.html#a650674261758e63ccde58cd585caef81":[2,0,0,31,4], "d5/d46/classstd_1_1event.html#ae5bc638a246c98040e8ecfa64836f029":[2,0,0,31,5], "d5/d46/classstd_1_1event.html#ae9459294918a688d5b389ed80b54cd58":[2,0,0,31,3], "d5/d4b/classstd_1_1property.html":[2,0,0,125], "d5/d4b/classstd_1_1property.html#a098f2afe0df9c5ce4506b335611ef53e":[2,0,0,125,3], "d5/d4b/classstd_1_1property.html#a2b7254e0060ade9f44e65f3a4d71dd54":[2,0,0,125,1], "d5/d4b/classstd_1_1property.html#a556273c46a8a9cbd32b5a05375c844cd":[2,0,0,125,0], "d5/d4b/classstd_1_1property.html#aa2728918617e3d879fb41e58d7e53c24":[2,0,0,125,4], "d5/d4b/classstd_1_1property.html#ae5ddf88013535b71302ec90518934549":[2,0,0,125,5], "d5/d4b/classstd_1_1property.html#af5962d92265befccc38f8a426d11d58a":[2,0,0,125,2], "d5/d51/buffer__allocator_8hpp.html":[3,0,1,15], "d5/d61/allocator_8hpp.html":[3,0,1,7], "d5/d61/allocator_8hpp.html#a3b4c7dfb17db51bb2753517543ccd37c":[3,0,1,7,2], "d5/d61/allocator_8hpp.html#a9a2e8249bedcfb932780df5723e4ad9e":[3,0,1,7,1], "d5/d64/classstd_1_1slist.html":[2,0,0,141], "d5/d64/classstd_1_1slist.html#a04a69afc6847311533818dddfcdee97e":[2,0,0,141,4], "d5/d64/classstd_1_1slist.html#a0b6782d4bcd7dc6971e8fbb42a6ad5ce":[2,0,0,141,12], "d5/d64/classstd_1_1slist.html#a111d34dd3475c3d5b9247a70a85a30b2":[2,0,0,141,22], "d5/d64/classstd_1_1slist.html#a140815ea1f9e91fe058f933f1ae8ed55":[2,0,0,141,6], "d5/d64/classstd_1_1slist.html#a14776d9cb4de5a6ab72e848ecd996a67":[2,0,0,141,10], "d5/d64/classstd_1_1slist.html#a24c00ed63a3cd52377a77de14fe82652":[2,0,0,141,0], "d5/d64/classstd_1_1slist.html#a2977308e228e97004773dee54c91b8b5":[2,0,0,141,13], "d5/d64/classstd_1_1slist.html#a2bdb4b58fb7bdd268323735f0b33bbe6":[2,0,0,141,11], "d5/d64/classstd_1_1slist.html#a3660e14a008464ecc897c731968ecd81":[2,0,0,141,19], "d5/d64/classstd_1_1slist.html#a47166c64c1ddb6b559610a6c5f739c35":[2,0,0,141,17], "d5/d64/classstd_1_1slist.html#a495f2218b4c1e39bda6258ee9dcb9db1":[2,0,0,141,20], "d5/d64/classstd_1_1slist.html#a55470629e45e49d744d6eeab82331138":[2,0,0,141,7], "d5/d64/classstd_1_1slist.html#a5fa39130f5ef432af64b224e50d99e72":[2,0,0,141,16], "d5/d64/classstd_1_1slist.html#a61f6570d0e7572ac7d68e6e8967dd098":[2,0,0,141,5], "d5/d64/classstd_1_1slist.html#a6ae4ca7dfc3e0bd5080033904ae10c71":[2,0,0,141,9], "d5/d64/classstd_1_1slist.html#a7f3ce2758b964158f7b413bbe0e2c699":[2,0,0,141,21], "d5/d64/classstd_1_1slist.html#a8f3d02d796e1b94127a8f9ec622e7f3a":[2,0,0,141,14], "d5/d64/classstd_1_1slist.html#a9dc76627cfe746336df1102798406f04":[2,0,0,141,3], "d5/d64/classstd_1_1slist.html#aae0f045e80a1691a8dc0daa4a64d7c53":[2,0,0,141,8], "d5/d64/classstd_1_1slist.html#ab6b6cc8d2f6529076150d4b9d25421c1":[2,0,0,141,15], "d5/d64/classstd_1_1slist.html#aca19a21368914a9c7d6ba9bfd2ca7e6e":[2,0,0,141,2], "d5/d64/classstd_1_1slist.html#ace6af22ddd9ca105272f3a7e6c8dd90c":[2,0,0,141,18], "d5/d64/classstd_1_1slist.html#af578a53dfee381d366b7a881720a07d4":[2,0,0,141,1], "d5/d68/structstd_1_1is__polymorphic.html":[2,0,0,91], "d5/d6c/atomic_8hpp.html":[3,0,1,12], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3f":[3,0,1,12,1], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3fa1b67b1f58b6dfe544dc067460fc47332":[3,0,1,12,1,5], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3fa713961552f49e86e76c18d31568396d8":[3,0,1,12,1,1], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3fa71556f1ad3429c75eb63c783a8c4390e":[3,0,1,12,1,0], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3fa8b17a31dea30fef995ad75d19e1d85ee":[3,0,1,12,1,3], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3fad4338b1beb516c55566a43f41ad98560":[3,0,1,12,1,4], "d5/d6c/atomic_8hpp.html#a6257cbad5715428cc0b01d30efe1fc3faf4ba3803d19d0df46da5f0ae092ec08d":[3,0,1,12,1,2], "d5/d78/structstd_1_1has__trivial__assign.html":[2,0,0,50], "d5/d7a/classstd_1_1spinlock.html":[2,0,0,143], "d5/d7a/classstd_1_1spinlock.html#a01429c40f6b8a27bc844f2e7073b5262":[2,0,0,143,0], "d5/d7a/classstd_1_1spinlock.html#a1c0cb294f8af28dee9a63807a982b0ed":[2,0,0,143,6], "d5/d7a/classstd_1_1spinlock.html#a48029fe3844ce4614875c893d20a970e":[2,0,0,143,8], "d5/d7a/classstd_1_1spinlock.html#a6d010c79795532eac8503d24b5c14312":[2,0,0,143,1], "d5/d7a/classstd_1_1spinlock.html#aa4caf15c25859ff4c23fcf4d978023d2":[2,0,0,143,3], "d5/d7a/classstd_1_1spinlock.html#aa7b292b211c18e54849550385c9686cd":[2,0,0,143,2], "d5/d7a/classstd_1_1spinlock.html#abb56d76aad9b5ab8d865d2a1691ebf03":[2,0,0,143,4], "d5/d7a/classstd_1_1spinlock.html#aca18d2985a115a9f01ecd5aab1d6e12f":[2,0,0,143,7], "d5/d7a/classstd_1_1spinlock.html#ae958fb96bc80bb084032600a3834bee4":[2,0,0,143,5], "d5/d7e/structstd_1_1_sys_1_1mutex__struct.html":[2,0,0,151,0], "d5/d88/structstd_1_1string__rep.html":[2,0,0,149], "d5/d88/structstd_1_1string__rep.html#a2b07a0e88e164ee6406b2d1b9c6112c5":[2,0,0,149,0], "d5/d88/structstd_1_1string__rep.html#a811ba699f524a07fca87451ec9b7bd9a":[2,0,0,149,5], "d5/d88/structstd_1_1string__rep.html#a8c75d5341c4689f99f5357e4c7686edd":[2,0,0,149,6], "d5/d88/structstd_1_1string__rep.html#a9703e294128a2ee943237571af5bedf0":[2,0,0,149,3], "d5/d88/structstd_1_1string__rep.html#a976c3e095976d5098eafa69b61abc016":[2,0,0,149,1], "d5/d88/structstd_1_1string__rep.html#abf1f5949512a20b084a87b276f65307c":[2,0,0,149,4], "d5/d88/structstd_1_1string__rep.html#ad9d46356d507f4750b7f66b84d741bd2":[2,0,0,149,2], "d5/da8/classstd_1_1lock__base.html":[2,0,0,107], "d5/da8/classstd_1_1lock__base.html#a11a6fcfe95e53fcf7fa9ea1899795399":[2,0,0,107,2], "d5/da8/classstd_1_1lock__base.html#a40542bbcdbabc587b03363ba1e6291c6":[2,0,0,107,0], "d5/da8/classstd_1_1lock__base.html#a493cd8e3d4e08f82d1d64014153a032b":[2,0,0,107,3], "d5/da8/classstd_1_1lock__base.html#ad2292c7877a72b49f0b59e08a7392c61":[2,0,0,107,1], "d5/da8/classstd_1_1lock__base.html#ad5ab453523394a1c4b083b82766f555e":[2,0,0,107,4], "d5/da8/ext_8hpp.html":[3,0,1,2,3], "d5/da8/ext_8hpp.html#a75ea34a9c5a358814dc101008e25da63":[3,0,1,2,3,3], "d5/da8/ext_8hpp.html#af2e3a1605007b6c1c31a698b0036a4af":[3,0,1,2,3,1], "d5/da8/ext_8hpp.html#af627b3eb00e62d3b51160e17590d7cf8":[3,0,1,2,3,0], "d5/da8/ext_8hpp.html#afedf386ab72c194c06eaeb3d5c7c650a":[3,0,1,2,3,2], "d5/db6/structstd_1_1random__access__iterator__tag.html":[2,0,0,128], "d5/dcf/classstd_1_1net_1_1socket.html":[2,0,0,3,8], "d5/dcf/classstd_1_1net_1_1socket.html#a037eb0329c110f9978e504a2e9c6b850":[2,0,0,3,8,1], "d5/dcf/classstd_1_1net_1_1socket.html#a057063eaf2e2ae7e3e2a68d36aea64fe":[2,0,0,3,8,18], "d5/dcf/classstd_1_1net_1_1socket.html#a1145bdb7d5e964fd525f0635dcfd043f":[2,0,0,3,8,2], "d5/dcf/classstd_1_1net_1_1socket.html#a2adbebe226bb20438587b8cd802a74a8":[2,0,0,3,8,7], "d5/dcf/classstd_1_1net_1_1socket.html#a2c9643d14e3b5ff465bbc77391ae2bef":[2,0,0,3,8,3], "d5/dcf/classstd_1_1net_1_1socket.html#a2e846460d29b2e9e9c15201245cf0ddb":[2,0,0,3,8,25], "d5/dcf/classstd_1_1net_1_1socket.html#a3ce264c4d03e7d066e68ca59cd173baf":[2,0,0,3,8,17], "d5/dcf/classstd_1_1net_1_1socket.html#a45060a1f5a96f3fc0b579b6a12e59686":[2,0,0,3,8,5], "d5/dcf/classstd_1_1net_1_1socket.html#a49263efe677b0ed0b0db906d9b300835":[2,0,0,3,8,24], "d5/dcf/classstd_1_1net_1_1socket.html#a4dee92e90c25b542d7a5dfd2777565c1":[2,0,0,3,8,16], "d5/dcf/classstd_1_1net_1_1socket.html#a5138f6fa3c53e3b9c7acfd668fbe8080":[2,0,0,3,8,27], "d5/dcf/classstd_1_1net_1_1socket.html#a514b503b24b99d2d281ca8ea6f062c35":[2,0,0,3,8,35], "d5/dcf/classstd_1_1net_1_1socket.html#a545a96e10df6b5750fd7c5c525bc42ac":[2,0,0,3,8,21], "d5/dcf/classstd_1_1net_1_1socket.html#a5a951a5a6482ed9ebff2b61092a045ff":[2,0,0,3,8,10], "d5/dcf/classstd_1_1net_1_1socket.html#a6bb39f226ba79d033a9881ed2ab64fea":[2,0,0,3,8,36], "d5/dcf/classstd_1_1net_1_1socket.html#a6fd737591a798c982ab10d1171863b11":[2,0,0,3,8,26], "d5/dcf/classstd_1_1net_1_1socket.html#a799f9d5c22e3f0b1b9e9142b71dc548b":[2,0,0,3,8,22] };
/* global $,kendo,PouchDB */ var testHelper = testHelper || {}; //Returns event spy {events:array, dispose:function, reset:function}. //events[i] is {e:*}. testHelper.spyKendoEvent = function (instance, eventName) { 'use strict'; var handler = function (e) { var copy = $.extend(true, {}, e); result.events.push({ e: copy }); }, dispose = function () { instance.unbind(eventName, handler); this.reset(); }, reset = function () { result.events = []; }, result = { events: [], dispose: dispose, reset: reset }; instance.bind(eventName, handler); return result; }; //Returns promise that resolves when change event occurs on PouchDB specified number of times. testHelper.waitForDbChanges = function (db, numberOfChanges) { var counter = 0, deferred = new $.Deferred(), handler = function () { counter++; if (counter === numberOfChanges) { changes.removeListener("change", handler); deferred.resolve(); } }, changes = db.changes({ since: 'now', live: true }); changes.on("change", handler); return deferred.promise(); }; testHelper.addArrayToDataSource = function (dataSource, rows) { $.each(rows, function (_, row) { dataSource.add(row); }); };
import * as React from 'react'; import { expect } from 'chai'; import { spy } from 'sinon'; import { createMount, describeConformanceV5, act, createClientRender } from 'test/utils'; import FormControl, { formControlClasses as classes } from '@material-ui/core/FormControl'; import Input from '@material-ui/core/Input'; import Select from '@material-ui/core/Select'; import useFormControl from './useFormControl'; describe('<FormControl />', () => { const render = createClientRender(); const mount = createMount(); function TestComponent(props) { const context = useFormControl(); React.useEffect(() => { props.contextCallback(context); }); return null; } describeConformanceV5(<FormControl />, () => ({ classes, inheritComponent: 'div', render, mount, refInstanceof: window.HTMLDivElement, testComponentPropWith: 'fieldset', muiName: 'MuiFormControl', testVariantProps: { margin: 'dense' }, skip: ['componentsProp'], })); describe('initial state', () => { it('should have no margin', () => { const { container } = render(<FormControl />); const root = container.firstChild; expect(root).not.to.have.class(classes.marginNormal); expect(root).not.to.have.class(classes.sizeSmall); }); it('can have the margin normal class', () => { const { container } = render(<FormControl margin="normal" />); const root = container.firstChild; expect(root).to.have.class(classes.marginNormal); expect(root).not.to.have.class(classes.sizeSmall); }); it('can have the margin dense class', () => { const { container } = render(<FormControl margin="dense" />); const root = container.firstChild; expect(root).to.have.class(classes.marginDense); expect(root).not.to.have.class(classes.marginNormal); }); it('should not be filled initially', () => { const readContext = spy(); render( <FormControl> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('filled', false); }); it('should not be focused initially', () => { const readContext = spy(); render( <FormControl> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('focused', false); }); }); describe('prop: required', () => { it('should not apply it to the DOM', () => { const { container } = render(<FormControl required />); expect(container.firstChild).not.to.have.attribute('required'); }); }); describe('prop: disabled', () => { it('will be unfocused if it gets disabled', () => { const readContext = spy(); const { container, setProps } = render( <FormControl> <Input /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('focused', false); act(() => { container.querySelector('input').focus(); }); expect(readContext.args[1][0]).to.have.property('focused', true); setProps({ disabled: true }); expect(readContext.args[2][0]).to.have.property('focused', false); }); }); describe('prop: focused', () => { it('should display input in focused state', () => { const readContext = spy(); const { container } = render( <FormControl focused> <Input /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('focused', true); container.querySelector('input').blur(); expect(readContext.args[0][0]).to.have.property('focused', true); }); it('ignores focused when disabled', () => { const readContext = spy(); render( <FormControl focused disabled> <Input /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.include({ disabled: true, focused: false }); }); }); describe('input', () => { it('should be filled when a value is set', () => { const readContext = spy(); render( <FormControl> <Input value="bar" /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('filled', true); }); it('should be filled when a defaultValue is set', () => { const readContext = spy(); render( <FormControl> <Input defaultValue="bar" /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('filled', true); }); it('should not be adornedStart with an endAdornment', () => { const readContext = spy(); render( <FormControl> <Input endAdornment={<div />} /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('adornedStart', false); }); it('should be adornedStar with a startAdornment', () => { const readContext = spy(); render( <FormControl> <Input startAdornment={<div />} /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('adornedStart', true); }); }); describe('select', () => { it('should not be adorned without a startAdornment', () => { const readContext = spy(); render( <FormControl> <Select value="" /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0]).to.have.property('adornedStart', false); }); it('should be adorned with a startAdornment', () => { const readContext = spy(); render( <FormControl> <Select value="" input={<Input startAdornment={<div />} />} /> <TestComponent contextCallback={readContext} /> </FormControl>, ); expect(readContext.args[0][0].adornedStart, true); }); }); describe('useFormControl', () => { const FormController = React.forwardRef((_, ref) => { const formControl = useFormControl(); React.useImperativeHandle(ref, () => formControl, [formControl]); return null; }); const FormControlled = React.forwardRef(function FormControlled(props, ref) { return ( <FormControl {...props}> <FormController ref={ref} /> </FormControl> ); }); describe('from props', () => { it('should have the required prop from the instance', () => { const formControlRef = React.createRef(); const { setProps } = render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('required', false); setProps({ required: true }); expect(formControlRef.current).to.have.property('required', true); }); it('should have the error prop from the instance', () => { const formControlRef = React.createRef(); const { setProps } = render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('error', false); setProps({ error: true }); expect(formControlRef.current).to.have.property('error', true); }); it('should have the margin prop from the instance', () => { const formControlRef = React.createRef(); const { setProps } = render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('size', 'medium'); setProps({ size: 'small' }); expect(formControlRef.current).to.have.property('size', 'small'); }); it('should have the fullWidth prop from the instance', () => { const formControlRef = React.createRef(); const { setProps } = render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('fullWidth', false); setProps({ fullWidth: true }); expect(formControlRef.current).to.have.property('fullWidth', true); }); }); describe('callbacks', () => { describe('onFilled', () => { it('should set the filled state', () => { const formControlRef = React.createRef(); render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('filled', false); act(() => { formControlRef.current.onFilled(); }); expect(formControlRef.current).to.have.property('filled', true); act(() => { formControlRef.current.onFilled(); }); expect(formControlRef.current).to.have.property('filled', true); }); }); describe('onEmpty', () => { it('should clean the filled state', () => { const formControlRef = React.createRef(); render(<FormControlled ref={formControlRef} />); act(() => { formControlRef.current.onFilled(); }); expect(formControlRef.current).to.have.property('filled', true); act(() => { formControlRef.current.onEmpty(); }); expect(formControlRef.current).to.have.property('filled', false); act(() => { formControlRef.current.onEmpty(); }); expect(formControlRef.current).to.have.property('filled', false); }); }); describe('handleFocus', () => { it('should set the focused state', () => { const formControlRef = React.createRef(); render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('focused', false); act(() => { formControlRef.current.onFocus(); }); expect(formControlRef.current).to.have.property('focused', true); act(() => { formControlRef.current.onFocus(); }); expect(formControlRef.current).to.have.property('focused', true); }); }); describe('handleBlur', () => { it('should clear the focused state', () => { const formControlRef = React.createRef(); render(<FormControlled ref={formControlRef} />); expect(formControlRef.current).to.have.property('focused', false); act(() => { formControlRef.current.onFocus(); }); expect(formControlRef.current).to.have.property('focused', true); act(() => { formControlRef.current.onBlur(); }); expect(formControlRef.current).to.have.property('focused', false); act(() => { formControlRef.current.onBlur(); }); expect(formControlRef.current).to.have.property('focused', false); }); }); }); }); });
const EventEmitter = require('events'); class MomentumEventEmitter extends EventEmitter {} module.exports = MomentumEventEmitter;
module.exports = function(grunt) { var commonTasks = ['jscs', 'jshint', 'concat', 'uglify']; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), jscs: { src: ['Gruntfile.js', 'src/*.js', 'test/utils-test.js', 'test/basicTimerSpec', 'test/timedFuncSpec.js'] }, jshint: { all: ['Gruntfile.js', 'src/*.js', 'test/utils-test.js', 'test/basicTimerSpec', 'test/timedFuncSpec.js'] }, concat: { options: { banner: [ '/*! <%= pkg.name %> <%= pkg.version %> <%=grunt.template.today("yyyy-mm-dd")%>*/\n', '(function($) {\n' ].join(''), footer: '} (jQuery));' }, dist: { src: [ 'src/constants.js', 'src/utils.js', 'src/Timer.js', 'src/index.js' ], dest: 'dist/timer.jquery.js' } }, uglify: { dist: { src: 'dist/timer.jquery.js', dest: 'dist/timer.jquery.min.js' } }, watch: { scripts: { files: ['src/*.js'], tasks: commonTasks, options: { nospawn: true } } } }); grunt.loadNpmTasks('grunt-jscs'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', commonTasks); };
var http = require("http"); var path = require('path'); var fs = require('fs'); var mkdirp = require('mkdirp'); var pg = require('pg'); var exec = require('child_process').exec; var sh = require("execSync") var util = require('util'); var info = {"good_load":0,"bad_load":0,"no_data":0}; var password="transit"; var options = { host: 'www.gtfs-data-exchange.com', path: '/api/agencies' }; http.get(options, function (http_res) { //console.log(http_res); var data = ""; http_res.on("data", function (chunk) { data += chunk; }); http_res.on("end", function () { parseAgencies(JSON.parse(data).data); }); }) .on('error', function(e) { console.log(e); console.log("Got error: " + e); }); var parseAgencies = function(agencyList){ var validAgencyCount = 0; var conString = "postgres://postgres:"+password+"@localhost:5432/gtfs"; var client = new pg.Client(conString); client.connect(function(err) { if(err) { return console.error('Could not connect to database', err); } //console.log(result.rows[0].theTime); //output: Tue Jan 15 2013 19:12:47 GMT-600 (CST) agencyList.forEach(function(agency){ if(agency['is_official'] && agency['country'] == 'United States'){ //console.log( agency['dataexchange_id']); validAgencyCount++ var options = { host: 'www.gtfs-data-exchange.com', path: '/api/agency?agency='+agency['dataexchange_id'] }; http.get(options, function (http_res) { //console.log(http_res); var data = ""; http_res.on("data", function (chunk) { data += chunk; }); http_res.on("end", function () { mkdirp(path.resolve(__dirname,"../gtfs/")+"/"+agency['dataexchange_id'], function(err){ if (err) console.error(err) //else console.log('created dir '+agency['dataexchange_id']); }); if(agency["is_official"] && agency['country'] === 'United States'){ //console.log( "Agency id: " + agency['dataexchange_id'],"File URL: " + "") } parseAgent(JSON.parse(data).data,agency,client); }); }) .on('error', function(e) { console.log(e); console.log("Got error: " + e); }); } })//end for each agency; //client.end(); }); console.log("Num Agencies:"+validAgencyCount); console.log("done"); } var download = function(url, dest, cb) { var file = fs.createWriteStream(dest); var request = http.get(url, function(response) { response.pipe(file); file.on('finish', function() { file.close(); cb(); }); }); } var gtfsdbLoad = function(schemaName,destinationStream){ var result = sh.exec("gtfsdb-load --database_url postgresql://postgres:"+password+"@localhost/gtfs --schema="+schemaName+" --is_geospatial "+destinationStream); console.log('return code ' + result.code); console.log('stdout + stderr ' + result.stdout); } var createSchema = function(client,schemaName){ var query = 'CREATE SCHEMA "'+schemaName+'" '; client.query(query, function(err, result) { if(err) { return console.error('error running query:',query, err); }}) } var writeAgency = function(agency){ var body = JSON.stringify(agency); var post_options = { hostname: "localhost", port: 1337, path: "/agency/create/", method: "POST", headers: { "Content-Type": "application/json", "Content-Length": body.length // Often this part is optional } } var post_req = http.request(post_options, function(res) { res.setEncoding('utf8'); res.on('data', function (chunk) { console.log('Response: ' + chunk); }); }); post_req.write(body); post_req.end(); } var inAPI = function(dataexchange_id,cb){ var options = { host: 'localhost', port: 1337, path: '/agency/?dataexchange_id='+dataexchange_id }; http.get(options, function (http_res) { //console.log(http_res); var data = ""; http_res.on("data", function (chunk) { data += chunk; }); http_res.on("end", function () { output =JSON.parse(data) if(output.length > 0){ cb(true); }else{ cb(false); } }); }) .on('error', function(e) { console.log(e); console.log("Got error: " + e); }); } var testQuery = function(client,schemaName,agency,destinationStream){ var query = 'select ST_AsGeoJSON(geom) as geo,route_id from "'+schemaName+'".routes where geom is not null'; client.query(query, function(err, result) { if(err) { //return console.error('error running query:',query, err); info.no_data++; console.log(util.inspect(info,false,null)); //client.query('DROP SCHEMA "'+schemaName+'"'); return console.log(schemaName+":No Table"); } if(result.rows && result.rows.length > 0){ //console.log('error check '+util.inspect(result,false,null)+' '+schemaName); if(JSON.parse(result.rows[0].geo) !== null){ agency['current_datafile'] = schemaName; agency.is_official = 1; //console.log('Writing '+agency.dataexchange_id) //console.log(util.inspect(agency,false,null)); //writeAgency(agency); inAPI(agency.dataexchange_id,function(exists){ if(exists){ console.log(agency.dataexchange_id+" exists.") }else{ console.log(agency.dataexchange_id+" doesn't exist.") writeAgency(agency); } }); //console.log(schemaName+": "+JSON.parse(result.rows[0].geo).coordinates[0][0]); info.good_load++; }else{ //client.query('DROP SCHEMA "'+schemaName+'"'); //console.log(schemaName+": No Geometry"); info.bad_load++; //gtfsdbLoad(schemaName,destinationStream) } }else{ //client.query('DROP SCHEMA "'+schemaName+'"'); //console.log(schemaName+": No Rows"); info.bad_load++; //gtfsdbLoad(schemaName,destinationStream) } //console.log(util.inspect(info,false,null)); }) } var parseAgent = function(agent,agency, client){ var i = 0; var house = agency.dataexchange_id; agent.datafiles.forEach(function(datafile){ if(i == 0){ var fileNameOrig = agent["datafiles"][0].file_url; var nameSplit = fileNameOrig.substr(29); var schemaName = fileNameOrig.substr(29).split(".")[0]; var destinationStream = path.resolve(__dirname,"../gtfs/" + house + "/" + nameSplit); testQuery(client,schemaName,agency,destinationStream); //createSchema(client,schemaName); //gtfsdbLoad(schemaName,destinationStream) //download(agent["datafiles"][0].file_url,destinationStream,function(){}); } i++; }) //console.log("agent") return agent["datafiles"][0].file_url; }
module.exports = (req, res, next) => { const _registration = req.requestParams.registration const match = { _registration: _registration } return global.models.getAll( global.db.registrations.RegistrationDebaters, match, global.utils.populate.registrationDebaters, res ) }
'use strict' const pkg = require('../package') module.exports = { port: 4000, title: 'slotlist.info - ArmA 3 mission and slotlist management', publicPath: '/', }
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }; var possibleConstructorReturn = function (self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }; var slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }; /* Possible todos: 0. Add XSLT to JML-string stylesheet (or even vice versa) 0. IE problem: Add JsonML code to handle name attribute (during element creation) 0. Element-specific: IE object-param handling Todos inspired by JsonML: https://github.com/mckamey/jsonml/blob/master/jsonml-html.js 0. duplicate attributes? 0. expand ATTR_MAP 0. equivalent of markup, to allow strings to be embedded within an object (e.g., {$value: '<div>id</div>'}); advantage over innerHTML in that it wouldn't need to work as the entire contents (nor destroy any existing content or handlers) 0. More validation? 0. JsonML DOM Level 0 listener 0. Whitespace trimming? JsonML element-specific: 0. table appending 0. canHaveChildren necessary? (attempts to append to script and img) Other Todos: 0. Note to self: Integrate research from other jml notes 0. Allow Jamilih to be seeded with an existing element, so as to be able to add/modify attributes and children 0. Allow array as single first argument 0. Settle on whether need to use null as last argument to return array (or fragment) or other way to allow appending? Options object at end instead to indicate whether returning array, fragment, first element, etc.? 0. Allow building of generic XML (pass configuration object) 0. Allow building content internally as a string (though allowing DOM methods, etc.?) 0. Support JsonML empty string element name to represent fragments? 0. Redo browser testing of jml (including ensuring IE7 can work even if test framework can't work) */ var win = typeof window !== 'undefined' && window; var doc = typeof document !== 'undefined' && document; var XmlSerializer = typeof XMLSerializer !== 'undefined' && XMLSerializer; // STATIC PROPERTIES var possibleOptions = ['$plugins', '$map' // Add any other options here ]; var NS_HTML = 'http://www.w3.org/1999/xhtml', hyphenForCamelCase = /-([a-z])/g; var ATTR_MAP = { 'readonly': 'readOnly' }; // We define separately from ATTR_DOM for clarity (and parity with JsonML) but no current need // We don't set attribute esp. for boolean atts as we want to allow setting of `undefined` // (e.g., from an empty variable) on templates to have no effect var BOOL_ATTS = ['checked', 'defaultChecked', 'defaultSelected', 'disabled', 'indeterminate', 'open', // Dialog elements 'readOnly', 'selected']; var ATTR_DOM = BOOL_ATTS.concat([// From JsonML 'accessKey', // HTMLElement 'async', 'autocapitalize', // HTMLElement 'autofocus', 'contentEditable', // HTMLElement through ElementContentEditable 'defaultValue', 'defer', 'draggable', // HTMLElement 'formnovalidate', 'hidden', // HTMLElement 'innerText', // HTMLElement 'inputMode', // HTMLElement through ElementContentEditable 'ismap', 'multiple', 'novalidate', 'pattern', 'required', 'spellcheck', // HTMLElement 'translate', // HTMLElement 'value', 'willvalidate']); // Todo: Add more to this as useful for templating // to avoid setting through nullish value var NULLABLES = ['dir', // HTMLElement 'lang', // HTMLElement 'max', 'min', 'title' // HTMLElement ]; var $ = function $(sel) { return doc.querySelector(sel); }; var $$ = function $$(sel) { return [].concat(toConsumableArray(doc.querySelectorAll(sel))); }; /** * Retrieve the (lower-cased) HTML name of a node * @static * @param {Node} node The HTML node * @returns {String} The lower-cased node name */ function _getHTMLNodeName(node) { return node.nodeName && node.nodeName.toLowerCase(); } /** * Apply styles if this is a style tag * @static * @param {Node} node The element to check whether it is a style tag */ function _applyAnyStylesheet(node) { if (!doc.createStyleSheet) { return; } if (_getHTMLNodeName(node) === 'style') { // IE var ss = doc.createStyleSheet(); // Create a stylesheet to actually do something useful ss.cssText = node.cssText; // We continue to add the style tag, however } } /** * Need this function for IE since options weren't otherwise getting added * @private * @static * @param {DOMElement} parent The parent to which to append the element * @param {DOMNode} child The element or other node to append to the parent */ function _appendNode(parent, child) { var parentName = _getHTMLNodeName(parent); var childName = _getHTMLNodeName(child); if (doc.createStyleSheet) { if (parentName === 'script') { parent.text = child.nodeValue; return; } if (parentName === 'style') { parent.cssText = child.nodeValue; // This will not apply it--just make it available within the DOM cotents return; } } if (parentName === 'template') { parent.content.appendChild(child); return; } try { parent.appendChild(child); // IE9 is now ok with this } catch (e) { if (parentName === 'select' && childName === 'option') { try { // Since this is now DOM Level 4 standard behavior (and what IE7+ can handle), we try it first parent.add(child); } catch (err) { // DOM Level 2 did require a second argument, so we try it too just in case the user is using an older version of Firefox, etc. parent.add(child, null); // IE7 has a problem with this, but IE8+ is ok } return; } throw e; } } /** * Attach event in a cross-browser fashion * @static * @param {DOMElement} el DOM element to which to attach the event * @param {String} type The DOM event (without 'on') to attach to the element * @param {Function} handler The event handler to attach to the element * @param {Boolean} [capturing] Whether or not the event should be * capturing (W3C-browsers only); default is false; NOT IN USE */ function _addEvent(el, type, handler, capturing) { el.addEventListener(type, handler, !!capturing); } /** * Creates a text node of the result of resolving an entity or character reference * @param {'entity'|'decimal'|'hexadecimal'} type Type of reference * @param {String} prefix Text to prefix immediately after the "&" * @param {String} arg The body of the reference * @returns {Text} The text node of the resolved reference */ function _createSafeReference(type, prefix, arg) { // For security reasons related to innerHTML, we ensure this string only contains potential entity characters if (!arg.match(/^\w+$/)) { throw new TypeError('Bad ' + type); } var elContainer = doc.createElement('div'); // Todo: No workaround for XML? elContainer.textContent = '&' + prefix + arg + ';'; return doc.createTextNode(elContainer.textContent); } /** * @param {String} n0 Whole expression match (including "-") * @param {String} n1 Lower-case letter match * @returns {String} Uppercased letter */ function _upperCase(n0, n1) { return n1.toUpperCase(); } /** * @private * @static */ function _getType(item) { if (typeof item === 'string') { return 'string'; } if ((typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object') { if (item === null) { return 'null'; } if (Array.isArray(item)) { return 'array'; } if ('nodeType' in item) { if (item.nodeType === 1) { return 'element'; } if (item.nodeType === 11) { return 'fragment'; } } return 'object'; } return undefined; } /** * @private * @static */ function _fragReducer(frag, node) { frag.appendChild(node); return frag; } /** * @private * @static */ function _replaceDefiner(xmlnsObj) { return function (n0) { var retStr = xmlnsObj[''] ? ' xmlns="' + xmlnsObj[''] + '"' : n0 || ''; // Preserve XHTML for (var ns in xmlnsObj) { if (xmlnsObj.hasOwnProperty(ns)) { if (ns !== '') { retStr += ' xmlns:' + ns + '="' + xmlnsObj[ns] + '"'; } } } return retStr; }; } function _optsOrUndefinedJML() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return jml.apply(undefined, toConsumableArray(args[0] === undefined ? args.slice(1) : args)); } /** * @private * @static */ function _jmlSingleArg(arg) { return jml(arg); } /** * @private * @static */ function _copyOrderedAtts(attArr) { var obj = {}; // Todo: Fix if allow prefixed attributes obj[attArr[0]] = attArr[1]; // array of ordered attribute-value arrays return obj; } /** * @private * @static */ function _childrenToJML(node) { return function (childNodeJML, i) { var cn = node.childNodes[i]; var j = Array.isArray(childNodeJML) ? jml.apply(undefined, toConsumableArray(childNodeJML)) : jml(childNodeJML); cn.parentNode.replaceChild(j, cn); }; } /** * @private * @static */ function _appendJML(node) { return function (childJML) { node.appendChild(jml.apply(undefined, toConsumableArray(childJML))); }; } /** * @private * @static */ function _appendJMLOrText(node) { return function (childJML) { if (typeof childJML === 'string') { node.appendChild(doc.createTextNode(childJML)); } else { node.appendChild(jml.apply(undefined, toConsumableArray(childJML))); } }; } /** * @private * @static function _DOMfromJMLOrString (childNodeJML) { if (typeof childNodeJML === 'string') { return doc.createTextNode(childNodeJML); } return jml(...childNodeJML); } */ /** * Creates an XHTML or HTML element (XHTML is preferred, but only in browsers that support); * Any element after element can be omitted, and any subsequent type or types added afterwards * @requires polyfill: Array.isArray * @requires polyfill: Array.prototype.reduce For returning a document fragment * @requires polyfill: Element.prototype.dataset For dataset functionality (Will not work in IE <= 7) * @param {String} el The element to create (by lower-case name) * @param {Object} [atts] Attributes to add with the key as the attribute name and value as the * attribute value; important for IE where the input element's type cannot * be added later after already added to the page * @param {DOMElement[]} [children] The optional children of this element (but raw DOM elements * required to be specified within arrays since * could not otherwise be distinguished from siblings being added) * @param {DOMElement} [parent] The optional parent to which to attach the element (always the last * unless followed by null, in which case it is the second-to-last) * @param {null} [returning] Can use null to indicate an array of elements should be returned * @returns {DOMElement} The newly created (and possibly already appended) element or array of elements */ var jml = function jml() { for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var elem = doc.createDocumentFragment(); function _checkAtts(atts) { var att = void 0; for (att in atts) { if (!atts.hasOwnProperty(att)) { continue; } var attVal = atts[att]; att = att in ATTR_MAP ? ATTR_MAP[att] : att; if (NULLABLES.includes(att)) { if (attVal != null) { elem[att] = attVal; } continue; } else if (ATTR_DOM.includes(att)) { elem[att] = attVal; continue; } switch (att) { /* Todos: 0. JSON mode to prevent event addition 0. {$xmlDocument: []} // doc.implementation.createDocument 0. Accept array for any attribute with first item as prefix and second as value? 0. {$: ['xhtml', 'div']} for prefixed elements case '$': // Element with prefix? nodes[nodes.length] = elem = doc.createElementNS(attVal[0], attVal[1]); break; */ case '#': { // Document fragment nodes[nodes.length] = _optsOrUndefinedJML(opts, attVal); break; }case '$shadow': { var open = attVal.open, closed = attVal.closed; var content = attVal.content, template = attVal.template; var shadowRoot = elem.attachShadow({ mode: closed || open === false ? 'closed' : 'open' }); if (template) { if (Array.isArray(template)) { if (_getType(template[0]) === 'object') { // Has attributes template = jml.apply(undefined, ['template'].concat(toConsumableArray(template), [doc.body])); } else { // Array is for the children template = jml('template', template, doc.body); } } else if (typeof template === 'string') { template = $(template); } jml(template.content.cloneNode(true), shadowRoot); } else { if (!content) { content = open || closed; } if (content && typeof content !== 'boolean') { if (Array.isArray(content)) { jml({ '#': content }, shadowRoot); } else { jml(content, shadowRoot); } } } break; }case 'is': { // Not yet supported in browsers // Handled during element creation break; }case '$custom': { Object.assign(elem, attVal); break; }case '$define': { var _ret = function () { var localName = elem.localName.toLowerCase(); // Note: customized built-ins sadly not working yet var customizedBuiltIn = !localName.includes('-'); var def = customizedBuiltIn ? elem.getAttribute('is') : localName; if (customElements.get(def)) { return 'break'; } var getConstructor = function getConstructor(cb) { var baseClass = options && options.extends ? doc.createElement(options.extends).constructor : customizedBuiltIn ? doc.createElement(localName).constructor : HTMLElement; return cb ? function (_baseClass) { inherits(_class, _baseClass); function _class() { classCallCheck(this, _class); var _this = possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this)); cb.call(_this); return _this; } return _class; }(baseClass) : function (_baseClass2) { inherits(_class2, _baseClass2); function _class2() { classCallCheck(this, _class2); return possibleConstructorReturn(this, (_class2.__proto__ || Object.getPrototypeOf(_class2)).apply(this, arguments)); } return _class2; }(baseClass); }; var constructor = void 0, options = void 0, prototype = void 0; if (Array.isArray(attVal)) { if (attVal.length <= 2) { var _attVal = slicedToArray(attVal, 2); constructor = _attVal[0]; options = _attVal[1]; if (typeof options === 'string') { options = { extends: options }; } else if (!options.hasOwnProperty('extends')) { prototype = options; } if ((typeof constructor === 'undefined' ? 'undefined' : _typeof(constructor)) === 'object') { prototype = constructor; constructor = getConstructor(); } } else { var _attVal2 = slicedToArray(attVal, 3); constructor = _attVal2[0]; prototype = _attVal2[1]; options = _attVal2[2]; if (typeof options === 'string') { options = { extends: options }; } } } else if (typeof attVal === 'function') { constructor = attVal; } else { prototype = attVal; constructor = getConstructor(); } if (!constructor.toString().startsWith('class')) { constructor = getConstructor(constructor); } if (!options && customizedBuiltIn) { options = { extends: localName }; } if (prototype) { Object.assign(constructor.prototype, prototype); } customElements.define(def, constructor, customizedBuiltIn ? options : undefined); return 'break'; }(); if (_ret === 'break') break; }case '$symbol': { var _attVal3 = slicedToArray(attVal, 2), symbol = _attVal3[0], func = _attVal3[1]; if (typeof func === 'function') { var funcBound = func.bind(elem); if (typeof symbol === 'string') { elem[Symbol.for(symbol)] = funcBound; } else { elem[symbol] = funcBound; } } else { var obj = func; obj.elem = elem; if (typeof symbol === 'string') { elem[Symbol.for(symbol)] = obj; } else { elem[symbol] = obj; } } break; }case '$data': { setMap(attVal); break; }case '$attribute': { // Attribute node var node = attVal.length === 3 ? doc.createAttributeNS(attVal[0], attVal[1]) : doc.createAttribute(attVal[0]); node.value = attVal[attVal.length - 1]; nodes[nodes.length] = node; break; }case '$text': { // Todo: Also allow as jml(['a text node']) (or should that become a fragment)? var _node = doc.createTextNode(attVal); nodes[nodes.length] = _node; break; }case '$document': { // Todo: Conditionally create XML document var _node2 = doc.implementation.createHTMLDocument(); if (attVal.childNodes) { attVal.childNodes.forEach(_childrenToJML(_node2)); // Remove any extra nodes created by createHTMLDocument(). var j = attVal.childNodes.length; while (_node2.childNodes[j]) { var cn = _node2.childNodes[j]; cn.parentNode.removeChild(cn); j++; } } else { if (attVal.$DOCTYPE) { var dt = { $DOCTYPE: attVal.$DOCTYPE }; var doctype = jml(dt); _node2.firstChild.replaceWith(doctype); } var html = _node2.childNodes[1]; var head = html.childNodes[0]; var _body = html.childNodes[1]; if (attVal.title || attVal.head) { var meta = doc.createElement('meta'); meta.setAttribute('charset', 'utf-8'); head.appendChild(meta); } if (attVal.title) { _node2.title = attVal.title; // Appends after meta } if (attVal.head) { attVal.head.forEach(_appendJML(head)); } if (attVal.body) { attVal.body.forEach(_appendJMLOrText(_body)); } } nodes[nodes.length] = _node2; break; }case '$DOCTYPE': { /* // Todo: if (attVal.internalSubset) { node = {}; } else */ var _node3 = void 0; if (attVal.entities || attVal.notations) { _node3 = { name: attVal.name, nodeName: attVal.name, nodeValue: null, nodeType: 10, entities: attVal.entities.map(_jmlSingleArg), notations: attVal.notations.map(_jmlSingleArg), publicId: attVal.publicId, systemId: attVal.systemId // internalSubset: // Todo }; } else { _node3 = doc.implementation.createDocumentType(attVal.name, attVal.publicId || '', attVal.systemId || ''); } nodes[nodes.length] = _node3; break; }case '$ENTITY': { /* // Todo: Should we auto-copy another node's properties/methods (like DocumentType) excluding or changing its non-entity node values? const node = { nodeName: attVal.name, nodeValue: null, publicId: attVal.publicId, systemId: attVal.systemId, notationName: attVal.notationName, nodeType: 6, childNodes: attVal.childNodes.map(_DOMfromJMLOrString) }; */ break; }case '$NOTATION': { // Todo: We could add further properties/methods, but unlikely to be used as is. var _node4 = { nodeName: attVal[0], publicID: attVal[1], systemID: attVal[2], nodeValue: null, nodeType: 12 }; nodes[nodes.length] = _node4; break; }case '$on': { // Events for (var p2 in attVal) { if (attVal.hasOwnProperty(p2)) { var val = attVal[p2]; if (typeof val === 'function') { val = [val, false]; } if (typeof val[0] === 'function') { _addEvent(elem, p2, val[0], val[1]); // element, event name, handler, capturing } } } break; }case 'className':case 'class': if (attVal != null) { elem.className = attVal; } break; case 'dataset': { var _ret2 = function () { // Map can be keyed with hyphenated or camel-cased properties var recurse = function recurse(attVal, startProp) { var prop = ''; var pastInitialProp = startProp !== ''; Object.keys(attVal).forEach(function (key) { var value = attVal[key]; if (pastInitialProp) { prop = startProp + key.replace(hyphenForCamelCase, _upperCase).replace(/^([a-z])/, _upperCase); } else { prop = startProp + key.replace(hyphenForCamelCase, _upperCase); } if (value === null || (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object') { if (value != null) { elem.dataset[prop] = value; } prop = startProp; return; } recurse(value, prop); }); }; recurse(attVal, ''); return 'break'; // Todo: Disable this by default unless configuration explicitly allows (for security) }(); break; } case 'htmlFor':case 'for': if (elStr === 'label') { if (attVal != null) { elem.htmlFor = attVal; } break; } elem.setAttribute(att, attVal); break; case 'xmlns': // Already handled break; default: if (att.match(/^on/)) { elem[att] = attVal; // _addEvent(elem, att.slice(2), attVal, false); // This worked, but perhaps the user wishes only one event break; } if (att === 'style') { if (attVal == null) { break; } if ((typeof attVal === 'undefined' ? 'undefined' : _typeof(attVal)) === 'object') { for (var _p in attVal) { if (attVal.hasOwnProperty(_p) && attVal[_p] != null) { // Todo: Handle aggregate properties like "border" if (_p === 'float') { elem.style.cssFloat = attVal[_p]; elem.style.styleFloat = attVal[_p]; // Harmless though we could make conditional on older IE instead } else { elem.style[_p.replace(hyphenForCamelCase, _upperCase)] = attVal[_p]; } } } break; } // setAttribute unfortunately erases any existing styles elem.setAttribute(att, attVal); /* // The following reorders which is troublesome for serialization, e.g., as used in our testing if (elem.style.cssText !== undefined) { elem.style.cssText += attVal; } else { // Opera elem.style += attVal; } */ break; } var matchingPlugin = opts && opts.$plugins && opts.$plugins.find(function (p) { return p.name === att; }); if (matchingPlugin) { matchingPlugin.set({ element: elem, attribute: { name: att, value: attVal } }); break; } elem.setAttribute(att, attVal); break; } } } var nodes = []; var elStr = void 0; var opts = void 0; var isRoot = false; if (_getType(args[0]) === 'object' && Object.keys(args[0]).some(function (key) { return possibleOptions.includes(key); })) { opts = args[0]; if (opts.state !== 'child') { isRoot = true; opts.state = 'child'; } if (opts.$map && !opts.$map.root && opts.$map.root !== false) { opts.$map = { root: opts.$map }; } if ('$plugins' in opts) { if (!Array.isArray(opts.$plugins)) { throw new Error('$plugins must be an array'); } opts.$plugins.forEach(function (pluginObj) { if (!pluginObj) { throw new TypeError('Plugin must be an object'); } if (!pluginObj.name || !pluginObj.name.startsWith('$_')) { throw new TypeError('Plugin object name must be present and begin with `$_`'); } if (typeof pluginObj.set !== 'function') { throw new TypeError('Plugin object must have a `set` method'); } }); } args = args.slice(1); } var argc = args.length; var defaultMap = opts && opts.$map && opts.$map.root; var setMap = function setMap(dataVal) { var map = void 0, obj = void 0; // Boolean indicating use of default map and object if (dataVal === true) { var _defaultMap = slicedToArray(defaultMap, 2); map = _defaultMap[0]; obj = _defaultMap[1]; } else if (Array.isArray(dataVal)) { // Array of strings mapping to default if (typeof dataVal[0] === 'string') { dataVal.forEach(function (dVal) { setMap(opts.$map[dVal]); }); // Array of Map and non-map data object } else { map = dataVal[0] || defaultMap[0]; obj = dataVal[1] || defaultMap[1]; } // Map } else if (/^\[object (?:Weak)?Map\]$/.test([].toString.call(dataVal))) { map = dataVal; obj = defaultMap[1]; // Non-map data object } else { map = defaultMap[0]; obj = dataVal; } map.set(elem, obj); }; for (var i = 0; i < argc; i++) { var arg = args[i]; switch (_getType(arg)) { case 'null': // null always indicates a place-holder (only needed for last argument if want array returned) if (i === argc - 1) { _applyAnyStylesheet(nodes[0]); // We have to execute any stylesheets even if not appending or otherwise IE will never apply them // Todo: Fix to allow application of stylesheets of style tags within fragments? return nodes.length <= 1 ? nodes[0] : nodes.reduce(_fragReducer, doc.createDocumentFragment()); // nodes; } break; case 'string': // Strings indicate elements switch (arg) { case '!': nodes[nodes.length] = doc.createComment(args[++i]); break; case '?': arg = args[++i]; var procValue = args[++i]; var val = procValue; if ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') { procValue = []; for (var p in val) { if (val.hasOwnProperty(p)) { procValue.push(p + '=' + '"' + // https://www.w3.org/TR/xml-stylesheet/#NT-PseudoAttValue val[p].replace(/"/g, '&quot;') + '"'); } } procValue = procValue.join(' '); } // Firefox allows instructions with ">" in this method, but not if placed directly! try { nodes[nodes.length] = doc.createProcessingInstruction(arg, procValue); } catch (e) { // Getting NotSupportedError in IE, so we try to imitate a processing instruction with a comment // innerHTML didn't work // var elContainer = doc.createElement('div'); // elContainer.textContent = '<?' + doc.createTextNode(arg + ' ' + procValue).nodeValue + '?>'; // nodes[nodes.length] = elContainer.textContent; // Todo: any other way to resolve? Just use XML? nodes[nodes.length] = doc.createComment('?' + arg + ' ' + procValue + '?'); } break; // Browsers don't support doc.createEntityReference, so we just use this as a convenience case '&': nodes[nodes.length] = _createSafeReference('entity', '', args[++i]); break; case '#': // // Decimal character reference - ['#', '01234'] // &#01234; // probably easier to use JavaScript Unicode escapes nodes[nodes.length] = _createSafeReference('decimal', arg, String(args[++i])); break; case '#x': // Hex character reference - ['#x', '123a'] // &#x123a; // probably easier to use JavaScript Unicode escapes nodes[nodes.length] = _createSafeReference('hexadecimal', arg, args[++i]); break; case '![': // '![', ['escaped <&> text'] // <![CDATA[escaped <&> text]]> // CDATA valid in XML only, so we'll just treat as text for mutual compatibility // Todo: config (or detection via some kind of doc.documentType property?) of whether in XML try { nodes[nodes.length] = doc.createCDATASection(args[++i]); } catch (e2) { nodes[nodes.length] = doc.createTextNode(args[i]); // i already incremented } break; case '': nodes[nodes.length] = doc.createDocumentFragment(); break; default: { // An element elStr = arg; var _atts = args[i + 1]; // Todo: Fix this to depend on XML/config, not availability of methods if (_getType(_atts) === 'object' && _atts.is) { var is = _atts.is; if (doc.createElementNS) { elem = doc.createElementNS(NS_HTML, elStr, { is: is }); } else { elem = doc.createElement(elStr, { is: is }); } } else { if (doc.createElementNS) { elem = doc.createElementNS(NS_HTML, elStr); } else { elem = doc.createElement(elStr); } } nodes[nodes.length] = elem; // Add to parent break; } } break; case 'object': // Non-DOM-element objects indicate attribute-value pairs var atts = arg; if (atts.xmlns !== undefined) { // We handle this here, as otherwise may lose events, etc. // As namespace of element already set as XHTML, we need to change the namespace // elem.setAttribute('xmlns', atts.xmlns); // Doesn't work // Can't set namespaceURI dynamically, renameNode() is not supported, and setAttribute() doesn't work to change the namespace, so we resort to this hack var replacer = void 0; if (_typeof(atts.xmlns) === 'object') { replacer = _replaceDefiner(atts.xmlns); } else { replacer = ' xmlns="' + atts.xmlns + '"'; } // try { // Also fix DOMParser to work with text/html elem = nodes[nodes.length - 1] = new DOMParser().parseFromString(new XmlSerializer().serializeToString(elem) // Mozilla adds XHTML namespace .replace(' xmlns="' + NS_HTML + '"', replacer), 'application/xml').documentElement; // }catch(e) {alert(elem.outerHTML);throw e;} } var orderedArr = atts.$a ? atts.$a.map(_copyOrderedAtts) : [atts]; orderedArr.forEach(_checkAtts); break; case 'fragment': case 'element': /* 1) Last element always the parent (put null if don't want parent and want to return array) unless only atts and children (no other elements) 2) Individual elements (DOM elements or sequences of string[/object/array]) get added to parent first-in, first-added */ if (i === 0) { // Allow wrapping of element elem = arg; } if (i === argc - 1 || i === argc - 2 && args[i + 1] === null) { // parent var elsl = nodes.length; for (var k = 0; k < elsl; k++) { _appendNode(arg, nodes[k]); } // Todo: Apply stylesheets if any style tags were added elsewhere besides the first element? _applyAnyStylesheet(nodes[0]); // We have to execute any stylesheets even if not appending or otherwise IE will never apply them } else { nodes[nodes.length] = arg; } break; case 'array': // Arrays or arrays of arrays indicate child nodes var child = arg; var cl = child.length; for (var j = 0; j < cl; j++) { // Go through children array container to handle elements var childContent = child[j]; var childContentType = typeof childContent === 'undefined' ? 'undefined' : _typeof(childContent); if (childContent === undefined) { throw String('Parent array:' + JSON.stringify(args) + '; child: ' + child + '; index:' + j); } switch (childContentType) { // Todo: determine whether null or function should have special handling or be converted to text case 'string':case 'number':case 'boolean': _appendNode(elem, doc.createTextNode(childContent)); break; default: if (Array.isArray(childContent)) { // Arrays representing child elements _appendNode(elem, _optsOrUndefinedJML.apply(undefined, [opts].concat(toConsumableArray(childContent)))); } else if (childContent['#']) { // Fragment _appendNode(elem, _optsOrUndefinedJML(opts, childContent['#'])); } else { // Single DOM element children _appendNode(elem, childContent); } break; } } break; } } var ret = nodes[0] || elem; if (opts && isRoot && opts.$map && opts.$map.root) { setMap(true); } return ret; }; /** * Converts a DOM object or a string of HTML into a Jamilih object (or string) * @param {string|HTMLElement} [dom=document.documentElement] Defaults to converting the current document. * @param {object} [config={stringOutput:false}] Configuration object * @param {boolean} [config.stringOutput=false] Whether to output the Jamilih object as a string. * @returns {array|string} Array containing the elements which represent a Jamilih object, or, if `stringOutput` is true, it will be the stringified version of such an object */ jml.toJML = function (dom, config) { config = config || { stringOutput: false }; if (typeof dom === 'string') { dom = new DOMParser().parseFromString(dom, 'text/html'); // todo: Give option for XML once implemented and change JSDoc to allow for Element } var ret = []; var parent = ret; var parentIdx = 0; function invalidStateError() { // These are probably only necessary if working with text/html function DOMException() { return this; } { // INVALID_STATE_ERR per section 9.3 XHTML 5: http://www.w3.org/TR/html5/the-xhtml-syntax.html // Since we can't instantiate without this (at least in Mozilla), this mimicks at least (good idea?) var e = new DOMException(); e.code = 11; throw e; } } function addExternalID(obj, node) { if (node.systemId.includes('"') && node.systemId.includes("'")) { invalidStateError(); } var publicId = node.publicId; var systemId = node.systemId; if (systemId) { obj.systemId = systemId; } if (publicId) { obj.publicId = publicId; } } function set$$1(val) { parent[parentIdx] = val; parentIdx++; } function setChildren() { set$$1([]); parent = parent[parentIdx - 1]; parentIdx = 0; } function setObj(prop1, prop2) { parent = parent[parentIdx - 1][prop1]; parentIdx = 0; if (prop2) { parent = parent[prop2]; } } function parseDOM(node, namespaces) { // namespaces = clone(namespaces) || {}; // Ensure we're working with a copy, so different levels in the hierarchy can treat it differently /* if ((node.prefix && node.prefix.includes(':')) || (node.localName && node.localName.includes(':'))) { invalidStateError(); } */ var type = 'nodeType' in node ? node.nodeType : null; namespaces = Object.assign({}, namespaces); var xmlChars = /([\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$/; // eslint-disable-line no-control-regex if ([2, 3, 4, 7, 8].includes(type) && !xmlChars.test(node.nodeValue)) { invalidStateError(); } var children = void 0, start = void 0, tmpParent = void 0, tmpParentIdx = void 0; function setTemp() { tmpParent = parent; tmpParentIdx = parentIdx; } function resetTemp() { parent = tmpParent; parentIdx = tmpParentIdx; parentIdx++; // Increment index in parent container of this element } switch (type) { case 1: // ELEMENT setTemp(); var nodeName = node.nodeName.toLowerCase(); // Todo: for XML, should not lower-case setChildren(); // Build child array since elements are, except at the top level, encapsulated in arrays set$$1(nodeName); start = {}; var hasNamespaceDeclaration = false; if (namespaces[node.prefix || ''] !== node.namespaceURI) { namespaces[node.prefix || ''] = node.namespaceURI; if (node.prefix) { start['xmlns:' + node.prefix] = node.namespaceURI; } else if (node.namespaceURI) { start.xmlns = node.namespaceURI; } hasNamespaceDeclaration = true; } if (node.attributes.length) { set$$1(Array.from(node.attributes).reduce(function (obj, att) { obj[att.name] = att.value; // Attr.nodeName and Attr.nodeValue are deprecated as of DOM4 as Attr no longer inherits from Node, so we can safely use name and value return obj; }, start)); } else if (hasNamespaceDeclaration) { set$$1(start); } children = node.childNodes; if (children.length) { setChildren(); // Element children array container Array.from(children).forEach(function (childNode) { parseDOM(childNode, namespaces); }); } resetTemp(); break; case undefined: // Treat as attribute node until this is fixed: https://github.com/tmpvar/jsdom/issues/1641 / https://github.com/tmpvar/jsdom/pull/1822 case 2: // ATTRIBUTE (should only get here if passing in an attribute node) set$$1({ $attribute: [node.namespaceURI, node.name, node.value] }); break; case 3: // TEXT if (config.stripWhitespace && /^\s+$/.test(node.nodeValue)) { return; } set$$1(node.nodeValue); break; case 4: // CDATA if (node.nodeValue.includes(']]' + '>')) { invalidStateError(); } set$$1(['![', node.nodeValue]); break; case 5: // ENTITY REFERENCE (probably not used in browsers since already resolved) set$$1(['&', node.nodeName]); break; case 6: // ENTITY (would need to pass in directly) setTemp(); start = {}; if (node.xmlEncoding || node.xmlVersion) { // an external entity file? start.$ENTITY = { name: node.nodeName, version: node.xmlVersion, encoding: node.xmlEncoding }; } else { start.$ENTITY = { name: node.nodeName }; if (node.publicId || node.systemId) { // External Entity? addExternalID(start.$ENTITY, node); if (node.notationName) { start.$ENTITY.NDATA = node.notationName; } } } set$$1(start); children = node.childNodes; if (children.length) { start.$ENTITY.childNodes = []; // Set position to $ENTITY's childNodes array children setObj('$ENTITY', 'childNodes'); Array.from(children).forEach(function (childNode) { parseDOM(childNode, namespaces); }); } resetTemp(); break; case 7: // PROCESSING INSTRUCTION if (/^xml$/i.test(node.target)) { invalidStateError(); } if (node.target.includes('?>')) { invalidStateError(); } if (node.target.includes(':')) { invalidStateError(); } if (node.data.includes('?>')) { invalidStateError(); } set$$1(['?', node.target, node.data]); // Todo: Could give option to attempt to convert value back into object if has pseudo-attributes break; case 8: // COMMENT if (node.nodeValue.includes('--') || node.nodeValue.length && node.nodeValue.lastIndexOf('-') === node.nodeValue.length - 1) { invalidStateError(); } set$$1(['!', node.nodeValue]); break; case 9: // DOCUMENT setTemp(); var docObj = { $document: { childNodes: [] } }; if (config.xmlDeclaration) { docObj.$document.xmlDeclaration = { version: doc.xmlVersion, encoding: doc.xmlEncoding, standAlone: doc.xmlStandalone }; } set$$1(docObj); // doc.implementation.createHTMLDocument // Set position to fragment's array children setObj('$document', 'childNodes'); children = node.childNodes; if (!children.length) { invalidStateError(); } // set({$xmlDocument: []}); // doc.implementation.createDocument // Todo: use this conditionally Array.from(children).forEach(function (childNode) { // Can't just do documentElement as there may be doctype, comments, etc. // No need for setChildren, as we have already built the container array parseDOM(childNode, namespaces); }); resetTemp(); break; case 10: // DOCUMENT TYPE setTemp(); // Can create directly by doc.implementation.createDocumentType start = { $DOCTYPE: { name: node.name } }; if (node.internalSubset) { start.internalSubset = node.internalSubset; } var pubIdChar = /^(\u0020|\u000D|\u000A|[a-zA-Z0-9]|[-'()+,./:=?;!*#@$_%])*$/; // eslint-disable-line no-control-regex if (!pubIdChar.test(node.publicId)) { invalidStateError(); } addExternalID(start.$DOCTYPE, node); // Fit in internal subset along with entities?: probably don't need as these would only differ if from DTD, and we're not rebuilding the DTD set$$1(start); // Auto-generate the internalSubset instead? Avoid entities/notations in favor of array to preserve order? var entities = node.entities; // Currently deprecated if (entities && entities.length) { start.$DOCTYPE.entities = []; setObj('$DOCTYPE', 'entities'); Array.from(entities).forEach(function (entity) { parseDOM(entity, namespaces); }); // Reset for notations parent = tmpParent; parentIdx = tmpParentIdx + 1; } var notations = node.notations; // Currently deprecated if (notations && notations.length) { start.$DOCTYPE.notations = []; setObj('$DOCTYPE', 'notations'); Array.from(notations).forEach(function (notation) { parseDOM(notation, namespaces); }); } resetTemp(); break; case 11: // DOCUMENT FRAGMENT setTemp(); set$$1({ '#': [] }); // Set position to fragment's array children setObj('#'); children = node.childNodes; Array.from(children).forEach(function (childNode) { // No need for setChildren, as we have already built the container array parseDOM(childNode, namespaces); }); resetTemp(); break; case 12: // NOTATION start = { $NOTATION: { name: node.nodeName } }; addExternalID(start.$NOTATION, node); set$$1(start); break; default: throw new TypeError('Not an XML type'); } } parseDOM(dom, {}); if (config.stringOutput) { return JSON.stringify(ret[0]); } return ret[0]; }; jml.toJMLString = function (dom, config) { return jml.toJML(dom, Object.assign(config || {}, { stringOutput: true })); }; jml.toDOM = function () { // Alias for jml() return jml.apply(undefined, arguments); }; jml.toHTML = function () { // Todo: Replace this with version of jml() that directly builds a string var ret = jml.apply(undefined, arguments); // Todo: deal with serialization of properties like 'selected', 'checked', 'value', 'defaultValue', 'for', 'dataset', 'on*', 'style'! (i.e., need to build a string ourselves) return ret.outerHTML; }; jml.toDOMString = function () { // Alias for jml.toHTML for parity with jml.toJMLString return jml.toHTML.apply(jml, arguments); }; jml.toXML = function () { var ret = jml.apply(undefined, arguments); return new XmlSerializer().serializeToString(ret); }; jml.toXMLDOMString = function () { // Alias for jml.toXML for parity with jml.toJMLString return jml.toXML.apply(jml, arguments); }; var JamilihMap = function (_Map) { inherits(JamilihMap, _Map); function JamilihMap() { classCallCheck(this, JamilihMap); return possibleConstructorReturn(this, (JamilihMap.__proto__ || Object.getPrototypeOf(JamilihMap)).apply(this, arguments)); } createClass(JamilihMap, [{ key: 'get', value: function get$$1(elem) { elem = typeof elem === 'string' ? $(elem) : elem; return get(JamilihMap.prototype.__proto__ || Object.getPrototypeOf(JamilihMap.prototype), 'get', this).call(this, elem); } }, { key: 'set', value: function set$$1(elem, value) { elem = typeof elem === 'string' ? $(elem) : elem; return get(JamilihMap.prototype.__proto__ || Object.getPrototypeOf(JamilihMap.prototype), 'set', this).call(this, elem, value); } }, { key: 'invoke', value: function invoke(elem, methodName) { var _get; elem = typeof elem === 'string' ? $(elem) : elem; for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { args[_key3 - 2] = arguments[_key3]; } return (_get = this.get(elem))[methodName].apply(_get, [elem].concat(args)); } }]); return JamilihMap; }(Map); var JamilihWeakMap = function (_WeakMap) { inherits(JamilihWeakMap, _WeakMap); function JamilihWeakMap() { classCallCheck(this, JamilihWeakMap); return possibleConstructorReturn(this, (JamilihWeakMap.__proto__ || Object.getPrototypeOf(JamilihWeakMap)).apply(this, arguments)); } createClass(JamilihWeakMap, [{ key: 'get', value: function get$$1(elem) { elem = typeof elem === 'string' ? $(elem) : elem; return get(JamilihWeakMap.prototype.__proto__ || Object.getPrototypeOf(JamilihWeakMap.prototype), 'get', this).call(this, elem); } }, { key: 'set', value: function set$$1(elem, value) { elem = typeof elem === 'string' ? $(elem) : elem; return get(JamilihWeakMap.prototype.__proto__ || Object.getPrototypeOf(JamilihWeakMap.prototype), 'set', this).call(this, elem, value); } }, { key: 'invoke', value: function invoke(elem, methodName) { var _get2; elem = typeof elem === 'string' ? $(elem) : elem; for (var _len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) { args[_key4 - 2] = arguments[_key4]; } return (_get2 = this.get(elem))[methodName].apply(_get2, [elem].concat(args)); } }]); return JamilihWeakMap; }(WeakMap); jml.Map = JamilihMap; jml.WeakMap = JamilihWeakMap; jml.weak = function (obj) { var map = new JamilihWeakMap(); for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { args[_key5 - 1] = arguments[_key5]; } var elem = jml.apply(undefined, [{ $map: [map, obj] }].concat(args)); return [map, elem]; }; jml.strong = function (obj) { var map = new JamilihMap(); for (var _len6 = arguments.length, args = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { args[_key6 - 1] = arguments[_key6]; } var elem = jml.apply(undefined, [{ $map: [map, obj] }].concat(args)); return [map, elem]; }; jml.symbol = jml.sym = jml.for = function (elem, sym) { elem = typeof elem === 'string' ? $(elem) : elem; return elem[(typeof sym === 'undefined' ? 'undefined' : _typeof(sym)) === 'symbol' ? sym : Symbol.for(sym)]; }; jml.command = function (elem, symOrMap, methodName) { elem = typeof elem === 'string' ? $(elem) : elem; var func = void 0; for (var _len7 = arguments.length, args = Array(_len7 > 3 ? _len7 - 3 : 0), _key7 = 3; _key7 < _len7; _key7++) { args[_key7 - 3] = arguments[_key7]; } if (['symbol', 'string'].includes(typeof symOrMap === 'undefined' ? 'undefined' : _typeof(symOrMap))) { var _func; func = jml.sym(elem, symOrMap); if (typeof func === 'function') { return func.apply(undefined, [methodName].concat(args)); // Already has `this` bound to `elem` } return (_func = func)[methodName].apply(_func, args); } else { var _func3; func = symOrMap.get(elem); if (typeof func === 'function') { var _func2; return (_func2 = func).call.apply(_func2, [elem, methodName].concat(args)); } return (_func3 = func)[methodName].apply(_func3, [elem].concat(args)); } // return func[methodName].call(elem, ...args); }; jml.setWindow = function (wind) { win = wind; }; jml.setDocument = function (docum) { doc = docum; if (docum && docum.body) { body = docum.body; } }; jml.setXMLSerializer = function (xmls) { XmlSerializer = xmls; }; jml.getWindow = function () { return win; }; jml.getDocument = function () { return doc; }; jml.getXMLSerializer = function () { return XmlSerializer; }; var body = doc && doc.body; var nbsp = '\xA0'; // Very commonly needed in templates export default jml; export { jml, $, $$, nbsp, body };
export default from './navigation.component';
(function(){ 'use strict'; angular .module('app') .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { $stateProvider .state('edit-profile', { url:'/edit-profile/:id', templateUrl: 'edit-profile-state/edit-profile.view.html', controller: 'EditProfileController', controllerAs: 'vm', permissions: { only: 'isAuthorized' } }) }]) })();
'use strict'; angular.module('<%= name %>') .service('<%= serviceName %>', function ($q, $http) { // A private cache key. var cache = {}; // Update broadcast name. var broadcastUpdateEventName = '<%= serviceName %>Change'; /** * Return the promise with the collection, from cache or the server. * * @returns {*} */ this.get = function() { if (cache) { return $q.when(cache.data); } return getDataFromBackend(); }; /** * Return promise with the collection from the server. * * @returns {$q.promise} */ function getDataFromBackend() { var deferred = $q.defer(); var url = ''; $http({ method: 'GET', url: url, params: params, transformResponse: prepareDataForLeafletMarkers }).success(function(response) { setCache(response); deferred.resolve(response); }); return deferred.promise; } /** * Save cache, and broadcast an event, because data changed. * * @param data * Object with the data to cache. */ var setCache = function(data) { // Cache data by company ID. cache = { data: data, timestamp: new Date() }; // Clear cache in 60 seconds. $timeout(function() { if (cache.data && cache.data[cacheId]) { cache.data[cacheId] = null; } }, 60000); // Broadcast a change event. $rootScope.$broadcast(broadcastUpdateEventName); }; /** * Convert the response to a collection. * * @param response * The response from the $http. * * @returns {*} * The Collection requested. */ function prepareDataForLeafletMarkers(response) { var collection; // Convert response serialized to an object. collection = angular.fromJson(reponse).data; return collection; } });
'use strict'; angular.module('myApp.contact', ['ngRoute']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/contact', { templateUrl: 'app/view/contact.html', controller: 'contactCtrl' }); }]) .controller('contactCtrl',['$scope','$http', function($scope, $http) { $scope.result = 'hidden' $scope.resultMessage; $scope.formData; //formData is an object holding the name, email, subject, and message $scope.submitButtonDisabled = false; $scope.submitted = false; //used so that form errors are shown only after the form has been submitted $scope.submit = function(contactform) { $scope.submitted = true; $scope.submitButtonDisabled = true; if (contactform.$valid) { $http({ method : 'POST', url : 'http://localhost:8000/contact-form.php', data : $.param($scope.formData), //param method from jQuery headers : { 'Content-Type': 'application/x-www-form-urlencoded' } //set the headers so angular passing info as form data (not request payload) }).success(function(data){ console.log(data); if (data) { //success comes from the return json object $scope.submitButtonDisabled = true; $scope.resultMessage = data; $scope.result='bg-success'; } else { $scope.submitButtonDisabled = false; $scope.resultMessage = data; $scope.result='bg-danger'; } }); } else { $scope.submitButtonDisabled = false; $scope.resultMessage = 'Failed <img src="http://www.chaosm.net/blog/wp-includes/images/smilies/icon_sad.gif" alt=":(" class="wp-smiley"> Please fill out all the fields.'; $scope.result='bg-danger'; } }; var myCenter=new google.maps.LatLng(42.656021, -71.330044); var mapProp = { center:myCenter, zoom:5, mapTypeId:google.maps.MapTypeId.ROADMAP }; var map=new google.maps.Map(document.getElementById("map"),mapProp); var marker=new google.maps.Marker({ position:myCenter, }); marker.setMap(map); var infowindow = new google.maps.InfoWindow({ content:"203 University avenue Lowell, MA, 01854" }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); }); google.maps.event.addDomListener(window, 'load'); }]);
'use strict'; angular.module('f1feeder.version.version-directive', []) .directive('appVersion', ['version', function(version) { return function(scope, elm, attrs) { elm.text(version); }; }]);
'use strict'; /** * Module Dependencies */ var gulp = require('gulp'); var sass = require('gulp-sass'); var app = require('./app.js'); /** * Config */ var PUBLIC = __dirname + '/public'; var ASSETS = PUBLIC + '/assets'; /** * Compiling */ gulp.task('sass', function(){ gulp.src(ASSETS + '/styles/sass/app.scss') .pipe(sass()) .pipe(gulp.dest(ASSETS + '/styles/css')); }); // lol gulp.task('piss', ['sass'], function() { app.init(); }); // Default gulp.task('default', ['piss']);
import {waitFor} from './wait-for' const isRemoved = result => !result || (Array.isArray(result) && !result.length) // Check if the element is not present. // As the name implies, waitForElementToBeRemoved should check `present` --> `removed` function initialCheck(elements) { if (isRemoved(elements)) { throw new Error( 'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.', ) } } async function waitForElementToBeRemoved(callback, options) { // created here so we get a nice stacktrace const timeoutError = new Error('Timed out in waitForElementToBeRemoved.') if (typeof callback !== 'function') { initialCheck(callback) const elements = Array.isArray(callback) ? callback : [callback] const getRemainingElements = elements.map(element => { let parent = element.parentElement if (parent === null) return () => null while (parent.parentElement) parent = parent.parentElement return () => (parent.contains(element) ? element : null) }) callback = () => getRemainingElements.map(c => c()).filter(Boolean) } initialCheck(callback()) return waitFor(() => { let result try { result = callback() } catch (error) { if (error.name === 'TestingLibraryElementError') { return undefined } throw error } if (!isRemoved(result)) { throw timeoutError } return undefined }, options) } export {waitForElementToBeRemoved} /* eslint require-await: "off" */
// @flow import React, { Component, PropTypes } from "react" import { connect } from "react-redux" import TextField from 'material-ui/TextField' import { CreateAuctionButton } from "../../molecules/" import * as AuctionActions from "../../../actions/auction" import { Button } from "../../atoms/" import styles from "./styles.css" export class CreateAuctionBox extends Component { constructor(props) { super(props) this.state = { name: "", minimum: "", message: "", image: "", auctionMsg: props.auctionMsg, } } change = (event) => { if ("id" in event.target && "value" in event.target) { console.log(event.target.id) console.log(event.target.value) this.setState({ [event.target.id]: event.target.value }) } } data = () => { const { name, minimum, message, image } = this.state const base = { name : name, minimum : minimum, message : message, image : image } if (firebase.auth().currentUser) { return Object.assign({}, base, { usrID : firebase.auth().currentUser.uid }) } return base } action = () => { const { name, minimum, message, image } = this.state if (name && minimum && message && image && minimum > 0) { const { dispatch } = this.props console.log(this.data()) dispatch(AuctionActions.queryCreateAuction(JSON.stringify(this.data()))) } } componentWillReceiveProps(nextProps) { if(JSON.stringify(this.state.auctionMsg) !== JSON.stringify(nextProps.auctionMsg)) { this.setState({ auctionMsg: nextProps.auctionMsg }) } } render() { const { auctionMsg } = this.state return ( <div className={ styles.root }> <h3>Create Bid</h3> <div>Status: <span style={{ color : (auctionMsg.status.toLowerCase() !== 'success' ? "red" : "green") }}>{ auctionMsg.status }</span></div> <TextField id="name" value={ this.state.name } floatingLabelText="Domain" onChange={this.change}/><br /> <TextField id="minimum" type="number" value={ this.state.minimum } floatingLabelText="Minimum" onChange={this.change}/><br /> <TextField id="message" value={ this.state.message } floatingLabelText="Message" onChange={this.change}/><br /> <TextField id="image" value={ this.state.image } floatingLabelText="Image" style={{ "marginBottom" : "1em"}} onChange={this.change}/><br /> <Button onClick={ this.action }> Create Auction </Button> </div> ) } } CreateAuctionBox.propTypes = { auctionMsg: PropTypes.object.isRequired, dispatch: PropTypes.func.isRequired, } function mapStateToProps(state) { const { auctionMsg } = state.auction return { auctionMsg, } } export default connect(mapStateToProps)(CreateAuctionBox)
"use strict"; var expect = require('chai').expect , protolib = require(__dirname + '/../') ; describe('protolib', function() { describe('clone', function() { it('should create a clone of the given object', function() { var object = { name: 'Philip' , hello: function() { return 'Hello, my name is ' + this.name; } , date: new Date() , arr: [1, {foo: 'bar'}] }; var clone_object = protolib.clone(object); expect(clone_object).to.have.property('name', 'Philip'); expect(clone_object.hello()).to.equal('Hello, my name is Philip'); expect(clone_object.date.getMonth()).to.equal(new Date().getMonth()); expect(clone_object).to.have.deep.property('arr[0]', 1); expect(clone_object).to.have.deep.property('arr[1].foo', 'bar'); }); it('should throw an error if input is not an object or array', function() { expect(protolib.clone).to.throw('Cannot clone!'); }); }); describe('inherit', function() { it('should set the prototype of an object to the given value', function() { var proto = {foo: 'bar'}; var object = protolib.inherit(proto); expect(object).to.have.property('foo', 'bar'); proto.foo = 'baz'; expect(object).to.have.property('foo', 'baz'); }); }); describe('mixin', function() { it('should add the prototype properties to the given object', function() { var proto = {type: 'list', values: [1, 2, 3]}; var object = {readonly: true}; protolib.mixin(object, proto); expect(object).to.have.property('readonly', true); expect(object).to.have.property('type', 'list'); expect(object).to.have.deep.property('values[0]', 1); expect(object).to.have.deep.property('values[1]', 2); expect(object).to.have.deep.property('values[2]', 3); }); it('should overwrite any existing properties with duplicate names', function() { var proto = {type: 'list', values: [1, 2, 3]}; var object = {type: 'none'}; protolib.mixin(object, proto); expect(object).to.have.property('type', 'list'); expect(object).to.have.deep.property('values[0]', 1); expect(object).to.have.deep.property('values[1]', 2); expect(object).to.have.deep.property('values[2]', 3); }); }); });
console.log('load version 2.0.0');
/*! * Copyright 2014 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! * @module bigquery/dataset */ 'use strict'; var common = require('@google-cloud/common'); var extend = require('extend'); var is = require('is'); var util = require('util'); /** * @type {module:bigquery/table} * @private */ var Table = require('./table.js'); /*! Developer Documentation * * @param {module:bigquery} bigQuery - BigQuery instance. * @param {string} id - The ID of the Dataset. */ /** * Interact with your BigQuery dataset. Create a Dataset instance with * {module:bigquery#createDataset} or {module:bigquery#dataset}. * * @alias module:bigquery/dataset * @constructor * * @example * var dataset = bigquery.dataset('institutions'); */ function Dataset(bigQuery, id) { var methods = { /** * Create a dataset. * * @example * dataset.create(function(err, dataset, apiResponse) { * if (!err) { * // The dataset was created successfully. * } * }); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.create().then(function(data) { * var dataset = data[0]; * var apiResponse = data[1]; * }); */ create: true, /** * Check if the dataset exists. * * @param {function} callback - The callback function. * @param {?error} callback.err - An error returned while making this * request. * @param {boolean} callback.exists - Whether the dataset exists or not. * * @example * dataset.exists(function(err, exists) {}); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.exists().then(function(data) { * var exists = data[0]; * }); */ exists: true, /** * Get a dataset if it exists. * * You may optionally use this to "get or create" an object by providing an * object with `autoCreate` set to `true`. Any extra configuration that is * normally required for the `create` method must be contained within this * object as well. * * @param {options=} options - Configuration object. * @param {boolean} options.autoCreate - Automatically create the object if * it does not exist. Default: `false` * * @example * dataset.get(function(err, dataset, apiResponse) { * if (!err) { * // `dataset.metadata` has been populated. * } * }); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.get().then(function(data) { * var dataset = data[0]; * var apiResponse = data[1]; * }); */ get: true, /** * Get the metadata for the Dataset. * * @resource [Datasets: get API Documentation]{@link https://cloud.google.com/bigquery/docs/reference/v2/datasets/get} * * @param {function} callback - The callback function. * @param {?error} callback.err - An error returned while making this * request. * @param {object} callback.metadata - The dataset's metadata. * @param {object} callback.apiResponse - The full API response. * * @example * dataset.getMetadata(function(err, metadata, apiResponse) {}); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.getMetadata().then(function(data) { * var metadata = data[0]; * var apiResponse = data[1]; * }); */ getMetadata: true, /** * Sets the metadata of the Dataset object. * * @resource [Datasets: patch API Documentation]{@link https://cloud.google.com/bigquery/docs/reference/v2/datasets/patch} * * @param {object} metadata - Metadata to save on the Dataset. * @param {function} callback - The callback function. * @param {?error} callback.err - An error returned while making this * request. * @param {object} callback.apiResponse - The full API response. * * @example * var metadata = { * description: 'Info for every institution in the 2013 IPEDS universe' * }; * * dataset.setMetadata(metadata, function(err, apiResponse) {}); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.setMetadata(metadata).then(function(data) { * var apiResponse = data[0]; * }); */ setMetadata: true }; common.ServiceObject.call(this, { parent: bigQuery, baseUrl: '/datasets', id: id, createMethod: bigQuery.createDataset.bind(bigQuery), methods: methods }); this.bigQuery = bigQuery; } util.inherits(Dataset, common.ServiceObject); /** * Run a query scoped to your dataset as a readable object stream. * * See {module:bigquery#createQueryStream} for full documentation of this * method. */ Dataset.prototype.createQueryStream = function(options) { if (is.string(options)) { options = { query: options }; } options = extend(true, {}, options, { defaultDataset: { datasetId: this.id } }); return this.bigQuery.createQueryStream(options); }; /** * Create a table given a tableId or configuration object. * * @resource [Tables: insert API Documentation]{@link https://cloud.google.com/bigquery/docs/reference/v2/tables/insert} * * @param {string} id - Table id. * @param {object=} options - See a * [Table resource](https://cloud.google.com/bigquery/docs/reference/v2/tables#resource). * @param {string|object} options.schema - A comma-separated list of name:type * pairs. Valid types are "string", "integer", "float", "boolean", and * "timestamp". If the type is omitted, it is assumed to be "string". * Example: "name:string, age:integer". Schemas can also be specified as a * JSON array of fields, which allows for nested and repeated fields. See * a [Table resource](http://goo.gl/sl8Dmg) for more detailed information. * @param {function} callback - The callback function. * @param {?error} callback.err - An error returned while making this request * @param {module:bigquery/table} callback.table - The newly created table. * @param {object} callback.apiResponse - The full API response. * * @example * var tableId = 'institution_data'; * * var options = { * // From the data.gov CSV dataset (http://goo.gl/kSE7z6): * schema: 'UNITID,INSTNM,ADDR,CITY,STABBR,ZIP,FIPS,OBEREG,CHFNM,...' * }; * * dataset.createTable(tableId, options, function(err, table, apiResponse) {}); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.createTable(tableId, options).then(function(data) { * var table = data[0]; * var apiResponse = data[1]; * }); */ Dataset.prototype.createTable = function(id, options, callback) { var self = this; if (is.fn(options)) { callback = options; options = {}; } var body = extend(true, {}, options, { tableReference: { datasetId: this.id, projectId: this.bigQuery.projectId, tableId: id } }); if (is.string(options.schema)) { body.schema = Table.createSchemaFromString_(options.schema); } if (is.array(options.schema)) { body.schema = { fields: options.schema }; } if (body.schema && body.schema.fields) { body.schema.fields = body.schema.fields.map(function(field) { if (field.fields) { field.type = 'RECORD'; } return field; }); } this.request({ method: 'POST', uri: '/tables', json: body }, function(err, resp) { if (err) { callback(err, null, resp); return; } var table = self.table(resp.tableReference.tableId); table.metadata = resp; callback(null, table, resp); }); }; /** * Delete the dataset. * * @resource [Datasets: delete API Documentation]{@link https://cloud.google.com/bigquery/docs/reference/v2/datasets/delete} * * @param {object=} options - The configuration object. * @param {boolean} options.force - Force delete dataset and all tables. * Default: false. * @param {function} callback - The callback function. * @param {?error} callback.err - An error returned while making this request * @param {object} callback.apiResponse - The full API response. * * @example * //- * // Delete the dataset, only if it does not have any tables. * //- * dataset.delete(function(err, apiResponse) {}); * * //- * // Delete the dataset and any tables it contains. * //- * dataset.delete({ force: true }, function(err, apiResponse) {}); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.delete().then(function(data) { * var apiResponse = data[0]; * }); */ Dataset.prototype.delete = function(options, callback) { if (!callback) { callback = options; options = {}; } var query = { deleteContents: !!options.force }; this.request({ method: 'DELETE', uri: '', qs: query }, callback); }; /** * Get a list of tables. * * @resource [Tables: list API Documentation]{@link https://cloud.google.com/bigquery/docs/reference/v2/tables/list} * * @param {object=} query - Configuration object. * @param {boolean} query.autoPaginate - Have pagination handled automatically. * Default: true. * @param {number} query.maxApiCalls - Maximum number of API calls to make. * @param {number} query.maxResults - Maximum number of results to return. * @param {string} query.pageToken - Token returned from a previous call, to * request the next page of results. * @param {function} callback - The callback function. * @param {?error} callback.err - An error returned while making this request * @param {module:bigquery/table[]} callback.tables - The list of tables from * your Dataset. * @param {object} callback.apiResponse - The full API response. * * @example * dataset.getTables(function(err, tables, nextQuery, apiResponse) { * // If `nextQuery` is non-null, there are more results to fetch. * }); * * //- * // If the callback is omitted, we'll return a Promise. * //- * dataset.getTables().then(function(data) { * var tables = data[0]; * }); */ Dataset.prototype.getTables = function(query, callback) { var that = this; if (is.fn(query)) { callback = query; query = {}; } query = query || {}; this.request({ uri: '/tables', qs: query }, function(err, resp) { if (err) { callback(err, null, null, resp); return; } var nextQuery = null; if (resp.nextPageToken) { nextQuery = extend({}, query, { pageToken: resp.nextPageToken }); } var tables = (resp.tables || []).map(function(tableObject) { var table = that.table(tableObject.tableReference.tableId); table.metadata = tableObject; return table; }); callback(null, tables, nextQuery, resp); }); }; /** * List all or some of the {module:bigquery/table} objects in your project as a * readable object stream. * * @param {object=} query - Configuration object. See * {module:bigquery/dataset#getTables} for a complete list of options. * @return {stream} * * @example * dataset.getTablesStream() * .on('error', console.error) * .on('data', function(table) {}) * .on('end', function() { * // All tables have been retrieved * }); * * //- * // If you anticipate many results, you can end a stream early to prevent * // unnecessary processing and API requests. * //- * dataset.getTablesStream() * .on('data', function(table) { * this.end(); * }); */ Dataset.prototype.getTablesStream = common.paginator.streamify('getTables'); /** * Run a query scoped to your dataset. * * See {module:bigquery#query} for full documentation of this method. */ Dataset.prototype.query = function(options, callback) { if (is.string(options)) { options = { query: options }; } options = extend(true, {}, options, { defaultDataset: { datasetId: this.id } }); return this.bigQuery.query(options, callback); }; /** * Create a Table object. * * @param {string} id - The ID of the table. * @return {module:bigquery/table} * * @example * var institutions = dataset.table('institution_data'); */ Dataset.prototype.table = function(id) { return new Table(this, id); }; /*! Developer Documentation * * These methods can be auto-paginated. */ common.paginator.extend(Dataset, ['getTables']); /*! Developer Documentation * * All async methods (except for streams) will return a Promise in the event * that a callback is omitted. */ common.util.promisifyAll(Dataset, { exclude: ['table'] }); module.exports = Dataset;
(function(Button, set) { set += ": "; test(set + "Test btn class added", function() { var $elements; $elements = new Button($("<a>").add("<button>").add("<input>")); ok($elements.hasClass("btn"), "Buttons should be of the btn class"); }); test(set + "Test button creation, no arguments", function() { var button = new Button(); ok(button.hasClass("btn"), "Button should be of the btn class"); ok(button.is("button"), "Button should be a <button> element"); equal(button.attr("type"), "button", "Type attribute should be 'button'"); }); test(set + "Test default buttons", function() { var button = new Button(); button.primary(); equal(button.attr("class"), "btn " + button.options.PRIMARY, "Primary style button should be of the btn and '" + button.options.PRIMARY + "' classes only"); button.info(); equal(button.attr("class"), "btn " + button.options.INFO, "Info style button should be of the btn and '" + button.options.INFO + "' classes only"); button.success(); equal(button.attr("class"), "btn " + button.options.SUCCESS, "Success style button should be of the btn and '" + button.options.SUCCESS + "' classes only"); button.warning(); equal(button.attr("class"), "btn " + button.options.WARNING, "Warning style button should be of the btn and '" + button.options.WARNING + "' classes only"); button.danger(); equal(button.attr("class"), "btn " + button.options.DANGER, "Danger style button should be of the btn and '" + button.options.DANGER + "' classes only"); button.link(); equal(button.attr("class"), "btn " + button.options.LINK, "Link style button should be of the btn and '" + button.options.LINK + "' classes only"); button.defaultStyle(); equal(button.attr("class"), "btn", "Default button should be of the btn class only"); }); test(set+ "Test button sizes", function() { var button = new Button(); button.large(); equal(button.attr("class"), "btn " + button.sizes.LARGE, "Large button should be of the btn and '" + button.sizes.LARGE + "' classes only"); button.defaultSize(); equal(button.attr("class"), "btn", "Default button should be of the btn class only"); button.small(); equal(button.attr("class"), "btn " + button.sizes.SMALL, "Small button should be of the btn and '" + button.sizes.SMALL + "' classes only"); button.extraSmall(); equal(button.attr("class"), "btn " + button.sizes.EXTRASMALL, "Extra small button should be of the btn and '" + button.sizes.EXTRASMALL + "' classes only"); }); test(set + "Test block-level button", function () { var button = new Button(); button.block(); equal(button.attr("class"), "btn " + button.BLOCK, "Block level button should be of the btn and '" + button.BLOCK + "' classes only"); }); test(set + "Test disable <button> and <input> elements", function() { var buttons, hasClass; buttons = new Button($("<button>").add("<input>")); hasClass = false; buttons.disable(); equal(buttons.attr("disabled"), "disabled", "Disabled elements should have the disabled attribute value of 'disabled'"); buttons.map(function() { hasClass = hasClass || $(this).hasClass(Button.prototype.DISABLED); }); equal(hasClass, false, "Elements should not be of the '" + Button.prototype.DISABLED + "' class"); }); test(set + "Test disable <a> element", function() { var button = new Button("<a>"); button.disable(); ok(button.attr("disabled") === undefined, "Disabled anchor elements should not have the disabled attribute"); ok(button.hasClass(button.DISABLED), "Disabled anchor elements should be of the '" + button.DISABLED + "' class"); }); test(set + "Test set text", function() { var anotherButton, buttons, functionExpectedValue, oldText, text; oldText = "Hello, tester!"; text = "Hello, world!"; buttons = new Button( $("<button>") .add("<input type='button'>") .add("<input type='submit'>") .add("<input type='reset'>") .add("<input type='text'>")); //not a real button anotherButton = new Button("<button>" + oldText + "</button>"); buttons.text(text); //.eq() returns a jQuery object, so no worries about the Button.prototype.text() calls, here! equal(buttons.eq(0).text(), text, "<button> element should have text() set to " + text); equal(buttons.eq(0).attr("value"), undefined, "<button> element should not have the value attribute set"); equal(buttons.eq(1).text(), "", "<input> button element should have text() set to an empty string"); equal(buttons.eq(1).attr("value"), text, "<input> button element should have the value attribute set to " + text); equal(buttons.eq(2).text(), "", "<input> submit element should have text() set to an empty string"); equal(buttons.eq(2).attr("value"), text, "<input> submit element should have the value attribute set to " + text); equal(buttons.eq(3).text(), "", "<input> reset element should have text() set to an empty string"); equal(buttons.eq(3).attr("value"), text, "<input> reset element should have the value attribute set to " + text); equal(buttons.eq(4).text(), text, "<input> text (not a button) element should have text() set to " + text); equal(buttons.eq(4).attr("value"), undefined, "<input> text (not a button) element should not have the value attribute set"); anotherButton.text(function(index, old) { return "" + text + "-" + index + "-" + old; }); functionExpectedValue = "" + text + "-0-" + oldText; equal($.fn.text.apply(anotherButton, []), functionExpectedValue, "Setting text with this function should return '" + functionExpectedValue + "' for text()"); }); test(set + "Test get text", function() { var buttons, text; text = "Hello, world, again!"; buttons = { button: new Button("<button>" + text + "</button>"), input: { button: new Button("<input type='button' value='" + text + "'>"), submit: new Button("<input type='submit' value='" + text + "'>"), reset: new Button("<input type='reset' value='" + text + "'>"), notAButton: new Button("<input type='text' value='" + text + "'>") }, anchor: new Button("<a>" + text + "</a>") }; equal(buttons.button.text(), text, "<button> element should have text() return '" + text + "'"); equal(buttons.input.button.text(), text, "<input> button element should have text() return '" + text + "'"); equal(buttons.input.submit.text(), text, "<input> submit element should have text() return '" + text + "'"); equal(buttons.input.reset.text(), text, "<input> reset element should have text() return '" + text + "'"); equal(buttons.input.notAButton.text(), "", "<input> text (not a button) element should have text() return an empty string"); equal(buttons.anchor.text(), text, "<a> element should have text() return '" + text + "'"); }); })(uk.co.stevenmeyer.bootstrap.css.Button, "css.Button");
/// <reference path="Xrm.js" /> var EntityLogicalName = "uomschedule"; var Form_a793fa7c_8b63_43f0_b4bc_73f75a68935a_Properties = { description: "description", name: "name" }; var Form_a793fa7c_8b63_43f0_b4bc_73f75a68935a_Controls = { description: "description", name: "name" }; var pageData = { "Event": "none", "SaveMode": 1, "EventSource": null, "AuthenticationHeader": "", "CurrentTheme": "Default", "OrgLcid": 1033, "OrgUniqueName": "", "QueryStringParameters": { "_gridType": "1056", "etc": "1056", "id": "", "pagemode": "iframe", "preloadcache": "1344548892170", "rskey": "141637534" }, "ServerUrl": "", "UserId": "", "UserLcid": 1033, "UserRoles": [""], "isOutlookClient": false, "isOutlookOnline": true, "DataXml": "", "EntityName": "uomschedule", "Id": "", "IsDirty": false, "CurrentControl": "", "CurrentForm": null, "Forms": [], "FormType": 2, "ViewPortHeight": 558, "ViewPortWidth": 1231, "Attributes": [{ "Name": "description", "Value": "", "Type": "memo", "Format": "text", "IsDirty": false, "RequiredLevel": "none", "SubmitMode": "dirty", "UserPrivilege": { "canRead": true, "canUpdate": true, "canCreate": true }, "MaxLength": 2000, "Controls": [{ "Name": "description" }] }, { "Name": "name", "Value": "", "Type": "string", "Format": "text", "IsDirty": false, "RequiredLevel": "none", "SubmitMode": "dirty", "UserPrivilege": { "canRead": true, "canUpdate": true, "canCreate": true }, "MaxLength": 200, "Controls": [{ "Name": "name" }] }], "AttributesLength": 2, "Controls": [{ "Name": "description", "Type": "standard", "Disabled": false, "Visible": true, "Label": "Description", "Attribute": "description" }, { "Name": "name", "Type": "standard", "Disabled": false, "Visible": true, "Label": "Name", "Attribute": "name" }], "ControlsLength": 2, "Navigation": [], "Tabs": [{ "Label": "General", "Name": "general", "DisplayState": "expanded", "Visible": true, "Sections": [{ "Label": "UOM Schedule Information", "Name": "uom schedule information", "Visible": true, "Controls": [{ "Name": "name" }, { "Name": "description" }] }] }] }; var Xrm = new _xrm(pageData);
// To set up environmental variables, see http://twil.io/secure const accountSid = process.env.TWILIO_ACCOUNT_SID; const authToken = process.env.TWILIO_AUTH_TOKEN; const Twilio = require('twilio').Twilio; const client = new Twilio(accountSid, authToken); const service = client.sync.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); service .syncLists('MyFirstList') .syncListItems(0) .update({ data: { number: '001', attack: '49', name: 'Bulbasaur', }, }) .then(response => { console.log(response); }) .catch(error => { console.log(error); });
/* 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( 'newpage', 'af', { toolbar: 'Nuwe bladsy' } );
'use strict' const Twitter = require('twitter') const twitterOpts = require('./auth.json') const client = new Twitter(twitterOpts) const twttr = require('./twttr/') twttr.getTrendingTopics(client).then((tt) => { tt.forEach((topic, idx) => { twttr.searchTopic(client, topic).then((tweets) => { let statuses = twttr.transformTweets(tweets) console.log(statuses) // insights: word count, graphos etc. }) }) })
{ babelHelpers.inheritsLoose(Test, _Foo); function Test() { return _Foo.apply(this, arguments) || this; } return Test; }
import Aquaman from './components/Aquaman.jsx'; // eslint-disable-line no-unused-vars import '../styles/appStyles.scss';
const Hapi = require('hapi'); const Request = require('request'); const port = process.env.PORT || 8080; const server = new Hapi.Server(); const cephalopods = 'http://api.gbif.org/v1/species/136'; server.connection({ port: port, host: '0.0.0.0' }); server.route({ method: 'GET', path: '/', handler: function (request, reply) { Request(cephalopods, function (err, response, body) { return reply(body); }); } }); server.start(function () { console.log('Server started on ' + port); });
const {env, browsers} = require('config'); const isProd = env === 'production'; module.exports = { // parser: 'sugarss', plugins: { 'postcss-preset-env': browsers, 'cssnano': isProd ? {} : false, } };
$(document).ready(function() { SVGUpInstance.init('inforamaui', {"icons": { "logo":{"url":"images/inforama-icon.svg"}, "downarrow":{"url":"images/down-arrow.svg"}, "usericon":{"url":"images/user-icon.svg"} }, "classes":{ "mainstyle":{ "svgdefault":{"fillcolor":"#AA8833"}, "svghover":{"fillcolor":"#8CC63E"}, "cssdefault":{"opacity":"0.3", "width":"40px", "height":"40px", "transition":"all 0.5s"}, "csshover":{"opacity":"1", "width":"50px", "height":"50px"} } }} ); });
import _ from 'lodash' // eslint-disable-line export default function loadInitialState(req) { const user = req.user const state = { auth: {}, } if (user) { state.auth = { user: {id: user.id}, } if (req.session.accessToken) { state.auth.accessToken = req.session.accessToken.token } } if (req.csrfToken) { state.auth.csrf = req.csrfToken() } // Immutable.fromJS has a bug with objects flagged as anonymous in node 6 // https://github.com/facebook/immutable-js/issues/1001 return JSON.parse(JSON.stringify(state)) // callback(null, state) }
import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import pluralize from 'common/utils/pluralize'; import search from './actions'; import { selectSearchResultIds, selectIsSearching, selectIsSearchComplete } from './selectors'; import Element from 'common/components/Element'; import H3 from 'common/components/H3'; import Button from 'common/components/Button'; import VocabList from 'common/components/VocabList'; import { blue, orange } from 'common/styles/colors'; SearchResults.propTypes = { ids: PropTypes.arrayOf(PropTypes.number), isSearching: PropTypes.bool, isSearchComplete: PropTypes.bool, onReset: PropTypes.func.isRequired, }; SearchResults.defaultProps = { ids: [], isSearching: false, isSearchComplete: false, }; export function SearchResults({ ids, isSearching, isSearchComplete, onReset }) { const tooBroad = ids.length >= 50; const amount = `${ids.length}${tooBroad ? '+' : ''}`; const wordsFoundText = `${amount} ${pluralize('word', ids.length)} found${ tooBroad ? '. Try refining your search keywords.' : '' }`; return ( (isSearching || isSearchComplete) && ( <Fragment> <Element flexRow flexCenter> <H3>{(isSearching && 'Searching...') || wordsFoundText}</H3> {isSearchComplete && ( <Button bgColor={orange[5]} colorHover={orange[5]} onClick={onReset}> Clear Results </Button> )} </Element> <VocabList ids={ids} bgColor={blue[5]} showSecondary showFuri /> </Fragment> ) ); } const mapStateToProps = (state, props) => ({ ids: selectSearchResultIds(state, props), isSearching: selectIsSearching(state, props), isSearchComplete: selectIsSearchComplete(state, props), }); const mapDispatchToProps = { onReset: search.clear, }; export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);
import { toTitleCase } from 'utils'; export default values => { let newValues = { ...values }; // Add a sourceType if no source (i.e. not scraped) and no sourceType if (!newValues['source'] && !newValues['sourceType']) { newValues['sourceType'] = 'user'; } switch (newValues['sourceType']) { case 'user': newValues = { ...newValues, url: undefined, page: undefined, book: undefined, }; break; case 'website': newValues = { ...newValues, page: undefined, book: undefined }; break; case 'book': newValues = { ...newValues, url: undefined }; break; default: break; } if (Array.isArray(values['ingredients'])) { newValues = { ...newValues, ingredients: values['ingredients'].map(ingredient => ({ ...ingredient, text: ingredient.text.trim(), })), }; } return { public: true, ...newValues, title: toTitleCase(values['title']), }; };
pinion.backend.renderer.CommentRenderer = (function($) { var constr; // public API -- constructor constr = function(settings, backend) { var _this = this, data = settings.data; this.$element = $("<div class='pinion-backend-renderer-CommentRenderer'></div>"); // TEXTWRAPPER var $textWrapper = $("<div class='pinion-textWrapper'></div>") .appendTo(this.$element); // INFOS $("<div class='pinion-comment-info'></div>") // USER .append("<div class='pinion-name'><span class='pinion-backend-icon-user'></span><span class='pinion-username'>"+data.name+"</span></div>") // TIME .append("<div class='pinion-time'><span class='pinion-backend-icon-clock'></span><span class='pinion-time-text'>"+data.created+"</span></div>") .append("<div class='pinion-mail'><span class='pinion-backend-icon-mail'></span><a href='mailto:"+data.email+"' class='pinion-mail-adress'>"+data.email+"</a></div>") .appendTo(this.$element); // COMMENT $("<div class='pinion-commentWrapper'><div class='pinion-comment-text'>"+data.text+"</div></div>") .appendTo(this.$element); var $activate = $("<div class='pinion-activate'><div class='pinion-icon'></div><div class='pinion-text'>"+pinion.translate("activate comment")+"</div></div>") .click(function() { if(_this.$element.hasClass("pinion-activated")) { _this.setClean(); } else { _this.setDirty(); } _this.$element.toggleClass("pinion-activated") }); // RENDERER BAR var bar = []; if(pinion.hasPermission("comment", "approve comment")) { bar.push($activate); } if(pinion.hasPermission("comment", "delete comment")) { bar.push(pinion.data.Delete.call(this, data, function() { _this.info.deleted = true; _this.fadeOut(300, function() { _this.setDirty(); }); })); } if(!pinion.isEmpty(bar)) { pinion.data.Bar.call(this, bar); } // INFO pinion.data.Info.call(this, ["Time"], data); // group events settings.groupEvents = true; } // public API -- prototype constr.prototype = { constructor: pinion.backend.renderer.CommentRenderer, init: function() { this.info.id = this.settings.data.id; }, reset: function() { this.$element.removeClass("pinion-activated"); } } return constr; }(jQuery));
/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.lang.functional.scan"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.lang.functional.scan"] = true; dojo.provide("dojox.lang.functional.scan"); dojo.require("dojox.lang.functional.lambda"); // This module adds high-level functions and related constructs: // - "scan" family of functions // Notes: // - missing high-level functions are provided with the compatible API: // scanl, scanl1, scanr, scanr1 // Defined methods: // - take any valid lambda argument as the functional argument // - operate on dense arrays // - take a string as the array argument // - take an iterator objects as the array argument (only scanl, and scanl1) (function(){ var d = dojo, df = dojox.lang.functional, empty = {}; d.mixin(df, { // classic reduce-class functions scanl: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){ // summary: repeatedly applies a binary function to an array from left // to right using a seed value as a starting point; returns an array // of values produced by foldl() at that point. if(typeof a == "string"){ a = a.split(""); } o = o || d.global; f = df.lambda(f); var t, n, i; if(d.isArray(a)){ // array t = new Array((n = a.length) + 1); t[0] = z; for(i = 0; i < n; z = f.call(o, z, a[i], i, a), t[++i] = z); }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ // iterator t = [z]; for(i = 0; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a))); }else{ // object/dictionary t = [z]; for(i in a){ if(!(i in empty)){ t.push(z = f.call(o, z, a[i], i, a)); } } } return t; // Array }, scanl1: function(/*Array|String|Object*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ // summary: repeatedly applies a binary function to an array from left // to right; returns an array of values produced by foldl1() at that // point. if(typeof a == "string"){ a = a.split(""); } o = o || d.global; f = df.lambda(f); var t, n, z, first = true; if(d.isArray(a)){ // array t = new Array(n = a.length); t[0] = z = a[0]; for(var i = 1; i < n; t[i] = z = f.call(o, z, a[i], i, a), ++i); }else if(typeof a.hasNext == "function" && typeof a.next == "function"){ // iterator if(a.hasNext()){ t = [z = a.next()]; for(var i = 1; a.hasNext(); t.push(z = f.call(o, z, a.next(), i++, a))); } }else{ // object/dictionary for(var i in a){ if(!(i in empty)){ if(first){ t = [z = a[i]]; first = false; }else{ t.push(z = f.call(o, z, a[i], i, a)); } } } } return t; // Array }, scanr: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object*/ z, /*Object?*/ o){ // summary: repeatedly applies a binary function to an array from right // to left using a seed value as a starting point; returns an array // of values produced by foldr() at that point. if(typeof a == "string"){ a = a.split(""); } o = o || d.global; f = df.lambda(f); var n = a.length, t = new Array(n + 1), i = n; t[n] = z; for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z); return t; // Array }, scanr1: function(/*Array|String*/ a, /*Function|String|Array*/ f, /*Object?*/ o){ // summary: repeatedly applies a binary function to an array from right // to left; returns an array of values produced by foldr1() at that // point. if(typeof a == "string"){ a = a.split(""); } o = o || d.global; f = df.lambda(f); var n = a.length, t = new Array(n), z = a[n - 1], i = n - 1; t[i] = z; for(; i > 0; --i, z = f.call(o, z, a[i], i, a), t[i] = z); return t; // Array } }); })(); }
'use strict'; /* jasmine specs for directives go here */ describe('directives', function () { beforeEach(module('myApp.directives')); describe('app-version', function () { it('should print current version', function () { module(function ($provide) { $provide.value('version', 'TEST_VER'); }); inject(function ($compile, $rootScope) { var element = $compile('<span app-version></span>')($rootScope); expect(element.text()).toEqual('TEST_VER'); }); }); }); describe('Button directive', function(){ var $compile, $rootScope; beforeEach(inject(function (_$rootScope_, _$compile_) { $compile = _$compile_; $rootScope = _$rootScope_; })); it('should have "btn" class to the button element', function(){ var element = $compile('<button></button>')($rootScope); expect(element.hasClass('btn')).toBeTruthy(); }) }); describe('Pagination directive', function () { var element, $scope, lis; beforeEach(inject(function ($compile, $rootScope) { $scope = $rootScope; $scope.numPage = 5; $scope.currentPage = 2; element = $compile('<pagination num-pages="numPages" current-page="currentPage"></pagination>')($scope); $scope.$digest(); lis = function () { return element.find('li'); }; })); it('has the number of the page as text in each page item', function () { for (var i = 0;i < $scope.numPage; i++) { expect(lis.eq(i).text()).toEqual('' + i); } }); }); });
const https = require('https') const cookie = require('cookie'); var exports = module.exports = {} exports.getResponseHeaders = function(httpOptions, formData) { if (formData) { httpOptions.headers = formData.getHeaders() } return new Promise((resolve, reject) => { const request = https.request(httpOptions, (response) => { // handle http errors if (response.statusCode < 200 || response.statusCode > 299) { reject(new Error('Failed to load page, status code: ' + response.statusCode)); } // temporary data holder const body = []; // on every content chunk, push it to the data array response.on('data', () => {}); // we are done, resolve promise with those joined chunks response.on('end', () => resolve(response.headers)); }); // handle connection errors of the request request.on('error', (err) => reject(err)) request.end() }) } exports.getCookies = function(headers) { cookies = {} headers['set-cookie'].forEach((element) => { cookies = Object.assign(cookies, cookie.parse(element)) }) return cookies }
'use strict'; /** * Developed by Engagement Lab, 2019 * ============== * Route to retrieve data by url * @class api * @author Johnny Richardson * * ========== */ const keystone = global.keystone, mongoose = require('mongoose'), Bluebird = require('bluebird'); mongoose.Promise = require('bluebird'); let list = keystone.list('Story').model; var getAdjacent = (results, res, lang) => { let fields = 'key photo.public_id '; if (lang === 'en') fields += 'name'; else if (lang === 'tm') fields += 'nameTm'; else if (lang === 'hi') fields += 'nameHi'; // Get one next/prev person from selected person's sortorder let nextPerson = list.findOne({ sortOrder: { $gt: results.jsonData.sortOrder } }, fields).limit(1); let prevPerson = list.findOne({ sortOrder: { $lt: results.jsonData.sortOrder } }, fields).sort({ sortOrder: -1 }).limit(1); // Poplulate next/prev and output response Bluebird.props({ next: nextPerson, prev: prevPerson }).then(nextPrevResults => { let output = Object.assign(nextPrevResults, { person: results.jsonData }); return res.status(200).json({ status: 200, data: output }); }).catch(err => { console.log(err); }); }; var buildData = (storyId, res, lang) => { let data = null; let fields = 'key photo.public_id '; if (lang === 'en') fields += 'name subtitle'; else if (lang === 'tm') fields += 'nameTm subtitleTm'; else if (lang === 'hi') fields += 'nameHi subtitleHi'; if (storyId) { let subFields = ' description.html '; if (lang === 'tm') subFields = ' descriptionTm.html '; else if (lang === 'hi') subFields = ' descriptionHi.html '; data = list.findOne({ key: storyId }, fields + subFields + 'sortOrder -_id'); } else data = list.find({}, fields + ' -_id').sort([ ['sortOrder', 'descending'] ]); Bluebird.props({ jsonData: data }) .then(results => { // When retrieving one story, also get next/prev ones if (storyId) getAdjacent(results, res, lang); else { return res.status(200).json({ status: 200, data: results.jsonData }); } }).catch(err => { console.log(err); }) } /* * Get data */ exports.get = function (req, res) { let id = null; if (req.query.id) id = req.query.id; let lang = null; if (req.params.lang) lang = req.params.lang; return buildData(id, res, lang); }
import React from 'react'; import Sortable from '../../src/'; import DemoItem from '../components/DemoItem'; export default class Dynamic extends React.Component { constructor() { super(); this.state = { arr: [998, 225, 13] }; } handleSort(sortedArray) { this.setState({ arr: sortedArray }); } handleAddElement() { this.setState({ arr: this.state.arr.concat(Math.round(Math.random() * 1000)) }); } handleRemoveElement(index) { const newArr = this.state.arr.slice(); newArr.splice(index, 1); this.setState({ arr: newArr }); } render() { function renderItem(num, index) { return ( <DemoItem key={num} className="dynamic-item" sortData={num}> {num} <span className="delete" onClick={this.handleRemoveElement.bind(this, index)} >&times;</span> </DemoItem> ); } return ( <div className="demo-container"> <h4 className="demo-title"> Dynamically adding/removing children <a href="https://github.com/jasonslyvia/react-anything-sortable/tree/master/demo/pages/dynamic.js" target="_blank">source</a> </h4> <div className="dynamic-demo"> <button onClick={::this.handleAddElement}>Add 1 element</button> <Sortable onSort={::this.handleSort} dynamic> {this.state.arr.map(renderItem, this)} </Sortable> </div> </div> ); } }
import expect from "expect"; import { Collection } from "./Collection"; import { Server } from "./Server"; describe("Collection", () => { describe("constructor", () => { it("should set the initial set of data", () => { const collection = new Collection([ { id: 1, name: "foo" }, { id: 2, name: "bar" }, ]); expect(collection.getAll()).toEqual([ { id: 1, name: "foo" }, { id: 2, name: "bar" }, ]); }); it("should set identifier name to id by default", () => { const collection = new Collection(); expect(collection.identifierName).toEqual("id"); }); }); describe("getCount", () => { it("should return an integer", () => { expect(new Collection().getCount()).toEqual(0); }); it("should return the collection size", () => { expect(new Collection([{}, {}]).getCount()).toEqual(2); }); it("should return the correct collection size, even when items were removed", () => { const collection = new Collection([{}, {}, {}]); collection.removeOne(1); expect(collection.getCount()).toEqual(2); }); it("should accept a query object", () => { const collection = new Collection([{}, { name: "a" }, { name: "b" }]); function filter(item) { return item.name == "a" || item.name == "b"; } expect(collection.getCount({ filter: filter })).toEqual(2); }); }); describe("getAll", () => { it("should return an array", () => { expect(new Collection().getAll()).toEqual([]); }); it("should return all collections", () => { const collection = new Collection([ { id: 1, name: "foo" }, { id: 2, name: "bar" }, ]); expect(collection.getAll()).toEqual([ { id: 1, name: "foo" }, { id: 2, name: "bar" }, ]); }); describe("sort query", () => { it("should throw an error if passed an unsupported sort argument", () => { const collection = new Collection(); expect(() => { collection.getAll({ sort: 23 }); }).toThrow(new Error("Unsupported sort type")); }); it("should sort by sort function", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); const expected = [ { name: "a", id: 1 }, { name: "b", id: 2 }, { name: "c", id: 0 }, ]; function sort(a, b) { if (a.name > b.name) { return 1; } if (a.name < b.name) { return -1; } // a must be equal to b return 0; } expect(collection.getAll({ sort: sort })).toEqual(expected); }); it("should sort by sort name", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); const expected = [ { name: "a", id: 1 }, { name: "b", id: 2 }, { name: "c", id: 0 }, ]; expect(collection.getAll({ sort: "name" })).toEqual(expected); }); it("should sort by sort name and direction", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); let expected; expected = [ { name: "a", id: 1 }, { name: "b", id: 2 }, { name: "c", id: 0 }, ]; expect(collection.getAll({ sort: ["name", "asc"] })).toEqual(expected); expected = [ { name: "c", id: 0 }, { name: "b", id: 2 }, { name: "a", id: 1 }, ]; expect(collection.getAll({ sort: ["name", "desc"] })).toEqual(expected); }); it("should not affect further requests", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); collection.getAll({ sort: "name" }); const expected = [ { name: "c", id: 0 }, { name: "a", id: 1 }, { name: "b", id: 2 }, ]; expect(collection.getAll()).toEqual(expected); }); }); describe("filter query", () => { it("should throw an error if passed an unsupported filter argument", () => { const collection = new Collection(); expect(() => { collection.getAll({ filter: 23 }); }).toThrow(new Error("Unsupported filter type")); }); it("should filter by filter function", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); const expected = [ { name: "c", id: 0 }, { name: "b", id: 2 }, ]; function filter(item) { return item.name !== "a"; } expect(collection.getAll({ filter: filter })).toEqual(expected); }); it("should filter by filter object", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); const expected = [{ name: "b", id: 2 }]; expect(collection.getAll({ filter: { name: "b" } })).toEqual(expected); }); it("should filter values with deep paths", () => { const collection = new Collection([ { name: "c", deep: { value: "c" } }, { name: "a", deep: { value: "a" } }, { name: "b", deep: { value: "b" } }, ]); const expected = [{ name: "b", deep: { value: "b" }, id: 2 }]; expect(collection.getAll({ filter: { "deep.value": "b" } })).toEqual(expected); }); it("should filter values with objects", () => { const collection = new Collection([ { name: "c", deep: { value: "c" } }, { name: "a", deep: { value: "a" } }, { name: "b", deep: { value: "b" } }, ]); const expected = [{ name: "b", deep: { value: "b" }, id: 2 }]; expect(collection.getAll({ filter: { deep: { value: "b" } } })).toEqual(expected); }); it("should filter boolean values properly", () => { const collection = new Collection([ { name: "a", is: true }, { name: "b", is: false }, { name: "c", is: true }, ]); const expectedFalse = [{ name: "b", id: 1, is: false }]; const expectedTrue = [ { name: "a", id: 0, is: true }, { name: "c", id: 2, is: true }, ]; expect(collection.getAll({ filter: { is: "false" } })).toEqual( expectedFalse ); expect(collection.getAll({ filter: { is: false } })).toEqual( expectedFalse ); expect(collection.getAll({ filter: { is: "true" } })).toEqual( expectedTrue ); expect(collection.getAll({ filter: { is: true } })).toEqual( expectedTrue ); }); it("should filter array values properly", () => { const collection = new Collection([ { tags: ["a", "b", "c"] }, { tags: ["b", "c", "d"] }, { tags: ["c", "d", "e"] }, ]); const expected = [ { id: 0, tags: ["a", "b", "c"] }, { id: 1, tags: ["b", "c", "d"] }, ]; expect(collection.getAll({ filter: { tags: "b" } })).toEqual(expected); expect(collection.getAll({ filter: { tags: "f" } })).toEqual([]); }); it("should filter array values properly within deep paths", () => { const collection = new Collection([ { deep: { tags: ["a", "b", "c"] } }, { deep: { tags: ["b", "c", "d"] } }, { deep: { tags: ["c", "d", "e"] } }, ]); const expected = [ { id: 0, deep: { tags: ["a", "b", "c"] } }, { id: 1, deep: { tags: ["b", "c", "d"] } }, ]; expect(collection.getAll({ filter: { 'deep.tags': "b" } })).toEqual(expected); expect(collection.getAll({ filter: { 'deep.tags': "f" } })).toEqual([]); }); it("should filter array values properly inside deep paths", () => { const collection = new Collection([ { tags: { deep: ["a", "b", "c"] } }, { tags: { deep: ["b", "c", "d"] } }, { tags: { deep: ["c", "d", "e"] } }, ]); const expected = [ { id: 0, tags: { deep: ["a", "b", "c"] } }, { id: 1, tags: { deep: ["b", "c", "d"] } }, ]; expect(collection.getAll({ filter: { 'tags.deep': "b" } })).toEqual(expected); expect(collection.getAll({ filter: { 'tags.deep': "f" } })).toEqual([]); }); it("should filter array values properly with deep paths", () => { const collection = new Collection([ { tags: [{ name: "a" }, { name: "b" }, { name: "c" }] }, { tags: [{ name: "b" }, { name: "c" }, { name: "d" }] }, { tags: [{ name: "c" }, { name: "d" }, { name: "e" }] }, ]); const expected = [ { id: 0, tags: [{ name: "a" }, { name: "b" }, { name: "c" }] }, { id: 1, tags: [{ name: "b" }, { name: "c" }, { name: "d" }] }, ]; expect(collection.getAll({ filter: { 'tags.name': "b" } })).toEqual(expected); expect(collection.getAll({ filter: { 'tags.name': "f" } })).toEqual([]); }); it("should filter array values properly when receiving several values within deep paths", () => { const collection = new Collection([ { deep: { tags: ["a", "b", "c"] } }, { deep: { tags: ["b", "c", "d"] } }, { deep: { tags: ["c", "d", "e"] } }, ]); const expected = [{ id: 1, deep: { tags: ["b", "c", "d"] } }]; expect(collection.getAll({ filter: { 'deep.tags': ["b", "d"] } })).toEqual( expected ); expect( collection.getAll({ filter: { 'deep.tags': ["a", "b", "e"] } }) ).toEqual([]); }); it("should filter array values properly when receiving several values with deep paths", () => { const collection = new Collection([ { tags: [{ name: "a" }, { name: "b" }, { name: "c" }] }, { tags: [{ name: "c" }, { name: "d" }, { name: "e" }] }, { tags: [{ name: "e" }, { name: "f" }, { name: "g" }] }, ]); const expected = [ { id: 0, tags: [{ name: "a" }, { name: "b" }, { name: "c" }] }, { id: 1, tags: [{ name: "c" }, { name: "d" }, { name: "e" }] } ]; expect(collection.getAll({ filter: { 'tags.name': ["c"] } })).toEqual( expected ); expect( collection.getAll({ filter: { 'tags.name': ["h", "i"] } }) ).toEqual([]); }); it("should filter array values properly when receiving several values", () => { const collection = new Collection([ { tags: ["a", "b", "c"] }, { tags: ["b", "c", "d"] }, { tags: ["c", "d", "e"] }, ]); const expected = [{ id: 1, tags: ["b", "c", "d"] }]; expect(collection.getAll({ filter: { tags: ["b", "d"] } })).toEqual( expected ); expect( collection.getAll({ filter: { tags: ["a", "b", "e"] } }) ).toEqual([]); }); it("should filter by the special q full-text filter", () => { const collection = new Collection([ { a: "Hello", b: "world" }, { a: "helloworld", b: "bunny" }, { a: "foo", b: "bar" }, { a: { b: "bar" } }, { a: "", b: "" }, { a: null, b: null }, {}, ]); expect(collection.getAll({ filter: { q: "hello" } })).toEqual([ { id: 0, a: "Hello", b: "world" }, { id: 1, a: "helloworld", b: "bunny" }, ]); expect(collection.getAll({ filter: { q: "bar" } })).toEqual([ { id: 2, a: "foo", b: "bar" }, { id: 3, a: { b: "bar" } }, ]); }); it("should filter by range using _gte, _gt, _lte, and _lt", () => { const collection = new Collection([{ v: 1 }, { v: 2 }, { v: 3 }]); expect(collection.getAll({ filter: { v_gte: 2 } })).toEqual([ { v: 2, id: 1 }, { v: 3, id: 2 }, ]); expect(collection.getAll({ filter: { v_gt: 2 } })).toEqual([ { v: 3, id: 2 }, ]); expect(collection.getAll({ filter: { v_gte: 4 } })).toEqual([]); expect(collection.getAll({ filter: { v_lte: 2 } })).toEqual([ { v: 1, id: 0 }, { v: 2, id: 1 }, ]); expect(collection.getAll({ filter: { v_lt: 2 } })).toEqual([ { v: 1, id: 0 }, ]); expect(collection.getAll({ filter: { v_lte: 0 } })).toEqual([]); }); it("should filter by inequality using _neq", () => { const collection = new Collection([{ v: 1 }, { v: 2 }, { v: 3 }]); expect(collection.getAll({ filter: { v_neq: 2 } })).toEqual([ { v: 1, id: 0 }, { v: 3, id: 2 }, ]); }); it("should filter by text search using _q", () => { const collection = new Collection([{ v: 'abCd' }, { v: 'cDef' }, { v: 'EFgh' }]); expect(collection.getAll({ filter: { v_q: 'cd' } })).toEqual([ { id: 0, v: 'abCd' }, { id: 1, v: 'cDef' } ]); expect(collection.getAll({ filter: { v_q: 'ef' } })).toEqual([ { id: 1, v: 'cDef' }, { id: 2, v: 'EFgh' } ]); }); it("should filter by array", () => { const collection = new Collection([ { a: "H" }, { a: "e" }, { a: "l" }, { a: "l" }, { a: "o" }, ]); expect(collection.getAll({ filter: { id: [] } })).toEqual([]); expect(collection.getAll({ filter: { id: [1, 2, 3] } })).toEqual([ { id: 1, a: "e" }, { id: 2, a: "l" }, { id: 3, a: "l" }, ]); expect(collection.getAll({ filter: { id: ["1", "2", "3"] } })).toEqual([ { id: 1, a: "e" }, { id: 2, a: "l" }, { id: 3, a: "l" }, ]); }); it("should combine all filters with an AND logic", () => { const collection = new Collection([{ v: 1 }, { v: 2 }, { v: 3 }]); expect(collection.getAll({ filter: { v_gte: 2, v_lte: 2 } })).toEqual([ { v: 2, id: 1 }, ]); }); it("should not affect further requests", () => { const collection = new Collection([ { name: "c" }, { name: "a" }, { name: "b" }, ]); function filter(item) { return item.name !== "a"; } collection.getAll({ filter: filter }); const expected = [ { name: "c", id: 0 }, { name: "a", id: 1 }, { name: "b", id: 2 }, ]; expect(collection.getAll()).toEqual(expected); }); }); describe("range query", () => { it("should throw an error if passed an unsupported range argument", () => { const collection = new Collection(); expect(() => { collection.getAll({ range: 23 }); }).toThrow(new Error("Unsupported range type")); }); const collection = new Collection([ { id: 0, name: "a" }, { id: 1, name: "b" }, { id: 2, name: "c" }, { id: 3, name: "d" }, { id: 4, name: "e" }, ]); it("should return a range in the collection", () => { let expected; expected = [{ id: 0, name: "a" }]; expect(collection.getAll({ range: [0, 0] })).toEqual(expected); expected = [ { id: 1, name: "b" }, { id: 2, name: "c" }, { id: 3, name: "d" }, { id: 4, name: "e" }, ]; expect(collection.getAll({ range: [1] })).toEqual(expected); expected = [ { id: 2, name: "c" }, { id: 3, name: "d" }, ]; expect(collection.getAll({ range: [2, 3] })).toEqual(expected); }); it("should not affect further requests", () => { const collection = new Collection([ { id: 0, name: "a" }, { id: 1, name: "b" }, { id: 2, name: "c" }, ]); collection.getAll({ range: [1] }); const expected = [ { id: 0, name: "a" }, { id: 1, name: "b" }, { id: 2, name: "c" }, ]; expect(collection.getAll()).toEqual(expected); }); }); describe("embed query", () => { it("should throw an error when trying to embed a non-existing collection", () => { const foos = new Collection([{ name: "John", bar_id: 123 }]); const server = new Server(); server.addCollection("foos", foos); expect(() => { foos.getAll({ embed: ["bar"] }); }).toThrow(new Error("Can't embed a non-existing collection bar")); }); it("should return the original object for missing embed one", () => { const foos = new Collection([{ name: "John", bar_id: 123 }]); const bars = new Collection([]); const server = new Server(); server.addCollection("foos", foos); server.addCollection("bars", bars); const expected = [{ id: 0, name: "John", bar_id: 123 }]; expect(foos.getAll({ embed: ["bar"] })).toEqual(expected); }); it("should return the object with the reference object for embed one", () => { const foos = new Collection([ { name: "John", bar_id: 123 }, { name: "Jane", bar_id: 456 }, ]); const bars = new Collection([ { id: 1, bar: "nobody wants me" }, { id: 123, bar: "baz" }, { id: 456, bar: "bazz" }, ]); const server = new Server(); server.addCollection("foos", foos); server.addCollection("bars", bars); const expected = [ { id: 0, name: "John", bar_id: 123, bar: { id: 123, bar: "baz" } }, { id: 1, name: "Jane", bar_id: 456, bar: { id: 456, bar: "bazz" } }, ]; expect(foos.getAll({ embed: ["bar"] })).toEqual(expected); }); it("should throw an error when trying to embed many a non-existing collection", () => { const foos = new Collection([{ name: "John", bar_id: 123 }]); const server = new Server(); server.addCollection("foos", foos); expect(() => { foos.getAll({ embed: ["bars"] }); }).toThrow(new Error("Can't embed a non-existing collection bars")); }); it("should return the object with an empty array for missing embed many", () => { const foos = new Collection([{ name: "John", bar_id: 123 }]); const bars = new Collection([{ id: 1, bar: "nobody wants me" }]); const server = new Server(); server.addCollection("foos", foos); server.addCollection("bars", bars); const expected = [{ id: 1, bar: "nobody wants me", foos: [] }]; expect(bars.getAll({ embed: ["foos"] })).toEqual(expected); }); it("should return the object with an array of references for embed many", () => { const foos = new Collection([ { id: 1, name: "John", bar_id: 123 }, { id: 2, name: "Jane", bar_id: 456 }, { id: 3, name: "Jules", bar_id: 456 }, ]); const bars = new Collection([ { id: 1, bar: "nobody wants me" }, { id: 123, bar: "baz" }, { id: 456, bar: "bazz" }, ]); const server = new Server(); server.addCollection("foos", foos); server.addCollection("bars", bars); const expected = [ { id: 1, bar: "nobody wants me", foos: [] }, { id: 123, bar: "baz", foos: [{ id: 1, name: "John", bar_id: 123 }] }, { id: 456, bar: "bazz", foos: [ { id: 2, name: "Jane", bar_id: 456 }, { id: 3, name: "Jules", bar_id: 456 }, ], }, ]; expect(bars.getAll({ embed: ["foos"] })).toEqual(expected); }); it("should return the object with an array of references for embed many using inner array", () => { const foos = new Collection([ { id: 1, name: "John" }, { id: 2, name: "Jane" }, { id: 3, name: "Jules" }, ]); const bars = new Collection([ { id: 1, bar: "nobody wants me" }, { id: 123, bar: "baz", foos: [1] }, { id: 456, bar: "bazz", foos: [2, 3] }, ]); const server = new Server(); server.addCollection("foos", foos); server.addCollection("bars", bars); const expected = [ { id: 1, bar: "nobody wants me", foos: [] }, { id: 123, bar: "baz", foos: [{ id: 1, name: "John" }] }, { id: 456, bar: "bazz", foos: [ { id: 2, name: "Jane" }, { id: 3, name: "Jules" }, ], }, ]; expect(bars.getAll({ embed: ["foos"] })).toEqual(expected); }); it("should allow multiple embeds", () => { const books = new Collection([ { id: 1, title: "Pride and Prejudice", author_id: 1 }, { id: 2, title: "Sense and Sensibility", author_id: 1 }, { id: 3, title: "War and Preace", author_id: 2 }, ]); const authors = new Collection([ { id: 1, firstName: "Jane", lastName: "Austen", country_id: 1 }, { id: 2, firstName: "Leo", lastName: "Tosltoi", country_id: 2 }, ]); const countries = new Collection([ { id: 1, name: "England" }, { id: 2, name: "Russia" }, ]); const server = new Server(); server.addCollection("books", books); server.addCollection("authors", authors); server.addCollection("countrys", countries); // nevermind the plural const expected = [ { id: 1, firstName: "Jane", lastName: "Austen", country_id: 1, books: [ { id: 1, title: "Pride and Prejudice", author_id: 1 }, { id: 2, title: "Sense and Sensibility", author_id: 1 }, ], country: { id: 1, name: "England" }, }, { id: 2, firstName: "Leo", lastName: "Tosltoi", country_id: 2, books: [{ id: 3, title: "War and Preace", author_id: 2 }], country: { id: 2, name: "Russia" }, }, ]; expect(authors.getAll({ embed: ["books", "country"] })).toEqual( expected ); }); }); describe("composite query", () => { it("should execute all commands of the query object", () => { const collection = new Collection([ { id: 0, name: "c", arg: false }, { id: 1, name: "b", arg: true }, { id: 2, name: "a", arg: true }, ]); const query = { filter: { arg: true }, sort: "name", }; const expected = [ { id: 2, name: "a", arg: true }, { id: 1, name: "b", arg: true }, ]; expect(collection.getAll(query)).toEqual(expected); }); }); }); describe("getOne", () => { it("should throw an exception when trying to get a non-existing item", () => { const collection = new Collection(); expect(() => { collection.getOne(0); }).toThrow(new Error("No item with identifier 0")); }); it("should return the first collection matching the identifier", () => { const collection = new Collection([ { id: 1, name: "foo" }, { id: 2, name: "bar" }, ]); expect(collection.getOne(1)).toEqual({ id: 1, name: "foo" }); expect(collection.getOne(2)).toEqual({ id: 2, name: "bar" }); }); it("should use the identifierName", () => { const collection = new Collection( [ { _id: 1, name: "foo" }, { _id: 2, name: "bar" }, ], "_id" ); expect(collection.getOne(1)).toEqual({ _id: 1, name: "foo" }); expect(collection.getOne(2)).toEqual({ _id: 2, name: "bar" }); }); }); describe("addOne", () => { it("should return the item inserted", () => { const collection = new Collection(); const r = collection.addOne({ name: "foo" }); expect(r.name).toEqual("foo"); }); it("should add the item", () => { const collection = new Collection(); collection.addOne({ name: "foo" }); expect(collection.getOne(0)).toEqual({ id: 0, name: "foo" }); }); it("should incement the sequence at each insertion", () => { const collection = new Collection(); expect(collection.sequence).toEqual(0); collection.addOne({ name: "foo" }); expect(collection.sequence).toEqual(1); collection.addOne({ name: "foo" }); expect(collection.sequence).toEqual(2); }); it("should set identifier if not provided", () => { const collection = new Collection(); const r1 = collection.addOne({ name: "foo" }); expect(r1.id).toEqual(0); const r2 = collection.addOne({ name: "bar" }); expect(r2.id).toEqual(1); }); it("should refuse insertion with existing identifier", () => { const collection = new Collection([{ name: "foo" }]); expect(() => { collection.addOne({ id: 0, name: "bar" }); }).toThrow(new Error("An item with the identifier 0 already exists")); }); it("should accept insertion with non-existing identifier and move sequence accordingly", () => { const collection = new Collection(); collection.addOne({ name: "foo" }); collection.addOne({ id: 12, name: "bar" }); expect(collection.sequence).toEqual(13); const r = collection.addOne({ name: "bar" }); expect(r.id).toEqual(13); }); }); describe("updateOne", () => { it("should throw an exception when trying to update a non-existing item", () => { const collection = new Collection(); expect(() => { collection.updateOne(0, { id: 0, name: "bar" }); }).toThrow(new Error("No item with identifier 0")); }); it("should return the updated item", () => { const collection = new Collection([{ name: "foo" }]); expect(collection.updateOne(0, { id: 0, name: "bar" })).toEqual({ id: 0, name: "bar", }); }); it("should update the item", () => { const collection = new Collection([{ name: "foo" }, { name: "baz" }]); collection.updateOne(0, { id: 0, name: "bar" }); expect(collection.getOne(0)).toEqual({ id: 0, name: "bar" }); expect(collection.getOne(1)).toEqual({ id: 1, name: "baz" }); }); }); describe("removeOne", () => { it("should throw an exception when trying to remove a non-existing item", () => { const collection = new Collection(); expect(() => { collection.removeOne(0); }).toThrow(new Error("No item with identifier 0")); }); it("should remove the item", () => { const collection = new Collection(); const item = collection.addOne({ name: "foo" }); collection.removeOne(item.id); expect(collection.getAll()).toEqual([]); }); it("should return the removed item", () => { const collection = new Collection(); const item = collection.addOne({}); const r = collection.removeOne(item.id); expect(r).toEqual(item); }); it("should decrement the sequence only if the removed item is the last", () => { const collection = new Collection([{ id: 0 }, { id: 1 }, { id: 2 }]); expect(collection.sequence).toEqual(3); collection.removeOne(2); expect(collection.sequence).toEqual(2); collection.removeOne(0); expect(collection.sequence).toEqual(2); const r = collection.addOne({}); expect(r.id).toEqual(2); }); }); });
"use strict"; var userUtils = require("../../lib/user-utils.js"); module.exports = function(core, config, store) { core.on("setstate", function(changes) { var future = store.with(changes), userId = future.get("user"), roomId = future.get("nav", "room"), mode = future.get("nav", "mode"), cta = future.get("app", "cta"), role = future.get("entities", roomId + "_" + userId, "role"), roomObj = future.getRoom(roomId); changes.app = changes.app || {}; if (roomObj === "missing") { changes.app.cta = null; } else if (userId && !userUtils.isGuest(userId) && ((/(visitor|none)/).test(role) || !role) && (/(chat|room)/).test(mode) && !(roomObj && roomObj.guides && roomObj.guides.authorizer && roomObj.guides.authorizer.openRoom === false)) { changes.app.cta = "follow"; } else if (cta === "follow") { changes.app.cta = null; } }, 400); };
export * from './achievement'; export * from './auth'; export * from './chatlinks'; export * from './forum'; export * from './help'; export * from './emotes'; export * from './rank'; export * from './test';
$(function() { var FADE_TIME = 150; // ms var TYPING_TIMER_LENGTH = 400; // ms var COLORS = [ '#e21400', '#91580f', '#f8a700', '#f78b00', '#58dc00', '#287b00', '#a8f07a', '#4ae8c4', '#3b88eb', '#3824aa', '#a700ff', '#d300e7' ]; // Initialize variables var $window = $(window); var $usernameInput = $('.usernameInput'); // Input for username var $messages = $('.messages'); // Messages area var $inputMessage = $('.inputMessage'); // Input message input box var $loginPage = $('.login.page'); // The login page var $chatPage = $('.chat.page'); // The chatroom page // Prompt for setting a username var username; var connected = false; var typing = false; var lastTypingTime; var $currentInput = $usernameInput.focus(); var socket = io(); function addParticipantsMessage (data) { var message = ''; if (data.numUsers === 1) { message += "there's 1 participant"; } else { message += "there are " + data.numUsers + " participants"; } log(message); } // Sets the client's username function setUsername () { username = cleanInput($usernameInput.val().trim()); // If the username is valid if (username) { $loginPage.fadeOut(); $chatPage.show(); $loginPage.off('click'); $currentInput = $inputMessage.focus(); // Tell the server your username socket.emit('add user', username); } } // Sends a chat message function sendMessage () { var message = $inputMessage.val(); // Prevent markup from being injected into the message message = cleanInput(message); // if there is a non-empty message and a socket connection if (message && connected) { $inputMessage.val(''); addChatMessage({ username: username, message: message }); // tell server to execute 'new message' and send along one parameter socket.emit('new message', message); } } // Log a message function log (message, options) { var $el = $('<li>').addClass('log').text(message); addMessageElement($el, options); } // Adds the visual chat message to the message list function addChatMessage (data, options) { // Don't fade the message in if there is an 'X was typing' var $typingMessages = getTypingMessages(data); options = options || {}; if ($typingMessages.length !== 0) { options.fade = false; $typingMessages.remove(); } var $usernameDiv = $('<span class="username"/>') .text(data.username) .css('color', getUsernameColor(data.username)); var $messageBodyDiv = $('<span class="messageBody">') .text(data.message); var typingClass = data.typing ? 'typing' : ''; var $messageDiv = $('<li class="message"/>') .data('username', data.username) .addClass(typingClass) .append($usernameDiv, $messageBodyDiv); addMessageElement($messageDiv, options); } // Adds the visual chat typing message function addChatTyping (data) { data.typing = true; data.message = 'is typing'; addChatMessage(data); } // Removes the visual chat typing message function removeChatTyping (data) { getTypingMessages(data).fadeOut(function () { $(this).remove(); }); } // Adds a message element to the messages and scrolls to the bottom // el - The element to add as a message // options.fade - If the element should fade-in (default = true) // options.prepend - If the element should prepend // all other messages (default = false) function addMessageElement (el, options) { var $el = $(el); // Setup default options if (!options) { options = {}; } if (typeof options.fade === 'undefined') { options.fade = true; } if (typeof options.prepend === 'undefined') { options.prepend = false; } // Apply options if (options.fade) { $el.hide().fadeIn(FADE_TIME); } if (options.prepend) { $messages.prepend($el); } else { $messages.append($el); } $messages[0].scrollTop = $messages[0].scrollHeight; } // Prevents input from having injected markup function cleanInput (input) { return $('<div/>').text(input).text(); } // Updates the typing event function updateTyping () { if (connected) { if (!typing) { typing = true; socket.emit('typing'); } lastTypingTime = (new Date()).getTime(); setTimeout(function () { var typingTimer = (new Date()).getTime(); var timeDiff = typingTimer - lastTypingTime; if (timeDiff >= TYPING_TIMER_LENGTH && typing) { socket.emit('stop typing'); typing = false; } }, TYPING_TIMER_LENGTH); } } // Gets the 'X is typing' messages of a user function getTypingMessages (data) { return $('.typing.message').filter(function (i) { return $(this).data('username') === data.username; }); } // Gets the color of a username through our hash function function getUsernameColor (username) { // Compute hash code var hash = 7; for (var i = 0; i < username.length; i++) { hash = username.charCodeAt(i) + (hash << 5) - hash; } // Calculate color var index = Math.abs(hash % COLORS.length); return COLORS[index]; } // Keyboard events $window.keydown(function (event) { // Auto-focus the current input when a key is typed if (!(event.ctrlKey || event.metaKey || event.altKey)) { $currentInput.focus(); } // When the client hits ENTER on their keyboard if (event.which === 13) { if (username) { sendMessage(); socket.emit('stop typing'); typing = false; } else { setUsername(); } } }); $inputMessage.on('input', function() { updateTyping(); }); // Click events // Focus input when clicking anywhere on login page $loginPage.click(function () { $currentInput.focus(); }); // Focus input when clicking on the message input's border $inputMessage.click(function () { $inputMessage.focus(); }); // Socket events // Whenever the server emits 'login', log the login message socket.on('login', function (data) { connected = true; // Display the welcome message var message = "Welcome to Socket.IO Chat – "; log(message, { prepend: true }); addParticipantsMessage(data); }); // Whenever the server emits 'new message', update the chat body socket.on('new message', function (data) { addChatMessage(data); }); // Whenever the server emits 'user joined', log it in the chat body socket.on('user joined', function (data) { log(data.username + ' joined'); addParticipantsMessage(data); }); // Whenever the server emits 'user left', log it in the chat body socket.on('user left', function (data) { log(data.username + ' left'); addParticipantsMessage(data); removeChatTyping(data); }); // Whenever the server emits 'typing', show the typing message socket.on('typing', function (data) { addChatTyping(data); }); // Whenever the server emits 'stop typing', kill the typing message socket.on('stop typing', function (data) { removeChatTyping(data); }); socket.on('disconnect', function () { log('you have been disconnected'); }); socket.on('reconnect', function () { log('you have been reconnected'); if (username) { socket.emit('add user', username); } }); socket.on('reconnect_error', function () { log('attempt to reconnect has failed'); }); });
//////////////////////////////////////////////////////////////////// // // GENERATED CLASS // // DO NOT EDIT // // See sequelize-auto-ts for edits // //////////////////////////////////////////////////////////////////// var Sequelize = require('sequelize'); exports.initialized = false; exports.SEQUELIZE; /*__each__ tables */ exports.__tableName__; /*__each__ tables */ exports.__tableNameCamel__; /*__ignore__*/ var __defineFieldType__; /*__ignore__*/ var __primaryTableName__; /*__ignore__*/ var __foreignTableName__; /*__ignore__*/ var __firstTableName__; /*__ignore__*/ var __secondTableName__; /*__ignore__*/ var __associationNameQuoted__; function initialize(database, username, password, options) { if (exports.initialized) { return; } exports.SEQUELIZE = new Sequelize(database, username, password, options); /*__startEach__ tables */ exports.__tableName__ = exports.__tableNameCamel__ = exports.SEQUELIZE.define('__tableNameSingular__', { /*__each__ realDbFields, */ '__fieldName__': __defineFieldType__ }, { timestamps: false, classMethods: { get__tableNameSingular__: function (__tableNameSingularCamel__) { var where = {}; var id = parseInt(__tableNameSingularCamel__); if (isNaN(id)) { /*__each__ realDbFields */ if (__tableNameSingularCamel__['__fieldName__'] !== undefined) { where['__fieldName__'] = __tableNameSingularCamel__['__fieldName__']; } } else { where['__idFieldName__'] = id; } return exports.__tableName__.find({ where: where }); } } }); /*__endEach__*/ /*__startEach__ references */ __primaryTableName__.hasMany(__foreignTableName__, { foreignKey: '__foreignKey__' }); __foreignTableName__.belongsTo(__primaryTableName__, { as: __associationNameQuoted__, foreignKey: '__foreignKey__' }); /*__endEach__*/ /*__startEach__ xrefs */ __firstTableName__.hasMany(__secondTableName__, { through: '__xrefTableName__' }); __secondTableName__.hasMany(__firstTableName__, { through: '__xrefTableName__' }); /*__endEach__*/ return exports; } exports.initialize = initialize; //# sourceMappingURL=sequelize-models.js.map
import Vue from 'vue'; import Electron from 'vue-electron'; import Resource from 'vue-resource'; import Router from 'vue-router'; import KeenUI from 'keen-ui'; import 'keen-ui/dist/keen-ui.css'; import App from './App'; import routes from './routes'; Vue.use(Electron); Vue.use(Resource); Vue.use(Router); Vue.use(KeenUI); Vue.config.debug = true; const router = new Router({ scrollBehavior: () => ({ y: 0 }), routes, }); /* eslint-disable no-new */ new Vue({ router, ...App, }).$mount('#app');
'use strict' import Tea from './modules/tea.core.js' global.app = () => { return Tea; }
version https://git-lfs.github.com/spec/v1 oid sha256:b7405262706997cffc865837cffd6bd9eb92a8f12c3da71795815fb2da9be9f6 size 2483
var Imap = require('imap'), MailParser = require('mailparser').MailParser, moment = require('moment') util = require('util'), events = require('events'); var SimpleImap = function(options) { this.options = options; this.imap = null; this.start = function() { if (this.imap === null) { this.imap = new Imap(this.options); var selfImap = this.imap, self = this; selfImap.on('ready', function() { self.emit('ready'); selfImap.openBox(self.options.mailbox, false, function() { self.emit('open'); }); }); selfImap.on('mail', function(num) { selfImap.search(['UNSEEN'], function(err, result) { if (result.length) { var f = selfImap.fetch(result, { markSeen: true, struct: true, bodies: '' }); f.on('message', function(msg, seqNo) { msg.on('body', function(stream, info) { var buffer = ''; stream.on('data', function(chunk) { buffer += chunk.toString('utf8'); }); stream.on('end', function() { var mailParser = new MailParser(); mailParser.on('end', function(mailObject) { self.emit('mail', { from: mailObject.from, subject: mailObject.subject, text: mailObject.text, html: mailObject.html, date: moment(mailObject.date).format('YYYY-MM-DD HH:mm:ss') }); }); mailParser.write(buffer); mailParser.end(); }); }); }); } }); }); selfImap.on('end', function() { self.emit('end'); }); selfImap.on('error', function(err) { self.emit('error', err); }); selfImap.on('close', function(hadError) { self.emit('close', hadError); }); } this.imap.connect(); } this.stop = function() { this.imap.destroy(); } this.restart = function() { this.stop(); if (arguments.length >= 1) this.options = arguments[0]; this.start(); } this.getImap = function() { return this.imap; } }; util.inherits(SimpleImap, events.EventEmitter); module.exports = SimpleImap
/* Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.lang['nl'] = { "editor": "Tekstverwerker", "editorPanel": "Tekstverwerker beheerpaneel", "common": { "editorHelp": "Druk ALT 0 voor hulp", "browseServer": "Bladeren op server", "url": "URL", "protocol": "Protocol", "upload": "Upload", "uploadSubmit": "Naar server verzenden", "image": "Afbeelding", "flash": "Flash", "form": "Formulier", "checkbox": "Selectievinkje", "radio": "Keuzerondje", "textField": "Tekstveld", "textarea": "Tekstvak", "hiddenField": "Verborgen veld", "button": "Knop", "select": "Selectieveld", "imageButton": "Afbeeldingsknop", "notSet": "<niet ingevuld>", "id": "Id", "name": "Naam", "langDir": "Schrijfrichting", "langDirLtr": "Links naar rechts (LTR)", "langDirRtl": "Rechts naar links (RTL)", "langCode": "Taalcode", "longDescr": "Lange URL-omschrijving", "cssClass": "Stylesheet-klassen", "advisoryTitle": "Adviserende titel", "cssStyle": "Stijl", "ok": "OK", "cancel": "Annuleren", "close": "Sluiten", "preview": "Voorbeeld", "resize": "Sleep om te herschalen", "generalTab": "Algemeen", "advancedTab": "Geavanceerd", "validateNumberFailed": "Deze waarde is geen geldig getal.", "confirmNewPage": "Alle aangebrachte wijzigingen gaan verloren. Weet u zeker dat u een nieuwe pagina wilt openen?", "confirmCancel": "Enkele opties zijn gewijzigd. Weet u zeker dat u dit dialoogvenster wilt sluiten?", "options": "Opties", "target": "Doelvenster", "targetNew": "Nieuw venster (_blank)", "targetTop": "Hele venster (_top)", "targetSelf": "Zelfde venster (_self)", "targetParent": "Origineel venster (_parent)", "langDirLTR": "Links naar rechts (LTR)", "langDirRTL": "Rechts naar links (RTL)", "styles": "Stijl", "cssClasses": "Stylesheet-klassen", "width": "Breedte", "height": "Hoogte", "align": "Uitlijning", "alignLeft": "Links", "alignRight": "Rechts", "alignCenter": "Centreren", "alignJustify": "Uitvullen", "alignTop": "Boven", "alignMiddle": "Midden", "alignBottom": "Onder", "alignNone": "Geen", "invalidValue": "Ongeldige waarde.", "invalidHeight": "De hoogte moet een getal zijn.", "invalidWidth": "De breedte moet een getal zijn.", "invalidCssLength": "Waarde in veld \"%1\" moet een positief nummer zijn, met of zonder een geldige CSS meeteenheid (px, %, in, cm, mm, em, ex, pt of pc).", "invalidHtmlLength": "Waarde in veld \"%1\" moet een positief nummer zijn, met of zonder een geldige HTML meeteenheid (px of %).", "invalidInlineStyle": "Waarde voor de online stijl moet bestaan uit een of meerdere tupels met het formaat \"naam : waarde\", gescheiden door puntkomma's.", "cssLengthTooltip": "Geef een nummer in voor een waarde in pixels of geef een nummer in met een geldige CSS eenheid (px, %, in, cm, mm, em, ex, pt, of pc).", "unavailable": "%1<span class=\"cke_accessibility\">, niet beschikbaar</span>" }, "about": { "copy": "Copyright &copy; $1. Alle rechten voorbehouden.", "dlgTitle": "Over CKEditor", "help": "Bekijk de $1 voor hulp.", "moreInfo": "Bezoek onze website voor licentieinformatie:", "title": "Over CKEditor", "userGuide": "CKEditor gebruiksaanwijzing" }, "basicstyles": { "bold": "Vet", "italic": "Cursief", "strike": "Doorhalen", "subscript": "Subscript", "superscript": "Superscript", "underline": "Onderstrepen" }, "bidi": {"ltr": "Schrijfrichting van links naar rechts", "rtl": "Schrijfrichting van rechts naar links"}, "blockquote": {"toolbar": "Citaatblok"}, "clipboard": { "copy": "Kopiëren", "copyError": "De beveiligingsinstelling van de browser verhinderen het automatisch kopiëren. Gebruik de sneltoets Ctrl/Cmd+C van het toetsenbord.", "cut": "Knippen", "cutError": "De beveiligingsinstelling van de browser verhinderen het automatisch knippen. Gebruik de sneltoets Ctrl/Cmd+X van het toetsenbord.", "paste": "Plakken", "pasteArea": "Plakgebied", "pasteMsg": "Plak de tekst in het volgende vak gebruikmakend van uw toetsenbord (<strong>Ctrl/Cmd+V</strong>) en klik op OK.", "securityMsg": "Door de beveiligingsinstellingen van uw browser is het niet mogelijk om direct vanuit het klembord in de editor te plakken. Middels opnieuw plakken in dit venster kunt u de tekst alsnog plakken in de editor.", "title": "Plakken" }, "button": {"selectedLabel": "%1 (Geselecteerd)"}, "colorbutton": { "auto": "Automatisch", "bgColorTitle": "Achtergrondkleur", "colors": { "000": "Zwart", "800000": "Kastanjebruin", "8B4513": "Chocoladebruin", "2F4F4F": "Donkerleigrijs", "008080": "Blauwgroen", "000080": "Marine", "4B0082": "Indigo", "696969": "Donkergrijs", "B22222": "Baksteen", "A52A2A": "Bruin", "DAA520": "Donkergeel", "006400": "Donkergroen", "40E0D0": "Turquoise", "0000CD": "Middenblauw", "800080": "Paars", "808080": "Grijs", "F00": "Rood", "FF8C00": "Donkeroranje", "FFD700": "Goud", "008000": "Groen", "0FF": "Cyaan", "00F": "Blauw", "EE82EE": "Violet", "A9A9A9": "Donkergrijs", "FFA07A": "Lichtzalm", "FFA500": "Oranje", "FFFF00": "Geel", "00FF00": "Felgroen", "AFEEEE": "Lichtturquoise", "ADD8E6": "Lichtblauw", "DDA0DD": "Pruim", "D3D3D3": "Lichtgrijs", "FFF0F5": "Linnen", "FAEBD7": "Ivoor", "FFFFE0": "Lichtgeel", "F0FFF0": "Honingdauw", "F0FFFF": "Azuur", "F0F8FF": "Licht hemelsblauw", "E6E6FA": "Lavendel", "FFF": "Wit" }, "more": "Meer kleuren...", "panelTitle": "Kleuren", "textColorTitle": "Tekstkleur" }, "colordialog": { "clear": "Wissen", "highlight": "Actief", "options": "Kleuropties", "selected": "Geselecteerde kleur", "title": "Selecteer kleur" }, "templates": { "button": "Sjablonen", "emptyListMsg": "(Geen sjablonen gedefinieerd)", "insertOption": "Vervang de huidige inhoud", "options": "Template opties", "selectPromptMsg": "Selecteer het sjabloon dat in de editor geopend moet worden (de actuele inhoud gaat verloren):", "title": "Inhoud sjablonen" }, "contextmenu": {"options": "Contextmenu opties"}, "div": { "IdInputLabel": "Id", "advisoryTitleInputLabel": "Adviserende titel", "cssClassInputLabel": "Stylesheet klassen", "edit": "Div wijzigen", "inlineStyleInputLabel": "Inline stijl", "langDirLTRLabel": "Links naar rechts (LTR)", "langDirLabel": "Schrijfrichting", "langDirRTLLabel": "Rechts naar links (RTL)", "languageCodeInputLabel": " Taalcode", "remove": "Div verwijderen", "styleSelectLabel": "Stijl", "title": "Div aanmaken", "toolbar": "Div aanmaken" }, "toolbar": { "toolbarCollapse": "Werkbalk inklappen", "toolbarExpand": "Werkbalk uitklappen", "toolbarGroups": { "document": "Document", "clipboard": "Klembord/Ongedaan maken", "editing": "Bewerken", "forms": "Formulieren", "basicstyles": "Basisstijlen", "paragraph": "Paragraaf", "links": "Links", "insert": "Invoegen", "styles": "Stijlen", "colors": "Kleuren", "tools": "Toepassingen" }, "toolbars": "Werkbalken" }, "elementspath": {"eleLabel": "Elementenpad", "eleTitle": "%1 element"}, "find": { "find": "Zoeken", "findOptions": "Zoekopties", "findWhat": "Zoeken naar:", "matchCase": "Hoofdlettergevoelig", "matchCyclic": "Doorlopend zoeken", "matchWord": "Hele woord moet voorkomen", "notFoundMsg": "De opgegeven tekst is niet gevonden.", "replace": "Vervangen", "replaceAll": "Alles vervangen", "replaceSuccessMsg": "%1 resultaten vervangen.", "replaceWith": "Vervangen met:", "title": "Zoeken en vervangen" }, "fakeobjects": { "anchor": "Interne link", "flash": "Flash animatie", "hiddenfield": "Verborgen veld", "iframe": "IFrame", "unknown": "Onbekend object" }, "flash": { "access": "Script toegang", "accessAlways": "Altijd", "accessNever": "Nooit", "accessSameDomain": "Zelfde domeinnaam", "alignAbsBottom": "Absoluut-onder", "alignAbsMiddle": "Absoluut-midden", "alignBaseline": "Basislijn", "alignTextTop": "Boven tekst", "bgcolor": "Achtergrondkleur", "chkFull": "Schermvullend toestaan", "chkLoop": "Herhalen", "chkMenu": "Flashmenu's inschakelen", "chkPlay": "Automatisch afspelen", "flashvars": "Variabelen voor Flash", "hSpace": "HSpace", "properties": "Eigenschappen Flash", "propertiesTab": "Eigenschappen", "quality": "Kwaliteit", "qualityAutoHigh": "Automatisch hoog", "qualityAutoLow": "Automatisch laag", "qualityBest": "Beste", "qualityHigh": "Hoog", "qualityLow": "Laag", "qualityMedium": "Gemiddeld", "scale": "Schaal", "scaleAll": "Alles tonen", "scaleFit": "Precies passend", "scaleNoBorder": "Geen rand", "title": "Eigenschappen Flash", "vSpace": "VSpace", "validateHSpace": "De HSpace moet een getal zijn.", "validateSrc": "De URL mag niet leeg zijn.", "validateVSpace": "De VSpace moet een getal zijn.", "windowMode": "Venster modus", "windowModeOpaque": "Ondoorzichtig", "windowModeTransparent": "Doorzichtig", "windowModeWindow": "Venster" }, "font": { "fontSize": {"label": "Lettergrootte", "voiceLabel": "Lettergrootte", "panelTitle": "Lettergrootte"}, "label": "Lettertype", "panelTitle": "Lettertype", "voiceLabel": "Lettertype" }, "forms": { "button": { "title": "Eigenschappen knop", "text": "Tekst (waarde)", "type": "Soort", "typeBtn": "Knop", "typeSbm": "Versturen", "typeRst": "Leegmaken" }, "checkboxAndRadio": { "checkboxTitle": "Eigenschappen aanvinkvakje", "radioTitle": "Eigenschappen selectievakje", "value": "Waarde", "selected": "Geselecteerd", "required": "Vereist" }, "form": { "title": "Eigenschappen formulier", "menu": "Eigenschappen formulier", "action": "Actie", "method": "Methode", "encoding": "Codering" }, "hidden": {"title": "Eigenschappen verborgen veld", "name": "Naam", "value": "Waarde"}, "select": { "title": "Eigenschappen selectieveld", "selectInfo": "Informatie", "opAvail": "Beschikbare opties", "value": "Waarde", "size": "Grootte", "lines": "Regels", "chkMulti": "Gecombineerde selecties toestaan", "required": "Vereist", "opText": "Tekst", "opValue": "Waarde", "btnAdd": "Toevoegen", "btnModify": "Wijzigen", "btnUp": "Omhoog", "btnDown": "Omlaag", "btnSetValue": "Als geselecteerde waarde instellen", "btnDelete": "Verwijderen" }, "textarea": {"title": "Eigenschappen tekstvak", "cols": "Kolommen", "rows": "Rijen"}, "textfield": { "title": "Eigenschappen tekstveld", "name": "Naam", "value": "Waarde", "charWidth": "Breedte (tekens)", "maxChars": "Maximum aantal tekens", "required": "Vereist", "type": "Soort", "typeText": "Tekst", "typePass": "Wachtwoord", "typeEmail": "E-mail", "typeSearch": "Zoeken", "typeTel": "Telefoonnummer", "typeUrl": "URL" } }, "format": { "label": "Opmaak", "panelTitle": "Opmaak", "tag_address": "Adres", "tag_div": "Normaal (DIV)", "tag_h1": "Kop 1", "tag_h2": "Kop 2", "tag_h3": "Kop 3", "tag_h4": "Kop 4", "tag_h5": "Kop 5", "tag_h6": "Kop 6", "tag_p": "Normaal", "tag_pre": "Met opmaak" }, "horizontalrule": {"toolbar": "Horizontale lijn invoegen"}, "iframe": { "border": "Framerand tonen", "noUrl": "Vul de IFrame URL in", "scrolling": "Scrollbalken inschakelen", "title": "IFrame-eigenschappen", "toolbar": "IFrame" }, "image": { "alt": "Alternatieve tekst", "border": "Rand", "btnUpload": "Naar server verzenden", "button2Img": "Wilt u de geselecteerde afbeeldingsknop vervangen door een eenvoudige afbeelding?", "hSpace": "HSpace", "img2Button": "Wilt u de geselecteerde afbeelding vervangen door een afbeeldingsknop?", "infoTab": "Informatie afbeelding", "linkTab": "Link", "lockRatio": "Afmetingen vergrendelen", "menu": "Eigenschappen afbeelding", "resetSize": "Afmetingen resetten", "title": "Eigenschappen afbeelding", "titleButton": "Eigenschappen afbeeldingsknop", "upload": "Upload", "urlMissing": "De URL naar de afbeelding ontbreekt.", "vSpace": "VSpace", "validateBorder": "Rand moet een heel nummer zijn.", "validateHSpace": "HSpace moet een heel nummer zijn.", "validateVSpace": "VSpace moet een heel nummer zijn." }, "indent": {"indent": "Inspringing vergroten", "outdent": "Inspringing verkleinen"}, "smiley": {"options": "Smiley opties", "title": "Smiley invoegen", "toolbar": "Smiley"}, "justify": {"block": "Uitvullen", "center": "Centreren", "left": "Links uitlijnen", "right": "Rechts uitlijnen"}, "language": {"button": "Taal instellen", "remove": "Taal verwijderen"}, "link": { "acccessKey": "Toegangstoets", "advanced": "Geavanceerd", "advisoryContentType": "Aanbevolen content-type", "advisoryTitle": "Adviserende titel", "anchor": { "toolbar": "Interne link", "menu": "Eigenschappen interne link", "title": "Eigenschappen interne link", "name": "Naam interne link", "errorName": "Geef de naam van de interne link op", "remove": "Interne link verwijderen" }, "anchorId": "Op kenmerk interne link", "anchorName": "Op naam interne link", "charset": "Karakterset van gelinkte bron", "cssClasses": "Stylesheet-klassen", "emailAddress": "E-mailadres", "emailBody": "Inhoud bericht", "emailSubject": "Onderwerp bericht", "id": "Id", "info": "Linkomschrijving", "langCode": "Taalcode", "langDir": "Schrijfrichting", "langDirLTR": "Links naar rechts (LTR)", "langDirRTL": "Rechts naar links (RTL)", "menu": "Link wijzigen", "name": "Naam", "noAnchors": "(Geen interne links in document gevonden)", "noEmail": "Geef een e-mailadres", "noUrl": "Geef de link van de URL", "other": "<ander>", "popupDependent": "Afhankelijk (Netscape)", "popupFeatures": "Instellingen popupvenster", "popupFullScreen": "Volledig scherm (IE)", "popupLeft": "Positie links", "popupLocationBar": "Locatiemenu", "popupMenuBar": "Menubalk", "popupResizable": "Herschaalbaar", "popupScrollBars": "Schuifbalken", "popupStatusBar": "Statusbalk", "popupToolbar": "Werkbalk", "popupTop": "Positie boven", "rel": "Relatie", "selectAnchor": "Kies een interne link", "styles": "Stijl", "tabIndex": "Tabvolgorde", "target": "Doelvenster", "targetFrame": "<frame>", "targetFrameName": "Naam doelframe", "targetPopup": "<popupvenster>", "targetPopupName": "Naam popupvenster", "title": "Link", "toAnchor": "Interne link in pagina", "toEmail": "E-mail", "toUrl": "URL", "toolbar": "Link invoegen/wijzigen", "type": "Linktype", "unlink": "Link verwijderen", "upload": "Upload" }, "list": {"bulletedlist": "Opsomming invoegen", "numberedlist": "Genummerde lijst invoegen"}, "liststyle": { "armenian": "Armeense nummering", "bulletedTitle": "Eigenschappen lijst met opsommingstekens", "circle": "Cirkel", "decimal": "Cijfers (1, 2, 3, etc.)", "decimalLeadingZero": "Cijfers beginnen met nul (01, 02, 03, etc.)", "disc": "Schijf", "georgian": "Georgische nummering (an, ban, gan, etc.)", "lowerAlpha": "Kleine letters (a, b, c, d, e, etc.)", "lowerGreek": "Grieks kleine letters (alpha, beta, gamma, etc.)", "lowerRoman": "Romeins kleine letters (i, ii, iii, iv, v, etc.)", "none": "Geen", "notset": "<niet gezet>", "numberedTitle": "Eigenschappen genummerde lijst", "square": "Vierkant", "start": "Start", "type": "Type", "upperAlpha": "Hoofdletters (A, B, C, D, E, etc.)", "upperRoman": "Romeinse hoofdletters (I, II, III, IV, V, etc.)", "validateStartNumber": "Startnummer van de lijst moet een heel nummer zijn." }, "magicline": {"title": "Hier paragraaf invoeren"}, "maximize": {"maximize": "Maximaliseren", "minimize": "Minimaliseren"}, "newpage": {"toolbar": "Nieuwe pagina"}, "pagebreak": {"alt": "Pagina-einde", "toolbar": "Pagina-einde invoegen"}, "pastetext": {"button": "Plakken als platte tekst", "title": "Plakken als platte tekst"}, "pastefromword": { "confirmCleanup": "De tekst die u wilt plakken lijkt gekopieerd te zijn vanuit Word. Wilt u de tekst opschonen voordat deze geplakt wordt?", "error": "Het was niet mogelijk om de geplakte tekst op te schonen door een interne fout", "title": "Plakken vanuit Word", "toolbar": "Plakken vanuit Word" }, "preview": {"preview": "Voorbeeld"}, "print": {"toolbar": "Afdrukken"}, "removeformat": {"toolbar": "Opmaak verwijderen"}, "save": {"toolbar": "Opslaan"}, "selectall": {"toolbar": "Alles selecteren"}, "showblocks": {"toolbar": "Toon blokken"}, "sourcearea": {"toolbar": "Broncode"}, "specialchar": { "options": "Speciale tekens opties", "title": "Selecteer speciaal teken", "toolbar": "Speciaal teken invoegen" }, "scayt": { "btn_about": "Over SCAYT", "btn_dictionaries": "Woordenboeken", "btn_disable": "SCAYT uitschakelen", "btn_enable": "SCAYT inschakelen", "btn_langs": "Talen", "btn_options": "Opties", "text_title": "Controleer de spelling tijdens het typen" }, "stylescombo": { "label": "Stijl", "panelTitle": "Opmaakstijlen", "panelTitle1": "Blok stijlen", "panelTitle2": "Inline stijlen", "panelTitle3": "Object stijlen" }, "table": { "border": "Randdikte", "caption": "Onderschrift", "cell": { "menu": "Cel", "insertBefore": "Voeg cel in voor", "insertAfter": "Voeg cel in na", "deleteCell": "Cellen verwijderen", "merge": "Cellen samenvoegen", "mergeRight": "Voeg samen naar rechts", "mergeDown": "Voeg samen naar beneden", "splitHorizontal": "Splits cel horizontaal", "splitVertical": "Splits cel vertikaal", "title": "Celeigenschappen", "cellType": "Celtype", "rowSpan": "Rijen samenvoegen", "colSpan": "Kolommen samenvoegen", "wordWrap": "Automatische terugloop", "hAlign": "Horizontale uitlijning", "vAlign": "Verticale uitlijning", "alignBaseline": "Tekstregel", "bgColor": "Achtergrondkleur", "borderColor": "Randkleur", "data": "Gegevens", "header": "Kop", "yes": "Ja", "no": "Nee", "invalidWidth": "De celbreedte moet een getal zijn.", "invalidHeight": "De celhoogte moet een getal zijn.", "invalidRowSpan": "Rijen samenvoegen moet een heel getal zijn.", "invalidColSpan": "Kolommen samenvoegen moet een heel getal zijn.", "chooseColor": "Kies" }, "cellPad": "Celopvulling", "cellSpace": "Celafstand", "column": { "menu": "Kolom", "insertBefore": "Voeg kolom in voor", "insertAfter": "Voeg kolom in na", "deleteColumn": "Kolommen verwijderen" }, "columns": "Kolommen", "deleteTable": "Tabel verwijderen", "headers": "Koppen", "headersBoth": "Beide", "headersColumn": "Eerste kolom", "headersNone": "Geen", "headersRow": "Eerste rij", "invalidBorder": "De randdikte moet een getal zijn.", "invalidCellPadding": "Celopvulling moet een getal zijn.", "invalidCellSpacing": "Celafstand moet een getal zijn.", "invalidCols": "Het aantal kolommen moet een getal zijn groter dan 0.", "invalidHeight": "De tabelhoogte moet een getal zijn.", "invalidRows": "Het aantal rijen moet een getal zijn groter dan 0.", "invalidWidth": "De tabelbreedte moet een getal zijn.", "menu": "Tabeleigenschappen", "row": { "menu": "Rij", "insertBefore": "Voeg rij in voor", "insertAfter": "Voeg rij in na", "deleteRow": "Rijen verwijderen" }, "rows": "Rijen", "summary": "Samenvatting", "title": "Tabeleigenschappen", "toolbar": "Tabel", "widthPc": "procent", "widthPx": "pixels", "widthUnit": "eenheid breedte" }, "undo": {"redo": "Opnieuw uitvoeren", "undo": "Ongedaan maken"}, "wsc": { "btnIgnore": "Negeren", "btnIgnoreAll": "Alles negeren", "btnReplace": "Vervangen", "btnReplaceAll": "Alles vervangen", "btnUndo": "Ongedaan maken", "changeTo": "Wijzig in", "errorLoading": "Er is een fout opgetreden bij het laden van de dienst: %s.", "ieSpellDownload": "De spellingscontrole is niet geïnstalleerd. Wilt u deze nu downloaden?", "manyChanges": "Klaar met spellingscontrole: %1 woorden aangepast", "noChanges": "Klaar met spellingscontrole: geen woorden aangepast", "noMispell": "Klaar met spellingscontrole: geen fouten gevonden", "noSuggestions": "- Geen suggesties -", "notAvailable": "Excuses, deze dienst is momenteel niet beschikbaar.", "notInDic": "Niet in het woordenboek", "oneChange": "Klaar met spellingscontrole: één woord aangepast", "progress": "Bezig met spellingscontrole...", "title": "Spellingscontrole", "toolbar": "Spellingscontrole" } };
/** * Connections * * `Connections` are like "saved settings" for your adapters. What's the difference between * a connection and an adapter, you might ask? An adapter (e.g. `sails-mysql`) is generic-- * it needs some additional information to work (e.g. your database host, password, user, etc.) * A `connection` is that additional information. * * Each model must have a `connection` property (a string) which is references the name of one * of these connections. If it doesn't, the default `connection` configured in `config/models.js` * will be applied. Of course, a connection can (and usually is) shared by multiple models. * . * Note: If you're using version control, you should put your passwords/api keys * in `config/local.js`, environment variables, or use another strategy. * (this is to prevent you inadvertently sensitive credentials up to your repository.) * * For more information on configuration, check out: * http://links.sailsjs.org/docs/config/connections */ module.exports.connections = { // Local disk storage for DEVELOPMENT ONLY // // Installed by default. // localDiskDb: { adapter: 'sails-disk' }, // MySQL is the world's most popular relational database. // http://en.wikipedia.org/wiki/MySQL // // Run: // npm install sails-mysql // someMysqlServer: { adapter: 'sails-mysql', host: 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS', user: 'YOUR_MYSQL_USER', password: 'YOUR_MYSQL_PASSWORD', database: 'YOUR_MYSQL_DB' }, // MongoDB is the leading NoSQL database. // http://en.wikipedia.org/wiki/MongoDB // // Run: // npm install sails-mongo // mongodb: { adapter: 'sails-mongo', host: 'localhost', port: 27017, user: '', password: '', database: 'nhop' }, // PostgreSQL is another officially supported relational database. // http://en.wikipedia.org/wiki/PostgreSQL // // Run: // npm install sails-postgresql // somePostgresqlServer: { adapter: 'sails-postgresql', host: 'YOUR_POSTGRES_SERVER_HOSTNAME_OR_IP_ADDRESS', user: 'YOUR_POSTGRES_USER', password: 'YOUR_POSTGRES_PASSWORD', database: 'YOUR_POSTGRES_DB' } // More adapters: // https://github.com/balderdashy/sails };
'use strict'; var Axes = require('../../plots/cartesian/axes'); module.exports = function formatLabels(cdi, trace, fullLayout) { var labels = {}; var mockGd = {_fullLayout: fullLayout}; var xa = Axes.getFromTrace(mockGd, trace, 'x'); var ya = Axes.getFromTrace(mockGd, trace, 'y'); labels.xLabel = Axes.tickText(xa, xa.c2l(cdi.x), true).text; labels.yLabel = Axes.tickText(ya, ya.c2l(cdi.y), true).text; return labels; };
var app = angular.module('AtWork', [ 'atwork.system', 'atwork.users', 'atwork.posts', 'atwork.streams', 'atwork.chats', 'atwork.activities', 'atwork.notifications', 'atwork.settings', 'ngMaterial']); app.controller('AppCtrl', [ '$scope', '$route', '$rootScope', '$mdSidenav', '$mdBottomSheet', '$location', '$timeout', 'appLocation', 'appAuth', 'appWebSocket', 'appSettings', 'appSettingsValid', 'appToast', function($scope, $route, $rootScope, $mdSidenav, $mdBottomSheet, $location, $timeout, appLocation, appAuth, appWebSocket, appSettings, appSettingsValid, appToast) { $scope.barTitle = ''; $scope.search = ''; $scope.toggleSidenav = function(menuId) { $mdSidenav(menuId).toggle(); }; $scope.updateLoginStatus = function() { $scope.isLoggedIn = appAuth.isLoggedIn(); $scope.user = appAuth.getUser(); }; $scope.goHome = function() { appLocation.url('/'); }; $scope.showUserActions = function($event) { $mdBottomSheet.show({ templateUrl: '/modules/users/views/user-list.html', controller: 'UserSheet', targetEvent: $event }).then(function(clickedItem) { $scope.alert = clickedItem.name + ' clicked!'; }); }; var initiateSettings = function(cb) { appSettings.fetch(function(settings) { $rootScope.systemSettings = settings; if (cb) { cb(); } }); }; /** * Scroll the view to top on route change */ $scope.$on('$routeChangeSuccess', function() { angular.element('*[md-scroll-y]').animate({scrollTop: 0}, 300); $mdSidenav('left').close(); }); $scope.$on('loggedIn', function() { $scope.updateLoginStatus(); $scope.barTitle = ''; $scope.$broadcast('updateNotifications'); appWebSocket.conn.emit('online', {token: appAuth.getToken()}); appAuth.refreshUser(function(user) { $scope.user = user; }); /** * Fetch settings and get the app ready */ initiateSettings(function() { $scope.$on('$routeChangeStart', function (event, toState) { var valid = appSettingsValid(); if (!valid) { appToast('Please complete the setup first.'); } }); $scope.appReady = true; $scope.barTitle = $rootScope.systemSettings.tagline; $timeout(appSettingsValid); }); }); $scope.$on('loggedOut', function() { $scope.updateLoginStatus(); appWebSocket.conn.emit('logout', {token: appAuth.getToken()}); }); appWebSocket.conn.on('connect', function() { if (appAuth.isLoggedIn()) { appWebSocket.conn.emit('online', {token: appAuth.getToken()}); } }); $scope.updateLoginStatus(); $timeout(function() { if (!appAuth.isLoggedIn()) { if (window.location.href.indexOf('/activate/') == -1 && window.location.href.indexOf('/changePassword/') == -1) { appLocation.url('/login'); } initiateSettings(); $scope.appReady = true; } else { $scope.barTitle = ''; $scope.$broadcast('loggedIn'); } }); } ]);
// All material copyright ESRI, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.16/esri/copyright.txt for details. //>>built define("require exports ../../../../core/Logger ../../../../core/libs/gl-matrix-2/vec2f64 ../../../../core/libs/gl-matrix-2/vec3 ../../../../core/libs/gl-matrix-2/vec4 ../../../../core/libs/gl-matrix-2/vec4f64 ../../support/imageUtils ./DefaultTextureUnits ./glUtil3D ./SSAOTechnique ./Util ../../../webgl/FramebufferObject ../../../webgl/Texture ../../../webgl/Util".split(" "),function(w,r,x,y,z,A,t,B,C,u,p,v,q,D,m){var E=x.getLogger("esri.views.3d.webgl-engine.lib.SSAOHelper");r=function(){function b(a, d,b){this._enabled=!1;this._BLUR_F=2;this._attenuation=.5;this._radius=3;this._samples=16;this._viewportToRestore=t.vec4f64.create();this._rctx=d;this._techniqueRep=a;this._requestRender=b;this._ssaoTechniqueConfig=new p.SSAOTechniqueConfiguration;this._emptyTexture=u.createColorTexture(d,[1,1,1,1])}b.prototype.dispose=function(){this._emptyTexture.dispose();this._emptyTexture=null};Object.defineProperty(b.prototype,"isSupported",{get:function(){var a=this._rctx,d=-1!==a.parameters.versionString.indexOf("WebGL 0.93"), a=-1!==a.parameters.versionString.indexOf("WebGL 0.94");return!(d||a)},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"enabled",{get:function(){return this._enabled},set:function(a){a?this.enable():this.disable()},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"attenuation",{get:function(){return this._attenuation},set:function(a){this._attenuation=a},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"radius",{get:function(){return this._radius}, set:function(a){this._radius=a},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"filterRadius",{get:function(){return 4},enumerable:!0,configurable:!0});Object.defineProperty(b.prototype,"samples",{get:function(){return this._samples},set:function(a){this._samples=a;this._enabled&&this.selectPrograms()},enumerable:!0,configurable:!0});b.prototype.computeSSAO=function(a,d,b){if(this._noiseTexture){v.assert(this.enabled);var c=this._rctx,l=a.fullViewport,e=l[2],g=l[3],l=e/this._BLUR_F, k=g/this._BLUR_F;this._ssaoFBO.resize(e,g);this._blur0FBO.resize(l,k);this._blur1FBO.resize(l,k);l=1*e;k=1*g;c.bindFramebuffer(this._ssaoFBO);A.vec4.copy(this._viewportToRestore,a.fullViewport);c.setViewport(0,0,e,g);var f=this._ssaoTechnique.program,h=this._blurTechnique.program;c.bindProgram(f);c.setPipelineState(this._ssaoTechnique.pipeline);f.setUniform2f("rnmScale",e/this._noiseTexture.descriptor.width,g/this._noiseTexture.descriptor.height);f.setUniform3fv("pSphere",8>=this._samples?this._data.random8: 16>=this._samples?this._data.random16:32>=this._samples?this._data.random32:this._data.random64);e=this._data.minDiscrepancy;f.setUniform1f("numSpiralTurns",this._samples<e.length?e[this._samples]:5779);e=F;g=G;v.inverseProjectionInfo(a.projectionMatrix,a.fullWidth,a.fullHeight,e,g);f.setUniform4fv("projInfo",e);f.setUniform2fv("zScale",g);f.setUniform2f("nearFar",a.near,a.far);e=1/a.computeRenderPixelSizeAtDist(1);f.setUniform1f("projScale",1*e);f.setUniform2f("screenDimensions",l,k);var n=2*this._radius, g=z.vec3.distance(a.eye,a.center),n=20*a.computeRenderPixelSizeAtDist(g),n=Math.max(.1,n);f.setUniform1f("radius",n);f.setUniform1f("intensity",4*this._attenuation/Math.pow(n,6));f.setUniform1i("rnm",0);f.setUniform1i("normalMap",1);f.setUniform1i("depthMap",2);c.bindTexture(this._noiseTexture,0);c.bindTexture(b,1);c.bindTexture(d,2);d=u.createQuadVAO(this._rctx);c.bindVAO(d);c.drawArrays(5,0,m.vertexCount(d,"geometry"));c.bindTexture(this._ssaoFBO.colorTexture,0);c.setViewport(0,0,l/this._BLUR_F, k/this._BLUR_F);c.bindFramebuffer(this._blur0FBO);c.bindProgram(h);h.setUniform2f("screenDimensions",l,k);h.setUniform1i("tex",0);h.setUniform1i("normalMap",1);h.setUniform1i("depthMap",2);h.setUniform2f("blurSize",0,1*this._BLUR_F/k);h.setUniform1i("radius",4);h.setUniform1f("g_BlurFalloff",.08);h.setUniform2f("nearFar",a.near,a.far);5E4<g&&(e=Math.max(0,e-(g-5E4)));h.setUniform1f("projScale",e);h.setUniform2f("zScale",1,0);c.drawArrays(5,0,m.vertexCount(d,"geometry"));h.setUniform2f("blurSize", 1*this._BLUR_F/l,0);c.bindFramebuffer(this._blur1FBO);c.bindTexture(this._blur0FBO.colorTexture,0);c.drawArrays(5,0,m.vertexCount(d,"geometry"));c.setViewport(this._viewportToRestore[0],this._viewportToRestore[1],this._viewportToRestore[2],this._viewportToRestore[3])}};b.prototype.setUniforms=function(a,d){var b=this.enabled&&this._noiseTexture,c=this._rctx;c.bindTexture(b?this._blur1FBO.colorTexture:this._emptyTexture,d);c.setActiveTexture(0);a.setUniform1i("ssaoTex",d);b?a.setUniform4f("viewportPixelSz", this._viewportToRestore[0],this._viewportToRestore[1],1/this._ssaoFBO.width,1/this._ssaoFBO.height):a.setUniform4f("viewportPixelSz",-1,-1,-1,-1)};b.prototype.bindToAllPrograms=function(a){a=a.getProgramsUsingUniform("viewportPixelSz");for(var b=0;b<a.length;b++)this.setUniforms(a[b],C.DefaultTextureUnits.SSAO)};b.prototype.selectPrograms=function(){this._ssaoTechniqueConfig.samples=8>=this._samples?8:16>=this._samples?16:32>=this._samples?32:64;this._ssaoTechniqueConfig.radius=4;this._ssaoTechniqueConfig.output= 0;this._ssaoTechnique=this._techniqueRep.acquireAndReleaseExisting(p.SSAOTechnique,this._ssaoTechniqueConfig,this._ssaoTechnique);this._ssaoTechniqueConfig.output=1;this._blurTechnique=this._techniqueRep.acquireAndReleaseExisting(p.SSAOTechnique,this._ssaoTechniqueConfig,this._blurTechnique)};b.prototype.enable=function(){var a=this;this.enabled||(this.isSupported?(this._enabled=!0,this.loadResources(function(){a._enabled&&a.initialize()})):E.warn("SSAO is not supported for this browser or hardware"))}; b.prototype.loadResources=function(a){var b=this;this._data?a():w(["./SSAOHelperData"],function(d){b._data=d;a()})};b.prototype.initialize=function(){var a=this,b={target:3553,pixelFormat:6408,dataType:5121,samplingMode:9729,wrapMode:33071,width:0,height:0},k={colorTarget:0,depthStencilTarget:0};this._ssaoFBO=new q(this._rctx,k,b);this._blur0FBO=new q(this._rctx,k,b);this._blur1FBO=new q(this._rctx,k,b);B.requestImage(this._data.noiseTexture).then(function(b){a._enabled&&(a._noiseTexture=new D(a._rctx, {target:3553,pixelFormat:6408,dataType:5121,hasMipmap:!0,width:b.width,height:b.height},b),a._requestRender())});this.selectPrograms()};b.prototype.disable=function(){this.enabled&&(this._enabled=!1,this._noiseTexture&&(this._noiseTexture.dispose(),this._noiseTexture=null),this._blur1FBO&&(this._blur1FBO.dispose(),this._blur1FBO=null),this._blur0FBO&&(this._blur0FBO.dispose(),this._blur0FBO=null),this._ssaoFBO&&(this._ssaoFBO.dispose(),this._ssaoFBO=null))};b.prototype.getGpuMemoryUsage=function(){return m.getGpuMemoryUsage(this._blur0FBO)+ m.getGpuMemoryUsage(this._blur1FBO)+m.getGpuMemoryUsage(this._ssaoFBO)};return b}();var G=y.vec2f64.create(),F=t.vec4f64.create();return r});
version https://git-lfs.github.com/spec/v1 oid sha256:ad911cfe35ed2702a6023f24dac7e20b7b1d64e5583cd53411e87b5c10fa0c35 size 16080
function render(node){ console.log(node); }; export default render;
(function ($, _, Backbone, models) { "use strict"; models.Widget = Backbone.Model.extend({ defaults: { "name" : "Undefined name", "range" : '30-minutes', "update_interval": '10' }, url: function() { var tmp = "/api/dashboards/" + this.get("dashboard_id") + "/widgets"; if (this.isNew()) { return tmp; } else { return tmp + "/" + this.get("id"); } }, targetsString: function() { return (this.get("targets") || "").split(';'); } }); })($, _, Backbone, app.models);
XO.View.define({ pid:'home', vid:'page2', version:'20131209', cssHost:'body', init:function(){ XO.warn('View inited:'+this.id); } });