code
stringlengths
2
1.05M
/* eslint-env jest */ /* eslint-disable global-require, import/no-dynamic-require */ import path from 'path'; import bootstrap from '../bootstrap'; jest.mock('../utils/shell'); jest.mock('../utils/writeSpecs'); const PACKAGE_NAMES_1 = ['oao', 'oao-b', 'oao-c', 'oao-d', 'oao-priv']; const PACKAGE_NAMES_2 = ['oao', 'oao-b', 'oao-c']; const readOriginalSpecs = (base, names) => { const originalSpecs = {}; names.forEach(name => { originalSpecs[name] = require(path.join(base, `${name}/package.json`)); }); return originalSpecs; }; const spyFinalSpec = (spy, pkgName) => { let finalSpec; spy.mock.calls.forEach(([, specs]) => { if (specs.name === pkgName) finalSpec = specs; }); return finalSpec; }; describe('BOOTSTRAP command', () => { it('does not modify any package.json', async () => { const writeSpecs = require('../utils/writeSpecs').default; const base = path.join(process.cwd(), 'test/fixtures/packages'); const originalSpecs = readOriginalSpecs(base, PACKAGE_NAMES_1); await bootstrap({ src: 'test/fixtures/packages/*' }); // Process call arguments; we keep the last time a spec is stored // and compare it with the original one writeSpecs.mock.calls.forEach(([specPath, specs]) => { const { name } = specs; expect(specPath.split(path.sep)).toContain(name); expect(specPath.split(path.sep)).toContain('package.json'); }); PACKAGE_NAMES_1.forEach(name => { const finalSpecWritten = spyFinalSpec(writeSpecs, name); if (finalSpecWritten === undefined) return; // not changed at all! expect(finalSpecWritten).toEqual(originalSpecs[name]); }); }); it('does not modify any package.json with custom links', async () => { const writeSpecs = require('../utils/writeSpecs').default; const base = path.join(process.cwd(), 'test/fixtures/packagesCustomLinks'); const originalSpecs = readOriginalSpecs(base, PACKAGE_NAMES_2); await bootstrap({ src: 'test/fixtures/packagesCustomLinks/*', link: 'ext-.*', }); PACKAGE_NAMES_2.forEach(name => { const finalSpecWritten = spyFinalSpec(writeSpecs, name); if (finalSpecWritten === undefined) return; // not changed at all! expect(finalSpecWritten).toEqual(originalSpecs[name]); }); }); it('executes the correct `yarn link`s and `yarn install`s', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packages/*' }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('executes the correct `yarn link`s and `yarn install`s in production', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packages/*', production: true }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('executes the correct `yarn link`s and `yarn install`s with --frozen-lockfile', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packages/*', frozenLockfile: true }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('executes the correct `yarn link`s and `yarn install`s with --pure-lockfile', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packages/*', pureLockfile: true }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('executes the correct `yarn link`s and `yarn install`s with --no-lockfile', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packages/*', noLockfile: true }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('executes the correct `yarn link`s and `yarn install`s with custom links', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packagesCustomLinks/*', link: 'ext-.*', }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('supports scoped packages', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: 'test/fixtures/packagesScoped/*' }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); it('just runs `yarn install` when workspaces are configured', async () => { const helpers = require('../utils/shell'); await bootstrap({ src: ['test/fixtures/packages/*'], workspaces: true }); expect(helpers.exec.mock.calls).toMatchSnapshot(); }); });
module.exports = { SEND : 0, SIGNATURE : 1, DELEGATE : 2, VOTE : 3, USERNAME : 4, FOLLOW : 5, MESSAGE : 6, AVATAR : 7, MULTI: 8 }
/** * Created by rohit on 12/9/16. */ var express = require('express'); var Handler = require('../handler'); var model = require('../models/hero'); var router = express.Router(); var handler = new Handler(model); router.get("/", handler.getList); router.get("/:id", handler.get); router.post("/", handler.post); router.put("/:id", handler.put); router.delete("/:id", handler.handleDelete); module.exports = router;
/** * DOM utils */ (function(window, document) { 'use strict'; var module = {}; /** * Adds or removes the given class on/from a node element * @param node * @param classname * @param on */ module.toggleClass = function(node, classname, on) { if (on) { node.className += ' ' + classname; } else { node.className = node.className.replace(classname, ''); } }; /** * Gets the closest node depending on its classname * @param node * @param classname */ module.getClosestNode = function(node, classname) { while (node.className.search(classname) === -1) { node = node.parentNode; } return node; }; window.DOM = module; })(window, document);
/** * Overdrive effect module for the Web Audio API. * * @param {AudioContext} context * @param {object} opts * @param {number} opts.preBand * @param {number} opts.color * @param {number} opts.drive * @param {number} opts.postCut */ function Overdrive (context, opts) { this.input = context.createGain(); this.output = context.createGain(); // Internal AudioNodes this._bandpass = context.createBiquadFilter(); this._bpWet = context.createGain(); this._bpDry = context.createGain(); this._ws = context.createWaveShaper(); this._lowpass = context.createBiquadFilter(); // AudioNode graph routing this.input.connect(this._bandpass); this._bandpass.connect(this._bpWet); this._bandpass.connect(this._bpDry); this._bpWet.connect(this._ws); this._bpDry.connect(this._ws); this._ws.connect(this._lowpass); this._lowpass.connect(this.output); // Defaults var p = this.meta.params; opts = opts || {}; this._bandpass.frequency.value = opts.color || p.color.defaultValue; this._bpWet.gain.value = opts.preBand || p.preBand.defaultValue; this._lowpass.frequency.value = opts.postCut || p.postCut.defaultValue; this.drive = opts.drive || p.drive.defaultValue; // Inverted preBand value this._bpDry.gain.value = opts.preBand ? 1 - opts.preBand : 1 - p.preBand.defaultValue; } Overdrive.prototype = Object.create(null, { /** * AudioNode prototype `connect` method. * * @param {AudioNode} dest */ connect: { value: function (dest) { this.output.connect( dest.input ? dest.input : dest ); } }, /** * AudioNode prototype `disconnect` method. */ disconnect: { value: function () { this.output.disconnect(); } }, /** * Module parameter metadata. */ meta: { value: { name: "Overdrive", params: { preBand: { min: 0, max: 1.0, defaultValue: 0.5, type: "float" }, color: { min: 0, max: 22050, defaultValue: 800, type: "float" }, drive: { min: 0.0, max: 1.0, defaultValue: 0.5, type: "float" }, postCut: { min: 0, max: 22050, defaultValue: 3000, type: "float" } } } }, /** * Public parameters */ preBand: { enumerable: true, get: function () { return this._bpWet.gain.value; }, set: function (value) { this._bpWet.gain.setValueAtTime(value, 0); this._bpDry.gain.setValueAtTime(1 - value, 0); } }, color: { enumerable: true, get: function () { return this._bandpass.frequency.value; }, set: function (value) { this._bandpass.frequency.setValueAtTime(value, 0); } }, drive: { enumerable: true, get: function () { return this._drive; }, set: function (value) { var k = value * 100 , n = 22050 , curve = new Float32Array(n) , deg = Math.PI / 180; this._drive = value; for (var i = 0; i < n; i++) { var x = i * 2 / n - 1; curve[i] = (3 + k) * x * 20 * deg / (Math.PI + k * Math.abs(x)); } this._ws.curve = curve; } }, postCut: { enumerable: true, get: function () { return this._lowpass.frequency.value; }, set: function (value) { this._lowpass.frequency.setValueAtTime(value, 0); } } }); /** * Exports. */ /* module.exports = Overdrive; */
import dateHelper from 'appkit/utils/date'; App.Goal = DS.Model.extend({ title: DS.attr(), body: DS.attr(), daily: DS.attr(), startDate: DS.attr(), endDate: DS.attr(), isCompleted: function() { return this.get('endDate') <= dateHelper.todayDate(); }.property('endDate'), investment: DS.attr(), isInvested: function() { return this.get('investment') > 0; }.property('investment'), sorting: function() { if (this.get('isCompleted')) return 2; if (this.get('isInvested')) return 1; return 0; }.property('isCompleted', 'isInvested'), dailyGoals: DS.hasMany('dailyGoal') }); export default App.Goal;
var searchData= [ ['iddest',['idDest',['../a00008.html#a82d0b10f7c7c3190a863bd908d44ef18',1,'Graph::Edge']]], ['indegree',['indegree',['../a00023.html#ab6ac19101f852f053664f91c23665419',1,'Graph::Vertex']]], ['info',['info',['../a00023.html#a409b7b4ee715251a5b2cd890c426475e',1,'Graph::Vertex']]], ['isigarape',['isIgarape',['../a00019.html#afe9fc3ac51c7d19045526af8e35a3064',1,'DeliveryRoute::PathInfo']]] ];
var wordlists = wordlists || {}; // 997 very common words // based on David Norman's top 1,000 words // https://gist.github.com/deekayen/4148741 wordlists.deekayen = [ 'the', 'of', 'to', 'and', 'a', 'in', 'is', 'it', 'you', 'that', 'he', 'was', 'for', 'on', 'are', 'with', 'as', 'I', 'his', 'they', 'be', 'at', 'one', 'have', 'this', 'from', 'or', 'had', 'by', 'hot', 'word', 'but', 'what', 'some', 'we', 'can', 'out', 'other', 'were', 'all', 'there', 'when', 'up', 'use', 'your', 'how', 'said', 'an', 'each', 'she', 'which', 'do', 'their', 'time', 'if', 'will', 'way', 'about', 'many', 'then', 'them', 'write', 'would', 'like', 'so', 'these', 'her', 'long', 'make', 'thing', 'see', 'him', 'two', 'has', 'look', 'more', 'day', 'could', 'go', 'come', 'did', 'number', 'sound', 'no', 'most', 'people', 'my', 'over', 'know', 'water', 'than', 'call', 'first', 'who', 'may', 'down', 'side', 'been', 'now', 'find', 'any', 'new', 'work', 'part', 'take', 'get', 'place', 'made', 'live', 'where', 'after', 'back', 'little', 'only', 'round', 'man', 'year', 'came', 'show', 'every', 'good', 'me', 'give', 'our', 'under', 'name', 'very', 'through', 'just', 'form', 'sentence', 'great', 'think', 'say', 'help', 'low', 'line', 'differ', 'turn', 'cause', 'much', 'mean', 'before', 'move', 'right', 'boy', 'old', 'too', 'same', 'tell', 'does', 'set', 'three', 'want', 'air', 'well', 'also', 'play', 'small', 'end', 'put', 'home', 'read', 'hand', 'port', 'large', 'spell', 'add', 'even', 'land', 'here', 'must', 'big', 'high', 'such', 'follow', 'act', 'why', 'ask', 'men', 'change', 'went', 'light', 'kind', 'off', 'need', 'house', 'picture', 'try', 'us', 'again', 'animal', 'point', 'mother', 'world', 'near', 'build', 'self', 'earth', 'father', 'head', 'stand', 'own', 'page', 'should', 'country', 'found', 'answer', 'school', 'grow', 'study', 'still', 'learn', 'plant', 'cover', 'food', 'sun', 'four', 'between', 'state', 'keep', 'eye', 'never', 'last', 'let', 'thought', 'city', 'tree', 'cross', 'farm', 'hard', 'start', 'might', 'story', 'saw', 'far', 'sea', 'draw', 'left', 'late', 'run', 'while', 'press', 'close', 'night', 'real', 'life', 'few', 'north', 'open', 'seem', 'together', 'next', 'white', 'children', 'begin', 'got', 'walk', 'example', 'ease', 'paper', 'group', 'always', 'music', 'those', 'both', 'mark', 'often', 'letter', 'until', 'mile', 'river', 'car', 'feet', 'care', 'second', 'book', 'carry', 'took', 'science', 'eat', 'room', 'friend', 'began', 'idea', 'fish', 'mountain', 'stop', 'once', 'base', 'hear', 'horse', 'cut', 'sure', 'watch', 'color', 'face', 'wood', 'main', 'enough', 'plain', 'girl', 'usual', 'young', 'ready', 'above', 'ever', 'red', 'list', 'though', 'feel', 'talk', 'bird', 'soon', 'body', 'dog', 'family', 'direct', 'pose', 'leave', 'song', 'measure', 'door', 'product', 'black', 'short', 'numeral', 'class', 'wind', 'question', 'happen', 'complete', 'ship', 'area', 'half', 'rock', 'order', 'fire', 'south', 'problem', 'piece', 'told', 'knew', 'pass', 'since', 'top', 'whole', 'king', 'space', 'heard', 'best', 'hour', 'better', 'true', 'during', 'hundred', 'five', 'remember', 'step', 'early', 'hold', 'west', 'ground', 'interest', 'reach', 'fast', 'verb', 'sing', 'listen', 'six', 'table', 'travel', 'less', 'morning', 'ten', 'simple', 'several', 'vowel', 'toward', 'war', 'lay', 'against', 'pattern', 'slow', 'center', 'love', 'person', 'money', 'serve', 'appear', 'road', 'map', 'rain', 'rule', 'govern', 'pull', 'cold', 'notice', 'voice', 'unit', 'power', 'town', 'fine', 'certain', 'fly', 'fall', 'lead', 'cry', 'dark', 'machine', 'note', 'wait', 'plan', 'figure', 'star', 'box', 'noun', 'field', 'rest', 'correct', 'able', 'pound', 'done', 'beauty', 'drive', 'stood', 'contain', 'front', 'teach', 'week', 'final', 'gave', 'green', 'oh', 'quick', 'develop', 'ocean', 'warm', 'free', 'minute', 'strong', 'special', 'mind', 'behind', 'clear', 'tail', 'produce', 'fact', 'street', 'inch', 'multiply', 'nothing', 'course', 'stay', 'wheel', 'full', 'force', 'blue', 'object', 'decide', 'surface', 'deep', 'moon', 'island', 'foot', 'system', 'busy', 'test', 'record', 'boat', 'common', 'gold', 'possible', 'plane', 'stead', 'dry', 'wonder', 'laugh', 'thousand', 'ago', 'ran', 'check', 'game', 'shape', 'equate', 'miss', 'brought', 'heat', 'snow', 'tire', 'bring', 'yes', 'distant', 'fill', 'east', 'paint', 'language', 'among', 'grand', 'ball', 'yet', 'wave', 'drop', 'heart', 'am', 'present', 'heavy', 'dance', 'engine', 'position', 'arm', 'wide', 'sail', 'material', 'size', 'vary', 'settle', 'speak', 'weight', 'general', 'ice', 'matter', 'circle', 'pair', 'include', 'divide', 'syllable', 'felt', 'perhaps', 'pick', 'sudden', 'count', 'square', 'reason', 'length', 'represent', 'art', 'subject', 'region', 'energy', 'hunt', 'probable', 'bed', 'brother', 'egg', 'ride', 'cell', 'believe', 'fraction', 'forest', 'sit', 'race', 'window', 'store', 'summer', 'train', 'sleep', 'prove', 'lone', 'leg', 'exercise', 'wall', 'catch ', 'mount', 'wish', 'sky', 'board', 'joy', 'winter', 'sat', 'written', 'wild', 'instrument', 'kept', 'glass', 'grass', 'cow', 'job', 'edge', 'sign', 'visit', 'past', 'soft', 'fun', 'bright', 'gas', 'weather', 'month', 'million', 'bear', 'finish', 'happy', 'hope', 'flower', 'clothe', 'strange', 'gone', 'jump', 'baby', 'eight', 'village', 'meet', 'root', 'buy', 'raise', 'solve', 'metal', 'whether', 'push', 'seven', 'paragraph', 'third', 'shall', 'held', 'hair', 'describe', 'cook', 'floor', 'either', 'result', 'burn', 'hill', 'safe', 'cat', 'century', 'consider', 'type', 'law', 'bit', 'coast', 'copy', 'phrase', 'silent', 'tall', 'sand', 'soil', 'roll', 'temperature', 'finger', 'industry', 'value', 'fight', 'lie', 'beat', 'excite', 'natural', 'view', 'sense', 'ear', 'else', 'quite', 'broke', 'case ', 'middle', 'kill', 'son', 'lake', 'moment', 'scale', 'loud', 'spring', 'observe', 'child', 'straight', 'consonant', 'nation', 'dictionary', 'milk', 'speed', 'method', 'organ', 'pay', 'age', 'section', 'dress', 'cloud', 'surprise', 'quiet', 'stone', 'tiny', 'climb', 'cool', 'design', 'poor', 'lot', 'experiment', 'bottom', 'key', 'iron', 'single', 'stick', 'flat', 'twenty', 'skin', 'smile', 'crease', 'hole', 'trade', 'melody', 'trip', 'office', 'receive', 'row', 'mouth', 'exact', 'symbol', 'die', 'least', 'trouble', 'shout', 'except', 'wrote', 'seed', 'tone', 'join', 'suggest', 'clean', 'break ', 'lady', 'yard', 'rise', 'bad', 'blow', 'oil', 'blood', 'touch', 'grew', 'cent', 'mix', 'team', 'wire', 'cost', 'lost', 'brown', 'wear', 'garden', 'equal', 'sent', 'choose', 'fell', 'fit', 'flow', 'fair', 'bank', 'collect', 'save', 'control', 'decimal', 'gentle', 'woman', 'captain', 'practice', 'separate', 'difficult', 'doctor', 'please', 'protect', 'noon', 'whose', 'locate', 'ring', 'character', 'insect', 'caught', 'period', 'indicate', 'radio', 'spoke', 'atom', 'human', 'history', 'effect', 'electric', 'expect', 'crop', 'modern', 'element', 'hit', 'student', 'corner', 'party', 'supply', 'bone', 'rail', 'imagine', 'provide', 'agree', 'thus', 'capital', 'chair', 'danger', 'fruit', 'rich', 'thick', 'soldier', 'process', 'operate', 'guess', 'necessary', 'sharp', 'wing', 'create', 'neighbor', 'wash', 'bat', 'rather', 'crowd', 'corn', 'compare', 'poem', 'string', 'bell', 'depend', 'meat', 'rub', 'tube', 'famous', 'dollar', 'stream', 'fear', 'sight', 'thin', 'triangle', 'planet', 'hurry', 'chief', 'colony', 'clock', 'mine', 'tie', 'enter', 'major', 'fresh', 'search', 'send', 'yellow', 'gun', 'allow', 'print', 'dead', 'spot', 'desert', 'suit', 'current', 'lift', 'rose', 'continue', 'block', 'chart', 'hat', 'sell', 'success', 'company', 'subtract', 'event', 'particular', 'deal', 'swim', 'term', 'opposite', 'wife', 'shoe', 'shoulder', 'spread', 'arrange', 'camp', 'invent', 'cotton', 'born', 'determine', 'quart', 'nine', 'truck', 'noise', 'level', 'chance', 'gather', 'shop', 'stretch', 'throw', 'shine', 'property', 'column', 'molecule', 'select', 'wrong', 'gray', 'repeat', 'require', 'broad', 'prepare', 'salt', 'nose', 'plural', 'anger', 'claim', 'continent', 'oxygen', 'sugar', 'death', 'pretty', 'skill', 'women', 'season', 'solution', 'magnet', 'silver', 'thank', 'branch', 'match', 'suffix', 'especially', 'fig', 'afraid', 'huge', 'sister', 'steel', 'discuss', 'forward', 'similar', 'guide', 'experience', 'score', 'apple', 'bought', 'led', 'pitch', 'coat', 'mass', 'card', 'band', 'rope', 'slip', 'win', 'dream', 'evening', 'condition', 'feed', 'tool', 'total', 'basic', 'smell', 'valley', 'nor', 'double', 'seat', 'arrive', 'master', 'track', 'parent', 'shore', 'division', 'sheet', 'substance', 'favor', 'connect', 'post', 'spend', 'chord', 'fat', 'glad', 'original', 'share', 'station', 'dad', 'bread', 'charge', 'proper', 'bar', 'offer', 'segment', 'slave', 'duck', 'instant', 'market', 'degree', 'populate', 'chick', 'dear', 'enemy', 'reply', 'drink', 'occur', 'support', 'speech', 'nature', 'range', 'steam', 'motion', 'path', 'liquid', 'log', 'meant', 'quotient', 'teeth', 'shell', 'neck' ];
define(["helpers/log", "settings"], function( log, settings) { 'use strict'; return Mouse; function Mouse() { var _guid = guid(); log.low('[MOUSE:' + _guid + ']', 'getting a new mouse object'); var _elem = null; var _callbacks = { mouseup: [], mousedown: [], mousemove: [], mouseover: [], mouseout: [] }; this.up = function(func) { _register('mouseup', func); }; this.down = function(func) { _register('mousedown', func); }; this.move = function(func) { _register('mousemove', func); }; this.setup = function(elem) { _elem = (typeof elem === 'string') ? document.getElementById(elem) : elem; _addEvent('mousemove', function(e) { for (var x = 0; x < _callbacks.mousemove.length; x++) { _gridHelper(e, _callbacks.mousemove[x]); } }.bind(this)); _addEvent('mouseup', function(e) { for (var x = 0; x < _callbacks.mouseup.length; x++) { _gridHelper(e, _callbacks.mouseup[x]); } }.bind(this)); _addEvent('mousedown', function(e) { for (var x = 0; x < _callbacks.mousedown.length; x++) { _gridHelper(e, _callbacks.mousedown[x]); } }.bind(this)); }; function _gridHelper(e, func) { var ret = { on: e.srcElement, tile: { height: ~~(parseInt(e.layerY) / settings.square), width: ~~(parseInt(e.layerX) / settings.square), pixHeight: e.layerY, pixWidth: e.layerX } }; func.call(this, ret); } function _register(type, func) { _callbacks[type].push(func); } // add event cross browser function _addEvent(e, fn) { // avoid memory overhead of new anonymous functions for every event handler that's installed // by using local functions function listenHandler(e) { var ret = fn.apply(this, arguments); if (ret === false) { e.stopPropagation(); e.preventDefault(); } return (ret); } function attachHandler() { // set the this pointer same as addEventListener when fn is called // and make sure the event is passed to the fn also so that works the same too var ret = fn.call(_elem, window.event); if (ret === false) { window.event.returnValue = false; window.event.cancelBubble = true; } return (ret); } if (_elem.addEventListener) { _elem.addEventListener(e, listenHandler, false); } else { _elem.attachEvent("on" + e, attachHandler); } } } });
// flow-typed signature: 1c287c7de36e0f17b360c02a0176067d // flow-typed version: <<STUB>>/lint-staged_v^4.0.3/flow_v0.52.0 /** * This is an autogenerated libdef stub for: * * 'lint-staged' * * Fill this stub out by replacing all the `any` types. * * Once filled out, we encourage you to share your work with the * community by sending a pull request to: * https://github.com/flowtype/flow-typed */ declare module 'lint-staged' { declare module.exports: any; } /** * We include stubs for each file inside this npm package in case you need to * require those files directly. Feel free to delete any files that aren't * needed. */ declare module 'lint-staged/src/calcChunkSize' { declare module.exports: any; } declare module 'lint-staged/src/findBin' { declare module.exports: any; } declare module 'lint-staged/src/generateTasks' { declare module.exports: any; } declare module 'lint-staged/src/index' { declare module.exports: any; } declare module 'lint-staged/src/readConfigOption' { declare module.exports: any; } declare module 'lint-staged/src/runScript' { declare module.exports: any; } // Filename aliases declare module 'lint-staged/index' { declare module.exports: $Exports<'lint-staged'>; } declare module 'lint-staged/index.js' { declare module.exports: $Exports<'lint-staged'>; } declare module 'lint-staged/src/calcChunkSize.js' { declare module.exports: $Exports<'lint-staged/src/calcChunkSize'>; } declare module 'lint-staged/src/findBin.js' { declare module.exports: $Exports<'lint-staged/src/findBin'>; } declare module 'lint-staged/src/generateTasks.js' { declare module.exports: $Exports<'lint-staged/src/generateTasks'>; } declare module 'lint-staged/src/index.js' { declare module.exports: $Exports<'lint-staged/src/index'>; } declare module 'lint-staged/src/readConfigOption.js' { declare module.exports: $Exports<'lint-staged/src/readConfigOption'>; } declare module 'lint-staged/src/runScript.js' { declare module.exports: $Exports<'lint-staged/src/runScript'>; }
var Renderer = (function () { function Renderer(recipeCategoriesSummary) { this.recipeCategoriesSummary = recipeCategoriesSummary; if (recipeCategoriesSummary) { this.renderCategories(recipeCategoriesSummary); } else { this.renderError(); } } Renderer.prototype.renderCategories = function (recipeCategoriesSummary) { var recipeSelect = document.getElementById('RecipeCategory'); recipeCategoriesSummary.items.forEach(function (category) { var opt = document.createElement('option'); opt.setAttribute('title', category.title); opt.innerHTML = category.text; recipeSelect.appendChild(opt); }); }; //TODO (INTERFACES EXERCISE) //1. Change the category parameter type to IRecipeCategory Renderer.prototype.renderCategory = function (category) { //Update foodgroups bullet points var foodGroups = document.getElementById('FoodGroups'); foodGroups.value = ''; var html = '<ul>'; for (var i = 0, len = category.foodGroups.length; i < len; i++) { html += '<li>' + category.foodGroups[i].name + '</li>'; } foodGroups.innerHTML = html + '</ul>'; //Update description var el = document.getElementById('recipeDesc'); el.innerHTML = category.description; this.renderExamples(category); }; //TODO (INTERFACES EXERCISE) //1. Change the category parameter type to IRecipeCategory Renderer.prototype.renderExamples = function (category) { //Update examples var examples = document.getElementById('examples'); examples.value = ''; var html = '<ol>'; for (var i = 0, len = category.examples.length; i < len; i++) { var example = category.examples[i]; var ingredients = example.ingredients.map(function (ingredient) { return ingredient.name; }); html += '<li>' + '<h4>' + example.name + ' </h4>' + '<strong>Ingredients: </strong>' + ingredients.join(', ') + '<br /><strong>Preparation Time: </strong>' + example.prepTime + '</li>'; } examples.innerHTML = html + '</ol>'; }; Renderer.prototype.renderError = function () { var examples = document.getElementById('examples'); examples.value = 'Unable to load data!'; }; return Renderer; }()); //# sourceMappingURL=renderer.js.map
import express from 'express'; import path from 'path'; import assets from './assets'; // eslint-disable-line import/no-unresolved import template from './index.pug'; import { port } from './config'; const app = express(); app.use(express.static(path.join(__dirname, 'public'))); app.get('*', (req, res) => { res.send(template({ assets, title: 'React with Flux Examples' })); }); /* eslint-disable no-console */ app.listen(port, () => { console.log(`The server is running at http://localhost:${port}/`); }); /* eslint-enable no-console */
var ParticleKinematics = "return origin + startVelocity*t + Acceleration*t*t*0.5;"; var EmitterRotation = "return EmitterRotationVelocity*t+EmitterRotationAcceleration*t*t/2;"; var SomeEmitterTrajectoryFunction = "return vec3(sin(t*5.0)*3.1-1.5, -1.0+sin(t*4.0)*2.6, sin(t*1.6+0.23)*2.5-1.0);"; var SomeEmitterRotationFunction = "return vec3(8.0,29.5,-1.0)*t*cos(t*3.0);"; var SomeColorFunction = "vec3 mainColor = mix( f3rand(vec2(floor(birthTime*4.0), 42.1)), f3rand(vec2(floor(birthTime*4.0+1.0), 58.3)), fract(birthTime*4.0) )*8.0;\ vec3 startColor = f3rand(vec2(birthTime, 342.1))*0.03;\ vec3 finalColor = f3rand(vec2(birthTime, 39.6));\ return vec4( mix(startColor, finalColor, factor)*mainColor, (1.0-factor)*(1.0-factor) );"; var SomeSizeFunction = "float scale = exp(mix(MinSizeOrder, MaxSizeOrder, frand(vec2(birthTime, 5.3))));\ float startSize = frand(vec2(birthTime, 85.3))*0.04*scale;\ float finalSize = frand(vec2(birthTime, 123.5))*0.1*scale;\ return mix(startSize, finalSize, pow(factor, 0.7));"; var SomeParticleTrajectoryFunction = "return origin + startVelocity*t + vec3(0.0, 0.58*t*t*0.5, 0.0);"; var SomeEmitterFunction = "float speed = mix(0.5, 3.35, frand(vec2(t, 0.0)));\ vec3 rotation = mix(vec3(-0.7,-0.3,-0.7), vec3(0.7,0.3,0.7), f3rand(vec2(t, 12.3)));\ velocity = RotationEulerMatrix(rotation)*vec3(speed, 0.0, 0.0);\ origin = (f3rand(vec2(t, 10.0))*2.0-1.0)*0.2;"; function ParticleEffectDescToShader(gl, desc) { var vertexShaderCode = desc.VertexTemplateCode .replace('${GetColor_Body}', desc.ColorFunction) .replace('${GetSize_Body}', desc.SizeFunction) .replace('${GetPosition_Body}', desc.PositionFunction) .replace('${GetEmitterPosition_Body}', desc.EmitterPositionFunction) .replace('${GetEmitterRotationAngles_Body}', desc.EmitterRotationFunction) .replace('${GetStartParameters_Body}', desc.StartParametersFunction); return CompileShaderProgram(gl, vertexShaderCode, desc.FragmentShaderCode); }
/** * THIS FILE IS AUTO-GENERATED * DON'T MAKE CHANGES HERE */ import { BigNumberDependencies } from './dependenciesBigNumberClass.generated' import { createE } from '../../factoriesAny.js' export const eDependencies = { BigNumberDependencies, createE }
var convert = require('convert-source-map') var smap = require('source-map') var jsdom = require('jsdom') var cp = require('child_process') var util = require('util') module.exports = run process.once('message', function(data) { run(data.script, data.html, function(data) { process.send(data) }) }) process.on('uncaughtException', function(err) { process.send({method: 'error', message: err.stack}) }) function run(script, html, send) { var sourcemap = convert.fromSource(script) if(sourcemap) { sourcemap = new smap.SourceMapConsumer(sourcemap.toJSON()) } jsdom.env({ html: html || ' ', src: [script], created: setup, loaded: loaded, }) function setup(err, window) { if(err) { throw err } window.Error.prepareStackTrace = prepareStackTrace var methods = ['info', 'warn', 'trace'] methods.forEach(function(method) { window.console[method] = logger(method + ':', 'log') }) window.console.log = logger('', 'log') window.console.error = logger('', 'error') function logger(prefix, method) { return function() { var args = [].slice.call(arguments) send({method: method, message: prefix + util.format.apply(util, arguments)}) } } } function loaded(errs, window) { if(errs && errs.length) { throw errs[0].data.error } } function prepareStackTrace(err, stack) { var message var getters = [ 'getTypeName', 'getFunctionName', 'getMethodName', 'getFileName', 'getLineNumber', 'getColumnNumber', 'getEvalOrigin', 'isToplevel', 'isEval', 'isNative', 'isConstructor' ] message = stack.reduce(combineIntoTrace, err) return message function combineIntoTrace(trace, frame, i) { if(!frame) return trace var names = getters.reduce(function(map, getter) { try { map[getter] = frame[getter] && frame[getter]() } catch(e) { // uh.... } return map }, {}) var original if(sourcemap && names.getLineNumber && names.getColumnNumber) { original = sourcemap.originalPositionFor({ line: names.getLineNumber, column: names.getColumnNumber }) } if(!original) { return trace + '\n at ' + frame } var location = '(' + original.source + ':' + original.line + ':' + original.column + ')' var out = trace + '\n at ' if(names.isConstructor && names.getFunctionName) { return out + 'new ' + names.getFunctionName + ' ' + location } if(names.isConstructor) { return out + 'new <anonymous> ' + location } if(names.getTypeName) { out += names.getTypeName + '.' } if(names.getFunctionName) { out += names.getFunctionName if(names.getMethodName && names.getFunctionName !== names.getMethodName) { out += ' [as ' + names.getMethodName + ']' } } else { out += names.getMethodName || '<anonymous>' } return out + ' ' + location } } }
var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { devtool: 'eval', entry: [ 'react-hot-loader/patch', 'webpack-dev-server/client?http://localhost:3000', 'webpack/hot/only-dev-server', './src/vendor', './src/index' ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js' }, plugins: [ new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin(), new HtmlWebpackPlugin({ template: 'public/index.html' }) ], module: { loaders: [{ test: /\.js$/, loader: 'babel-loader', include: path.join(__dirname, 'src') }, { test: /\.css/, loaders: ["style-loader", "css-loader"] }] } };
var should = require('should'); var root = __dirname.substring(0, __dirname.lastIndexOf('/')); var config = require(root + '/config.js'); var uuid = require('node-uuid'); var TV_ADMIN_VAULT_ID = config.TV_ADMIN_VAULT_ID; var TV_ORG_SCHEMA_ID = config.TV_ORG_SCHEMA_ID; var tvInterface = require(root + '/tvInterface.js')(config); var org_schema = require(root + '/test/sample-files/test_schema.js'); describe('Schema Methods', function() { var vaultName = "TvInterfaceTest-" + uuid.v4(); var created_vault_id; var schemaName = "TvInterfaceTest-" + uuid.v4(); var created_schema_id; before(function(done) { // runs before all tests in this block tvInterface.vaults.create(vaultName, function(error, results) { should.not.exist(error); created_vault_id = results; console.log("Created a vault for testing.") done(); }); }); after(function(done) { // runs before all tests in this block tvInterface.vaults.delete(created_vault_id, function(error, results) { should.not.exist(error); created_vault_id = results; console.log("Deleted test vault.") done(); }); }); it('schemaTests-01 - should list all schemas', function(done) { tvInterface.schemas.getAll(created_vault_id, function(error, results) { should.not.exist(error); should.exist(results); for (schema in results) { should.exist(results[schema].id); } done(); }); }); it('schemaTests-02 - should be able to create a schema', function(done) { tvInterface.schemas.create(created_vault_id, org_schema, function(error, results) { should.not.exist(error); should.exist(results); created_schema_id = results; done(); }); }); it('schemaTests-02 - should have created a schema', function(done) { tvInterface.schemas.getAll(created_vault_id, function(error, results) { should.not.exist(error); should.exist(results); var flag = false; for (schema in results) { if (created_schema_id == results[schema].id) { done(); } } flag.should.equal(true); done(); }); }); it('schemaTests-03 - should be able to handle duplicate error gracefully', function(done) { tvInterface.schemas.create(created_vault_id, org_schema, function(error, results) { should.exist(error); should.not.exist(results); done(); }); }); it('schemaTests-04 - should be able to update schema', function(done) { tvInterface.schemas.update(created_vault_id, created_schema_id, org_schema, function(error, results) { should.not.exist(error); results.should.equal(true); done(); }); }); it('schemaTests-05 - should be able to delete an empty schema', function(done) { tvInterface.schemas.delete(created_vault_id, created_schema_id, function(error, results) { should.not.exist(error); should.exist(results); done(); }); }); it('schemaTests-05 - should have deleted the schema', function(done) { tvInterface.schemas.getAll(created_vault_id, function(error, results) { should.not.exist(error); should.exist(results); var flag = false; for (schema in results) { if (created_schema_id == results[schema].id) { flag.should.equal(true); done(); } } done(); }); }); });
import React from 'react' import { connect } from 'react-redux' import { addToCart, pickupInStore, share, addToRegistry, addToList } from '../actions/ProductActions' import MobileProduct from './MobileProduct' let MobileProductContainer = ({ product, dispatch }) => { return ( <MobileProduct product={product} addToCart={addToCartCallback} pickupInStore={pickupInStoreCallback} share={shareCallback} addToRegistry={addToRegistryCallback} addToList={addToListCallback} /> ) function addToCartCallback(clickEvent) { clickEvent.preventDefault(); dispatch(addToCart(product)) } function pickupInStoreCallback(clickEvent) { clickEvent.preventDefault(); dispatch(pickupInStore(product)) } function shareCallback() { dispatch(share(product)) } function addToRegistryCallback() { dispatch(addToRegistry(product)) } function addToListCallback() { dispatch(addToList(product)) } } export default connect()(MobileProductContainer)
import splitPath from './util/splitPath' import curry from './util/curry' function is(path, predicate, object) { const parts = splitPath(path) let rest = object for (let i = 0; i < parts.length; i += 1) { if (typeof rest === 'undefined') return false const part = parts[i] rest = rest[part] } if (typeof predicate === 'function') { return predicate(rest) } return predicate === rest } export default curry(is)
// Game.js // Created by MonkeyShen 2012 // 游戏对象,单件 var cocos = require('cocos2d'); var geo = require('geometry'); var ChessRender = require('ChessRender').ChessRender; require('Util') require('AI') require('MainFrame') require('Board') Game = { chess_render : null, // 当前可以移动的正营 cur_camp : null, // 玩家身份(人类还是AI) player_red : null, player_black : null, // 是否已经结束 is_over : false, // 赢家 winner : null, // 提醒被将军的sprite red_king_sprite : null, black_king_sprite : null, // 初始化 init : function(layer) { // 初始化主界面 MainFrame.init(layer); // 初始化AI AI.init(); // 创建棋盘 Board.clear_board(); this.chess_render = ChessRender.create(); this.chess_render.set('position', new geo.Point(174, 50)); layer.addChild({child : this.chess_render}); Board.add_board_listener(this); // 创建被将军时用于提醒的sprite this.red_king_sprite = cocos.nodes.Sprite.create({ file : '/resources/jiangjun.png', }); this.black_king_sprite = cocos.nodes.Sprite.create({ file : '/resources/jiangjun.png', }); this.red_king_sprite.set('position', geo.ccp(100, 100)); this.black_king_sprite.set('position', geo.ccp(100, 500)); this.red_king_sprite.set('visible', false); this.black_king_sprite.set('visible', false); layer.addChild(this.red_king_sprite); layer.addChild(this.black_king_sprite); }, // 开始棋局,传入先手正营 start : function(first_camp) { this.cur_camp = first_camp; this.is_over = false; Board.init_board(); this.step(); }, // 停止棋局 stop : function() { this.cur_camp = null; Board.clear_board(); this.is_over = true; }, // 重新开始 restart : function() { Board.init_board(); this.step(); }, // 悔棋 regret : function() { Board.unmove_chess(); // 如果对方不是人类,也unmove一下 if (this.cur_camp == CAMP_RED && ! this.player_black.get('human')) { Board.unmove_chess(); } else if (this.cur_camp == CAMP_BLACK && ! this.player_red.get('human')) { Board.unmove_chess(); } else { this.step(); } }, // 玩家是否已设定 is_player_seted : function() { console.log(this.player_red, this.player_black); return this.player_red != null && this.player_black != null; }, // 某一方赢了 win : function(camp) { var text; if (camp == CAMP_RED) text = '红方胜利了'; else text = '黑方胜利了'; // 回调 function callback(v) { if (v == 'replay') Game.restart(); else Game.stop(); } $.prompt(text, { buttons : { 重新开始 : 'replay', 退出 : 'quit', }, callback : callback, }); }, // 移一步 step : function() { this.red_king_sprite.set('visible', false); this.black_king_sprite.set('visible', false); if (this.cur_camp == CAMP_RED) { this.player_black.stop(); this.player_red.run(); } else { this.player_red.stop(); this.player_black.run(); } }, // 设置玩家 set_player : function(camp, name, player_class) { if (camp == CAMP_RED) this.player_red = player_class.create(name, camp); else this.player_black = player_class.create(name, camp); }, // 移动棋子 move_chess : function(x, y, tx, ty, move_info) { // 移动棋子 if (Board.move_chess(x, y, tx, ty, move_info)) { // 切换阵营 this.cur_camp = -this.cur_camp; // 移动一步 setTimeout("Game.step()", 300); } }, // 检查是否被将军 check_king : function() { var move_list = MoveGenerator.create_possible_moves(-this.cur_camp); var king = R_KING * this.cur_camp; for (var i = 0; i < move_list.length; ++i) { var move = move_list[i]; var tc = MoveGenerator.get_chess(move.tx, move.ty); if (tc == king) { if (this.cur_camp == CAMP_RED) this.red_king_sprite.set('visible', true); else this.black_king_sprite.set('visible', true); } } }, // 监听:棋子被杀掉 on_chess_killed: function(chess) { if (chess.name == 'R_KING') this.win(CAMP_BLACK); else if (chess.name == 'B_KING') this.win(CAMP_RED); }, }
'use strict'; ( function() { CKEDITOR.htmlParser.node = function() {}; CKEDITOR.htmlParser.node.prototype = { remove: function() { var children = this.parent.children, index = CKEDITOR.tools.indexOf( children, this ), previous = this.previous, next = this.next; previous && ( previous.next = next ); next && ( next.previous = previous ); children.splice( index, 1 ); this.parent = null; }, replaceWith: function( node ) { var children = this.parent.children, index = CKEDITOR.tools.indexOf( children, this ), previous = node.previous = this.previous, next = node.next = this.next; previous && ( previous.next = node ); next && ( next.previous = node ); children[ index ] = node; node.parent = this.parent; this.parent = null; }, insertAfter: function( node ) { var children = node.parent.children, index = CKEDITOR.tools.indexOf( children, node ), next = node.next; children.splice( index + 1, 0, this ); this.next = node.next; this.previous = node; node.next = this; next && ( next.previous = this ); this.parent = node.parent; }, insertBefore: function( node ) { var children = node.parent.children, index = CKEDITOR.tools.indexOf( children, node ); children.splice( index, 0, this ); this.next = node; this.previous = node.previous; node.previous && ( node.previous.next = this ); node.previous = this; this.parent = node.parent; }, getAscendant: function( condition ) { var checkFn = typeof condition == 'function' ? condition : typeof condition == 'string' ? function( el ) { return el.name == condition; } : function( el ) { return el.name in condition; }; var parent = this.parent; // Parent has to be an element - don't check doc fragment. while ( parent && parent.type == CKEDITOR.NODE_ELEMENT ) { if ( checkFn( parent ) ) return parent; parent = parent.parent; } return null; }, wrapWith: function( wrapper ) { this.replaceWith( wrapper ); wrapper.add( this ); return wrapper; }, getIndex: function() { return CKEDITOR.tools.indexOf( this.parent.children, this ); }, getFilterContext: function( context ) { return context || {}; } }; } )();
"use strict"; let datafire = require('datafire'); let openapi = require('./openapi.json'); module.exports = datafire.Integration.fromOpenAPI(openapi, "google_cloudmonitoring");
import React, { PropTypes, Component } from 'react'; import { Link } from 'react-router'; class NotSignedIn extends Component { render() { return ( <ul className='menu'> <li><Link to='/sign-in'>Sign In</Link></li> <li><Link to='/sign-up' className='button'>Sign Up</Link></li> </ul> ); } } NotSignedIn.propTypes = { }; export default NotSignedIn;
/* LIB */ const radial = require('../../radial'); const authenticate = require('./authenticate'); /* MODULES */ const xmlConvert = require('xml-js'); /* CONSTRUCTOR */ (function () { var PaymentSettlementStatus = {}; /* PRIVATE VARIABLES */ /* PUBLIC VARIABLES */ /* PUBLIC FUNCTIONS */ PaymentSettlementStatus.parse = function (req, fn) { authenticate('paymentSettlementStatus', req, function (err) { if (err) { return fn({ status: 403, type: 'Authentication Failed', message: err.message }); } var body = req.body; var reply = body.paymentsettlementstatuslist; if (!reply) { return fn({ status: 400, type: 'Invalid Parameters', message: 'The message body for this endpoint seems to be empty' }); } var list = reply.paymentsettlementstatus; var replyList = []; list.forEach(function (item) { var reply = {}; reply.storeId = item.storeid[0]; reply.paymentContext = { orderId: item.paymentcontextbase ? item.paymentcontextbase[0].orderid[0] : item.paymentcontext[0].orderid[0], }; if (item.paymentcontext && item.paymentcontext.paymentaccountuniqueid) { reply.paymentContext.paymentAccountUniqueId = item.paymentcontext.paymentaccountuniqueid[0]._; reply.paymentContext.paymentAccountUniqueIdIsToken = item.paymentcontext.paymentaccountuniqueid[0].$.isToken; } reply.tenderType = item.tendertype[0]; reply.amount = parseFloat(item.amount[0]._); reply.currencyCode = item.amount[0].$.currencyCode; reply.settlementType = item.settlementtype[0]; reply.settlementStatus = item.settlementstatus[0]; if (item.declinereason) { reply.declineReason = item.declinereason[0]; } replyList.push(reply); }); return fn(null, replyList); }); }; /* NPM EXPORT */ if (typeof module === 'object' && module.exports) { module.exports = PaymentSettlementStatus.parse; } else { throw new Error('This module only works with NPM in NodeJS environments.'); } }());
'use strict'; (function (angular) { angular .module('magentoEcommerceWidget', ['ngRoute']) .config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/', { templateUrl: 'templates/home.html', controllerAs: 'WidgetHome', controller: 'WidgetHomeCtrl', }) .otherwise('/'); }]) })(window.angular);
module.exports = { entry: "./app.js", cache: false, output: { path: __dirname, filename: "bundle.js" }, module: { loaders: [ {test: /\.ejs$/, loader: require.resolve("../") + "?htmlmin"} ] }, 'ejs-compiled-loader': { 'htmlminOptions': { removeComments: true } } }
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _react = require('react'); var _react2 = _interopRequireDefault(_react); var Week = _react2['default'].createClass({ displayName: 'Week', render: function render() { return _react2['default'].createElement( 'tr', { className: 'Week' }, this.props.children ); } }); exports['default'] = Week; module.exports = exports['default'];
import loading from './loading' import formErrors from './form-errors' import currentUser from './current-user' import games from './games' import currentGame from './currentGame' module.exports = { formErrors, loading, currentUser, games, currentGame, }
import { combineReducers } from 'redux'; import { reducer as datagridReducer } from '../src'; export default combineReducers({ datagrid: datagridReducer, });
var debug = require('debug')('district') var quote = require('quotemeta') var findup = require('findup') var mkdirp = require('mkdirp') var once = require('once') var uniq = require('uniq') var path = require('path') var fs = require('fs') module.exports = district function district(namespace, linked, dirname, opts, done) { if (typeof opts === 'function') { done = opts opts = {} } linked = uniq(Array.isArray(linked) ? linked : [linked]) dirname = path.resolve(dirname) done = once(done) opts = opts || {} var prefix = opts.prefix && new RegExp('^' + quote( String(opts.prefix) || '' ) + '\\-?', 'g') var dup = getDuplicate(linked.map(function (d) { return path.basename(d) })) if (dup) { throw new Error('Duplicate package name: ' + dup) } findup(dirname, 'package.json', function(err, root) { if (err) return done(err) var node_modules = path.join( root = path.resolve(root || dirname) , 'node_modules', '@' + namespace) mkdirp(node_modules, function(err) { if (err) return done(err) doLink(node_modules) }) }) function doLink(node_modules) { var n = 0 linked.forEach(function(dir) { var name = path.basename(dir) var suff = prefix ? name.replace(prefix, '') : name var dest = path.join(node_modules, suff) var rel = path.relative(node_modules, dir) fs.lstat(dest, function(err, stat) { if (err && err.code !== 'ENOENT') return done(err) if (err) return link() if (!stat.isSymbolicLink()) return done(new Error( 'Module "'+name+'" cannot be linked into '+node_modules + ': something else already exists there' )) fs.unlink(dest, link) }) function link(err) { if (err) return done(err) fs.symlink(rel, dest, 'junction', bump) } function bump(err) { if (err) return done(err) debug('Linked ' + name + ' into ./' + path.relative(process.cwd(), dest)) if (++n === linked.length) return done() } }) } } function getDuplicate(arr) { for (var x = 0; x < arr.length; x++) for (var y = 0; y < arr.length; y++) { if (x === y) continue if (arr[x] === arr[y]) return arr[x] } return false }
/** * @author mrdoob / http://mrdoob.com/ */ THREE.MaterialLoader = function ( manager ) { this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; this.textures = {}; }; THREE.MaterialLoader.prototype = { constructor: THREE.MaterialLoader, load: function ( url, onLoad, onProgress, onError ) { var scope = this; var loader = new THREE.XHRLoader( scope.manager ); loader.load( url, function ( text ) { onLoad( scope.parse( JSON.parse( text ) ) ); }, onProgress, onError ); }, setTextures: function ( value ) { this.textures = value; }, getTexture: function ( name ) { var textures = this.textures; if ( textures[ name ] === undefined ) { console.warn( 'THREE.MaterialLoader: Undefined texture', name ); } return textures[ name ]; }, parse: function ( json ) { var material = new THREE[ json.type ]; if ( json.uuid !== undefined ) material.uuid = json.uuid; if ( json.name !== undefined ) material.name = json.name; if ( json.color !== undefined ) material.color.setHex( json.color ); if ( json.roughness !== undefined ) material.roughness = json.roughness; if ( json.metalness !== undefined ) material.metalness = json.metalness; if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive ); if ( json.specular !== undefined ) material.specular.setHex( json.specular ); if ( json.shininess !== undefined ) material.shininess = json.shininess; if ( json.uniforms !== undefined ) material.uniforms = json.uniforms; if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader; if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader; if ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors; if ( json.shading !== undefined ) material.shading = json.shading; if ( json.blending !== undefined ) material.blending = json.blending; if ( json.side !== undefined ) material.side = json.side; if ( json.opacity !== undefined ) material.opacity = json.opacity; if ( json.transparent !== undefined ) material.transparent = json.transparent; if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest; if ( json.depthTest !== undefined ) material.depthTest = json.depthTest; if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite; if ( json.stencilTest !== undefined ) material.stencilTest = json.stencilTest; if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite; if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite; if ( json.wireframe !== undefined ) material.wireframe = json.wireframe; if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth; // for PointsMaterial if ( json.size !== undefined ) material.size = json.size; if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation; // maps if ( json.map !== undefined ) material.map = this.getTexture( json.map ); if ( json.alphaMap !== undefined ) { material.alphaMap = this.getTexture( json.alphaMap ); material.transparent = true; } if ( json.bumpMap !== undefined ) material.bumpMap = this.getTexture( json.bumpMap ); if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale; if ( json.normalMap !== undefined ) material.normalMap = this.getTexture( json.normalMap ); if ( json.normalScale !== undefined ) { var normalScale = json.normalScale; if ( Array.isArray( normalScale ) === false ) { // Blender exporter used to export a scalar. See #7459 normalScale = [ normalScale, normalScale ]; } material.normalScale = new THREE.Vector2().fromArray( normalScale ); } if ( json.displacementMap !== undefined ) material.displacementMap = this.getTexture( json.displacementMap ); if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale; if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias; if ( json.roughnessMap !== undefined ) material.roughnessMap = this.getTexture( json.roughnessMap ); if ( json.metalnessMap !== undefined ) material.metalnessMap = this.getTexture( json.metalnessMap ); if ( json.emissiveMap !== undefined ) material.emissiveMap = this.getTexture( json.emissiveMap ); if ( json.emissiveMapIntensity !== undefined ) material.emissiveMapIntensity = json.emissiveMapIntensity; if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap ); if ( json.envMap !== undefined ) { material.envMap = this.getTexture( json.envMap ); material.combine = THREE.MultiplyOperation; } if ( json.reflectivity ) material.reflectivity = json.reflectivity; if ( json.lightMap !== undefined ) material.lightMap = this.getTexture( json.lightMap ); if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity; if ( json.aoMap !== undefined ) material.aoMap = this.getTexture( json.aoMap ); if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity; // MeshFaceMaterial if ( json.materials !== undefined ) { for ( var i = 0, l = json.materials.length; i < l; i ++ ) { material.materials.push( this.parse( json.materials[ i ] ) ); } } return material; } };
/** * Copyright 2013 Facebook, Inc. * * 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. * * @providesModule hasArrayNature */ /** * Perform a heuristic test to determine if an object is "array-like". * * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" * Joshu replied: "Mu." * * This function determines if its argument has "array nature": it returns * true if the argument is an actual array, an `arguments' object, or an * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). * * @param obj An object to test. * @return bool True if the object is array-like. */ function hasArrayNature(obj) { return ( // not null/false !!obj && // arrays are objects, NodeLists are functions in Safari (typeof obj == 'object' || typeof obj == 'function') && // quacks like an array ('length' in obj) && // not window !('setInterval' in obj) && // no DOM node should be considered an array-like // a 'select' element has 'length' and 'item' properties (typeof obj.nodeType != 'number') && ( // a real array (Array.isArray(obj) || // arguments ('callee' in obj) || // HTMLCollection/NodeList 'item' in obj) ) ); } module.exports = hasArrayNature;
import expect from 'expect.js'; import responseHandler from '../../src/helper/response-handler'; describe('helpers responseHandler', function() { it('should return default error', function(done) { responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ error: 'generic_error', errorDescription: 'Something went wrong' }); done(); })(null, null); }); it('should return normalized format 1', function(done) { var assert_err = {}; assert_err.response = {}; assert_err.response.statusCode = 400; assert_err.response.statusText = 'Bad request'; assert_err.response.body = { error: 'the_error_code', policy: 'the policy', error_description: 'The error description.', name: 'SomeName' }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, statusCode: 400, statusText: 'Bad request', code: 'the_error_code', policy: 'the policy', description: 'The error description.', name: 'SomeName' }); done(); })(assert_err, null); }); it('should return normalized format 2', function(done) { var assert_err = {}; assert_err.response = {}; assert_err.response.body = { code: 'the_error_code', description: 'The error description.' }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: 'the_error_code', description: 'The error description.' }); done(); })(assert_err, null); }); it('should return normalized format 3', function(done) { var assert_err = {}; assert_err.response = {}; assert_err.response.body = {}; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: null, description: null }); done(); })(assert_err, null); }); it('should return normalized format 4', function(done) { var assert_err = {}; assert_err.response = {}; assert_err.response.body = { error_code: 'the_error_code', error_description: 'The error description.' }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: 'the_error_code', description: 'The error description.' }); done(); })(assert_err, null); }); it('should return normalized format 4', function(done) { var assert_err = {}; assert_err.err = {}; assert_err.err = { status: 'the_error_code', err: 'The error description.' }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: 'the_error_code', description: 'The error description.' }); done(); })(assert_err, null); }); it('should return normalized format 5 (error comes from data)', function(done) { var assert_err = { error: 'the_error_code', errorDescription: 'The error description.' }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: 'the_error_code', description: 'The error description.' }); done(); })(null, assert_err); }); it('should return normalized format 6', function(done) { var assert_err = {}; assert_err.response = {}; assert_err.response.body = { code: 'the_error_code', error: 'The error description.' }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: 'the_error_code', description: 'The error description.' }); done(); })(assert_err, null); }); it('should return normalized error codes and details', function(done) { var assert_err = {}; assert_err.response = {}; assert_err.response.body = { code: 'blocked_user', error: 'Blocked user.', error_codes: ['reason-1', 'reason-2'], error_details: { 'reason-1': { timestamp: 123 }, 'reason-2': { timestamp: 456 } } }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: assert_err, code: 'blocked_user', description: 'Blocked user.', errorDetails: { codes: ['reason-1', 'reason-2'], details: { 'reason-1': { timestamp: 123 }, 'reason-2': { timestamp: 456 } } } }); done(); })(assert_err, null); }); it('should return the data', function(done) { var assert_data = { body: { attr1: 'attribute 1', attr2: 'attribute 2' } }; responseHandler(function(err, data) { expect(err).to.be(null); expect(data).to.eql({ attr1: 'attribute 1', attr2: 'attribute 2' }); done(); })(null, assert_data); }); it('should return the data 2', function(done) { var assert_data = { text: 'The response message', type: 'text/html' }; responseHandler(function(err, data) { expect(err).to.be(null); expect(data).to.eql('The response message'); done(); })(null, assert_data); }); it('should return the data respecting the `keepOriginalCasing` option', function(done) { var assert_data = { body: { the_attr: 'attr' } }; responseHandler( function(err, data) { expect(err).to.be(null); expect(data).to.eql({ the_attr: 'attr', theAttr: 'attr' }); done(); }, { keepOriginalCasing: true } )(null, assert_data); }); it('should mask the password object in the original response object', function(done) { var assert_err = { code: 'the_error_code', error: 'The error description.', response: { req: { _data: { realm: 'realm', client_id: 'client_id', username: 'username', password: 'this is a password' } } } }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: { code: 'the_error_code', error: 'The error description.', response: { req: { _data: { realm: 'realm', client_id: 'client_id', username: 'username', password: '*****' } } } }, code: 'the_error_code', description: 'The error description.' }); done(); })(assert_err, null); }); it('should mask the password object in the data object', function(done) { var assert_err = { code: 'the_error_code', error: 'The error description.', response: { req: { _data: { realm: 'realm', client_id: 'client_id', username: 'username', password: 'this is a password' } } } }; responseHandler(function(err, data) { expect(data).to.be(undefined); expect(err).to.eql({ original: { code: 'the_error_code', error: 'The error description.', response: { req: { _data: { realm: 'realm', client_id: 'client_id', username: 'username', password: '*****' } } } }, code: 'the_error_code', description: 'The error description.' }); done(); })(assert_err, null); }); });
module.exports = function(grunt) { require('load-grunt-tasks')(grunt); grunt.initConfig({ compass: { dist: { options: { config: 'config.rb' } } }, imagemin: { dynamic: { files: [{ expand: true, cwd: 'assets/raw/', src: ['**/*.{png,jpg,gif}'], dest: 'assets/img/' }] } }, svgmin: { dist: { files: [{ expand: true, cwd: 'assets/raw/svg', src: ['**/*.svg'], dest: 'assets/img/svg', ext: '.svg' }] } }, watch: { php: { files: ['**/**.php'], options: { spawn: false, livereload: true } }, js: { files: ['assets/js/*.js','!assets/js/*.min.js'], tasks: ['jshint','uglify','concat'], options: { spawn: false, livereload: true } }, scss: { files: ['assets/scss/*.scss','assets/scss/**/*.scss'], tasks: ['compass'], options: { spawn: false, livereload: true } }, } }); grunt.registerTask('default', ['compass','imagemin','svgmin']); }
import request from '@/utils/request' const base_url = '/Clients/' export function getPageList(params) { return request({ url: base_url + 'GetPageList', method: 'get', params }) } export function getAccGroupList(params) { return request({ url: base_url + 'GetAccGroupList', method: 'get', params }) } export function toAccClient(data) { return request({ url: base_url + 'ToAccClient', method: 'post', data }) } export function edit(data) { return request({ url: base_url + 'Edit', method: 'post', data }) } export function del(id) { return request({ url: base_url + 'Delete', method: 'post', data: { id } }) }
/*! * mathGraphs * https://github.com/gouglhupf/mathGraphs/ * Version: 0.1-alpha * * Copyright 2015 Justus Leiner * Released under the MIT license * https://github.com/gouglhupf/mathGraphs/blob/master/LICENSE.md */ var graph = function (context, settings){ "use strict"; // Default global config which can be modivied with the 'settings' parameter var defaultConfig = this.options = { size: { width: function() { return (window.innerHeight < window.innerWidth) ? window.innerHeight-20 : window.innerWidth-20; }, height: function() { return (window.innerHeight < window.innerWidth) ? window.innerHeight-20 : window.innerWidth-20; } }, gridSettings: { range: { xM: -10, xP: 10, yM: -10, yP: 10 }, colors: { axes: "#E4EDF0", temLines: "#7f8c8d", text: "#7f8c8d" }, referenceLines: true, text: true }, toolTips: { enable: true, roundEdges: true, width: 140, fontColor: "#e3f2fd", template: "P(<x(1)>, <y(1)>)<br>f(x) = <formula>" }, fontType: "Arial", changeOnResize: true, randomColors: true, moveEnable: true, zoomEnable: true, colors: ["rgb(26, 188, 156)","rgb(46, 204, 113)","rgb(52, 152, 219)","rgb(155, 89, 182)","rgb(52, 73, 94)","rgb(22, 160, 133)","rgb(39, 174, 96)","rgb(41, 128, 185)","rgb(142, 68, 173)","rgb(44, 62, 80)","rgb(241, 196, 15)","rgb(230, 126, 34)","rgb(231, 76, 60)","rgb(243, 156, 18)","rgb(211, 84, 0)","rgb(192, 57, 43)"] }; // Defines a few handy function in the helpers class var helpers = {}; var merge = helpers.merge = function (target, source) { /* Merges two (or more) objects, giving the last one precedence */ if ( typeof target !== 'object' ) { target = {}; } for (var property in source) { if ( source.hasOwnProperty(property) ) { var sourceProperty = source[ property ]; if ( typeof sourceProperty === 'object' ) { target[ property ] = helpers.merge( target[ property ], sourceProperty ); continue; } target[ property ] = sourceProperty; } } for (var a = 2, l = arguments.length; a < l; a++) { merge(target, arguments[a]); } return target; }, getRandomArbitrary = helpers.getRandomArbitrary = function (min, max) { return Math.random() * (max - min) + min; }, complileTemplate = helpers.complileTemplate = function (tempStr) { // Gets the template as a string and converts it in an javascript functions which are then return in an array var functionsAry = [], tempParts = tempStr.split("<br>"); for (var i = 0; i < tempParts.length; i++) { var functionComp = "return '"+tempParts[i] .split("<").join("'+ dataset.") .split(">").join("+'")+"'"; functionsAry.push(new Function ("dataset", functionComp)); }; return functionsAry; }, decimalAdjust = helpers.decimalAdjust = function (type, value, exp) { // If the exp is undefined or zero... if (typeof exp === 'undefined' || +exp === 0) { return Math[type](value); } value = +value; exp = +exp; // If the value is not a number or the exp is not an integer... if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { return NaN; } // Shift value = value.toString().split('e'); value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp))); // Shift back value = value.toString().split('e'); return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)); } // Adds the decimalAdjust function to the standard math class if not already there if (!Math.round10) { Math.round10 = function(value, exp) { return decimalAdjust('round', value, exp); }; } // Adds a function to the Canvas class which can draw rectangles with rounded edges CanvasRenderingContext2D.prototype.roundRect = function(x, y, width, height, radius, fill, stroke) { if (typeof stroke == "undefined" ) { stroke = true; } if (typeof radius === "undefined") { radius = 5; } this.beginPath(); this.moveTo(x + radius, y); this.lineTo(x + width - radius, y); this.quadraticCurveTo(x + width, y, x + width, y + radius); this.lineTo(x + width, y + height - radius); this.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); this.lineTo(x + radius, y + height); this.quadraticCurveTo(x, y + height, x, y + height - radius); this.lineTo(x, y + radius); this.quadraticCurveTo(x, y, x + radius, y); this.closePath(); if (stroke) { this.stroke(); } if (fill) { this.fill(); } } // Main variables this.canvas = context.canvas; this.ctx = context; this.initialized = false; this.functions = []; this.offset = {x: 0, y: 0}; this.zoom = 0; this.options = helpers.merge(defaultConfig, settings); this.functionsComp = helpers.complileTemplate(this.options.toolTips.template); this.canvasWidth = this.canvas.width = this.options.size.width(); this.canvasHeight = this.canvas.height = this.options.size.height(); this.dynamicZoom = (this.options.gridSettings.range.xM*-1+this.options.gridSettings.range.xP+1 == this.options.gridSettings.range.yM*-1+this.options.gridSettings.range.yP+1); if(!this.dynamicZoom) console.warn("Dynamic zoom was turned off due to the fact that the scale is stretched!"); this.drawGrid = function() { // First reset the canvas this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); // All essential variables such as spacing, number of units considering the offset and so on var canvasWidth = this.canvasWidth = this.canvas.width, canvasHeight = this.canvasHeight = this.canvas.height, range = { xM: this.options.gridSettings.range.xM+this.zoom, xP: this.options.gridSettings.range.xP-this.zoom, yM: this.options.gridSettings.range.yM+this.zoom, yP: this.options.gridSettings.range.yP-this.zoom }, unitsX = range.xM*-1+range.xP+1, unitsY = range.yM*-1+range.yP+1, unitsGapX = canvasWidth / unitsX, unitsGapY = canvasHeight / unitsY, middleX = canvasWidth/2, middleY = canvasHeight/2, offsetX = this.offset.x/unitsGapX, offsetY = this.offset.y*-1/unitsGapY, titlePosX = (this.offset.x > canvasWidth/2) ? 0 : (this.offset.x*-1 > canvasWidth/2) ? canvasWidth : middleX-this.offset.x, titlePosY = (this.offset.y > canvasHeight/2) ? 0 : (this.offset.y*-1 > canvasHeight/2) ? canvasHeight : middleY-this.offset.y, increment = 1; if (this.dynamicZoom) increment = this.getIncrement(unitsX); // Saves default and restores them if already initialized if (this.initialized) this.ctx.restore(); this.ctx.save(); // Draws middel line if they should be on the canvas // Draws reference lines if (this.options.gridSettings.referenceLines) { for (var i = (this.offset.x > middleX) ? Math.floor(offsetX-range.xP) : increment; i <= range.xP+Math.floor(offsetX+0.5); i += increment) { this.drawRefLinieX(unitsGapX*i+middleX-this.offset.x); }; for (var i = (this.offset.y*-1 > middleY) ? Math.floor(offsetY-range.yP) : increment; i <= range.yP+Math.floor(offsetY+0.5); i += increment) { this.drawRefLinieY(canvasHeight-(unitsGapY*i+middleY+this.offset.y)); }; for (var i = (this.offset.x*-1 > middleX) ? Math.ceil(offsetX-range.xM) : increment*-1; i >= range.xM+Math.floor(offsetX); i -= increment) { this.drawRefLinieX(unitsGapX*i+middleX-this.offset.x); }; for (var i = (this.offset.y > middleY) ? Math.ceil(offsetY-range.yM) : increment*-1; i >= range.yM+Math.floor(offsetY); i -= increment) { this.drawRefLinieY(canvasHeight-(unitsGapY*i+middleY+this.offset.y)); }; } this.ctx.lineWidth = 2; this.ctx.strokeStyle = "#7f8c8d"; if (this.offset.y < canvasHeight/2 && this.offset.y*-1 < canvasHeight/2) { this.ctx.beginPath(); this.ctx.moveTo(0, middleY-this.offset.y); this.ctx.lineTo(canvasWidth, middleY-this.offset.y); this.ctx.stroke(); } if (this.offset.x < canvasWidth/2 && this.offset.x*-1 < canvasWidth/2) { this.ctx.beginPath(); this.ctx.moveTo(middleX-this.offset.x, 0); this.ctx.lineTo(middleX-this.offset.x, canvasHeight); this.ctx.stroke(); } // Draws the text for the units for (var i = (this.offset.x > middleX) ? Math.floor(offsetX-range.xP) : increment; i <= range.xP+Math.floor(offsetX+0.5); i += increment) { this.drawUnitX(unitsGapX*i+middleX-this.offset.x, titlePosY, i, (this.offset.y+20 < canvasHeight/2) ? -10 : 20); }; for (var i = (this.offset.y*-1 > middleY) ? Math.floor(offsetY-range.yP) : increment; i <= range.yP+Math.floor(offsetY+0.5); i += increment) { this.drawUnitY(titlePosX,canvasHeight-(unitsGapY*i+middleY+this.offset.y), i, (this.offset.x*-1+20 > canvasWidth/2) ? -10 : 10); }; for (var i = (this.offset.x*-1 > middleX) ? Math.ceil(offsetX-range.xM) : increment*-1; i >= range.xM+Math.floor(offsetX); i -= increment) { this.drawUnitX(unitsGapX*i+middleX-this.offset.x, titlePosY, i, (this.offset.y+20 < canvasHeight/2) ? -10 : 20); }; for (var i = (this.offset.y > middleY) ? Math.ceil(offsetY-range.yM) : increment*-1; i >= range.yM+Math.floor(offsetY); i -= increment) { this.drawUnitY(titlePosX,canvasHeight-(unitsGapY*i+middleY+this.offset.y), i, (this.offset.x*-1+20 > canvasWidth/2) ? -10 : 10); }; // Makes a few variables public to the script this.initialized = true; this.middleX = middleX; this.middleY = middleY; this.unitsGapX = unitsGapX; this.unitsGapY = unitsGapY; } this.getIncrement = function (units, increment) { if (typeof increment === "undefined") var increment = 1; if (units/increment > 35) increment = this.getIncrement(units, increment+1); return increment; } this.drawRefLinieX = function (x) { this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.options.gridSettings.colors.axes; this.ctx.beginPath(); this.ctx.moveTo(x, 0); this.ctx.lineTo(x, this.canvasHeight); this.ctx.stroke(); } this.drawRefLinieY = function (y) { this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.options.gridSettings.colors.axes; this.ctx.beginPath(); this.ctx.moveTo(0, y); this.ctx.lineTo(this.canvasWidth, y); this.ctx.stroke(); } // Draws the background lines, the text for the units and the "small little" lines along the X-axis this.drawUnitX = function(posX, posY, title, textOffset) { this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.options.gridSettings.colors.temLines; this.ctx.beginPath(); this.ctx.moveTo(posX, posY - 5); this.ctx.lineTo(posX, posY + 5); this.ctx.stroke(); if (this.options.gridSettings.text) { this.ctx.textAlign = "left"; this.ctx.font="14px " + this.options.fontType; this.ctx.fillStyle = this.options.gridSettings.colors.text; this.ctx.fillText(title,posX-this.ctx.measureText(title.toString()).width/2,posY + textOffset); } } // Same but along the Y-axis this.drawUnitY = function(posX, posY, title, textOffset) { this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.options.gridSettings.colors.temLines; this.ctx.beginPath(); this.ctx.moveTo(posX - 5, posY); this.ctx.lineTo(posX + 5, posY); this.ctx.stroke(); if (this.options.gridSettings.text) { this.ctx.textAlign = (textOffset < 0) ? "right" : "left"; this.ctx.font="14px " + this.options.fontType; this.ctx.fillStyle = this.options.gridSettings.colors.text; this.ctx.fillText(title,posX + textOffset,posY+5); } } // This is the heart of the script. It calculates a graph and saves the points the an array which is then returned this.funGraph = function (funcStr, color) { var xx, yy, xN, yN, previous = {x: 0, y: 0}, dx=4, points=[], middleX = this.middleX, middleY = this.middleY, iMax = Math.round((this.canvasWidth-middleX)/dx), iMin = Math.round(-middleX/dx), func = math.compile(funcStr); this.ctx.beginPath(); this.ctx.lineWidth = 2; this.ctx.strokeStyle = color; for (var i = iMin; i <= iMax; i++) { xx = dx * i; yy = this.unitsGapY * func.eval({x: xx/this.unitsGapX}); if (middleY - yy >= 0) { if (previous.y > yy && middleY - previous.y < 0) { points.push({x: middleX + previous.x, y: middleY-previous.y}); this.ctx.moveTo(middleX + previous.x - this.offset.x, middleY - previous.y - this.offset.y); } points.push({x: middleX + xx, y: middleY-yy}); this.ctx.lineTo(middleX + xx - this.offset.x,middleY-yy - this.offset.y); } else if (i != iMin && previous.y < yy && middleY - previous.y > 0) { xN = xx + dx, yN = this.unitsGapY * func.eval({x: xN/this.unitsGapX}); this.ctx.lineTo(middleX + xN - this.offset.x,middleY-yN - this.offset.y); points.push({x: middleX + xN, y: middleY - yN}); break; } previous = {x: xx, y: yy}; } this.ctx.stroke(); return { compFunction: func, points: points }; } // This function initializes a complete new canvas-space with given functions this.drawGraphs = function (graphFuncs) { this.drawGrid(); this.functions = []; var graphReturn; for(var i = 0; i < graphFuncs.length; i++) { this.functions.push({formula: graphFuncs[i]}); try { if (this.options.randomColors) { this.functions[i].color = this.options.colors[Math.round(helpers.getRandomArbitrary(0, this.options.colors.length-1))]; graphReturn = this.funGraph(graphFuncs[i],this.functions[i].color); this.functions[i].points = graphReturn.points; this.functions[i].compiled = graphReturn.compFunction; } else { this.functions[i].color = this.options.colors[i]; graphReturn = this.funGraph(graphFuncs[i],this.options.colors[i]); this.functions[i].points = graphReturn.points; this.functions[i].compiled = graphReturn.compFunction; } } catch (e) { if (typeof this.errorElem !== "undefined") { this.errorElem.innerHTML = "<p>" + e.message + "</p>"; } else { console.log(e.message); } } } } // This adds given functions to the canvas-space without removing the old ones this.addGraphs = function (graphFuncs) { if(!this.initialized) { this.drawGrid(); } var graphReturn, prevLenght = this.functions.length; for (var i = 0; i < graphFuncs.length; i++) { this.functions.push({formula: graphFuncs[i]}); } for (var i = 0; i < graphFuncs.length; i++) { try { if (this.options.randomColors) { this.functions[i+prevLenght].color = this.options.colors[Math.round(helpers.getRandomArbitrary(0, this.options.colors.length-1))]; graphReturn = this.funGraph(graphFuncs[i], this.functions[i+prevLenght].color); this.functions[i+prevLenght].points = graphReturn.points; this.functions[i+prevLenght].compiled = graphReturn.compFunction; } else { this.functions[i+prevLenght].color = this.options.colors[i+prevLenght]; graphReturn = this.funGraph(graphFuncs[i],this.options.colors[i+prevLenght]); this.functions[i+prevLenght].points = graphReturn.points; this.functions[i+prevLenght].compiled = graphReturn.compFunction; } } catch (e) { if (typeof this.errorElem !== "undefined") { this.errorElem.innerHTML = "<p>" + e.message + "</p>"; } else { console.log(e.message); } } } } // Calculate missing points this.addMissingPoints = function () { var pointsAry, pointX, pointY, xx, yy; for (var i = 0; i < this.functions.length; i++) { pointsAry = this.functions[i].points; if (pointsAry[0].x-this.offset.x > 0 && pointsAry[0].x-this.offset.x < this.canvasWidth && pointsAry[0].y-this.offset.y > 0 && pointsAry[0].y-this.offset.y < this.canvasHeight) { this.ctx.beginPath(); this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.functions[i].color; this.ctx.moveTo(pointsAry[0].x-this.offset.x,pointsAry[0].y-this.offset.y); while (pointsAry[0].x-this.offset.x > 0 && pointsAry[0].x-this.offset.x < this.canvasWidth && pointsAry[0].y-this.offset.y > 0 && pointsAry[0].y-this.offset.y < this.canvasHeight) { xx = pointsAry[0].x-this.middleX-4; yy = this.unitsGapY*this.functions[i].compiled.eval({x: xx/this.unitsGapX}); this.ctx.lineTo(this.middleX+xx-this.offset.x,this.middleY-yy-this.offset.y); pointsAry.unshift({x: this.middleX+xx, y: this.middleY-yy}); } this.ctx.stroke(); } if (pointsAry[pointsAry.length-1].x-this.offset.x > 0 && pointsAry[pointsAry.length-1].x-this.offset.x < this.canvasWidth && pointsAry[pointsAry.length-1].y-this.offset.y > 0 && pointsAry[pointsAry.length-1].y-this.offset.y < this.canvasHeight) { this.ctx.beginPath(); this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.functions[i].color; this.ctx.moveTo(pointsAry[pointsAry.length-1].x-this.offset.x,pointsAry[pointsAry.length-1].y-this.offset.y); while (pointsAry[pointsAry.length-1].x-this.offset.x > 0 && pointsAry[pointsAry.length-1].x-this.offset.x < this.canvasWidth && pointsAry[pointsAry.length-1].y-this.offset.y > 0 && pointsAry[pointsAry.length-1].y-this.offset.y < this.canvasHeight) { xx = pointsAry[pointsAry.length-1].x-this.middleX+4; yy = this.unitsGapY*this.functions[i].compiled.eval({x: xx/this.unitsGapX}); this.ctx.lineTo(this.middleX+xx-this.offset.x,this.middleY-yy-this.offset.y); pointsAry.push({x: this.middleX+xx, y: this.middleY-yy}); } this.ctx.stroke(); } } } // Updates the canvas by using the calculated points this.updateGraphs = function () { this.drawGrid(); for(var i = 0; i < this.functions.length; i++) { var pointsAry = this.functions[i].points; this.ctx.beginPath(); this.ctx.lineWidth = 2; this.ctx.strokeStyle = this.functions[i].color; this.ctx.moveTo(pointsAry[0].x-this.offset.x,pointsAry[0].y-this.offset.y); for(var i2 = 1; i2 < pointsAry.length; i2++) { this.ctx.lineTo(pointsAry[i2].x-this.offset.x,pointsAry[i2].y-this.offset.y); } this.ctx.stroke(); } } // This is called the mouse cursor moves on or in the canvas this.updateHover = function (e) { e.preventDefault(); e.stopPropagation(); var mouseX=parseInt(e.clientX-this.canvas.offsetLeft), mouseY=parseInt(e.clientY-this.canvas.offsetTop); var pointX, pointY, pointsAry; for (var i = 0; i < this.functions.length; i++) { pointsAry = this.functions[i].points; for (var i2 = 0; i2 < pointsAry.length; i2++) { pointX = pointsAry[i2].x-this.offset.x; pointY = pointsAry[i2].y-this.offset.y; if (mouseX-pointX < 12 && mouseX-pointX > -12 && (mouseY-pointY < 12 && mouseY-pointY > -12)) { var parent = this, dataset = { x: function (r) {return Math.round10((pointsAry[i2].x-parent.middleX)/parent.unitsGapX,r*-1)}, y: function (r) {return Math.round10((pointsAry[i2].y-parent.middleY)/parent.unitsGapY*-1,r*-1)}, formula: this.functions[i].formula } this.updateGraphs(); this.ctx.restore(); this.ctx.beginPath(); this.ctx.fillStyle = this.functions[i].color; this.ctx.arc(pointX,pointY,3,0,2*Math.PI); this.ctx.fill(); if (this.canvasWidth - pointX < 160) { pointX -= 160; } else { pointX += 5; } if (pointY < 90) { pointY += 5; } else { pointY -= 85; } this.ctx.shadowBlur=2; this.ctx.shadowColor="black"; this.ctx.fillStyle = this.functions[i].color; if (this.options.toolTips.roundEdges) { this.ctx.roundRect(pointX, pointY, 150, this.functionsComp.length*35+5, 5, true, false); } else { this.ctx.fillRect(pointX, pointY, 150 , this.functionsComp.length*35+5); } this.ctx.shadowBlur=0; this.ctx.fillStyle = this.options.toolTips.fontColor; this.ctx.font = "30px " + this.options.fontType; for (var i3 = 0; i3 < this.functionsComp.length; i3++) { this.ctx.fillText(this.functionsComp[i3](dataset), pointX+5, pointY+25+i3*35, 140); } this.hoverMenu = true; return; } else { if (this.hoverMenu) { this.updateGraphs(); this.hoverMenu = false; } } } } } // Called then the mouse cursor moves and the mouse button is clicked this.updateOffset = function (e, mouseState) { // Update offset if (e !== "undefined" && mouseState !== "undefined") { this.offset.x = parseInt(mouseState.mouseX - (e.clientX-this.canvas.offsetLeft)); this.offset.y = parseInt(mouseState.mouseY - (e.clientY-this.canvas.offsetTop)); } this.updateGraphs(); this.addMissingPoints(); } // Zoom... this.updateZoom = function (e) { // cross-browser wheel delta var e = window.event || e; // old IE support if (this.dynamicZoom) { // TODO this.zoom += Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); } else this.zoom += Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); if (this.options.gridSettings.range.xM+this.zoom > -1 || this.options.gridSettings.range.xP-this.zoom < 1 || this.options.gridSettings.range.yM+this.zoom > -1 || this.options.gridSettings.range.yP-this.zoom < 1) { this.zoom -= 1; return; } this.drawGrid(); var graphReturn; for(var i = 0; i < this.functions.length; i++) { graphReturn = this.funGraph(this.functions[i].formula, this.functions[i].color); this.functions[i].points = graphReturn.points; this.functions[i].compiled = graphReturn.compFunction; } this.addMissingPoints(); } // This is called then the window resizes this.resizeGraphs = function () { this.drawGrid(); var graphReturn; for(var i = 0; i < this.functions.length; i++) { graphReturn = this.funGraph(this.functions[i].formula, this.functions[i].color); this.functions[i].points = graphReturn.points; this.functions[i].compiled = graphReturn.compFunction; } this.addMissingPoints(); } // Initializes the hover and scrolling var doingResize = false, isInterval = 0, parent = this; parent.mouseState = {}; if (this.options.toolTips.enable || this.options.moveEnable) { this.canvas.addEventListener("mousemove", function (event) { if (isInterval == 0 && !doingResize) { if (parent.options.moveEnable && parent.mouseState.down) { parent.updateOffset(event, parent.mouseState); } else if (parent.options.toolTips.enable) { parent.updateHover(event); } isInterval += 1; window.setTimeout(function() { isInterval -= 1; }, 33); } }); } if (this.options.moveEnable) { this.canvas.addEventListener("mousedown", function (event) { parent.mouseState = { down: true, mouseX: parseInt(event.clientX-parent.canvas.offsetLeft) + parent.offset.x, mouseY: parseInt(event.clientY-parent.canvas.offsetTop) + parent.offset.y } parent.canvas.style.cursor = "move"; }); this.canvas.addEventListener("mouseup", function () { parent.canvas.style.cursor = "auto"; parent.mouseState.down = false; }); this.canvas.addEventListener("mouseout", function () { parent.canvas.style.cursor = "auto"; parent.mouseState.down = false; }); } if (this.options.zoomEnable) { // Firefox this.canvas.addEventListener("DOMMouseScroll", function (event) { parent.updateZoom(event); event = event || window.event; if (event.preventDefault) event.preventDefault(); event.returnValue = false; }, false); // IE9, Chrome, Safari, Opera this.canvas.addEventListener("mousewheel", function (event) { parent.updateZoom(event); event = event || window.event; if (event.preventDefault) event.preventDefault(); event.returnValue = false; }, false); this.canvas.addEventListener("mouseover", function () { //parent.disableScroll(); }, false); } if (this.options.changeOnResize) { window.onresize = function() { if (parent.canvasWidth != parent.options.size.width() || parent.canvasHeight != parent.options.size.height()) { doingResize = true; parent.canvasWidth = parent.canvas.width = parent.options.size.width(); parent.canvasHeight = parent.canvas.height = parent.options.size.height(); parent.resizeGraphs(); doingResize = false; } } } return this; };
let src = [ 'let src = [', '];', 'console.log(src[0]);', 'for (var i = 0; i < src.length - 1; i++) console.log(` \'${src[i]}\',`);', 'console.log(` \'${src[src.length - 1]}\'`);', 'for (var i = 1; i < src.length; i++) console.log(src[i]);' ]; console.log(src[0]); for (var i = 0; i < src.length - 1; i++) console.log(` '${src[i]}',`); console.log(` '${src[src.length - 1]}'`); for (var i = 1; i < src.length; i++) console.log(src[i]);
QUnit.module( "Backbone.Relation options", { setup: require('./setup/data') } ); QUnit.test( "`includeInJSON` (Person to JSON)", function() { var json = person1.toJSON(); equal( json.user_id, 'user-1', "The value of 'user_id' is the user's id (not an object, since 'includeInJSON' is set to the idAttribute)" ); ok ( json.likesALot instanceof Object, "The value of 'likesALot' is an object ('includeInJSON' is 'true')" ); equal( json.likesALot.likesALot, 'person-1', "Person is serialized only once" ); json = person1.get( 'user' ).toJSON(); equal( json.person, 'boy', "The value of 'person' is the person's name (`includeInJSON` is set to 'name')" ); json = person2.toJSON(); ok( person2.get('livesIn') instanceof House, "'person2' has a 'livesIn' relation" ); equal( json.livesIn, undefined , "The value of 'livesIn' is not serialized (`includeInJSON` is 'false')" ); json = person3.toJSON(); ok( json.user_id === null, "The value of 'user_id' is null"); ok( json.likesALot === null, "The value of 'likesALot' is null"); }); QUnit.test( "`includeInJSON` (Zoo to JSON)", function() { var zoo = new Zoo({ id: 0, name: 'Artis', city: 'Amsterdam', animals: [ new Animal( { id: 1, species: 'bear', name: 'Baloo' } ), new Animal( { id: 2, species: 'tiger', name: 'Shere Khan' } ) ] }); var jsonZoo = zoo.toJSON(), jsonBear = jsonZoo.animals[ 0 ]; ok( _.isArray( jsonZoo.animals ), "animals is an Array" ); equal( jsonZoo.animals.length, 2 ); equal( jsonBear.id, 1, "animal's id has been included in the JSON" ); equal( jsonBear.species, 'bear', "animal's species has been included in the JSON" ); ok( !jsonBear.name, "animal's name has not been included in the JSON" ); var tiger = zoo.get( 'animals' ).get( 1 ), jsonTiger = tiger.toJSON(); ok( _.isObject( jsonTiger.livesIn ) && !_.isArray( jsonTiger.livesIn ), "zoo is an Object" ); equal( jsonTiger.livesIn.id, 0, "zoo.id is included in the JSON" ); equal( jsonTiger.livesIn.name, 'Artis', "zoo.name is included in the JSON" ); ok( !jsonTiger.livesIn.city, "zoo.city is not included in the JSON" ); }); QUnit.test( "'createModels' is false", function() { var NewUser = Backbone.RelationalModel.extend({}); var NewPerson = Backbone.RelationalModel.extend({ relations: [{ type: Backbone.HasOne, key: 'user', relatedModel: NewUser, createModels: false }] }); var person = new NewPerson({ id: 'newperson-1', resource_uri: 'newperson-1', user: { id: 'newuser-1', resource_uri: 'newuser-1' } }); ok( person.get( 'user' ) == null ); var user = new NewUser( { id: 'newuser-1', name: 'SuperUser' } ); ok( person.get( 'user' ) === user ); // Old data gets overwritten by the explicitly created user, since a model was never created from the old data ok( person.get( 'user' ).get( 'resource_uri' ) == null ); }); QUnit.test( "Relations load from both `keySource` and `key`", function() { var Property = Backbone.RelationalModel.extend({ idAttribute: 'property_id' }); var View = Backbone.RelationalModel.extend({ idAttribute: 'id', relations: [{ type: Backbone.HasMany, key: 'properties', keySource: 'property_ids', relatedModel: Property, reverseRelation: { key: 'view', keySource: 'view_id' } }] }); var property1 = new Property({ property_id: 1, key: 'width', value: 500, view_id: 5 }); var view = new View({ id: 5, property_ids: [ 2 ] }); var property2 = new Property({ property_id: 2, key: 'height', value: 400 }); // The values from view.property_ids should be loaded into view.properties ok( view.get( 'properties' ) && view.get( 'properties' ).length === 2, "'view' has two 'properties'" ); ok( typeof view.get( 'property_ids' ) === 'undefined', "'view' does not have 'property_ids'" ); view.set( 'properties', [ property1, property2 ] ); ok( view.get( 'properties' ) && view.get( 'properties' ).length === 2, "'view' has two 'properties'" ); view.set( 'property_ids', [ 1, 2 ] ); ok( view.get( 'properties' ) && view.get( 'properties' ).length === 2, "'view' has two 'properties'" ); }); QUnit.test( "`keySource` is emptied after a set, doesn't get confused by `unset`", function() { var SubModel = Backbone.RelationalModel.extend(); var Model = Backbone.RelationalModel.extend({ relations: [{ type: Backbone.HasOne, key: 'submodel', keySource: 'sub_data', relatedModel: SubModel }] }); var inst = new Model( {'id': 123} ); // `set` may be called from fetch inst.set({ 'id': 123, 'some_field': 'some_value', 'sub_data': { 'id': 321, 'key': 'value' }, 'to_unset': 'unset value' }); ok( inst.get('submodel').get('key') === 'value', "value of submodule.key should be 'value'" ); inst.set( { 'to_unset': '' }, { 'unset': true } ); ok( inst.get('submodel').get('key') === 'value', "after unset value of submodule.key should be still 'value'" ); ok( typeof inst.get('sub_data') === 'undefined', "keySource field should be removed from model" ); ok( typeof inst.get('submodel') !== 'undefined', "key field should be added..." ); ok( inst.get('submodel') instanceof SubModel, "... and should be model instance" ); // set called from fetch inst.set({ 'sub_data': { 'id': 321, 'key': 'value2' } }); ok( typeof inst.get('sub_data') === 'undefined', "keySource field should be removed from model" ); ok( typeof inst.get('submodel') !== 'undefined', "key field should be present..." ); ok( inst.get('submodel').get('key') === 'value2', "... and should be updated" ); }); QUnit.test( "'keyDestination' saves to 'key'", function() { var Property = Backbone.RelationalModel.extend({ idAttribute: 'property_id' }); var View = Backbone.RelationalModel.extend({ idAttribute: 'id', relations: [{ type: Backbone.HasMany, key: 'properties', keyDestination: 'properties_attributes', relatedModel: Property, reverseRelation: { key: 'view', keyDestination: 'view_attributes', includeInJSON: true } }] }); var property1 = new Property({ property_id: 1, key: 'width', value: 500, view: 5 }); var view = new View({ id: 5, properties: [ 2 ] }); var property2 = new Property({ property_id: 2, key: 'height', value: 400 }); var viewJSON = view.toJSON(); ok( viewJSON.properties_attributes && viewJSON.properties_attributes.length === 2, "'viewJSON' has two 'properties_attributes'" ); ok( typeof viewJSON.properties === 'undefined', "'viewJSON' does not have 'properties'" ); }); QUnit.test( "'collectionOptions' sets the options on the created HasMany Collections", function() { var shop = new Shop({ id: 1 }); equal( shop.get( 'customers' ).url, 'shop/' + shop.id + '/customers/' ); }); QUnit.test( "`parse` with deeply nested relations", function() { var collParseCalled = 0, modelParseCalled = 0; var Job = Backbone.RelationalModel.extend({}); var JobCollection = Backbone.Collection.extend({ model: Job, parse: function( resp, options ) { collParseCalled++; return resp.data || resp; } }); var Company = Backbone.RelationalModel.extend({ relations: [{ type: 'HasMany', key: 'employees', parse: true, relatedModel: Job, collectionType: JobCollection, reverseRelation: { key: 'company' } }] }); var Person = Backbone.RelationalModel.extend({ relations: [{ type: 'HasMany', key: 'jobs', parse: true, relatedModel: Job, collectionType: JobCollection, reverseRelation: { key: 'person', parse: false } }], parse: function( resp, options ) { modelParseCalled++; var data = _.clone( resp.model ); data.id = data.id.uri; return data; } }); Company.prototype.parse = Job.prototype.parse = function( resp, options ) { modelParseCalled++; var data = _.clone( resp.model ); data.id = data.id.uri; return data; }; var data = { model: { id: { uri: 'c1' }, employees: [ { model: { id: { uri: 'e1' }, person: { /*model: { id: { uri: 'p1' }, jobs: [ 'e1', { model: { id: { uri: 'e3' } } } ] }*/ id: 'p1', jobs: [ 'e1', { model: { id: { uri: 'e3' } } } ] } } }, { model: { id: { uri: 'e2' }, person: { id: 'p2' /*model: { id: { uri: 'p2' } }*/ } } } ] } }; var company = new Company( data, { parse: true } ), employees = company.get( 'employees' ), job = employees.first(), person = job.get( 'person' ); ok( job && job.id === 'e1', 'job exists' ); ok( person && person.id === 'p1', 'person exists' ); ok( modelParseCalled === 4, 'model.parse called 4 times? ' + modelParseCalled ); ok( collParseCalled === 0, 'coll.parse called 0 times? ' + collParseCalled ); }); QUnit.module( "Backbone.Relation preconditions", { setup: require('./setup/setup').reset } ); QUnit.test( "'type', 'key', 'relatedModel' are required properties", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { key: 'listProperties', relatedModel: Properties } ] }); var view = new View(); ok( _.size( view._relations ) === 0 ); ok( view.getRelations().length === 0 ); View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, relatedModel: Properties } ] }); view = new View(); ok( _.size( view._relations ) === 0 ); View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'parentView' } ] }); view = new View(); ok( _.size( view._relations ) === 1 ); ok( view.getRelation( 'parentView' ).relatedModel === View, "No 'relatedModel' makes it self-referential" ); }); QUnit.test( "'type' can be a string or an object reference", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { type: 'Backbone.HasOne', key: 'listProperties', relatedModel: Properties } ] }); var view = new View(); ok( _.size( view._relations ) === 1 ); View = Backbone.RelationalModel.extend({ relations: [ { type: 'HasOne', key: 'listProperties', relatedModel: Properties } ] }); view = new View(); ok( _.size( view._relations ) === 1 ); View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'listProperties', relatedModel: Properties } ] }); view = new View(); ok( _.size( view._relations ) === 1 ); }); QUnit.test( "'key' can be a string or an object reference", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'listProperties', relatedModel: Properties } ] }); var view = new View(); ok( _.size( view._relations ) === 1 ); View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'listProperties', relatedModel: Properties } ] }); view = new View(); ok( _.size( view._relations ) === 1 ); }); QUnit.test( "HasMany with a reverseRelation HasMany is not allowed", function() { var User = Backbone.RelationalModel.extend({}); var Password = Backbone.RelationalModel.extend({ relations: [{ type: 'HasMany', key: 'users', relatedModel: User, reverseRelation: { type: 'HasMany', key: 'passwords' } }] }); var password = new Password({ plaintext: 'qwerty', users: [ 'person-1', 'person-2', 'person-3' ] }); ok( _.size( password._relations ) === 0, "No _relations created on Password" ); }); QUnit.test( "Duplicate relations not allowed (two simple relations)", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'properties', relatedModel: Properties }, { type: Backbone.HasOne, key: 'properties', relatedModel: Properties } ] }); var view = new View(); view.set( { properties: new Properties() } ); ok( _.size( view._relations ) === 1 ); }); QUnit.test( "Duplicate relations not allowed (one relation with a reverse relation, one without)", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'properties', relatedModel: Properties, reverseRelation: { type: Backbone.HasOne, key: 'view' } }, { type: Backbone.HasOne, key: 'properties', relatedModel: Properties } ] }); var view = new View(); view.set( { properties: new Properties() } ); ok( _.size( view._relations ) === 1 ); }); QUnit.test( "Duplicate relations not allowed (two relations with reverse relations)", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'properties', relatedModel: Properties, reverseRelation: { type: Backbone.HasOne, key: 'view' } }, { type: Backbone.HasOne, key: 'properties', relatedModel: Properties, reverseRelation: { type: Backbone.HasOne, key: 'view' } } ] }); var view = new View(); view.set( { properties: new Properties() } ); ok( _.size( view._relations ) === 1 ); }); QUnit.test( "Duplicate relations not allowed (different relations, reverse relations)", function() { var Properties = Backbone.RelationalModel.extend({}); var View = Backbone.RelationalModel.extend({ relations: [ { type: Backbone.HasOne, key: 'listProperties', relatedModel: Properties, reverseRelation: { type: Backbone.HasOne, key: 'view' } }, { type: Backbone.HasOne, key: 'windowProperties', relatedModel: Properties, reverseRelation: { type: Backbone.HasOne, key: 'view' } } ] }); var view = new View(), prop1 = new Properties( { name: 'a' } ), prop2 = new Properties( { name: 'b' } ); view.set( { listProperties: prop1, windowProperties: prop2 } ); ok( _.size( view._relations ) === 2 ); ok( _.size( prop1._relations ) === 1 ); ok( view.get( 'listProperties' ).get( 'name' ) === 'a' ); ok( view.get( 'windowProperties' ).get( 'name' ) === 'b' ); }); QUnit.module( "Backbone.Relation general", { setup: require('./setup/setup').reset } ); QUnit.test( "Only valid models (no validation failure) should be added to a relation", function() { var zoo = new Zoo(); zoo.on( 'add:animals', function( animal ) { ok( animal instanceof Animal ); }); var smallElephant = new Animal( { name: 'Jumbo', species: 'elephant', weight: 2000, livesIn: zoo } ); equal( zoo.get( 'animals' ).length, 1, "Just 1 elephant in the zoo" ); // should fail validation, so it shouldn't be added zoo.get( 'animals' ).add( { name: 'Big guy', species: 'elephant', weight: 13000 }, { validate: true } ); equal( zoo.get( 'animals' ).length, 1, "Still just 1 elephant in the zoo" ); }); QUnit.test( "Updating (retrieving) a model keeps relation consistency intact", function() { var zoo = new Zoo(); var lion = new Animal({ species: 'Lion', livesIn: zoo }); equal( zoo.get( 'animals' ).length, 1 ); lion.set({ id: 5, species: 'Lion', livesIn: zoo }); equal( zoo.get( 'animals' ).length, 1 ); zoo.set({ name: 'Dierenpark Amersfoort', animals: [ 5 ] }); equal( zoo.get( 'animals' ).length, 1 ); ok( zoo.get( 'animals' ).at( 0 ) === lion, "lion is in zoo" ); ok( lion.get( 'livesIn' ) === zoo ); var elephant = new Animal({ species: 'Elephant', livesIn: zoo }); equal( zoo.get( 'animals' ).length, 2 ); ok( elephant.get( 'livesIn' ) === zoo ); zoo.set({ id: 2 }); equal( zoo.get( 'animals' ).length, 2 ); ok( lion.get( 'livesIn' ) === zoo ); ok( elephant.get( 'livesIn' ) === zoo ); }); QUnit.test( "Setting id on objects with reverse relations updates related collection correctly", function() { var zoo1 = new Zoo(); ok( zoo1.get( 'animals' ).size() === 0, "zoo has no animals" ); var lion = new Animal( { livesIn: 2 } ); zoo1.set( 'id', 2 ); ok( lion.get( 'livesIn' ) === zoo1, "zoo1 connected to lion" ); ok( zoo1.get( 'animals' ).length === 1, "zoo1 has one Animal" ); ok( zoo1.get( 'animals' ).at( 0 ) === lion, "lion added to zoo1" ); ok( zoo1.get( 'animals' ).get( lion ) === lion, "lion can be retrieved from zoo1" ); lion.set( { id: 5, livesIn: 2 } ); ok( lion.get( 'livesIn' ) === zoo1, "zoo1 connected to lion" ); ok( zoo1.get( 'animals' ).length === 1, "zoo1 has one Animal" ); ok( zoo1.get( 'animals' ).at( 0 ) === lion, "lion added to zoo1" ); ok( zoo1.get( 'animals' ).get( lion ) === lion, "lion can be retrieved from zoo1" ); // Other way around var elephant = new Animal( { id: 6 } ), tiger = new Animal( { id: 7 } ), zoo2 = new Zoo( { animals: [ 6 ] } ); ok( elephant.get( 'livesIn' ) === zoo2, "zoo2 connected to elephant" ); ok( zoo2.get( 'animals' ).length === 1, "zoo2 has one Animal" ); ok( zoo2.get( 'animals' ).at( 0 ) === elephant, "elephant added to zoo2" ); ok( zoo2.get( 'animals' ).get( elephant ) === elephant, "elephant can be retrieved from zoo2" ); zoo2.set( { id: 5, animals: [ 6, 7 ] } ); ok( elephant.get( 'livesIn' ) === zoo2, "zoo2 connected to elephant" ); ok( tiger.get( 'livesIn' ) === zoo2, "zoo2 connected to tiger" ); ok( zoo2.get( 'animals' ).length === 2, "zoo2 has one Animal" ); ok( zoo2.get( 'animals' ).at( 0 ) === elephant, "elephant added to zoo2" ); ok( zoo2.get( 'animals' ).at( 1 ) === tiger, "tiger added to zoo2" ); ok( zoo2.get( 'animals' ).get( elephant ) === elephant, "elephant can be retrieved from zoo2" ); ok( zoo2.get( 'animals' ).get( tiger ) === tiger, "tiger can be retrieved from zoo2" ); }); QUnit.test( "Collections can be passed as attributes on creation", function() { var animals = new AnimalCollection([ { id: 1, species: 'Lion' }, { id: 2 ,species: 'Zebra' } ]); var zoo = new Zoo( { animals: animals } ); equal( zoo.get( 'animals' ), animals, "The 'animals' collection has been set as the zoo's animals" ); equal( zoo.get( 'animals' ).length, 2, "Two animals in 'zoo'" ); zoo.destroy(); var newZoo = new Zoo( { animals: animals.models } ); ok( newZoo.get( 'animals' ).length === 2, "Two animals in the 'newZoo'" ); }); QUnit.test( "Models can be passed as attributes on creation", function() { var artis = new Zoo( { name: 'Artis' } ); var animal = new Animal( { species: 'Hippo', livesIn: artis }); equal( artis.get( 'animals' ).at( 0 ), animal, "Artis has a Hippo" ); equal( animal.get( 'livesIn' ), artis, "The Hippo is in Artis" ); }); QUnit.test( "id checking handles `undefined`, `null`, `0` ids properly", function() { var parent = new Node(); var child = new Node( { parent: parent } ); ok( child.get( 'parent' ) === parent ); parent.destroy(); ok( child.get( 'parent' ) === null, child.get( 'parent' ) + ' === null' ); // It used to be the case that `randomOtherNode` became `child`s parent here, since both the `parent.id` // (which is stored as the relation's `keyContents`) and `randomOtherNode.id` were undefined. var randomOtherNode = new Node(); ok( child.get( 'parent' ) === null, child.get( 'parent' ) + ' === null' ); // Create a child with parent id=0, then create the parent child = new Node( { parent: 0 } ); ok( child.get( 'parent' ) === null, child.get( 'parent' ) + ' === null' ); parent = new Node( { id: 0 } ); ok( child.get( 'parent' ) === parent ); child.destroy(); parent.destroy(); // The other way around; create the parent with id=0, then the child parent = new Node( { id: 0 } ); equal( parent.get( 'children' ).length, 0 ); child = new Node( { parent: 0 } ); ok( child.get( 'parent' ) === parent ); }); QUnit.test( "Relations are not affected by `silent: true`", function() { var ceo = new Person( { id: 1 } ); var company = new Company( { employees: [ { id: 2 }, { id: 3 }, 4 ], ceo: 1 }, { silent: true } ), employees = company.get( 'employees' ), employee = employees.first(); ok( company.get( 'ceo' ) === ceo ); ok( employees instanceof Backbone.Collection ); equal( employees.length, 2 ); employee.set( 'company', null, { silent: true } ); equal( employees.length, 1 ); employees.add( employee, { silent: true } ); ok( employee.get( 'company' ) === company ); ceo.set( 'runs', null, { silent: true } ); ok( !company.get( 'ceo' ) ); var employee4 = new Job( { id: 4 } ); equal( employees.length, 3 ); }); QUnit.test( "Repeated model initialization and a collection should not break existing models", function () { var dataCompanyA = { id: 'company-a', name: 'Big Corp.', employees: [ { id: 'job-a' }, { id: 'job-b' } ] }; var dataCompanyB = { id: 'company-b', name: 'Small Corp.', employees: [] }; var companyA = new Company( dataCompanyA ); // Attempting to instantiate another model with the same data will throw an error throws( function() { new Company( dataCompanyA ); }, "Can only instantiate one model for a given `id` (per model type)" ); // init-ed a lead and its nested contacts are a collection ok( companyA.get('employees') instanceof Backbone.Collection, "Company's employees should be a collection" ); equal(companyA.get('employees').length, 2, 'with elements'); var CompanyCollection = Backbone.Collection.extend({ model: Company }); var companyCollection = new CompanyCollection( [ dataCompanyA, dataCompanyB ] ); // After loading a collection with models of the same type // the existing company should still have correct collections ok( companyCollection.get( dataCompanyA.id ) === companyA ); ok( companyA.get('employees') instanceof Backbone.Collection, "Company's employees should still be a collection" ); equal( companyA.get('employees').length, 2, 'with elements' ); }); QUnit.test( "Destroy removes models from (non-reverse) relations", function() { var agent = new Agent( { id: 1, customers: [ 2, 3, 4 ], address: { city: 'Utrecht' } } ); var c2 = new Customer( { id: 2 } ); var c3 = new Customer( { id: 3 } ); var c4 = new Customer( { id: 4 } ); ok( agent.get( 'customers' ).length === 3 ); c2.destroy(); ok( agent.get( 'customers' ).length === 2 ); ok( agent.get( 'customers' ).get( c3 ) === c3 ); ok( agent.get( 'customers' ).get( c4 ) === c4 ); agent.get( 'customers' ).remove( c3 ); ok( agent.get( 'customers' ).length === 1 ); ok( agent.get( 'address' ) instanceof Address ); agent.get( 'address' ).destroy(); ok( !agent.get( 'address' ) ); agent.destroy(); equal( agent.get( 'customers' ).length, 0 ); }); QUnit.test( "If keySource is used, don't remove a model that is present in the key attribute", function() { var ForumPost = Backbone.RelationalModel.extend({ // Normally would set something here, not needed for test }); var Forum = Backbone.RelationalModel.extend({ relations: [{ type: Backbone.HasMany, key: 'posts', relatedModel: ForumPost, reverseRelation: { key: 'forum', keySource: 'forum_id' } }] }); var testPost = new ForumPost({ id: 1, title: 'Hello World', forum: { id: 1, title: 'Cupcakes' } }); var testForum = Forum.findOrCreate( 1 ); notEqual( testPost.get( 'forum' ), null, "The post's forum is not null" ); equal( testPost.get( 'forum' ).get( 'title' ), "Cupcakes", "The post's forum title is Cupcakes" ); equal( testForum.get( 'title' ), "Cupcakes", "A forum of id 1 has the title cupcakes" ); var testPost2 = new ForumPost({ id: 3, title: 'Hello World', forum: { id: 2, title: 'Donuts' }, forum_id: 3 }); notEqual( testPost2.get( 'forum' ), null, "The post's forum is not null" ); equal( testPost2.get( 'forum' ).get( 'title' ), "Donuts", "The post's forum title is Donuts" ); deepEqual( testPost2.getRelation( 'forum' ).keyContents, { id: 2, title: 'Donuts' }, 'The expected forum is 2' ); equal( testPost2.getRelation( 'forum' ).keyId, null, "There's no expected forum anymore" ); var testPost3 = new ForumPost({ id: 4, title: 'Hello World', forum: null, forum_id: 3 }); equal( testPost3.get( 'forum' ), null, "The post's forum is null" ); equal( testPost3.getRelation( 'forum' ).keyId, 3, 'Forum is expected to have id=3' ); }); // GH-187 QUnit.test( "Can pass related model in constructor", function() { var A = Backbone.RelationalModel.extend(); var B = Backbone.RelationalModel.extend({ relations: [{ type: Backbone.HasOne, key: 'a', keySource: 'a_id', relatedModel: A }] }); var a1 = new A({ id: 'a1' }); var b1 = new B(); b1.set( 'a', a1 ); ok( b1.get( 'a' ) instanceof A ); ok( b1.get( 'a' ).id === 'a1' ); var a2 = new A({ id: 'a2' }); var b2 = new B({ a: a2 }); ok( b2.get( 'a' ) instanceof A ); ok( b2.get( 'a' ).id === 'a2' ); });
/// Copyright by Erik Weitnauer, 2012. /** SparseMatrix is a subclass of array. I use the Prototype chain injection method described in http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/ for it. The matrix array contains the row vectors as Vectors. This is slower than the SparseMatrix implementation based on triplets, so better use the definition in sparse_matrix.js. */ /// Constructor, takes an array of row SparseVectors as arguments. function SparseMatrix(M, N) { var arr = []; arr.M = M || 0; arr.N = N || 0; if (arr.M) for (var i=0; i<arr.M; i++) arr.push(new SparseVector(arr.N)); arr.__proto__ = SparseMatrix.prototype; return arr; } SparseMatrix.prototype = new Array; SparseMatrix.prototype.get = function(i,j) { return this[i].get(j); } SparseMatrix.prototype.Set = function(i,j,val) { this[i].el[j] = val; return this; } /// Returns the results of the vector multiplication with v as a new Vector instance. SparseMatrix.prototype.mul = function(v) { var vN = (v instanceof SparseVector) ? v.N : v.length; if (this.length > 0 && this[0].N != vN) throw "dimensions do not match, SparseMatrix-SparseVector multiplication not possible" var res = new Vector(); for (var i=0; i<this.length; i++) res.push(this[i].mul(v)); return res; }
// All material copyright ESRI, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.16/esri/copyright.txt for details. //>>built define({measures:{length:"Panjang",area:"Area",volume:"Volume",angle:"Sudut"},units:{millimeters:{singular:"milimeter",plural:"milimeter",abbr:"mm"},centimeters:{singular:"sentimeter",plural:"sentimeter",abbr:"cm"},decimeters:{singular:"desimeter",plural:"desimeter",abbr:"dm"},meters:{singular:"meter",plural:"meter",abbr:"m"},kilometers:{singular:"kilometer",plural:"kilometer",abbr:"km"},inches:{singular:"inci",plural:"inci",abbr:"in"},feet:{singular:"kaki",plural:"kaki",abbr:"kaki"},yards:{singular:"yard", plural:"yard",abbr:"yard"},miles:{singular:"mil",plural:"mil",abbr:"mi"},"nautical-miles":{singular:"mil laut",plural:"mil laut",abbr:"nm"},"us-feet":{singular:"kaki (AS)",plural:"kaki (AS)",abbr:"kaki"},"square-millimeters":{singular:"milimeter persegi",plural:"milimeter persegi",abbr:"mm\u00b2"},"square-centimeters":{singular:"sentimeter persegi",plural:"sentimeter persegi",abbr:"cm\u00b2"},"square-decimeters":{singular:"desimeter persegi",plural:"desimeter persegi",abbr:"dm\u00b2"},"square-meters":{singular:"meter persegi", plural:"meter persegi",abbr:"m\u00b2"},"square-kilometers":{singular:"kilometer persegi",plural:"kilometer persegi",abbr:"km\u00b2"},"square-inches":{singular:"inci persegi",plural:"inci persegi",abbr:"in\u00b2"},"square-feet":{singular:"kaki persegi",plural:"kaki persegi",abbr:"kaki\u00b2"},"square-yards":{singular:"yard persegi",plural:"yard persegi",abbr:"yd\u00b2"},"square-miles":{singular:"mil persegi",plural:"mil persegi",abbr:"mi\u00b2"},"square-us-feet":{singular:"kaki persegi (AS)",plural:"kaki persegi (AS)", abbr:"kaki\u00b2"},acres:{singular:"acre",plural:"acre",abbr:"acre"},ares:{singular:"are",plural:"are",abbr:"a"},hectares:{singular:"hektare",plural:"hektare",abbr:"ha"},liters:{singular:"liter",plural:"liter",abbr:"l"},"cubic-millimeters":{singular:"milimeter kubik",plural:"milimeter kubik",abbr:"mm\u00b3"},"cubic-centimeters":{singular:"sentimeter kubik",plural:"sentimeter kubik",abbr:"cm\u00b3"},"cubic-decimeters":{singular:"desimeter kubik",plural:"desimeter kubik",abbr:"dm\u00b3"},"cubic-meters":{singular:"meter kubik", plural:"meter kubik",abbr:"m\u00b3"},"cubic-kilometers":{singular:"kilometer kubik",plural:"kilometer kubik",abbr:"km\u00b3"},"cubic-inches":{singular:"inci kubik",plural:"inci kubik",abbr:"in\u00b3"},"cubic-feet":{singular:"kaki kubik",plural:"kaki kubik",abbr:"kaki\u00b3"},"cubic-yards":{singular:"yard kubik",plural:"yard kubik",abbr:"yd\u00b3"},"cubic-miles":{singular:"mil kubik",plural:"mil kubik",abbr:"mi\u00b3"},radians:{singular:"radian",plural:"radian",abbr:""},degrees:{singular:"derajat", plural:"derajat",abbr:"\u00b0"},bytes:{B:"ng_{fileSize} B_____________ny",kB:"ng_{fileSize} kB______________ny",MB:"ng_{fileSize} MB______________ny",GB:"ng_{fileSize} GB______________ny",TB:"ng_{fileSize} TB______________ny"}}});
{"country":"England","area_name":null,"longitude":-0.146927,"street":null,"town":"","average_values_graph_url":"http://www.zoopla.co.uk/dynimgs/graph/average_prices/NW1?width=400&height=212","latitude":51.5330895,"value_ranges_graph_url":"http://www.zoopla.co.uk/dynimgs/graph/price_bands/NW1?width=400&height=212","value_trend_graph_url":"http://www.zoopla.co.uk/dynimgs/graph/local_type_trends/NW1?width=400&height=212","county":"London","bounding_box":{"latitude_min":"51.518085","longitude_min":"-0.170917","longitude_max":"-0.122937","latitude_max":"51.548094"},"area_values_url":"http://www.zoopla.co.uk/home-values/london/NW1/camden-town-regents-park-marylebone-north","postcode":"NW1","home_values_graph_url":"http://www.zoopla.co.uk/dynimgs/graph/home_value/oc/NW1?width=400&height=212"}
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this notice and otherwise comply with the Use Terms. /*--- es5id: 15.4.4.18-8-4 description: > Array.prototype.forEach doesn't call callbackfn if 'length' is 0 (subclassed Array, length overridden to 0 (type conversion)) includes: [runTestCase.js] ---*/ function testcase() { foo.prototype = new Array(1, 2, 3); function foo() {} var f = new foo(); f.length = 0; var callCnt = 0; function cb(){callCnt++} var i = f.forEach(cb); if (callCnt === 0) { return true; } } runTestCase(testcase);
/** * Gestion de l'affichage du menu en mobile */ class Nav { constructor(container) { this.options = { itemsContainerOpenClass: "bab-MainNav--open", toggleIconOpenClass: "fa-bars", toggleIconCloseClass: "fa-times" }; this.container = container; this.toggleButton = this.container.querySelector(".js-nav-toggle"); this.toggleIcon = this.toggleButton.querySelector(".js-nav-toggle-icon"); this.itemsContainer = this.container.querySelector(".js-nav-items"); this.initEvents(); } /** * Au click sur le bouton, toggle le menu */ initEvents() { this.toggleButton.addEventListener("click", () => this.toggle()); } /** * Ouvre ou ferme le menu selon son état actuel */ toggle() { this.container.classList.toggle(this.options.itemsContainerOpenClass); this.toggleIcon.classList.toggle(this.options.toggleIconOpenClass); this.toggleIcon.classList.toggle(this.options.toggleIconCloseClass); } } export default Nav;
'use strict'; var glob = require('glob'); var path = require('path'); var webpack = require('webpack'); var config = { devtool: 'source-map', entry: { 'vendor': [ 'angular', 'angular-animate', 'angular-resource', 'angular-cookies', 'angular-touch', 'angular-sanitize', 'angular-ui-router', 'angular-ui-utils/ui-utils.js', 'ng-debounce/angular-debounce.js', 'ngDialog/js/ngDialog.js', 'ng-lodash/build/ng-lodash.js' ], 'krossr': 'AppModule.ts' }, output: { path: path.join(__dirname + '/public/dist'), filename: '[name].bundle-[hash].js' }, plugins: [ new webpack.optimize.CommonsChunkPlugin({ names: ['vendor'], minChunks: Infinity }) ], resolve: { modules: [ 'node_modules', 'public/lib', 'public/lib/angular-ui-router/release', 'public/modules' ], extensions: [ '.ts', '.js' ] }, module: { loaders: [ { test: /\.ts$/, exclude: /node_modules/, loader: 'ts-loader' } ] } } module.exports = config;
'use strict'; /* Controllers */ angular.module('myApp.controllers', []). controller('MyCtrl1', ['$scope', '$location', function($scope, $location) { $scope.isActive = function(viewLocation) { var active = (viewLocation === $location.path()); return active; }; }]);
'use strict'; const cryptographyController = require('./cryptography-controller'); module.exports = (fastify, options, next) => { fastify .route({ method: 'POST', url: '/encrypt', beforeHandler: fastify.auth([fastify.verifyJWTToken]), handler: (request, reply) => cryptographyController.encrypt(request, reply) }); fastify .route({ method: 'POST', url: '/decrypt', beforeHandler: fastify.auth([fastify.verifyJWTToken]), handler: (request, reply) => cryptographyController.decrypt(request, reply) }); next(); };
require("./base/ix.js"); var fs = require('fs'); var ixCfg = require('./config.js'); module.exports = function (grunt) { var hdrStr = fs.readFileSync("./base/hdr.js").toString(); fs.writeFileSync("dist/hdr.js", hdrStr.replace("DATE", IX.getTimeStrInMS())); grunt.initConfig(IX.inherit({ pkg : grunt.file.readJSON("./package.json") }, ixCfg)); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.registerTask('autotest', 'code unit test.', function() { try{ grunt.log.writeln('start autotest ...'); var testTask = require("./testcase/test.js"); testTask(); grunt.log.writeln('Autotest done.'); }catch(ex) { return false; } }); grunt.registerTask('default', ['jshint:files', 'autotest', 'concat', 'jshint:afterconcat', 'uglify']); };
import { ABC, LETTER_WIDTH, LETTER_HEIGHT } from './serift'; const STRING_LENGTH = 8; export default function convertText2Smiles(text = '', bgSymbol = '🤘', textSymbol = '💀', strLength = STRING_LENGTH) { if (!text.length) return text; function getLetter(symb, lineIndex) { let letter; const POSITION = lineIndex * LETTER_WIDTH; switch (symb) { case "'": case '"': letter = ABC.quote; break; default: letter = ABC[symb]; } if (!letter) { letter = ABC[' ']; } return letter.slice(POSITION, POSITION + (LETTER_WIDTH - 1)); } function generateLine(str, result = '', secondLine = false) { let currentResult = result; const currentString = str.slice(0, strLength); const surplusString = str.slice(strLength); for (let lineIndex = secondLine ? 1 : 0; lineIndex < LETTER_HEIGHT; lineIndex += 1) { for (let letterIndex = 0; letterIndex < currentString.length; letterIndex += 1) { const letter = currentString[letterIndex]; currentResult += getLetter(letter, lineIndex); } currentResult += `${bgSymbol}\n`; } if (surplusString.length > 0) { return generateLine(surplusString, currentResult, true); } return currentResult; } return generateLine(text.toLowerCase()).replace(/\./g, bgSymbol).replace(/\*/g, textSymbol); }
"use strict"; require('../../qunit_extensions'); var deleteSelection = require('../../../../model/transform/deleteSelection'); var containerSample = require('../../../fixtures/container_anno_sample'); var sample1 = require('../../../fixtures/sample1'); function addStructuredNode(doc) { var structuredNode = doc.create({ id: "sn1", type: "structured-node", title: "0123456789", body: "0123456789", caption: "0123456789" }); doc.get('main').show(structuredNode.id, 1); return structuredNode; } function addImage(doc) { // This node does not have any editable properties var imageNode = doc.create({ id: "img1", type: "image", src: "img1.png", previewSrc: "img1thumb.png", }); doc.get('main').show(imageNode.id, 1); return imageNode; } QUnit.module('model/transform/deleteSelection'); QUnit.test("Deleting a property selection", function(assert) { var doc = sample1(); var sel = doc.createSelection({ type: 'property', path: ['p2', 'content'], startOffset: 10, endOffset: 15 }); var args = {selection: sel}; args = deleteSelection(doc, args); assert.equal(doc.get(['p2', 'content']), 'Paragraph annotation', 'Selected text should be deleted.'); assert.equal(args.selection.start.offset, 10, 'Selection should be collapsed to the left'); }); QUnit.test("Deleting a property selection before annotation", function(assert) { var doc = sample1(); var sel = doc.createSelection({ type: 'property', path: ['p2', 'content'], startOffset: 0, endOffset: 4 }); var anno = doc.get('em1'); var oldStartOffset = anno.startOffset; var oldEndOffset = anno.endOffset; var args = {selection: sel}; deleteSelection(doc, args); assert.equal(anno.startOffset, oldStartOffset-4, 'Annotation start should be shifted left.'); assert.equal(anno.endOffset, oldEndOffset-4, 'Annotation end should be shifted left.'); }); QUnit.test("Deleting a property selection overlapping annotation start", function(assert) { var doc = sample1(); var sel = doc.createSelection({ type: 'property', path: ['p2', 'content'], startOffset: 10, endOffset: 20 }); var anno = doc.get('em1'); var args = {selection: sel}; deleteSelection(doc, args); assert.equal(anno.startOffset, 10, 'Annotation start should be shifted left.'); assert.equal(anno.endOffset, 15, 'Annotation end should be shifted left.'); }); QUnit.test("Deleting a property selection overlapping annotation end", function(assert) { var doc = sample1(); var sel = doc.createSelection({ type: 'property', path: ['p2', 'content'], startOffset: 20, endOffset: 30 }); var anno = doc.get('em1'); var args = {selection: sel}; deleteSelection(doc, args); assert.equal(anno.startOffset, 15, 'Annotation start should not change.'); assert.equal(anno.endOffset, 20, 'Annotation end should be shifted left.'); }); QUnit.test("Deleting a container selection", function(assert) { var doc = sample1(); var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['h2', 'content'], startOffset: 8, endPath: ['p2', 'content'], endOffset: 10 }); var args = {selection: sel, containerId: 'main'}; var out = deleteSelection(doc, args); var selection = out.selection; var anno = doc.get('em1'); assert.equal(doc.get(['h2', 'content']), "Section with annotation", "Remaining content of p2 should get appended to remains of h2"); assert.ok(selection.isCollapsed(), 'Selection should be collapsed afterwards.'); assert.deepEqual(selection.path, ['h2', 'content'], 'Cursor should be in h2.'); assert.equal(selection.startOffset, 8, 'Cursor should be at the end of h2s remains'); assert.deepEqual(anno.path, ['h2', 'content'], 'Annotation should have been transferred to h2.'); assert.deepEqual([anno.startOffset, anno.endOffset], [13, 23], 'Annotation should have been placed correctly.'); }); QUnit.test("Deleting all", function(assert) { var doc = sample1(); var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['h1', 'content'], startOffset: 0, endPath: ['p3', 'content'], endOffset: 11 }); var args = { selection: sel, containerId: 'main' }; var out = deleteSelection(doc, args); // there should be an empty paragraph now var container = doc.get('main'); assert.equal(container.nodes.length, 1, "There should be one empty paragraph"); var first = container.getChildAt(0); var defaultTextType = doc.getSchema().getDefaultTextType(); assert.equal(first.type, defaultTextType, "Node should be a default text node"); var path = out.selection.getPath(); var address = container.getAddress(path); assert.ok(out.selection.isCollapsed(), "Selection should be collapsed (Cursor)."); assert.ok(address.isEqual([0,0]), "Cursor should be in empty text node."); assert.equal(out.selection.start.offset, 0, "Cursor should be at first position."); }); QUnit.test("Deleting partially", function(assert) { var doc = sample1(); var structuredNode = addStructuredNode(doc); var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['h1', 'content'], startOffset: 0, endPath: [structuredNode.id, 'body'], endOffset: 5 }); var args = { selection: sel, containerId: 'main' }; var out = deleteSelection(doc, args); var container = doc.get('main'); var first = container.getChildAt(0); assert.equal(first.id, structuredNode.id, "First node should have been deleted."); assert.equal(first.title, "", "Node's title should have been deleted."); assert.equal(first.body, "56789", "Node's body should have been truncated."); // Check selection var path = out.selection.getPath(); var address = container.getAddress(path); assert.ok(out.selection.isCollapsed(), "Selection should be collapsed (Cursor)."); assert.ok(address.isEqual([0,0]), "Cursor should be in empty text node."); assert.equal(out.selection.start.offset, 0, "Cursor should be at first position."); }); QUnit.test("Deleting wrapped structured node", function(assert) { var doc = sample1(); addStructuredNode(doc); // structured node sits betweeen h1 and p1 var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['h1', 'content'], startOffset: 4, endPath: ['p1', 'content'], endOffset: 4 }); var args = { selection: sel, containerId: 'main' }; deleteSelection(doc, args); var containerNodes = doc.get(['main', 'nodes']); assert.deepEqual(containerNodes, ["h1", "h2", "p2", "h3", "p3"], 'sn and p1 should have been deleted from the container'); var h1 = doc.get('h1'); assert.notOk(doc.get('sn'), 'Structured node should have been deleted'); assert.equal(h1.content, 'Sectgraph 1', 'h1 should have been joined with the remaining contents of p1'); }); QUnit.test("Delete wrapped nodes that have no editable properties", function(assert) { var doc = sample1(); addImage(doc); // image node sits betweeen h1 and p1 var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['h1', 'content'], startOffset: 4, endPath: ['p1', 'content'], endOffset: 4 }); var args = { selection: sel, containerId: 'main' }; deleteSelection(doc, args); var containerNodes = doc.get(['main', 'nodes']); assert.deepEqual(containerNodes, ["h1", "h2", "p2", "h3", "p3"], 'sn and p1 should have been deleted from the container'); var h1 = doc.get('h1'); assert.notOk(doc.get('img1'), 'Structured node should have been deleted'); assert.equal(h1.content, 'Sectgraph 1', 'h1 should have been joined with the remaining contents of p1'); }); QUnit.test("Edge case: delete container selection spaning multiple nodes containing container annotations", function(assert) { // the annotation spans over three nodes // we start the selection within the anno in the first text node // and expand to the end of the third node var doc = containerSample(); var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['p1', 'content'], startOffset: 7, endPath: ['p3', 'content'], endOffset: 10 }); var args = { selection: sel, containerId: 'main' }; var out = deleteSelection(doc, args); var selection = out.selection; var a1 = doc.get('a1'); assert.equal(doc.get(['p1', 'content']), "0123456", "Remaining content of p1 should be truncated."); assert.ok(selection.isCollapsed(), 'Selection should be collapsed afterwards.'); assert.deepEqual(a1.endPath, ['p1', 'content'], "Container annotation should be truncated"); assert.equal(a1.endOffset, 7, "Container annotation should be truncated"); }); QUnit.test("Edge case: delete container selection with 2 fully selected paragraphs", function(assert) { // when all nodes under a container selection are covered // fully, we want to have a default text type get inserted // and the cursor at its first position var doc = containerSample(); var sel = doc.createSelection({ type: 'container', containerId: 'main', startPath: ['p2', 'content'], startOffset: 0, endPath: ['p3', 'content'], endOffset: 10 }); var args = { selection: sel, containerId: 'main' }; var out = deleteSelection(doc, args); var selection = out.selection; assert.ok(selection.isCollapsed(), 'Selection should be collapsed afterwards.'); assert.equal(selection.startOffset, 0, 'Cursor should be at first position'); var p = doc.get(selection.path[0]); assert.equal(p.type, "paragraph", 'Cursor should be in an empty paragraph'); assert.equal(p.content.length, 0, 'Paragraph should be empty.'); assert.equal(doc.get('main').getPosition(p.id), 1); });
//*------------------------------------*\ // $GULPFILE //*------------------------------------*/ // All tasks are configured in ./gulp/tasks const gulp = require('gulp'); const browserSync = require('browser-sync').create(); require('dotenv').config(); global.browserSync = browserSync; require('./gulp/tasks/browser-sync'); require('./gulp/tasks/build'); require('./gulp/tasks/clean'); require('./gulp/tasks/css'); require('./gulp/tasks/favicons'); require('./gulp/tasks/images'); require('./gulp/tasks/mysql'); require('./gulp/tasks/rev'); require('./gulp/tasks/rsync'); require('./gulp/tasks/scripts'); require('./gulp/tasks/watch'); //*------------------------------------*\ // $TASKS //*------------------------------------*/ exports.default = gulp.task('default', gulp.series('watch', done => done()));
var assert = require('assert'); var Metalsmith = require('metalsmith'); var collectionScoping = require('..'); var collections = require('metalsmith-collections'); describe('metalsmith-collection-scoping', function() { it('should remove private collections with no scope option', function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: {}, secrets: { metadata: { private: true } } })) .use(collectionScoping()) .build(function(err) { if (err) return(done(err)); var m = metalsmith.metadata(); assert.notEqual(m.articles,null); assert.notEqual(m.collections.articles,null); assert.equal(m.secrets,null); assert.equal(m.collections.secrets,null); done(); }); }); it('should remove private collections with non-private scope option', function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: {}, secrets: { metadata: { private: true } } })) .use(collectionScoping({scope: 'public'})) .build(function(err) { if (err) return(done(err)); var m = metalsmith.metadata(); assert.notEqual(m.articles,null); assert.notEqual(m.collections.articles,null); assert.equal(m.secrets,null); assert.equal(m.collections.secrets,null); done(); }); }); it('should retain private collections with private scope option', function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: {}, secrets: { metadata: { private: true } } })) .use(collectionScoping({scope: 'private'})) .build(function(err) { if (err) return(done(err)); var m = metalsmith.metadata(); assert.notEqual(m.articles,null); assert.notEqual(m.collections.articles,null); assert.notEqual(m.secrets,null); assert.notEqual(m.collections.secrets,null); done(); }); }); it("should add 'private' metadata for files in private collections", function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: {}, secrets: { metadata: { private: true } } })) .use(collectionScoping({propagate: true})) .build(function(err, files) { assert.equal(files['three.md'].private, true); assert.equal(files['four.md'].private, true); assert.equal(files['one.md'].private, undefined); assert.equal(files['five.md'].private, undefined); done(); }); }); it("should remove private files from collections for non-private scope", function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: {} })) .use(collectionScoping()) .build(function(err) { var m = metalsmith.metadata(); m.collections.articles.forEach(function(page) { assert.equal(page["private"],null); }); m.articles.forEach(function(page) { assert.equal(page["private"],null); }); assert.equal(m.collections.articles.length,1); assert.equal(m.articles.length,1); done(); }); }); it("should leave private files in collections for private scope", function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: {} })) .use(collectionScoping({scope: 'private'})) .build(function(err) { var m = metalsmith.metadata(); assert.equal(m.collections.articles.length, 2); assert.equal(m.articles.length,2); done(); }); }); it("should not remove metadata when removing private files from collections", function(done) { var metalsmith = Metalsmith('test/fixtures/basic'); metalsmith .use(collections({ articles: { metadata: { foo: 'bar' } } })) .use(collectionScoping({scope: 'private'})) .build(function(err) { var m = metalsmith.metadata(); assert.equal(m.collections.articles.metadata.foo, 'bar'); assert.equal(m.articles.metadata.foo, 'bar'); done(); }); }); });
'use strict' module.exports = function (str, loose) { return ( (loose) ? str : str.trim() ).split('\n').map( (line) => line.trim() ).join('\n') }
(function() { var https = require('https'); var qs = require('querystring'); var _ = require('underscore'); module.exports = function(options) { var defaults = { hostname: 'gateway.smstrade.de', port: 443, method: 'GET', debug: 0 }; options = _.extend(defaults, options); var api = {}; api.printOptions = function(callback) { console.log(options); }; api.sendTextMessage = function(message, callback) { message = _.extend(options, message); console.log(message); var query = qs.stringify({ key: message.api_key, to: message.to, message: message.message, route: message.route, debug: message.debug }); var request_options = { hostname: message.hostname, port: message.port, path: '/?' + query, method: message.method }; var req = https.request(request_options, function(res) { console.log("statusCode: ", res.statusCode); console.log("headers: ", res.headers); res.on('data', function(d) { //process.stdout.write(d); callback(d); }); }); req.end(); req.on('error', function(e) { console.error(e); }); }; return api; }; }).call(this);
/* global Messenger */ $(document).ready(function() { $("form").submit(function(e) { e.preventDefault(); $("form button, form textarea").prop("disabled", true); $("form button").html("<i class='fa fa-cog fa-spin'></i> Processing..."); var students = $("#students").val().split("\n"); var create_webdocs = function() { $.post("?json", { students: students.splice(0, 10).join("\n"), legacy: $("#legacy-checkbox").is(":checked"), "no-user": $("#no-user-checkbox").is(":checked") }, function(data) { $.each(data.success, function(k, v) { var item = $("<div class='yes' />"); item.text(v); $("#success-list").append(item); }); $.each(data.failure, function(k, v) { var item = $("<div class='no' />"); item.text(v); $("#failure-list").append(item); }); if (students.length) { create_webdocs(); } else { $("form").hide(); $("#finished-container").show(); } }).fail(function() { Messenger().error("An error occured while creating webdocs."); $("form").hide(); $("#finished-container").show(); }); }; create_webdocs(); }); });
module.exports = { up: function (queryInterface) { return queryInterface.bulkInsert('user_settings_profile', [ { user_id: 1, created_date: new Date(), modified_date: new Date() } ], { updateOnDuplicate: ['user_id', 'modified_date'] }).catch(function (err) { if (err && err.errors) { for (var i = 0; i < err.errors.length; i++) { console.error('× SEED ERROR', err.errors[i].type, err.errors[i].message, err.errors[i].path, err.errors[i].value); } } else if (err && err.message) { console.error('× SEED ERROR', err.message); } }); }, down: function (queryInterface) { return queryInterface.bulkDelete('user_settings_profile', null, {}); } };
/* eslint-env mocha */ /* global expect, testContext */ /* eslint-disable prefer-arrow-callback, no-unused-expressions */ import React from 'react' import {mount} from 'enzyme' import UserList from 'src/common/components/UserList' describe(testContext(__filename), function () { before(function () { const users = [ { id: 'abcd1234', name: 'Ivanna Lerntokode', handle: 'ivannalerntokode', chapter: {id: 'wxyz9876', name: 'Over the Rainbow'} }, { id: 'efgf5678', name: 'Already Lerndtokode!', handle: 'alreadylerndtokode', chapter: {id: '9876wxyz', name: 'Under the Rainbow'} } ] this.getProps = customProps => { return Object.assign({users}, customProps || {}) } }) describe('rendering', function () { it('renders all the users', function () { const props = this.getProps() const root = mount(React.createElement(UserList, props)) const userRows = root.find('TableRow') expect(userRows.length).to.equal(props.users.length) }) }) })
/* * Wegas * http://wegas.albasim.ch * * Copyright (c) 2013 School of Business and Engineering Vaud, Comem * Licensed under the MIT License */ /** * @fileoverview * @author Francois-Xavier Aeberhard <fx@red-agent.com> */ YUI.add("wegas-inputex-list", function(Y) { "use strict"; var inputEx = Y.inputEx, ListField, EditableList, PluginList; /** * Adds a method that retrieves the value of each input in the group * (unlike Y.inputEx.Group.getValue() that returns an object based on * inputs names): */ inputEx.Group.prototype.getArray = function() { var i, ret = []; for (i = 0; i < this.inputs.length; i = i + 1) { ret.push(this.inputs[i].getValue()); } return ret; }; /** * @class ListField * @constructor * @extends inputEx.Group * @param {Object} options InputEx definition object */ ListField = function(options) { ListField.superclass.constructor.call(this, options); //parentNode.insert(this.addButton.get("boundingBox").remove(), 1); this.addButton.render(this.fieldset); Y.one(this.fieldset).prepend(this.addButton.get("boundingBox")); }; Y.extend(ListField, inputEx.Group, { /** * Set the ListField classname * @param {Object} options Options object as passed to the constructor */ setOptions: function(options) { ListField.superclass.setOptions.call(this, options); this.options.className = options.className || 'inputEx-Field inputEx-ListField'; this.options.addType = options.addType; this.options.sortable = options.sortable || false; }, /** * Render the addButton */ render: function() { ListField.superclass.render.call(this); this.addButton = new Y.Wegas.Button({ label: "<span class=\"wegas-icon wegas-icon-add\"></span>" }); this.addButton.get("boundingBox").addClass("wegas-addbutton"); }, /** * */ destroy: function() { var i, length; this.addButton.destroy(); for (i = 0, length = this.inputs.length; i < length; i += 1) { this._purgeField(this.inputs[i]); } ListField.superclass.destroy.call(this); }, /** * Handle the click event on the add button */ initEvents: function() { ListField.superclass.initEvents.call(this); this.addButton.on("click", this.onAdd, this); }, renderField: function(fieldOptions) { var fieldInstance = ListField.superclass.renderField.call(this, fieldOptions); fieldInstance._handlers = []; fieldInstance._handlers.push( new Y.Wegas.Button({// // Render remove line button label: '<span class="wegas-icon wegas-icon-remove"></span>', cssClass: "wegas-removebutton", on: { click: Y.bind(this.onRemove, this, fieldInstance) } }).render(fieldInstance.divEl) ); if (this.options.sortable) { // Render move up/down buttons fieldInstance._handlers.push( new Y.Wegas.Button({ label: '<span class="wegas-icon wegas-icon-moveup"></span>', cssClass: "wegas-moveupbutton", on: { click: Y.bind(this.move, this, fieldInstance, -1) } }).render(fieldInstance.divEl) ); fieldInstance._handlers.push( new Y.Wegas.Button({ label: '<span class="wegas-icon wegas-icon-movedown"></span>', cssClass: "wegas-movedownbutton", on: { click: Y.bind(this.move, this, fieldInstance, 1) } }).render(fieldInstance.divEl) ); } return fieldInstance; }, move: function(field, direction) { var i = Y.Array.indexOf(this.inputs, field), tmp = this.inputs[i]; if (this.inputs[i + direction]) { this.inputs[i] = this.inputs[i + direction]; this.inputs[i + direction] = tmp; if (Y.one(this.inputs[i].divEl).one(".mce-tinymce")) { Y.one(this.inputs[i].divEl).swap(tmp.divEl); } else { Y.one(tmp.divEl).swap(this.inputs[i].divEl); } Y.one(tmp.divEl).setStyle("backgroundColor", "#ededed") .transition({ duration: 1, easing: 'ease-out', backgroundColor: "#FFFFFF" }); // Animate the moved node so the user can see the change this.fireUpdatedEvt(); } }, onRemove: function(field) { var i = Y.Array.indexOf(this.inputs, field), d = this.inputs[i]; d.destroy(); this.inputs.splice(i, 1); this.fireUpdatedEvt(); }, onAdd: function() { this.addField(Y.Lang.isString(this.options.addType) ? {type: this.options.addType} : this.options.addType); this.fireUpdatedEvt(); }, _purgeField: function(field) { var i; for (i = 0; i < field._handlers.length; i += 1) { if (field._handlers[i].destroy) { field._handlers[i].destroy(); } else if (field._handlers[i].detach) { field._handlers[i].detach(); } } }, /** * Override to disable */ runInteractions: function() { } }); inputEx.registerType("listfield", ListField); // Register this class as "list" type /** * @class ListField * @constructor * @extends Y.Wegas.ListField * @param {Object} options InputEx definition object */ EditableList = function(options) { EditableList.superclass.constructor.call(this, options); }; Y.extend(EditableList, ListField, { /** * Set the ListField classname * @param {Object} options Options object as passed to the constructor */ setOptions: function(options) { EditableList.superclass.setOptions.call(this, options); this.options.fields = options.fields || []; this.options.items = options.items || []; }, setValue: function(value, fireUpdatedEvent) { //EditableList.superclass.setValue.apply(this, arguments); this.clear(fireUpdatedEvent); var i; for (i = 0; i < value.length; i += 1) { this.addPluginField(value[i].fn, value[i].cfg, fireUpdatedEvent); } /* if (fireUpdatedEvent) { //this.fireUpdatedEvent(); }*/ }, /** * Handle the click event on the add button */ initEvents: function() { EditableList.superclass.initEvents.call(this); /*var ttplugin = new Y.Plugin.Tooltip;*/ this.addButton.plug(Y.Plugin.WidgetMenu, { children: this.options.items }); }, /** * Override to prevent field creation on click */ onAdd: function() { }, /** * Override to disable */ runInteractions: function() { } }); inputEx.registerType("editablelist", EditableList); // Register this class as "list" type /** * @class PluginList * @constructor * @extends Y.Wegas.EditableList * @param {Object} options InputEx definition object */ PluginList = function(options) { PluginList.superclass.constructor.call(this, options); }; Y.extend(PluginList, EditableList, { /** * Handle the click event on the add button */ initEvents: function() { PluginList.superclass.initEvents.call(this); this.addButton.menu.on("button:click", function(e) { if (e.target.get("data")) { this.addPluginField(e.target.get("data")); } }, this); }, /** * * @returns {Array} */ getValue: function() { var f = [], e; for (e = 0; e < this.inputs.length; e += 1) { f.push({ fn: this.inputs[e].options.name, cfg: this.inputs[e].getValue() }); } return f; }, /** * * @param {Object} value * @param {boolean} fireUpdatedEvent */ setValue: function(value, fireUpdatedEvent) { //EditableList.superclass.setValue.apply(this, arguments); this.clear(fireUpdatedEvent); var i; for (i = 0; i < value.length; i += 1) { this.addPluginField(value[i].fn, value[i].cfg, fireUpdatedEvent); } if (fireUpdatedEvent) { //this.fireUpdatedEvent(); } }, /** * * @param {string|function} fn * @param {Object} value */ addPluginField: function(fn, value, fireUpdatedEvent) { Y.Wegas.use({type: fn}, Y.bind(function() { //load required modules var cfg, targetPlg = Y.Plugin[fn], w = new Y.Wegas.Text(); // Use this hack to retrieve a plugin config w.plug(targetPlg); cfg = w[targetPlg.NS].getFormCfg(); cfg.name = targetPlg.NAME; cfg.value = value; inputEx.use(w[targetPlg.NS].getFormCfg(), Y.bind(function(cfg) { this.addField(cfg); if (fireUpdatedEvent !== false) { this.fireUpdatedEvt(); } }, this, cfg, value)); }, this)); } }); inputEx.registerType("pluginlist", PluginList); // Register this class as "list" type });
import TableCol from "./TableCol"; const TableColArray = TableCol.extend` text-align: right; span + span { font-size: 80%; opacity: 0.8; } `; export default TableColArray;
// Gera um token aleatório // @todo Gerar token com letras e números com relação // a data/hora para ser único export default () => { return Math.random(); }
var create = require('../diagnostics'); /** * Create a new diagnostics logger. * * @param {String} namespace The namespace it should enable. * @param {Object} options Additional options. * @returns {Function} The logger. * @public */ var diagnostics = create(function dev(namespace, options) { options = options || {}; options.namespace = namespace; options.prod = false; options.dev = true; // // The order of operation is important here, as both yep and nope introduce // items to the `options` object, we want `nope` to be last so it sets // the debugger as disabled initially until the adapters are resolved. // const yep = dev.yep(options); const nope = dev.nope(options); let resolved = false; const queue = []; dev.enabled(namespace).then(function pinkypromised(enabled) { var disabled = !enabled && !(options.force || diagnostics.force); resolved = true; // // Correctly process the options and enabled state of the logger to // ensure that all functions such as loggers also see the correct state // of the logger. // options.enabled = diagnostics.enabled = !disabled; if (options.enabled) queue.forEach(function process(messages) { yep.apply(yep, messages); }); queue.lenght = 0; }); /** * Unlike browser and node, we return the same function when it's enabled * or disabled. This is because the adapters are resolved async in development * mode because we use AsyncStorage. This means that at the time of * creation we don't know yet if the logger can be used. * * @private */ function diagnostics() { if (!resolved) return queue.push(Array.prototype.slice.call(arguments, 0)); if (!diagnostics.enabled) return nope.apply(nope, arguments); return yep.apply(yep, arguments); } return dev.introduce(diagnostics, options); }); // // Configure the logger for the given environment. // diagnostics.modify(require('../modifiers/namespace')); diagnostics.use(require('../adapters/asyncstorage')); diagnostics.set(require('../logger/console')); // // Expose the diagnostics logger. // module.exports = diagnostics;
'use strict'; var express = require('express'); var router = express.Router(); var authCtrl = require('../controllers/authentication'); router.post('/signin', authCtrl.signin); router.get('/signout', authCtrl.signout); module.exports = router;
////////////////////////////////////////////////////////////////////////// // // // This is a generated file. You can view the original // // source in your browser if your browser supports source maps. // // Source maps are supported by all recent versions of Chrome, Safari, // // and Firefox, and by Internet Explorer 11. // // // ////////////////////////////////////////////////////////////////////////// (function () { /* Imports */ var Meteor = Package.meteor.Meteor; var Session = Package.session.Session; var Spacebars = Package.spacebars.Spacebars; var Accounts = Package['accounts-base'].Accounts; var AccountsClient = Package['accounts-base'].AccountsClient; var _ = Package.underscore._; var Template = Package.templating.Template; var i18n = Package['anti:i18n'].i18n; var Blaze = Package.blaze.Blaze; var UI = Package.blaze.UI; var Handlebars = Package.blaze.Handlebars; var HTML = Package.htmljs.HTML; /* Package-scope variables */ var ptPT, ptBR, zhCN, zhTW, accountsUIBootstrap3, i, $modal; (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/accounts_ui.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // if (!Accounts.ui){ // 1 Accounts.ui = {}; // 2 } // 3 // 4 if (!Accounts.ui._options) { // 5 Accounts.ui._options = { // 6 extraSignupFields: [], // 7 requestPermissions: {}, // 8 requestOfflineToken: {}, // 9 forceApprovalPrompt: {}, // 10 forceEmailLowercase: false, // 11 forceUsernameLowercase: false, // 12 forcePasswordLowercase: false // 13 }; // 14 } // 15 // 16 Accounts.ui.navigate = function (route, hash) { // 17 // if router is iron-router // 18 if (window.Router && _.isFunction(Router.go)) { // 19 Router.go(route, hash); // 20 } // 21 } // 22 // 23 Accounts.ui.config = function(options) { // 24 // validate options keys // 25 var VALID_KEYS = ['passwordSignupFields', 'extraSignupFields', 'forceEmailLowercase', 'forceUsernameLowercase','forcePasswordLowercase', 'requestPermissions', 'requestOfflineToken', 'forceApprovalPrompt']; // 27 // 28 _.each(_.keys(options), function(key) { // 29 if (!_.contains(VALID_KEYS, key)){ // 30 throw new Error("Accounts.ui.config: Invalid key: " + key); // 31 } // 32 }); // 33 // 34 options.extraSignupFields = options.extraSignupFields || []; // 35 // 36 // deal with `passwordSignupFields` // 37 if (options.passwordSignupFields) { // 38 if (_.contains([ // 39 "USERNAME_AND_EMAIL_CONFIRM", // 40 "USERNAME_AND_EMAIL", // 41 "USERNAME_AND_OPTIONAL_EMAIL", // 42 "USERNAME_ONLY", // 43 "EMAIL_ONLY" // 44 ], options.passwordSignupFields)) { // 45 if (Accounts.ui._options.passwordSignupFields){ // 46 throw new Error("Accounts.ui.config: Can't set `passwordSignupFields` more than once"); // 47 } else { // 48 Accounts.ui._options.passwordSignupFields = options.passwordSignupFields; // 49 } // 50 } else { // 51 throw new Error("Accounts.ui.config: Invalid option for `passwordSignupFields`: " + options.passwordSignupFields); } // 53 } // 54 // 55 Accounts.ui._options.forceEmailLowercase = options.forceEmailLowercase; // 56 Accounts.ui._options.forceUsernameLowercase = options.forceUsernameLowercase; // 57 Accounts.ui._options.forcePasswordLowercase = options.forcePasswordLowercase; // 58 // 59 // deal with `requestPermissions` // 60 if (options.requestPermissions) { // 61 _.each(options.requestPermissions, function(scope, service) { // 62 if (Accounts.ui._options.requestPermissions[service]) { // 63 throw new Error("Accounts.ui.config: Can't set `requestPermissions` more than once for " + service); // 64 } else if (!(scope instanceof Array)) { // 65 throw new Error("Accounts.ui.config: Value for `requestPermissions` must be an array"); // 66 } else { // 67 Accounts.ui._options.requestPermissions[service] = scope; // 68 } // 69 }); // 70 } // 71 if (typeof options.extraSignupFields !== 'object' || !options.extraSignupFields instanceof Array) { // 72 throw new Error("Accounts.ui.config: `extraSignupFields` must be an array."); // 73 } else { // 74 if (options.extraSignupFields) { // 75 _.each(options.extraSignupFields, function(field, index) { // 76 if (!field.fieldName || !field.fieldLabel){ // 77 throw new Error("Accounts.ui.config: `extraSignupFields` objects must have `fieldName` and `fieldLabel` attributes."); } // 79 if (typeof field.visible === 'undefined'){ // 80 field.visible = true; // 81 } // 82 Accounts.ui._options.extraSignupFields[index] = field; // 83 }); // 84 } // 85 } // 86 // 87 // deal with `requestOfflineToken` // 88 if (options.requestOfflineToken) { // 89 _.each(options.requestOfflineToken, function (value, service) { // 90 if (service !== 'google'){ // 91 throw new Error("Accounts.ui.config: `requestOfflineToken` only supported for Google login at the moment."); // 92 } // 93 if (Accounts.ui._options.requestOfflineToken[service]) { // 94 throw new Error("Accounts.ui.config: Can't set `requestOfflineToken` more than once for " + service); // 95 } else { // 96 Accounts.ui._options.requestOfflineToken[service] = value; // 97 } // 98 }); // 99 } // 100 // 101 // deal with `forceApprovalPrompt` // 102 if (options.forceApprovalPrompt) { // 103 _.each(options.forceApprovalPrompt, function (value, service) { // 104 if (service !== 'google'){ // 105 throw new Error("Accounts.ui.config: `forceApprovalPrompt` only supported for Google login at the moment."); // 106 } // 107 if (Accounts.ui._options.forceApprovalPrompt[service]) { // 108 throw new Error("Accounts.ui.config: Can't set `forceApprovalPrompt` more than once for " + service); // 109 } else { // 110 Accounts.ui._options.forceApprovalPrompt[service] = value; // 111 } // 112 }); // 113 } // 114 }; // 115 // 116 Accounts.ui._passwordSignupFields = function() { // 117 return Accounts.ui._options.passwordSignupFields || "EMAIL_ONLY"; // 118 }; // 119 // 120 // 121 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/en.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("en", { // 1 resetPasswordDialog: { // 2 title: "Reset your password", // 3 newPassword: "New password", // 4 newPasswordAgain: "New Password (again)", // 5 cancel: "Cancel", // 6 submit: "Set password" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Choose a password", // 10 newPassword: "New password", // 11 newPasswordAgain: "New Password (again)", // 12 cancel: "Close", // 13 submit: "Set password" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Email address verified", // 17 dismiss: "Dismiss" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Dismiss", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Change password", // 24 signOut: "Sign out" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Sign in", // 28 up: "Join" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "or" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Create", // 35 signIn: "Sign in", // 36 forgot: "Forgot password?", // 37 createAcc: "Create account" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Reset password", // 42 invalidEmail: "Invalid email" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Cancel" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Change password", // 49 cancel: "Cancel" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Sign in with", // 53 configure: "Configure", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Sign out" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "No login services configured" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Username or Email", // 63 username: "Username", // 64 email: "Email", // 65 password: "Password" // 66 }, // 67 signupFields: { // 68 username: "Username", // 69 email: "Email", // 70 emailOpt: "Email (optional)", // 71 password: "Password", // 72 passwordAgain: "Password (again)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Current Password", // 76 newPassword: "New Password", // 77 newPasswordAgain: "New Password (again)" // 78 }, // 79 infoMessages : { // 80 emailSent: "Email sent", // 81 passwordChanged: "Password changed" // 82 }, // 83 errorMessages: { // 84 genericTitle: "There was an error", // 85 userNotFound: "User not found", // 86 invalidEmail: "Invalid email", // 87 incorrectPassword: "Incorrect password", // 88 usernameTooShort: "Username must be at least 3 characters long", // 89 passwordTooShort: "Password must be at least 6 characters long", // 90 passwordsDontMatch: "Passwords don't match", // 91 newPasswordSameAsOld: "New and old passwords must be different", // 92 signupsForbidden: "Signups forbidden" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/es.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("es", { // 1 resetPasswordDialog: { // 2 title: "Restablece tu contraseña", // 3 newPassword: "Nueva contraseña", // 4 newPasswordAgain: "Nueva contraseña (otra vez)", // 5 cancel: "Cancelar", // 6 submit: "Guardar" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Escribe una contraseña", // 10 newPassword: "Nueva contraseña", // 11 newPasswordAgain: "Nueva contraseña (otra vez)", // 12 cancel: "Cerrar", // 13 submit: "Guardar contraseña" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Correo electrónico verificado", // 17 dismiss: "Cerrar" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Cerrar", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Cambiar contraseña", // 24 signOut: "Cerrar sesión" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Iniciar sesión", // 28 up: "registrarse" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "o" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Crear", // 35 signIn: "Iniciar sesión", // 36 forgot: "¿Ha olvidado su contraseña?", // 37 createAcc: "Registrarse" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Correo electrónico", // 41 reset: "Restablecer contraseña", // 42 invalidEmail: "Correo electrónico inválido" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Cancelar" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Cambiar contraseña", // 49 cancel: "Cancelar" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Inicia sesión con", // 53 configure: "Configurar", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Cerrar sesión" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "No hay ningún servicio configurado" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Usuario o correo electrónico", // 63 username: "Usuario", // 64 email: "Correo electrónico", // 65 password: "Contraseña" // 66 }, // 67 signupFields: { // 68 username: "Usuario", // 69 email: "Correo electrónico", // 70 emailOpt: "Correo elect. (opcional)", // 71 password: "Contraseña", // 72 passwordAgain: "Contraseña (otra vez)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Contraseña Actual", // 76 newPassword: "Nueva Contraseña", // 77 newPasswordAgain: "Nueva Contraseña (otra vez)" // 78 }, // 79 infoMessages: { // 80 emailSent: "Email enviado", // 81 passwordChanged: "Contraseña modificada" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Ha ocurrido un error", // 85 userNotFound: "El usuario no existe", // 86 invalidEmail: "Correo electrónico inválido", // 87 incorrectPassword: "Contraseña incorrecta", // 88 usernameTooShort: "El nombre de usuario tiene que tener 3 caracteres como mínimo", // 89 passwordTooShort: "La contraseña tiene que tener 6 caracteres como mínimo", // 90 passwordsDontMatch: "Las contraseñas no son iguales", // 91 newPasswordSameAsOld: "La contraseña nueva y la actual no pueden ser iguales" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/ca.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("ca", { // 1 resetPasswordDialog: { // 2 title: "Restablir la contrasenya", // 3 newPassword: "Nova contrasenya", // 4 newPasswordAgain: "Nova contrasenya (un altre cop)", // 5 cancel: "Cancel·lar", // 6 submit: "Guardar" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Escriu una contrasenya", // 10 newPassword: "Nova contrasenya", // 11 newPasswordAgain: "Nova contrasenya (un altre cop)", // 12 cancel: "Tancar", // 13 submit: "Guardar contrasenya" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Adreça electrònica verificada", // 17 dismiss: "Tancar" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Tancar", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Canviar contrasenya", // 24 signOut: "Tancar sessió" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Iniciar sessió", // 28 up: "Registrar-se" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "o bé" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Crear", // 35 signIn: "Iniciar sessió", // 36 forgot: "Ha oblidat la contrasenya?", // 37 createAcc: "Registrar-se" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Adreça electrònica", // 41 reset: "Restablir contrasenya", // 42 invalidEmail: "Adreça invàlida" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Cancel·lar" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Canviar contrasenya", // 49 cancel: "Cancel·lar" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Inicia sessió amb", // 53 configure: "Configurar" // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Tancar sessió" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "No hi ha cap servei configurat" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Usuari o correu electrònic", // 63 username: "Usuari", // 64 email: "Adreça electrònica", // 65 password: "Contrasenya" // 66 }, // 67 signupFields: { // 68 username: "Usuari", // 69 email: "Adreça electrònica", // 70 emailOpt: "Adreça elect. (opcional)", // 71 password: "Contrasenya", // 72 passwordAgain: "Contrasenya (un altre cop)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Contrasenya Actual", // 76 newPassword: "Nova Contrasenya", // 77 newPasswordAgain: "Nova Contrasenya (un altre cop)" // 78 }, // 79 infoMessages: { // 80 emailSent: "Email enviat", // 81 passwordChanged: "Contrasenya canviada" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Hi ha hagut un error", // 85 userNotFound: "L'usuari no existeix", // 86 invalidEmail: "Adreça invàlida", // 87 incorrectPassword: "Contrasenya incorrecta", // 88 usernameTooShort: "El nom d'usuari ha de tenir 3 caracters com a mínim", // 89 passwordTooShort: "La contrasenya ha de tenir 6 caracters como a mínim", // 90 passwordsDontMatch: "Les contrasenyes no són iguals", // 91 newPasswordSameAsOld: "La contrasenya nova i l'actual no poden ser iguals" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/fr.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("fr", { // 1 resetPasswordDialog: { // 2 title: "Réinitialiser mon mot de passe", // 3 newPassword: "Nouveau mot de passe", // 4 newPasswordAgain: "Nouveau mot de passe (confirmation)", // 5 cancel: "Annuler", // 6 submit: "Définir le mot de passe" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Choisir un mot de passe", // 10 newPassword: "Nouveau mot de passe", // 11 newPasswordAgain: "Nouveau mot de passe (confirmation)", // 12 cancel: "Fermer", // 13 submit: "Définir le mot de passe" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "L'adresse email a été vérifiée", // 17 dismiss: "Fermer" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Fermer", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Changer le mot de passe", // 24 signOut: "Déconnexion" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Connexion", // 28 up: "Inscription" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "ou" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Créer", // 35 signIn: "Connexion", // 36 forgot: "Mot de passe oublié ?", // 37 createAcc: "Inscription" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Réinitialiser le mot de passe", // 42 invalidEmail: "L'adresse email est invalide" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Annuler" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Changer le mot de passe", // 49 cancel: "Annuler" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Se connecter avec", // 53 configure: "Configurer", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Déconnexion" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Aucun service d'authentification n'est configuré" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Nom d'utilisateur ou email", // 63 username: "Nom d'utilisateur", // 64 email: "Email", // 65 password: "Mot de passe" // 66 }, // 67 signupFields: { // 68 username: "Nom d'utilisateur", // 69 email: "Email", // 70 emailOpt: "Email (optionnel)", // 71 password: "Mot de passe", // 72 passwordAgain: "Mot de passe (confirmation)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Mot de passe actuel", // 76 newPassword: "Nouveau mot de passe", // 77 newPasswordAgain: "Nouveau mot de passe (confirmation)" // 78 }, // 79 infoMessages: { // 80 emailSent: "Email envoyé", // 81 passwordChanged: "Mot de passe modifié" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Il y avait une erreur", // 85 userNotFound: "Utilisateur non trouvé", // 86 invalidEmail: "L'adresse email est invalide", // 87 incorrectPassword: "Mot de passe incorrect", // 88 usernameTooShort: "Le nom d'utilisateur doit comporter au moins 3 caractères", // 89 passwordTooShort: "Le mot de passe doit comporter au moins 6 caractères", // 90 passwordsDontMatch: "Les mots de passe ne sont pas identiques", // 91 newPasswordSameAsOld: "Le nouveau et le vieux mot de passe doivent être différent" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/de.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("de", { // 1 resetPasswordDialog: { // 2 title: "Passwort zurücksetzen", // 3 newPassword: "Neues Passwort", // 4 newPasswordAgain: "Neues Passwort (wiederholen)", // 5 cancel: "Abbrechen", // 6 submit: "Passwort ändern" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Passwort wählen", // 10 newPassword: "Neues Passwort", // 11 newPasswordAgain: "Neues Passwort (wiederholen)", // 12 cancel: "Schließen", // 13 submit: "Passwort ändern" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Email Adresse verifiziert", // 17 dismiss: "Schließen" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Schließen" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Passwort ändern", // 24 signOut: "Abmelden" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Anmelden", // 28 up: "Registrieren" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "oder" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Erstellen", // 35 signIn: "Anmelden", // 36 forgot: "Passwort vergessen?", // 37 createAcc: "Account erstellen" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Passwort zurücksetzen", // 42 invalidEmail: "Ungültige Email Adresse" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Abbrechen" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Passwort ändern", // 49 cancel: "Abbrechen" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Anmelden mit", // 53 configure: "Konfigurieren", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Abmelden" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Keine Anmelde Services konfiguriert" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Benutzername oder Email", // 63 username: "Benutzername", // 64 email: "Email", // 65 password: "Passwort" // 66 }, // 67 signupFields: { // 68 username: "Benutzername", // 69 email: "Email", // 70 emailOpt: "Email (freiwillig)", // 71 password: "Passwort", // 72 passwordAgain: "Passwort (wiederholen)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Aktuelles Passwort", // 76 newPassword: "Neues Passwort", // 77 newPasswordAgain: "Neues Passwort (wiederholen)" // 78 }, // 79 infoMessages : { // 80 sent: "Email gesendet", // 81 passwordChanged: "Passwort geändert" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Es gab einen Fehler", // 85 userNotFound: "Benutzer nicht gefunden", // 86 invalidEmail: "Ungültige Email Adresse", // 87 incorrectPassword: "Falsches Passwort", // 88 usernameTooShort: "Der Benutzername muss mindestens 3 Buchstaben lang sein", // 89 passwordTooShort: "Passwort muss mindestens 6 Zeichen lang sein", // 90 passwordsDontMatch: "Die Passwörter stimmen nicht überein", // 91 newPasswordSameAsOld: "Neue und aktuelle Passwörter müssen unterschiedlich sein" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/it.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("it", { // 1 resetPasswordDialog: { // 2 title: "Reimposta la password", // 3 newPassword: "Nuova password", // 4 newPasswordAgain: "Nuova password (di nuovo)", // 5 cancel: "Annulla", // 6 submit: "Imposta password" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Scegli una password", // 10 newPassword: "Nuova password", // 11 newPasswordAgain: "Nuova password (di nuovo)", // 12 cancel: "Chiudi", // 13 submit: "Imposta password" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Indirizzo email verificato", // 17 dismiss: "Chiudi" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Chiudi", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Cambia password", // 24 signOut: "Esci" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Accedi", // 28 up: "Registrati" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "oppure" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Crea", // 35 signIn: "Accedi", // 36 forgot: "Password dimenticata?", // 37 createAcc: "Crea un account" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Reimposta la password", // 42 invalidEmail: "Email non valida" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Cancella" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Cambia password", // 49 cancel: "Annulla" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Accedi con", // 53 configure: "Configura", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Esci" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Nessun servizio di accesso configurato" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Username o Email", // 63 username: "Username", // 64 email: "Email", // 65 password: "Password" // 66 }, // 67 signupFields: { // 68 username: "Username", // 69 email: "Email", // 70 emailOpt: "Email (opzionale)", // 71 password: "Password", // 72 passwordAgain: "Password (di nuovo)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Password corrente", // 76 newPassword: "Nuova password", // 77 newPasswordAgain: "Nuova password (di nuovo)" // 78 }, // 79 infoMessages: { // 80 emailSent: "Email inviata", // 81 passwordChanged: "Password changed" // 82 }, // 83 errorMessages: { // 84 genericTitle: "C'era un errore", // 85 userNotFound: "Username non trovato", // 86 invalidEmail: "Email non valida", // 87 incorrectPassword: "Password errata", // 88 usernameTooShort: "La Username deve essere almeno di 3 caratteri", // 89 passwordTooShort: "La Password deve essere almeno di 6 caratteri", // 90 passwordsDontMatch: "Le password non corrispondono", // 91 newPasswordSameAsOld: "Nuove e vecchie password devono essere diversi" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/pt-PT.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ptPT = { // 1 resetPasswordDialog: { // 2 title: "Esqueci-me da palavra-passe", // 3 newPassword: "Nova palavra-passe", // 4 newPasswordAgain: "Nova palavra-passe (confirmacao)", // 5 cancel: "Cancelar", // 6 submit: "Alterar palavra-passe" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Introduza a nova palavra-passe", // 10 newPassword: "Nova palavra-passe", // 11 newPasswordAgain: "Nova palavra-passe (confirmacao)", // 12 cancel: "Fechar", // 13 submit: "Alterar palavra-passe" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "E-mail verificado!", // 17 dismiss: "Ignorar" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Ignorar" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Mudar palavra-passe", // 24 signOut: "Sair" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Entrar", // 28 up: "Registar" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "ou" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Criar", // 35 signIn: "Entrar", // 36 forgot: "Esqueci-me da palavra-passe", // 37 createAcc: "Registar" // 38 }, // 39 forgotPasswordForm: { // 40 email: "E-mail", // 41 reset: "Alterar palavra-passe", // 42 sent: "E-mail enviado", // 43 invalidEmail: "E-mail inválido" // 44 }, // 45 loginButtonsBackToLoginLink: { // 46 back: "Cancelar" // 47 }, // 48 loginButtonsChangePassword: { // 49 submit: "Mudar palavra-passe", // 50 cancel: "Cancelar" // 51 }, // 52 loginButtonsLoggedOutSingleLoginButton: { // 53 signInWith: "Entrar com", // 54 configure: "Configurar" // 55 }, // 56 loginButtonsLoggedInSingleLogoutButton: { // 57 signOut: "Sair" // 58 }, // 59 loginButtonsLoggedOut: { // 60 noLoginServices: "Nenhum servico de login configurado" // 61 }, // 62 loginFields: { // 63 usernameOrEmail: "Utilizador ou E-mail", // 64 username: "Utilizador", // 65 email: "E-mail", // 66 password: "Palavra-passe" // 67 }, // 68 signupFields: { // 69 username: "Utilizador", // 70 email: "E-mail", // 71 emailOpt: "E-mail (opcional)", // 72 password: "Palavra-passe", // 73 passwordAgain: "Palavra-passe (confirmacão)" // 74 }, // 75 changePasswordFields: { // 76 currentPassword: "Palavra-passe atual", // 77 newPassword: "Nova palavra-passe", // 78 newPasswordAgain: "Nova palavra-passe (confirmacao)" // 79 }, // 80 infoMessages: { // 81 emailSent: "E-mail enviado", // 82 passwordChanged: "Palavra-passe alterada" // 83 }, // 84 errorMessages: { // 85 genericTitle: "Houve um erro", // 86 usernameTooShort: "Utilizador precisa de ter mais de 3 caracteres", // 87 invalidEmail: "E-mail inválido", // 88 passwordTooShort: "Palavra-passe precisa ter mais de 6 caracteres", // 89 passwordsDontMatch: "As Palavras-passe estão diferentes", // 90 userNotFound: "Utilizador não encontrado", // 91 incorrectPassword: "Palavra-passe incorreta", // 92 newPasswordSameAsOld: "A nova palavra-passe tem de ser diferente da antiga" // 93 } // 94 }; // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/pt-BR.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ptBR = { // 1 resetPasswordDialog: { // 2 title: "Esqueceu sua senha?", // 3 newPassword: "Nova senha", // 4 newPasswordAgain: "Nova senha (confirmacao)", // 5 cancel: "Cancelar", // 6 submit: "Alterar senha" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Digite a nova senha", // 10 newPassword: "Nova senha", // 11 newPasswordAgain: "Nova senha (confirmacao)", // 12 cancel: "Fechar", // 13 submit: "Alterar senha" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "E-mail verificado!", // 17 dismiss: "Ignorar" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Ignorar" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Mudar senha", // 24 signOut: "Sair" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Entrar", // 28 up: "Cadastrar" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "ou" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Criar", // 35 signIn: "Login", // 36 forgot: "Esqueceu sua senha?", // 37 createAcc: "Cadastrar" // 38 }, // 39 forgotPasswordForm: { // 40 email: "E-mail", // 41 reset: "Alterar senha", // 42 invalidEmail: "E-mail inválido" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Cancelar" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Mudar senha", // 49 cancel: "Cancelar" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Logar com", // 53 configure: "Configurar", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Sair" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Nenhum servico de login configurado" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Usuário ou E-mail", // 63 username: "Usuário", // 64 email: "E-mail", // 65 password: "Senha" // 66 }, // 67 signupFields: { // 68 username: "Usuário", // 69 email: "E-mail", // 70 emailOpt: "E-mail (opcional)", // 71 password: "Senha", // 72 passwordAgain: "Senha (confirmacão)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Senha atual", // 76 newPassword: "Nova Senha", // 77 newPasswordAgain: "Nova Senha (confirmacao)" // 78 }, // 79 infoMessages: { // 80 emailSent: "E-mail enviado", // 81 passwordChanged: "Senha alterada" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Houve um erro", // 85 userNotFound: "Usuário não encontrado", // 86 invalidEmail: "E-mail inválido", // 87 incorrectPassword: "Senha incorreta", // 88 usernameTooShort: "Usuário precisa ter mais de 3 caracteres", // 89 passwordTooShort: "Senha precisa ter mais de 6 caracteres", // 90 passwordsDontMatch: "Senhas estão diferentes", // 91 newPasswordSameAsOld: "A nova senha tem de ser diferente da antiga" // 92 } // 93 }; // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/pt.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map('pt', ptPT); // 1 i18n.map('pt-PT', ptPT); // 2 i18n.map('pt-BR', ptBR); // 3 // 4 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/ru.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("ru", { // 1 resetPasswordDialog: { // 2 title: "Сбросить пароль", // 3 newPassword: "Новый пароль", // 4 newPasswordAgain: "Новый пароль (еще раз)", // 5 cancel: "Отмена", // 6 submit: "Сохранить пароль" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Выбрать пароль", // 10 newPassword: "Новый пароль", // 11 newPasswordAgain: "Новый пароль (еще раз)", // 12 cancel: "Отмена", // 13 submit: "Сохранить пароль" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Email подтвержден", // 17 dismiss: "Закрыть" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Закрыть" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Изменить пароль", // 24 signOut: "Выйти" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Войти", // 28 up: "Зарегистрироваться" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "или" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Создать", // 35 signIn: "Войти", // 36 forgot: "Забыли пароль?", // 37 createAcc: "Создать аккаунт" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Сбросить пароль", // 42 invalidEmail: "Некорректный email" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Отмена" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Изменить пароль", // 49 cancel: "Отмена" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Войти через", // 53 configure: "Настроить вход через", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Выйти" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Сервис для входа не настроен" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Имя пользователя или email", // 63 username: "Имя пользователя", // 64 email: "Email", // 65 password: "Пароль" // 66 }, // 67 signupFields: { // 68 username: "Имя пользователя", // 69 email: "Email", // 70 emailOpt: "Email (необязательный)", // 71 password: "Пароль", // 72 passwordAgain: "Пароль (еще раз)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Текущий пароль", // 76 newPassword: "Новый пароль", // 77 newPasswordAgain: "Новый пароль (еще раз)" // 78 }, // 79 infoMessages : { // 80 sent: "Вам отправлено письмо", // 81 passwordChanged: "Пароль изменён" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Там была ошибка", // 85 userNotFound: "Пользователь не найден", // 86 invalidEmail: "Некорректный email", // 87 incorrectPassword: "Неправильный пароль", // 88 usernameTooShort: "Имя пользователя должно быть длиной не менее 3-х символов", // 89 passwordTooShort: "Пароль должен быть длиной не менее 6-ти символов", // 90 passwordsDontMatch: "Пароли не совпадают", // 91 newPasswordSameAsOld: "Новый и старый пароли должны быть разными" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/el.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("el", { // 1 resetPasswordDialog: { // 2 title: "Ακύρωση κωδικού", // 3 newPassword: "Νέος κωδικός", // 4 newPasswordAgain: "Νέος Κωδικός (ξανά)", // 5 cancel: "Ακύρωση", // 6 submit: "Ορισμός κωδικού" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Επιλέξτε κωδικό", // 10 newPassword: "Νέος κωδικός", // 11 newPasswordAgain: "Νέος Κωδικός (ξανά)", // 12 cancel: "Ακύρωση", // 13 submit: "Ορισμός κωδικού" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Ο λογαριασμός ηλεκτρονικού ταχυδρομείου έχει επιβεβαιωθεί", // 17 dismiss: "Κλείσιμο" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Κλείσιμο", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Αλλαγή κωδικού", // 24 signOut: "Αποσύνδεση" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Είσοδος", // 28 up: "Εγγραφή" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "ή" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Δημιουργία", // 35 signIn: "Είσοδος", // 36 forgot: "Ξεχάσατε τον κωδικό σας;", // 37 createAcc: "Δημιουργία λογαριασμού" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Ηλεκτρονικό ταχυδρομείο (email)", // 41 reset: "Ακύρωση κωδικού", // 42 invalidEmail: "Μη έγκυρος λογαριασμός ηλεκτρονικού ταχυδρομείου (email)" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Επιστροφή" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Αλλαγή κωδικού", // 49 cancel: "Ακύρωση" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Είσοδος με", // 53 configure: "Διαμόρφωση", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Αποσύνδεση" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Δεν έχουν διαμορφωθεί υπηρεσίες εισόδου" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Όνομα χρήστη ή Λογαριασμός Ηλεκτρονικού Ταχυδρομείου", // 63 username: "Όνομα χρήστη", // 64 email: "Ηλεκτρονικό ταχυδρομείο (email)", // 65 password: "Κωδικός" // 66 }, // 67 signupFields: { // 68 username: "Όνομα χρήστη", // 69 email: "Ηλεκτρονικό ταχυδρομείο (email)", // 70 emailOpt: "Ηλεκτρονικό ταχυδρομείο (προαιρετικό)", // 71 password: "Κωδικός", // 72 passwordAgain: "Κωδικός (ξανά)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Ισχύων Κωδικός", // 76 newPassword: "Νέος Κωδικός", // 77 newPasswordAgain: "Νέος Κωδικός (ξανά)" // 78 }, // 79 infoMessages: { // 80 emailSent: "Το email έχει αποσταλεί", // 81 passwordChanged: "Password changed" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Υπήρξε ένα σφάλμα", // 85 userNotFound: "Ο χρήστης δεν βρέθηκε", // 86 invalidEmail: "Μη έγκυρος λογαριασμός ηλεκτρονικού ταχυδρομείου (email)", // 87 incorrectPassword: "Λάθος κωδικός", // 88 usernameTooShort: "Το όνομα χρήστη πρέπει να είναι τουλάχιστον 3 χαρακτήρες", // 89 passwordTooShort: "Ο κωδικός πρέπει να είναι τουλάχιστον 6 χαρακτήρες", // 90 passwordsDontMatch: "Οι κωδικοί δεν ταιριάζουν", // 91 newPasswordSameAsOld: "Νέα και παλιά κωδικούς πρόσβασης πρέπει να είναι διαφορετική" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/ko.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("ko", { // 1 resetPasswordDialog: { // 2 title: "비밀번호 초기화하기", // 3 newPassword: "새로운 비밀번호", // 4 newPasswordAgain: "새로운 비밀번호 (확인)", // 5 cancel: "취소", // 6 submit: "변경" // 7 }, // 8 enrollAccountDialog: { // 9 title: "비밀번호를 입력해주세요", // 10 newPassword: "새로운 비밀번호", // 11 newPasswordAgain: "새로운 비밀번호 (확인)", // 12 cancel: "닫기", // 13 submit: "변경" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "이메일 주소가 인증되었습니다", // 17 dismiss: "취소" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "취소", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "비밀번호 변경하기", // 24 signOut: "로그아웃" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "로그인", // 28 up: "계정 만들기" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "또는" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "만들기", // 35 signIn: "로그인", // 36 forgot: "비밀번호를 잊어버리셨나요?", // 37 createAcc: "계정 만들기" // 38 }, // 39 forgotPasswordForm: { // 40 email: "이메일 주소", // 41 reset: "비밀번호 초기화하기", // 42 invalidEmail: "올바르지 않은 이메일 주소입니다" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "취소" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "비밀번호 변경하기", // 49 cancel: "취소" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "다음으로 로그인하기:", // 53 configure: "설정", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "로그아웃" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "사용 가능한 로그인 서비스가 없습니다" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "사용자 이름 또는 이메일 주소", // 63 username: "사용자 이름", // 64 email: "이메일 주소", // 65 password: "비밀번호" // 66 }, // 67 signupFields: { // 68 username: "사용자 이름", // 69 email: "이메일 주소", // 70 emailOpt: "이메일 주소 (선택)", // 71 password: "비밀번호", // 72 passwordAgain: "비밀번호 (확인)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "현재 비밀번호", // 76 newPassword: "새로운 비밀번호", // 77 newPasswordAgain: "새로운 비밀번호 (확인)" // 78 }, // 79 infoMessages: { // 80 emailSent: "이메일이 발송되었습니다", // 81 passwordChanged: "비밀번호가 변경되었습니다" // 82 }, // 83 errorMessages: { // 84 genericTitle: "오류가 발생했습니다", // 85 userNotFound: "찾을 수 없는 회원입니다", // 86 invalidEmail: "잘못된 이메일 주소", // 87 incorrectPassword: "비밀번호가 틀렸습니다", // 88 usernameTooShort: "사용자 이름은 최소 3글자 이상이어야 합니다", // 89 passwordTooShort: "비밀번호는 최소 6글자 이상이어야 합니다", // 90 passwordsDontMatch: "비밀번호가 같지 않습니다", // 91 newPasswordSameAsOld: "새 비밀번호와 기존 비밀번호는 달라야합니다" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/ar.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("ar", { // 1 resetPasswordDialog: { // 2 title: "استرجع كلمة المرور", // 3 newPassword: "كلمة المرور الجديدة", // 4 newPasswordAgain: "أعد كتابة كلمة السر الجديدة", // 5 cancel: "إلغ", // 6 submit: "تم" // 7 }, // 8 enrollAccountDialog: { // 9 title: "اختر كلمة سر", // 10 newPassword: "كلمة السر", // 11 newPasswordAgain: "أعد كتابة كلمة السر الجديدة", // 12 cancel: "أغلق", // 13 submit: "تم" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "تم تأكيد البريد", // 17 dismiss: "حسنًا" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "حسنًا" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "غير كلمة السر", // 24 signOut: "تسجيل الخروج" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "دخول", // 28 up: "إنشاء حساب" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "أو" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "أنشئ", // 35 signIn: "دخول", // 36 forgot: "نسيت كلمة السر؟", // 37 createAcc: "أنشئ حسابا" // 38 }, // 39 forgotPasswordForm: { // 40 email: "البريد", // 41 reset: "إعادة تعين كلمة السر", // 42 invalidEmail: "البريد خاطئ" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "إلغ" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "غير كلمة السر", // 49 cancel: "إلغ" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "سجل الدخول عبر", // 53 configure: "تعيين" // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "اخرج" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "لا يوجد خدمة دخول مفعله" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "اسم المستخدم او عنوان البريد", // 63 username: "اسم المستخدم", // 64 email: "البريد", // 65 password: "كلمة السر" // 66 }, // 67 signupFields: { // 68 username: "اسم المستخدم", // 69 email: "البريد", // 70 emailOpt: "-اختياري- البريد", // 71 password: "كلمة السر", // 72 passwordAgain: "أعد كتابة كلمة السر" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "كلمة السر الحالية", // 76 newPassword: "كلمة السر الجديدة", // 77 newPasswordAgain: "أعد كتابة كلمة السر الجديدة" // 78 }, // 79 infoMessages : { // 80 emailSent: "تم الارسال", // 81 passwordChanged: "تمت إعادة تعيين كلمة السر" // 82 }, // 83 errorMessages: { // 84 genericTitle: "كان هناك خطأ", // 85 userNotFound: "المستخدم غير موجود", // 86 invalidEmail: "بريد خاطئ", // 87 incorrectPassword: "كلمة السر خطأ", // 88 usernameTooShort: "اسم المستخدم لابد ان يكون علي الاقل ٣ حروف", // 89 passwordTooShort: "كلمة السر لابد ان تكون علي الاقل ٦ احرف", // 90 passwordsDontMatch: "كلمة السر غير متطابقة", // 91 newPasswordSameAsOld: "لابد من اختيار كلمة سر مختلفة عن السابقة", // 92 signupsForbidden: "التسجيل مغلق" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/pl.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("pl", { // 1 resetPasswordDialog: { // 2 title: "Resetuj hasło", // 3 newPassword: "Nowe hasło", // 4 newPasswordAgain: "Nowe hasło (powtórz)", // 5 cancel: "Anuluj", // 6 submit: "Ustaw hasło" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Wybierz hasło", // 10 newPassword: "Nowe hasło", // 11 newPasswordAgain: "Nowe hasło (powtórz)", // 12 cancel: "Zamknij", // 13 submit: "Ustaw hasło" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Adres email został zweryfikowany", // 17 dismiss: "Odrzuć" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Odrzuć" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Zmień hasło", // 24 signOut: "Wyloguj się" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Zaloguj się", // 28 up: "Zarejestruj się" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "lub" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Stwórz", // 35 signIn: "Zaloguj się ", // 36 forgot: "Nie pamiętasz hasła?", // 37 createAcc: "Utwórz konto" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Resetuj hasło", // 42 invalidEmail: "Niepoprawny email" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Anuluj" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Zmień hasło", // 49 cancel: "Anuluj" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Zaloguj się przez", // 53 configure: "Configure" // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Wyloguj się" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Nie skonfigurowano usługi logowania" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Nazwa użytkownika lub email", // 63 username: "Nazwa użytkownika", // 64 email: "Email", // 65 password: "Hasło" // 66 }, // 67 signupFields: { // 68 username: "Nazwa użytkownika", // 69 email: "Email", // 70 emailOpt: "Email (opcjonalnie)", // 71 password: "Hasło", // 72 passwordAgain: "Hasło (powtórz)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Obecne hasło", // 76 newPassword: "Nowe hasło", // 77 newPasswordAgain: "Nowe hasło (powtórz)" // 78 }, // 79 infoMessages : { // 80 emailSent: "Wysłano email", // 81 passwordChanged: "Hasło zostało zmienione" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Wystąpił błąd", // 85 userNotFound: "Nie znaleziono użytkownika", // 86 invalidEmail: "Niepoprawny email", // 87 incorrectPassword: "Niepoprawne hasło", // 88 usernameTooShort: "Nazwa użytkowika powinna mieć przynajmniej 3 znaki", // 89 passwordTooShort: "Hasło powinno składać się przynajmnej z 6 znaków", // 90 passwordsDontMatch: "Hasło są różne", // 91 newPasswordSameAsOld: "Nowe hasło musi się różnić od starego", // 92 signupsForbidden: "Rejstracja wyłączona" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/zh-CN.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // zhCN = { // 1 resetPasswordDialog: { // 2 title: "重置密码", // 3 newPassword: "新密码", // 4 newPasswordAgain: "重复新密码", // 5 cancel: "取消", // 6 submit: "确定" // 7 }, // 8 enrollAccountDialog: { // 9 title: "选择一个密码", // 10 newPassword: "新密码", // 11 newPasswordAgain: "重复新密码", // 12 cancel: "取消", // 13 submit: "确定" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Email地址验证", // 17 dismiss: "失败" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "失败" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "更改密码", // 24 signOut: "退出" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "登录", // 28 up: "注册" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "或" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "新建", // 35 signIn: "登陆", // 36 forgot: "忘记密码?", // 37 createAcc: "新建用户" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "重置密码", // 42 invalidEmail: "email格式不正确" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "取消" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "更改密码", // 49 cancel: "取消" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "登陆以", // 53 configure: "配置" // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "退出" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "没有配置登录服务" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "用户名或者Email", // 63 username: "用户名", // 64 email: "Email", // 65 password: "密码" // 66 }, // 67 signupFields: { // 68 username: "用户名", // 69 email: "Email", // 70 emailOpt: "Email (可选)", // 71 password: "密码", // 72 passwordAgain: "重复密码" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "当前密码", // 76 newPassword: "新密码", // 77 newPasswordAgain: "重复新密码" // 78 }, // 79 infoMessages: { // 80 emailSent: "发送Email", // 81 passwordChanged: "密码更改成功" // 82 }, // 83 errorMessages: { // 84 genericTitle: "出現了一個錯誤", // 85 userNotFound: "用户不存在", // 86 invalidEmail: "Email格式不正确", // 87 incorrectPassword: "密码错误", // 88 usernameTooShort: "用户名必需大于3位", // 89 passwordTooShort: "密码必需大于6位", // 90 passwordsDontMatch: "密码输入不一致", // 91 newPasswordSameAsOld: "新密码和旧的不能一样", // 92 signupsForbidden: "没有权限" // 93 } // 94 }; // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/zh-TW.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // zhTW = { // 1 resetPasswordDialog: { // 2 title: "重設密碼", // 3 newPassword: "新密碼", // 4 newPasswordAgain: "重複新密碼", // 5 cancel: "取消", // 6 submit: "確定" // 7 }, // 8 enrollAccountDialog: { // 9 title: "選擇一個密碼", // 10 newPassword: "新密碼", // 11 newPasswordAgain: "重複新密碼", // 12 cancel: "取消", // 13 submit: "確定" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Email驗證", // 17 dismiss: "失敗" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "失敗" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "更改密碼", // 24 signOut: "登出" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "登入", // 28 up: "註冊" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "或" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "新建", // 35 signIn: "登入", // 36 forgot: "忘记密碼?", // 37 createAcc: "新建用户" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "重設密碼", // 42 invalidEmail: "email格式不正確" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "取消" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "更改密碼", // 49 cancel: "取消" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "登入以", // 53 configure: "設定" // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "退出" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "沒有設定登入服务" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "用户名或者Email", // 63 username: "用户名", // 64 email: "Email", // 65 password: "密碼" // 66 }, // 67 signupFields: { // 68 username: "用户名", // 69 email: "Email", // 70 emailOpt: "Email (可選)", // 71 password: "密碼", // 72 passwordAgain: "重複密碼" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "目前密碼", // 76 newPassword: "新密碼", // 77 newPasswordAgain: "重複新密碼" // 78 }, // 79 infoMessages: { // 80 emailSent: "發送Email", // 81 passwordChanged: "密碼更改成功" // 82 }, // 83 errorMessages: { // 84 genericTitle: "出現了一個錯誤", // 85 userNotFound: "用户不存在", // 86 invalidEmail: "Email格式不正確", // 87 incorrectPassword: "密碼错误", // 88 usernameTooShort: "用户名必需大于3位", // 89 passwordTooShort: "密碼必需大于6位", // 90 passwordsDontMatch: "密碼输入不一致", // 91 newPasswordSameAsOld: "新密碼和舊的不能一樣", // 92 signupsForbidden: "沒有權限" // 93 } // 94 }; // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/zh.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("zh", zhCN); // 1 i18n.map("zh-CN", zhCN); // 2 i18n.map("zh-TW", zhTW); // 3 // 4 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/nl.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("nl", { // 1 resetPasswordDialog: { // 2 title: "Wachtwoord resetten", // 3 newPassword: "Nieuw wachtwoord", // 4 newPasswordAgain: "Nieuw wachtwoord (opnieuw)", // 5 cancel: "Annuleren", // 6 submit: "Wachtwoord instellen" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Stel een wachtwoord in", // 10 newPassword: "Nieuw wachtwoord", // 11 newPasswordAgain: "Nieuw wachtwoord (opnieuw)", // 12 cancel: "Sluiten", // 13 submit: "Wachtwoord instellen" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "E-mailadres geverifieerd", // 17 dismiss: "Sluiten" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Sluiten", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Wachtwoord veranderen", // 24 signOut: "Afmelden" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Aanmelden", // 28 up: "Registreren" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "of" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Aanmaken", // 35 signIn: "Aanmelden", // 36 forgot: "Wachtwoord vergeten?", // 37 createAcc: "Account aanmaken" // 38 }, // 39 forgotPasswordForm: { // 40 email: "E-mailadres", // 41 reset: "Wachtwoord opnieuw instellen", // 42 invalidEmail: "Ongeldig e-mailadres" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Annuleren" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Wachtwoord veranderen", // 49 cancel: "Annuleren" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Aanmelden via", // 53 configure: "Instellen", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Afmelden" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Geen aanmelddienst ingesteld" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Gebruikersnaam of e-mailadres", // 63 username: "Gebruikersnaam", // 64 email: "E-mailadres", // 65 password: "Wachtwoord" // 66 }, // 67 signupFields: { // 68 username: "Gebruikersnaam", // 69 email: "E-mailadres", // 70 emailOpt: "E-mailadres (niet verplicht)", // 71 password: "Wachtwoord", // 72 passwordAgain: "Wachtwoord (opnieuw)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Huidig wachtwoord", // 76 newPassword: "Nieuw wachtwoord", // 77 newPasswordAgain: "Nieuw wachtwoord (opnieuw)" // 78 }, // 79 infoMessages : { // 80 emailSent: "E-mail verstuurd", // 81 passwordChanged: "Wachtwoord veranderd" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Er is een fout opgetreden", // 85 userNotFound: "Gebruiker niet gevonden", // 86 invalidEmail: "Ongeldig e-mailadres", // 87 incorrectPassword: "Onjuist wachtwoord", // 88 usernameTooShort: "De gebruikersnaam moet minimaal uit 3 tekens bestaan", // 89 passwordTooShort: "Het wachtwoord moet minimaal uit 6 tekens bestaan", // 90 passwordsDontMatch: "De wachtwoorden komen niet overeen", // 91 newPasswordSameAsOld: "Het oude en het nieuwe wachtwoord mogen niet hetzelfde zijn", // 92 signupsForbidden: "Aanmeldingen niet toegestaan" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/ja.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("ja", { // 1 resetPasswordDialog: { // 2 title: "パスワードを再設定する", // 3 newPassword: "新しいパスワード", // 4 newPasswordAgain: "新しいパスワード (確認)", // 5 cancel: "キャンセル", // 6 submit: "パスワードを設定" // 7 }, // 8 enrollAccountDialog: { // 9 title: "パスワードを決める", // 10 newPassword: "新しいパスワード", // 11 newPasswordAgain: "新しいパスワード (確認)", // 12 cancel: "閉じる", // 13 submit: "パスワードを設定" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "メールアドレス菅確認されました", // 17 dismiss: "閉じる" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "閉じる", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "パスワードを変える", // 24 signOut: "サインアウト" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "サインイン", // 28 up: "参加" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "または" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "作成", // 35 signIn: "サインイン", // 36 forgot: "パスワードを忘れましたか?", // 37 createAcc: "アカウントを作成" // 38 }, // 39 forgotPasswordForm: { // 40 email: "メール", // 41 reset: "パスワードを再設定する", // 42 invalidEmail: "無効なメール" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "キャンセル" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "パスワードを変える", // 49 cancel: "キャンセル" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "サインインする", // 53 configure: "設定する", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "サインアウト" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "ログインサービスが設定されていません" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "ユーザー名またはメール", // 63 username: "ユーザー名", // 64 email: "メール", // 65 password: "パスワード" // 66 }, // 67 signupFields: { // 68 username: "ユーザー名", // 69 email: "メール", // 70 emailOpt: "メール (オプション)", // 71 password: "パスワード", // 72 passwordAgain: "パスワード (確認)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "現在のパスワード", // 76 newPassword: "新しいパスワード", // 77 newPasswordAgain: "新しいパスワード (確認)" // 78 }, // 79 infoMessages : { // 80 emailSent: "メールを送りました", // 81 passwordChanged: "パスワードが変わりました" // 82 }, // 83 errorMessages: { // 84 genericTitle: "エラーが発生しました", // 85 userNotFound: "ユーザーが見つかりません", // 86 invalidEmail: "無効なメール", // 87 incorrectPassword: "無効なパスワード", // 88 usernameTooShort: "ユーザー名は3文字以上でなければいけません", // 89 passwordTooShort: "パスワードは6文字以上でなければいけません", // 90 passwordsDontMatch: "パスワードが一致しません", // 91 newPasswordSameAsOld: "新しいパスワードは古いパスワードと違っていなければいけません", // 92 signupsForbidden: "サインアップが許可されませんでした" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/he.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("he", { // 1 resetPasswordDialog: { // 2 title: "איפוס סיסמא", // 3 newPassword: "סיסמא חדשה", // 4 newPasswordAgain: "סיסמא חדשה (שוב)", // 5 cancel: "ביטול", // 6 submit: "קביעת סיסמא" // 7 }, // 8 enrollAccountDialog: { // 9 title: "בחירת סיסמא", // 10 newPassword: "סיסמא חדשה", // 11 newPasswordAgain: "סיסמא חדשה (שוב)", // 12 cancel: "סגירה", // 13 submit: "קביעת סיסמא" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "כתובת דואר אלקטרוני אומתה", // 17 dismiss: "סגירה" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "סגירה", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "שינוי סיסמא", // 24 signOut: "יציאה" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "כניסה", // 28 up: "רישום" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "או" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "יצירה", // 35 signIn: "התחברות", // 36 forgot: "סיסמא נשכחה?", // 37 createAcc: "יצירת חשבון" // 38 }, // 39 forgotPasswordForm: { // 40 email: "דואר אלקטרוני (אימייל)", // 41 reset: "איפוס סיסמא", // 42 invalidEmail: "כתובת דואר אלקטרוני לא חוקית" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "ביטול" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "שינוי סיסמא", // 49 cancel: "ביטול" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "התחברות עםh", // 53 configure: "הגדרות", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "התנתקות" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "שירותים התחברות נוספים לא הוגדרו" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "שם משתמש או כתובת דואר אלקטרוני", // 63 username: "שם משתמש", // 64 email: "דואר אלקטרוני", // 65 password: "סיסמא" // 66 }, // 67 signupFields: { // 68 username: "שם משתמש", // 69 email: "דואר אלקטרוני", // 70 emailOpt: "דואר אלקטרוני (לא חובה)", // 71 password: "סיסמא", // 72 passwordAgain: "סיסמא (שוב)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "סיסמא נוכחית", // 76 newPassword: "סיסמא חדשה", // 77 newPasswordAgain: "סיסמא חדשה (שוב)" // 78 }, // 79 infoMessages : { // 80 emailSent: "דואר אלקטרוני נשלח", // 81 passwordChanged: "סיסמא שונתה" // 82 }, // 83 errorMessages: { // 84 genericTitle: "תרעה שגיאה", // 85 userNotFound: "משתמש/ת לא קיים/מת", // 86 invalidEmail: "כתובת דואר אלקטרוני לא חוקי", // 87 incorrectPassword: "סיסמא שגויה", // 88 usernameTooShort: "שם משתמש חייב להיות בן 3 תוים לפחות", // 89 passwordTooShort: "סיסמא חייבת להיות בת 6 תווים לפחות", // 90 passwordsDontMatch: "סיסמאות לא תואמות", // 91 newPasswordSameAsOld: "סיסמא חדשה וישנה חייבות להיות שונות", // 92 signupsForbidden: "אין אפשרות לרישום" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/sv.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("sv", { // 1 resetPasswordDialog: { // 2 title: "Återställ ditt lösenord", // 3 newPassword: "Nytt lösenord", // 4 cancel: "Avbryt", // 5 submit: "Spara lösenord" // 6 }, // 7 enrollAccountDialog: { // 8 title: "Välj ett lösenord", // 9 newPassword: "Nytt lösenord", // 10 cancel: "Stäng", // 11 submit: "Spara lösenord" // 12 }, // 13 justVerifiedEmailDialog: { // 14 verified: "Epostadressen verifierades", // 15 dismiss: "Avfärda" // 16 }, // 17 loginButtonsMessagesDialog: { // 18 dismiss: "Avfärda", // 19 }, // 20 loginButtonsLoggedInDropdownActions: { // 21 password: "Byt lösenord", // 22 signOut: "Logga ut" // 23 }, // 24 loginButtonsLoggedOutDropdown: { // 25 signIn: "Logga in", // 26 up: "Skapa konto" // 27 }, // 28 loginButtonsLoggedOutPasswordServiceSeparator: { // 29 or: "eller" // 30 }, // 31 loginButtonsLoggedOutPasswordService: { // 32 create: "Skapa", // 33 signIn: "Logga in", // 34 forgot: "Glömt ditt lösenord?", // 35 createAcc: "Skapa konto" // 36 }, // 37 forgotPasswordForm: { // 38 email: "E-postadress", // 39 reset: "Återställ lösenord", // 40 sent: "E-post skickat", // 41 invalidEmail: "Ogiltig e-postadress" // 42 }, // 43 loginButtonsBackToLoginLink: { // 44 back: "Avbryt" // 45 }, // 46 loginButtonsChangePassword: { // 47 submit: "Byt lösenord", // 48 cancel: "Avbryt" // 49 }, // 50 loginButtonsLoggedOutSingleLoginButton: { // 51 signInWith: "Logga in med", // 52 configure: "Konfigurera", // 53 }, // 54 loginButtonsLoggedInSingleLogoutButton: { // 55 signOut: "Logga ut" // 56 }, // 57 loginButtonsLoggedOut: { // 58 noLoginServices: "Inga inloggningstjänster har konfigurerats" // 59 }, // 60 loginFields: { // 61 usernameOrEmail: "Användarnamn eller e-postadress", // 62 username: "Användarnamn", // 63 email: "E-postadress", // 64 password: "Lösenord" // 65 }, // 66 signupFields: { // 67 username: "Användarnamn", // 68 email: "E-postadress", // 69 emailOpt: "E-postadress (valfritt)", // 70 password: "Lösenord", // 71 passwordAgain: "Upprepa lösenord" // 72 }, // 73 changePasswordFields: { // 74 currentPassword: "Nuvarande lösenord", // 75 newPassword: "Nytt lösenord", // 76 newPasswordAgain: "Upprepa nytt lösenord" // 77 }, // 78 infoMessages : { // 79 emailSent: "E-post skickat", // 80 passwordChanged: "Lösenord ändrat" // 81 }, // 82 errorMessages: { // 83 genericTitle: "Ett fel har uppstått", // 84 userNotFound: "Ingen användare hittades", // 85 invalidEmail: "Ogiltig e-postadress", // 86 incorrectPassword: "Fel lösenord", // 87 usernameTooShort: "Användarnamnet måste vara minst 3 tecken långt", // 88 passwordTooShort: "Lösenordet bör vara längre än 6 tecken", // 89 passwordsDontMatch: "Lösenorden matchar inte", // 90 newPasswordSameAsOld: "Den nya och gamla lösenordet bör inte vara samma", // 91 signupsForbidden: "Sign up är inte tillåtet" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/ua.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map('ua', { // 1 resetPasswordDialog: { // 2 title: "Скинути пароль", // 3 newPassword: "Новий пароль", // 4 newPasswordAgain: "Новий пароль (ще раз)", // 5 cancel: "Скасувати", // 6 submit: "Зберегти пароль" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Обрати пароль", // 10 newPassword: "Новий пароль", // 11 newPasswordAgain: "Новий пароль (ще раз)", // 12 cancel: "Скасувати", // 13 submit: "Зберегти пароль" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Email підтверджено", // 17 dismiss: "Закрити" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Закрити" // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Змінити пароль", // 24 signOut: "Вийти" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Ввійти", // 28 up: "Зареєструватись" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "або" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Створити", // 35 signIn: "Ввійти", // 36 forgot: "Забули пароль?", // 37 createAcc: "Створити аккаунт" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Скинути пароль", // 42 invalidEmail: "Некорректный email" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Скасувати" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Змінити пароль", // 49 cancel: "Скасувати" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Ввійти через", // 53 configure: "Налаштувати вхід через", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Вийти" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Сервіс для входу не налаштований" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Им’я користувача або email", // 63 username: "Им’я користувача", // 64 email: "Email", // 65 password: "Пароль" // 66 }, // 67 signupFields: { // 68 username: "Им’я користувача", // 69 email: "Email", // 70 emailOpt: "Email (необов’язковий)", // 71 password: "Пароль", // 72 passwordAgain: "Пароль (ще раз)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Поточний пароль", // 76 newPassword: "Новий пароль", // 77 newPasswordAgain: "Новий пароль (ще раз)" // 78 }, // 79 infoMessages : { // 80 sent: "Вам відправлено лист", // 81 passwordChanged: "Пароль змінено" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Там була помилка", // 85 userNotFound: "Користувача не знайдено", // 86 invalidEmail: "Некорректний email", // 87 incorrectPassword: "Невірний пароль", // 88 usernameTooShort: "Им’я користувача повинно бути довжиною не менше 3-ьох символів", // 89 passwordTooShort: "Пароль повинен бути довжиною не менше 6-ти символів", // 90 passwordsDontMatch: "Паролі не співпадають", // 91 newPasswordSameAsOld: "Новий та старий паролі повинні бути різними" // 92 } // 93 }); // 94 // 95 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/fi.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("fi", { // 1 resetPasswordDialog: { // 2 title: "Palauta salasana", // 3 newPassword: "Uusi salasana", // 4 newPasswordAgain: "Uusi salasana (uudestaan)", // 5 cancel: "Peruuta", // 6 submit: "Aseta salasana" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Valitse salasana", // 10 newPassword: "Uusi salasana", // 11 newPasswordAgain: "Uusi salasana (uudestaan)", // 12 cancel: "Sulje", // 13 submit: "Aseta salasana" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Sähköpostiosoite vahvistettu", // 17 dismiss: "Sulje" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Sulje", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Vaihda salasana", // 24 signOut: "Kirjaudu ulos" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Kirjaudu", // 28 up: "Rekisteröidy" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "tai" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Luo", // 35 signIn: "Kirjaudu", // 36 forgot: "Unohditko salasanasi?", // 37 createAcc: "Luo tunnus" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Sähköpostiosoite", // 41 reset: "Palauta salasana", // 42 invalidEmail: "Virheellinen sähköpostiosoite" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Peruuta" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Vaihda salasana", // 49 cancel: "Peruuta" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Kirjaudu käyttäen", // 53 configure: "Konfiguroi", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Kirjaudu ulos" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Kirjautumispalveluita ei konfiguroituna" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Käyttäjätunnus tai sähköpostiosoite", // 63 username: "Käyttäjätunnus", // 64 email: "Sähköpostiosoite", // 65 password: "Salasana" // 66 }, // 67 signupFields: { // 68 username: "Käyttäjätunnus", // 69 email: "Sähköpostiosoite", // 70 emailOpt: "Sähköposti (vapaaehtoinen)", // 71 password: "Salasana", // 72 passwordAgain: "Salasana (uudestaan)" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Nykyinen salasana", // 76 newPassword: "Uusi salasana", // 77 newPasswordAgain: "Uusi salasana (uudestaan)" // 78 }, // 79 infoMessages : { // 80 emailSent: "Sähköposti lähetetty", // 81 passwordChanged: "Salasana vaihdettu" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Tapahtui virhe", // 85 userNotFound: "Käyttäjää ei löytynyt", // 86 invalidEmail: "Virheellinen sähköpostiosoite", // 87 incorrectPassword: "Virheellinen salasana", // 88 usernameTooShort: "Käyttäjätunnuksen on oltava vähintään 3 merkkiä pitkä", // 89 passwordTooShort: "Salasanan on oltava vähintään 6 merkkiä pitkä", // 90 passwordsDontMatch: "Salasanat eivät täsmää", // 91 newPasswordSameAsOld: "Uuden ja vanhan salasanan on oltava eri", // 92 signupsForbidden: "Rekisteröityminen estetty" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/vi.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map("vi", { // 1 resetPasswordDialog: { // 2 title: "Đặt lại mật khẩu", // 3 newPassword: "Mật khẩu mới", // 4 newPasswordAgain: "Xác nhận mật khẩu mới", // 5 cancel: "Thoát", // 6 submit: "Lưu lại" // 7 }, // 8 enrollAccountDialog: { // 9 title: "Cài đặt mật khẩu", // 10 newPassword: "Mật khẩu mới", // 11 newPasswordAgain: "Xác nhận mật khẩu mới", // 12 cancel: "Thoát", // 13 submit: "Lưu lại" // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: "Địa chỉ Email đã được xác nhận.", // 17 dismiss: "Đóng" // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: "Đóng", // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: "Thay đổi mật khẩu", // 24 signOut: "Đăng xuất" // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: "Đăng nhập", // 28 up: "Đăng ký" // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: "hoặc" // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: "Tạo mới", // 35 signIn: "Đăng nhập", // 36 forgot: "Quên mật khẩu?", // 37 createAcc: "Khởi tạo tài khoản" // 38 }, // 39 forgotPasswordForm: { // 40 email: "Email", // 41 reset: "Cài lại mật khẩu", // 42 invalidEmail: "Email không hợp lệ" // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: "Thoát" // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: "Lưu lại", // 49 cancel: "Thoát" // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: "Đăng nhập bằng", // 53 configure: "Cấu hình", // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: "Đăng xuất" // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: "Không có dịch vụ nào được cấu hình" // 60 }, // 61 loginFields: { // 62 usernameOrEmail: "Tên đăng nhập hoặc Email", // 63 username: "Tên đăg nhập", // 64 email: "Email", // 65 password: "Mật khẩu" // 66 }, // 67 signupFields: { // 68 username: "Tên đăng nhập", // 69 email: "Email", // 70 emailOpt: "Email (Không bắt buộc)", // 71 password: "Mật khẩu", // 72 passwordAgain: "Xác nhận mật khẩu" // 73 }, // 74 changePasswordFields: { // 75 currentPassword: "Mật khẩu hiện tại", // 76 newPassword: "Mật khẩu mới", // 77 newPasswordAgain: "Xác nhận mật khẩu mới" // 78 }, // 79 infoMessages : { // 80 emailSent: "Gửi Email", // 81 passwordChanged: "Mật khẩu đã được thay đổi" // 82 }, // 83 errorMessages: { // 84 genericTitle: "Có lỗi xảy ra", // 85 userNotFound: "Người dùng không tồn tại", // 86 invalidEmail: "Email không hợp lệ", // 87 incorrectPassword: "Sai mật khẩu", // 88 usernameTooShort: "Tên đăng nhập phải có ít nhất 3 ký tự", // 89 passwordTooShort: "Mật khẩu phải có ít nhất 6 ký tự", // 90 passwordsDontMatch: "Xác nhận mật khẩu không khớp", // 91 newPasswordSameAsOld: "Mật khẩu mới và cũ phải khác nhau", // 92 signupsForbidden: "Tạm khoá đăng ký" // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n/sk.i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.map('sk', { // 1 resetPasswordDialog: { // 2 title: 'Obnovenie hesla', // 3 newPassword: 'Nové heslo', // 4 newPasswordAgain: 'Nové heslo (opakujte)', // 5 cancel: 'Zrušiť', // 6 submit: 'Zmeniť heslo' // 7 }, // 8 enrollAccountDialog: { // 9 title: 'Nastaviť heslo', // 10 newPassword: 'Nové heslo', // 11 newPasswordAgain: 'Nové heslo (opakujte)', // 12 cancel: 'Zatvoriť', // 13 submit: 'Nastaviť heslo' // 14 }, // 15 justVerifiedEmailDialog: { // 16 verified: 'Emailová adresa overená', // 17 dismiss: 'Zavrieť' // 18 }, // 19 loginButtonsMessagesDialog: { // 20 dismiss: 'Zrušiť' // 21 }, // 22 loginButtonsLoggedInDropdownActions: { // 23 password: 'Zmeniť heslo', // 24 signOut: 'Odhlásiť' // 25 }, // 26 loginButtonsLoggedOutDropdown: { // 27 signIn: 'Prihlásenie', // 28 up: 'Registrovať' // 29 }, // 30 loginButtonsLoggedOutPasswordServiceSeparator: { // 31 or: 'alebo' // 32 }, // 33 loginButtonsLoggedOutPasswordService: { // 34 create: 'Vytvoriť', // 35 signIn: 'Prihlásiť', // 36 forgot: 'Zabudli ste heslo?', // 37 createAcc: 'Vytvoriť účet' // 38 }, // 39 forgotPasswordForm: { // 40 email: 'Email', // 41 reset: 'Obnoviť heslo', // 42 invalidEmail: 'Nesprávný email' // 43 }, // 44 loginButtonsBackToLoginLink: { // 45 back: 'Späť' // 46 }, // 47 loginButtonsChangePassword: { // 48 submit: 'Zmeniť heslo', // 49 cancel: 'Zrušiť' // 50 }, // 51 loginButtonsLoggedOutSingleLoginButton: { // 52 signInWith: 'Prihlasiť s', // 53 configure: 'Nastaviť' // 54 }, // 55 loginButtonsLoggedInSingleLogoutButton: { // 56 signOut: 'Odhlásiť' // 57 }, // 58 loginButtonsLoggedOut: { // 59 noLoginServices: 'Žiadne prihlasovacie služby' // 60 }, // 61 loginFields: { // 62 usernameOrEmail: 'Užívateľské meno alebo email', // 63 username: 'Užívateľské meno', // 64 email: 'Email', // 65 password: 'Heslo' // 66 }, // 67 signupFields: { // 68 username: 'Užívateľské meno', // 69 email: 'Email', // 70 emailOpt: 'Email (voliteľné)', // 71 password: 'Heslo', // 72 passwordAgain: 'Heslo (opakujte)' // 73 }, // 74 changePasswordFields: { // 75 currentPassword: 'Vaše heslo', // 76 newPassword: 'Nové heslo', // 77 newPasswordAgain: 'Nové heslo (opakujte)' // 78 }, // 79 infoMessages: { // 80 emailSent: 'Email odoslaný', // 81 passwordChanged: 'Heslo zmenené' // 82 }, // 83 errorMessages: { // 84 genericTitle: 'Nastala chyba', // 85 userNotFound: 'Užívateľ sa nenašiel', // 86 invalidEmail: 'Nesprávný email', // 87 incorrectPassword: 'Nesprávne heslo', // 88 usernameTooShort: 'Užívateľské meno musi obsahovať minimálne 3 znaky', // 89 passwordTooShort: 'Heslo musi obsahovať minimálne 6 znakov', // 90 passwordsDontMatch: 'Hesla sa nezhodujú', // 91 newPasswordSameAsOld: 'Staré a nové hesla sa nezhodujú', // 92 signupsForbidden: 'Prihlasovanie je zakázané' // 93 } // 94 }); // 95 // 96 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/i18n.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // i18n.setDefaultLanguage('en') // 1 // 2 accountsUIBootstrap3 = { // 3 setLanguage: function (lang) { // 4 return i18n.setLanguage(lang) // 5 }, // 6 getLanguage: function () { // 7 return i18n.getLanguage() // 8 }, // 9 map: function (lang, obj) { // 10 return i18n.map(lang, obj) // 11 } // 12 } // 13 // 14 // 15 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/template.login_buttons.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // 1 Template.__checkName("_loginButtons"); // 2 Template["_loginButtons"] = new Template("Template._loginButtons", (function() { // 3 var view = this; // 4 return Blaze.If(function() { // 5 return Spacebars.call(view.lookup("currentUser")); // 6 }, function() { // 7 return [ "\n ", Blaze.Unless(function() { // 8 return Spacebars.call(view.lookup("loggingIn")); // 9 }, function() { // 10 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedIn")), "\n " ]; // 11 }), "\n " ]; // 12 }, function() { // 13 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOut")), "\n " ]; // 14 }); // 15 })); // 16 // 17 Template.__checkName("_loginButtonsLoggedIn"); // 18 Template["_loginButtonsLoggedIn"] = new Template("Template._loginButtonsLoggedIn", (function() { // 19 var view = this; // 20 return Spacebars.include(view.lookupTemplate("_loginButtonsLoggedInDropdown")); // 21 })); // 22 // 23 Template.__checkName("_loginButtonsLoggedOut"); // 24 Template["_loginButtonsLoggedOut"] = new Template("Template._loginButtonsLoggedOut", (function() { // 25 var view = this; // 26 return Blaze.If(function() { // 27 return Spacebars.call(view.lookup("services")); // 28 }, function() { // 29 return [ " \n ", Blaze.If(function() { // 30 return Spacebars.call(view.lookup("configurationLoaded")); // 31 }, function() { // 32 return [ "\n ", Blaze.If(function() { // 33 return Spacebars.call(view.lookup("dropdown")); // 34 }, function() { // 35 return [ " \n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOutDropdown")), "\n " ]; // 36 }, function() { // 37 return [ "\n ", Spacebars.With(function() { // 38 return Spacebars.call(view.lookup("singleService")); // 39 }, function() { // 40 return [ " \n ", Blaze.Unless(function() { // 41 return Spacebars.call(view.lookup("logginIn")); // 42 }, function() { // 43 return [ "\n ", HTML.DIV({ // 44 "class": "navbar-form" // 45 }, "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOutSingleLoginButton")), "\n "), "\n " ]; }), "\n " ]; // 47 }), "\n " ]; // 48 }), "\n " ]; // 49 }), "\n " ]; // 50 }, function() { // 51 return [ "\n ", HTML.DIV({ // 52 "class": "no-services" // 53 }, Blaze.View("lookup:i18n", function() { // 54 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOut.noLoginServices"); // 55 })), "\n " ]; // 56 }); // 57 })); // 58 // 59 Template.__checkName("_loginButtonsMessages"); // 60 Template["_loginButtonsMessages"] = new Template("Template._loginButtonsMessages", (function() { // 61 var view = this; // 62 return [ Blaze.If(function() { // 63 return Spacebars.call(view.lookup("errorMessage")); // 64 }, function() { // 65 return [ "\n ", HTML.DIV({ // 66 "class": "alert alert-danger" // 67 }, Blaze.View("lookup:errorMessage", function() { // 68 return Spacebars.mustache(view.lookup("errorMessage")); // 69 })), "\n " ]; // 70 }), "\n ", Blaze.If(function() { // 71 return Spacebars.call(view.lookup("infoMessage")); // 72 }, function() { // 73 return [ "\n ", HTML.DIV({ // 74 "class": "alert alert-success no-margin" // 75 }, Blaze.View("lookup:infoMessage", function() { // 76 return Spacebars.mustache(view.lookup("infoMessage")); // 77 })), "\n " ]; // 78 }) ]; // 79 })); // 80 // 81 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/template.login_buttons_single.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // 1 Template.__checkName("_loginButtonsLoggedOutSingleLoginButton"); // 2 Template["_loginButtonsLoggedOutSingleLoginButton"] = new Template("Template._loginButtonsLoggedOutSingleLoginButton", (function() { var view = this; // 4 return Blaze.If(function() { // 5 return Spacebars.call(view.lookup("configured")); // 6 }, function() { // 7 return [ "\n ", HTML.BUTTON({ // 8 "class": function() { // 9 return [ "login-button btn btn-block btn-", Spacebars.mustache(view.lookup("capitalizedName")) ]; // 10 } // 11 }, Blaze.View("lookup:i18n", function() { // 12 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutSingleLoginButton.signInWith"); // 13 }), " ", Blaze.View("lookup:capitalizedName", function() { // 14 return Spacebars.mustache(view.lookup("capitalizedName")); // 15 })), "\n " ]; // 16 }, function() { // 17 return [ "\n ", HTML.BUTTON({ // 18 "class": "login-button btn btn-block configure-button btn-danger" // 19 }, Blaze.View("lookup:i18n", function() { // 20 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutSingleLoginButton.configure"); // 21 }), " ", Blaze.View("lookup:capitalizedName", function() { // 22 return Spacebars.mustache(view.lookup("capitalizedName")); // 23 })), "\n " ]; // 24 }); // 25 })); // 26 // 27 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/template.login_buttons_dropdown.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // 1 Template.__checkName("_loginButtonsLoggedInDropdown"); // 2 Template["_loginButtonsLoggedInDropdown"] = new Template("Template._loginButtonsLoggedInDropdown", (function() { // 3 var view = this; // 4 return HTML.LI({ // 5 id: "login-dropdown-list", // 6 "class": "dropdown" // 7 }, "\n ", HTML.A({ // 8 "class": "dropdown-toggle", // 9 "data-toggle": "dropdown" // 10 }, "\n ", Blaze.View("lookup:displayName", function() { // 11 return Spacebars.mustache(view.lookup("displayName")); // 12 }), "\n ", Spacebars.With(function() { // 13 return Spacebars.call(view.lookup("user_profile_picture")); // 14 }, function() { // 15 return [ "\n ", HTML.IMG({ // 16 src: function() { // 17 return Spacebars.mustache(view.lookup(".")); // 18 }, // 19 width: "30px", // 20 height: "30px", // 21 "class": "img-circle", // 22 alt: "#" // 23 }), "\n " ]; // 24 }), "\n ", HTML.Raw('<b class="caret"></b>'), "\n "), "\n ", HTML.DIV({ // 25 "class": "dropdown-menu" // 26 }, "\n ", Blaze.If(function() { // 27 return Spacebars.call(view.lookup("inMessageOnlyFlow")); // 28 }, function() { // 29 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n " ]; // 30 }, function() { // 31 return [ "\n ", Blaze.If(function() { // 32 return Spacebars.call(view.lookup("inChangePasswordFlow")); // 33 }, function() { // 34 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsChangePassword")), "\n " ]; // 35 }, function() { // 36 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedInDropdownActions")), "\n " ]; }), "\n " ]; // 38 }), "\n "), "\n "); // 39 })); // 40 // 41 Template.__checkName("_loginButtonsLoggedInDropdownActions"); // 42 Template["_loginButtonsLoggedInDropdownActions"] = new Template("Template._loginButtonsLoggedInDropdownActions", (function() { var view = this; // 44 return [ Blaze.If(function() { // 45 return Spacebars.call(view.lookup("additionalLoggedInDropdownActions")); // 46 }, function() { // 47 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsAdditionalLoggedInDropdownActions")), "\n " ]; }), "\n\n ", Blaze.If(function() { // 49 return Spacebars.call(view.lookup("allowChangingPassword")); // 50 }, function() { // 51 return [ "\n ", HTML.BUTTON({ // 52 "class": "btn btn-default btn-block", // 53 id: "login-buttons-open-change-password" // 54 }, Blaze.View("lookup:i18n", function() { // 55 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedInDropdownActions.password"); // 56 })), "\n " ]; // 57 }), "\n\n ", HTML.BUTTON({ // 58 "class": "btn btn-block btn-primary", // 59 id: "login-buttons-logout" // 60 }, Blaze.View("lookup:i18n", function() { // 61 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedInDropdownActions.signOut"); // 62 })) ]; // 63 })); // 64 // 65 Template.__checkName("_loginButtonsLoggedOutDropdown"); // 66 Template["_loginButtonsLoggedOutDropdown"] = new Template("Template._loginButtonsLoggedOutDropdown", (function() { // 67 var view = this; // 68 return HTML.LI({ // 69 id: "login-dropdown-list", // 70 "class": "dropdown" // 71 }, "\n ", HTML.A({ // 72 "class": "dropdown-toggle", // 73 "data-toggle": "dropdown" // 74 }, Blaze.View("lookup:i18n", function() { // 75 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutDropdown.signIn"); // 76 }), Blaze.Unless(function() { // 77 return Spacebars.call(view.lookup("forbidClientAccountCreation")); // 78 }, function() { // 79 return [ " / ", Blaze.View("lookup:i18n", function() { // 80 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutDropdown.up"); // 81 }) ]; // 82 }), " ", HTML.Raw('<b class="caret"></b>')), "\n ", HTML.DIV({ // 83 "class": "dropdown-menu" // 84 }, "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOutAllServices")), "\n "), "\n "); // 85 })); // 86 // 87 Template.__checkName("_loginButtonsLoggedOutAllServices"); // 88 Template["_loginButtonsLoggedOutAllServices"] = new Template("Template._loginButtonsLoggedOutAllServices", (function() { var view = this; // 90 return Blaze.Each(function() { // 91 return Spacebars.call(view.lookup("services")); // 92 }, function() { // 93 return [ "\n ", Blaze.Unless(function() { // 94 return Spacebars.call(view.lookup("hasPasswordService")); // 95 }, function() { // 96 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n " ]; // 97 }), "\n ", Blaze.If(function() { // 98 return Spacebars.call(view.lookup("isPasswordService")); // 99 }, function() { // 100 return [ "\n ", Blaze.If(function() { // 101 return Spacebars.call(view.lookup("hasOtherServices")); // 102 }, function() { // 103 return [ " \n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOutPasswordServiceSeparator")), "\n " ]; }), "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOutPasswordService")), "\n " ]; // 105 }, function() { // 106 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsLoggedOutSingleLoginButton")), "\n " ]; // 107 }), "\n " ]; // 108 }); // 109 })); // 110 // 111 Template.__checkName("_loginButtonsLoggedOutPasswordServiceSeparator"); // 112 Template["_loginButtonsLoggedOutPasswordServiceSeparator"] = new Template("Template._loginButtonsLoggedOutPasswordServiceSeparator", (function() { var view = this; // 114 return HTML.DIV({ // 115 "class": "or" // 116 }, HTML.Raw('\n <span class="hline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>\n '), HTML.SPAN({ "class": "or-text" // 118 }, Blaze.View("lookup:i18n", function() { // 119 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutPasswordServiceSeparator.or"); // 120 })), HTML.Raw('\n <span class="hline">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>\n ')); // 121 })); // 122 // 123 Template.__checkName("_loginButtonsLoggedOutPasswordService"); // 124 Template["_loginButtonsLoggedOutPasswordService"] = new Template("Template._loginButtonsLoggedOutPasswordService", (function() { var view = this; // 126 return Blaze.If(function() { // 127 return Spacebars.call(view.lookup("inForgotPasswordFlow")); // 128 }, function() { // 129 return [ "\n ", Spacebars.include(view.lookupTemplate("_forgotPasswordForm")), "\n " ]; // 130 }, function() { // 131 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n ", Blaze.Each(function() { return Spacebars.call(view.lookup("fields")); // 133 }, function() { // 134 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsFormField")), "\n " ]; // 135 }), "\n ", HTML.BUTTON({ // 136 "class": "btn btn-primary col-xs-12 col-sm-12", // 137 id: "login-buttons-password", // 138 type: "button" // 139 }, "\n ", Blaze.If(function() { // 140 return Spacebars.call(view.lookup("inSignupFlow")); // 141 }, function() { // 142 return [ "\n ", Blaze.View("lookup:i18n", function() { // 143 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutPasswordService.create"); // 144 }), "\n " ]; // 145 }, function() { // 146 return [ "\n ", Blaze.View("lookup:i18n", function() { // 147 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutPasswordService.signIn"); // 148 }), "\n " ]; // 149 }), "\n "), "\n ", Blaze.If(function() { // 150 return Spacebars.call(view.lookup("inLoginFlow")); // 151 }, function() { // 152 return [ "\n ", HTML.DIV({ // 153 id: "login-other-options" // 154 }, "\n ", Blaze.If(function() { // 155 return Spacebars.call(view.lookup("showForgotPasswordLink")); // 156 }, function() { // 157 return [ "\n ", HTML.A({ // 158 id: "forgot-password-link", // 159 "class": "pull-left" // 160 }, Blaze.View("lookup:i18n", function() { // 161 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutPasswordService.forgot"); // 162 })), "\n " ]; // 163 }), "\n ", Blaze.If(function() { // 164 return Spacebars.call(view.lookup("showCreateAccountLink")); // 165 }, function() { // 166 return [ "\n ", HTML.A({ // 167 id: "signup-link", // 168 "class": "pull-right" // 169 }, Blaze.View("lookup:i18n", function() { // 170 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsLoggedOutPasswordService.createAcc"); // 171 })), "\n " ]; // 172 }), "\n "), "\n " ]; // 173 }), "\n ", Blaze.If(function() { // 174 return Spacebars.call(view.lookup("inSignupFlow")); // 175 }, function() { // 176 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsBackToLoginLink")), "\n " ]; // 177 }), "\n " ]; // 178 }); // 179 })); // 180 // 181 Template.__checkName("_forgotPasswordForm"); // 182 Template["_forgotPasswordForm"] = new Template("Template._forgotPasswordForm", (function() { // 183 var view = this; // 184 return HTML.DIV({ // 185 "class": "login-form" // 186 }, "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n ", HTML.DIV({ // 187 id: "forgot-password-email-label-and-input" // 188 }, " \n ", HTML.INPUT({ // 189 id: "forgot-password-email", // 190 type: "email", // 191 placeholder: function() { // 192 return Spacebars.mustache(view.lookup("i18n"), "forgotPasswordForm.email"); // 193 }, // 194 "class": "form-control" // 195 }), "\n "), "\n ", HTML.BUTTON({ // 196 "class": "btn btn-primary login-button-form-submit col-xs-12 col-sm-12", // 197 id: "login-buttons-forgot-password" // 198 }, Blaze.View("lookup:i18n", function() { // 199 return Spacebars.mustache(view.lookup("i18n"), "forgotPasswordForm.reset"); // 200 })), "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsBackToLoginLink")), "\n "); // 201 })); // 202 // 203 Template.__checkName("_loginButtonsBackToLoginLink"); // 204 Template["_loginButtonsBackToLoginLink"] = new Template("Template._loginButtonsBackToLoginLink", (function() { // 205 var view = this; // 206 return HTML.BUTTON({ // 207 id: "back-to-login-link", // 208 "class": "btn btn-default col-xs-12 col-sm-12" // 209 }, Blaze.View("lookup:i18n", function() { // 210 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsBackToLoginLink.back"); // 211 })); // 212 })); // 213 // 214 Template.__checkName("_loginButtonsFormField"); // 215 Template["_loginButtonsFormField"] = new Template("Template._loginButtonsFormField", (function() { // 216 var view = this; // 217 return Blaze.If(function() { // 218 return Spacebars.call(view.lookup("visible")); // 219 }, function() { // 220 return [ "\n ", HTML.Comment(" TODO: Implement more input types "), "\n ", Blaze.If(function() { // 221 return Spacebars.dataMustache(view.lookup("equals"), view.lookup("inputType"), "checkbox"); // 222 }, function() { // 223 return [ "\n ", HTML.DIV({ // 224 "class": "checkbox" // 225 }, "\n ", HTML.LABEL(HTML.INPUT({ // 226 type: "checkbox", // 227 id: function() { // 228 return [ "login-", Spacebars.mustache(view.lookup("fieldName")) ]; // 229 }, // 230 name: function() { // 231 return [ "login-", Spacebars.mustache(view.lookup("fieldName")) ]; // 232 }, // 233 value: "true" // 234 }), "\n ", Blaze.View("lookup:fieldLabel", function() { // 235 return Spacebars.makeRaw(Spacebars.mustache(view.lookup("fieldLabel"))); // 236 })), "\n "), "\n " ]; // 237 }), "\n\n ", Blaze.If(function() { // 238 return Spacebars.dataMustache(view.lookup("equals"), view.lookup("inputType"), "select"); // 239 }, function() { // 240 return [ "\n ", HTML.DIV({ // 241 "class": "select-dropdown" // 242 }, "\n ", Blaze.If(function() { // 243 return Spacebars.call(view.lookup("showFieldLabel")); // 244 }, function() { // 245 return [ "\n ", HTML.LABEL(Blaze.View("lookup:fieldLabel", function() { // 246 return Spacebars.mustache(view.lookup("fieldLabel")); // 247 })), HTML.BR(), "\n " ]; // 248 }), "\n ", HTML.SELECT({ // 249 id: function() { // 250 return [ "login-", Spacebars.mustache(view.lookup("fieldName")) ]; // 251 } // 252 }, "\n ", Blaze.If(function() { // 253 return Spacebars.call(view.lookup("empty")); // 254 }, function() { // 255 return [ "\n ", HTML.OPTION({ // 256 value: "" // 257 }, Blaze.View("lookup:empty", function() { // 258 return Spacebars.mustache(view.lookup("empty")); // 259 })), "\n " ]; // 260 }), "\n ", Blaze.Each(function() { // 261 return Spacebars.call(view.lookup("data")); // 262 }, function() { // 263 return [ "\n ", HTML.OPTION({ // 264 value: function() { // 265 return Spacebars.mustache(view.lookup("value")); // 266 } // 267 }, Blaze.View("lookup:label", function() { // 268 return Spacebars.mustache(view.lookup("label")); // 269 })), "\n " ]; // 270 }), "\n "), "\n "), "\n " ]; // 271 }), "\n\n ", Blaze.If(function() { // 272 return Spacebars.dataMustache(view.lookup("equals"), view.lookup("inputType"), "radio"); // 273 }, function() { // 274 return [ "\n ", HTML.DIV({ // 275 "class": "radio" // 276 }, "\n ", Blaze.If(function() { // 277 return Spacebars.call(view.lookup("showFieldLabel")); // 278 }, function() { // 279 return [ "\n ", HTML.LABEL(Blaze.View("lookup:fieldLabel", function() { // 280 return Spacebars.mustache(view.lookup("fieldLabel")); // 281 })), HTML.BR(), "\n " ]; // 282 }), "\n ", Blaze.Each(function() { // 283 return Spacebars.call(view.lookup("data")); // 284 }, function() { // 285 return [ "\n ", HTML.LABEL(HTML.INPUT(HTML.Attrs({ // 286 type: "radio", // 287 id: function() { // 288 return [ "login-", Spacebars.mustache(Spacebars.dot(view.lookup(".."), "fieldName")), "-", Spacebars.mustache(view.lookup("id")) ]; }, // 290 name: function() { // 291 return [ "login-", Spacebars.mustache(Spacebars.dot(view.lookup(".."), "fieldName")) ]; // 292 }, // 293 value: function() { // 294 return Spacebars.mustache(view.lookup("value")); // 295 } // 296 }, function() { // 297 return Spacebars.attrMustache(view.lookup("checked")); // 298 })), " ", Blaze.View("lookup:label", function() { // 299 return Spacebars.mustache(view.lookup("label")); // 300 })), "\n ", Blaze.If(function() { // 301 return Spacebars.dataMustache(view.lookup("equals"), Spacebars.dot(view.lookup(".."), "radioLayout"), "vertical"); }, function() { // 303 return [ "\n ", HTML.BR(), "\n " ]; // 304 }), "\n " ]; // 305 }), "\n "), "\n " ]; // 306 }), "\n\n ", Blaze.If(function() { // 307 return Spacebars.call(view.lookup("inputTextual")); // 308 }, function() { // 309 return [ "\n ", HTML.INPUT({ // 310 id: function() { // 311 return [ "login-", Spacebars.mustache(view.lookup("fieldName")) ]; // 312 }, // 313 type: function() { // 314 return Spacebars.mustache(view.lookup("inputType")); // 315 }, // 316 placeholder: function() { // 317 return Spacebars.mustache(view.lookup("fieldLabel")); // 318 }, // 319 "class": "form-control" // 320 }), "\n " ]; // 321 }), "\n " ]; // 322 }); // 323 })); // 324 // 325 Template.__checkName("_loginButtonsChangePassword"); // 326 Template["_loginButtonsChangePassword"] = new Template("Template._loginButtonsChangePassword", (function() { // 327 var view = this; // 328 return [ Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n ", Blaze.Each(function() { // 329 return Spacebars.call(view.lookup("fields")); // 330 }, function() { // 331 return [ "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsFormField")), "\n " ]; // 332 }), "\n ", HTML.BUTTON({ // 333 "class": "btn btn-block btn-primary", // 334 id: "login-buttons-do-change-password" // 335 }, Blaze.View("lookup:i18n", function() { // 336 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsChangePassword.submit"); // 337 })), "\n ", HTML.BUTTON({ // 338 "class": "btn btn-block btn-default", // 339 id: "login-buttons-cancel-change-password" // 340 }, Blaze.View("lookup:i18n", function() { // 341 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsChangePassword.cancel"); // 342 })) ]; // 343 })); // 344 // 345 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/template.login_buttons_dialogs.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // 1 Template.body.addContent((function() { // 2 var view = this; // 3 return [ Spacebars.include(view.lookupTemplate("_resetPasswordDialog")), "\n ", Spacebars.include(view.lookupTemplate("_enrollAccountDialog")), "\n ", Spacebars.include(view.lookupTemplate("_justVerifiedEmailDialog")), "\n ", Spacebars.include(view.lookupTemplate("_configureLoginServiceDialog")), "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessagesDialog")) ]; })); // 5 Meteor.startup(Template.body.renderToDocument); // 6 // 7 Template.__checkName("_resetPasswordDialog"); // 8 Template["_resetPasswordDialog"] = new Template("Template._resetPasswordDialog", (function() { // 9 var view = this; // 10 return [ Blaze.If(function() { // 11 return Spacebars.call(view.lookup("inResetPasswordFlow")); // 12 }, function() { // 13 return [ "\n ", HTML.DIV({ // 14 "class": "modal", // 15 id: "login-buttons-reset-password-modal" // 16 }, "\n ", HTML.DIV({ // 17 "class": "modal-dialog" // 18 }, "\n ", HTML.DIV({ // 19 "class": "modal-content" // 20 }, "\n ", HTML.DIV({ // 21 "class": "modal-header" // 22 }, "\n ", HTML.BUTTON({ // 23 type: "button", // 24 "class": "close", // 25 "data-dismiss": "modal", // 26 "aria-hidden": "true" // 27 }, HTML.CharRef({ // 28 html: "&times;", // 29 str: "×" // 30 })), "\n ", HTML.H4({ // 31 "class": "modal-title" // 32 }, Blaze.View("lookup:i18n", function() { // 33 return Spacebars.mustache(view.lookup("i18n"), "resetPasswordDialog.title"); // 34 })), "\n "), "\n ", HTML.DIV({ // 35 "class": "modal-body" // 36 }, "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n ", HTML.INPUT({ // 37 id: "reset-password-new-password", // 38 "class": "form-control", // 39 type: "password", // 40 placeholder: function() { // 41 return Spacebars.mustache(view.lookup("i18n"), "resetPasswordDialog.newPassword"); // 42 } // 43 }), HTML.BR(), "\n ", HTML.INPUT({ // 44 id: "reset-password-new-password-again", // 45 "class": "form-control", // 46 type: "password", // 47 placeholder: function() { // 48 return Spacebars.mustache(view.lookup("i18n"), "resetPasswordDialog.newPasswordAgain"); // 49 } // 50 }), HTML.BR(), "\n "), "\n ", HTML.DIV({ // 51 "class": "modal-footer" // 52 }, "\n ", HTML.A({ // 53 "class": "btn btn-default", // 54 id: "login-buttons-cancel-reset-password" // 55 }, Blaze.View("lookup:i18n", function() { // 56 return Spacebars.mustache(view.lookup("i18n"), "resetPasswordDialog.cancel"); // 57 })), "\n ", HTML.BUTTON({ // 58 "class": "btn btn-primary", // 59 id: "login-buttons-reset-password-button" // 60 }, "\n ", Blaze.View("lookup:i18n", function() { // 61 return Spacebars.mustache(view.lookup("i18n"), "resetPasswordDialog.submit"); // 62 }), "\n "), "\n "), "\n "), HTML.Comment(" /.modal-content "), "\n "), HTML.Comment(" /.modal-dalog "), "\n "), HTML.Comment(" /.modal "), "\n " ]; }), "\n\n ", HTML.DIV({ // 64 "class": "modal", // 65 id: "login-buttons-reset-password-modal-success" // 66 }, "\n ", HTML.DIV({ // 67 "class": "modal-dialog" // 68 }, "\n ", HTML.DIV({ // 69 "class": "modal-content" // 70 }, "\n ", HTML.DIV({ // 71 "class": "modal-header" // 72 }, "\n ", HTML.Raw('<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>'), "\n ", HTML.H4({ "class": "modal-title" // 74 }, Blaze.View("lookup:i18n", function() { // 75 return Spacebars.mustache(view.lookup("i18n"), "resetPasswordDialog.title"); // 76 })), "\n "), "\n ", HTML.DIV({ // 77 "class": "modal-body" // 78 }, "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n "), "\n ", HTML.DIV({ // 79 "class": "modal-footer" // 80 }, "\n ", HTML.A({ // 81 "class": "btn btn-default", // 82 id: "login-buttons-dismiss-reset-password-success" // 83 }, Blaze.View("lookup:i18n", function() { // 84 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsMessagesDialog.dismiss"); // 85 })), "\n "), "\n "), HTML.Raw("<!-- /.modal-content -->"), "\n "), HTML.Raw("<!-- /.modal-dalog -->"), "\n "), HTML.Raw("<!-- /.modal -->") ]; })); // 87 // 88 Template.__checkName("_enrollAccountDialog"); // 89 Template["_enrollAccountDialog"] = new Template("Template._enrollAccountDialog", (function() { // 90 var view = this; // 91 return Blaze.If(function() { // 92 return Spacebars.call(view.lookup("inEnrollAccountFlow")); // 93 }, function() { // 94 return [ "\n ", HTML.DIV({ // 95 "class": "modal", // 96 id: "login-buttons-enroll-account-modal" // 97 }, "\n ", HTML.DIV({ // 98 "class": "modal-dialog" // 99 }, "\n ", HTML.DIV({ // 100 "class": "modal-content" // 101 }, "\n ", HTML.DIV({ // 102 "class": "modal-header" // 103 }, "\n ", HTML.BUTTON({ // 104 type: "button", // 105 "class": "close", // 106 "data-dismiss": "modal", // 107 "aria-hidden": "true" // 108 }, HTML.CharRef({ // 109 html: "&times;", // 110 str: "×" // 111 })), "\n ", HTML.H4({ // 112 "class": "modal-title" // 113 }, Blaze.View("lookup:i18n", function() { // 114 return Spacebars.mustache(view.lookup("i18n"), "enrollAccountDialog.title"); // 115 })), "\n "), "\n ", HTML.DIV({ // 116 "class": "modal-body" // 117 }, "\n ", HTML.INPUT({ // 118 id: "enroll-account-password", // 119 "class": "form-control", // 120 type: "password", // 121 placeholder: function() { // 122 return Spacebars.mustache(view.lookup("i18n"), "enrollAccountDialog.newPassword"); // 123 } // 124 }), HTML.BR(), "\n ", HTML.INPUT({ // 125 id: "enroll-account-password-again", // 126 "class": "form-control", // 127 type: "password", // 128 placeholder: function() { // 129 return Spacebars.mustache(view.lookup("i18n"), "enrollAccountDialog.newPasswordAgain"); // 130 } // 131 }), HTML.BR(), "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n "), "\n ", HTML.DIV({ "class": "modal-footer" // 133 }, "\n ", HTML.A({ // 134 "class": "btn btn-default", // 135 id: "login-buttons-cancel-enroll-account-button" // 136 }, Blaze.View("lookup:i18n", function() { // 137 return Spacebars.mustache(view.lookup("i18n"), "enrollAccountDialog.cancel"); // 138 })), "\n ", HTML.BUTTON({ // 139 "class": "btn btn-primary", // 140 id: "login-buttons-enroll-account-button" // 141 }, "\n ", Blaze.View("lookup:i18n", function() { // 142 return Spacebars.mustache(view.lookup("i18n"), "enrollAccountDialog.submit"); // 143 }), "\n "), "\n "), "\n "), HTML.Comment(" /.modal-content "), "\n "), HTML.Comment(" /.modal-dalog "), "\n "), HTML.Comment(" /.modal "), "\n " ]; }); // 145 })); // 146 // 147 Template.__checkName("_justVerifiedEmailDialog"); // 148 Template["_justVerifiedEmailDialog"] = new Template("Template._justVerifiedEmailDialog", (function() { // 149 var view = this; // 150 return Blaze.If(function() { // 151 return Spacebars.call(view.lookup("visible")); // 152 }, function() { // 153 return [ "\n ", HTML.DIV({ // 154 "class": "modal", // 155 id: "login-buttons-email-address-verified-modal" // 156 }, "\n ", HTML.DIV({ // 157 "class": "modal-dialog" // 158 }, "\n ", HTML.DIV({ // 159 "class": "modal-content" // 160 }, "\n ", HTML.DIV({ // 161 "class": "modal-body" // 162 }, "\n ", HTML.H4(HTML.B(Blaze.View("lookup:i18n", function() { // 163 return Spacebars.mustache(view.lookup("i18n"), "justVerifiedEmailDialog.verified"); // 164 }))), "\n "), "\n ", HTML.DIV({ // 165 "class": "modal-footer" // 166 }, "\n ", HTML.BUTTON({ // 167 "class": "btn btn-primary login-button", // 168 id: "just-verified-dismiss-button", // 169 "data-dismiss": "modal" // 170 }, Blaze.View("lookup:i18n", function() { // 171 return Spacebars.mustache(view.lookup("i18n"), "justVerifiedEmailDialog.dismiss"); // 172 })), "\n "), "\n "), "\n "), "\n "), "\n " ]; // 173 }); // 174 })); // 175 // 176 Template.__checkName("_configureLoginServiceDialog"); // 177 Template["_configureLoginServiceDialog"] = new Template("Template._configureLoginServiceDialog", (function() { // 178 var view = this; // 179 return Blaze.If(function() { // 180 return Spacebars.call(view.lookup("visible")); // 181 }, function() { // 182 return [ "\n ", HTML.DIV({ // 183 "class": "modal", // 184 id: "configure-login-service-dialog-modal" // 185 }, "\n ", HTML.DIV({ // 186 "class": "modal-dialog" // 187 }, "\n ", HTML.DIV({ // 188 "class": "modal-content" // 189 }, "\n ", HTML.DIV({ // 190 "class": "modal-header" // 191 }, "\n ", HTML.BUTTON({ // 192 type: "button", // 193 "class": "close", // 194 "data-dismiss": "modal", // 195 "aria-label": "Close" // 196 }, HTML.SPAN({ // 197 "aria-hidden": "true" // 198 }, HTML.CharRef({ // 199 html: "&times;", // 200 str: "×" // 201 }))), "\n ", HTML.H4({ // 202 "class": "modal-title" // 203 }, "Configure Service"), "\n "), "\n ", HTML.DIV({ // 204 "class": "modal-body" // 205 }, "\n ", HTML.DIV({ // 206 id: "configure-login-service-dialog", // 207 "class": "accounts-dialog accounts-centered-dialog" // 208 }, "\n ", Spacebars.include(view.lookupTemplate("configurationSteps")), "\n ", HTML.P("\n Now, copy over some details.\n "), "\n ", HTML.P("\n ", HTML.TABLE("\n ", HTML.COLGROUP("\n ", HTML.COL({ span: "1", // 210 "class": "configuration_labels" // 211 }), "\n ", HTML.COL({ // 212 span: "1", // 213 "class": "configuration_inputs" // 214 }), "\n "), "\n ", Blaze.Each(function() { // 215 return Spacebars.call(view.lookup("configurationFields")); // 216 }, function() { // 217 return [ "\n ", HTML.TR("\n ", HTML.TD("\n ", HTML.LABEL({ // 218 "for": function() { // 219 return [ "configure-login-service-dialog-", Spacebars.mustache(view.lookup("property")) ]; // 220 } // 221 }, Blaze.View("lookup:label", function() { // 222 return Spacebars.mustache(view.lookup("label")); // 223 })), "\n "), "\n ", HTML.TD("\n ", HTML.INPUT({ // 224 id: function() { // 225 return [ "configure-login-service-dialog-", Spacebars.mustache(view.lookup("property")) ]; // 226 }, // 227 type: "text" // 228 }), "\n "), "\n "), "\n " ]; // 229 }), "\n "), "\n "), "\n ", HTML.P({ // 230 "class": "new-section" // 231 }, "\n Choose the login style:\n "), "\n ", HTML.P("\n ", HTML.CharRef({ // 232 html: "&emsp;", // 233 str: " " // 234 }), HTML.INPUT({ // 235 id: "configure-login-service-dialog-popupBasedLogin", // 236 type: "radio", // 237 checked: "checked", // 238 name: "loginStyle", // 239 value: "popup" // 240 }), "\n ", HTML.LABEL({ // 241 "for": "configure-login-service-dialog-popupBasedLogin" // 242 }, "Popup-based login (recommended for most applications)"), "\n\n ", HTML.BR(), HTML.CharRef({ // 243 html: "&emsp;", // 244 str: " " // 245 }), HTML.INPUT({ // 246 id: "configure-login-service-dialog-redirectBasedLogin", // 247 type: "radio", // 248 name: "loginStyle", // 249 value: "redirect" // 250 }), "\n ", HTML.LABEL({ // 251 "for": "configure-login-service-dialog-redirectBasedLogin" // 252 }, "\n Redirect-based login (special cases explained\n ", HTML.A({ // 253 href: "https://github.com/meteor/meteor/wiki/OAuth-for-mobile-Meteor-clients#popup-versus-redirect-flow", // 254 target: "_blank" // 255 }, "here"), ")\n "), "\n "), "\n "), "\n "), "\n ", HTML.DIV({ // 256 "class": "modal-footer new-section" // 257 }, "\n ", HTML.DIV({ // 258 "class": "login-button btn btn-danger configure-login-service-dismiss-button" // 259 }, "\n I'll do this later\n "), "\n ", HTML.DIV({ // 260 "class": function() { // 261 return [ "login-button login-button-configure btn btn-success ", Blaze.If(function() { // 262 return Spacebars.call(view.lookup("saveDisabled")); // 263 }, function() { // 264 return "login-button-disabled"; // 265 }) ]; // 266 }, // 267 id: "configure-login-service-dialog-save-configuration" // 268 }, "\n Save Configuration\n "), "\n "), "\n "), "\n "), "\n "), "\n " ]; // 269 }); // 270 })); // 271 // 272 Template.__checkName("_loginButtonsMessagesDialog"); // 273 Template["_loginButtonsMessagesDialog"] = new Template("Template._loginButtonsMessagesDialog", (function() { // 274 var view = this; // 275 return HTML.DIV({ // 276 "class": "modal", // 277 id: "login-buttons-message-dialog" // 278 }, "\n ", Blaze.If(function() { // 279 return Spacebars.call(view.lookup("visible")); // 280 }, function() { // 281 return [ "\n ", HTML.DIV({ // 282 "class": "modal-dialog" // 283 }, "\n ", HTML.DIV({ // 284 "class": "modal-content" // 285 }, "\n ", HTML.DIV({ // 286 "class": "modal-header" // 287 }, "\n ", HTML.BUTTON({ // 288 type: "button", // 289 "class": "close", // 290 "data-dismiss": "modal", // 291 "aria-label": "Close" // 292 }, HTML.SPAN({ // 293 "aria-hidden": "true" // 294 }, HTML.CharRef({ // 295 html: "&times;", // 296 str: "×" // 297 }))), "\n ", HTML.H4({ // 298 "class": "modal-title" // 299 }, Blaze.View("lookup:i18n", function() { // 300 return Spacebars.mustache(view.lookup("i18n"), "errorMessages.genericTitle"); // 301 })), "\n "), "\n ", HTML.DIV({ // 302 "class": "modal-body" // 303 }, "\n ", Spacebars.include(view.lookupTemplate("_loginButtonsMessages")), "\n "), "\n ", HTML.DIV({ // 304 "class": "modal-footer" // 305 }, "\n ", HTML.BUTTON({ // 306 "class": "btn btn-primary login-button", // 307 id: "messages-dialog-dismiss-button", // 308 "data-dismiss": "modal" // 309 }, Blaze.View("lookup:i18n", function() { // 310 return Spacebars.mustache(view.lookup("i18n"), "loginButtonsMessagesDialog.dismiss"); // 311 })), "\n "), "\n "), "\n "), "\n " ]; // 312 }), "\n "); // 313 })); // 314 // 315 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/login_buttons_session.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // (function () { // 1 var VALID_KEYS = [ // 2 'dropdownVisible', // 3 // 4 // XXX consider replacing these with one key that has an enum for values. // 5 'inSignupFlow', // 6 'inForgotPasswordFlow', // 7 'inChangePasswordFlow', // 8 'inMessageOnlyFlow', // 9 // 10 'errorMessage', // 11 'infoMessage', // 12 // 13 // dialogs with messages (info and error) // 14 'resetPasswordToken', // 15 'enrollAccountToken', // 16 'justVerifiedEmail', // 17 // 18 'configureLoginServiceDialogVisible', // 19 'configureLoginServiceDialogServiceName', // 20 'configureLoginServiceDialogSaveDisabled' // 21 ]; // 22 // 23 var validateKey = function (key) { // 24 if (!_.contains(VALID_KEYS, key)){ // 25 throw new Error("Invalid key in loginButtonsSession: " + key); // 26 } // 27 }; // 28 // 29 var KEY_PREFIX = "Meteor.loginButtons."; // 30 // 31 // XXX we should have a better pattern for code private to a package like this one // 32 Accounts._loginButtonsSession = { // 33 set: function(key, value) { // 34 validateKey(key); // 35 if (_.contains(['errorMessage', 'infoMessage'], key)){ // 36 throw new Error("Don't set errorMessage or infoMessage directly. Instead, use errorMessage() or infoMessage()."); } // 38 // 39 this._set(key, value); // 40 }, // 41 // 42 _set: function(key, value) { // 43 Session.set(KEY_PREFIX + key, value); // 44 }, // 45 // 46 get: function(key) { // 47 validateKey(key); // 48 return Session.get(KEY_PREFIX + key); // 49 }, // 50 // 51 closeDropdown: function () { // 52 this.set('inSignupFlow', false); // 53 this.set('inForgotPasswordFlow', false); // 54 this.set('inChangePasswordFlow', false); // 55 this.set('inMessageOnlyFlow', false); // 56 this.set('dropdownVisible', false); // 57 this.resetMessages(); // 58 }, // 59 // 60 infoMessage: function(message) { // 61 this._set("errorMessage", null); // 62 this._set("infoMessage", message); // 63 this.ensureMessageVisible(); // 64 }, // 65 // 66 errorMessage: function(message) { // 67 this._set("errorMessage", message); // 68 this._set("infoMessage", null); // 69 this.ensureMessageVisible(); // 70 }, // 71 // 72 // is there a visible dialog that shows messages (info and error) // 73 isMessageDialogVisible: function () { // 74 return this.get('resetPasswordToken') || // 75 this.get('enrollAccountToken') || // 76 this.get('justVerifiedEmail'); // 77 }, // 78 // 79 // ensure that somethings displaying a message (info or error) is // 80 // visible. if a dialog with messages is open, do nothing; // 81 // otherwise open the dropdown. // 82 // // 83 // notably this doesn't matter when only displaying a single login // 84 // button since then we have an explicit message dialog // 85 // (_loginButtonsMessageDialog), and dropdownVisible is ignored in // 86 // this case. // 87 ensureMessageVisible: function () { // 88 if (!this.isMessageDialogVisible()){ // 89 this.set("dropdownVisible", true); // 90 } // 91 }, // 92 // 93 resetMessages: function () { // 94 this._set("errorMessage", null); // 95 this._set("infoMessage", null); // 96 }, // 97 // 98 configureService: function (name) { // 99 this.set('configureLoginServiceDialogVisible', true); // 100 this.set('configureLoginServiceDialogServiceName', name); // 101 this.set('configureLoginServiceDialogSaveDisabled', true); // 102 setTimeout(function(){ // 103 $('#configure-login-service-dialog-modal').modal(); // 104 }, 500) // 105 } // 106 }; // 107 }) (); // 108 // 109 // 110 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/login_buttons.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // (function() { // 1 if (!Accounts._loginButtons){ // 2 Accounts._loginButtons = {}; // 3 } // 4 // 5 // for convenience // 6 var loginButtonsSession = Accounts._loginButtonsSession; // 7 // 8 UI.registerHelper("loginButtons", function() { // 9 return Template._loginButtons; // 10 }); // 11 // 12 // shared between dropdown and single mode // 13 Template._loginButtons.events({ // 14 'click #login-buttons-logout': function() { // 15 Meteor.logout(function(error) { // 16 loginButtonsSession.closeDropdown(); // 17 if (typeof accountsUIBootstrap3.logoutCallback === 'function') { // 18 accountsUIBootstrap3.logoutCallback(error); // 19 } // 20 }); // 21 } // 22 }); // 23 // 24 // // 25 // loginButtonLoggedOut template // 26 // // 27 Template._loginButtonsLoggedOut.helpers({ // 28 dropdown: function() { // 29 return Accounts._loginButtons.dropdown(); // 30 }, // 31 services: function() { // 32 return Accounts._loginButtons.getLoginServices(); // 33 }, // 34 singleService: function() { // 35 var services = Accounts._loginButtons.getLoginServices(); // 36 if (services.length !== 1){ // 37 throw new Error( // 38 "Shouldn't be rendering this template with more than one configured service"); // 39 } // 40 return services[0]; // 41 }, // 42 configurationLoaded: function() { // 43 return Accounts.loginServicesConfigured(); // 44 } // 45 }); // 46 // 47 // 48 // 49 // // 50 // loginButtonsLoggedIn template // 51 // // 52 // 53 // decide whether we should show a dropdown rather than a row of // 54 // buttons // 55 Template._loginButtonsLoggedIn.helpers({ // 56 dropdown: function() { // 57 return Accounts._loginButtons.dropdown(); // 58 }, // 59 displayName: function() { // 60 return Accounts._loginButtons.displayName(); // 61 } // 62 }) // 63 // 64 // 65 // 66 // // 67 // loginButtonsMessage template // 68 // // 69 // 70 Template._loginButtonsMessages.helpers({ // 71 errorMessage: function() { // 72 return loginButtonsSession.get('errorMessage'); // 73 }, // 74 infoMessage: function() { // 75 return loginButtonsSession.get('infoMessage'); // 76 } // 77 }); // 78 // 79 // 80 // 81 // // 82 // helpers // 83 // // 84 // 85 Accounts._loginButtons.displayName = function() { // 86 var user = Meteor.user(); // 87 if (!user){ // 88 return ''; // 89 } // 90 // 91 if (user.profile && user.profile.name){ // 92 return user.profile.name; // 93 } // 94 if (user.username){ // 95 return user.username; // 96 } // 97 if (user.emails && user.emails[0] && user.emails[0].address){ // 98 return user.emails[0].address; // 99 } // 100 // 101 return ''; // 102 }; // 103 // 104 Accounts._loginButtons.getLoginServices = function() { // 105 // First look for OAuth services. // 106 var services = Package['accounts-oauth'] ? Accounts.oauth.serviceNames() : []; // 107 // 108 // Be equally kind to all login services. This also preserves // 109 // backwards-compatibility. (But maybe order should be // 110 // configurable?) // 111 services.sort(); // 112 // 113 // Add password, if it's there; it must come last. // 114 if (this.hasPasswordService()){ // 115 services.push('password'); // 116 } // 117 // 118 return _.map(services, function(name) { // 119 return { // 120 name: name // 121 }; // 122 }); // 123 }; // 124 // 125 Accounts._loginButtons.hasPasswordService = function() { // 126 return !!Package['accounts-password']; // 127 }; // 128 // 129 Accounts._loginButtons.dropdown = function() { // 130 return this.hasPasswordService() || Accounts._loginButtons.getLoginServices().length > 1; // 131 }; // 132 // 133 // XXX improve these. should this be in accounts-password instead? // 134 // // 135 // XXX these will become configurable, and will be validated on // 136 // the server as well. // 137 Accounts._loginButtons.validateUsername = function(username) { // 138 if (username.length >= 3) { // 139 return true; // 140 } else { // 141 loginButtonsSession.errorMessage(i18n('errorMessages.usernameTooShort')); // 142 return false; // 143 } // 144 }; // 145 Accounts._loginButtons.validateEmail = function(email) { // 146 if (Accounts.ui._passwordSignupFields() === "USERNAME_AND_OPTIONAL_EMAIL" && email === ''){ // 147 return true; // 148 } // 149 // 150 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // 152 if (re.test(email)) { // 153 return true; // 154 } else { // 155 loginButtonsSession.errorMessage(i18n('errorMessages.invalidEmail')); // 156 return false; // 157 } // 158 }; // 159 Accounts._loginButtons.validatePassword = function(password, passwordAgain) { // 160 if (password.length >= 6) { // 161 if (typeof passwordAgain !== "undefined" && passwordAgain !== null && password != passwordAgain) { // 162 loginButtonsSession.errorMessage(i18n('errorMessages.passwordsDontMatch')); // 163 return false; // 164 } // 165 return true; // 166 } else { // 167 loginButtonsSession.errorMessage(i18n('errorMessages.passwordTooShort')); // 168 return false; // 169 } // 170 }; // 171 // 172 Accounts._loginButtons.rendered = function() { // 173 debugger; // 174 }; // 175 // 176 })(); // 177 // 178 // 179 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/login_buttons_single.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // (function() { // 1 // for convenience // 2 var loginButtonsSession = Accounts._loginButtonsSession; // 3 // 4 Template._loginButtonsLoggedOutSingleLoginButton.events({ // 5 'click .login-button': function() { // 6 var serviceName = this.name; // 7 loginButtonsSession.resetMessages(); // 8 var callback = function(err) { // 9 if (!err) { // 10 loginButtonsSession.closeDropdown(); // 11 } else if (err instanceof Accounts.LoginCancelledError) { // 12 // do nothing // 13 } else if (err instanceof Accounts.ConfigError) { // 14 loginButtonsSession.configureService(serviceName); // 15 } else { // 16 loginButtonsSession.errorMessage(err.reason || "Unknown error"); // 17 } // 18 }; // 19 // 20 // XXX Service providers should be able to specify their // 21 // `Meteor.loginWithX` method name. // 22 var loginWithService = Meteor["loginWith" + (serviceName === 'meteor-developer' ? 'MeteorDeveloperAccount' : capitalize(serviceName))]; // 24 var options = {}; // use default scope unless specified // 25 if (Accounts.ui._options.requestPermissions[serviceName]) // 26 options.requestPermissions = Accounts.ui._options.requestPermissions[serviceName]; // 27 if (Accounts.ui._options.requestOfflineToken[serviceName]) // 28 options.requestOfflineToken = Accounts.ui._options.requestOfflineToken[serviceName]; // 29 if (Accounts.ui._options.forceApprovalPrompt[serviceName]) // 30 options.forceApprovalPrompt = Accounts.ui._options.forceApprovalPrompt[serviceName]; // 31 // 32 loginWithService(options, callback); // 33 } // 34 }); // 35 // 36 Template._loginButtonsLoggedOutSingleLoginButton.helpers({ // 37 configured: function() { // 38 return !!Accounts.loginServiceConfiguration.findOne({ // 39 service: this.name // 40 }); // 41 }, // 42 capitalizedName: function() { // 43 if (this.name === 'github'){ // 44 // XXX we should allow service packages to set their capitalized name // 45 return 'GitHub'; // 46 } else { // 47 return capitalize(this.name); // 48 } // 49 } // 50 }); // 51 // 52 // 53 // XXX from http://epeli.github.com/underscore.string/lib/underscore.string.js // 54 var capitalize = function(str) { // 55 str = (str == null) ? '' : String(str); // 56 return str.charAt(0).toUpperCase() + str.slice(1); // 57 }; // 58 })(); // 59 // 60 // 61 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/login_buttons_dropdown.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // (function() { // 1 // 2 // for convenience // 3 var loginButtonsSession = Accounts._loginButtonsSession; // 4 // 5 // events shared between loginButtonsLoggedOutDropdown and // 6 // loginButtonsLoggedInDropdown // 7 Template._loginButtons.events({ // 8 'click input, click .radio, click .checkbox, click option, click select': function(event) { // 9 event.stopPropagation(); // 10 }, // 11 'click #login-name-link, click #login-sign-in-link': function(event) { // 12 event.stopPropagation(); // 13 loginButtonsSession.set('dropdownVisible', true); // 14 Meteor.flush(); // 15 }, // 16 'click .login-close': function() { // 17 loginButtonsSession.closeDropdown(); // 18 } // 19 }); // 20 // 21 Template._loginButtons.toggleDropdown = function() { // 22 toggleDropdown(); // 23 focusInput(); // 24 }; // 25 // 26 // // 27 // loginButtonsLoggedInDropdown template and related // 28 // // 29 // 30 Template._loginButtonsLoggedInDropdown.events({ // 31 'click #login-buttons-open-change-password': function(event) { // 32 event.stopPropagation(); // 33 loginButtonsSession.resetMessages(); // 34 loginButtonsSession.set('inChangePasswordFlow', true); // 35 Meteor.flush(); // 36 } // 37 }); // 38 // 39 Template._loginButtonsLoggedInDropdown.helpers({ // 40 displayName: function() { // 41 return Accounts._loginButtons.displayName(); // 42 }, // 43 // 44 inChangePasswordFlow: function() { // 45 return loginButtonsSession.get('inChangePasswordFlow'); // 46 }, // 47 // 48 inMessageOnlyFlow: function() { // 49 return loginButtonsSession.get('inMessageOnlyFlow'); // 50 }, // 51 // 52 dropdownVisible: function() { // 53 return loginButtonsSession.get('dropdownVisible'); // 54 }, // 55 // 56 user_profile_picture: function() { // 57 var user = Meteor.user(); // 58 if (user && user.profile && user.profile.display_picture) { // 59 return user.profile.display_picture; // 60 } // 61 return ""; // 62 } // 63 }); // 64 // 65 // 66 Template._loginButtonsLoggedInDropdownActions.helpers({ // 67 allowChangingPassword: function() { // 68 // it would be more correct to check whether the user has a password set, // 69 // but in order to do that we'd have to send more data down to the client, // 70 // and it'd be preferable not to send down the entire service.password document. // 71 // // 72 // instead we use the heuristic: if the user has a username or email set. // 73 var user = Meteor.user(); // 74 return user.username || (user.emails && user.emails[0] && user.emails[0].address); // 75 }, // 76 additionalLoggedInDropdownActions: function() { // 77 return Template._loginButtonsAdditionalLoggedInDropdownActions !== undefined; // 78 } // 79 }); // 80 // 81 // 82 // // 83 // loginButtonsLoggedOutDropdown template and related // 84 // // 85 // 86 Template._loginButtonsLoggedOutAllServices.events({ // 87 'click #login-buttons-password': function(event) { // 88 event.stopPropagation(); // 89 loginOrSignup(); // 90 }, // 91 // 92 'keypress #forgot-password-email': function(event) { // 93 event.stopPropagation(); // 94 if (event.keyCode === 13){ // 95 forgotPassword(); // 96 } // 97 }, // 98 // 99 'click #login-buttons-forgot-password': function(event) { // 100 event.stopPropagation(); // 101 forgotPassword(); // 102 }, // 103 // 104 'click #signup-link': function(event) { // 105 event.stopPropagation(); // 106 loginButtonsSession.resetMessages(); // 107 // 108 // store values of fields before swtiching to the signup form // 109 var username = trimmedElementValueById('login-username'); // 110 var email = trimmedElementValueById('login-email'); // 111 var usernameOrEmail = trimmedElementValueById('login-username-or-email'); // 112 // notably not trimmed. a password could (?) start or end with a space // 113 var password = elementValueById('login-password'); // 114 // 115 loginButtonsSession.set('inSignupFlow', true); // 116 loginButtonsSession.set('inForgotPasswordFlow', false); // 117 // 118 // force the ui to update so that we have the approprate fields to fill in // 119 Meteor.flush(); // 120 // 121 // update new fields with appropriate defaults // 122 if (username !== null){ // 123 document.getElementById('login-username').value = username; // 124 } else if (email !== null){ // 125 document.getElementById('login-email').value = email; // 126 } else if (usernameOrEmail !== null){ // 127 if (usernameOrEmail.indexOf('@') === -1){ // 128 document.getElementById('login-username').value = usernameOrEmail; // 129 } else { // 130 document.getElementById('login-email').value = usernameOrEmail; // 131 } // 132 } // 133 }, // 134 'click #forgot-password-link': function(event) { // 135 event.stopPropagation(); // 136 loginButtonsSession.resetMessages(); // 137 // 138 // store values of fields before swtiching to the signup form // 139 var email = trimmedElementValueById('login-email'); // 140 var usernameOrEmail = trimmedElementValueById('login-username-or-email'); // 141 // 142 loginButtonsSession.set('inSignupFlow', false); // 143 loginButtonsSession.set('inForgotPasswordFlow', true); // 144 // 145 // force the ui to update so that we have the approprate fields to fill in // 146 Meteor.flush(); // 147 //toggleDropdown(); // 148 // 149 // update new fields with appropriate defaults // 150 if (email !== null){ // 151 document.getElementById('forgot-password-email').value = email; // 152 } else if (usernameOrEmail !== null){ // 153 if (usernameOrEmail.indexOf('@') !== -1){ // 154 document.getElementById('forgot-password-email').value = usernameOrEmail; // 155 } // 156 } // 157 }, // 158 'click #back-to-login-link': function(event) { // 159 event.stopPropagation(); // 160 loginButtonsSession.resetMessages(); // 161 // 162 var username = trimmedElementValueById('login-username'); // 163 var email = trimmedElementValueById('login-email') || trimmedElementValueById('forgot-password-email'); // Ughh. Standardize on names? // 165 loginButtonsSession.set('inSignupFlow', false); // 166 loginButtonsSession.set('inForgotPasswordFlow', false); // 167 // 168 // force the ui to update so that we have the approprate fields to fill in // 169 Meteor.flush(); // 170 // 171 if (document.getElementById('login-username')){ // 172 document.getElementById('login-username').value = username; // 173 } // 174 if (document.getElementById('login-email')){ // 175 document.getElementById('login-email').value = email; // 176 } // 177 // "login-password" is preserved thanks to the preserve-inputs package // 178 if (document.getElementById('login-username-or-email')){ // 179 document.getElementById('login-username-or-email').value = email || username; // 180 } // 181 }, // 182 'keypress #login-username, keypress #login-email, keypress #login-username-or-email, keypress #login-password, keypress #login-password-again': function(event) { if (event.keyCode === 13){ // 184 loginOrSignup(); // 185 } // 186 } // 187 }); // 188 // 189 Template._loginButtonsLoggedOutDropdown.helpers({ // 190 forbidClientAccountCreation: function() { // 191 return Accounts._options.forbidClientAccountCreation; // 192 } // 193 }); // 194 // 195 Template._loginButtonsLoggedOutAllServices.helpers({ // 196 // additional classes that can be helpful in styling the dropdown // 197 additionalClasses: function() { // 198 if (!Accounts.password) { // 199 return false; // 200 } else { // 201 if (loginButtonsSession.get('inSignupFlow')) { // 202 return 'login-form-create-account'; // 203 } else if (loginButtonsSession.get('inForgotPasswordFlow')) { // 204 return 'login-form-forgot-password'; // 205 } else { // 206 return 'login-form-sign-in'; // 207 } // 208 } // 209 }, // 210 // 211 dropdownVisible: function() { // 212 return loginButtonsSession.get('dropdownVisible'); // 213 }, // 214 // 215 services: function() { // 216 return Accounts._loginButtons.getLoginServices(); // 217 }, // 218 // 219 isPasswordService: function() { // 220 return this.name === 'password'; // 221 }, // 222 // 223 hasOtherServices: function() { // 224 return Accounts._loginButtons.getLoginServices().length > 1; // 225 }, // 226 // 227 hasPasswordService: function() { // 228 return Accounts._loginButtons.hasPasswordService(); // 229 } // 230 }); // 231 // 232 // 233 Template._loginButtonsLoggedOutPasswordService.helpers({ // 234 fields: function() { // 235 var loginFields = [{ // 236 fieldName: 'username-or-email', // 237 fieldLabel: i18n('loginFields.usernameOrEmail'), // 238 visible: function() { // 239 return _.contains( // 240 ["USERNAME_AND_EMAIL_CONFIRM", "USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL"], // 241 Accounts.ui._passwordSignupFields()); // 242 } // 243 }, { // 244 fieldName: 'username', // 245 fieldLabel: i18n('loginFields.username'), // 246 visible: function() { // 247 return Accounts.ui._passwordSignupFields() === "USERNAME_ONLY"; // 248 } // 249 }, { // 250 fieldName: 'email', // 251 fieldLabel: i18n('loginFields.email'), // 252 inputType: 'email', // 253 visible: function() { // 254 return Accounts.ui._passwordSignupFields() === "EMAIL_ONLY"; // 255 } // 256 }, { // 257 fieldName: 'password', // 258 fieldLabel: i18n('loginFields.password'), // 259 inputType: 'password', // 260 visible: function() { // 261 return true; // 262 } // 263 }]; // 264 // 265 var signupFields = [{ // 266 fieldName: 'username', // 267 fieldLabel: i18n('signupFields.username'), // 268 visible: function() { // 269 return _.contains( // 270 ["USERNAME_AND_EMAIL_CONFIRM", "USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "USERNAME_ONLY"], // 271 Accounts.ui._passwordSignupFields()); // 272 } // 273 }, { // 274 fieldName: 'email', // 275 fieldLabel: i18n('signupFields.email'), // 276 inputType: 'email', // 277 visible: function() { // 278 return _.contains( // 279 ["USERNAME_AND_EMAIL_CONFIRM", "USERNAME_AND_EMAIL", "EMAIL_ONLY"], // 280 Accounts.ui._passwordSignupFields()); // 281 } // 282 }, { // 283 fieldName: 'email', // 284 fieldLabel: i18n('signupFields.emailOpt'), // 285 inputType: 'email', // 286 visible: function() { // 287 return Accounts.ui._passwordSignupFields() === "USERNAME_AND_OPTIONAL_EMAIL"; // 288 } // 289 }, { // 290 fieldName: 'password', // 291 fieldLabel: i18n('signupFields.password'), // 292 inputType: 'password', // 293 visible: function() { // 294 return true; // 295 } // 296 }, { // 297 fieldName: 'password-again', // 298 fieldLabel: i18n('signupFields.passwordAgain'), // 299 inputType: 'password', // 300 visible: function() { // 301 // No need to make users double-enter their password if // 302 // they'll necessarily have an email set, since they can use // 303 // the "forgot password" flow. // 304 return _.contains( // 305 ["USERNAME_AND_EMAIL_CONFIRM", "USERNAME_AND_OPTIONAL_EMAIL", "USERNAME_ONLY"], // 306 Accounts.ui._passwordSignupFields()); // 307 } // 308 }]; // 309 // 310 signupFields = signupFields.concat(Accounts.ui._options.extraSignupFields); // 311 // 312 return loginButtonsSession.get('inSignupFlow') ? signupFields : loginFields; // 313 }, // 314 // 315 inForgotPasswordFlow: function() { // 316 return loginButtonsSession.get('inForgotPasswordFlow'); // 317 }, // 318 // 319 inLoginFlow: function() { // 320 return !loginButtonsSession.get('inSignupFlow') && !loginButtonsSession.get('inForgotPasswordFlow'); // 321 }, // 322 // 323 inSignupFlow: function() { // 324 return loginButtonsSession.get('inSignupFlow'); // 325 }, // 326 // 327 showForgotPasswordLink: function() { // 328 return _.contains( // 329 ["USERNAME_AND_EMAIL_CONFIRM", "USERNAME_AND_EMAIL", "USERNAME_AND_OPTIONAL_EMAIL", "EMAIL_ONLY"], // 330 Accounts.ui._passwordSignupFields()); // 331 }, // 332 // 333 showCreateAccountLink: function() { // 334 return !Accounts._options.forbidClientAccountCreation; // 335 } // 336 }); // 337 // 338 Template._loginButtonsFormField.helpers({ // 339 equals: function(a, b) { // 340 return (a === b); // 341 }, // 342 inputType: function() { // 343 return this.inputType || "text"; // 344 }, // 345 inputTextual: function() { // 346 return !_.contains(["radio", "checkbox", "select"], this.inputType); // 347 } // 348 }); // 349 // 350 // // 351 // loginButtonsChangePassword template // 352 // // 353 Template._loginButtonsChangePassword.events({ // 354 'keypress #login-old-password, keypress #login-password, keypress #login-password-again': function(event) { // 355 if (event.keyCode === 13){ // 356 changePassword(); // 357 } // 358 }, // 359 'click #login-buttons-do-change-password': function(event) { // 360 event.stopPropagation(); // 361 changePassword(); // 362 }, // 363 'click #login-buttons-cancel-change-password': function(event) { // 364 event.stopPropagation(); // 365 loginButtonsSession.resetMessages(); // 366 Accounts._loginButtonsSession.set('inChangePasswordFlow', false); // 367 Meteor.flush(); // 368 } // 369 }); // 370 // 371 Template._loginButtonsChangePassword.helpers({ // 372 fields: function() { // 373 return [{ // 374 fieldName: 'old-password', // 375 fieldLabel: i18n('changePasswordFields.currentPassword'), // 376 inputType: 'password', // 377 visible: function() { // 378 return true; // 379 } // 380 }, { // 381 fieldName: 'password', // 382 fieldLabel: i18n('changePasswordFields.newPassword'), // 383 inputType: 'password', // 384 visible: function() { // 385 return true; // 386 } // 387 }, { // 388 fieldName: 'password-again', // 389 fieldLabel: i18n('changePasswordFields.newPasswordAgain'), // 390 inputType: 'password', // 391 visible: function() { // 392 // No need to make users double-enter their password if // 393 // they'll necessarily have an email set, since they can use // 394 // the "forgot password" flow. // 395 return _.contains( // 396 ["USERNAME_AND_OPTIONAL_EMAIL", "USERNAME_ONLY"], // 397 Accounts.ui._passwordSignupFields()); // 398 } // 399 }]; // 400 } // 401 }); // 402 // 403 // // 404 // helpers // 405 // // 406 // 407 var elementValueById = function(id) { // 408 var element = document.getElementById(id); // 409 if (!element){ // 410 return null; // 411 } else { // 412 return element.value; // 413 } // 414 }; // 415 // 416 var elementValueByIdForRadio = function(fieldIdPrefix, radioOptions) { // 417 var value = null; // 418 for (i in radioOptions) { // 419 var element = document.getElementById(fieldIdPrefix + '-' + radioOptions[i].id); // 420 if (element && element.checked){ // 421 value = element.value; // 422 } // 423 } // 424 return value; // 425 }; // 426 // 427 var elementValueByIdForCheckbox = function(id) { // 428 var element = document.getElementById(id); // 429 return element.checked; // 430 }; // 431 // 432 var trimmedElementValueById = function(id) { // 433 var element = document.getElementById(id); // 434 if (!element){ // 435 return null; // 436 } else { // 437 return element.value.replace(/^\s*|\s*$/g, ""); // trim; // 438 } // 439 }; // 440 // 441 var loginOrSignup = function() { // 442 if (loginButtonsSession.get('inSignupFlow')){ // 443 signup(); // 444 } else { // 445 login(); // 446 } // 447 }; // 448 // 449 var login = function() { // 450 loginButtonsSession.resetMessages(); // 451 // 452 var username = trimmedElementValueById('login-username'); // 453 if (username && Accounts.ui._options.forceUsernameLowercase) { // 454 username = username.toLowerCase(); // 455 } // 456 var email = trimmedElementValueById('login-email'); // 457 if (email && Accounts.ui._options.forceEmailLowercase) { // 458 email = email.toLowerCase(); // 459 } // 460 var usernameOrEmail = trimmedElementValueById('login-username-or-email'); // 461 if (usernameOrEmail && Accounts.ui._options.forceEmailLowercase && Accounts.ui._options.forceUsernameLowercase) { // 462 usernameOrEmail = usernameOrEmail.toLowerCase(); // 463 } // 464 // 465 // notably not trimmed. a password could (?) start or end with a space // 466 var password = elementValueById('login-password'); // 467 if (password && Accounts.ui._options.forcePasswordLowercase) { // 468 password = password.toLowerCase(); // 469 } // 470 // 471 var loginSelector; // 472 if (username !== null) { // 473 if (!Accounts._loginButtons.validateUsername(username)){ // 474 return; // 475 } else { // 476 loginSelector = { // 477 username: username // 478 }; // 479 } // 480 } else if (email !== null) { // 481 if (!Accounts._loginButtons.validateEmail(email)){ // 482 return; // 483 } else { // 484 loginSelector = { // 485 email: email // 486 }; // 487 } // 488 } else if (usernameOrEmail !== null) { // 489 // XXX not sure how we should validate this. but this seems good enough (for now), // 490 // since an email must have at least 3 characters anyways // 491 if (!Accounts._loginButtons.validateUsername(usernameOrEmail)){ // 492 return; // 493 } else { // 494 loginSelector = usernameOrEmail; // 495 } // 496 } else { // 497 throw new Error("Unexpected -- no element to use as a login user selector"); // 498 } // 499 // 500 Meteor.loginWithPassword(loginSelector, password, function(error, result) { // 501 if (error) { // 502 if (error.reason == 'User not found'){ // 503 loginButtonsSession.errorMessage(i18n('errorMessages.userNotFound')) // 504 } else if (error.reason == 'Incorrect password'){ // 505 loginButtonsSession.errorMessage(i18n('errorMessages.incorrectPassword')) // 506 } else { // 507 loginButtonsSession.errorMessage(error.reason || "Unknown error"); // 508 } // 509 } else { // 510 loginButtonsSession.closeDropdown(); // 511 } // 512 }); // 513 }; // 514 // 515 var toggleDropdown = function() { // 516 $("#login-dropdown-list").toggleClass("open"); // 517 } // 518 // 519 var focusInput = function() { // 520 setTimeout(function() { // 521 $("#login-dropdown-list input").first().focus(); // 522 }, 0); // 523 }; // 524 // 525 var signup = function() { // 526 loginButtonsSession.resetMessages(); // 527 // 528 // to be passed to Accounts.createUser // 529 var options = {}; // 530 if(typeof accountsUIBootstrap3.setCustomSignupOptions === 'function') { // 531 options = accountsUIBootstrap3.setCustomSignupOptions(); // 532 if (!(options instanceof Object)){ options = {}; } // 533 } // 534 // 535 var username = trimmedElementValueById('login-username'); // 536 if (username && Accounts.ui._options.forceUsernameLowercase) { // 537 username = username.toLowerCase(); // 538 } // 539 if (username !== null) { // 540 if (!Accounts._loginButtons.validateUsername(username)){ // 541 return; // 542 } else { // 543 options.username = username; // 544 } // 545 } // 546 // 547 var email = trimmedElementValueById('login-email'); // 548 if (email && Accounts.ui._options.forceEmailLowercase) { // 549 email = email.toLowerCase(); // 550 } // 551 if (email !== null) { // 552 if (!Accounts._loginButtons.validateEmail(email)){ // 553 return; // 554 } else { // 555 options.email = email; // 556 } // 557 } // 558 // 559 // notably not trimmed. a password could (?) start or end with a space // 560 var password = elementValueById('login-password'); // 561 if (password && Accounts.ui._options.forcePasswordLowercase) { // 562 password = password.toLowerCase(); // 563 } // 564 if (!Accounts._loginButtons.validatePassword(password)){ // 565 return; // 566 } else { // 567 options.password = password; // 568 } // 569 // 570 if (!matchPasswordAgainIfPresent()){ // 571 return; // 572 } // 573 // 574 // prepare the profile object // 575 // it could have already been set through setCustomSignupOptions // 576 if (!(options.profile instanceof Object)){ // 577 options.profile = {}; // 578 } // 579 // 580 // define a proxy function to allow extraSignupFields set error messages // 581 var errorFunction = function(errorMessage) { // 582 Accounts._loginButtonsSession.errorMessage(errorMessage); // 583 }; // 584 // 585 var invalidExtraSignupFields = false; // 586 // parse extraSignupFields to populate account's profile data // 587 _.each(Accounts.ui._options.extraSignupFields, function(field, index) { // 588 var value = null; // 589 var elementIdPrefix = 'login-'; // 590 // 591 if (field.inputType === 'radio') { // 592 value = elementValueByIdForRadio(elementIdPrefix + field.fieldName, field.data); // 593 } else if (field.inputType === 'checkbox') { // 594 value = elementValueByIdForCheckbox(elementIdPrefix + field.fieldName); // 595 } else { // 596 value = elementValueById(elementIdPrefix + field.fieldName); // 597 } // 598 // 599 if (typeof field.validate === 'function') { // 600 if (field.validate(value, errorFunction)) { // 601 if (typeof field.saveToProfile !== 'undefined' && !field.saveToProfile){ // 602 options[field.fieldName] = value; // 603 } else { // 604 options.profile[field.fieldName] = value; // 605 } // 606 } else { // 607 invalidExtraSignupFields = true; // 608 } // 609 } else { // 610 options.profile[field.fieldName] = value; // 611 } // 612 }); // 613 // 614 if (invalidExtraSignupFields){ // 615 return; // 616 } // 617 // 618 Accounts.createUser(options, function(error) { // 619 if (error) { // 620 if (error.reason == 'Signups forbidden'){ // 621 loginButtonsSession.errorMessage(i18n('errorMessages.signupsForbidden')) // 622 } else { // 623 loginButtonsSession.errorMessage(error.reason || "Unknown error"); // 624 } // 625 } else { // 626 loginButtonsSession.closeDropdown(); // 627 } // 628 }); // 629 }; // 630 // 631 var forgotPassword = function() { // 632 loginButtonsSession.resetMessages(); // 633 // 634 var email = trimmedElementValueById("forgot-password-email"); // 635 if (email.indexOf('@') !== -1) { // 636 Accounts.forgotPassword({ // 637 email: email // 638 }, function(error) { // 639 if (error) { // 640 if (error.reason == 'User not found'){ // 641 loginButtonsSession.errorMessage(i18n('errorMessages.userNotFound')) // 642 } else { // 643 loginButtonsSession.errorMessage(error.reason || "Unknown error"); // 644 } // 645 } else { // 646 loginButtonsSession.infoMessage(i18n('infoMessages.emailSent')); // 647 } // 648 }); // 649 } else { // 650 loginButtonsSession.errorMessage(i18n('forgotPasswordForm.invalidEmail')); // 651 } // 652 }; // 653 var changePassword = function() { // 654 loginButtonsSession.resetMessages(); // 655 // notably not trimmed. a password could (?) start or end with a space // 656 var oldPassword = elementValueById('login-old-password'); // 657 // notably not trimmed. a password could (?) start or end with a space // 658 var password = elementValueById('login-password'); // 659 // 660 if (password == oldPassword) { // 661 loginButtonsSession.errorMessage(i18n('errorMessages.newPasswordSameAsOld')); // 662 return; // 663 } // 664 // 665 if (!Accounts._loginButtons.validatePassword(password)){ // 666 return; // 667 } // 668 // 669 if (!matchPasswordAgainIfPresent()){ // 670 return; // 671 } // 672 // 673 Accounts.changePassword(oldPassword, password, function(error) { // 674 if (error) { // 675 if (error.reason == 'Incorrect password'){ // 676 loginButtonsSession.errorMessage(i18n('errorMessages.incorrectPassword')) // 677 } else { // 678 loginButtonsSession.errorMessage(error.reason || "Unknown error"); // 679 } // 680 } else { // 681 loginButtonsSession.infoMessage(i18n('infoMessages.passwordChanged')); // 682 // 683 // wait 3 seconds, then expire the msg // 684 Meteor.setTimeout(function() { // 685 loginButtonsSession.resetMessages(); // 686 }, 3000); // 687 } // 688 }); // 689 }; // 690 // 691 var matchPasswordAgainIfPresent = function() { // 692 // notably not trimmed. a password could (?) start or end with a space // 693 var passwordAgain = elementValueById('login-password-again'); // 694 if (passwordAgain !== null) { // 695 // notably not trimmed. a password could (?) start or end with a space // 696 var password = elementValueById('login-password'); // 697 if (password !== passwordAgain) { // 698 loginButtonsSession.errorMessage(i18n('errorMessages.passwordsDontMatch')); // 699 return false; // 700 } // 701 } // 702 return true; // 703 }; // 704 })(); // 705 // 706 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); (function(){ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // packages/ian_accounts-ui-bootstrap-3/login_buttons_dialogs.js // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // (function() { // 1 // for convenience // 2 var loginButtonsSession = Accounts._loginButtonsSession; // 3 // 4 // 5 // // 6 // populate the session so that the appropriate dialogs are // 7 // displayed by reading variables set by accounts-urls, which parses // 8 // special URLs. since accounts-ui depends on accounts-urls, we are // 9 // guaranteed to have these set at this point. // 10 // // 11 // 12 if (Accounts._resetPasswordToken) { // 13 loginButtonsSession.set('resetPasswordToken', Accounts._resetPasswordToken); // 14 } // 15 // 16 if (Accounts._enrollAccountToken) { // 17 loginButtonsSession.set('enrollAccountToken', Accounts._enrollAccountToken); // 18 } // 19 // 20 // Needs to be in Meteor.startup because of a package loading order // 21 // issue. We can't be sure that accounts-password is loaded earlier // 22 // than accounts-ui so Accounts.verifyEmail might not be defined. // 23 Meteor.startup(function() { // 24 if (Accounts._verifyEmailToken) { // 25 Accounts.verifyEmail(Accounts._verifyEmailToken, function(error) { // 26 Accounts._enableAutoLogin(); // 27 if (!error){ // 28 loginButtonsSession.set('justVerifiedEmail', true); // 29 } // 30 // XXX show something if there was an error. // 31 }); // 32 } // 33 }); // 34 // 35 // // 36 // resetPasswordDialog template // 37 // // 38 // 39 Template._resetPasswordDialog.events({ // 40 'click #login-buttons-reset-password-button': function(event) { // 41 event.stopPropagation(); // 42 resetPassword(); // 43 }, // 44 'keypress #reset-password-new-password': function(event) { // 45 if (event.keyCode === 13){ // 46 resetPassword(); // 47 } // 48 }, // 49 'click #login-buttons-cancel-reset-password': function(event) { // 50 event.stopPropagation(); // 51 loginButtonsSession.set('resetPasswordToken', null); // 52 Accounts._enableAutoLogin(); // 53 $('#login-buttons-reset-password-modal').modal("hide"); // 54 }, // 55 'click #login-buttons-dismiss-reset-password-success': function(event) { // 56 event.stopPropagation(); // 57 $('#login-buttons-reset-password-modal-success').modal("hide"); // 58 } // 59 }); // 60 // 61 var resetPassword = function() { // 62 loginButtonsSession.resetMessages(); // 63 var newPassword = document.getElementById('reset-password-new-password').value; // 64 var passwordAgain= document.getElementById('reset-password-new-password-again').value; // 65 if (!Accounts._loginButtons.validatePassword(newPassword,passwordAgain)){ // 66 return; // 67 } // 68 // 69 Accounts.resetPassword( // 70 loginButtonsSession.get('resetPasswordToken'), newPassword, // 71 function(error) { // 72 if (error) { // 73 loginButtonsSession.errorMessage(error.reason || "Unknown error"); // 74 } else { // 75 $('#login-buttons-reset-password-modal').modal("hide"); // 76 $('#login-buttons-reset-password-modal-success').modal(); // 77 loginButtonsSession.infoMessage(i18n('infoMessages.passwordChanged')); // 78 loginButtonsSession.set('resetPasswordToken', null); // 79 Accounts._enableAutoLogin(); // 80 } // 81 }); // 82 }; // 83 // 84 Template._resetPasswordDialog.helpers({ // 85 inResetPasswordFlow: function() { // 86 return loginButtonsSession.get('resetPasswordToken'); // 87 } // 88 }); // 89 // 90 Template._resetPasswordDialog.onRendered(function() { // 91 var $modal = $(this.find('#login-buttons-reset-password-modal')); // 92 if (!_.isFunction($modal.modal)) { // 93 console.error("You have to add a Bootstrap package, i.e. meteor add twbs:bootstrap"); // 94 } else { // 95 $modal.modal(); // 96 } // 97 }); // 98 // 99 // // 100 // enrollAccountDialog template // 101 // // 102 // 103 Template._enrollAccountDialog.events({ // 104 'click #login-buttons-enroll-account-button': function() { // 105 enrollAccount(); // 106 }, // 107 'keypress #enroll-account-password': function(event) { // 108 if (event.keyCode === 13){ // 109 enrollAccount(); // 110 } // 111 }, // 112 'click #login-buttons-cancel-enroll-account-button': function() { // 113 loginButtonsSession.set('enrollAccountToken', null); // 114 Accounts._enableAutoLogin(); // 115 $modal.modal("hide"); // 116 } // 117 }); // 118 // 119 var enrollAccount = function() { // 120 loginButtonsSession.resetMessages(); // 121 var password = document.getElementById('enroll-account-password').value; // 122 var passwordAgain= document.getElementById('enroll-account-password-again').value; // 123 if (!Accounts._loginButtons.validatePassword(password,passwordAgain)){ // 124 return; // 125 } // 126 // 127 Accounts.resetPassword( // 128 loginButtonsSession.get('enrollAccountToken'), password, // 129 function(error) { // 130 if (error) { // 131 loginButtonsSession.errorMessage(error.reason || "Unknown error"); // 132 } else { // 133 loginButtonsSession.set('enrollAccountToken', null); // 134 Accounts._enableAutoLogin(); // 135 $modal.modal("hide"); // 136 } // 137 }); // 138 }; // 139 // 140 Template._enrollAccountDialog.helpers({ // 141 inEnrollAccountFlow: function() { // 142 return loginButtonsSession.get('enrollAccountToken'); // 143 } // 144 }); // 145 // 146 Template._enrollAccountDialog.onRendered(function() { // 147 $modal = $(this.find('#login-buttons-enroll-account-modal')); // 148 if (!_.isFunction($modal.modal)) { // 149 console.error("You have to add a Bootstrap package, i.e. meteor add twbs:bootstrap"); // 150 } else { // 151 $modal.modal(); // 152 } // 153 }); // 154 // 155 // // 156 // justVerifiedEmailDialog template // 157 // // 158 // 159 Template._justVerifiedEmailDialog.events({ // 160 'click #just-verified-dismiss-button': function() { // 161 loginButtonsSession.set('justVerifiedEmail', false); // 162 } // 163 }); // 164 // 165 Template._justVerifiedEmailDialog.helpers({ // 166 visible: function() { // 167 if (loginButtonsSession.get('justVerifiedEmail')) { // 168 setTimeout(function() { // 169 $('#login-buttons-email-address-verified-modal').modal() // 170 }, 500) // 171 } // 172 return loginButtonsSession.get('justVerifiedEmail'); // 173 } // 174 }); // 175 // 176 // 177 // // 178 // loginButtonsMessagesDialog template // 179 // // 180 // 181 var messagesDialogVisible = function() { // 182 var hasMessage = loginButtonsSession.get('infoMessage') || loginButtonsSession.get('errorMessage'); // 183 return !Accounts._loginButtons.dropdown() && hasMessage; // 184 } // 185 // 186 // 187 Template._loginButtonsMessagesDialog.onRendered(function() { // 188 var self = this; // 189 // 190 self.autorun(function() { // 191 if (messagesDialogVisible()) { // 192 var $modal = $(self.find('#login-buttons-message-dialog')); // 193 if (!_.isFunction($modal.modal)) { // 194 console.error("You have to add a Bootstrap package, i.e. meteor add twbs:bootstrap"); // 195 } else { // 196 $modal.modal(); // 197 } // 198 } // 199 }); // 200 }); // 201 // 202 Template._loginButtonsMessagesDialog.events({ // 203 'click #messages-dialog-dismiss-button': function() { // 204 loginButtonsSession.resetMessages(); // 205 } // 206 }); // 207 // 208 Template._loginButtonsMessagesDialog.helpers({ // 209 visible: function() { return messagesDialogVisible(); } // 210 }); // 211 // 212 // 213 // // 214 // configureLoginServiceDialog template // 215 // // 216 // 217 Template._configureLoginServiceDialog.events({ // 218 'click .configure-login-service-dismiss-button': function(event) { // 219 event.stopPropagation(); // 220 loginButtonsSession.set('configureLoginServiceDialogVisible', false); // 221 $('#configure-login-service-dialog-modal').modal('hide'); // 222 }, // 223 'click #configure-login-service-dialog-save-configuration': function() { // 224 if (loginButtonsSession.get('configureLoginServiceDialogVisible') && // 225 !loginButtonsSession.get('configureLoginServiceDialogSaveDisabled')) { // 226 // Prepare the configuration document for this login service // 227 var serviceName = loginButtonsSession.get('configureLoginServiceDialogServiceName'); // 228 var configuration = { // 229 service: serviceName // 230 }; // 231 _.each(configurationFields(), function(field) { // 232 configuration[field.property] = document.getElementById( // 233 'configure-login-service-dialog-' + field.property).value // 234 .replace(/^\s*|\s*$/g, ""); // trim; // 235 }); // 236 // 237 configuration.loginStyle = // 238 $('#configure-login-service-dialog input[name="loginStyle"]:checked') // 239 .val(); // 240 // 241 // Configure this login service // 242 Meteor.call("configureLoginService", configuration, function(error, result) { // 243 if (error){ // 244 Meteor._debug("Error configuring login service " + serviceName, error); // 245 } else { // 246 loginButtonsSession.set('configureLoginServiceDialogVisible', false); // 247 } // 248 $('#configure-login-service-dialog-modal').modal('hide'); // 249 }); // 250 } // 251 }, // 252 // IE8 doesn't support the 'input' event, so we'll run this on the keyup as // 253 // well. (Keeping the 'input' event means that this also fires when you use // 254 // the mouse to change the contents of the field, eg 'Cut' menu item.) // 255 'input, keyup input': function(event) { // 256 // if the event fired on one of the configuration input fields, // 257 // check whether we should enable the 'save configuration' button // 258 if (event.target.id.indexOf('configure-login-service-dialog') === 0){ // 259 updateSaveDisabled(); // 260 } // 261 } // 262 }); // 263 // 264 // check whether the 'save configuration' button should be enabled. // 265 // this is a really strange way to implement this and a Forms // 266 // Abstraction would make all of this reactive, and simpler. // 267 var updateSaveDisabled = function() { // 268 var anyFieldEmpty = _.any(configurationFields(), function(field) { // 269 return document.getElementById( // 270 'configure-login-service-dialog-' + field.property).value === ''; // 271 }); // 272 // 273 loginButtonsSession.set('configureLoginServiceDialogSaveDisabled', anyFieldEmpty); // 274 }; // 275 // 276 // Returns the appropriate template for this login service. This // 277 // template should be defined in the service's package // 278 var configureLoginServiceDialogTemplateForService = function() { // 279 var serviceName = loginButtonsSession.get('configureLoginServiceDialogServiceName'); // 280 return Template['configureLoginServiceDialogFor' + capitalize(serviceName)]; // 281 }; // 282 // 283 var configurationFields = function() { // 284 var template = configureLoginServiceDialogTemplateForService(); // 285 return template.fields(); // 286 }; // 287 // 288 Template._configureLoginServiceDialog.helpers({ // 289 configurationFields: function() { // 290 return configurationFields(); // 291 }, // 292 // 293 visible: function() { // 294 return loginButtonsSession.get('configureLoginServiceDialogVisible'); // 295 }, // 296 // 297 configurationSteps: function() { // 298 // renders the appropriate template // 299 return configureLoginServiceDialogTemplateForService(); // 300 }, // 301 // 302 saveDisabled: function() { // 303 return loginButtonsSession.get('configureLoginServiceDialogSaveDisabled'); // 304 } // 305 }); // 306 // 307 // 308 ; // 309 // 310 // 311 // 312 // XXX from http://epeli.github.com/underscore.string/lib/underscore.string.js // 313 var capitalize = function(str) { // 314 str = str == null ? '' : String(str); // 315 return str.charAt(0).toUpperCase() + str.slice(1); // 316 }; // 317 // 318 })(); // 319 // 320 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }).call(this); /* Exports */ if (typeof Package === 'undefined') Package = {}; Package['ian:accounts-ui-bootstrap-3'] = { accountsUIBootstrap3: accountsUIBootstrap3 }; })();
initSidebarItems({"enum":[["OrphanCheckErr",""]],"fn":[["orphan_check","Checks the coherence orphan rules. `impl_def_id` should be the def-id of a trait impl. To pass, either the trait must be local, or else two conditions must be satisfied:"],["overlapping_impls","True if there exist types that satisfy both of the two given impls."]]});
// All symbols in the `Cherokee` script as per Unicode v6.2.0: [ '\u13A0', '\u13A1', '\u13A2', '\u13A3', '\u13A4', '\u13A5', '\u13A6', '\u13A7', '\u13A8', '\u13A9', '\u13AA', '\u13AB', '\u13AC', '\u13AD', '\u13AE', '\u13AF', '\u13B0', '\u13B1', '\u13B2', '\u13B3', '\u13B4', '\u13B5', '\u13B6', '\u13B7', '\u13B8', '\u13B9', '\u13BA', '\u13BB', '\u13BC', '\u13BD', '\u13BE', '\u13BF', '\u13C0', '\u13C1', '\u13C2', '\u13C3', '\u13C4', '\u13C5', '\u13C6', '\u13C7', '\u13C8', '\u13C9', '\u13CA', '\u13CB', '\u13CC', '\u13CD', '\u13CE', '\u13CF', '\u13D0', '\u13D1', '\u13D2', '\u13D3', '\u13D4', '\u13D5', '\u13D6', '\u13D7', '\u13D8', '\u13D9', '\u13DA', '\u13DB', '\u13DC', '\u13DD', '\u13DE', '\u13DF', '\u13E0', '\u13E1', '\u13E2', '\u13E3', '\u13E4', '\u13E5', '\u13E6', '\u13E7', '\u13E8', '\u13E9', '\u13EA', '\u13EB', '\u13EC', '\u13ED', '\u13EE', '\u13EF', '\u13F0', '\u13F1', '\u13F2', '\u13F3', '\u13F4' ];
/* Gradebook from Names and Scores I worked on this challenge [by myself, with:] This challenge took me [#] hours. You will work with the following two variables. The first, students, holds the names of four students. The second, scores, holds groups of test scores. The relative positions of elements within the two variables match (i.e., 'Joseph' is the first element in students; his scores are the first value in scores.). Do not alter the students and scores code. */ var students = ["Joseph", "Susan", "William", "Elizabeth"] var scores = [ [80, 70, 70, 100], // joseph [85, 80, 90, 90], // susan [75, 70, 80, 75], // william [100, 90, 95, 85] ] // elizabeth // __________________________________________ // Write your code below. // var gradebook = {}; // gradebook["Joseph"] = {}; // gradebook["Susan"] = {}; // gradebook["William"] = {}; // gradebook["Elizabeth"] = {}; // gradebook["Joseph"]["testScores"] = scores[0]; // gradebook["Susan"]["testScores"] = scores[1]; // gradebook["William"]["testScores"] = scores[2]; // gradebook["Elizabeth"]["testScores"] = scores[3]; // gradebook.addScore = function(name, score) { // gradebook[name]["testScores"].push(score); // } // console.log(gradebook.addScore) // gradebook.getAverage = function(name){ // var select_nums = gradebook[name]["testScores"] // return average(select_nums) // }; // var average = function(array_of_int) { // var sum = 0 // for (var i = 0; i < array_of_int.length; i++) { // sum += array_of_int[i]; // var average_grade = sum / array_of_int.length // } // return average_grade // } // __________________________________________ // Refactored Solution gradebook = {} for(var counter = 0; counter < students.length; counter ++){ gradebook[students[counter]] = {}; } for(var counter = 0; counter < students.length; counter ++){ gradebook[students[counter]]["testScores"] = scores[counter]; } gradebook.addScore = function(name, score) { gradebook[name]["testScores"].push(score); } gradebook.getAverage = function(name){ var select_nums = gradebook[name]["testScores"] return average(select_nums) }; var average = function(array_of_int) { var total = array_of_int.reduce(function(a, b) { return (a + b) }); total = total / array_of_int.length; return total } // gradebook.getAverage("Joseph") // __________________________________________ // Reflect // What did you learn about adding functions to objects? // I think this just built off of last weeks material, I'm not sure how much of it was truly new. It was mostly reinforcement of how and what arguments you could pass in. // How did you iterate over nested arrays in JavaScript? It was good practice with the for loop, this challenge wasn't as hard as several of the ruby ones were. to answer the question, with a for loop. It was actually essentially the same loop twice. Once to create the objects, it would not let us compress the creation of the object and the addition of the array into one, but we may not have done it correctly. // Were there any new methods you were able to incorporate? If so, what were they and how did they work? // the reduce method was new. It just might work through magic. We had to copy the syntax exactly. I'll actually be attending office hours to discuss it a little bit further becuase we weren't sure on a couple elements in it. We did get it to work though, so that's nifty. // __________________________________________ // Test Code: Do not alter code below this line. function assert(test, message, test_number) { if (!test) { console.log(test_number + "false"); throw "ERROR: " + message; } console.log(test_number + "true"); return true; } assert( (gradebook instanceof Object), "The value of gradebook should be an Object.\n", "1. " ) assert( (gradebook["Elizabeth"] instanceof Object), "gradebook's Elizabeth property should be an object.", "2. " ) assert( (gradebook.William.testScores === scores[2]), "William's testScores should equal the third element in scores.", "3. " ) assert( (gradebook.addScore instanceof Function), "The value of gradebook's addScore property should be a Function.", "4. " ) gradebook.addScore("Susan", 80) assert( (gradebook.Susan.testScores.length === 5 && gradebook.Susan.testScores[4] === 80), "Susan's testScores should have a new score of 80 added to the end.", "5. " ) assert( (gradebook.getAverage instanceof Function), "The value of gradebook's getAverage property should be a Function.", "6. " ) assert( (average instanceof Function), "The value of average should be a Function.\n", "7. " ) assert( average([1, 2, 3]) === 2, "average should return the average of the elements in the array argument.\n", "8. " ) assert( (gradebook.getAverage("Joseph") === 80), "gradebook's getAverage should return 80 if passed 'Joseph'.", "9. " )
export default function() { console.log('Hello World!'); }
/* * 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["tzm-Latn"] = { name: "tzm-Latn", numberFormat: { pattern: ["n-"], decimals: 2, ",": ".", ".": ",", groupSize: [3], percent: { pattern: ["-n %","n %"], decimals: 2, ",": ".", ".": ",", groupSize: [3], symbol: "%" }, currency: { pattern: ["-n $","n $"], decimals: 2, ",": ",", ".": ".", groupSize: [3], symbol: "DZD" } }, calendars: { standard: { days: { names: ["Acer","Arime","Aram","Ahad","Amhadh","Sem","Sedh"], namesAbbr: ["Ace","Ari","Ara","Aha","Amh","Sem","Sed"], namesShort: ["Ac","Ar","Ar","Ah","Am","Se","Se"] }, months: { names: ["Yenayer","Furar","Maghres","Yebrir","Mayu","Yunyu","Yulyu","Ghuct","Cutenber","Ktuber","Wambir","Dujanbir",""], namesAbbr: ["Yen","Fur","Mag","Yeb","May","Yun","Yul","Ghu","Cut","Ktu","Wam","Duj",""] }, 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: 6 } } } })(this); return window.kendo; }, typeof define == 'function' && define.amd ? define : function(_, f){ f(); });
import Ember from 'ember'; /** * Controller for the login/logout view */ export default Ember.Controller.extend({ application: Ember.inject.controller(), session: Ember.inject.service(), account: Ember.computed.alias('application.model'), apikey: Ember.computed.alias('session.apikey'), loggedIn: Ember.computed.alias('session.loggedIn'), actions: { logout() { var _this = this; this.get('session').logout() .then(function() { _this.transitionToRoute('index'); }); } } });
(function() { Jobber = { jobber_admin_url: "", FixPng: function() { var arVersion = navigator.appVersion.split("MSIE"); var version = parseFloat(arVersion[1]); if ((version >= 5.5) && (document.body.filters)) { for(var i=0; i<document.images.length; i++) { var img = document.images[i]; var imgName = img.src.toUpperCase(); if (imgName == this.jobber_admin_url.toUpperCase() + "IMG/BT-RSS.PNG") { var imgID = (img.id) ? "id='" + img.id + "' " : ""; var imgClass = (img.className) ? "class='" + img.className + "' " : ""; var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; var imgStyle = "display:inline-block;" + img.style.cssText; if (img.align == "left") imgStyle = "float:left;" + imgStyle; if (img.align == "right") imgStyle = "float:right;" + imgStyle; if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle; var strNewHTML = "<span " + imgID + imgClass + imgTitle; strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"; strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"; strNewHTML += "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"; img.outerHTML = strNewHTML; i = i - 1; } } } }, DeactivateLink: function(job_id) { var url = Jobber.jobber_admin_url+'deactivate/'; Jobber.Deactivate(url, job_id); }, ActivateLink: function(job_id) { var url = Jobber.jobber_admin_url+'activate/'; Jobber.Activate(url, job_id, 0); }, Activate: function(url, job_id, is_first_page) { $.ajax({ type: "POST", url: url, data: "job_id=" + job_id, success: function(msg) { if (msg != "0") { var currentRowId = 'item'+job_id; var currentLinkId = 'activateLink'+job_id; if(is_first_page == 1) { $("#"+currentRowId).css({ display: "none" }); } else { var deactivateJobFunction = function() { Jobber.DeactivateLink(job_id); }; var linkElement = document.getElementById(currentLinkId); linkElement.setAttribute('title', 'deactivate'); linkElement.setAttribute('onclick', deactivateJobFunction); linkElement.onclick = deactivateJobFunction; linkElement.innerHTML = '<img src="'+Jobber.jobber_admin_url+'img/icon_deactivate.gif" alt="deactivate" />'; linkElement.id = 'deactivateLink'+job_id; } } } }); }, Deactivate: function(url, job_id) { $.ajax({ type: "POST", url: url, data: "job_id=" + job_id, success: function(msg) { if (msg != "0") { var currentLinkId = 'deactivateLink'+job_id; var activateJobFunction = function() { Jobber.ActivateLink(job_id); }; var linkElement = document.getElementById(currentLinkId); linkElement.setAttribute('title', 'activate'); linkElement.setAttribute('onclick', activateJobFunction); linkElement.onclick = activateJobFunction; linkElement.innerHTML = '<img src="'+Jobber.jobber_admin_url+'img/icon_accept.gif" alt="activate" />'; linkElement.id = 'activateLink'+job_id; } } }); }, DeactivateSpotlight: function(job_id) { var url = Jobber.jobber_admin_url+'deactivate-spotlight/'; Jobber.SpotlightDeactivate(url, job_id); }, ActivateSpotlight: function(job_id) { var url = Jobber.jobber_admin_url+'activate-spotlight/'; Jobber.SpotlightActivate(url, job_id, 0); }, SpotlightActivate: function(url, job_id, is_first_page) { $.ajax({ type: "POST", url: url, data: "job_id=" + job_id, success: function(msg) { if (msg != "0") { var currentRowId = 'item'+job_id; var currentLinkId = 'activateSpotlight'+job_id; if(is_first_page == 1) { $("#"+currentRowId).css({ display: "none" }); } else { var deactivateSpotlightFunction = function() { Jobber.DeactivateSpotlight(job_id); }; var linkElement = document.getElementById(currentLinkId); linkElement.setAttribute('title', 'deactivate-spotlight'); linkElement.setAttribute('onclick', deactivateSpotlightFunction); linkElement.onclick = deactivateSpotlightFunction; linkElement.innerHTML = '<img src="'+Jobber.jobber_admin_url+'img/icon_spotlight_deactivate.gif" alt="deactivate" />'; linkElement.id = 'deactivateSpotlight'+job_id; } } } }); }, SpotlightDeactivate: function(url, job_id) { $.ajax({ type: "POST", url: url, data: "job_id=" + job_id, success: function(msg) { if (msg != "0") { var currentLinkId = 'deactivateSpotlight'+job_id; var activateSpotlightFunction = function() { Jobber.ActivateSpotlight(job_id); }; var linkElement = document.getElementById(currentLinkId); linkElement.setAttribute('title', 'activate-spotlight'); linkElement.setAttribute('onclick', activateSpotlightFunction); linkElement.onclick = activateSpotlightFunction; linkElement.innerHTML = '<img src="'+Jobber.jobber_admin_url+'img/icon_spotlight_activate.gif" alt="activate" />'; linkElement.id = 'activateSpotlight'+job_id; } } }); }, Delete: function(url, job_id) { if(confirm(Jobber.I18n.js.delete_job_confirmation_question)) { $.ajax({ type: "POST", url: url, data: "job_id=" + job_id, success: function(msg) { if (msg != "0") { var currentJobId = 'item'+job_id; $("#"+currentJobId).css({ display: "none" }); } } }); } else return false; } } })();
import React, { PropTypes } from 'react' import { Field, reduxForm } from 'redux-form' import { Link } from 'react-router' import RaisedButton from 'material-ui/RaisedButton' import TextField from 'components/TextField' // import BinaryToggle from 'components/BinaryToggle' import { ACCOUNT_FORM_NAME, HOME_PATH } from 'constants' import ProviderDataForm from '../ProviderDataForm' import classes from './AccountForm.scss' export const AccountForm = ({ account, handleSubmit, submitting }) => ( <form className={classes.container} onSubmit={handleSubmit}> <h4>Account</h4> <Field name='displayName' component={TextField} label='Display Name' /> <Field name='email' component={TextField} label='Email' /> <Field name='height' component={TextField} label='Height' /> { !!account && !!account.providerData && <div> <h4>Linked Accounts</h4> <ProviderDataForm providerData={account.providerData} /> </div> } <div> <Link to={HOME_PATH}> <RaisedButton secondary label='Cancel' className={classes.submit} /> </Link> <RaisedButton primary label='Save' type='submit' className={classes.submit} /> </div> </form> ) AccountForm.propTypes = { account: PropTypes.object, handleSubmit: PropTypes.func, submitting: PropTypes.bool } export default reduxForm({ form: ACCOUNT_FORM_NAME })(AccountForm)
var BaseMethod = require('./basemethod'); var Error = require('../error'); var AccountsMethods = { base: BaseMethod.extend({ dataFunction: function(data, cb){ if (typeof(data['account_id']) != 'undefined') delete data['account_id']; cb(null, data); } }), get: BaseMethod.extend({ requiredParams: [ 'account_id' ] }), delete: BaseMethod.extend({ requiredParams: [ 'account_id' ], method: "DELETE" }), search: BaseMethod.extend({ requiredParams: [ 'q' ], method: "GET", dataFunction: function(data, cb) { this.path = "storage/search/?q=" + data['q']; cb(null, data); } }) } module.exports = AccountsMethods;
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'iframe', 'th', { border: 'Show frame border', // MISSING noUrl: 'Please type the iframe URL', // MISSING scrolling: 'Enable scrollbars', // MISSING title: 'IFrame Properties', // MISSING toolbar: 'IFrame' } );
var labelType, useGradients, nativeTextSupport, animate; (function() { var ua = navigator.userAgent, iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), typeOfCanvas = typeof HTMLCanvasElement, nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), textSupport = nativeCanvasSupport && (typeof document.createElement('canvas').getContext('2d').fillText == 'function'); //I'm setting this based on the fact that ExCanvas provides text support for IE //and that as of today iPhone/iPad current text support is lame labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML'; nativeTextSupport = labelType == 'Native'; useGradients = nativeCanvasSupport; animate = !(iStuff || !nativeCanvasSupport); })(); function init(){ // init ForceDirected var fd = new $jit.NetworkMap({ //id of the visualization container injectInto: 'infovis', //Enable zooming and panning //by scrolling and DnD Navigation: { enable: true, //Enable panning events only if we're dragging the empty //canvas (and not a node). panning: true, //'avoid nodes', zooming: 80 //zoom speed. higher is more sensible }, // Change node and edge styles such as // color and width. // These properties are also set per node // with dollar prefixed data-properties in the // JSON structure. Node: { overridable: true, dim: 20 }, Edge: { overridable: true, color: '#23A4FF', lineWidth: 1, type: 'arrowpipe' }, //Native canvas text styling Label: { type: 'HTML', //Native or HTML // TODO: can't move nodes properly with HTML labels - may need to overide navigation class size: 10, style: 'bold' }, // Add node events Events: { enable: true, type: 'Native', // use the default events system onMouseMove: function(node, eventInfo, e) { var edge = eventInfo.getEdge(); if (this.current) this.current.remove(); if (!edge) return; var n1 = edge.nodeFrom, n2 = edge.nodeTo, n1f = fd.fitsInCanvas(fd.p2c(n1.getPos())), n2f = fd.fitsInCanvas(fd.p2c(n2.getPos())); if (n1f && n2f || !n1f && !n2f) { return; } var to = n1f ? n2 : n1; var from = n1f ? n1 : n2; this.current = jQuery('<div>To ' + to.name + '</div>') .css({ position: 'absolute', left: e.clientX, top: e.clientY - 30, color: '#ddd' }) .appendTo(document.body); }, onMouseWheel: function() { }, //Change cursor style when hovering a node onMouseEnter: function() { fd.canvas.getElement().style.cursor = 'move'; }, onMouseLeave: function() { fd.canvas.getElement().style.cursor = ''; }, //Update node positions when dragged onDragMove: function(node, eventInfo, e) { //var pos = eventInfo.getPos(); //node.pos.setc(pos.x, pos.y); //fd.plot(); }, //Implement the same handler for touchscreens onTouchMove: function(node, eventInfo, e) { //$jit.util.event.stop(e); //stop default touchmove event //this.onDragMove(node, eventInfo, e); }, //Add also a click handler to nodes onClick: function(node, eventInfo, e) { var edge = eventInfo.getEdge(); if (!edge) return; var n1 = edge.nodeFrom, n2 = edge.nodeTo, n1f = fd.fitsInCanvas(fd.p2c(n1.getPos())), n2f = fd.fitsInCanvas(fd.p2c(n2.getPos())); if (n1f && n2f || !n1f && !n2f) { return; } var from = n1f ? n1 : n2; var to = n1f ? n2 : n1; fd.followEdge(from, to, 2); }, onRightClick: function(node, eventInfo, e) { if (node) fd.zoomNode(node, 1, 30); } }, bgAlpha: 0.25, onCreateLabel: function(domElement, node){ if (node.data.parentID) { domElement.innerHTML = node.name; } else { domElement.innerHTML = node.id.substr(4); } var style = domElement.style; style.fontSize = "0.8em"; style.color = "#000"; style.backgroundColor = "rgba(255,255,255,0.90)"; style.padding = "1px"; style.whiteSpace= "nowrap"; }, // Change node styles when DOM labels are placed // or moved. onPlaceLabel: function(domElement, node){ var style = domElement.style; var left = parseInt(style.left); var top = parseInt(style.top); var w = domElement.offsetWidth; style.left = (left - w / 2) + 'px'; style.top = top + 'px'; } }); // load JSON data. $NetworkMap.Json.load('data/karen-detail.json', function(json) { var tx = 35, ty = 50, sx = 1.1, sy = 1.1; $NetworkMap.Utils.Metrics.initJSON(json); fd.loadJSON(json); $NetworkMap.Utils.Metrics.updateMetrics(fd); fd.refresh(); fd.canvas.scale(sx, sy); fd.canvas.translate(tx, ty); // overview test var over = new $NetworkMap.Views.OverviewManager(fd, jQuery('#overview'), 180, 150, {}, tx, ty); // overlay test var m = new $NetworkMap.Overlays.OverlayManager(fd); jQuery.getJSON('data/vlan910.json', function(vlans) { var vlan = vlans[0]; var select = jQuery('#selectVLAN'); var o = new $NetworkMap.Overlays.Overlay('vlans', function(viz, graph, canvas) { var ctx = canvas.getCtx(); ctx.save(); ctx.strokeStyle = 'fuchsia'; ctx.lineWidth = 2 / canvas.scaleOffsetX; graph.eachNode(function(n) { n.eachAdjacency(function(adj) { var nodeFrom = adj.nodeFrom, nodeTo = adj.nodeTo, posFrom = nodeFrom.getPos(), posTo = nodeTo.getPos(); if (vlan.devices[nodeFrom.id]) { if (vlan.devices[nodeFrom.id].links.indexOf(nodeTo.id) != -1) { ctx.beginPath(); ctx.moveTo(posFrom.x, posFrom.y); ctx.lineTo(posTo.x, posTo.y); ctx.closePath(); ctx.stroke(); } } }); }); ctx.restore(); }); m.add(o); o.stop(); select.append( jQuery('<option></option') .attr('value', vlan.id) .text(vlan.id)); select.change(function() { if (jQuery(this).val() == 'VLAN910') o.start(); else o.stop(); fd.refresh(); m.refresh(); }); }); // debug test //var debug = new $NetworkMap.Debug.GraphicalOutput(fd); //debug.enable(); // update metrics test //setInterval(function() { // $NetworkMap.Utils.Metrics.updateMetrics(fd); // fd.plot(); //}, 1000); //var button = jQuery('<input id="btnSave" type="button" value="save" />').click(function() { // $NetworkMap.Json.save('../../src/save.php', json, 'karen-detail.json'); //}); //jQuery(document.body).append(button); }); }
/* globals $ Template Meteor Session StatusMap */ Template.hostIssueList.events({ 'click .flag-enabled': function () { Meteor.call('disableIssueFlag', this.projectId, this.issueId) }, 'click .flag-disabled': function () { Meteor.call('enableIssueFlag', this.projectId, this.issueId) }, 'click #flag-filter-enable': function () { Session.set('hostIssueListFlagFilter', 'enabled') }, 'click #flag-filter-disable': function () { Session.set('hostIssueListFlagFilter', null) }, 'click .confirm-enabled': function () { Meteor.call('unconfirmIssue', this.projectId, this.issueId) }, 'click .confirm-disabled': function () { Meteor.call('confirmIssue', this.projectId, this.issueId) }, 'click .issue-status-button': function (event) { var id = 'hostIssueListStatusButton' + event.target.id if (Session.equals(id, null) || typeof Session.get(id) === 'undefined') { Session.set(id, 'disabled') return } Session.set(id, null) }, 'keyup #issue-list-search': function (event, tpl) { Session.set('hostIssueListSearch', tpl.find('#issue-list-search').value) }, 'click #remove-issue-list-search': function (event, tpl) { tpl.find('#issue-list-search').value = "" Session.set('hostIssueListSearch', null) }, 'click .issue-status': function () { var status = StatusMap[StatusMap.indexOf(this.status) + 1] if (StatusMap.indexOf(this.status) === 4) { status = StatusMap[0] } Meteor.call('setIssueStatus', this.projectId, this.issueId, status) }, 'click #remove-issues': function () { var inputs = $('.issue-checked') var issuesToRemove = [] inputs.each(function () { if ($(this).is(':checked')) { var parts = $(this).attr('id').split('-') issuesToRemove.push({ issueId: parts[0], port: parseInt(parts[1], 10), protocol: parts[2] }) } }) for (var i = 0; i < issuesToRemove.length; i++) { var issue = issuesToRemove[i] Meteor.call('removeHostFromIssue', this.projectId, issue.issueId, this.host.ipv4, issue.port, issue.protocol) } inputs.each(function () { $(this).prop('checked', false) }) } })
/** * Views to show a description and access to the role of the player. */ (function () { var Dom = require('dom'); var Plugin = require('plugin'); var Ui = require('ui'); var Db = require('db'); var Modal = require('modal'); var Server = require('server'); var Obs = require('obs'); var Constants = require('Constants')(); var VotingViews = require('VotingViews'); var UserModal = require('SelectUserModal'); var UserViews = require('UserViews'); /** * A box as used for containing the possible abilities/actions. * Similar to the box used for voting. * @param content the content for within the box. */ function actionBox(content) { Dom.div(function () { Dom.style({ 'background-color': 'white', 'box-shadow': '0 2px rgba(0,0,0,.1)', display: 'block', padding: '1em' }); content(); }); } /** * A button that is not usable. * @param text the text on the button */ function disabledButton(text) { Dom.div(function () { Dom.style({'background-color': '#A88698'}); Dom.cls('big-button'); Dom.text(text); }); } /** * Gives a description of a role. * @param name the name of the role * @param icon the name of the uri * @param content the content to display in the description as function using dom. */ function description(name, icon, content) { // the main color theme to use var color = '#ba1a6e'; Dom.div(function () { Dom.cls('role-description'); Dom.style({ border: '3px solid ' + color, display: 'block', padding: '1em', margin: '1em' }); // the header Dom.div(function () { Dom.h3(function () { Dom.style({ color: color }); Dom.span(function () { Dom.img(function () { Dom.prop('src', Plugin.resourceUri(icon)); }); }); Dom.text(name); }); }); // the content Dom.div(function () { content(); }); }); } function guardian(time) { /** Makes rpc call to protect the given user */ function protect(user) { Server.call('protect', user); } description('Guardian', 'shield.png', function () { Dom.div(function () { Dom.p( 'You are a guardian, protector of the innocent. ' + 'Each night you can secretely protect one of the citizens ' + 'from the gruesome deeds of the werewolves.' ); Dom.p( 'You win when all the werewolves are dead.' ); }); actionBox(function () { // the text section Dom.h3('Protect'); Dom.p( 'Select the citizen you want to protect. ' + 'You can not protect a single citizen twice in a row.' ); // the button var isAlive = Db.shared.get('users', Plugin.userId(), 'isAlive'); if (time.isNight && isAlive) { // when can protect // get the users that are still alive var users = UserViews.getUsers({isAlive: true}); // the user that we protected last time var prevProtect = Db.personal.get('protect', 'night' + (time.number - 1)); // remove prevProtect from user users = users.filter(function (user) { return user !== prevProtect; }); // and the user we may already have protected var nowProtect = Db.personal.get('protect', time.timeId); Ui.bigButton('Protect', UserModal.bind(this, users, 'Protect', Obs.create(nowProtect), protect)); } else { // Show reason why he can not protect Dom.div(function () { Dom.style({color: 'red'}); if (!time.isNight) Dom.text('You can only protect people during the night.'); else if (!isAlive) Dom.text('You are dead; you can not stop the werewolves like this!'); disabledButton('Protect'); }); } }); }); } function seer(time) { /** * Shows the role of the user in a separated modal. */ function investigate(user) { // ask the server for the role Server.call('investigateRole', user); } description('Watcher', 'seer.png', function () { Dom.div(function () { Dom.p( 'You are a watcher. ' + 'You can see straight through how people appear ' + 'to discover who they really are. ' + 'Each night you can investigate one person to find their true role.' ); Dom.p( 'You win when all the werewolves are dead.' ); // section to activate the seer power actionBox(function () { // some explanation Dom.p('Select who you want to investigate.' + 'You will be able to see his role during the next day.'); // the investigate button var isAlive = Db.shared.get('users', Plugin.userId(), 'isAlive'); var hasInvestigated = Db.personal.get('investigate', time.timeId); if (time.isNight && isAlive && !hasInvestigated) { // get the users that are still alive var users = UserViews.getUsers({isAlive: true}); Ui.bigButton('Investigate', UserModal.bind(this, users, 'Investigate', null, investigate)); } else { // we can not vote // reason why we can not vote Dom.div(function () { Dom.style({color: 'red'}); if (!time.isNight) Dom.text('You can only investigate people during the night.'); else if (!isAlive) Dom.text('You are dead; your investigate power is useless now!'); else if (hasInvestigated) Dom.text('You have already used this ability this night.'); }); disabledButton('Investigate'); } // display the role of the user selected in the previous night if (time.isDay && time.number > 0) { // get the id of the previous night var prevTimeId = 'night' + (time.number - 1); // get the investigation var investigated = Db.personal.get('investigate', prevTimeId); if (investigated) { // we have investigated last night // show what his role was Ui.item(function () { Ui.avatar(Plugin.userAvatar(investigated.user)); UserViews.name(investigated.user) Dom.span(function () { Dom.style({ margin: '1em', color: '#AAA' }); Dom.text(' is a '); }); nameOf(investigated.role); }); } else { // no one has been investigated Ui.item(function () { Dom.span(function () { Dom.style({ margin: '1em', color: '#AAA' }); Dom.text('You did not investigate anyone last night!'); }); }); } } }); }); }); } function werewolf(time) { description('Werewolf', 'wolf.png', function () { Dom.div(function () { Dom.p( 'You are a werewolf. ' + 'Together with the other werewolves you gather ' + 'each night to kill one of the citizens.' ); Dom.p( 'You win when there are only werewolves left in the village.' ); }); // show the voting for werewolves VotingViews.werewolves(time); }); } function citizen() { description('Citizen', 'citizen.png', function () { Dom.div(function () { Dom.p( 'You are an innocent citizen.' + 'You try to protect the village by revealing ' + 'the werewolves and lynching them.' ); Dom.p( 'You win when all the werewolves are dead.' ); }); }); } /** * Gives a description view of the given role. * @param time the current game time */ function descriptionOf(role, time) { // get a description based on the role switch(role) { case Constants.roles.CITIZEN: citizen(); break; case Constants.roles.WEREWOLF: werewolf(time); break; case Constants.roles.SEER: seer(time); break; case Constants.roles.GUARDIAN: guardian(time); break; } } /** * Renders the name with the image found and the given source and the given text. */ function name(icon, text) { Dom.span(function () { Dom.style({ textTransform: 'initial', margin: '4px', color: Plugin.colors().highlight }); // small image indicating the role Dom.img(function () { Dom.style({ height: '1em', width: '1em' }); Dom.prop('src', Plugin.resourceUri(icon)); }); // the text showing the role Dom.text(text); }); } /** * Displays the name of the role (with a symbol and such.) */ function nameOf(role) { switch(role) { case Constants.roles.CITIZEN: name('citizen.png', 'Citizen'); break; case Constants.roles.WEREWOLF: name('wolf.png', 'Werewolf'); break; case Constants.roles.SEER: name('seer.png', 'Watcher'); break; case Constants.roles.GUARDIAN: name('shield.png', 'Guardian'); break; } } /** * A view giving a description and access to the given role. */ exports.description = descriptionOf; exports.name = nameOf; }());
// Generated on 2015-01-22 using generator-angular-fullstack 2.0.13 'use strict'; module.exports = function (grunt) { var localConfig; try { localConfig = require('./server/config/local.env'); } catch(e) { localConfig = {}; } // Load grunt tasks automatically, when needed require('jit-grunt')(grunt, { express: 'grunt-express-server', useminPrepare: 'grunt-usemin', ngtemplates: 'grunt-angular-templates', cdnify: 'grunt-google-cdn', protractor: 'grunt-protractor-runner', injector: 'grunt-asset-injector', buildcontrol: 'grunt-build-control' }); // Time how long tasks take. Can help when optimizing build times require('time-grunt')(grunt); // Define the configuration for all the tasks grunt.initConfig({ // Project settings pkg: grunt.file.readJSON('package.json'), yeoman: { // configurable paths client: require('./bower.json').appPath || 'client', dist: 'dist' }, express: { options: { port: 9000 }, dev: { options: { script: 'server.js', debug: true } }, prod: { options: { script: 'dist/server.js' } } }, open: { server: { url: 'http://localhost:<%= express.options.port %>' } }, watch: { injectJS: { files: [ '<%= yeoman.client %>/{app,components}/**/*.js', '!<%= yeoman.client %>/{app,components}/**/*.spec.js', '!<%= yeoman.client %>/{app,components}/**/*.mock.js', '!<%= yeoman.client %>/server.js'], tasks: ['injector:scripts'] }, injectCss: { files: [ '<%= yeoman.client %>/{app,components}/**/*.css' ], tasks: ['injector:css'] }, mochaTest: { files: ['server/**/*.spec.js'], tasks: ['env:test', 'mochaTest'] }, jsTest: { files: [ '<%= yeoman.client %>/{app,components}/**/*.spec.js', '<%= yeoman.client %>/{app,components}/**/*.mock.js' ], tasks: ['newer:jshint:all', 'karma'] }, gruntfile: { files: ['Gruntfile.js'] }, livereload: { files: [ '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.css', '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.html', '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js', '!{.tmp,<%= yeoman.client %>}{app,components}/**/*.spec.js', '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js', '<%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}' ], options: { livereload: true } }, express: { files: [ 'server/**/*.{js,json}' ], tasks: ['express:dev', 'wait'], options: { livereload: true, nospawn: true //Without this option specified express won't be reloaded } } }, // Make sure code styles are up to par and there are no obvious mistakes jshint: { options: { jshintrc: '<%= yeoman.client %>/.jshintrc', reporter: require('jshint-stylish') }, server: { options: { jshintrc: 'server/.jshintrc' }, src: [ 'server/**/*.js', '!server/**/*.spec.js' ] }, serverTest: { options: { jshintrc: 'server/.jshintrc-spec' }, src: ['server/**/*.spec.js'] }, all: [ '<%= yeoman.client %>/{app,components}/**/*.js', '!<%= yeoman.client %>/{app,components}/**/*.spec.js', '!<%= yeoman.client %>/{app,components}/**/*.mock.js' ], test: { src: [ '<%= yeoman.client %>/{app,components}/**/*.spec.js', '<%= yeoman.client %>/{app,components}/**/*.mock.js' ] } }, // Empties folders to start fresh clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*', '!<%= yeoman.dist %>/.openshift', '!<%= yeoman.dist %>/Procfile' ] }] }, server: '.tmp' }, // Add vendor prefixed styles autoprefixer: { options: { browsers: ['last 1 version'] }, dist: { files: [{ expand: true, cwd: '.tmp/', src: '{,*/}*.css', dest: '.tmp/' }] } }, // Debugging with node inspector 'node-inspector': { custom: { options: { 'web-host': 'localhost' } } }, // Use nodemon to run server in debug mode with an initial breakpoint nodemon: { debug: { script: 'server.js', options: { nodeArgs: ['--debug-brk'], env: { PORT: 9000 }, callback: function (nodemon) { nodemon.on('log', function (event) { console.log(event.colour); }); // opens browser on initial server start nodemon.on('config:update', function () { setTimeout(function () { require('open')('http://localhost:8080/debug?port=5858'); }, 500); }); } } } }, // Automatically inject Bower components into the app wiredep: { target: { src: '<%= yeoman.client %>/index.html', ignorePath: '<%= yeoman.client %>/', exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/'] } }, // Renames files for browser caching purposes rev: { dist: { files: { src: [ '<%= yeoman.dist %>/public/{,*/}*.js', '<%= yeoman.dist %>/public/{,*/}*.css', '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', '<%= yeoman.dist %>/public/assets/fonts/*' ] } } }, // Reads HTML for usemin blocks to enable smart builds that automatically // concat, minify and revision files. Creates configurations in memory so // additional tasks can operate on them useminPrepare: { html: ['<%= yeoman.client %>/index.html'], options: { dest: '<%= yeoman.dist %>/public' } }, // Performs rewrites based on rev and the useminPrepare configuration usemin: { html: ['<%= yeoman.dist %>/public/{,*/}*.html'], css: ['<%= yeoman.dist %>/public/{,*/}*.css'], js: ['<%= yeoman.dist %>/public/{,*/}*.js'], options: { assetsDirs: [ '<%= yeoman.dist %>/public', '<%= yeoman.dist %>/public/assets/images' ], // This is so we update image references in our ng-templates patterns: { js: [ [/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images'] ] } } }, // The following *-min tasks produce minified files in the dist folder imagemin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.client %>/assets/images', src: '{,*/}*.{png,jpg,jpeg,gif}', dest: '<%= yeoman.dist %>/public/assets/images' }] } }, svgmin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.client %>/assets/images', src: '{,*/}*.svg', dest: '<%= yeoman.dist %>/public/assets/images' }] } }, // Allow the use of non-minsafe AngularJS files. Automatically makes it // minsafe compatible so Uglify does not destroy the ng references ngAnnotate: { dist: { files: [{ expand: true, cwd: '.tmp/concat', src: '*/**.js', dest: '.tmp/concat' }] } }, // Package all the html partials into a single javascript payload ngtemplates: { options: { // This should be the name of your apps angular module module: 'badgerApp', htmlmin: { collapseBooleanAttributes: true, collapseWhitespace: true, removeAttributeQuotes: true, removeEmptyAttributes: true, removeRedundantAttributes: true, removeScriptTypeAttributes: true, removeStyleLinkTypeAttributes: true }, usemin: 'server.js' }, main: { cwd: '<%= yeoman.client %>', src: ['{app,components}/**/*.html'], dest: '.tmp/templates.js' }, tmp: { cwd: '.tmp', src: ['{app,components}/**/*.html'], dest: '.tmp/tmp-templates.js' } }, // Replace Google CDN references cdnify: { dist: { html: ['<%= yeoman.dist %>/public/*.html'] } }, // Copies remaining files to places other tasks can use copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.client %>', dest: '<%= yeoman.dist %>/public', src: [ '*.{ico,png,txt}', '.htaccess', 'bower_components/**/*', 'assets/images/{,*/}*.{webp}', 'assets/fonts/**/*', 'index.html' ] }, { expand: true, cwd: '.tmp/images', dest: '<%= yeoman.dist %>/public/assets/images', src: ['generated/*'] }, { expand: true, dest: '<%= yeoman.dist %>', src: [ 'package.json', 'server/**/*' ] }] }, styles: { expand: true, cwd: '<%= yeoman.client %>', dest: '.tmp/', src: ['{app,components}/**/*.css'] } }, buildcontrol: { options: { dir: 'dist', commit: true, push: true, connectCommits: false, message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%' }, heroku: { options: { remote: 'heroku', branch: 'master' } }, openshift: { options: { remote: 'openshift', branch: 'master' } } }, // Run some tasks in parallel to speed up the build process concurrent: { server: [ ], test: [ ], debug: { tasks: [ 'nodemon', 'node-inspector' ], options: { logConcurrentOutput: true } }, dist: [ 'imagemin', 'svgmin' ] }, // Test settings karma: { unit: { configFile: 'karma.conf.js', singleRun: true } }, mochaTest: { options: { reporter: 'spec' }, src: ['server/**/*.spec.js'] }, protractor: { options: { configFile: 'protractor.conf.js' }, chrome: { options: { args: { browser: 'chrome' } } } }, env: { test: { NODE_ENV: 'test' }, prod: { NODE_ENV: 'production' }, all: localConfig }, injector: { options: { }, // Inject application script files into index.html (doesn't include bower) scripts: { options: { transform: function(filePath) { filePath = filePath.replace('/client/', ''); filePath = filePath.replace('/.tmp/', ''); return '<script src="' + filePath + '"></script>'; }, starttag: '<!-- injector:js -->', endtag: '<!-- endinjector -->' }, files: { '<%= yeoman.client %>/index.html': [ ['{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js', '!{.tmp,<%= yeoman.client %>}/app/app.js', '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.spec.js', '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js'] ] } }, // Inject component css into index.html css: { options: { transform: function(filePath) { filePath = filePath.replace('/client/', ''); filePath = filePath.replace('/.tmp/', ''); return '<link rel="stylesheet" href="' + filePath + '">'; }, starttag: '<!-- injector:css -->', endtag: '<!-- endinjector -->' }, files: { '<%= yeoman.client %>/index.html': [ '<%= yeoman.client %>/{app,components}/**/*.css' ] } } }, }); // Used for delaying livereload until after server has restarted grunt.registerTask('wait', function () { grunt.log.ok('Waiting for server reload...'); var done = this.async(); setTimeout(function () { grunt.log.writeln('Done waiting!'); done(); }, 1500); }); grunt.registerTask('express-keepalive', 'Keep grunt running', function() { this.async(); }); grunt.registerTask('serve', function (target) { if (target === 'dist') { return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']); } if (target === 'debug') { return grunt.task.run([ 'clean:server', 'env:all', 'concurrent:server', 'injector', 'wiredep', 'autoprefixer', 'concurrent:debug' ]); } grunt.task.run([ 'clean:server', 'env:all', 'concurrent:server', 'injector', 'wiredep', 'autoprefixer', 'express:dev', 'wait', 'open', 'watch' ]); }); grunt.registerTask('server', function () { grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); grunt.task.run(['serve']); }); grunt.registerTask('test', function(target) { if (target === 'server') { return grunt.task.run([ 'env:all', 'env:test', 'mochaTest' ]); } else if (target === 'client') { return grunt.task.run([ 'clean:server', 'env:all', 'concurrent:test', 'injector', 'autoprefixer', 'karma' ]); } else if (target === 'e2e') { return grunt.task.run([ 'clean:server', 'env:all', 'env:test', 'concurrent:test', 'injector', 'wiredep', 'autoprefixer', 'express:dev', 'protractor' ]); } else grunt.task.run([ 'test:server', 'test:client' ]); }); grunt.registerTask('build', [ 'clean:dist', 'concurrent:dist', 'injector', 'wiredep', 'useminPrepare', 'autoprefixer', 'ngtemplates', 'concat', 'ngAnnotate', 'copy:dist', 'cdnify', 'cssmin', 'uglify', 'rev', 'usemin' ]); grunt.registerTask('default', [ 'newer:jshint', 'test', 'build' ]); };
const mongoose = require('mongoose'); const Schema = mongoose.Schema; const schema = new Schema({ accType: { type: String, enum: ['individual', 'family', 'organization'], required: true }, members: [{ user: { type: Schema.Types.ObjectId, ref: 'User', required: true }, role: { type: String, enum: ['owner', 'viewer'] }, _id: false }], list: [{ type: Schema.Types.ObjectId, ref: 'List' }] }); module.exports = mongoose.model('Account', schema);
import m from 'mithril'; import prop from 'mithril/stream'; import h from '../h'; import _ from 'underscore'; import balanceTransferListVM from '../vms/balance-transfer-list-vm'; import balanceTransferFilterVM from '../vms/balance-transfer-filter-vm'; import adminList from '../c/admin-list'; import adminFilter from '../c/admin-filter'; import filterMain from '../c/filter-main'; import filterDropdown from '../c/filter-dropdown'; import filterDateRange from '../c/filter-date-range'; import filterNumberRange from '../c/filter-number-range'; import modalBox from '../c/modal-box'; import adminBalanceTransferItem from '../c/admin-balance-transfer-item'; import adminBalanceTransferItemDetail from '../c/admin-balance-transfer-item-detail'; const adminBalanceTranfers = { oninit: function(vnode) { const listVM = balanceTransferListVM, filterVM = balanceTransferFilterVM(), authorizedListVM = balanceTransferListVM, authorizedFilterVM = balanceTransferFilterVM(), authorizedCollection = prop([]), error = prop(''), selectedAny = prop(false), filterBuilder = [ { component: filterMain, data: { vm: filterVM.full_text_index, placeholder: 'Busque pelo email, ids do usuario, ids de transferencia e eventos de saldo' } }, { component: filterDropdown, data: { label: 'Status', name: 'state', vm: filterVM.state, options: [{ value: '', option: 'Qualquer um' }, { value: 'pending', option: 'Pendente' }, { value: 'authorized', option: 'Autorizado' }, { value: 'processing', option: 'Processando' }, { value: 'transferred', option: 'Concluido' }, { value: 'error', option: 'Erro' }, { value: 'rejected', option: 'Rejeitado' }, { value: 'gateway_error', option: 'Erro no gateway' }] } }, { component: filterDateRange, data: { label: 'Data da solicitação', first: filterVM.created_date.gte, last: filterVM.created_date.lte } }, { component: filterDateRange, data: { label: 'Data da confirmação', first: filterVM.transferred_date.gte, last: filterVM.transferred_date.lte } }, { component: filterNumberRange, data: { label: 'Valores entre', first: filterVM.amount.gte, last: filterVM.amount.lte } } ], selectedItemsIDs = prop([]), displayApprovalModal = h.toggleProp(false, true), displayManualModal = h.toggleProp(false, true), displayRejectModal = h.toggleProp(false, true), displayProcessTransfer = h.toggleProp(false, true), processingTranfersLoader = h.toggleProp(false, true), selectAllLoading = prop(false), redrawProp = prop(false), actionMenuToggle = h.toggleProp(false, true), isSelected = item_id => _.find(selectedItemsIDs(), i => i.id == item_id), selectItem = (item) => { if (!_.find(selectedItemsIDs(), i => i.id == item.id)) { selectedItemsIDs().push(item); } selectedAny(true); }, unSelectItem = (item) => { const newIDs = _.reject(selectedItemsIDs(), i => i.id == item.id); selectedItemsIDs(newIDs); if (_.isEmpty(newIDs)) { selectedAny(false); } }, loadAuthorizedBalances = () => { authorizedFilterVM.state('authorized'); authorizedFilterVM.getAllBalanceTransfers(authorizedFilterVM).then((data) => { authorizedCollection(data); m.redraw(); }); }, submit = () => { error(false); listVM.firstPage(filterVM.parameters()).then(_ => m.redraw(), (serverError) => { error(serverError.message); m.redraw(); }); return false; }, generateWrapperModal = (customAttrs) => { const wrapper = { view: function({state, attrs}) { actionMenuToggle(false); return m('', [ m('.modal-dialog-header', [ m('.fontsize-large.u-text-center', attrs.modalTitle) ]), m('.modal-dialog-content', [ m('.w-row.fontweight-semibold', [ m('.w-col.w-col-6', 'Nome'), m('.w-col.w-col-3', 'Valor'), m('.w-col.w-col-3', 'Solicitado em'), ]), _.map(selectedItemsIDs(), (item, index) => m('.divider.fontsize-smallest.lineheight-looser', [ m('.w-row', [ m('.w-col.w-col-6', [ m('span', item.user_name) ]), m('.w-col.w-col-3', [ m('span', `R$ ${h.formatNumber(item.amount, 2, 3)}`) ]), m('.w-col.w-col-3', [ m('span', h.momentify(item.created_at)) ]), ]) ])), m('.w-row.fontweight-semibold.divider', [ m('.w-col.w-col-6', 'Total'), m('.w-col.w-col-3', `R$ ${h.formatNumber(_.reduce(selectedItemsIDs(), (t, i) => t + i.amount, 0), 2, 3)}`), m('.w-col.w-col-3'), ]), m('.w-row.u-margintop-40', [ m('.w-col.w-col-1'), m('.w-col.w-col-5', m('a.btn.btn-medium.w-button', { onclick: attrs.onClickCallback }, attrs.ctaText) ), m('.w-col.w-col-5', m('a.btn.btn-medium.btn-terciary.w-button', { onclick: attrs.displayModal.toggle }, 'Voltar') ), m('.w-col.w-col-1') ]) ]) ]); } }; return [wrapper, customAttrs]; }, manualTransferSelectedIDs = () => { m.request({ method: 'POST', url: '/admin/balance_transfers/batch_manual', data: { transfer_ids: _.uniq(_.map(selectedItemsIDs(), s => s.id)) }, config: h.setCsrfToken }).then((data) => { selectedItemsIDs([]); listVM.firstPage(filterVM.parameters()); displayManualModal(false); m.redraw(); }); }, approveSelectedIDs = () => { m.request({ method: 'POST', url: '/admin/balance_transfers/batch_approve', data: { transfer_ids: _.uniq(_.map(selectedItemsIDs(), s => s.id)) }, config: h.setCsrfToken }).then((data) => { selectedItemsIDs([]); listVM.firstPage(filterVM.parameters()); loadAuthorizedBalances(); displayApprovalModal(false); m.redraw(); }); }, //processAuthorizedTransfers = () => { // processingTranfersLoader(true); // m.redraw(); // m.request({ // method: 'POST', // url: '/admin/balance_transfers/process_transfers', // data: {}, // config: h.setCsrfToken // }).then((data) => { // listVM.firstPage(filterVM.parameters()); // loadAuthorizedBalances(); // displayProcessTransfer(false); // processingTranfersLoader(false); // m.redraw(); // }); //}, rejectSelectedIDs = () => { m.request({ method: 'POST', url: '/admin/balance_transfers/batch_reject', data: { transfer_ids: _.uniq(_.map(selectedItemsIDs(), s => s.id)) }, config: h.setCsrfToken }).then((data) => { selectedItemsIDs([]); displayRejectModal(false); listVM.firstPage(); m.redraw(); }); }, unSelectAll = () => { selectedItemsIDs([]); selectedAny(false); }, selectAll = () => { selectAllLoading(true); m.redraw(); filterVM.getAllBalanceTransfers(filterVM).then((data) => { _.map(_.where(data, { state: 'pending' }), selectItem); selectAllLoading(false); m.redraw(); }); }, inputActions = () => { const authorizedSum = h.formatNumber(_.reduce(authorizedCollection(), (memo, item) => memo + item.amount, 0), 2, 3); return m('', [ m('button.btn.btn-inline.btn-small.btn-terciary.u-marginright-20.w-button', { onclick: selectAll }, (selectAllLoading() ? 'carregando...' : 'Selecionar todos')), (selectedItemsIDs().length > 1 ? m('button.btn.btn-inline.btn-small.btn-terciary.u-marginright-20.w-button', { onclick: unSelectAll }, `Desmarcar todos (${selectedItemsIDs().length})`) : ''), (selectedAny() ? m('.w-inline-block', [ m('button.btn.btn-inline.btn-small.btn-terciary.w-button', { onclick: actionMenuToggle.toggle }, [ `Marcar como (${selectedItemsIDs().length})`, ]), (actionMenuToggle() ? m('.card.dropdown-list.dropdown-list-medium.u-radius.zindex-10[id=\'transfer\']', [ m('a.dropdown-link.fontsize-smaller[href=\'javascript:void(0);\']', { onclick: event => displayApprovalModal.toggle() }, 'Aprovada'), m('a.dropdown-link.fontsize-smaller[href=\'javascript:void(0);\']', { onclick: event => displayManualModal.toggle() }, 'Transferencia manual'), m('a.dropdown-link.fontsize-smaller[href=\'javascript:void(0);\']', { onclick: event => displayRejectModal.toggle() }, 'Recusada') ]) : '') ]) : ''), //(authorizedCollection().length > 0 ? m('._w-inline-block.u-right', [ // m('button.btn.btn-small.btn-inline', { // onclick: displayProcessTransfer.toggle // }, `Repassar saques aprovados (${authorizedCollection().length})`), // (displayProcessTransfer() ? m('.dropdown-list.card.u-radius.dropdown-list-medium.zindex-10', [ // m('.w-form', [ // (processingTranfersLoader() ? h.loader() : m('form', [ // m('label.fontsize-smaller.umarginbottom-20', `Tem certeza que deseja repassar ${authorizedCollection().length} saques aprovados (total de R$ ${authorizedSum}) ?`), // m('button.btn.btn-small', { // onclick: processAuthorizedTransfers // }, 'Repassar saques aprovados') // ])) // ]) // ]) : '') //]) : '') ]); }; loadAuthorizedBalances(); vnode.state = { displayApprovalModal, displayRejectModal, displayManualModal, displayProcessTransfer, authorizedCollection, generateWrapperModal, approveSelectedIDs, manualTransferSelectedIDs, //processAuthorizedTransfers, rejectSelectedIDs, filterVM, filterBuilder, listVM: { hasInputAction: true, inputActions, list: listVM, selectedItemsIDs, selectItem, unSelectItem, selectedAny, isSelected, redrawProp, error }, data: { label: 'Pedidos de saque' }, submit }; }, view: function({state, attrs}) { return m('', [ m(adminFilter, { filterBuilder: state.filterBuilder, submit: state.submit }), (state.displayApprovalModal() ? m(modalBox, { displayModal: state.displayApprovalModal, content: state.generateWrapperModal({ modalTitle: 'Aprovar saques', ctaText: 'Aprovar', displayModal: state.displayApprovalModal, onClickCallback: state.approveSelectedIDs }) }) : ''), (state.displayManualModal() ? m(modalBox, { displayModal: state.displayManualModal, content: state.generateWrapperModal({ modalTitle: 'Transferencia manual de saques', ctaText: 'Aprovar', displayModal: state.displayManualModal, onClickCallback: state.manualTransferSelectedIDs }) }) : ''), (state.displayRejectModal() ? m(modalBox, { displayModal: state.displayRejectModal, content: state.generateWrapperModal({ modalTitle: 'Rejeitar saques', ctaText: 'Rejeitar', displayModal: state.displayRejectModal, onClickCallback: state.rejectSelectedIDs }) }) : ''), m(adminList, { vm: state.listVM, listItem: adminBalanceTransferItem, listDetail: adminBalanceTransferItemDetail }) ]); } }; export default adminBalanceTranfers;
define(['base/querystring'], function(QueryString) { 'use strict'; describe('QueryString.parse', function() { describe('Options', function() { it('should parse object with defaults', function() { var result = QueryString.parse('a=1&b[0]=1&b[1][0]=5&b[1][1][f]=false&b[1][1][s]=7&b[2]=3&c=false&d[a]=1&d[b]=2'); expect(result.a).to.be.eql(1); expect(result.b).to.be.eql([1, [5, {f: false, s: 7}], 3]); }); it('should parse object with custom delimiter', function() { var str = 'a=1;b[0]=1;b[1][0]=5;b[1][1][f]=false;b[1][1][s]=7;b[2]=3;c=false;d[a]=1;d[b]=2', result = QueryString.parse(str, { delimiter: ';' }); expect(result.a).to.be.eql(1); expect(result.b).to.be.eql([1, [5, {f: false, s: 7}], 3]); }); it ('should parse object with custom key-value delimiter', function() { var str = 'a:1&b[0]:1&b[1][0]:5&b[1][1][f]:false&b[1][1][s]:7&b[2]:3&c:false&d[a]:1&d[b]:2', result = QueryString.parse(str, { eq: ':' }); expect(result.a).to.be.eql(1); expect(result.b).to.be.eql([1, [5, {f: false, s: 7}], 3]); }); }); }); });
import m from "mithril"; import { router } from "../router"; export const Brewer = { view: ({ attrs: { state, routing } }) => { const id = routing.localSegment.params.id; return m( "div", m("div", state.brewer[id]), m("div", m("a", { href: router.toPath(routing.parentRoute()) }, "Close")) ); } };
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); let _ = require('lodash'); const pip_services_commons_node_1 = require("pip-services-commons-node"); const pip_services_commons_node_2 = require("pip-services-commons-node"); const pip_services_commons_node_3 = require("pip-services-commons-node"); const pip_services_commons_node_4 = require("pip-services-commons-node"); const pip_services_commons_node_5 = require("pip-services-commons-node"); const pip_services_commons_node_6 = require("pip-services-commons-node"); const pip_services_commons_node_7 = require("pip-services-commons-node"); const pip_services_commons_node_8 = require("pip-services-commons-node"); const pip_services_commons_node_9 = require("pip-services-commons-node"); const pip_services_commons_node_10 = require("pip-services-commons-node"); const pip_services_net_node_1 = require("pip-services-net-node"); class FacadeOperations { constructor() { this._logger = new pip_services_commons_node_3.CompositeLogger(); this._counters = new pip_services_commons_node_4.CompositeCounters(); this._dependencyResolver = new pip_services_commons_node_5.DependencyResolver(); } configure(config) { this._dependencyResolver.configure(config); } setReferences(references) { this._logger.setReferences(references); this._counters.setReferences(references); this._dependencyResolver.setReferences(references); } getCorrelationId(req) { return req.params.correlation_id; } getFilterParams(req) { let filter = pip_services_commons_node_1.FilterParams.fromValue(_.omit(req.query, 'skip', 'take', 'total')); return filter; } getPagingParams(req) { let paging = pip_services_commons_node_2.PagingParams.fromValue(_.pick(req.query, 'skip', 'take', 'total')); return paging; } sendResult(req, res) { return pip_services_net_node_1.HttpResponseSender.sendResult(req, res); } sendEmptyResult(req, res) { return pip_services_net_node_1.HttpResponseSender.sendEmptyResult(req, res); } sendCreatedResult(req, res) { return pip_services_net_node_1.HttpResponseSender.sendCreatedResult(req, res); } sendDeletedResult(req, res) { return pip_services_net_node_1.HttpResponseSender.sendDeletedResult(req, res); } sendError(req, res, error) { pip_services_net_node_1.HttpResponseSender.sendError(req, res, error); } sendBadRequest(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_6.BadRequestException(correlationId, 'BAD_REQUEST', message); this.sendError(req, res, error); } sendUnauthorized(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_7.UnauthorizedException(correlationId, 'UNAUTHORIZED', message); this.sendError(req, res, error); } sendNotFound(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_8.NotFoundException(correlationId, 'NOT_FOUND', message); this.sendError(req, res, error); } sendConflict(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_9.ConflictException(correlationId, 'CONFLICT', message); this.sendError(req, res, error); } sendSessionExpired(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_10.UnknownException(correlationId, 'SESSION_EXPIRED', message); error.status = 440; this.sendError(req, res, error); } sendInternalError(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_10.UnknownException(correlationId, 'INTERNAL', message); this.sendError(req, res, error); } sendServerUnavailable(req, res, message) { let correlationId = this.getCorrelationId(req); let error = new pip_services_commons_node_9.ConflictException(correlationId, 'SERVER_UNAVAILABLE', message); error.status = 503; this.sendError(req, res, error); } } exports.FacadeOperations = FacadeOperations; //# sourceMappingURL=FacadeOperations.js.map
'use strict'; module.exports = { flatten: require('./flatten'), unflatten: require('./unflatten'), stringify: require('./stringify'), parse: require('./parse') };
var https = require('https'); var express = require('express'); var async = require('async'); var officegen = require('officegen'); var app = express(); var $ = require('cheerio'); var fs = require('fs'); var path = require('path'); var curator = require('./node_modules/art-curator/dist/index.js'); var mammoth = require("mammoth"); var striptags = require('striptags'); var util = require('util'); var Busboy = require('busboy'); var busboy = require('connect-busboy'); var MongoClient = require('mongodb').MongoClient; var bodyParser = require('body-parser'); var Jimp = require('jimp'); require('dotenv').config(); $.prototype.eq = function (placement) { var eq = []; this.each(function (index, item) { if (index == placement) { eq.push(item); } }); return $(eq); } module.exports = { normalizeLocation: normalizeLocation } var ssl = { cert: fs.readFileSync('/etc/letsencrypt/live/trineura.cf/fullchain.pem'), key: fs.readFileSync('/etc/letsencrypt/live/trineura.cf/privkey.pem') }; app.use(bodyParser.json({limit: '50mb'})); app.use(busboy()); app.set('port', (process.env.PORT || 5000)); app.use(express.static(__dirname + '/app')); //views is directory for all template files app.set('views', __dirname + '/app'); app.engine('html', require('ejs').renderFile); app.get('/', function (request, response) { response.render('app/index.html'); }); var http = require('http'); http.createServer(function (req, res) { res.writeHead(301, { "Location": "https://" + req.headers['host'] + req.url }); res.end(); }).listen(80); https.createServer(ssl, app).listen(443); /** * @memberof myApp.index The word document is parseed via saved html using Cheerio. We will also formalize the data values by removing quotation marks for titles, and make a list of locations. */ app.use('/uploads/images', express.static('uploads/images')); var newFileName; function grabInfo(element, findString, replaceString, isImage) { if (typeof element == "undefined" || element == null) { var text = "No Data"; return text; } else { if (isImage) { var value = element.replace(findString, replaceString); } else { var value = element.replace(findString, replaceString).trim(); } return value; } } function checkIfNullOrEmpty(element) { if (typeof element == "undefined" || element == null || element == "" || element.indexOf("data:image") == -1) { return ""; } else { return element; } } function addThumbnail(artwork) { return new Promise(function (resolve, reject) { try { if (artwork.image.imageFile == "") { resolve(artwork); } var imgSrc = artwork.image.imageFile.substr(artwork.image.imageFile.indexOf("base64,") + 7); var jimp = Jimp.read(Buffer.from(imgSrc, 'base64'), (err, image) => { if (image == null) { resolve(artwork); } else { image.resize(60, 60); image.getBase64(image.getMIME(), function (err, base64Data) { artwork.thumbnail = base64Data; resolve(artwork); }); } }) } catch (err) { reject(err); } }) } // prosess data function processData(artworks) { var promises = []; for (var it = 0; it < artworks.length; it++) { var artwork = artworks[it]; artwork.next = (artworks[it + 1]) ? artworks[it + 1].assetRefNo : null; artwork.previous = (artworks[it - 1]) ? artworks[it - 1].assetRefNo : null; promises.push(addThumbnail(artwork)) } return new Promise(function (resolve, reject) { Promise.all(promises) .then(data => { resolve(data); }).catch(err => { reject(err); }) }) } app.post('/upload', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); if (req.method === 'POST') { var busboy = new Busboy({headers: req.headers}); busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { if (mimetype === "application/vnd.openxmlformats-officedocument.wordprocessingml.document") { var datetimestamp = Date.now(); newFileName = fieldname + '-' + datetimestamp + '.' + filename.split('.')[filename.split('.').length - 1]; var saveTo = path.join('./tmp/', newFileName); file.pipe(fs.createWriteStream(saveTo)); } else { res.status(400).send(["Invalid file format."]); return false; } }); busboy.on('finish', function () { mammoth.convertToHtml({path: "tmp/" + newFileName}) .then(function (result) { var html = "<div class='wrapper'>" + striptags(result.value, '<p><img>') + "</div>"; var parsedHTML = $.load(html); var elementsArray = []; parsedHTML('.wrapper').children('p').each(function () { var element = $(this); var imgElement = element.find("img"); if (imgElement.length > 0) { var elementText = element.text(); if (elementText.indexOf("Office Location") != -1) { elementsArray.push(elementText); elementsArray.push(imgElement.attr('src')); } else if (elementText.indexOf("Asset Reference No") != -1) { elementsArray.push(imgElement.attr('src')); elementsArray.push(elementText); } else { elementsArray.push(imgElement.attr('src')); } } else { elementsArray.push(element.text()); } }); var artworksDataArray = []; var imagesArray = []; var dataErorrs = []; for (var i = 0; i < elementsArray.length; i++) { if (elementsArray[i].indexOf("Asset Reference No") != -1) { var artworkDetailsObj = {}; var imageObj = {}; var referenceNo = grabInfo(elementsArray[i], "Asset Reference No:", "", false); var artist = grabInfo(elementsArray[i + 1], "Artist:", "", false); var title = grabInfo(elementsArray[i + 2], "Title:", "", false); var size = grabInfo(elementsArray[i + 3], "Size:", "", false); var amountPaid = grabInfo(elementsArray[i + 4], "Amount Paid:", "", false); var insured = grabInfo(elementsArray[i + 5], "Insured:", "", false); var provenance = grabInfo(elementsArray[i + 6], "Provenance:", "", false); var officeLocation = grabInfo(elementsArray[i + 7], "Office Location:", "", false); artworkDetailsObj.assetRefNo = referenceNo; artworkDetailsObj.artist = artist; artworkDetailsObj.title = title; artworkDetailsObj.size = size; artworkDetailsObj.amountPaid = amountPaid; artworkDetailsObj.insured = insured; artworkDetailsObj.provenance = provenance; artworkDetailsObj.officeLocation = officeLocation; artworkDetailsObj.imageFileName = "image-" + artworkDetailsObj.id + ".jpeg"; artworkDetailsObj.inspected = false; artworkDetailsObj.text = ""; imageObj.imageFile = checkIfNullOrEmpty(elementsArray[i + 8]); imageObj.assetRefNo = referenceNo; imageObj.additionalImages = []; artworkDetailsObj.image = imageObj; var dupRef = artworksDataArray.filter((value) => { return value.assetRefNo == referenceNo; }); if (!imageObj.imageFile) { dataErorrs.push("Image type error : [referenceNo: " + referenceNo + ", title:" + title + "]"); } if (dupRef.length > 0) { dataErorrs.push("Duplicate assetRefNo : [referenceNo: " + referenceNo + ", title:" + title + "]") } artworksDataArray.push(artworkDetailsObj); imagesArray.push(imageObj); } } if (dataErorrs.length > 0) { res.status(400).send(dataErorrs); return false; } // save data to database MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { res.status(404).send(["Database connection error"]); return false; } processData(artworksDataArray) .then(data => { var artworkCol = db.collection('artworks'); var imageCol = db.collection('images'); var artistCol = db.collection('artists'); var metaCol = db.collection('meta'); var artworkBulk = artworkCol.initializeUnorderedBulkOp(); var imageBulk = imageCol.initializeUnorderedBulkOp(); var artistBulk = artistCol.initializeUnorderedBulkOp(); var promises = [ artworkCol.remove(), imageCol.remove(), artistCol.remove() ]; var uniqueArtists = []; for (var it = 0; it < data.length; it++) { var artwork = data[it]; var image = artwork.image; delete artwork.image; var artist = { "name": artwork.artist.replace(/[$#,.]/g, ""), "skinName": "", "language": "", "region": "", "dreaming": "", "DOB": "", "bio": { "title": "", "body": "", "AASDLink": "", "WikiLink": "" }, }; artworkBulk.insert(artwork); imageBulk.insert(image); if (uniqueArtists.indexOf(artist) == -1) { artistBulk.insert(artist); uniqueArtists.push(artist); } } var updateAt = new Date(); Promise.all(promises) .then(() => { Promise.all([ artworkBulk.execute(), imageBulk.execute(), artistBulk.execute(), metaCol.update( {key: "last-update"}, { key: "last-update", value: updateAt.toLocaleString() }, {upsert: true}) ]). then(() => { db.close(); res.status(200).send({update_at: updateAt.toLocaleString()}); }); }).catch((err) => { res.status(404).send(["Data insert error"]); return false; }); }) }); // end save data to database fs.writeFile("uploads/artworks.json", JSON.stringify([artworksDataArray, imagesArray]), function (err) { if (err) { res.status(400).send(err); return; } else { fs.unlink("tmp/" + newFileName); async.forEach(imagesArray, function (image) { var type = image.imageFile.substring("data:image/".length, image.imageFile.indexOf(";base64")) fs.writeFile("uploads/images/image-" + image.artwork_id + "." + type, image.imageFile.replace("data:image\/" + type + ";base64,", ""), 'base64', function (err) { if (err) { res.status(400).send(err); return; } }); }); } }) }) .catch(function (err) { res.status(404).send(["Data parse error."]); return false; }) .done(); }); return req.pipe(busboy); } }); app.post('/save-artworks', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var artworksDataArray = req.body; // save data to database MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var artworkCol = db.collection('artworks'); var imageCol = db.collection('images'); var artistCol = db.collection('artists'); var artworkBulk = artworkCol.initializeUnorderedBulkOp(); var imageBulk = imageCol.initializeUnorderedBulkOp(); var artistBulk = artistCol.initializeUnorderedBulkOp(); var uniqueArtists = []; for (var it = 0; it < artworksDataArray.length; it++) { var artwork = artworksDataArray[it]; var image = artwork.image; delete artwork.image; var artist = { "name": artwork.artist.replace(/[$#,.]/g, ""), "skinName": "", "language": "", "region": "", "dreaming": "", "DOB": "", "bio": { "title": "", "body": "", "AASDLink": "", "WikiLink": "" }, }; artworkBulk.insert(artwork); imageBulk.insert(image); if (uniqueArtists.indexOf(artist) == -1) { artistBulk.insert(artist); uniqueArtists.push(artist); } } Promise.all([ artworkCol.remove(), imageCol.remove(), artistCol.remove() ]) .then(() => { Promise.all([ artworkBulk.execute(), imageBulk.execute(), artistBulk.execute() ]). then(() => { db.close(); res.send({data: "success"}); }); }).catch((err) => { console.error(err); }); }); // end save data to database }); app.post('/save-artist', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var data = req.body; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('artists'); collection.update({name: data.name}, data, {upsert: true}, function (err, resuslt) { res.send({data: "sucess"}); }); db.close(); }); }); app.post('/save-image', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var data = req.body; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('images'); collection.update({assetRefNo: data.assetRefNo}, data, {upsert: true}, function (err, resuslt) { res.send({data: "sucess"}); }); db.close(); }); }); app.post('/update-artist', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var data = req.body; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('artists'); collection.update({name: data.artist}, {$set: {bio: data.bio}}, function (err, items) { res.send({data: "sucess"}); }); db.close(); }); }); app.get('/get-artworks', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('artworks'); collection.find().sort({assetRefNo: 1}).toArray(function (err, items) { res.send(items); }); db.close(); }); }); app.get('/get-artwork/:id', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var artworkId = req.params.id; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('artworks'); collection.findOne({assetRefNo: artworkId}, function (err, items) { res.send(items); }); db.close(); }); }); app.get('/get-image/:id', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var arworkId = req.params.id; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('images'); collection.findOne({assetRefNo: arworkId}, function (err, items) { res.send(items); }); db.close(); }); }); app.get('/get-artist/:name', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var name = req.params.name; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('artists'); collection.findOne({name: name}, function (err, items) { res.send(items); }); db.close(); }); }); app.get('/get-meta/:key', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var key = req.params.key; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var collection = db.collection('meta'); collection.findOne({key: key}, function (err, items) { res.send(items); }); db.close(); }); }); app.get('/download-backup', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var fileName = 'assets/backups/artwork-backup.docx'; MongoClient.connect("mongodb://localhost:27017/serene-brushland", function (err, db) { if (err) { return console.dir(err); } var content = []; var collection = db.collection('artworks'); var imageCollection = db.collection('images'); collection.find().sort({assetRefNo: 1}).toArray(function (err, items) { var count = items.length; var docxFile = officegen('docx'); async.forEach(items, function (item) { imageCollection.findOne({assetRefNo: item.assetRefNo}, function (err, image) { var singleItem = item; var type = image.imageFile.substring("data:image/".length, image.imageFile.indexOf(";base64")) var imagePath = path.resolve(__dirname + '/app/assets/backups/images/image-' + item.assetRefNo + '.' + type); singleItem.imagePath = imagePath; singleItem.imageFile = image.imageFile; content.push(singleItem); fs.writeFile(imagePath, image.imageFile.replace("data:image\/" + type + ";base64,", ""), 'base64', function (err) { if (err) { res.status(400).send(err); return; } count--; if (count === 0) { for (var i = 0; i < content.length; i++) { var pObj = docxFile.createP(); pObj.addText('Asset Reference No: ' + content[i].assetRefNo); var pObj = docxFile.createP(); pObj.addText('Artist: ' + content[i].artist); var pObj = docxFile.createP(); pObj.addText('Title: ' + content[i].title); var pObj = docxFile.createP(); pObj.addText('Size: ' + content[i].size); var pObj = docxFile.createP(); pObj.addText('Amount Paid: ' + content[i].amountPaid); var pObj = docxFile.createP(); pObj.addText('Insured: ' + content[i].insured); var pObj = docxFile.createP(); pObj.addText('Provenance: ' + content[i].provenance); var pObj = docxFile.createP(); pObj.addText('Office Location: ' + content[i].officeLocation); var pObj = docxFile.createP(); if (content[i].imageFile.indexOf("data:image/") != -1) { pObj.addImage(content[i].imagePath); } docxFile.putPageBreak(); } var file = fs.createWriteStream(path.resolve(__dirname + '/app/' + fileName)); docxFile.generate(file); file.on('close', function () { res.send({data: fileName}); }); } }); }); }); }); }); }); /** Return the json file from the uploaded document. */ app.get('/artworks', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); try { fs.statSync('uploads/uploaded-artworks.json').isFile(); var artworksFile = fs.readFileSync('uploads/uploaded-artworks.json').toString(); res.send(artworksFile); } catch (err) { res.status(400).send(err); } }); /** Return a particular entry from the json file from the uploaded document. */ app.get('/artwork', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var artworkId = req.query.assetRefNo; var artworks = fs.readFileSync('uploads/uploaded-artworks.json').toString(); var artworksJson = JSON.parse(artworks); for (var i = 0; i < artworksJson.length; i++) { var obj = artworksJson[i]; if (obj.assetRefNo == artworkId) { res.send(JSON.stringify(obj)); break; } } }); app.get('/sample', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var htmlString = fs.readFileSync('data/sample.html').toString() var parsedHTML = $.load(htmlString) var images = []; var locations = []; var count = 1; console.log('=================================='); parsedHTML('p b span').map(function (i, element) { var item = {}; var newlines = /\r?\n|\r/g; element = $(element); var refNo = element.text(); if (refNo.indexOf('Reference No:') != -1) { var photoRefNo = element.parent().children().next().text(); // it's not easy to explain ms word format parsing var nextElement = element.parent().parent().next(); // go back to the p and get the next p. // get the name of the artist var artist = nextElement.text(); if (artist.indexOf('Artist:') === -1) { //console.log(artist+' replaced with '); // artist = nextElement.children().last().children('span').last().text(); //console.log(artist); } nextElement = nextElement.next(); // next title var title = nextElement.text(); nextElement = nextElement.next(); // etc var size = nextElement.text(); nextElement = nextElement.next(); var amountPaid = nextElement.text(); nextElement = nextElement.next(); var insured = nextElement.text(); nextElement = nextElement.next(); var supplier = nextElement.text(); nextElement = nextElement.next(); var officeLocation = nextElement.text(); var dm = ["Artist: ", "Title: ", "Size: ", "Amount Paid: ", "Insured: ", "Supplier: ", "Office Location: "]; item.photoRefNo = photoRefNo; item.count = count; item.artist = artist.substring(dm[0].length, artist.length).replace(newlines, " "); item.title = title.substring(dm[1].length, title.length).replace(newlines, " "); item.size = size.substring(dm[2].length, size.length); item.amountPaid = amountPaid.substring(dm[3].length, artist.length); item.insured = insured.substring(dm[4].length, insured.length); item.supplier = supplier.substring(dm[5].length, supplier.length); item.officeLocation = officeLocation.substring(dm[6].length, officeLocation.length).replace(newlines, " "); item.officeLocation = normalizeLocation(item.officeLocation); locations.push(item.officeLocation); // record 0 has an image src of image001 if (count < 10) { item.src = 'image00' + count + '.jpg'; } else if (count < 100) { item.src = 'image0' + count + '.jpg'; } else { item.src = 'image' + count + '.jpg'; } images.push(item); console.log(count + ' title:' + item.title + ' no:' + item.photoRefNo + ' src:' + item.src); count++; } }); locations = eliminateDuplicates(locations); locations.forEach(function (location) { //console.log(location); }); var resultString = JSON.stringify(images); fs.writeFile("data/word-doc.json", resultString, function (err) { if (err) { return console.log('err', err); } console.log("The file was saved~"); }); // also save a copy for the app to use fs.writeFile("./app/data/word-doc.json", resultString, function (err) { if (err) { return console.log('err', err); } else { console.log("The file was saved in ./app/data/word-doc.json"); } }); res.send(resultString); }); function normalizeLocation(location) { location = location.trim(); if (location === 'Tony Maple-Brown\’s office') { //console.log('1',location); return 'St Leonards – Tony\’s Office'; } else if (location === 'Tony\n’s office') { //console.log('2',location); return 'St Leonards – Tony\’s Office'; } else if (location === "St Leonards - Tony's Office Level 3") { return 'St Leonards – Tony\’s Office'; } else { //console.log('3',location); return location; } } function eliminateDuplicates(arr) { var i, len = arr.length, out = [], obj = {}; for (i = 0; i < len; i++) { obj[arr[i]] = 0; } for (i in obj) { out.push(i); } return out; } /** Parse the comma separated values json file. */ app.get('/csv', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var csvFile = fs.readFileSync('data/csv.json').toString() var obj; var works = []; var count = 0; fs.readFile('data/csv.json', 'utf8', function (err, data) { if (err) throw err; obj = JSON.parse(data); obj.forEach(function (item) { console.log(item.Title); }); console.log(obj.length); var resultString = JSON.stringify(obj); res.send(resultString); }); }); app.get('/merge', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var obj; var works = []; var refNumbers = []; var locations = []; var csvTitleRefs = []; var csvCount = 0; var docCount = 0; var csv_content; var htm_content; fs.readFile('data/csv.json', function read(err, csv_data) { if (err) { throw err; } csv_content = csv_data; fs.readFile('data/word-doc.json', function read(err, htm_data) { if (err) { throw err; } htm_content = htm_data; var csvObj = JSON.parse(csv_data); var docObj = JSON.parse(htm_content); console.log('== csv ' + csvObj.length + ' doc ' + docObj.length + '=========='); // go thru each item in the csv file csvObj.forEach(function (csvItem) { var PhotoRefNo = csvItem.PhotoRefNo; var location = csvItem['Office Loation']; // remove quotes and join with an @ var title_artist = csvItem.Title.trim() + '@' + csvItem.Artist.trim(); title_artist = title_artist.replace(/"/gi, ''); // add each csv title@artist pair and save it with its ref number csvTitleRefs.push(title_artist, PhotoRefNo); csvCount++; // go thru each word doc entry to look for title/artist matches docObj.forEach(function (docItem) { var title = docItem.title; var artist = docItem.artist; var matches = []; var title = docItem.title.trim().replace(/"/gi, ''); // go thru each title@artist key and see if the word doc item matches both for (var key in csvTitleRefs) { // key is the phot ref number if (key === 'length' || !csvTitleRefs.hasOwnProperty(key)) continue; var value = csvTitleRefs[key].toString(); // this should be the title@artist string if ((value.indexOf(title) !== -1) && (value.indexOf(artist) !== -1) && title !== '' && artist !== '') { console.log(' doc ' + title + ' ' + artist + ''); console.log(' csv ' + key + ' - ' + value); } } }); }); }); }); }); app.get('/inspect', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var artworkId = req.query.assetRefNo var artworks = fs.readFileSync('uploads/uploaded-artworks.json').toString(); var artworksJson = JSON.parse(artworks); for (var i = 0; i < artworksJson.length; i++) { if (artworksJson[i].assetRefNo == artworkId) { if (artworksJson[i].inspected) { res.status(200).json(artworksJson[i]); } else { artworksJson[i].inspected = true; fs.writeFile("uploads/uploaded-artworks.json", JSON.stringify(artworksJson), function (err) { if (err) { res.status(400).send(err); return; } else { res.status(200).json(artworksJson[i]); } }); break; } } } }); /** Get the generated word document as a json file. */ app.get('/get-inspected-artworks', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var file = fs.readFileSync('uploads/uploaded-artworks.json').toString(); var uploadedFileJson = JSON.parse(file); var inspectedArtworks = []; for (var i = 0; i < uploadedFileJson.length; i++) { if (uploadedFileJson[i].inspected) { inspectedArtworks.push(uploadedFileJson[i]); } } res.status(200).json(uploadedFileJson); }); app.get('/artists', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var artists = curator.getArtists; console.log('artists', artists.length); res.send(artists); }); app.get('/artist', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); //var artist = req.query.artist var artist = curator.getArtist(); console.log('artist', artist.length); res.send(artist); }); /** Valuation Document. Previously called Rockend Valuation 13 Jan 2016.html */ app.get('/valuation', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var htmlString = fs.readFileSync('data/valuation.html').toString() var parsedHTML = $.load(htmlString) var firstArtist = "Percy Ivor Hunt"; var items = []; var count = 1; captureFlag = false; console.log('=================================='); parsedHTML('div').map(function (i, element) { var item = {}; var newlines = /\r?\n|\r/g; element = $(element); var refNo = element.text(); if (refNo.indexOf(firstArtist) != -1) { count = 1; captureFlag = true; } if (captureFlag == true && count < 10) { items.push(item); console.log(count + ' - ' + refNo + '\n'); console.log('==================================\n'); count++; } else { //console.log('blank'); } }); var resultString = JSON.stringify(items); res.send(resultString); }); app.post('/save-from-firebase', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); var busboy = new Busboy({headers: req.headers}); busboy.on('field', function (fieldname, val, fieldnameTruncated, valTruncated) { if (fieldname == "fetched_data") { fs.writeFile("uploads/firebase-backup.json", val, function (err) { if (err) { res.status(400).send(err); return; } }); } }); busboy.on('finish', function () { res.send(); }); return req.pipe(busboy); }); app.post('/save-user-permissions', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); var busboy = new Busboy({headers: req.headers}); busboy.on('field', function (fieldname, val, fieldnameTruncated, valTruncated) { if (fieldname == "fetched_data") { fs.writeFile(".permissions.json", val, function (err) { if (err) { res.status(400).send(err); return; } }); } }); busboy.on('finish', function () { res.send(); }); return req.pipe(busboy); }); app.post('/is-authorized', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); var busboy = new Busboy({headers: req.headers}); busboy.on('field', function (fieldname, val) { var email = JSON.parse(val).email; var task = JSON.parse(val).task; var file = fs.readFileSync('.permissions.json').toString(); var assignedPermissions = JSON.parse(file).assignedPermissions; var index = assignedPermissions[task].indexOf(email); if (index == -1) { res.status(401).send(); return; } else { res.status(200).send(); return; } }); busboy.on('finish', function () { res.send(); }); return req.pipe(busboy); }); app.post('/add-additional-artwork-data', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); if (req.method === 'POST') { var busboy = new Busboy({headers: req.headers}); busboy.on('file', function (fieldname, file, filename, encoding, mimetype) { var datetimestamp = Date.now(); var fileName = "image-" + datetimestamp + "." + filename.split('.')[filename.split('.').length - 1]; var saveTo = path.join('./uploads/images/', fileName); file.pipe(fs.createWriteStream(saveTo)); }); busboy.on('finish', function () { res.writeHead(200, {'Connection': 'close'}); res.end(); }); return req.pipe(busboy); } res.writeHead(404); res.end(); }); app.get('/env', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var env = process.env; res.send(env); }); app.get('/auth-roles', function (req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); res.setHeader('Content-Type', 'application/json'); var file = fs.readFileSync('.permissions.json').toString(); var rolesFileJson = JSON.parse(file); res.send(rolesFileJson); });
/** * Created by dmitry on 01/07/15. */ mapApp.directive("kmFloorPlans",[function() { return { restrict:"E", templateUrl:"templates/floor-plans.html", link: function ( $scope, element, attrs ) { $scope.selectRoom = function(room) { if($scope.isCubiclesShown) return; $scope.curRoom = room; $scope.curCubicle = null; $scope.isRoomDetailsShown = true; }; $scope.isCubiclesShown = false; $scope.floorAdd = function(n){ var floor = _.find($scope.curFloor.building.children,function(f){ return f.buildingId === $scope.curFloor.buildingId && f.number == $scope.curFloor.number + n; }); if(floor) { $scope.curFloor = floor; $scope.curRoom = null; $scope.curCubicle = null; $scope.isRoomDetailsShown = false; } }; $scope.toggleDock = function () { $scope.isDocked = !$scope.isDocked; }; $scope.selectCubicle = function(cub){ $scope.handleSelectionChange(null,$scope.curBuilding,$scope.curFloor,null,cub,$scope.isSearchShown,$scope.isBuildingsCatalogShown,true,true,$scope.isBuildingDetailsShown); if(cub.room){ drillUp(cub); } }; var cubs; $scope.drillDown = function(room) { cubs = _.filter(room.floor.cubicles,function(c){ return c.insideOfRoomId === room.id; }); if(cubs.length){ $scope.isCubiclesShown = true; } cubs.forEach(function(c){ c.isShown = true; }); if(document.selection && document.selection.empty) { document.selection.empty(); } else if(window.getSelection) { var sel = window.getSelection(); sel.removeAllRanges(); } }; $scope.$on("exitCubicleMode",function(){ if(cubs) drillUp(); }); function drillUp() { cubs.forEach(function (c) { c.isShown = false; }); $scope.isCubiclesShown = false; cubs = null; } } } }]);
export default function loginCss() { return { body: { flex: 1, justifyContent: "center", }, login_container: { flex: 1, padding: 25 }, logo_container: { alignItems: "center", }, logo: { width: 180, height: 180, }, signup: { flexDirection: 'row', justifyContent: "center", alignItems: "center" }, input: { borderWidth: 1, borderColor: '#ccc', padding: 5, paddingLeft: 20, borderRadius: 5, marginBottom: 15 }, login_button: { padding: 15, alignItems: 'center', backgroundColor: '#387ef5', borderRadius: 5 }, login_button_text: { color: '#fff' }, catch_text_container: { marginTop: 5, flexDirection: 'row', }, catch_text: { fontFamily: 'monospace', color: '#387ef5', marginLeft: 10, marginRight: 10 }, signup_text: { fontFamily: 'monospace', color: '#387ef5', marginLeft: 5, marginRight: 5 }, footer: { height: 50, backgroundColor: '#e8e8e8', justifyContent: "center", } } }
var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var session = require('client-sessions'); var index = require('./routes/index'); var users = require('./routes/users'); var dashboard = require('./routes/dashboard'); var hostManagement = require('./routes/hostManagement'); var userManagement = require('./routes/userManagement'); var propertyManagement = require('./routes/propertyManagement'); var invoiceManagement = require('./routes/invoiceManagement'); var adminManagement = require('./routes/adminManagement'); require('./model/mongoconnect'); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); app.use(session({ cookieName: 'session', secret: '6692940916', duration: 30 * 60 * 1000, activeDuration: 5 * 60 * 1000, })); // uncomment after placing your favicon in /public //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico'))); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.get('/admin', index.admin_checkLogin); app.get('/topTenProperties', dashboard.topTenProperties); //done app.get('/cityRevenue', dashboard.cityRevenue); //done app.get('/topTenHost', dashboard.topTenHost); //done app.get('/getAllHosts', hostManagement.getAllHosts); //done app.get('/getAllUsers', userManagement.getAllUsers); //done app.get('/getAllProperties', propertyManagement.getAllProperties); //done app.get('/invoices', invoiceManagement.invoices); app.get('/totalUsers', dashboard.totalUsers); //done app.get('/totalHosts', dashboard.totalHosts); //done app.get('/totalProperties', dashboard.totalProperties); //done app.get('/totalRevenue', dashboard.totalRevenue); //done app.get('/admin_dashboard', dashboard.admin_dashboard); //done app.get('/admin_activeUserManagement', userManagement.admin_activeUserManagement); //done app.get('/admin_activeHostManagement', hostManagement.admin_activeHostManagement); //done app.get('/admin_activePropertyManagement', propertyManagement.admin_activePropertyManagement); //done app.get('/admin_invoiceManagement', invoiceManagement.admin_invoiceManagement); app.get('/unapprovedHost', hostManagement.unapprovedHost); app.get('/admin_pendingHost', hostManagement.admin_pendingHost); app.get('/admin_pendingProperty', propertyManagement.admin_pendingProperty); app.get('/unapprovedProperty', propertyManagement.unapprovedProperty); app.get('/totalBills', dashboard.totalBills); app.post('/getProperty', propertyManagement.getProperty); app.post('/getUser', userManagement.getUser); app.post('/getHost', hostManagement.getHost); app.post('/getInvoice', invoiceManagement.getInvoice); app.post('/getPendingHost', hostManagement.getPendingHost); app.post('/getPendingProperty', propertyManagement.getPendingProperty); app.post('/approveProperty', propertyManagement.approveProperty); app.post('/approveHost', hostManagement.approveHost); app.post('/admin_login', index.adminLogin); app.get('/admin_logout', index.adminLogout); app.get('/viewAddAdminPage', adminManagement.viewAddAdminPage); app.get('/addNode', adminManagement.viewAddNodePage); app.get('/addCluster', adminManagement.viewAddClusterPage); app.get('/addService', adminManagement.viewAddServicePage); app.post('/admin_add', adminManagement.addAdmin); app.post('/deleteBill', invoiceManagement.deleteBill); app.get('/getNodes', adminManagement.getNodes); app.get('/getClusters', adminManagement.getClusters); app.get('/getServices', adminManagement.getServices); app.post('/postNode', adminManagement.postNodes); app.post('/postCluster', adminManagement.postCluster); app.post('/postService', adminManagement.postService); // catch 404 and forward to error handler app.use(function (req, res, next) { var err = new Error('Not Found'); err.status = 404; next(err); }); // error handler app.use(function (err, req, res, next) { // set locals, only providing error in development res.locals.message = err.message; res.locals.error = req.app.get('env') === 'development' ? err : {}; // render the error page res.status(err.status || 500); res.render('error'); }); module.exports = app;
/*! * VERSION: beta 1.10.1 * DATE: 2013-07-10 * UPDATES AND DOCS AT: http://www.greensock.com * * @license Copyright (c) 2008-2013, GreenSock. All rights reserved. * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for * Club GreenSock members, the software agreement that was issued with your membership. * * @author: Jack Doyle, jack@greensock.com */ (function(window) { "use strict"; var _globals = window.GreenSockGlobals || window, _namespace = function(ns) { var a = ns.split("."), p = _globals, i; for (i = 0; i < a.length; i++) { p[a[i]] = p = p[a[i]] || {}; } return p; }, gs = _namespace("com.greensock"), _slice = [].slice, _emptyFunc = function() {}, a, i, p, _ticker, _tickerActive, _defLookup = {}, /** * @constructor * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition. * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally. * * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found, * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere, * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could * sandbox the banner one like: * * <script> * var gs = window.GreenSockGlobals = {}; //the newer version we're about to load could now be referenced in a "gs" object, like gs.TweenLite.to(...). Use whatever alias you want as long as it's unique, "gs" or "banner" or whatever. * </script> * <script src="js/greensock/v1.7/TweenMax.js"></script> * <script> * window.GreenSockGlobals = null; //reset it back to null so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...) * </script> * <script src="js/greensock/v1.6/TweenMax.js"></script> * <script> * gs.TweenLite.to(...); //would use v1.7 * TweenLite.to(...); //would use v1.6 * </script> * * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back". * @param {!Array.<string>} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"] * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition. * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object) */ Definition = function(ns, dependencies, func, global) { this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses _defLookup[ns] = this; this.gsClass = null; this.func = func; var _classes = []; this.check = function(init) { var i = dependencies.length, missing = i, cur, a, n, cl; while (--i > -1) { if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) { _classes[i] = cur.gsClass; missing--; } else if (init) { cur.sc.push(this); } } if (missing === 0 && func) { a = ("com.greensock." + ns).split("."); n = a.pop(); cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes); //exports to multiple environments if (global) { _globals[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.) if (typeof(define) === "function" && define.amd){ //AMD define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").join("/"), [], function() { return cl; }); } else if (typeof(module) !== "undefined" && module.exports){ //node module.exports = cl; } } for (i = 0; i < this.sc.length; i++) { this.sc[i].check(); } } }; this.check(true); }, //used to create Definition instances (which basically registers a class that has dependencies). _gsDefine = window._gsDefine = function(ns, dependencies, func, global) { return new Definition(ns, dependencies, func, global); }, //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class). _class = gs._class = function(ns, func, global) { func = func || function() {}; _gsDefine(ns, [], function(){ return func; }, global); return func; }; _gsDefine.globals = _globals; /* * ---------------------------------------------------------------- * Ease * ---------------------------------------------------------------- */ var _baseParams = [0, 0, 1, 1], _blankArray = [], Ease = _class("easing.Ease", function(func, extraParams, type, power) { this._func = func; this._type = type || 0; this._power = power || 0; this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams; }, true), _easeMap = Ease.map = {}, _easeReg = Ease.register = function(ease, names, types, create) { var na = names.split(","), i = na.length, ta = (types || "easeIn,easeOut,easeInOut").split(","), e, name, j, type; while (--i > -1) { name = na[i]; e = create ? _class("easing."+name, null, true) : gs.easing[name] || {}; j = ta.length; while (--j > -1) { type = ta[j]; _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease(); } } }; p = Ease.prototype; p._calcEnd = false; p.getRatio = function(p) { if (this._func) { this._params[0] = p; return this._func.apply(null, this._params); } var t = this._type, pw = this._power, r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2; if (pw === 1) { r *= r; } else if (pw === 2) { r *= r * r; } else if (pw === 3) { r *= r * r * r; } else if (pw === 4) { r *= r * r * r * r; } return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2); }; //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut) a = ["Linear","Quad","Cubic","Quart","Quint,Strong"]; i = a.length; while (--i > -1) { p = a[i]+",Power"+i; _easeReg(new Ease(null,null,1,i), p, "easeOut", true); _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : "")); _easeReg(new Ease(null,null,3,i), p, "easeInOut"); } _easeMap.linear = gs.easing.Linear.easeIn; _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks /* * ---------------------------------------------------------------- * EventDispatcher * ---------------------------------------------------------------- */ var EventDispatcher = _class("events.EventDispatcher", function(target) { this._listeners = {}; this._eventTarget = target || this; }); p = EventDispatcher.prototype; p.addEventListener = function(type, callback, scope, useParam, priority) { priority = priority || 0; var list = this._listeners[type], index = 0, listener, i; if (list == null) { this._listeners[type] = list = []; } i = list.length; while (--i > -1) { listener = list[i]; if (listener.c === callback && listener.s === scope) { list.splice(i, 1); } else if (index === 0 && listener.pr < priority) { index = i + 1; } } list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority}); if (this === _ticker && !_tickerActive) { _ticker.wake(); } }; p.removeEventListener = function(type, callback) { var list = this._listeners[type], i; if (list) { i = list.length; while (--i > -1) { if (list[i].c === callback) { list.splice(i, 1); return; } } } }; p.dispatchEvent = function(type) { var list = this._listeners[type], i, t, listener; if (list) { i = list.length; t = this._eventTarget; while (--i > -1) { listener = list[i]; if (listener.up) { listener.c.call(listener.s || t, {type:type, target:t}); } else { listener.c.call(listener.s || t); } } } }; /* * ---------------------------------------------------------------- * Ticker * ---------------------------------------------------------------- */ var _reqAnimFrame = window.requestAnimationFrame, _cancelAnimFrame = window.cancelAnimationFrame, _getTime = Date.now || function() {return new Date().getTime();}; //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill. a = ["ms","moz","webkit","o"]; i = a.length; while (--i > -1 && !_reqAnimFrame) { _reqAnimFrame = window[a[i] + "RequestAnimationFrame"]; _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"]; } _class("Ticker", function(fps, useRAF) { var _self = this, _startTime = _getTime(), _useRAF = (useRAF !== false && _reqAnimFrame), _fps, _req, _id, _gap, _nextTime, _tick = function(manual) { _self.time = (_getTime() - _startTime) / 1000; var id = _id, overlap = _self.time - _nextTime; if (!_fps || overlap > 0 || manual === true) { _self.frame++; _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap); _self.dispatchEvent("tick"); } if (manual !== true && id === _id) { //make sure the ids match in case the "tick" dispatch triggered something that caused the ticker to shut down or change _useRAF or something like that. _id = _req(_tick); } }; EventDispatcher.call(_self); this.time = this.frame = 0; this.tick = function() { _tick(true); }; this.sleep = function() { if (_id == null) { return; } if (!_useRAF || !_cancelAnimFrame) { clearTimeout(_id); } else { _cancelAnimFrame(_id); } _req = _emptyFunc; _id = null; if (_self === _ticker) { _tickerActive = false; } }; this.wake = function() { if (_id !== null) { _self.sleep(); } _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame; if (_self === _ticker) { _tickerActive = true; } _tick(2); }; this.fps = function(value) { if (!arguments.length) { return _fps; } _fps = value; _gap = 1 / (_fps || 60); _nextTime = this.time + _gap; _self.wake(); }; this.useRAF = function(value) { if (!arguments.length) { return _useRAF; } _self.sleep(); _useRAF = value; _self.fps(_fps); }; _self.fps(fps); //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition. setTimeout(function() { if (_useRAF && (!_id || _self.frame < 5)) { _self.useRAF(false); } }, 1500); }); p = gs.Ticker.prototype = new gs.events.EventDispatcher(); p.constructor = gs.Ticker; /* * ---------------------------------------------------------------- * Animation * ---------------------------------------------------------------- */ var Animation = _class("core.Animation", function(duration, vars) { this.vars = vars || {}; this._duration = this._totalDuration = duration || 0; this._delay = Number(this.vars.delay) || 0; this._timeScale = 1; this._active = (this.vars.immediateRender === true); this.data = this.vars.data; this._reversed = (this.vars.reversed === true); if (!_rootTimeline) { return; } if (!_tickerActive) { _ticker.wake(); } var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline; tl.add(this, tl._time); if (this.vars.paused) { this.paused(true); } }); _ticker = Animation.ticker = new gs.Ticker(); p = Animation.prototype; p._dirty = p._gc = p._initted = p._paused = false; p._totalTime = p._time = 0; p._rawPrevTime = -1; p._next = p._last = p._onUpdate = p._timeline = p.timeline = null; p._paused = false; p.play = function(from, suppressEvents) { if (arguments.length) { this.seek(from, suppressEvents); } return this.reversed(false).paused(false); }; p.pause = function(atTime, suppressEvents) { if (arguments.length) { this.seek(atTime, suppressEvents); } return this.paused(true); }; p.resume = function(from, suppressEvents) { if (arguments.length) { this.seek(from, suppressEvents); } return this.paused(false); }; p.seek = function(time, suppressEvents) { return this.totalTime(Number(time), suppressEvents !== false); }; p.restart = function(includeDelay, suppressEvents) { return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true); }; p.reverse = function(from, suppressEvents) { if (arguments.length) { this.seek((from || this.totalDuration()), suppressEvents); } return this.reversed(true).paused(false); }; p.render = function() { }; p.invalidate = function() { return this; }; p._enabled = function (enabled, ignoreTimeline) { if (!_tickerActive) { _ticker.wake(); } this._gc = !enabled; this._active = (enabled && !this._paused && this._totalTime > 0 && this._totalTime < this._totalDuration); if (ignoreTimeline !== true) { if (enabled && !this.timeline) { this._timeline.add(this, this._startTime - this._delay); } else if (!enabled && this.timeline) { this._timeline._remove(this, true); } } return false; }; p._kill = function(vars, target) { return this._enabled(false, false); }; p.kill = function(vars, target) { this._kill(vars, target); return this; }; p._uncache = function(includeSelf) { var tween = includeSelf ? this : this.timeline; while (tween) { tween._dirty = true; tween = tween.timeline; } return this; }; p._swapSelfInParams = function(params) { var i = params.length, copy = params.concat(); while (--i > -1) { if (params[i] === "{self}") { copy[i] = this; } } return copy; }; //----Animation getters/setters -------------------------------------------------------- p.eventCallback = function(type, callback, params, scope) { if ((type || "").substr(0,2) === "on") { var v = this.vars; if (arguments.length === 1) { return v[type]; } if (callback == null) { delete v[type]; } else { v[type] = callback; v[type + "Params"] = ((params instanceof Array) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params; v[type + "Scope"] = scope; } if (type === "onUpdate") { this._onUpdate = callback; } } return this; }; p.delay = function(value) { if (!arguments.length) { return this._delay; } if (this._timeline.smoothChildTiming) { this.startTime( this._startTime + value - this._delay ); } this._delay = value; return this; }; p.duration = function(value) { if (!arguments.length) { this._dirty = false; return this._duration; } this._duration = this._totalDuration = value; this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration. if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) { this.totalTime(this._totalTime * (value / this._duration), true); } return this; }; p.totalDuration = function(value) { this._dirty = false; return (!arguments.length) ? this._totalDuration : this.duration(value); }; p.time = function(value, suppressEvents) { if (!arguments.length) { return this._time; } if (this._dirty) { this.totalDuration(); } return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents); }; p.totalTime = function(time, suppressEvents, uncapped) { if (!_tickerActive) { _ticker.wake(); } if (!arguments.length) { return this._totalTime; } if (this._timeline) { if (time < 0 && !uncapped) { time += this.totalDuration(); } if (this._timeline.smoothChildTiming) { if (this._dirty) { this.totalDuration(); } var totalDuration = this._totalDuration, tl = this._timeline; if (time > totalDuration && !uncapped) { time = totalDuration; } this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale); if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. this._uncache(false); } //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed. if (tl._timeline) { while (tl._timeline) { if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) { tl.totalTime(tl._totalTime, true); } tl = tl._timeline; } } } if (this._gc) { this._enabled(true, false); } if (this._totalTime !== time) { this.render(time, suppressEvents, false); } } return this; }; p.startTime = function(value) { if (!arguments.length) { return this._startTime; } if (value !== this._startTime) { this._startTime = value; if (this.timeline) if (this.timeline._sortChildren) { this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct. } } return this; }; p.timeScale = function(value) { if (!arguments.length) { return this._timeScale; } value = value || 0.000001; //can't allow zero because it'll throw the math off if (this._timeline && this._timeline.smoothChildTiming) { var pauseTime = this._pauseTime, t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime(); this._startTime = t - ((t - this._startTime) * this._timeScale / value); } this._timeScale = value; return this._uncache(false); }; p.reversed = function(value) { if (!arguments.length) { return this._reversed; } if (value != this._reversed) { this._reversed = value; this.totalTime(this._totalTime, true); } return this; }; p.paused = function(value) { if (!arguments.length) { return this._paused; } if (value != this._paused) if (this._timeline) { if (!_tickerActive && !value) { _ticker.wake(); } var tl = this._timeline, raw = tl.rawTime(), elapsed = raw - this._pauseTime; if (!value && tl.smoothChildTiming) { this._startTime += elapsed; this._uncache(false); } this._pauseTime = value ? raw : null; this._paused = value; this._active = (!value && this._totalTime > 0 && this._totalTime < this._totalDuration); if (!value && elapsed !== 0 && this._duration !== 0) { this.render((tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale), true, true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render. } } if (this._gc && !value) { this._enabled(true, false); } return this; }; /* * ---------------------------------------------------------------- * SimpleTimeline * ---------------------------------------------------------------- */ var SimpleTimeline = _class("core.SimpleTimeline", function(vars) { Animation.call(this, 0, vars); this.autoRemoveChildren = this.smoothChildTiming = true; }); p = SimpleTimeline.prototype = new Animation(); p.constructor = SimpleTimeline; p.kill()._gc = false; p._first = p._last = null; p._sortChildren = false; p.add = p.insert = function(child, position, align, stagger) { var prevTween, st; child._startTime = Number(position || 0) + child._delay; if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order). child._pauseTime = child._startTime + ((this.rawTime() - child._startTime) / child._timeScale); } if (child.timeline) { child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one. } child.timeline = child._timeline = this; if (child._gc) { child._enabled(true, true); } prevTween = this._last; if (this._sortChildren) { st = child._startTime; while (prevTween && prevTween._startTime > st) { prevTween = prevTween._prev; } } if (prevTween) { child._next = prevTween._next; prevTween._next = child; } else { child._next = this._first; this._first = child; } if (child._next) { child._next._prev = child; } else { this._last = child; } child._prev = prevTween; if (this._timeline) { this._uncache(true); } return this; }; p._remove = function(tween, skipDisable) { if (tween.timeline === this) { if (!skipDisable) { tween._enabled(false, true); } tween.timeline = null; if (tween._prev) { tween._prev._next = tween._next; } else if (this._first === tween) { this._first = tween._next; } if (tween._next) { tween._next._prev = tween._prev; } else if (this._last === tween) { this._last = tween._prev; } if (this._timeline) { this._uncache(true); } } return this; }; p.render = function(time, suppressEvents, force) { var tween = this._first, next; this._totalTime = this._time = this._rawPrevTime = time; while (tween) { next = tween._next; //record it here because the value could change after rendering... if (tween._active || (time >= tween._startTime && !tween._paused)) { if (!tween._reversed) { tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); } else { tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); } } tween = next; } }; p.rawTime = function() { if (!_tickerActive) { _ticker.wake(); } return this._totalTime; }; /* * ---------------------------------------------------------------- * TweenLite * ---------------------------------------------------------------- */ var TweenLite = _class("TweenLite", function(target, duration, vars) { Animation.call(this, duration, vars); if (target == null) { throw "Cannot tween a null target."; } this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))), overwrite = this.vars.overwrite, i, targ, targets; this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite]; if ((isSelector || target instanceof Array) && typeof(target[0]) !== "number") { this._targets = targets = _slice.call(target, 0); this._propLookup = []; this._siblings = []; for (i = 0; i < targets.length; i++) { targ = targets[i]; if (!targ) { targets.splice(i--, 1); continue; } else if (typeof(targ) === "string") { targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings if (typeof(targ) === "string") { targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case) } continue; } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that <select> elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself. targets.splice(i--, 1); this._targets = targets = targets.concat(_slice.call(targ, 0)); continue; } this._siblings[i] = _register(targ, this, false); if (overwrite === 1) if (this._siblings[i].length > 1) { _applyOverwrite(targ, this, null, 1, this._siblings[i]); } } } else { this._propLookup = {}; this._siblings = _register(target, this, false); if (overwrite === 1) if (this._siblings.length > 1) { _applyOverwrite(target, this, null, 1, this._siblings); } } if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) { this.render(-this._delay, false, true); } }, true), _isSelector = function(v) { return (v.length && v !== window && v[0] && (v[0] === window || (v[0].nodeType && v[0].style && !v.nodeType))); //we cannot check "nodeType" if the target is window from within an iframe, otherwise it will trigger a security error in some browsers like Firefox. }, _autoCSS = function(vars, target) { var css = {}, p; for (p in vars) { if (!_reservedProps[p] && (!(p in target) || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties. css[p] = vars[p]; delete vars[p]; } } vars.css = css; }; p = TweenLite.prototype = new Animation(); p.constructor = TweenLite; p.kill()._gc = false; //----TweenLite defaults, overwrite management, and root updates ---------------------------------------------------- p.ratio = 0; p._firstPT = p._targets = p._overwrittenProps = p._startAt = null; p._notifyPluginsOfEnabled = false; TweenLite.version = "1.10.1"; TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1); TweenLite.defaultOverwrite = "auto"; TweenLite.ticker = _ticker; TweenLite.autoSleep = true; TweenLite.selector = window.$ || window.jQuery || function(e) { if (window.$) { TweenLite.selector = window.$; return window.$(e); } return window.document ? window.document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e) : e; }; var _internals = TweenLite._internals = {}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object. _plugins = TweenLite._plugins = {}, _tweenLookup = TweenLite._tweenLookup = {}, _tweenLookupNum = 0, _reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1}, _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0}, _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(), _rootTimeline = Animation._rootTimeline = new SimpleTimeline(); _rootTimeline._startTime = _ticker.time; _rootFramesTimeline._startTime = _ticker.frame; _rootTimeline._active = _rootFramesTimeline._active = true; Animation._updateRoot = function() { _rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false); _rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false); if (!(_ticker.frame % 120)) { //dump garbage every 120 frames... var i, a, p; for (p in _tweenLookup) { a = _tweenLookup[p].tweens; i = a.length; while (--i > -1) { if (a[i]._gc) { a.splice(i, 1); } } if (a.length === 0) { delete _tweenLookup[p]; } } //if there are no more tweens in the root timelines, or if they're all paused, make the _timer sleep to reduce load on the CPU slightly p = _rootTimeline._first; if (!p || p._paused) if (TweenLite.autoSleep && !_rootFramesTimeline._first && _ticker._listeners.tick.length === 1) { while (p && p._paused) { p = p._next; } if (!p) { _ticker.sleep(); } } } }; _ticker.addEventListener("tick", Animation._updateRoot); var _register = function(target, tween, scrub) { var id = target._gsTweenID, a, i; if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) { _tweenLookup[id] = {target:target, tweens:[]}; } if (tween) { a = _tweenLookup[id].tweens; a[(i = a.length)] = tween; if (scrub) { while (--i > -1) { if (a[i] === tween) { a.splice(i, 1); } } } } return _tweenLookup[id].tweens; }, _applyOverwrite = function(target, tween, props, mode, siblings) { var i, changed, curTween, l; if (mode === 1 || mode >= 4) { l = siblings.length; for (i = 0; i < l; i++) { if ((curTween = siblings[i]) !== tween) { if (!curTween._gc) if (curTween._enabled(false, false)) { changed = true; } } else if (mode === 5) { break; } } return changed; } //NOTE: Add 0.0000000001 to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example) var startTime = tween._startTime + 0.0000000001, overlaps = [], oCount = 0, zeroDur = (tween._duration === 0), globalStart; i = siblings.length; while (--i > -1) { if ((curTween = siblings[i]) === tween || curTween._gc || curTween._paused) { //ignore } else if (curTween._timeline !== tween._timeline) { globalStart = globalStart || _checkOverlap(tween, 0, zeroDur); if (_checkOverlap(curTween, globalStart, zeroDur) === 0) { overlaps[oCount++] = curTween; } } else if (curTween._startTime <= startTime) if (curTween._startTime + curTween.totalDuration() / curTween._timeScale + 0.0000000001 > startTime) if (!((zeroDur || !curTween._initted) && startTime - curTween._startTime <= 0.0000000002)) { overlaps[oCount++] = curTween; } } i = oCount; while (--i > -1) { curTween = overlaps[i]; if (mode === 2) if (curTween._kill(props, target)) { changed = true; } if (mode !== 2 || (!curTween._firstPT && curTween._initted)) { if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween. changed = true; } } } return changed; }, _checkOverlap = function(tween, reference, zeroDur) { var tl = tween._timeline, ts = tl._timeScale, t = tween._startTime, min = 0.0000000001; //we use this to protect from rounding errors. while (tl._timeline) { t += tl._startTime; ts *= tl._timeScale; if (tl._paused) { return -100; } tl = tl._timeline; } t /= ts; return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * min)) ? min : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + min) ? 0 : t - reference - min; }; //---- TweenLite instance methods ----------------------------------------------------------------------------- p._init = function() { var v = this.vars, op = this._overwrittenProps, dur = this._duration, ease = v.ease, i, initPlugins, pt, p; if (v.startAt) { v.startAt.overwrite = 0; v.startAt.immediateRender = true; this._startAt = TweenLite.to(this.target, 0, v.startAt); if (v.immediateRender) { this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()). if (this._time === 0 && dur !== 0) { return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a TimelineLite or TimelineMax, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting. } } } else if (v.runBackwards && v.immediateRender && dur !== 0) { //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards) if (this._startAt) { this._startAt.render(-1, true); this._startAt = null; } else if (this._time === 0) { pt = {}; for (p in v) { //copy props into a new object and skip any reserved props, otherwise onComplete or onUpdate or onStart could fire. We should, however, permit autoCSS to go through. if (!_reservedProps[p] || p === "autoCSS") { pt[p] = v[p]; } } pt.overwrite = 0; this._startAt = TweenLite.to(this.target, 0, pt); return; } } if (!ease) { this._ease = TweenLite.defaultEase; } else if (ease instanceof Ease) { this._ease = (v.easeParams instanceof Array) ? ease.config.apply(ease, v.easeParams) : ease; } else { this._ease = (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase; } this._easeType = this._ease._type; this._easePower = this._ease._power; this._firstPT = null; if (this._targets) { i = this._targets.length; while (--i > -1) { if ( this._initProps( this._targets[i], (this._propLookup[i] = {}), this._siblings[i], (op ? op[i] : null)) ) { initPlugins = true; } } } else { initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op); } if (initPlugins) { TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite } if (op) if (!this._firstPT) if (typeof(this.target) !== "function") { //if all tweening properties have been overwritten, kill the tween. If the target is a function, it's probably a delayedCall so let it live. this._enabled(false, false); } if (v.runBackwards) { pt = this._firstPT; while (pt) { pt.s += pt.c; pt.c = -pt.c; pt = pt._next; } } this._onUpdate = v.onUpdate; this._initted = true; }; p._initProps = function(target, propLookup, siblings, overwrittenProps) { var p, i, initPlugins, plugin, a, pt, v; if (target == null) { return false; } if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe. _autoCSS(this.vars, target); } for (p in this.vars) { v = this.vars[p]; if (_reservedProps[p]) { if (v instanceof Array) if (v.join("").indexOf("{self}") !== -1) { this.vars[p] = v = this._swapSelfInParams(v, this); } } else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this)) { //t - target [object] //p - property [string] //s - start [number] //c - change [number] //f - isFunction [boolean] //n - name [string] //pg - isPlugin [boolean] //pr - priority [number] this._firstPT = pt = {_next:this._firstPT, t:plugin, p:"setRatio", s:0, c:1, f:true, n:p, pg:true, pr:plugin._priority}; i = plugin._overwriteProps.length; while (--i > -1) { propLookup[plugin._overwriteProps[i]] = this._firstPT; } if (plugin._priority || plugin._onInitAllProps) { initPlugins = true; } if (plugin._onDisable || plugin._onEnable) { this._notifyPluginsOfEnabled = true; } } else { this._firstPT = propLookup[p] = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pg:false, pr:0}; pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ](); pt.c = (typeof(v) === "string" && v.charAt(1) === "=") ? parseInt(v.charAt(0) + "1", 10) * Number(v.substr(2)) : (Number(v) - pt.s) || 0; } if (pt) if (pt._next) { pt._next._prev = pt; } } if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first) return this._initProps(target, propLookup, siblings, overwrittenProps); } if (this._overwrite > 1) if (this._firstPT) if (siblings.length > 1) if (_applyOverwrite(target, this, propLookup, this._overwrite, siblings)) { this._kill(propLookup, target); return this._initProps(target, propLookup, siblings, overwrittenProps); } return initPlugins; }; p.render = function(time, suppressEvents, force) { var prevTime = this._time, isComplete, callback, pt; if (time >= this._duration) { this._totalTime = this._time = this._duration; this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1; if (!this._reversed) { isComplete = true; callback = "onComplete"; } if (this._duration === 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. if (time === 0 || this._rawPrevTime < 0) if (this._rawPrevTime !== time) { force = true; if (this._rawPrevTime > 0) { callback = "onReverseComplete"; if (suppressEvents) { time = -1; //when a callback is placed at the VERY beginning of a timeline and it repeats (or if timeline.seek(0) is called), events are normally suppressed during those behaviors (repeat or seek()) and without adjusting the _rawPrevTime back slightly, the onComplete wouldn't get called on the next render. This only applies to zero-duration tweens/callbacks of course. } } } this._rawPrevTime = time; } } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0. this._totalTime = this._time = 0; this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0; if (prevTime !== 0 || (this._duration === 0 && this._rawPrevTime > 0)) { callback = "onReverseComplete"; isComplete = this._reversed; } if (time < 0) { this._active = false; if (this._duration === 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered. if (this._rawPrevTime >= 0) { force = true; } this._rawPrevTime = time; } } else if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. force = true; } } else { this._totalTime = this._time = time; if (this._easeType) { var r = time / this._duration, type = this._easeType, pow = this._easePower; if (type === 1 || (type === 3 && r >= 0.5)) { r = 1 - r; } if (type === 3) { r *= 2; } if (pow === 1) { r *= r; } else if (pow === 2) { r *= r * r; } else if (pow === 3) { r *= r * r * r; } else if (pow === 4) { r *= r * r * r * r; } if (type === 1) { this.ratio = 1 - r; } else if (type === 2) { this.ratio = r; } else if (time / this._duration < 0.5) { this.ratio = r / 2; } else { this.ratio = 1 - (r / 2); } } else { this.ratio = this._ease.getRatio(time / this._duration); } } if (this._time === prevTime && !force) { return; } else if (!this._initted) { this._init(); if (!this._initted) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. return; } //_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently. if (this._time && !isComplete) { this.ratio = this._ease.getRatio(this._time / this._duration); } else if (isComplete && this._ease._calcEnd) { this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1); } } if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) { this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done. } if (prevTime === 0) { if (this._startAt) { if (time >= 0) { this._startAt.render(time, suppressEvents, force); } else if (!callback) { callback = "_dummyGS"; //if no callback is defined, use a dummy value just so that the condition at the end evaluates as true because _startAt should render AFTER the normal render loop when the time is negative. We could handle this in a more intuitive way, of course, but the render loop is the MOST important thing to optimize, so this technique allows us to avoid adding extra conditional logic in a high-frequency area. } } if (this.vars.onStart) if (this._time !== 0 || this._duration === 0) if (!suppressEvents) { this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray); } } pt = this._firstPT; while (pt) { if (pt.f) { pt.t[pt.p](pt.c * this.ratio + pt.s); } else { pt.t[pt.p] = pt.c * this.ratio + pt.s; } pt = pt._next; } if (this._onUpdate) { if (time < 0) if (this._startAt) { this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. } if (!suppressEvents) { this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray); } } if (callback) if (!this._gc) { //check _gc because there's a chance that kill() could be called in an onUpdate if (time < 0 && this._startAt && !this._onUpdate) { this._startAt.render(time, suppressEvents, force); } if (isComplete) { if (this._timeline.autoRemoveChildren) { this._enabled(false, false); } this._active = false; } if (!suppressEvents && this.vars[callback]) { this.vars[callback].apply(this.vars[callback + "Scope"] || this, this.vars[callback + "Params"] || _blankArray); } } }; p._kill = function(vars, target) { if (vars === "all") { vars = null; } if (vars == null) if (target == null || target === this.target) { return this._enabled(false, false); } target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target; var i, overwrittenProps, p, pt, propLookup, changed, killProps, record; if ((target instanceof Array || _isSelector(target)) && typeof(target[0]) !== "number") { i = target.length; while (--i > -1) { if (this._kill(vars, target[i])) { changed = true; } } } else { if (this._targets) { i = this._targets.length; while (--i > -1) { if (target === this._targets[i]) { propLookup = this._propLookup[i] || {}; this._overwrittenProps = this._overwrittenProps || []; overwrittenProps = this._overwrittenProps[i] = vars ? this._overwrittenProps[i] || {} : "all"; break; } } } else if (target !== this.target) { return false; } else { propLookup = this._propLookup; overwrittenProps = this._overwrittenProps = vars ? this._overwrittenProps || {} : "all"; } if (propLookup) { killProps = vars || propLookup; record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (vars == null || vars._tempKill !== true)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin) for (p in killProps) { if ((pt = propLookup[p])) { if (pt.pg && pt.t._kill(killProps)) { changed = true; //some plugins need to be notified so they can perform cleanup tasks first } if (!pt.pg || pt.t._overwriteProps.length === 0) { if (pt._prev) { pt._prev._next = pt._next; } else if (pt === this._firstPT) { this._firstPT = pt._next; } if (pt._next) { pt._next._prev = pt._prev; } pt._next = pt._prev = null; } delete propLookup[p]; } if (record) { overwrittenProps[p] = 1; } } if (!this._firstPT && this._initted) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening. this._enabled(false, false); } } } return changed; }; p.invalidate = function() { if (this._notifyPluginsOfEnabled) { TweenLite._onPluginEvent("_onDisable", this); } this._firstPT = null; this._overwrittenProps = null; this._onUpdate = null; this._startAt = null; this._initted = this._active = this._notifyPluginsOfEnabled = false; this._propLookup = (this._targets) ? {} : []; return this; }; p._enabled = function(enabled, ignoreTimeline) { if (!_tickerActive) { _ticker.wake(); } if (enabled && this._gc) { var targets = this._targets, i; if (targets) { i = targets.length; while (--i > -1) { this._siblings[i] = _register(targets[i], this, true); } } else { this._siblings = _register(this.target, this, true); } } Animation.prototype._enabled.call(this, enabled, ignoreTimeline); if (this._notifyPluginsOfEnabled) if (this._firstPT) { return TweenLite._onPluginEvent((enabled ? "_onEnable" : "_onDisable"), this); } return false; }; //----TweenLite static methods ----------------------------------------------------- TweenLite.to = function(target, duration, vars) { return new TweenLite(target, duration, vars); }; TweenLite.from = function(target, duration, vars) { vars.runBackwards = true; vars.immediateRender = (vars.immediateRender != false); return new TweenLite(target, duration, vars); }; TweenLite.fromTo = function(target, duration, fromVars, toVars) { toVars.startAt = fromVars; toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false); return new TweenLite(target, duration, toVars); }; TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) { return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, useFrames:useFrames, overwrite:0}); }; TweenLite.set = function(target, vars) { return new TweenLite(target, 0, vars); }; TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, vars) { var a = TweenLite.getTweensOf(target), i = a.length; while (--i > -1) { a[i]._kill(vars, target); } }; TweenLite.getTweensOf = function(target) { if (target == null) { return []; } target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; var i, a, j, t; if ((target instanceof Array || _isSelector(target)) && typeof(target[0]) !== "number") { i = target.length; a = []; while (--i > -1) { a = a.concat(TweenLite.getTweensOf(target[i])); } i = a.length; //now get rid of any duplicates (tweens of arrays of objects could cause duplicates) while (--i > -1) { t = a[i]; j = i; while (--j > -1) { if (t === a[j]) { a.splice(i, 1); } } } } else { a = _register(target).concat(); i = a.length; while (--i > -1) { if (a[i]._gc) { a.splice(i, 1); } } } return a; }; /* * ---------------------------------------------------------------- * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another <script> call before loading plugins which is easy to forget) * ---------------------------------------------------------------- */ var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) { this._overwriteProps = (props || "").split(","); this._propName = this._overwriteProps[0]; this._priority = priority || 0; this._super = TweenPlugin.prototype; }, true); p = TweenPlugin.prototype; TweenPlugin.version = "1.10.1"; TweenPlugin.API = 2; p._firstPT = null; p._addTween = function(target, prop, start, end, overwriteProp, round) { var c, pt; if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) { this._firstPT = pt = {_next:this._firstPT, t:target, p:prop, s:start, c:c, f:(typeof(target[prop]) === "function"), n:overwriteProp || prop, r:round}; if (pt._next) { pt._next._prev = pt; } return pt; } }; p.setRatio = function(v) { var pt = this._firstPT, min = 0.000001, val; while (pt) { val = pt.c * v + pt.s; if (pt.r) { val = (val + ((val > 0) ? 0.5 : -0.5)) | 0; //about 4x faster than Math.round() } else if (val < min) if (val > -min) { //prevents issues with converting very small numbers to strings in the browser val = 0; } if (pt.f) { pt.t[pt.p](val); } else { pt.t[pt.p] = val; } pt = pt._next; } }; p._kill = function(lookup) { var a = this._overwriteProps, pt = this._firstPT, i; if (lookup[this._propName] != null) { this._overwriteProps = []; } else { i = a.length; while (--i > -1) { if (lookup[a[i]] != null) { a.splice(i, 1); } } } while (pt) { if (lookup[pt.n] != null) { if (pt._next) { pt._next._prev = pt._prev; } if (pt._prev) { pt._prev._next = pt._next; pt._prev = null; } else if (this._firstPT === pt) { this._firstPT = pt._next; } } pt = pt._next; } return false; }; p._roundProps = function(lookup, value) { var pt = this._firstPT; while (pt) { if (lookup[this._propName] || (pt.n != null && lookup[ pt.n.split(this._propName + "_").join("") ])) { //some properties that are very plugin-specific add a prefix named after the _propName plus an underscore, so we need to ignore that extra stuff here. pt.r = value; } pt = pt._next; } }; TweenLite._onPluginEvent = function(type, tween) { var pt = tween._firstPT, changed, pt2, first, last, next; if (type === "_onInitAllProps") { //sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame. while (pt) { next = pt._next; pt2 = first; while (pt2 && pt2.pr > pt.pr) { pt2 = pt2._next; } if ((pt._prev = pt2 ? pt2._prev : last)) { pt._prev._next = pt; } else { first = pt; } if ((pt._next = pt2)) { pt2._prev = pt; } else { last = pt; } pt = next; } pt = tween._firstPT = first; } while (pt) { if (pt.pg) if (typeof(pt.t[type]) === "function") if (pt.t[type]()) { changed = true; } pt = pt._next; } return changed; }; TweenPlugin.activate = function(plugins) { var i = plugins.length; while (--i > -1) { if (plugins[i].API === TweenPlugin.API) { _plugins[(new plugins[i]())._propName] = plugins[i]; } } return true; }; //provides a more concise way to define plugins that have no dependencies besides TweenPlugin and TweenLite, wrapping common boilerplate stuff into one function (added in 1.9.0). You don't NEED to use this to define a plugin - the old way still works and can be useful in certain (rare) situations. _gsDefine.plugin = function(config) { if (!config || !config.propName || !config.init || !config.API) { throw "illegal plugin definition."; } var propName = config.propName, priority = config.priority || 0, overwriteProps = config.overwriteProps, map = {init:"_onInitTween", set:"setRatio", kill:"_kill", round:"_roundProps", initAll:"_onInitAllProps"}, Plugin = _class("plugins." + propName.charAt(0).toUpperCase() + propName.substr(1) + "Plugin", function() { TweenPlugin.call(this, propName, priority); this._overwriteProps = overwriteProps || []; }, (config.global === true)), p = Plugin.prototype = new TweenPlugin(propName), prop; p.constructor = Plugin; Plugin.API = config.API; for (prop in map) { if (typeof(config[prop]) === "function") { p[map[prop]] = config[prop]; } } Plugin.version = config.version; TweenPlugin.activate([Plugin]); return Plugin; }; //now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you. a = window._gsQueue; if (a) { for (i = 0; i < a.length; i++) { a[i](); } for (p in _defLookup) { if (!_defLookup[p].func) { window.console.log("GSAP encountered missing dependency: com.greensock." + p); } } } _tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated })(window);
import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; import { all } from 'rsvp'; export default class CourseVisualizationsRoute extends Route { @service store; @service session; @service dataLoader; titleToken = 'general.coursesAndSessions'; async model(params) { return this.dataLoader.loadCourse(params.course_id); } /** * Prefetch related data to limit network requests */ afterModel(model) { const courses = [model.get('id')]; const course = model.get('id'); const sessions = model.hasMany('sessions').ids(); const existingSessionsInStore = this.store.peekAll('session'); const existingSessionIds = existingSessionsInStore.mapBy('id'); const unloadedSessions = sessions.filter((id) => !existingSessionIds.includes(id)); //if we have already loaded all of these sessions we can just proceed normally if (unloadedSessions.length === 0) { return; } const promises = [ this.store.query('session', { filters: { course } }), this.store.query('offering', { filters: { courses } }), this.store.query('ilm-session', { filters: { courses } }), this.store.query('course-objective', { filters: { courses } }), ]; const maximumSessionLoad = 100; if (sessions.length < maximumSessionLoad) { promises.pushObject(this.store.query('session-objective', { filters: { sessions } })); promises.pushObject(this.store.query('session-type', { filters: { sessions } })); promises.pushObject(this.store.query('term', { filters: { sessions } })); } else { for (let i = 0; i < sessions.length; i += maximumSessionLoad) { const slice = sessions.slice(i, i + maximumSessionLoad); promises.pushObject( this.store.query('session-objective', { filters: { sessions: slice }, }) ); promises.pushObject(this.store.query('session-type', { filters: { sessions: slice } })); promises.pushObject(this.store.query('term', { filters: { sessions: slice } })); } } return all(promises); } beforeModel(transition) { this.session.requireAuthentication(transition, 'login'); } }
'use strict'; describe('App.expander module', function () { var $scope; beforeEach(module('myApp.expander')); beforeEach(inject(function ($rootScope) { $scope = $rootScope.$new(); })); describe('controller', function () { it('should ...', inject(function ($controller) { var view1Ctrl = $controller('ExpanderController', {$scope: $scope}); expect($scope.title).toEqual('Click me expander.'); expect(view1Ctrl).toBeDefined(); })); it('accords ...', inject(function ($controller) { var viewCtrl = $controller('ExpanderController', {$scope: $scope}); expect($scope.expanders.length).toEqual(3); })); }); });
/* * CarrotCake CMS * http://www.carrotware.com/ * * Copyright 2011, Samantha Copeland * Dual licensed under the MIT or GPL Version 3 licenses. * * Date: October 2011 * Generated: [[TIMESTAMP]] */ //==================== dateTime stuff function __carrotGetTimeFormat() { return "[[SHORTTIMEPATTERN]]"; } function __carrotGetDateFormat() { return "[[SHORTDATEPATTERN]]"; } function __carrotGetAMDateFormat() { return "[[AM_TIMEPATTERN]]"; } function __carrotGetPMDateFormat() { return "[[PM_TIMEPATTERN]]"; } function __carrotGetDateTemplate() { return "[[SHORTDATEFORMATPATTERN]]"; } function __carrotGetDateTimeTemplate() { return "[[SHORTDATETIMEFORMATPATTERN]]"; } //================================================================
import express from 'express'; import expressHealthcheck from 'express-healthcheck'; import cors from 'cors'; import bodyParser from 'body-parser'; import mongoose from 'mongoose'; import morgan from 'morgan'; // Providers import Log from './providers/log'; // Config import config from './config'; // Routes import routes from './routes'; class Api { constructor(){ this.app = express(); this.log = new Log(); this.mongoose = mongoose; this.middleware(); this.connectMongo(); this.routes(); this.start(); } middleware(){ // Enable Cors this.app.use(cors()); // Body Parser this.app.use(bodyParser.json()); this.app.use(bodyParser.urlencoded({ extended: false })); // Morgan - HTTP request logger this.app.use(morgan('combined')); // HealthCheck this.app.use('/healthcheck', expressHealthcheck()); } connectMongo(){ this.mongoConfig = config.mongo(); this.mongoose.connect(this.mongoConfig.uri); // Set Promise this.mongoose.Promise = Promise; // Callbacks of connection this.mongoose.connection.on('error', (err) => this.log.fatal(`MongoDB connection error: ${err}`)); this.mongoose.connection.on('connected', () => this.log.info(`MongoDB connection open to: ${this.mongoConfig.uri}`)); this.mongoose.connection.on('disconnected', () => this.log.fatal('MongoDB connection disconnected')); } routes(){ routes.map((route) => this.app.use('/', route)); } start(){ this.app.listen(config.port); this.log.info(`Listening on ${config.port}`); } } export default new Api();
/*jslint node: true*/ 'use strict'; /** * Decode the value. * * @param value The value. * @returns The value. */ module.exports = function (value) { // Check if the value is not a string. if (typeof value !== 'string') { // Return the value. return value; } // Return the value. return value.replace(/&#([0-9]{2});/g, function (match, oct) { // Parse the base 10 number. return String.fromCharCode(parseInt(oct, 10)); }); };
/*exported exampleDirective */ var exampleDirective = function(){ 'use strict'; return { restrict: 'AEC', replace: true, templateUrl: 'examples/exampleDirective.tmpl', link: function($scope, $elem, attrs){ $elem.find('button').on('click',function(ev){ $scope.setAlive($scope.pet); $scope.$apply(); console.log($scope, $elem, attrs, ev); }); } }; };
define(['widgets/appWidgets2/input/checkboxInput', 'common/runtime', 'testUtil'], ( CheckboxInput, Runtime, TestUtil ) => { 'use strict'; describe('Test checkbox data input widget', () => { let testConfig = {}, runtime, bus, container; beforeEach(() => { runtime = Runtime.make(); bus = runtime.bus().makeChannelBus({ description: 'checkbox testing', }); container = document.createElement('div'); document.body.appendChild(container); testConfig = { bus, parameterSpec: { data: { defaultValue: 0, nullValue: 0, constraints: { required: false, }, }, original: { checkbox_options: { checked_value: 1, unchecked_value: 0, }, id: 'some_checkbox', }, ui: { label: 'Some Checkbox', }, }, channelName: bus.channelName, }; }); afterEach(() => { bus.stop(); runtime.destroy(); TestUtil.clearRuntime(); container.remove(); }); it('should be defined', () => { expect(CheckboxInput).not.toBeNull(); }); it('should instantiate with a test config', () => { const widget = CheckboxInput.make(testConfig); expect(widget).toEqual(jasmine.any(Object)); ['start', 'stop'].forEach((fn) => { expect(widget[fn]).toEqual(jasmine.any(Function)); }); }); it('should start and stop properly without initial value', async () => { const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); expect(container.childElementCount).toBeGreaterThan(0); const input = container.querySelector('input[type="checkbox"]'); expect(input).toBeDefined(); expect(input.checked).toBeFalse(); await widget.stop(); expect(container.childElementCount).toBe(0); }); it('should start and stop properly with initial value', async () => { testConfig.initialValue = 1; const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); expect(container.childElementCount).toBeGreaterThan(0); const input = container.querySelector('input[type="checkbox"]'); expect(input).toBeDefined(); expect(input.checked).toBeTrue(); await widget.stop(); expect(container.childElementCount).toBe(0); }); it('should update model properly', async () => { let changeMsg; bus.on('changed', (value) => { changeMsg = value; }); const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); const input = container.querySelector('input[type="checkbox"]'); input.checked = true; input.dispatchEvent(new Event('change')); await TestUtil.wait(500); expect(changeMsg).toEqual({ newValue: 1 }); await widget.stop(); }); it('should respond to an update message by changing the value', async () => { const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); const input = container.querySelector('input[type="checkbox"]'); expect(input.checked).toBeFalse(); bus.emit('update', { value: 1 }); await TestUtil.wait(500); expect(input.checked).toBeTrue(); await widget.stop(); }); it('should reset the value to default via message', async () => { testConfig.initialValue = 1; const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); const input = container.querySelector('input[type="checkbox"]'); expect(input.checked).toBeTrue(); bus.emit('reset-to-defaults'); await TestUtil.wait(500); expect(input.checked).toBeFalse(); await widget.stop(); }); describe('error values', () => { beforeEach(() => { testConfig.initialValue = 'omg_not_a_value'; }); it('should show an error if the initial config value is not 1 or 0, and validate with the default value', async () => { const widget = CheckboxInput.make(testConfig); let validMsg; bus.on('changed', (msg) => { validMsg = msg; }); await widget.start({ node: container }); await TestUtil.wait(500); const input = container.querySelector('input[type="checkbox"]'); expect(input.checked).toBeFalse(); expect(validMsg).toEqual({ newValue: 0 }); // it should have the right class const errorContainer = container.querySelector( '.kb-appInput__checkbox_error_container' ); expect(errorContainer).not.toBeNull(); // it should have a cancel button expect( errorContainer.querySelector('button.kb-appInput__checkbox_error__close_button') ).not.toBeNull(); // it should have a message expect(errorContainer.textContent).toContain( `Invalid value of "${testConfig.initialValue}" for parameter ${testConfig.parameterSpec.ui.label}. Default value unchecked used.` ); }); it('the error should be dismissable with a button', async () => { const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); const elem = container.querySelector('.kb-appInput__checkbox_container'); await TestUtil.waitForElementChange(elem, () => { elem.querySelector('button.kb-appInput__checkbox_error__close_button').click(); }); expect(elem.querySelector('.kb-appInput__checkbox_error_container')).toBeNull(); }); it('the error should be dismissable by changing the checkbox', async () => { const widget = CheckboxInput.make(testConfig); await widget.start({ node: container }); const elem = container.querySelector('.kb-appInput__checkbox_container'); await TestUtil.waitForElementChange(elem, () => { container.querySelector('input[type="checkbox"]').click(); }); expect(elem.querySelector('.kb-appInput__checkbox_error_container')).toBeNull(); }); }); }); });
(function($_) { var Callbacks; $_.Callbacks = Callbacks = {}; var getCallbacks = function(options) { var list = $_.Store.getStore(); var on = function(fn) { var tmp = list.get('any')||[]; tmp.push(fn); list.set('any', tmp); }; var remove = function(fn){ var tmp = list.get('any')||[]; list.set('any', $_.A.without(tmp,fn)); }; var has = function(fn){ var tmp = list.get('any')||[]; return $_.A.include(tmp, fn); }; var emit = function(context, args){ var tmp = list.get('any')||[]; $_.A.each(tmp, function(fn){ fn.apply(context, args); }); return this; }; return { on: on, remove: remove, has: has, emit: emit }; }; $_.O.extend(Callbacks, { getCallbacks: getCallbacks }); })(Asdf);
function createQueryString (params) { return Object.keys(params).map(function (name) { return name + '=' + encodeURIComponent(params[name]) }).join('&') } exports.generateSearchUrl = function (params) { if (!params || typeof params !== 'object') { throw new Error('Expect params to be an object.') } // required if (!Object.prototype.hasOwnProperty.call(params, 'query') || typeof params.query !== 'string') { throw new Error('Expect params to have string property named query.') } // optional if (Object.prototype.hasOwnProperty.call(params, 'page') && typeof params.page !== 'number') { throw new Error('Expect params named page to be type number.') } params = { q: params.query, page: params.page || 1 } return 'https://bandcamp.com/search?' + createQueryString(params) } exports.generateTagUrl = function (params) { if (!params || typeof params !== 'object') { throw new Error('Expect params to be an object.') } // required if (!Object.prototype.hasOwnProperty.call(params, 'tag') || typeof params.tag !== 'string') { throw new Error('Expect params to have string property named tag.') } // optional if (Object.prototype.hasOwnProperty.call(params, 'page') && typeof params.page !== 'number') { throw new Error('Expect params named page to be type number.') } const tag = params.tag params = { page: params.page || 1 } return 'https://bandcamp.com/tag/' + encodeURIComponent(tag) + '?' + createQueryString(params) }
var searchData= [ ['yield_290',['Yield',['../namespaceargcv.html#a80686021f3ca186645e2d1e5c1801058',1,'argcv']]] ];
require('./event-tests')(); require('./subscription-tests')(); require('./signal-test')();
import React from 'react'; import PropTypes from 'prop-types'; import './Search.css'; function Search(props) { return ( <form onSubmit={props.searchResults} className="Search"> <div className="Input-group"> <p className="Input-field"> <label className="Input-label sr-only" htmlFor="profileSearch">Profile Search</label> <input type="text" id="profileSearch" name="profileSearch" className="Input" placeholder="Search GitHub" value={props.searchValue} onChange={(event) => props.updateSearch(event.target.value)} /> </p> <input type="submit" value="Search" className="Input-button" /> </div> </form> ); } Search.propTypes = { searchValue: PropTypes.string, updateSearch: PropTypes.func, searchResults: PropTypes.func, }; export default Search;
var animate; var Game = Game || {}; var WIDTH = window.innerWidth; var HEIGHT = window.innerHeight; var FPS = 30; var engine = new Game.Engine('game', WIDTH, HEIGHT, FPS); engine.init(); engine.register(new Game.SquareInvaders({ width: WIDTH, height: HEIGHT, FPS: FPS })); // Use fallbacks for requestAnimationFrame animate = (window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / FPS); }); // Taken from (function() { function main() { Game.stopLoop = animate(main); engine.step(); } main(); })();