code
stringlengths
2
1.05M
var gulpConfig = function() { var src = './src/'; var build = './build/'; var assets = build + 'assets'; var config = { /** * native files */ src: { js: src + 'js/**/*.js', allJade: src + '**/*.jade', pageJade: src + '*.jade', applicationSass: src + 'sass/application.sass', allSass: src + 'sass/**/*.sass' }, /** * build folders */ build: { js: build + 'js/', css: build + 'css/', html: build, VendorJs: build + 'assets/vendor/js/', VendorCss: build + 'assets/vendor/css/' } } return config; }; module.exports = gulpConfig();
/** * Gentelella adopted theme scripts */ /* eslint-disable */ var CURRENT_URL = window.location.href.split('?')[0], $BODY = $('body'), $MENU_TOGGLE = $('#menu_toggle'), $SIDEBAR_MENU = $('#sidebar-menu'), $SIDEBAR_FOOTER = $('.sidebar-footer'), $LEFT_COL = $('.left_col'), $RIGHT_COL = $('.right_col'), $NAV_MENU = $('.nav_menu'), $FOOTER = $('footer'); // Sidebar $(document).ready(function() { var setContentHeight = function () { // reset height $RIGHT_COL.css('min-height', $(window).height()); var bodyHeight = $BODY.outerHeight(), footerHeight = $BODY.hasClass('footer_fixed') ? 0 : $FOOTER.height(), leftColHeight = $LEFT_COL.eq(1).height() + $SIDEBAR_FOOTER.height(), contentHeight = bodyHeight < leftColHeight ? leftColHeight : bodyHeight; // normalize content contentHeight -= $NAV_MENU.height() + footerHeight; $RIGHT_COL.css('min-height', contentHeight); }; // toggle small or large menu $MENU_TOGGLE.on('click', function() { if ($BODY.hasClass('nav-md')) { $SIDEBAR_MENU.find('li.active ul').hide(); $SIDEBAR_MENU.find('li.active').addClass('active-sm').removeClass('active'); } else { $SIDEBAR_MENU.find('li.active-sm ul').show(); $SIDEBAR_MENU.find('li.active-sm').addClass('active').removeClass('active-sm'); } $BODY.toggleClass('nav-md nav-sm'); setContentHeight(); }); // recompute content when resizing $(window).smartresize(function(){ setContentHeight(); }); setContentHeight(); // fixed sidebar if ($.fn.mCustomScrollbar) { $('.menu_fixed').mCustomScrollbar({ autoHideScrollbar: true, theme: 'minimal', mouseWheel:{ preventDefault: true } }); } $('.ng-collapse').on('click', function() { $($(this).data('target')).slideToggle(); }); }); // /Sidebar // Panel toolbox var panelToolbox = function() { $('.collapse-link').off('click').on('click', function() { var $BOX_PANEL = $(this).closest('.x_panel'), $ICON = $(this).find('i'), $BOX_CONTENT = $BOX_PANEL.find('.x_content'); // fix for some div with hardcoded fix class if ($BOX_PANEL.attr('style')) { $BOX_CONTENT.slideToggle(200, function(){ $BOX_PANEL.removeAttr('style'); }); } else { $BOX_CONTENT.slideToggle(200); $BOX_PANEL.css('height', 'auto'); } $ICON.toggleClass('fa-chevron-up fa-chevron-down'); }); $('.close-link').off('click').click(function () { var $BOX_PANEL = $(this).closest('.x_panel'); $BOX_PANEL.remove(); }); }; $(document).ready(panelToolbox); // /Panel toolbox // Tooltip $(document).ready(function() { $('[data-toggle="tooltip"]').tooltip({ container: 'body' }); }); // /Tooltip // Progressbar if ($(".progress .progress-bar")[0]) { $('.progress .progress-bar').progressbar(); } // /Progressbar // Switchery $(document).ready(function() { if ($(".js-switch")[0]) { var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch')); elems.forEach(function (html) { var switchery = new Switchery(html, { color: '#26B99A' }); }); } }); // /Switchery // iCheck $(document).ready(function() { if ($("input.flat")[0]) { $(document).ready(function () { $('input.flat').iCheck({ checkboxClass: 'icheckbox_flat-green', radioClass: 'iradio_flat-green' }); }); } }); // /iCheck // Table $('table input').on('ifChecked', function () { checkState = ''; $(this).parent().parent().parent().addClass('selected'); countChecked(); }); $('table input').on('ifUnchecked', function () { checkState = ''; $(this).parent().parent().parent().removeClass('selected'); countChecked(); }); var checkState = ''; $('.bulk_action input').on('ifChecked', function () { checkState = ''; $(this).parent().parent().parent().addClass('selected'); countChecked(); }); $('.bulk_action input').on('ifUnchecked', function () { checkState = ''; $(this).parent().parent().parent().removeClass('selected'); countChecked(); }); $('.bulk_action input#check-all').on('ifChecked', function () { checkState = 'all'; countChecked(); }); $('.bulk_action input#check-all').on('ifUnchecked', function () { checkState = 'none'; countChecked(); }); function countChecked() { if (checkState === 'all') { $(".bulk_action input[name='table_records']").iCheck('check'); } if (checkState === 'none') { $(".bulk_action input[name='table_records']").iCheck('uncheck'); } var checkCount = $(".bulk_action input[name='table_records']:checked").length; if (checkCount) { $('.column-title').hide(); $('.bulk-actions').show(); $('.action-cnt').html(checkCount + ' Records Selected'); } else { $('.column-title').show(); $('.bulk-actions').hide(); } } // Accordion $(document).ready(function() { $(".expand").on("click", function () { $(this).next().slideToggle(200); $expand = $(this).find(">:first-child"); if ($expand.text() == "+") { $expand.text("-"); } else { $expand.text("+"); } }); }); // NProgress if (typeof NProgress != 'undefined') { $(document).ready(function () { NProgress.start(); }); $(window).load(function () { NProgress.done(); }); } /** * Resize function without multiple trigger * * Usage: * $(window).smartresize(function(){ * // code here * }); */ (function($,sr){ // debouncing function from John Hann // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ var debounce = function (func, threshold, execAsap) { var timeout; return function debounced () { var obj = this, args = arguments; function delayed () { if (!execAsap) func.apply(obj, args); timeout = null; } if (timeout) clearTimeout(timeout); else if (execAsap) func.apply(obj, args); timeout = setTimeout(delayed, threshold || 100); }; }; // smartresize jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; })(jQuery,'smartresize'); /** * Initialize select2 combo boxes */ var select2 = function () { $('.select2').each(function () { $(this).select2({ placeholder: $(this).attr('data-placeholder'), allowClear: $(this).attr('data-allow-clear'), maximumSelectionLength: $(this).attr('data-maximum-selection-length') }); }); }; $(document).ready(select2);
/** * @flow * @module cartReducer * * @author Oleg Nosov <olegnosov1@gmail.com> * @license MIT * * @description * Redux reducer to operate with cart * */ import { combineReducers } from "redux"; import products from "./cart/products"; import currency from "./cart/currency"; /** * @function * @description * Default state value is * { products: {}, currency: 'USD' } */ export default combineReducers({ products, currency });
'use strict'; const chai = require('chai'), Sequelize = require('../../../../index'), expect = chai.expect, Support = require(__dirname + '/../../support'); describe(Support.getTestDialectTeaser('Model'), () => { describe('scopes', () => { beforeEach(function() { this.ScopeMe = this.sequelize.define('ScopeMe', { username: Sequelize.STRING, email: Sequelize.STRING, access_level: Sequelize.INTEGER, other_value: Sequelize.INTEGER, parent_id: Sequelize.INTEGER }, { defaultScope: { where: { access_level: { gte: 5 } } }, scopes: { highValue: { where: { other_value: { gte: 10 } } }, andScope: { where: { $and: [ { email: { like: '%@sequelizejs.com' } }, { access_level : 3 } ] } } } }); return this.sequelize.sync({force: true}).then(() => { const records = [ {username: 'tony', email: 'tony@sequelizejs.com', access_level: 3, other_value: 7, parent_id: 1}, {username: 'tobi', email: 'tobi@fakeemail.com', access_level: 10, other_value: 11, parent_id: 2}, {username: 'dan', email: 'dan@sequelizejs.com', access_level: 5, other_value: 10, parent_id: 1}, {username: 'fred', email: 'fred@foobar.com', access_level: 3, other_value: 7, parent_id: 1} ]; return this.ScopeMe.bulkCreate(records); }); }); it('should be able use where in scope', function() { return this.ScopeMe.scope({where: { parent_id: 2 }}).findAll().then((users) => { expect(users).to.have.length(1); expect(users[0].username).to.equal('tobi'); }); }); it('should be able to combine scope and findAll where clauses', function() { return this.ScopeMe.scope({where: { parent_id: 1 }}).findAll({ where: {access_level: 3}}).then((users) => { expect(users).to.have.length(2); expect(['tony', 'fred'].indexOf(users[0].username) !== -1).to.be.true; expect(['tony', 'fred'].indexOf(users[1].username) !== -1).to.be.true; }); }); it('should be able to use a defaultScope if declared', function() { return this.ScopeMe.all().then((users) => { expect(users).to.have.length(2); expect([10, 5].indexOf(users[0].access_level) !== -1).to.be.true; expect([10, 5].indexOf(users[1].access_level) !== -1).to.be.true; expect(['dan', 'tobi'].indexOf(users[0].username) !== -1).to.be.true; expect(['dan', 'tobi'].indexOf(users[1].username) !== -1).to.be.true; }); }); it('should be able to handle $and in scopes', function() { return this.ScopeMe.scope('andScope').findAll().then((users) => { expect(users).to.have.length(1); expect(users[0].username).to.equal('tony'); }); }); describe('should not overwrite', () => { it('default scope with values from previous finds', function() { return this.ScopeMe.findAll({ where: { other_value: 10 }}).bind(this).then(function(users) { expect(users).to.have.length(1); return this.ScopeMe.findAll(); }).then((users) => { // This should not have other_value: 10 expect(users).to.have.length(2); }); }); it('other scopes with values from previous finds', function() { return this.ScopeMe.scope('highValue').findAll({ where: { access_level: 10 }}).bind(this).then(function(users) { expect(users).to.have.length(1); return this.ScopeMe.scope('highValue').findAll(); }).then((users) => { // This should not have other_value: 10 expect(users).to.have.length(2); }); }); }); it('should have no problem performing findOrCreate', function() { return this.ScopeMe.findOrCreate({ where: {username: 'fake'}}).spread((user) => { expect(user.username).to.equal('fake'); }); }); }); });
// No browsers as of this writing implement Fullscreen API without prefixes // So we look for prefixed versions of each API feature. const fullscreenEnabled = document.fullscreenEnabled || // Spec - future document.webkitFullscreenEnabled || // (Blink/Webkit) Chrome/Opera/Edge/Safari document.mozFullScreenEnabled || // (Gecko) Firefox document.msFullscreenEnabled; // IE11 export function isFullscreenEnabled() { return fullscreenEnabled; } function exitFullscreen() { // This cannot be reassigned to a common function or errors may appear, so each // vendor-prefixed API is checked individually and run if present. if (document.exitFullscreen) { // Spec document.exitFullscreen(); } else if (document.webkitExitFullscreen) { // (Blink/Webkit) Chrome/Opera/Edge/Safari document.webkitExitFullscreen(); } else if (document.mozCancelFullScreen) { // (Gecko) Firefox // Mozilla has its own syntax for this. document.mozCancelFullScreen(); } else if (document.msExitFullscreen) { // IE11 document.msExitFullscreen(); } } // Wraps `element.requestFullscreen` in a cross-browser compatible function. function requestFullscreen(element) { if (element.requestFullscreen) { // Spec element.requestFullscreen(); } else if (element.webkitRequestFullscreen) { // (Blink/Webkit) Chrome/Opera/Edge/Safari // Webkit-based browsers disables keyboard input in fullscreen for // some reason (security?) but it can be requested. However Safari // will refuse to allow keyboard input no matter what. element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } else if (element.mozRequestFullScreen) { // (Gecko) Firefox element.mozRequestFullScreen(); } else if (element.msRequestFullscreen) { // IE11 element.msRequestFullscreen(); } } /** * Returns the element that is currently being presented in full-screen mode in * this document, or null if full-screen mode is not currently in use. Since * no browser implements this without a prefix, this function accounts for * different cross-browser implementations. * * @returns {Node|null} - a DOM element that is currently displayed in * full screen (usually equal to `document.documentElement`), or `null` * if no element is displayed in full screen. */ export function getFullscreenElement() { return document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; } export function toggleFullscreen() { // If fullscreen not enabled, ignore if (!fullscreenEnabled) return; // Is there a current fullscreen element? const fullscreenElement = getFullscreenElement(); if (!fullscreenElement) { requestFullscreen(document.documentElement); } else if (exitFullscreen) { exitFullscreen(); } } function logFullscreenError(error) { console.log(error); } document.addEventListener('fullscreenerror', logFullscreenError, false); document.addEventListener('mozfullscreenerror', logFullscreenError, false); document.addEventListener('webkitfullscreenerror', logFullscreenError, false); document.addEventListener('MSFullscreenError', logFullscreenError, false);
/* Brazilian initialisation for the jQuery UI date picker plugin. */ /* Written by Leonildo Costa Silva (leocsilva@gmail.com). */ jQuery(function($){ $.datepicker.regional['pt-BR'] = { closeText: 'Fechar', prevText: '&#x3c;Anterior', nextText: 'Pr&oacute;ximo&#x3e;', currentText: 'Hoje', monthNames: ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho', 'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun', 'Jul','Ago','Set','Out','Nov','Dez'], dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'], dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'], dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'], weekHeader: 'Sm', dateFormat: 'dd/mm/yy', firstDay: 0, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['pt-BR']); });
var bodyParser = require('body-parser'); var express = require('express'); var methodOverride = require('method-override'); var RSVP = require('rsvp'); var logger = require('./utility/logger').createLogger('teksavvy-usage'); var TeksavvyClient = require('./lib/teksavvy-client'); var UsageController = require('./controllers/usage-controller').UsageController; RSVP.on('error', function(reason){ logger.fatal('RSVP error ', reason); process.exit(1); }); var app = express(); var address = process.env.ADDRESS || '0.0.0.0'; var port = process.env.PORT || 8080; app.use(require('express-bunyan-logger')({ name: 'teksavvy-usage', streams: [ { level: 'debug', stream: process.stdout } ] })); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use(methodOverride()); app.use(express.static(__dirname + '/../public')); var teksavvyClient = new TeksavvyClient({ logger: logger.child({subcomponent: 'teksavvy-client'}) }); var usageController = new UsageController({teksavvyClient: teksavvyClient}); app.get('/usage/:api_key', function(req, res) { usageController.usage.apply(usageController, arguments); }); app.listen(port, address, function() { logger.info('Express listening on %s:%d', address, port); });
var gameView = require('../view/gameView'); var Item = require('./Item'); var level = require('../level'); var TILE_HEIGHT = settings.tileSize.height; var ANIMATION = [ assets.entity.item.life0, assets.entity.item.life1, assets.entity.item.life2, assets.entity.item.life3, assets.entity.item.life4, assets.entity.item.life5, assets.entity.item.life6, assets.entity.item.life7, assets.entity.item.life8 ]; var PARAMS = { sprites: ANIMATION, offsetX: -2, offsetY: -3 }; var GRAVITY = 0.15; var MAX_GRAVITY = 2.5; var DAMPING = 0.7; //โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„ function ItemLife() { Item.call(this, PARAMS); this.grounded = false; this.rebound = 0; this.sy = 0; // when spawning, item is not grabbable by banana for few frames this.isLocked = true; this.lockedCounter = 30; } inherits(ItemLife, Item); module.exports = ItemLife; //โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„ ItemLife.prototype.draw = function () { // counter if (this.isLocked && this.lockedCounter-- <= 0) this.isLocked = false; // move if (!this.grounded) { this.sy += GRAVITY; this.sy = Math.min(this.sy, MAX_GRAVITY); var y = this.y + this.sy; if (level.getTileAt(this.x + 4, y + 8).isTopSolid) { y = this.y; this.sy *= -DAMPING; this.rebound += 1; sfx('bounce', Math.min(1, -this.sy)); if (this.rebound > 3) { this.grounded = true; y = ~~(this.y / TILE_HEIGHT + 1) * TILE_HEIGHT; } } this.y = y; } // draw item Item.prototype.draw.call(this); }; //โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„ ItemLife.prototype.collisionBanana = function (banana) { if (this.isLocked) return; banana.grab(this); }; //โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„โ–„ ItemLife.prototype.collectItem = function (monkey) { Item.prototype.collectItem.call(this, monkey); if (monkey.lifePoints < monkey.maxLife) monkey.lifePoints += 1; gameView.updateHealthHUD(); };
var mongoose = require('mongoose'); module.exports = mongoose.model('poll', { pollName : {type : String, default: ''}, pollDesc : {type : String, default: ''}, pollStartTime : Date, pollEndTime : Date, pollInterval : Number, isDeleted : {type : Boolean, default: false}, pollPublic : {type : Boolean, default: false}, pollCreateNew : {type : Boolean, default: false}, });
import { moduleFor, test } from 'ember-qunit'; moduleFor('route:locations', { // Specify the other units that are required for this test. // needs: ['controller:foo'] }); test('it exists', function(assert) { var route = this.subject(); assert.ok(route); });
var ajax = require('../../utils/ajax'); var message = require('../../utils/message'); var formatWeather = function(local, weather) { var weather = weather.data; var str = 'ใ€' + local +'ๅคฉๆฐ”ใ€‘\n\r\n\r'; for (var i in weather.forecast[0]) { if (i == 'date') { str += 'ใ€' + weather.forecast[0][i] + "ใ€‘\n\r"; } else { str += weather.forecast[0][i] + ' ' } } str += '\n\r'; for (var i in weather.forecast[1]) { if (i == 'date') { str += 'ใ€' + weather.forecast[1][i] + "ใ€‘\n\r"; } else { str += weather.forecast[1][i] + ' ' } } if (weather.ganmao) { str += '\n\r\n\r[็Žซ็‘ฐ]' + weather.ganmao + '[็Žซ็‘ฐ]'; } return str; } var weather = function(msgContent, casperIns, regex) { var local = msgContent.replace(/ |ๅคฉๆฐ”/, ''); var resource = 'http://wthrcdn.etouch.cn/weather_mini?city=' + encodeURIComponent(local); ajax.get(casperIns, resource, {}, function(res){ var weather = JSON.parse(res); if (weather.status == 1000) { message.send(casperIns, formatWeather(local, weather)); } else { message.send(casperIns, 'ๆœชๆŸฅๆ‰พๅˆฐ็›ธๅ…ณๅคฉๆฐ”ไฟกๆฏใ€‚่ฏทๅฐ่ฏ•่พ“ๅ…ฅๆ ผๅผๅฆ‚"ๅนฟๅทžๅคฉๆฐ”"ใ€‚') } }); } module.exports = weather;
// Right now this doesn't really do anything. It just wraps // a net connection in case we want to do fancier stuff later. var EventEmitter = require('events').EventEmitter, net = require('net'), Telnet; Telnet = function (host, port) { var self = this, client; client = net.connect({ host: host, port: port }, function () { self.emit('connection', self); }); client.setEncoding('utf8'); client.on('close', function () { self.emit('close'); }); client.on('error', function (err) { client.end(); }); client.on('data', function (data) { self.emit('data', data); }); this.write = function (data) { client.write(data); }; this.close = function () { client.end(); }; }; Telnet.prototype = Object.create(EventEmitter.prototype); module.exports = Telnet;
import React from 'react' import Modal from './Modal' const BLEND_MODES = [ 'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity' ] class ColumnSettings extends React.Component { getCurrentBlendMode = () => { return this.props.properties.blend_mode || 'normal' } handleBlendModeChange = (e) => { this.props.updateProperty('blend_mode', e.target.value) } handleLoopChange = (e) => { if (e.target.checked) { this.props.updateProperty('loop', true) } else { this.props.updateProperty('loop', false) } } handleLoopPointChange = (e) => { if (isNaN(e.target.value)) { return; } this.props.updateProperty('loop_point', parseInt(e.target.value, 10)) } render = () => ( <Modal onClose={this.props.hide} title="Settings"> <div> <label> Blend Mode <select value={this.getCurrentBlendMode()} onChange={this.handleBlendModeChange}> {BLEND_MODES.map(mode => <option key={mode} value={mode}>{mode}</option> )} </select> </label> </div> {this.props.asset.type == 'video' && <div> <div> <label> <input type="checkbox" checked={this.props.properties.loop || false} onChange={this.handleLoopChange} /> Loop Video </label> </div> <div> <label> Loop Point <input type="text" value={this.props.properties.loop_point || 0} onChange={this.handleLoopPointChange} /> </label> </div> </div> } <div className="vspacing"> <div className="pull-right"> <button className="button outline" onClick={this.props.delete}>Delete</button> <button className="button" onClick={this.props.hide}>Okay</button> </div> <div className="clearfix"></div> </div> </Modal> ) } export default ColumnSettings
// All material copyright ESRI, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.8/esri/copyright.txt for details. //>>built define({zoom:"Transfocare la",next:"Obiectul spa\u0163ial urm\u0103tor",previous:"Obiectul spa\u0163ial anterior",close:"\u00cenchidere",dock:"Doc",undock:"Anulare andocare",menu:"Meniu",untitled:"F\u0103r\u0103 titlu",pageText:"{index} din {total}",selectedFeature:"Obiect spa\u0163ial selectat",selectedFeatures:"{total} rezultate",loading:"Se \u00eencarc\u0103",collapse:"Restr\u00e2ngere",expand:"Extindere"});
;(function(commonjs){ // Blacklist common values. var BLACKLIST = [ "11111111111111" , "22222222222222" , "33333333333333" , "44444444444444" , "55555555555555" , "66666666666666" , "77777777777777" , "88888888888888" , "99999999999999" ]; var verifierDigit = function(numbers) { var index = 2; var reverse = numbers.split("").reduce(function(buffer, number) { return [parseInt(number, 10)].concat(buffer); }, []); var sum = reverse.reduce(function(buffer, number) { buffer += number * index; index = (index === 9 ? 2 : index + 1); return buffer; }, 0); var mod = sum % 11; return (mod < 2 ? 0 : 11 - mod); }; var CNPJ = {}; CNPJ.format = function(number) { return this.strip(number).replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5"); }; CNPJ.strip = function(number) { return (number || "").toString().replace(/[^\d]/g, ""); }; CNPJ.isValid = function(number) { var stripped = this.strip(number); // CNPJ must be defined if (!stripped) { return false; } // CNPJ must have 14 chars if (stripped.length !== 14) { return false; } // CNPJ can't be blacklisted if (BLACKLIST.indexOf(stripped) >= 0) { return false; } var numbers = stripped.substr(0, 12); numbers += verifierDigit(numbers); numbers += verifierDigit(numbers); return numbers.substr(-2) === stripped.substr(-2); }; CNPJ.generate = function(formatted) { var numbers = ""; for (var i = 0; i < 12; i++) { numbers += Math.floor(Math.random() * 9); } numbers += verifierDigit(numbers); numbers += verifierDigit(numbers); return (formatted ? this.format(numbers) : numbers); }; if (commonjs) { module.exports = CNPJ; } else { window.CNPJ = CNPJ; } })(typeof(exports) !== "undefined");
"use strict"; function Shader(vp, fp, names) { function compileShader(prog, type) { var shader = gl.createShader(type); gl.shaderSource(shader, prog); gl.compileShader(shader); if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { console.log(prog); assert(false, gl.getShaderInfoLog(shader)); return null; } return shader; } var frag = compileShader(fp, gl.FRAGMENT_SHADER); var vert = compileShader(vp, gl.VERTEX_SHADER); if (!frag || !vert) return null; var prog = gl.createProgram(); gl.attachShader(prog, vert); gl.attachShader(prog, frag); gl.bindAttribLocation(prog, 0, "position"); gl.linkProgram(prog); if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) { assert(false, "could not initialise shaders"); return null; } if (names) { var self = this; names.forEach(function(name) { self[name] = gl.getUniformLocation(prog, name); }); } this.use = function() { gl.useProgram(prog); } this.matrix = function(name, mat) { var loc = typeof name === "string" ? gl.getUniformLocation(prog, name) : name; gl.uniformMatrix4fv(loc, false, mat); } this.texture = function(name, id, lev) { var loc = typeof name === "string" ? gl.getUniformLocation(prog, name) : name; gl.uniform1i(loc, lev); gl.activeTexture(gl.TEXTURE0 + lev); gl.bindTexture(gl.TEXTURE_2D, id); } this.vector = function(name, vec) { var loc = typeof name === "string" ? gl.getUniformLocation(prog, name) : name; gl.uniform4f(loc, vec[0], vec[1], vec[2], vec[3]); } this.getLocation = function(name) { return gl.getUniformLocation(prog, name); } } Shader.vertexShader = function(mat_pos, mat_tex, position) { var vert = "attribute vec4 position;\n"; if (mat_pos) vert += "uniform mat4 mat_pos;\n"; if (mat_tex) vert += "uniform mat4 mat_tex;\n"; vert += "varying vec4 texcoord;\n\ \n\ void main()\n\ {\n"; if (mat_pos) vert += "gl_Position = mat_pos * position;\n"; else vert += "gl_Position = position;\n"; if (mat_tex) vert += "texcoord = mat_tex * position;\n"; else vert += "texcoord = position * 0.5 + 0.5;\n"; if (position !== undefined) vert += "texcoord.zw = " + position + ".xy * 0.5 + 0.5;\n"; vert += "}\n"; return vert; }
const fs = require('fs'); const http2 = require('http2'); const config = require('config'); const expressStaticGzip = require("express-static-gzip"); const path = require('path'); const compress = require('compression'); const expressGraphQL = require('express-graphql'); const schema = require('../schema'); const router = require('./router'); module.exports = function(app, express, HOST, PORT, staticPath) { express.request.__proto__ = http2.IncomingMessage.prototype; express.response.__proto__ = http2.ServerResponse.prototype; app.use(compress()); app.use('/', router); app.use('/graphql', expressGraphQL(req => ({ formatError: console.error, graphiql: true, schema, context: { token: req.headers.authorization }, }))); app.use(expressStaticGzip(staticPath, { enableBrotli: true, })); app.get('/*', (req, res) => { res.sendFile(path.resolve(staticPath,'index.html')); }); const tlsOptions = config.get('tlsOptions'); const options = { key: fs.readFileSync(tlsOptions.key), cert: fs.readFileSync(tlsOptions.cert), }; const server = http2.createServer(options,app); server.listen(PORT, HOST, () => { console.info(`App listening on ${HOST}:${PORT}`); }); //require('./websocket')(server); };
'use strict' const NullFactory = require('./null') const Transient = require('../constitutors/transient') class ClassFactory extends NullFactory { constructor (key, constitutor0) { // Alias defaults to the transient constitutor const constitutor = constitutor0 || Transient.with([]) super(constitutor) this.key = key } createInstance (container) { // TODO Prevent circular aliases return container.constitute(this.key) } } module.exports = ClassFactory
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ic_sentiment_dissatisfied = exports.ic_sentiment_dissatisfied = { "viewBox": "0 0 24 24", "children": [{ "name": "circle", "attribs": { "cx": "15.5", "cy": "9.5", "r": "1.5" } }, { "name": "circle", "attribs": { "cx": "8.5", "cy": "9.5", "r": "1.5" } }, { "name": "path", "attribs": { "d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm0-6c-2.33 0-4.32 1.45-5.12 3.5h1.67c.69-1.19 1.97-2 3.45-2s2.75.81 3.45 2h1.67c-.8-2.05-2.79-3.5-5.12-3.5z" } }] };
import {blendValues} from '../validators/isBlendMode'; export default { valid: [ ...blendValues, ...blendValues.map(value => value.toUpperCase()), ], invalid: ['superblend', 'blend-man'], };
require.config({ baseUrl: 'scripts', paths: { backbone: '../../bower_components/backbone/backbone', underscore: '../../bower_components/underscore/underscore', underscoreString: '../../bower_components/underscore.string/lib/underscore.string', jquery: '../../bower_components/jquery/dist/jquery', foundation: '../../bower_components/foundation/js/foundation', handlebars: '../../bower_components/handlebars/handlebars', moment: '../../bower_components/moment/moment', text: '../../bower_components/text/text' }, shim: { backbone: { deps: ['jquery', 'underscore'], exports: 'Backbone' }, underscore: { exports: '_' }, underscoreString: { deps: ['underscore'], exports: '_.str' }, jquery: { exports: '$' }, foundation: { deps: ['jquery'], exports: '$' }, handlebars: { exports: 'Handlebars' } } });
import React from 'react'; import ReactDataGrid from 'react-data-grid'; const DataGridBasic = React.createClass({ getInitialState() { this.createRows(); this._columns = [ { key: 'id', name: 'ID' }, { key: 'title', name: 'Title' }, { key: 'count', name: 'Count' } ]; return null; }, createRows() { let rows = []; for (let i = 1; i < 1000; i++) { rows.push({ id: i, title: 'Title ' + i, count: i * 1000 }); } this._rows = rows; }, rowGetter(i) { return this._rows[i]; }, render() { return ( <ReactDataGrid columns={this._columns} rowGetter={this.rowGetter} rowsCount={this._rows.length} minHeight={500} />); } }); export default DataGridBasic; // module.exports = exampleWrapper({ // WrappedComponent: Example, // exampleName: 'Basic Example', // exampleDescription: 'A display only grid.', // examplePath: './scripts/example01-basic.js', // examplePlaygroundLink: 'https://jsfiddle.net/f6mbnb8z/1/' // });
import path from 'path'; import fs from 'fs'; import LocalStorage from '../../main/local-storage'; import {globalBeforeEach} from '../../__jest__/before-each'; describe('LocalStorage()', () => { beforeEach(async () => { await globalBeforeEach(); jest.useFakeTimers(); // There has to be a better way to reset this... setTimeout.mock.calls = []; }); afterEach(() => { jest.clearAllTimers(); }); it('create directory', () => { const basePath = `/tmp/insomnia-localstorage-${Math.random()}`; const ls = new LocalStorage(basePath); expect(ls).toBeInstanceOf(LocalStorage); const dir = fs.readdirSync(basePath); expect(dir.length).toEqual(0); }); it('does basic operations', () => { const basePath = `/tmp/insomnia-localstorage-${Math.random()}`; const localStorage = new LocalStorage(basePath); // Test get and set localStorage.setItem('foo', 'bar 1'); localStorage.setItem('foo', 'bar'); expect(localStorage.getItem('foo', 'BAD')).toBe('bar'); // Test Object storage localStorage.setItem('obj', {foo: 'bar', arr: [1, 2, 3]}); expect(localStorage.getItem('obj')).toEqual({foo: 'bar', arr: [1, 2, 3]}); // Test default values expect(localStorage.getItem('dne', 'default')).toEqual('default'); expect(localStorage.getItem('dne')).toEqual('default'); }); it('does handles malformed files', () => { const basePath = `/tmp/insomnia-localstorage-${Math.random()}`; const localStorage = new LocalStorage(basePath); // Assert default is returned on bad JSON fs.writeFileSync(path.join(basePath, 'key'), '{bad JSON'); expect(localStorage.getItem('key', 'default')).toBe('default'); // Assert that writing our file actually works fs.writeFileSync(path.join(basePath, 'key'), '{"good": "JSON"}'); expect(localStorage.getItem('key', 'default')).toEqual({good: 'JSON'}); }); it('does handles failing to write file', () => { const basePath = `/tmp/insomnia-localstorage-${Math.random()}`; const localStorage = new LocalStorage(basePath); fs.rmdirSync(basePath); localStorage.setItem('key', 'value'); jest.runAllTimers(); // Since the above operation failed to write, we should now get back // the default value expect(localStorage.getItem('key', 'different')).toBe('different'); }); it('stores a key', () => { const basePath = `/tmp/insomnia-localstorage-${Math.random()}`; const localStorage = new LocalStorage(basePath); localStorage.setItem('foo', 'bar'); // Assert timeouts are called expect(setTimeout.mock.calls.length).toBe(1); expect(setTimeout.mock.calls[0][1]).toBe(100); // Force debouncer to flush jest.runAllTimers(); // Assert there is one item stored expect(fs.readdirSync(basePath).length).toEqual(1); // Assert the contents are correct const contents = fs.readFileSync(path.join(basePath, 'foo'), 'utf8'); expect(contents).toEqual('"bar"'); }); it('debounces key sets', () => { const basePath = `/tmp/insomnia-localstorage-${Math.random()}`; const localStorage = new LocalStorage(basePath); localStorage.setItem('foo', 'bar1'); localStorage.setItem('another', 10); localStorage.setItem('foo', 'bar3'); // Assert timeouts are called expect(setTimeout.mock.calls.length).toBe(3); expect(setTimeout.mock.calls[0][1]).toBe(100); expect(setTimeout.mock.calls[1][1]).toBe(100); expect(setTimeout.mock.calls[2][1]).toBe(100); expect(fs.readdirSync(basePath).length).toEqual(0); // Force flush jest.runAllTimers(); // Make sure only one item exists expect(fs.readdirSync(basePath).length).toEqual(2); expect(fs.readFileSync(path.join(basePath, 'foo'), 'utf8')).toEqual('"bar3"'); expect(fs.readFileSync(path.join(basePath, 'another'), 'utf8')).toEqual('10'); }); });
const webpack = require('webpack'); const path = require('path'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const extractCSS = new ExtractTextPlugin('[name].css'); const BUILD_DIR = path.resolve(__dirname, 'build'); const APP_DIR = path.resolve(__dirname, 'src'); const STYLES_DIR = path.resolve(__dirname, 'styles'); module.exports = { entry: [ APP_DIR + '/index.jsx', STYLES_DIR + '/main.scss' ], module: { // preLoaders: [ // { // test: /\.jsx?$/, // include: APP_DIR, // loader: 'eslint-loader' // } // ], loaders: [ { test: /\.scss$/i, loader: extractCSS.extract(['css','sass']) }, { test: /\.jsx?$/, include: APP_DIR, loader: 'babel-loader', query: { presets: ['es2015', 'react'] } } ] }, plugins: [ extractCSS ], eslint: { configFile: '.eslintrc' }, output: { path: BUILD_DIR, publicPath: '/assets/', filename: 'bundle.js' } };
import {inject} from 'aurelia-framework'; import {BaseService} from './base-service'; import {CustomHttpClient} from '../lib/custom-http-client'; import {Contact} from '../lib/models/contact'; @inject(CustomHttpClient) export class ContactService extends BaseService { constructor(httpClient) { super(httpClient); } getContactList() { return new Promise((resolve, reject) => { super.makeRequest('GET', '/api/contacts') .then(data => { let results = data.map(c => { return new Contact(c._id, c.firstName, c.lastName, c.email, c.phoneNumber); }); resolve(results); }) .catch(err => { reject(err); }); }); } getContactDetails(contactId) { return new Promise((resolve, reject) => { super.makeRequest('GET', '/api/contacts/' + contactId) .then(data => { resolve(data); }) .catch(err => { reject(err); }); }); } saveContact(contact) { if (this.isRequesting) { return; } this.isRequesting = true; return new Promise((resolve, reject) => { this.http.post('api/contacts/' + contact.id, contact) .then(data => { this.isRequesting = false; resolve(data); }) .catch(err => { this.isRequesting = false; reject(err); }); }); } }
version https://git-lfs.github.com/spec/v1 oid sha256:1be67e1bed29cdf9d270af70d61350b8867dc9c1ad575f912afadb575690202e size 12529
import PropTypes from 'prop-types'; import React from 'react'; const TwitterHandle = ({handle}) => <a href={`https://twitter.com/${handle}`}>{`@${handle}`}</a>; TwitterHandle.propTypes = { handle: PropTypes.string.isRequired, }; export default TwitterHandle;
/** * Created by petermares on 20/02/2016. */ (function() { console.log("GitRunner booting!"); var settings = require('../settings'); var Game = new Phaser.Game(settings.display.width, settings.display.height, Phaser.AUTO, '' ); Game.state.add('boot', require('./states/boot')); Game.state.add('preloader', require('./states/preloader')); Game.state.add('mainmenu', require('./states/mainmenu')); Game.state.add('game', require('./states/game')); Game.state.start('boot'); })();
// utils / existsInArray export let existsInArray = (v, arr) => { return arr.some((k) => { return k === v; }); };
(function () { 'use strict'; angular .module ('videoWorks') .directive("videoWork", videoWork) .directive ("viewVideoWork", viewVideoWork); videoWork.$inject = ['$rootScope', '$http', '$timeout', '$mdDialog', '$mdMedia', '$mdToast', '$sce', 'VideoWorks', 'PhotoWorks', 'VideoCoverImage', 'Upload']; viewVideoWork.$inject = ['$rootScope', '$http', '$timeout', '$mdDialog', '$mdMedia', '$mdToast', '$sce', 'VideoWorks', 'PhotoWorks', 'VideoCoverImage', 'Upload']; function viewVideoWork ($rootScope, $http, $timeout, $mdDialog, $mdMedia, $mdToast, $sce, VideoWorks, PhotoWorks, VideoCoverImage, Upload) { var directive = { restrict: 'E', scope: { work: '=' }, link: function (scope) { }, templateUrl: 'modules/video-works/client/views/view-video-work.html' }; return directive; } function videoWork ($rootScope, $http, $timeout, $mdDialog, $mdMedia, $mdToast, $sce, VideoWorks, PhotoWorks, VideoCoverImage, Upload) { var directive = { restrict: 'E', scope: { work: '=' }, link: function (scope, elem, attr) { scope.customFullscreen = $mdMedia('xs') || $mdMedia ('sm'); scope.coverImageUrl = scope.work.coverImageUrl; scope.showVideoWork = function (ev) { var useFullScreen = ($mdMedia ('sm') || $mdMedia ('xs')) && scope.customFullscreen; $rootScope.currentWork = scope.work; $mdDialog.show ({ controller: function (scope, $mdDialog, $sce, work) { scope.workTitle = work.title; scope.workInfo = work.workInfo; scope.directors = work.directedBy; scope.editors = work.editedBy; scope.cast = work.cast; scope.copyright = work.copyright; // thanks to // http://stackoverflow.com/a/23945027 function extractDomain(url) { var domain; //find & remove protocol (http, ftp, etc.) and get domain if (url.indexOf("://") > -1) { domain = url.split('/')[2]; } else { domain = url.split('/')[0]; } //find & remove port number domain = domain.split(':')[0]; return domain; } var domain = extractDomain (work.videoUrl); if (domain === 'youtube.com' || domain === 'www.youtube.com') { scope.domain = 'youtube'; var videoUrl = work.videoUrl.replace ("watch?v=", "embed/"); scope.videoUrl = $sce.trustAsResourceUrl (videoUrl); } if (domain === 'vimeo.com' || domain === 'www.vimeo.com') { //player.vimeo.com/video/175738725 var vimeoId = work.videoUrl.substring ( work.videoUrl.lastIndexOf('/') + 1); var videoUrl = '//player.vimeo.com/video/' + vimeoId; scope.videoUrl = $sce.trustAsResourceUrl (videoUrl); scope.domain = 'vimeo'; scope.vimeoId = vimeoId; } if (domain === 'facebook.com' || domain === 'www.facebook.com') { scope.videoUrl = 'https://www.facebook.com/plugins/video.php?href=' + work.videoUrl; scope.videoUrl = $sce.trustAsResourceUrl (scope.videoUrl); scope.domain = 'facebook'; } $rootScope.hide = function () { $mdDialog.hide(); }; scope.cancel = function () { $mdDialog.cancel(); }; $rootScope.answer = function (answer) { $mdDialog.hide (answer); } }, locals: { work: scope.work }, templateUrl: 'modules/video-works/client/views/view-video-work.html', parent: angular.element (document.body), targetEvent: ev, autoWrap: false, clickOutsideToClose: true, fullscreen: useFullScreen }); }; scope.deleteVideoWork = function (work) { VideoWorks.deleteVideoWork (work); }; scope.editVideoWork = function () { scope.castModel = []; scope.directorsModel = []; scope.editorsModel = []; scope.editors = scope.work.editedBy; scope.directors = scope.work.directedBy; scope.cast = scope.work.cast; // iterate through the currently set models for the photo work for (var i = 0; i < scope.work.cast.length; ++i) { // push each cast member onto the data model for // this for loop might be unnecessary // cast input on video work scope.castModel.push({name: 'cast_' + i}); scope.castNumber = i; } // iterate through the currently set models for the photo work for (var i = 0; i < scope.work.directedBy.length; ++i) { // push each director onto the data model for // this for loop might be unnecessary // directors input on video work scope.directorsModel.push({name: 'director_' + i}); scope.directorNumber = i; } // iterate through the currently set models for the photo work for (var i = 0; i < scope.work.editedBy.length; ++i) { // push each editor onto the data model for // this for loop might be unnecessary // editors input on vide work scope.editorsModel.push({name: 'editor_' + i}); scope.editorNumber = i; } $mdDialog.show ({ locals: { work: scope.work, cast: scope.castMembers, editors: scope.editors, directors: scope.directors, castModel: scope.castModel, directorsModel: scope.directorsModel, editorsModel: scope.editorsModel, coverImageUrl: scope.coverImageUrl }, controller: function ($scope, $rootScope, $mdDialog, $mdToast, work, cast, editors, directors, castModel, editorsModel, directorsModel, coverImageUrl) { var last = { bottom: false, top: true, left: false, right: true }; $scope.toastPosition = angular.extend({},last); $scope.getToastPosition = function() { sanitizePosition(); return Object.keys($scope.toastPosition) .filter(function(pos) { return $scope.toastPosition[pos]; }) .join(' '); }; function sanitizePosition() { var current = $scope.toastPosition; if ( current.bottom && last.top ) current.top = false; if ( current.top && last.bottom ) current.bottom = false; if ( current.right && last.left ) current.left = false; if ( current.left && last.right ) current.right = false; last = angular.extend({},current); } $scope.showSimpleToast = function(error) { var pinTo = $scope.getToastPosition(); if (error === 'images') { $mdToast.show( $mdToast.simple() .textContent('Please add at least one image.') .position(pinTo ) .hideDelay(3000) ); } else { if (error === 'title') { $mdToast.show ( $mdToast.simple() .textContent ('Another work with that title already exists.') .position (pinTo) .hideDelay (3000) ); } else { if (error === 'video-image') { $mdToast.show( $mdToast.simple() .textContent('Please add a cover image.') .position(pinTo ) .hideDelay(3000) ); } else { if (error === 'missing-title') { $mdToast.show( $mdToast.simple() .textContent('Please add a title.') .position(pinTo ) .hideDelay(3000) ); } else { if (error === 'video-url') { $mdToast.show( $mdToast.simple() .textContent('Please add a video URL.') .position(pinTo ) .hideDelay(3000) ); } } } } } }; $scope.work = work; $scope.cast = work.cast; $scope.editors = work.editedBy; $scope.directors = work.directedBy; $scope.castModel = castModel; $scope.editorsModel = editorsModel; $scope.directorsModel = directorsModel; $scope.bwUploading = { visibility: 'hidden' }; var oldWorkTitle = work.title; var oldCast = work.cast; var oldVideoUrl = work.videoUrl; var oldEditors = work.editedBy; var oldDirectors = work.directedBy; var oldCopyright = work.copyright; var oldWorkInfo = work.workInfo; var oldCastModel = castModel; var oldEditorsModel = editorsModel; var oldDirectorsModel = directorsModel; $scope.cancelEdit = function () { work.title = oldWorkTitle; work.cast = $scope.cast; work.editedBy = $scope.editors; work.directedBy = $scope.directors; work.videoUrl = oldVideoUrl; work.copyright = oldCopyright; work.workInfo = oldWorkInfo; $scope.castModel = oldCastModel; $scope.directorsModel = oldDirectorsModel; $scope.editorsModel = oldEditorsModel; $mdDialog.cancel(); }; $scope.selectedCoverImage = function (file) { VideoCoverImage.addImage (file); }; $scope.submitEditedWork = function () { for (var i = 0; i < work.directedBy.length; ++i) { if (work.directedBy[i] === '' || work.directedBy[i].match(/^\s*$/)) { work.directedBy.splice(i, 1); i = 0; } } for (var i = 0; i < work.editedBy.length; ++i) { if (work.editedBy[i] === '' || work.editedBy[i].match(/^\s*$/)) { work.editedBy.splice(i, 1); i = 0; } } for (var i = 0; i < work.cast.length; ++i) { if (work.cast[i] === '' || work.cast[i].match(/^\s*$/)) { work.cast.splice(i, 1); i = 0; } } if (angular.equals([], $rootScope.videoCoverImage)){ $scope.showSimpleToast('video-image'); return; } else { if (work.title === '') { $scope.showSimpleToast ('missing-title'); return; } else { // check if the entered work title already exists // (another work with the same name already exists). for (var i = 0; i < PhotoWorks.photoWorks.length; ++i) { if (PhotoWorks.photoWorks[i].title === $scope.photoWorkTitle) { $scope.showSimpleToast('title'); return; } } for (var i = 0; i < VideoWorks.videoWorks.length; ++i) { if (VideoWorks.videoWorks[i].title === $scope.photoWorkTitle) { $scope.showSimpleToast('title'); return; } } if (work.videoUrl === '') { $scope.showSimpleToast ('video-url'); return; } } } if (VideoCoverImage.image.length !== 0) { $scope.bwUploading.visibility = 'visible'; // new cover image selected Upload.upload({ url: '/api/video_works/edit_video_work', arrayKey: '', data: { file: VideoCoverImage.image[0], work: JSON.stringify (work) } }).then (function (resp) { var edit = resp.data; VideoWorks.addEdit (edit); work = edit; coverImageUrl = edit.coverImageUrl; $scope.uploadProgress = 0; $scope.bwUploading.visibility = 'hidden'; VideoCoverImage.image = []; $mdDialog.hide (); (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); }, function (resp) { }, function (evt) { $scope.uploadProgress = (evt.loaded / evt.total) * 100; }); } else { // no new cover image selected Upload.upload ({ url: '/api/video_works/edit_video_work', arrayKey: '', data: { file: {}, work: JSON.stringify (work) } }).then (function (resp) { var edit = resp.data; VideoWorks.addEdit (edit); work = edit; coverImageUrl = edit.coverImageUrl; $mdDialog.hide (); (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.7"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); }, function (resp) { }, function (evt) { }); } }; }, clickOutsideToClose: true, templateUrl: 'modules/bw-interface/client/views/edit-video-work.html' }); }; }, templateUrl: 'modules/video-works/client/views/video-work.html' }; return directive; } }());
module.exports = { "env": { jest: true }, "parser": "babel-eslint", "extends": ["standard", "standard-react"] };
/* eslint max-len: "off" */ import template from "babel-template"; const helpers = {}; export default helpers; helpers.typeof = template(` (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; `); helpers.jsx = template(` (function () { var REACT_ELEMENT_TYPE = (typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7; return function createRawReactElement (type, props, key, children) { var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { // If we're going to assign props.children, we create a new object now // to avoid mutating defaultProps. props = {}; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null, }; }; })() `); helpers.asyncIterator = template(` (function (iterable) { if (typeof Symbol === "function") { if (Symbol.asyncIterator) { var method = iterable[Symbol.asyncIterator]; if (method != null) return method.call(iterable); } if (Symbol.iterator) { return iterable[Symbol.iterator](); } } throw new TypeError("Object is not async iterable"); }) `); helpers.asyncGenerator = template(` (function () { function AwaitValue(value) { this.value = value; } function AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg) var value = result.value; if (value instanceof AwaitValue) { Promise.resolve(value.value).then( function (arg) { resume("next", arg); }, function (arg) { resume("throw", arg); }); } else { settle(result.done ? "return" : "normal", result.value); } } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; // Hide "return" method if generator return is not supported if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }; AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); }; AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); }; return { wrap: function (fn) { return function () { return new AsyncGenerator(fn.apply(this, arguments)); }; }, await: function (value) { return new AwaitValue(value); } }; })() `); helpers.asyncGeneratorDelegate = template(` (function (inner, awaitWrap) { var iter = {}, waiting = false; function pump(key, value) { waiting = true; value = new Promise(function (resolve) { resolve(inner[key](value)); }); return { done: false, value: awaitWrap(value) }; }; if (typeof Symbol === "function" && Symbol.iterator) { iter[Symbol.iterator] = function () { return this; }; } iter.next = function (value) { if (waiting) { waiting = false; return value; } return pump("next", value); }; if (typeof inner.throw === "function") { iter.throw = function (value) { if (waiting) { waiting = false; throw value; } return pump("throw", value); }; } if (typeof inner.return === "function") { iter.return = function (value) { return pump("return", value); }; } return iter; }) `); helpers.asyncToGenerator = template(` (function (fn) { return function () { return new Promise((resolve, reject) => { var gen = fn.apply(this, arguments); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; }) `); helpers.classCallCheck = template(` (function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }); `); helpers.createClass = template(` (function() { function defineProperties(target, props) { for (var i = 0; i < props.length; i ++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })() `); helpers.defineEnumerableProperties = template(` (function (obj, descs) { for (var key in descs) { var desc = descs[key]; desc.configurable = desc.enumerable = true; if ("value" in desc) desc.writable = true; Object.defineProperty(obj, key, desc); } // Symbols are not enumerated over by for-in loops. If native // Symbols are available, fetch all of the descs object's own // symbol properties and define them on our target object too. if (Object.getOwnPropertySymbols) { var objectSymbols = Object.getOwnPropertySymbols(descs); for (var i = 0; i < objectSymbols.length; i++) { var sym = objectSymbols[i]; var desc = descs[sym]; desc.configurable = desc.enumerable = true; if ("value" in desc) desc.writable = true; Object.defineProperty(obj, sym, desc); } } return obj; }) `); helpers.defaults = template(` (function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }) `); helpers.defineProperty = template(` (function (obj, key, value) { // Shortcircuit the slow defineProperty path when possible. // We are trying to avoid issues where setters defined on the // prototype cause side effects under the fast path of simple // assignment. By checking for existence of the property with // the in operator, we can optimize most of this overhead away. if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }); `); helpers.extends = template(` Object.assign || (function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }) `); helpers.get = template(` (function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }); `); helpers.inherits = template(` (function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }) `); helpers.inheritsLoose = template(` (function (subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }) `); helpers.instanceof = template(` (function (left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }); `); helpers.interopRequireDefault = template(` (function (obj) { return obj && obj.__esModule ? obj : { default: obj }; }) `); helpers.interopRequireWildcard = template(` (function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }) `); helpers.newArrowCheck = template(` (function (innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } }); `); helpers.objectDestructuringEmpty = template(` (function (obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }); `); helpers.objectWithoutProperties = template(` (function (source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }) `); helpers.possibleConstructorReturn = template(` (function (self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }); `); helpers.selfGlobal = template(` typeof global === "undefined" ? self : global `); helpers.set = template(` (function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if ("value" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; }); `); helpers.slicedToArray = template(` (function () { // Broken out into a separate function to avoid deoptimizations due to the try/catch for the // array iterator case. function sliceIterator(arr, i) { // this is an expanded form of \`for...of\` that properly supports abrupt completions of // iterators etc. variable names have been minimised to reduce the size of this massive // helper. sometimes spec compliancy is annoying :( // // _n = _iteratorNormalCompletion // _d = _didIteratorError // _e = _iteratorError // _i = _iterator // _s = _step var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })(); `); helpers.slicedToArrayLoose = template(` (function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); if (i && _arr.length === i) break; } return _arr; } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }); `); helpers.taggedTemplateLiteral = template(` (function (strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }); `); helpers.taggedTemplateLiteralLoose = template(` (function (strings, raw) { strings.raw = raw; return strings; }); `); helpers.temporalRef = template(` (function (val, name, undef) { if (val === undef) { throw new ReferenceError(name + " is not defined - temporal dead zone"); } else { return val; } }) `); helpers.temporalUndefined = template(` ({}) `); helpers.toArray = template(` (function (arr) { return Array.isArray(arr) ? arr : Array.from(arr); }); `); helpers.toConsumableArray = template(` (function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }); `); helpers.skipFirstGeneratorNext = template(` (function (fn) { return function () { var it = fn.apply(this, arguments); it.next(); return it; } }); `); helpers.toPropertyKey = template(` (function (key) { if (typeof key === "symbol") { return key; } else { return String(key); } }); `);
var constants = require('./constants'); var parseEvent = require('./parseEvent'); module.exports = function(parent, stream){ // parse out track header segment stream.string('header', 4); stream.tap(function(){ if (typeof this.vars.header === 'undefined') return parent.emit('error', new Error('Failed to parse track header')); if (this.vars.header !== constants.tracks.header) return parent.emit('error', new Error('Invalid track header value '+this.vars.header)); }); // parse out track chunk size stream.uint32be('chunkSize'); stream.tap(function(){ if (typeof this.vars.chunkSize === 'undefined') return parent.emit('error', new Error('Failed to parse track chunkSize')); }); // emit header info stream.tap(function(){ parent.emit('trackHeader', this.vars); }); // parse track events stream.loop('events', function(end){ parseEvent(parent, this); this.tap(function(){ parent.lastEvent = this.vars; // used for continuation midi events parent.emit('trackEvent', this.vars); }); // check for end of track this.tap(function(){ if (this.vars.eventType === 'meta' && this.vars.subtype === 47) { return end(true); } }); }); // skip the unparsed event chunks //stream.buffer('contents', 'chunkSize'); return stream; };
/* */ (function(process) { var assign = require("object-assign"); var babel = require("babel"); var babelDefaultOptions = require("../babel/default-options"); var babelOpts = babelDefaultOptions; module.exports = {process: function(src, path) { if (!path.match(/\/node_modules\//) && !path.match(/\/third_party\//)) { return babel.transform(src, assign({filename: path}, babelOpts)).code; } return src; }}; })(require("process"));
var Travis = { app: null, start: function() { Backbone.history = new Backbone.History; Travis.app = new ApplicationController; Travis.app.run(); }, trigger: function(event, data) { Travis.app.trigger(event, _.extend(data.build, { append_log: data.log })); } }; if(!INIT_DATA) { var INIT_DATA = {}; } $(document).ready(function() { if(!window.__TESTING__ && $('#application').length == 1) { Travis.start(); Backbone.history.start(); var channels = ['repositories', 'jobs']; // _.map(INIT_DATA.repositories || [], function(repository) { channels.push('repository_' + repository.id); }); _.each(channels, function(channel) { pusher.subscribe(channel).bind_all(Travis.trigger); }) } }); Pusher.log = function() { if (window.console) { // window.console.log.apply(window.console, arguments); } }; // Safari does not define bind() if(!Function.prototype.bind) { Function.prototype.bind = function(binding) { return _.bind(this, binding); } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tmrm = require("azure-pipelines-task-lib/mock-run"); const path = require("path"); const mocks = require("./mockWebApi"); let rootDir = path.join(__dirname, '../../Tasks', 'TagBuild'); let taskPath = path.join(rootDir, 'tagBuild.js'); let tmr = new tmrm.TaskMockRunner(taskPath); tmr.registerMock('azure-devops-node-api/WebApi', mocks.MockWebApi); // set variables process.env["SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"] = "http://localhost:8080/tfs/defaultcollection"; process.env["SYSTEM_TEAMPROJECT"] = "demo"; process.env["BUILD_BUILDID"] = "1"; process.env["RELEAS_RELEASEID"] = "22"; process.env["SYSTEM_ACCESSTOKEN"] = "faketoken"; // set inputs tmr.setInput('tags', 'tag1'); tmr.setInput('type', 'Build'); tmr.run(); // need setTimeout because of async methods setTimeout(() => { if ("demo" !== mocks.MockWebApi.taggerCall.project || "Build" !== mocks.MockWebApi.taggerCall.callType || 1 !== mocks.MockWebApi.taggerCall.id || !mocks.MockWebApi.taggerCall.tags.some(t => t === "tag1") || mocks.MockWebApi.taggerCall.tags.length !== 1) { console.log(mocks.MockWebApi.taggerCall); console.error("Tagging failed."); } else { console.log("Tagging successful!"); } }, 100); //# sourceMappingURL=test-tagBuildFromRelease-succeeds.js.map
'use strict'; /** * Implementation of $lte * @see http://docs.mongodb.org/manual/reference/operator/query/lte/ */ module.exports = function operation(model, update, options) { return model[options.queryItem] <= update.$lte; };
/* * grunt-x-combine * https://github.com/shadowmint/grunt-x-combine * * Copyright (c) 2014 doug * Licensed under the MIT license. */ 'use strict'; module.exports = function (grunt) { // Tasks require('matchdep').filterAll('grunt-*').forEach(function (x) { console.log("Autoload: " + x); grunt.loadNpmTasks(x); }); // Project configuration. grunt.initConfig({ jshint: { all: [ 'Gruntfile.js', 'tasks/*.js', '<%= nodeunit.tests %>' ], options: { jshintrc: '.jshintrc' } }, // Before generating any new files, remove any previously-created files. clean: { tests: ['tmp'] }, // Configuration to be run (and then tested). x_combine: { default_options: { options: { }, files: { 'tmp/default_options': ['test/fixtures/testing', 'test/fixtures/123'] } }, custom_options: { options: { separator: ': ', punctuation: ' !!!' }, files: { 'tmp/custom_options': ['test/fixtures/testing', 'test/fixtures/123'] } } }, // Unit tests. nodeunit: { tests: ['test/*_test.js'] }, // Build ts: { lib: { src: ['tasks/**/*.ts'], outDir: 'tasks/', options: { module: 'commonjs', target: 'es3', sourceMaps: true, declaration: true, removeComments: false } } }, // Watch watch: { lib: { files: ['tasks/**/*.ts'], tasks: ['ts:lib'], options: { spawn: false } } } }); // Actually load this plugin's task(s). grunt.loadTasks('tasks'); // Whenever the "test" task is run, first clean the "tmp" dir, then run this // plugin's task(s), then test the result. grunt.registerTask('test', ['clean', 'x_combine', 'nodeunit']); // By default, lint and run all tests. grunt.registerTask('default', ['ts:lib', 'jshint', 'test']); };
import { boolean } from 'type-func'; import { cancelAnimationFrame, requestAnimationFrame } from 'animation-frame-polyfill'; import { addElements, hasElement, removeElements } from 'dom-set'; import { createPointCB, getClientRect, pointInside } from 'dom-plane'; import mousemoveDispatcher from 'dom-mousemove-dispatcher'; function AutoScroller(elements, options){ if ( options === void 0 ) options = {}; var self = this; var maxSpeed = 4, scrolling = false; this.margin = options.margin || -1; //this.scrolling = false; this.scrollWhenOutside = options.scrollWhenOutside || false; var point = {}, pointCB = createPointCB(point), dispatcher = mousemoveDispatcher(), down = false; window.addEventListener('mousemove', pointCB, false); window.addEventListener('touchmove', pointCB, false); if(!isNaN(options.maxSpeed)){ maxSpeed = options.maxSpeed; } this.autoScroll = boolean(options.autoScroll); this.syncMove = boolean(options.syncMove, false); this.destroy = function(forceCleanAnimation) { window.removeEventListener('mousemove', pointCB, false); window.removeEventListener('touchmove', pointCB, false); window.removeEventListener('mousedown', onDown, false); window.removeEventListener('touchstart', onDown, false); window.removeEventListener('mouseup', onUp, false); window.removeEventListener('touchend', onUp, false); window.removeEventListener('pointerup', onUp, false); window.removeEventListener('mouseleave', onMouseOut, false); window.removeEventListener('mousemove', onMove, false); window.removeEventListener('touchmove', onMove, false); window.removeEventListener('scroll', setScroll, true); elements = []; if(forceCleanAnimation){ cleanAnimation(); } }; this.add = function(){ var element = [], len = arguments.length; while ( len-- ) element[ len ] = arguments[ len ]; addElements.apply(void 0, [ elements ].concat( element )); return this; }; this.remove = function(){ var element = [], len = arguments.length; while ( len-- ) element[ len ] = arguments[ len ]; return removeElements.apply(void 0, [ elements ].concat( element )); }; var hasWindow = null, windowAnimationFrame; if(Object.prototype.toString.call(elements) !== '[object Array]'){ elements = [elements]; } (function(temp){ elements = []; temp.forEach(function(element){ if(element === window){ hasWindow = window; }else{ self.add(element); } }); }(elements)); Object.defineProperties(this, { down: { get: function(){ return down; } }, maxSpeed: { get: function(){ return maxSpeed; } }, point: { get: function(){ return point; } }, scrolling: { get: function(){ return scrolling; } } }); var n = 0, current = null, animationFrame; window.addEventListener('mousedown', onDown, false); window.addEventListener('touchstart', onDown, false); window.addEventListener('mouseup', onUp, false); window.addEventListener('touchend', onUp, false); /* IE does not trigger mouseup event when scrolling. It is a known issue that Microsoft won't fix. https://connect.microsoft.com/IE/feedback/details/783058/scrollbar-trigger-mousedown-but-not-mouseup IE supports pointer events instead */ window.addEventListener('pointerup', onUp, false); window.addEventListener('mousemove', onMove, false); window.addEventListener('touchmove', onMove, false); window.addEventListener('mouseleave', onMouseOut, false); window.addEventListener('scroll', setScroll, true); function setScroll(e){ for(var i=0; i<elements.length; i++){ if(elements[i] === e.target){ scrolling = true; break; } } if(scrolling){ requestAnimationFrame(function (){ return scrolling = false; }); } } function onDown(){ down = true; } function onUp(){ down = false; cleanAnimation(); } function cleanAnimation(){ cancelAnimationFrame(animationFrame); cancelAnimationFrame(windowAnimationFrame); } function onMouseOut(){ down = false; } function getTarget(target){ if(!target){ return null; } if(current === target){ return target; } if(hasElement(elements, target)){ return target; } while(target = target.parentNode){ if(hasElement(elements, target)){ return target; } } return null; } function getElementUnderPoint(){ var underPoint = null; for(var i=0; i<elements.length; i++){ if(inside(point, elements[i])){ underPoint = elements[i]; } } return underPoint; } function onMove(event){ if(!self.autoScroll()) { return; } if(event['dispatched']){ return; } var target = event.target, body = document.body; if(current && !inside(point, current)){ if(!self.scrollWhenOutside){ current = null; } } if(target && target.parentNode === body){ //The special condition to improve speed. target = getElementUnderPoint(); }else{ target = getTarget(target); if(!target){ target = getElementUnderPoint(); } } if(target && target !== current){ current = target; } if(hasWindow){ cancelAnimationFrame(windowAnimationFrame); windowAnimationFrame = requestAnimationFrame(scrollWindow); } if(!current){ return; } cancelAnimationFrame(animationFrame); animationFrame = requestAnimationFrame(scrollTick); } function scrollWindow(){ autoScroll(hasWindow); cancelAnimationFrame(windowAnimationFrame); windowAnimationFrame = requestAnimationFrame(scrollWindow); } function scrollTick(){ if(!current){ return; } autoScroll(current); cancelAnimationFrame(animationFrame); animationFrame = requestAnimationFrame(scrollTick); } function autoScroll(el){ var rect = getClientRect(el), scrollx, scrolly; if(point.x < rect.left + self.margin){ scrollx = Math.floor( Math.max(-1, (point.x - rect.left) / self.margin - 1) * self.maxSpeed ); }else if(point.x > rect.right - self.margin){ scrollx = Math.ceil( Math.min(1, (point.x - rect.right) / self.margin + 1) * self.maxSpeed ); }else{ scrollx = 0; } if(point.y < rect.top + self.margin){ scrolly = Math.floor( Math.max(-1, (point.y - rect.top) / self.margin - 1) * self.maxSpeed ); }else if(point.y > rect.bottom - self.margin){ scrolly = Math.ceil( Math.min(1, (point.y - rect.bottom) / self.margin + 1) * self.maxSpeed ); }else{ scrolly = 0; } if(self.syncMove()){ /* Notes about mousemove event dispatch. screen(X/Y) should need to be updated. Some other properties might need to be set. Keep the syncMove option default false until all inconsistencies are taken care of. */ dispatcher.dispatch(el, { pageX: point.pageX + scrollx, pageY: point.pageY + scrolly, clientX: point.x + scrollx, clientY: point.y + scrolly }); } setTimeout(function (){ if(scrolly){ scrollY(el, scrolly); } if(scrollx){ scrollX(el, scrollx); } }); } function scrollY(el, amount){ if(el === window){ window.scrollTo(el.pageXOffset, el.pageYOffset + amount); }else{ el.scrollTop += amount; } } function scrollX(el, amount){ if(el === window){ window.scrollTo(el.pageXOffset + amount, el.pageYOffset); }else{ el.scrollLeft += amount; } } } function AutoScrollerFactory(element, options){ return new AutoScroller(element, options); } function inside(point, el, rect){ if(!rect){ return pointInside(point, el); }else{ return (point.y > rect.top && point.y < rect.bottom && point.x > rect.left && point.x < rect.right); } } /* git remote add origin https://github.com/hollowdoor/dom_autoscroller.git git push -u origin master */ export default AutoScrollerFactory; //# sourceMappingURL=bundle.es.js.map
const fs = require('fs'); const EJSON = require('mongodb-extended-json'); class ExpImpUsers { static get FILENAME_POSTFIX() { return '_users.json'; } static get MAPNAME_POSTFIX() { return '_userMap.json'; } static searchUser(allUserDoc, searchID) { for (let i=0; i < allUserDoc.length; i++) { if (allUserDoc[i]._id === searchID) { return allUserDoc[i]; } } throw Error('Could not find user with _id:'+searchID); } static doExport (db, msID, userIDsFlat) { return new Promise((resolve, reject) => { userIDsFlat = Object.keys(userIDsFlat); let userIDsOuputMap = {}; db.collection('users') .find({ _id : { $in : userIDsFlat } }) .toArray() .then(allUsersDoc => { if (allUsersDoc) { // userIDsFlat may contain "free text" users that are not in DB // We create a dict to look up which collected userIDs are really from DB let userIDsFromDB = {}; allUsersDoc.map(usr => { userIDsFromDB[usr._id] = 1; }); const usrFile = msID + ExpImpUsers.FILENAME_POSTFIX; fs.writeFileSync(usrFile, EJSON.stringify(allUsersDoc,null,2)); console.log('Saved: '+usrFile + ' with '+allUsersDoc.length+' users'); // Save mapping file old => new user ID // But only with REAL DB users (skip free text users) userIDsFlat.map(usrID => { if (userIDsFromDB[usrID]) { // default: newID === oldID // This means, users are copied(!) from source DB to destination DB // If newID is changed to an existing id from destination ID, this target user is used let thisUser = ExpImpUsers.searchUser(allUsersDoc, usrID); userIDsOuputMap[usrID] = { 'newID': usrID, 'hint': thisUser.username +' '+thisUser.profile.name }; } }); const mapFile = msID + ExpImpUsers.MAPNAME_POSTFIX; fs.writeFileSync(mapFile, JSON.stringify(userIDsOuputMap,null,2)); console.log('Saved: '+mapFile); console.log(' *** IMPORTANT!!! EDIT USER MAP FILE BEFORE IMPORT!!!'); resolve(db); } else { return reject ('Could not find users: ', userIDsFlat); } }); }); } static preImportCheck (db, msID) { return new Promise((resolve, reject) => { const mapFile = msID + ExpImpUsers.MAPNAME_POSTFIX; let usrMap = undefined; try { usrMap = JSON.parse(fs.readFileSync(mapFile, 'utf8')); if (!usrMap) { return reject('Could not read user map file '+mapFile); } } catch (e) { return reject('Could not read user map file '+mapFile + '\n'+e); } let usrMapSimple = {}; // make flat map: oldID => newID usrMap = Object.keys(usrMap).map(key => { usrMapSimple[key] = usrMap[key].newID; }); usrMap = usrMapSimple; let usrMapCount = Object.keys(usrMap).length; console.log('Found '+usrMapCount+' users in '+mapFile); let usrMapTargetIDs = []; let usrCopyIDs = []; Object.keys(usrMap).map(key => { if (key !== usrMap[key]) { // key/value different... usrMapTargetIDs.push(usrMap[key]); // map to existing user } else { usrCopyIDs.push(key); // copy user from export DB => import DB } }); // Check#1: All "link targets" should exist db.collection('users') .find({ _id : { $in : usrMapTargetIDs } }) .toArray() .then(doc => { if (doc) { console.log('Found '+doc.length + ' target users in current user DB.'); console.log('Will copy over '+usrCopyIDs.length + ' export users to current user DB.'); if (doc.length !== usrMapTargetIDs.length) { return reject ('Not all to-be patched target users found in current user DB: '+usrMapTargetIDs); } // Check#2: All copy-users MUST NOT exist! db.collection('users') .find({ _id : { $in : usrCopyIDs } }) .toArray() .then(shouldBeEmpty => { if (shouldBeEmpty && shouldBeEmpty.length > 0) { let errorUsers = shouldBeEmpty.map(usr => {return {_id: usr._id, username: usr.username};}); return reject (shouldBeEmpty.length+' to-be copied user(s) already exists:\n'+JSON.stringify(errorUsers)); } else { resolve({db, usrMap}); } }); } else { return reject ('Could not find users: ', usrMapTargetIDs); } }); }); } static doImport (db, msID, usrMap) { return new Promise((resolve, reject) => { const usrFile = msID + ExpImpUsers.FILENAME_POSTFIX; let allUsersDoc = undefined; try { allUsersDoc = EJSON.parse(fs.readFileSync(usrFile, 'utf8')); if (!allUsersDoc) { return reject('Could not read user file '+usrFile); } } catch (e) { return reject('Could not read user file '+usrFile+'\n'+e); } // We have some sequential DB inserts/updates from two cases now. // We chain them in a Promise chain. let promiseChain = []; for(let u=0; u<allUsersDoc.length; u++) { if (allUsersDoc[u]._id === usrMap[allUsersDoc[u]._id]) { // before/after ID are same in mapping file! let roleValueForMS = allUsersDoc[u].roles[msID]; // Case#1: clone this user from source DB => target DB! allUsersDoc[u].roles = {msID: roleValueForMS}; // Kill all other roles, just keep the one for this MS promiseChain.push( db.collection('users') .insert(allUsersDoc[u])); } else { promiseChain.push( // Case#2: only update user role for existing user in target DB db.collection('users') .findOne({'_id': usrMap[allUsersDoc[u]._id]}) // find the user in target DB .then(function (usr) { let roleValueForMS = allUsersDoc[u].roles[msID]; if (roleValueForMS && roleValueForMS.length > 0) { // user needs role for import meeting series? let roles = usr.roles ? usr.roles : {}; roles[msID] = roleValueForMS; return db.collection('users') // upsert role field .update({_id: usr._id}, {$set: {roles: roles}}); } })); } } // Now execute the chain. Promise.all(promiseChain) .then(function (res) { if (res && res[0] && res[0].result && !res[0].result.ok) { console.log('Promisechain result: ', res); } resolve(db); }) .catch(function (err) { reject(err); }); }); } } module.exports = ExpImpUsers;
/** * User: adoanhuu * Date: 03/05/11 */ $(document).ready(function() { $('#keywords').focus(function() { $('#keywords').val(''); }); $('#gallery img.thumbnail').click(function() { // Store main photo var photo = $('#gallery img.photo')[0].src; // Replace main photo by clicked thumbnail $('#gallery img.photo')[0].src = this.src.replace('/thumbnails', ''); // Replace clicked thumbnail by main photo this.src = photo.replace('/photos/', '/photos/thumbnails/'); }); });
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js (function(global) { global.ng = global.ng || {}; global.ng.common = global.ng.common || {}; global.ng.common.locales = global.ng.common.locales || {}; const u = undefined; function plural(n) { let i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; } root.ng.common.locales['sw-ke'] = [ 'sw-KE', [['am', 'pm'], ['AM', 'PM'], u], [['AM', 'PM'], u, u], [ ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], u, u ], u, [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Des'], [ 'Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba' ] ], u, [['KK', 'BK'], u, ['Kabla ya Kristo', 'Baada ya Kristo']], 0, [6, 0], ['dd/MM/y', 'd MMM y', 'd MMMM y', 'EEEE, d MMMM y'], ['HH:mm', 'HH:mm:ss', 'HH:mm:ss z', 'HH:mm:ss zzzz'], ['{1} {0}', u, u, u], ['.', ',', ';', '%', '+', '-', 'E', 'ร—', 'โ€ฐ', 'โˆž', 'NaN', ':'], ['#,##0.###', '#,##0%', 'ยคย #,##0.00', '#E0'], 'Ksh', 'Shilingi ya Kenya', {'JPY': ['JPยฅ', 'ยฅ'], 'KES': ['Ksh'], 'THB': ['เธฟ'], 'TWD': ['NT$'], 'TZS': ['TSh']}, plural, [ [ ['usiku', 'mchana', 'alfajiri', 'asubuhi', 'mchana', 'jioni', 'usiku'], ['saa sita za usiku', 'adhuhuri', 'alfajiri', 'asubuhi', 'mchana', 'jioni', 'usiku'], [ 'saa sita za usiku', 'saa sita za mchana', 'alfajiri', 'asubuhi', 'mchana', 'jioni', 'usiku' ] ], [ [ 'saa sita za usiku', 'saa sita za mchana', 'alfajiri', 'asubuhi', 'mchana', 'jioni', 'usiku' ], ['saa sita za usiku', 'adhuhuri', 'alfajiri', 'asubuhi', 'alasiri', 'jioni', 'usiku'], [ 'saa sita za usiku', 'saa sita za mchana', 'alfajiri', 'asubuhi', 'mchana', 'jioni', 'usiku' ] ], [ '00:00', '12:00', ['04:00', '07:00'], ['07:00', '12:00'], ['12:00', '16:00'], ['16:00', '19:00'], ['19:00', '04:00'] ] ] ]; })(typeof globalThis !== 'undefined' && globalThis || typeof global !== 'undefined' && global || typeof window !== 'undefined' && window);
define(["app/app", "adapters/ApplicationAdapter", "ember"], function(App, ApplicationAdapter, Ember) { // Adapter for sending data encoded as 'multipart/form-data' instead of JSON // (for submitting forms that contain files) App.FormDataAdapter = App.ApplicationAdapter.extend({ ajaxOptions: function(url, type, options) { var hash = options || {} hash.url = url hash.type = type hash.dataType = 'json' hash.context = this var fileName = hash.data.attachment.file.name if (hash.data && type !== 'GET' && type !== 'DELETE') { hash.processData = false hash.contentType = false var fd = new FormData() var root = Ember.keys(hash.data)[0] Ember.keys(hash.data[root]).forEach(function(key) { if (hash.data[root][key]) { fd.append(root + '[' + key + ']', hash.data[root][key]) } }) hash.data = fd } var headers = this.get('headers') if (headers !== undefined) { hash.beforeSend = function(xhr) { Ember.keys(headers).forEach(function(key) { xhr.setRequestHeader(key, headers[key]) }) } } hash.xhr = function() { var xhr = new window.XMLHttpRequest() // Upload progress xhr.upload.addEventListener('progress', function(event) { if (event.lengthComputable) { var percentComplete = Math.round(event.loaded / event.total * 100) Ember.$('.create-post .attachment, .edit-post .attachment').trigger({ type: 'upload-progress', fileName: fileName, percentComplete: percentComplete }) } }, false) return xhr } return hash } }) })
define(function (require, exports, module) { 'use strict'; var App = require('app'); // Create a new module. var Overview = App.module(); Overview.picturefill = require('picturefill'); // Models. Overview.Models = {}; Overview.Models.Index = Backbone.Model.extend({ defaults: { pageTitle: 'Overview', activeLink: 'overview' } }); Overview.Models.RecentWork = Backbone.Model.extend({ defaults: {} }); // Collections Overview.Collections = {}; Overview.Collections.Index = Backbone.Collection.extend({ model: Overview.Models.Index }); Overview.Collections.RecentWork = Backbone.Collection.extend({ model: Overview.Models.RecentWork, url: function () { return App.API + '/recent-work.json'; } }); // Views. Overview.Views.Content = Backbone.Layout.extend({ template: 'overview/index', afterRender: function () { Overview.picturefill(); } }); Overview.Views.Header = Backbone.View.extend({ //el: false, // tagName: 'header', // className: 'banner', // attributes: { // 'role': 'banner' // }, template: 'partials/header', afterRender: function () { App.components.navigation(this.$el); } }); Overview.Views.Footer = Backbone.View.extend({ template: 'partials/footer' }); Overview.Views.RecentWork = Backbone.View.extend({ el: false, template: 'recent_work/items', beforeRender: function () { this.collection.each(function (item) { // render row this.insertView('ul', new Overview.Views.RecentWork.Item({ model: item })); }, this); } }); Overview.Views.RecentWork.Item = Backbone.View.extend({ el: false, template: 'recent_work/item', serialize: function () { return _.clone(this.model.attributes); } }); // render layout Overview.init = function () { // get recent work data var recentProjectItems = new Overview.Collections.RecentWork(); recentProjectItems.fetch().then(function () { // Use the main layout. App.useLayout({template: 'layouts/twoColumn'}).setViews({ 'header': new Overview.Views.Header({model: new Overview.Models.Index()}), 'main': new Overview.Views.Content({model: new Overview.Models.Index()}), '#recentWork': new Overview.Views.RecentWork({collection: recentProjectItems}), 'footer': new Overview.Views.Footer({model: new Overview.Models.Index()}) }).render().promise().done(function () { }); }); }; module.exports = Overview; });
/* Tasks: $ gulp : Runs the "js" and "css" tasks. $ gulp js : Runs the "js" tasks. $ gulp css : Runs the "css" tasks. $ gulp watch : Starts a watch on the "js" and "css" tasks. */ const { parallel, series } = require('gulp'); const js = require('./gulp/js'); const css = require('./gulp/css'); /* $ gulp */ exports.default = (cb) => { parallel(js.all, css.all)(cb); }; /* $ gulp js */ exports.js = (cb) => { js.all(cb); }; /* $ gulp css */ exports.css = (cb) => { css.all(cb); }; /* $ gulp watch */ exports.watch = (cb) => { parallel(series(js.all, js.watch), series(css.all, css.watch))(cb); };
'use strict'; const swal = require('sweetalert'); const EditFilesCtrl = (app) => { app.controller('EditFilesCtrl', ['$window', '$scope', '$rootScope', 'Upload', 'editFilesRESTResource', ($window, $scope, $rootScope, Upload, resource) => { $scope.errors = []; $scope.files = []; $scope.filesToDelete = {}; const imageExtensions = [ '.tif', 'tiff', '.gif', 'jpeg', '.jpg', '.jif', '.jfif', '.jp2', '.jpx', '.j2k', '.j2c', '.fpx', '.pcd', '.png']; $scope.fileDisplayHeight = { 'height': 'auto' }; const FileResources = resource(); $scope.getAllFiles = () => { FileResources.getAllFiles( (err, data) => { if (err) { return $scope.errors.push({msg: 'could not retrieve files'}); } $scope.files.length = 0; for (let i = 0, len = data.length; i < len; i++) { let fileExtension = data[i].slice(-4).toLowerCase(); let isImage = true; if (imageExtensions.indexOf(fileExtension) === -1) { isImage = false; } $scope.files.push({fileName: data[i], fileLink: '/uploads/' + data[i], isImage: isImage}); } }) } $scope.deleteFiles = (files) => { let deleteCount = 0; let fileList = ''; for (let key in files) { if (files[key] === true) { deleteCount++; fileList += key + '\n'; } } swal({ title: 'Are you sure?', text: 'You will not be able to recover this file!', type: 'warning', showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: 'Yes, delete it!', closeOnConfirm: false, customClass: 'sweet-alert-hide-input' }, function(){ FileResources.deleteFiles (files, (err, data) => { if (err) { return $scope.errors.push({msg: 'could not delete files'}); } deleteCount = 0; fileList = ''; $scope.files.length = 0; $scope.getAllFiles(); }) swal({ title: 'Deleted!', text: 'Your imaginary file has been deleted.', type: 'success', customClass: 'sweet-alert-hide-input' }); }); /*let testQuestion = $window.confirm(`Are you sure you want to delete ${deleteCount} files?\n ${fileList}`); if (testQuestion) { } */ } }]); }; module.exports = EditFilesCtrl;
import { uuid } from './utils/index'; import { removeClasses, height, width, outerHeight } from './utils/css'; import { isString, isFunction } from './utils/type'; import EventEmitter from './utils/eventEmitter'; import Autoplay from './components/autoplay'; import Breakpoint from './components/breakpoint'; import Infinite from './components/infinite'; import Loop from './components/loop'; import Navigation from './components/navigation'; import Pagination from './components/pagination'; import Swipe from './components/swipe'; import Transitioner from './components/transitioner'; import defaultOptions from './defaultOptions'; import template from './templates'; import templateItem from './templates/item'; export default class bulmaCarousel extends EventEmitter { constructor(selector, options = {}) { super(); this.element = isString(selector) ? document.querySelector(selector) : selector; // An invalid selector or non-DOM node has been provided. if (!this.element) { throw new Error('An invalid selector or non-DOM node has been provided.'); } this._clickEvents = ['click', 'touch']; // Use Element dataset values to override options const elementConfig = this.element.dataset ? Object.keys(this.element.dataset) .filter(key => Object.keys(defaultOptions).includes(key)) .reduce((obj, key) => { return { ...obj, [key]: this.element.dataset[key] }; }, {}) : {}; // Set default options - dataset attributes are master this.options = { ...defaultOptions, ...options, ...elementConfig }; this._id = uuid('slider'); this.onShow = this.onShow.bind(this); // Initiate plugin this._init(); } /** * Initiate all DOM element containing datePicker class * @method * @return {Array} Array of all datePicker instances */ static attach(selector = '.slider', options = {}) { let instances = new Array(); const elements = isString(selector) ? document.querySelectorAll(selector) : Array.isArray(selector) ? selector : [selector]; [].forEach.call(elements, element => { if (typeof element[this.constructor.name] === 'undefined') { const instance = new bulmaCarousel(element, options); element[this.constructor.name] = instance; instances.push(instance); } else { instances.push(element[this.constructor.name]); } }); return instances; } /**************************************************** * * * PRIVATE FUNCTIONS * * * ****************************************************/ /** * Initiate plugin instance * @method _init * @return {Slider} Current plugin instance */ _init() { this._items = Array.from(this.element.children); // Load plugins this._breakpoint = new Breakpoint(this); this._autoplay = new Autoplay(this); this._navigation = new Navigation(this); this._pagination = new Pagination(this); this._infinite = new Infinite(this); this._loop = new Loop(this); this._swipe = new Swipe(this); this._build(); if (isFunction(this.options.onReady)) { this.options.onReady(this); } return this; } /** * Build Slider HTML component and append it to the DOM * @method _build */ _build() { // Generate HTML Fragment of template this.node = document.createRange().createContextualFragment(template(this.id)); // Save pointers to template parts this._ui = { wrapper: this.node.firstChild, container: this.node.querySelector('.slider-container') } // Add slider to DOM this.element.appendChild(this.node); this._ui.wrapper.classList.add('is-loading'); this._ui.container.style.opacity = 0; this._transitioner = new Transitioner(this); // Wrap all items by slide element this._slides = this._items.map((item, index) => { return this._createSlide(item, index); }); this.reset(); this._bindEvents(); this._ui.container.style.opacity = 1; this._ui.wrapper.classList.remove('is-loading'); } /** * Bind all events * @method _bindEvents * @return {void} */ _bindEvents() { this.on('show', this.onShow); } _unbindEvents() { this.off('show', this.onShow); } _createSlide(item, index) { const slide = document.createRange().createContextualFragment(templateItem()).firstChild; slide.dataset.sliderIndex = index; slide.appendChild(item); return slide; } /** * Calculate slider dimensions */ _setDimensions() { if (!this.options.vertical) { if (this.options.centerMode) { this._ui.wrapper.style.padding = '0px ' + this.options.centerPadding; } } else { this._ui.wrapper.style.height = outerHeight(this._slides[0]) * this.slidesToShow; if (this.options.centerMode) { this._ui.wrapper.style.padding = this.options.centerPadding + ' 0px'; } } this._wrapperWidth = width(this._ui.wrapper); this._wrapperHeight = outerHeight(this._ui.wrapper); if (!this.options.vertical) { this._slideWidth = Math.ceil(this._wrapperWidth / this.slidesToShow); this._containerWidth = Math.ceil(this._slideWidth * this._slides.length); this._ui.container.style.width = this._containerWidth + 'px'; } else { this._slideWidth = Math.ceil(this._wrapperWidth); this._containerHeight = Math.ceil((outerHeight(this._slides[0]) * this._slides.length)); this._ui.container.style.height = this._containerHeight + 'px'; } this._slides.forEach(slide => { slide.style.width = this._slideWidth + 'px'; }); } _setHeight() { if (this.options.effect !== 'translate') { this._ui.container.style.height = outerHeight(this._slides[this.state.index]) + 'px'; } } // Update slides classes _setClasses() { this._slides.forEach(slide => { removeClasses(slide, 'is-active is-current is-slide-previous is-slide-next'); if (Math.abs((this.state.index - 1) % this.state.length) === parseInt(slide.dataset.sliderIndex, 10)) { slide.classList.add('is-slide-previous'); } if (Math.abs(this.state.index % this.state.length) === parseInt(slide.dataset.sliderIndex, 10)) { slide.classList.add('is-current'); } if (Math.abs((this.state.index + 1) % this.state.length) === parseInt(slide.dataset.sliderIndex, 10)) { slide.classList.add('is-slide-next'); } }); } /**************************************************** * * * GETTERS and SETTERS * * * ****************************************************/ /** * Get id of current datePicker */ get id() { return this._id; } set index(index) { this._index = index; } get index() { return this._index; } set length(length) { this._length = length; } get length() { return this._length; } get slides() { return this._slides; } set slides(slides) { this._slides = slides; } get slidesToScroll() { return this.options.effect === 'translate' ? this._breakpoint.getSlidesToScroll() : 1; } get slidesToShow() { return this.options.effect === 'translate' ? this._breakpoint.getSlidesToShow() : 1; } get direction() { return (this.element.dir.toLowerCase() === 'rtl' || this.element.style.direction === 'rtl') ? 'rtl' : 'ltr'; } get wrapper() { return this._ui.wrapper; } get wrapperWidth() { return this._wrapperWidth || 0; } get container() { return this._ui.container; } get containerWidth() { return this._containerWidth || 0; } get slideWidth() { return this._slideWidth || 0; } get transitioner() { return this._transitioner; } /**************************************************** * * * EVENTS FUNCTIONS * * * ****************************************************/ onShow(e) { this._navigation.refresh(); this._pagination.refresh(); this._setClasses(); } /**************************************************** * * * PUBLIC FUNCTIONS * * * ****************************************************/ next() { if (!this.options.loop && !this.options.infinite && this.state.index + this.slidesToScroll > this.state.length - this.slidesToShow && !this.options.centerMode) { this.state.next = this.state.index; } else { this.state.next = this.state.index + this.slidesToScroll; } this.show(); } previous() { if (!this.options.loop && !this.options.infinite && this.state.index === 0) { this.state.next = this.state.index; } else { this.state.next = this.state.index - this.slidesToScroll; } this.show(); } start() { this._autoplay.start(); } pause() { this._autoplay.pause(); } stop() { this._autoplay.stop(); } show(index, force = false) { // If all slides are already visible then return if (!this.state.length || this.state.length <= this.slidesToShow) { return; } if (typeof index === 'Number') { this.state.next = index; } if (this.options.loop) { this._loop.apply(); } if (this.options.infinite) { this._infinite.apply(); } // If new slide is already the current one then return if (this.state.index === this.state.next) { return; } this.emit('before:show', this.state); this._transitioner.apply(force, this._setHeight.bind(this)); this.emit('after:show', this.state); this.emit('show', this); } reset() { this.state = { length: this._items.length, index: Math.abs(this.options.initialSlide), next: Math.abs(this.options.initialSlide), prev: undefined }; // Fix options if (this.options.loop && this.options.infinite) { this.options.loop = false; } if (this.options.slidesToScroll > this.options.slidesToShow) { this.options.slidesToScroll = this.slidesToShow; } this._breakpoint.init(); if (this.state.index >= this.state.length && this.state.index !== 0) { this.state.index = this.state.index - this.slidesToScroll; } if (this.state.length <= this.slidesToShow) { this.state.index = 0; } this._ui.wrapper.appendChild(this._navigation.init().render()); this._ui.wrapper.appendChild(this._pagination.init().render()); if (this.options.navigationSwipe) { this._swipe.bindEvents(); } else { this._swipe._bindEvents(); } this._breakpoint.apply(); // Move all created slides into slider this._slides.forEach(slide => this._ui.container.appendChild(slide)); this._transitioner.init().apply(true, this._setHeight.bind(this)); if (this.options.autoplay) { this._autoplay.init().start(); } } /** * Destroy Slider * @method destroy */ destroy() { this._unbindEvents(); this._items.forEach(item => { this.element.appendChild(item); }); this.node.remove(); } }
'use strict'; angular.module('myApp') .controller('edit-EntidadCtrl', ['$scope','$location','datosEntidad','Execute','$route','$window', function($scope,$location,datosEntidad,Execute,$route,$window){ var NombreActual; if ($route.current.params.idEntidad==0) { $scope.tiTulo = "Nueva Entidad"; $scope.buttonText ="Guardar"; } else { $scope.tiTulo = "Editar Entidad"; $scope.buttonText="Actualizar"; } datosEntidad.$promise.then(function(datos){ $scope.Datos = datos[0]; NombreActual = datos[0].ENT_NOMB; }); $scope.volver = function() { $location.path('/entidad'); } $scope.save = function(item) { var insertar = { Accion:"S", SQL:"SELECT ENT_NOMB FROM ESC_ENTI WHERE ENT_NOMB='" + item.ENT_NOMB + "'" } Execute.SQL(insertar).then(function(result) { if (result.data[0]!=null && NombreActual!=result.data[0].ENT_NOMB) { $window.alert('Ya existe el nombre'); } else { if (item.ENT_CODI ==undefined) { var datos ={ Accion:"I", SQL:"INSERT INTO ESC_ENTI (ENT_NOMB) VALUES ('" + item.ENT_NOMB + "')" } Execute.SQL(datos).then(function(result) { $window.alert('Ingresado'); $scope.Datos.ENT_NOMB=""; $('#idEntNomb').focus(); $location.path('/entidad'); }); } else { datos ={ Accion:"U", SQL:"UPDATE ESC_ENTI set ENT_NOMB='" + item.ENT_NOMB + "' WHERE ENT_CODI=" + item.ENT_CODI + "" } Execute.SQL(datos).then(function(result) { $window.alert('Actualizado'); $location.path('/entidad'); }); } } }); } }])
(function() { window.FrimFram = { isProduction: function() { return window.location.href.indexOf('localhost') === -1; }, wrapBackboneRequestCallbacks: function(options) { var originalOptions; if (options == null) { options = {}; } originalOptions = _.clone(options); options.success = function(model) { model.dataState = 'standby'; return typeof originalOptions.success === "function" ? originalOptions.success.apply(originalOptions, arguments) : void 0; }; options.error = function(model) { model.dataState = 'standby'; return typeof originalOptions.error === "function" ? originalOptions.error.apply(originalOptions, arguments) : void 0; }; options.complete = function(model) { model.dataState = 'standby'; return typeof originalOptions.complete === "function" ? originalOptions.complete.apply(originalOptions, arguments) : void 0; }; return options; } }; }).call(this); ;(function() { var BaseClass; BaseClass = (function() { function BaseClass() {} BaseClass.prototype.listenToShortcuts = function() { var func, ref, results, shortcut; if (!this.shortcuts) { return; } if (this.scope) { this.stopListeningToShortcuts(); } else { this.scope = _.uniqueId('class-scope-'); } ref = this.shortcuts; results = []; for (shortcut in ref) { func = ref[shortcut]; if (!_.isFunction(func)) { func = this[func]; } if (!func) { continue; } results.push(key(shortcut, this.scope, _.bind(func, this))); } return results; }; BaseClass.prototype.stopListeningToShortcuts = function() { return key.deleteScope(this.scope); }; BaseClass.prototype.destroy = function() { var key; this.off(); this.stopListeningToShortcuts(); for (key in this) { delete this[key]; } this.destroyed = true; return this.destroy = _.noop; }; return BaseClass; })(); _.extend(BaseClass.prototype, Backbone.Events); FrimFram.BaseClass = BaseClass; }).call(this); ;(function() { var View, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty, slice = [].slice; View = (function(superClass) { extend(View, superClass); View.prototype.template = ''; View.prototype.shortcuts = {}; View.globalContext = { 'moment': window.moment }; View.extendGlobalContext = function(globals) { return this.globalContext = _.extend(this.globalContext, globals); }; function View(options) { this.subviews = {}; this.listenToShortcuts(); View.__super__.constructor.apply(this, arguments); } View.prototype.render = function() { var id, ref, view; ref = this.subviews; for (id in ref) { view = ref[id]; view.destroy(); } this.subviews = {}; this.$el.html(this.getTemplateResult()); return this.onRender(); }; View.prototype.renderSelectors = function() { var elPair, i, j, len, newTemplate, results, selector, selectors; selectors = 1 <= arguments.length ? slice.call(arguments, 0) : []; newTemplate = $('<div>' + this.getTemplateResult() + '</div>'); results = []; for (i = j = 0, len = selectors.length; j < len; i = ++j) { selector = selectors[i]; results.push((function() { var k, len1, ref, results1; ref = _.zip(this.$el.find(selector), newTemplate.find(selector)); results1 = []; for (k = 0, len1 = ref.length; k < len1; k++) { elPair = ref[k]; results1.push($(elPair[0]).replaceWith($(elPair[1]))); } return results1; }).call(this)); } return results; }; View.prototype.getTemplateResult = function() { if (_.isString(this.template)) { return this.template; } else { return this.template(this.getContext()); } }; View.prototype.initContext = function(pickPredicate) { var context; context = {}; context.pathname = document.location.pathname; context = _.defaults(context, View.globalContext); if (pickPredicate) { context = _.extend(context, _.pick(this, pickPredicate, this)); } return context; }; View.prototype.getContext = function() { return this.initContext(); }; View.prototype.onRender = _.noop; View.prototype.onInsert = _.noop; View.prototype.listenToShortcuts = function(recurse) { var func, ref, ref1, results, shortcut, view, viewID; if (!this.shortcuts) { return; } if (this.scope) { this.stopListeningToShortcuts(); } else { this.scope = _.uniqueId('view-scope-'); } ref = this.shortcuts; for (shortcut in ref) { func = ref[shortcut]; if (!_.isFunction(func)) { func = this[func]; } if (!func) { continue; } key(shortcut, this.scope, _.bind(func, this)); } if (recurse) { ref1 = this.subviews; results = []; for (viewID in ref1) { view = ref1[viewID]; results.push(view.listenToShortcuts(true)); } return results; } }; View.prototype.stopListeningToShortcuts = function(recurse) { var ref, results, view, viewID; key.deleteScope(this.scope); if (recurse) { ref = this.subviews; results = []; for (viewID in ref) { view = ref[viewID]; results.push(view.stopListeningToShortcuts(true)); } return results; } }; View.prototype.insertSubview = function(view, elToReplace) { var key, oldSubview; if (elToReplace == null) { elToReplace = null; } key = this.makeSubviewKey(view); oldSubview = this.subviews[key]; if (elToReplace == null) { elToReplace = this.$el.find('#' + view.id); } if (!elToReplace.length) { throw new Error('Error inserting subview: do not have element for it to replace.'); } elToReplace.after(view.el).remove(); this.registerSubview(view, key); view.render(); view.onInsert(); if (oldSubview != null) { oldSubview.destroy(); } return view; }; View.prototype.registerSubview = function(view, key) { if (key == null) { key = this.makeSubviewKey(view); } this.subviews[key] = view; return view; }; View.prototype.makeSubviewKey = function(view) { var key; key = view.id || (_.uniqueId(view.constructor.name)); key = _.snakeCase(key); return key; }; View.prototype.removeSubview = function(view) { var key, newEl; view.$el.empty(); newEl = view.$el.clone(); view.$el.replaceWith(newEl); key = _.findKey(this.subviews, function(v) { return v === view; }); if (key) { delete this.subviews[key]; } return view.destroy(); }; View.prototype.getQueryParam = function(param) { return View.getQueryParam(param); }; View.getQueryParam = function(param) { var j, len, pair, pairs, query; query = this.getQueryString(); pairs = (function() { var j, len, ref, results; ref = query.split('&'); results = []; for (j = 0, len = ref.length; j < len; j++) { pair = ref[j]; results.push(pair.split('=')); } return results; })(); for (j = 0, len = pairs.length; j < len; j++) { pair = pairs[j]; if (pair[0] === param) { return decodeURIComponent(pair[1].replace(/\+/g, '%20')); } } }; View.getQueryString = function() { return document.location.search.substring(1); }; View.prototype.destroy = function() { var j, key, len, ref, value, view; this.remove(); this.stopListeningToShortcuts(); ref = _.values(this.subviews); for (j = 0, len = ref.length; j < len; j++) { view = ref[j]; view.destroy(); } for (key in this) { value = this[key]; delete this[key]; } this.destroyed = true; return this.destroy = _.noop; }; return View; })(Backbone.View); _.defaults(View.prototype, FrimFram.BaseClass.prototype); FrimFram.View = FrimFram.BaseView = View; }).call(this); ;(function() { var Application, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; Application = (function(superClass) { extend(Application, superClass); Application.extend = Backbone.Model.extend; function Application(options) { options = _.defaults({}, options, { watchForErrors: true, preventBackspace: true }); if (options.watchForErrors) { this.watchForErrors(); } if (options.preventBackspace) { $(document).bind('keydown', this.preventBackspace); } this.initialize.apply(this, arguments); } Application.prototype.initialize = _.noop; Application.prototype.start = function() { return Backbone.history.start({ pushState: true }); }; Application.prototype.watchForErrors = function() { return window.addEventListener("error", function(e) { var alert; if ($('body').find('.runtime-error-alert').length) { return; } alert = $(FrimFram.runtimeErrorTemplate({ errorMessage: e.error.message })); $('body').append(alert); alert.addClass('in'); return alert.alert(); }); }; Application.prototype.preventBackspace = function(event) { if (event.keyCode === 8 && !this.elementAcceptsKeystrokes(event.srcElement || event.target)) { return event.preventDefault(); } }; Application.prototype.elementAcceptsKeystrokes = function(el) { var ref, ref1, tag, textInputTypes, type; if (el == null) { el = document.activeElement; } tag = el.tagName.toLowerCase(); type = (ref = el.type) != null ? ref.toLowerCase() : void 0; textInputTypes = ['text', 'password', 'file', 'number', 'search', 'url', 'tel', 'email', 'date', 'month', 'week', 'time', 'datetimelocal']; return (tag === 'textarea' || (tag === 'input' && indexOf.call(textInputTypes, type) >= 0) || ((ref1 = el.contentEditable) === '' || ref1 === 'true')) && !(el.readOnly || el.disabled); }; return Application; })(FrimFram.BaseClass); FrimFram.Application = Application; }).call(this); ;(function() { var Collection, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Collection = (function(superClass) { extend(Collection, superClass); Collection.prototype.dataState = 'standby'; function Collection(models, options) { Collection.__super__.constructor.call(this, models, options); if (options != null ? options.defaultFetchData : void 0) { this.defaultFetchData = options.defaultFetchData; } } Collection.prototype.fetch = function(options) { this.dataState = 'fetching'; options = FrimFram.wrapBackboneRequestCallbacks(options); if (this.defaultFetchData) { if (options.data == null) { options.data = {}; } _.defaults(options.data, this.defaultFetchData); } return Collection.__super__.fetch.call(this, options); }; return Collection; })(Backbone.Collection); FrimFram.BaseCollection = FrimFram.Collection = Collection; }).call(this); ;(function() { var ModalView, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; ModalView = (function(superClass) { extend(ModalView, superClass); function ModalView() { return ModalView.__super__.constructor.apply(this, arguments); } ModalView.visibleModal = null; ModalView.prototype.className = 'modal fade'; ModalView.prototype.destroyOnHidden = true; ModalView.prototype.onRender = function() { var modal; ModalView.__super__.onRender.call(this); modal = this; this.$el.on('show.bs.modal', function() { return modal.trigger('show'); }); this.$el.on('shown.bs.modal', function() { modal.onInsert(); return modal.trigger('shown'); }); this.$el.on('hide.bs.modal', function() { return modal.trigger('hide'); }); this.$el.on('hidden.bs.modal', function() { return modal.onHidden(); }); return this.$el.on('loaded.bs.modal', function() { return modal.trigger('loaded'); }); }; ModalView.prototype.hide = function(fast) { if (fast) { this.$el.removeClass('fade'); } return this.$el.modal('hide'); }; ModalView.prototype.show = function(fast) { var ref; if ((ref = ModalView.visibleModal) != null) { ref.hide(true); } this.render(); if (fast) { this.$el.removeClass('fade'); } $('body').append(this.$el); this.$el.modal('show'); return ModalView.visibleModal = this; }; ModalView.prototype.toggle = function() { return this.$el.modal('toggle'); }; ModalView.prototype.onHidden = function() { if (ModalView.visibleModal === this) { ModalView.visibleModal = null; } this.trigger('hidden'); if (this.destroyOnHidden) { return this.destroy(); } }; return ModalView; })(FrimFram.View); FrimFram.ModalView = ModalView; }).call(this); ;(function() { var Model, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Model = (function(superClass) { extend(Model, superClass); function Model(attributes, options) { Model.__super__.constructor.call(this, attributes, options); this.on('add', this.onAdded, this); this.on('invalid', this.onInvalid, this); } Model.prototype.dataState = 'standby'; Model.prototype.created = function() { return new Date(parseInt(this.id.substring(0, 8), 16) * 1000); }; Model.prototype.onAdded = function() { return this.dataState = 'standby'; }; Model.prototype.schema = function() { var ref, s; s = this.constructor.schema; if (_.isString(s)) { return (ref = app.ajv.getSchema(s)) != null ? ref.schema : void 0; } else { return s; } }; Model.prototype.onInvalid = function() { var error, i, len, ref, results; console.debug("Validation failed for " + (this.constructor.className || this) + ": '" + (this.get('name') || this) + "'."); ref = this.validationError; results = []; for (i = 0, len = ref.length; i < len; i++) { error = ref[i]; results.push(console.debug("\t", error.dataPath, ':', error.message)); } return results; }; Model.prototype.set = function(attributes, options) { if ((this.dataState !== 'standby') && !(options.xhr || options.headers)) { throw new Error('Cannot set while fetching or saving.'); } return Model.__super__.set.call(this, attributes, options); }; Model.prototype.getValidationErrors = function() { var valid; valid = app.ajv.validate(this.constructor.schema || {}, this.attributes); if (!valid) { return app.ajv.errors; } }; Model.prototype.validate = function() { return this.getValidationErrors(); }; Model.prototype.save = function(attrs, options) { var result; options = FrimFram.wrapBackboneRequestCallbacks(options); result = Model.__super__.save.call(this, attrs, options); if (result) { this.dataState = 'saving'; } return result; }; Model.prototype.fetch = function(options) { options = FrimFram.wrapBackboneRequestCallbacks(options); this.dataState = 'fetching'; return Model.__super__.fetch.call(this, options); }; return Model; })(Backbone.Model); FrimFram.BaseModel = FrimFram.Model = Model; }).call(this); ;(function() { var RootView, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; RootView = (function(superClass) { extend(RootView, superClass); function RootView() { return RootView.__super__.constructor.apply(this, arguments); } RootView.prototype.onInsert = function() { var title; RootView.__super__.onInsert.apply(this, arguments); title = _.result(this, 'title') || _.result(RootView, 'globalTitle') || this.constructor.name; return $('title').text(title); }; RootView.prototype.title = _.noop; RootView.globalTitle = _.noop; RootView.prototype.onLeaveMessage = _.noop; return RootView; })(FrimFram.View); FrimFram.RootView = RootView; }).call(this); ;(function() { var Router, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Router = (function(superClass) { extend(Router, superClass); function Router() { return Router.__super__.constructor.apply(this, arguments); } Router.go = function(path) { return function() { return this.routeDirectly(path, arguments); }; }; Router.prototype.routeToServer = function() { return window.location.reload(true); }; Router.prototype.routeDirectly = function(path, args) { var ViewClass, error, error1, leavingMessage, ref, view; if ((ref = this.currentView) != null ? ref.reloadOnClose : void 0) { return document.location.reload(); } leavingMessage = _.result(this.currentView, 'onLeaveMessage'); if (leavingMessage) { if (!confirm(leavingMessage)) { return this.navigate(this.currentPath, { replace: true }); } } path = "views/" + path; try { ViewClass = require(path); } catch (error1) { error = error1; if (error.toString().search('Cannot find module "' + path + '" from') === -1) { throw error; } } if (ViewClass == null) { ViewClass = NotFoundView; } view = new ViewClass({ params: args }); return this.openView(view); }; Router.prototype.openView = function(view) { this.closeCurrentView(); view.render(); $('body').empty().append(view.el); this.currentView = view; this.currentPath = document.location.pathname + document.location.search; return view.onInsert(); }; Router.prototype.closeCurrentView = function() { var ref; return (ref = this.currentView) != null ? ref.destroy() : void 0; }; Router.prototype.setupOnLeaveSite = function() { return window.addEventListener("beforeunload", (function(_this) { return function(e) { var leavingMessage; leavingMessage = _.result(_this.currentView, 'onLeaveMessage'); if (leavingMessage) { e.returnValue = leavingMessage; return leavingMessage; } }; })(this)); }; return Router; })(Backbone.Router); FrimFram.Router = Router; }).call(this); ;(function() { FrimFram.onNetworkError = function() { var alert, jqxhr, r, ref, s; jqxhr = _.find(arguments, function(arg) { return (arg.promise != null) && (arg.getResponseHeader != null); }); r = jqxhr != null ? jqxhr.responseJSON : void 0; if ((jqxhr != null ? jqxhr.status : void 0) === 0) { s = 'Network failure'; } else if (((ref = arguments[2]) != null ? ref.textStatus : void 0) === 'parsererror') { s = 'Backbone parser error'; } else { s = (r != null ? r.message : void 0) || (r != null ? r.error : void 0) || 'Unknown error'; } if (r) { console.error('Response JSON:', JSON.stringify(r, null, '\t')); } else { console.error('Error arguments:', arguments); } alert = $(FrimFram.runtimeErrorTemplate({ errorMessage: s })); $('body').append(alert); alert.addClass('in'); return alert.alert(); }; FrimFram.runtimeErrorTemplate = _.template("<div class=\"runtime-error-alert alert alert-danger fade\">\n <button class=\"close\" type=\"button\" data-dismiss=\"alert\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n <span><%= errorMessage %></span>\n</div>"); }).call(this); ;(function() { FrimFram.storage = { prefix: '-storage-', load: function(key) { var SyntaxError, error, s, value; s = localStorage.getItem(this.prefix + key); if (!s) { return null; } try { value = JSON.parse(s); return value; } catch (error) { SyntaxError = error; console.warn('error loading from storage', key); return null; } }, save: function(key, value) { return localStorage.setItem(this.prefix + key, JSON.stringify(value)); }, remove: function(key) { return localStorage.removeItem(this.prefix + key); }, clear: function() { var key, results; results = []; for (key in localStorage) { if (key.indexOf(this.prefix) === 0) { results.push(localStorage.removeItem(key)); } else { results.push(void 0); } } return results; } }; }).call(this); ; //# sourceMappingURL=/javascripts/frimfram.js.map
var requireDir = require('require-dir'); requireDir('_tasks', { recurse: true });
var SpeedShifter; (function (SpeedShifter) { (function (Services) { 'use strict'; Services.CachePromiseProvider = function () { var serviceProvider = this, defOptions = {}, cacheStore = {}; this.$get = [ '$q', '$cacheFactory', function ($q, $cacheFactory) { var ngDefResolver = function (values, failed) { var def = $q.defer(); (!failed ? def.resolve : def.reject).apply(this, values); return def.promise; }, $DefResolver = function (values, failed) { var def = $.Deferred(); (!failed ? def.resolve : def.reject).apply(this, values); return def.promise(); }; return function (cacheId, options) { if (cacheStore[cacheId]) return cacheStore[cacheId]; var me = cacheStore[cacheId] = {}, opt, cache = $cacheFactory(cacheId, options); me.setOptions = function (_options) { opt = angular.extend({}, defOptions, _options); if (!opt.defResolver || !angular.isFunction(opt.defResolver)) { if (opt.JQPromise) opt.defResolver = $DefResolver; else opt.defResolver = ngDefResolver; } }; me.setOptions(options); me.get = function (key, timeout) { var cached = cache.get(key), now = (new Date()).getTime(); if (cached && cached.promise) { return cached.promise; } if (cached) { if ((!timeout || (now - cached.time < timeout)) && (!opt.timeout || (now - cached.time < opt.timeout))) { return opt.defResolver(cached.data, cached.failed); } else cache.remove(key); } return null; }; me.set = function (key, promise) { var cached_obj = { promise: promise }; var fnc = function () { var values = []; for (var _i = 0; _i < (arguments.length - 0); _i++) { values[_i] = arguments[_i + 0]; } cached_obj.data = values; cached_obj.time = (new Date()).getTime(); delete cached_obj.promise; if (opt.dontSaveResult || opt.timeout === 0) { cache.remove(key); } }, fail_fnc = opt.saveFail ? function () { var values = []; for (var _i = 0; _i < (arguments.length - 0); _i++) { values[_i] = arguments[_i + 0]; } cached_obj.failed = true; cached_obj.data = values; cached_obj.time = (new Date()).getTime(); delete cached_obj.promise; if (opt.dontSaveResult || opt.timeout === 0) { cache.remove(key); } } : function () { delete cached_obj.promise; cache.remove(key); }; promise.then(fnc, fail_fnc); cache.put(key, cached_obj); return promise; }; me.remove = function (key) { cache.remove(key); }; me.removeAll = function () { cache.removeAll(); }; return me; }; }]; serviceProvider.setOptions = function (options) { return defOptions = angular.extend({}, defOptions, options); }; }; var module = angular.module('speedshifter.cachePromise', []); module.provider('cachePromise', Services.CachePromiseProvider); })(SpeedShifter.Services || (SpeedShifter.Services = {})); var Services = SpeedShifter.Services; })(SpeedShifter || (SpeedShifter = {})); //# sourceMappingURL=angular-cache-promise.js.map
import React, {Component, PropTypes} from 'react'; import {reduxForm} from 'redux-form' import Dialog from 'material-ui/Dialog'; import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; export const fields = [ 'name', 'description' ]; const validate = values => { const errors = {}; if (!values.name) { errors.name = 'ะŸะพะปะต ะพะฑัะทะฐั‚ะตะปัŒะฝะพ ะดะปั ะทะฐะฟะพะปะฝะตะฝะธั'; } return errors }; class EditTask extends Component { constructor (props) { super(props); } submit () { // const {} = this.props; /*return new Promise((resolve, reject) => {// eslint-disable-line createTask(data, resolve, reject).done(() => { resetForm(); this.handleClose(); }).fail(() => { console.log('fail'); }); });*/ } render () { const { fields: { name, description }, handleSubmit, valid, open, handleClose } = this.props; return ( <Dialog title="ะกะพะทะดะฐั‚ัŒ ะทะฐะดะฐั‡ัƒ" modal={false} open={open} onRequestClose={handleClose}> <form onSubmit={handleSubmit(::this.submit)}> <TextField hintText="ะะพะฒะฐั ะทะฐะดะฐั‡ะฐ" fullWidth={true} errorText={name.touched && name.error && name.error} {...name} /> <TextField hintText="ะžะฟะธัะฐะฝะธะต" fullWidth={true} multiLine={true} errorText={description.touched && description.error && description.error} {...description} /> <RaisedButton label="ะžั‚ะผะตะฝะฐ" primary={true} onTouchTap={handleClose} />, <RaisedButton label="ะกะพะทะดะฐั‚ัŒ" primary={true} disabled={!valid} type="submit" keyboardFocused={true} /> </form> </Dialog> ); } } EditTask.propTypes = { fields: PropTypes.object.isRequired, handleSubmit: PropTypes.func.isRequired, error: PropTypes.string, resetForm: PropTypes.func.isRequired, submitting: PropTypes.bool.isRequired }; export default reduxForm({ form: 'NewTaskForm', fields, validate })(EditTask);
export default { demo: { index: { welcome: 'ๆฌข่ฟŽไฝฟ็”จTaurus Desktop้กน็›ฎๆจกๆฟ๏ผ', 'zh-CN': 'ไธญๆ–‡็ฎ€ไฝ“', 'en-US': '็พŽๅผ่‹ฑ่ฏญ', language: '่ฏญ่จ€', module: 'ๆจกๅ—็คบไพ‹', cloud: '็ ”ๅ‘ไบ‘ๅนณๅฐ็คบไพ‹', osp: '่ƒฝๅŠ›ๅผ€ๅ‘ๅนณๅฐ็คบไพ‹' }, cloud: { portal: {}, login: { name: '็”จๆˆทๅ', password: 'ๅฏ†็ ' } }, osp: { login: { input_username: '่ฏท่พ“ๅ…ฅ็”จๆˆทๅ', input_password: '่ฏท่พ“ๅ…ฅๅฏ†็ ', verify_code: '่ฏท่พ“ๅ…ฅ้ชŒ่ฏ็ ', forgot_password: 'ๅฟ˜่ฎฐๅฏ†็ ', stay_signed_in: '่ฎฐไฝๆˆ‘', login: '็™ปๅฝ•' }, portal: { access_app: 'ๆŽฅๅ…ฅๅบ”็”จ', quota: '้…้ข', root_certificates: 'ๆ น่ฏไนฆ', capability_query: '่ƒฝๅŠ›ๆŸฅ่ฏข', package_purchase: 'ๅฅ—้ค่ดญไนฐ', dev_manual: 'ๅผ€ๅ‘ๆ‰‹ๅ†Œ' }, operation1: 'ๆ“ไฝœ 1', operation2: 'ๆ“ไฝœ 2', online_apps: 'ๅœจ็บฟๅบ”็”จ', offline_apps: '็ฆป็บฟๅบ”็”จ', app_overview: 'ๅบ”็”จๆ€ป่งˆ', offline_tip1: 'ๆ‚จ็š„ๅบ”็”จ่ฟ˜ๆœชไธŠ็บฟ', offline_tip2: '็กฎไฟไปฅไธ‹ไฟกๆฏ้ƒฝๅกซๅ†™ๅฎŒๆ•ด๏ผŒๆ‚จ็š„ๅบ”็”จๆ‰ๅฏๆไบคไธŠ็บฟ็”ณ่ฏทใ€‚', offline_tip3: 'ๅฎŒๅ–„ๅŸบๆœฌไฟกๆฏ', offline_tip4: '็”ณ่ฏท่ฆ่ฐƒ็”จ็š„่ƒฝๅŠ›', offline_tip5: 'ๆŽฅๅฃๆฒ™็ฎฑ่ฐƒ่ฏ•', review: 'ๆญฃๅœจๅฎกๆ ธ', audited: 'ๅฎกๆ ธ้€š่ฟ‡', apply_online: '็”ณ่ฏทไธŠ็บฟ', basic_info: 'ๅŸบๆœฌไฟกๆฏ', more: '่Žทๅ–ๆ›ดๅคš', apply_for_access: '็”ณ่ฏทๆŽฅๅ…ฅๅบ”็”จ', access_platform: 'ๆŽฅๅ…ฅๅนณๅฐ', another: 'ๅ…ถไป–', app_name: 'ๅบ”็”จๅ็งฐ', app_catalog: 'ๅบ”็”จๅˆ†็ฑป', app_introduction: 'ๅบ”็”จ็ฎ€ไป‹', c: 'ๅˆ†็ฑป', c1: 'ๅˆ†็ฑปไธ€', c2: 'ๅˆ†็ฑปไบŒ', c3: 'ๅˆ†็ฑปไธ‰', input_something: '่ฏท่พ“ๅ…ฅ...', cancel: 'ๅ–ๆถˆ', ok: '็กฎๅฎš', code: '็ผ–็ ', integrated_office: '็ปผๅˆๅŠžๅ…ฌ', e_commerce: '็”ตๅ•†', entertainment: 'ๅจฑไน', platform: 'ๅนณๅฐ', status: '็Šถๆ€', create_time: 'ๅˆ›ๅปบๆ—ถ้—ด', callback_addr: 'ๅ›ž่ฐƒๅœฐๅ€', response_addr: 'ๅ“ๅบ”ๅœฐๅ€', signing_algorithms: '็ญพๅ็ฎ—ๆณ•', encryption_type: 'ๅŠ ๅฏ†็ฑปๅž‹', encryption_algorithm: 'ๅŠ ๅฏ†็ฎ—ๆณ•', custom_public_key: '่‡ชๅฎšไน‰ๅ…ฌๅŒ™', publick_key: 'ๅ…ฌๅŒ™', custom_key: '่‡ชๅฎšไน‰ๅฏ†ๅŒ™', key: 'ๅฏ†ๅŒ™', root_certificates_info: 'ๅบ”็”จๆ น่ฏไนฆๅœฐๅ€ไฟกๆฏ', cancel_modify: 'ๅ–ๆถˆไฟฎๆ”น', commit: 'ๆไบค', capabilities: '่ƒฝๅŠ›', application_capability_call: '็”ณ่ฏท่ƒฝๅŠ›่ฐƒ็”จ', app_log: 'ๅบ”็”จๆ—ฅๅฟ—', yes: 'ๆ˜ฏ', no: 'ๅฆ' } } }
// Generated by LiveScript 1.2.0 (function(){ var spec, ref$, forAll, sized, data, Int, compose, curry, partial, uncurry, uncurryBind, flip, wrap, id, x, slice$ = [].slice; spec = require('brofist')(); ref$ = require('claire'), forAll = ref$.forAll, sized = ref$.sized, data = ref$.data; Int = data.Int; ref$ = require('../../lib/higher-order'), compose = ref$.compose, curry = ref$.curry, partial = ref$.partial, uncurry = ref$.uncurry, uncurryBind = ref$.uncurryBind, flip = ref$.flip, wrap = ref$.wrap; id = require('../../lib/core').id; x = function(t){ return t.disable(); }; module.exports = spec('{} higher-order', function(it, spec){ spec('compose()', function(it){ var f, g, h; f = (function(it){ return it + 1; }); g = (function(it){ return it - 2; }); h = (function(it){ return it * 3; }); it('Given `f: a โ†’ b` and `g: b โ†’ c`, then `(g . f): a โ†’ c`', forAll(Int).satisfy(function(a){ return compose(g, f)(a) === g(f(a)); }).asTest()); it('associativity: `f . (g . h)` = `(f . g) . h`', forAll(Int).satisfy(function(a){ return compose(f, compose(g, h))(a) === compose(compose(f, g), h)(a); }).asTest()); it('left identity: `id . f` = f`', forAll(Int).satisfy(function(a){ return compose(id, f)(a) === f(a); }).asTest()); return it('right identity: `f . id` = f`', forAll(Int).satisfy(function(a){ return compose(f, id)(a) === f(a); }).asTest()); }); spec('curry()', function(it){ var add, sum; add = function(a, b){ return a + b; }; sum = function(){ var as; as = slice$.call(arguments); return as.reduce(curry$(function(x$, y$){ return x$ + y$; }), 0); }; it('Given `f: (a, b) โ†’ c`, a curried form should be `f: a โ†’ b โ†’ c`', forAll(Int, Int).satisfy(function(a, b){ return add(a, b) === curry(add)(a)(b); }).asTest()); it('Should allow specifying arity for variadic functions.', forAll(Int, Int, Int).satisfy(function(a, b, c){ return curry(3, sum)(a)(b)(c) === sum(a, b, c); }).asTest()); it('Should allow more than one argument applied at a time.', forAll(Int, Int, Int).satisfy(function(a, b, c){ var ref$; return curry(3, sum)(a, b)(c) === (ref$ = curry(3, sum)(a)(b, c)) && ref$ === sum(a, b, c); }).asTest()); return it('Should accept initial arguments as an array.', forAll(Int, Int, Int).satisfy(function(a, b, c){ return curry(3, sum, [a])(b)(c) === sum(a, b, c); }).asTest()); }); spec('partial()', function(it){ var add; add = function(a, b, c){ return a + b + (c || 0); }; return it('For a function `f: (a..., b...) โ†’ c`, should yield `f: (b...) โ†’ c`', forAll(Int, Int).satisfy(function(a, b){ return partial(add, 1)(2) === add(1, 2, 0); }).asTest()); }); spec('uncurry()', function(it){ var sum; sum = function(){ var as; as = slice$.call(arguments); return as.reduce(curry$(function(x$, y$){ return x$ + y$; }), 0); }; return it('Should convert an `f: (a... -> b)` into `f: [a] -> b`', forAll(Int, Int, Int).satisfy(function(a, b, c){ return uncurry(sum)([a, b, c]) === sum(a, b, c); }).asTest()); }); spec('uncurry-bind()', function(it){ var sum, usum; sum = function(){ var as; as = slice$.call(arguments); return as.reduce(curry$(function(x$, y$){ return x$ + y$; }), this.head); }; usum = uncurryBind(sum); return it('Should convert an `f: (a... -> b)` into `f: [this, a...] -> b`', forAll(Int, Int).satisfy(function(a, b){ return usum([ { head: 1 }, 2, 3 ]) === sum.call({ head: 1 }, 2, 3); }).asTest()); }); spec('flip()', function(it){ x(it('Should return a function of the same length.')); x(it('flip(f)(b)(a) = f(a, b).')); return x(it('flip(flip(f)(b))(a) = flip(a, b).')); }); return spec('wrap()', function(it){ var add, plus1; add = curry$(function(x$, y$){ return x$ + y$; }); plus1 = function(f, a){ return f(a, 1); }; return it('Should pass the wrapped function as first argument.', forAll(Int).satisfy(function(a){ return wrap(plus1, add)(a) === add(a, 1); }).asTest()); }); }); function curry$(f, bound){ var context, _curry = function(args) { return f.length > 1 ? function(){ var params = args ? args.concat() : []; context = bound ? context || this : this; return params.push.apply(params, arguments) < f.length && arguments.length ? _curry.call(context, params) : f.apply(context, params); } : f; }; return _curry(); } }).call(this);
var gulp = require('gulp'); var config = require('../config').images; gulp.task('images', function() { return gulp.src(config.src) .pipe(gulp.dest(config.dest)); });
๏ปฟ(function() { "use strict"; angular .module("editor") .run(configureAuth); configureAuth.$inject = ["authService", "$location", "$window"]; function configureAuth(authService, $location, $window) { // checks whether access token present if (!authService.getAccessToken()) { var params = authService.parseTokenFromUrl($location.path()); if (params.access_token) { // returning with access token, restore old hash, or at least hide token $location.path(params.state || "/"); authService.setAccessToken(params.access_token); } else { // no token - so bounce to Authorize endpoint in AccountController to sign in or register $window.location.href = "/account/authorize?client_id=web&response_type=token&state=" + encodeURIComponent($location.path()); } } } })();
/* * ๅบ—้“บ่ฏ„่ฎบใ€็‚น่ตž้กต้ข. **/ var app = getApp() var config = require('../../config.js') var util = require('../../utils/util.js') var appManager = require('../../apimanagers/appmanager.js') var shopManager = require('../../apimanagers/shopmanager.js') var commentManager = require('../../apimanagers/commentmanager.js') Page({ data:{ //ๆ€ปๅพ—ๅˆ†. totalScore: 0, totalScoreLabel: config.kCommentScoreLabels[0], //ๅ“่ดจๅพ—ๅˆ†. pinzhiScore: 0, pinzhiScoreLabel: config.kCommentScoreLabels[0], //้€Ÿๅบฆๅพ—ๅˆ†. suduScore: 0, suduScoreLabel: config.kCommentScoreLabels[0], //ๆ€ๅบฆๅพ—ๅˆ†. taiduScore: 0, taiduScoreLabel: config.kCommentScoreLabels[0], //่ฏ„่ฎบไฝ ็š„ๅ›พ็‰‡. images: [], //ๆ˜ฏๅฆๅฏไปฅๆทปๅŠ ๆ›ดๅคšๅ›พ็‰‡. canAddingMorePhotos: true, //่ฏ„่ฎบไฟกๆฏ. comment: '', //ๅฏ่พ“ๅ…ฅ็š„่ฏ„่ฎบๅญ—ๆ•ฐ. canInputCommentCount: config.kMaxCommentInputCount, //ๅปบ่ฎฎ. advice:'', //ๅฏ่พ“ๅ…ฅ็š„ๅปบ่ฎฎๆœ€ๅคงๅญ—ๆ•ฐ. canInputAdviceCount: config.kMaxCommentInputCount, //่ฏ„่ฎบ็š„ๆ ‡็ญพ. tags: [], //่ฏ„่ฎบๆ ‡็ญพๆ˜ฏๅฆๅฏ้€‰. tagEnable: true, //ๆ˜ฏๅฆๆ˜พ็คบๅ…จ้ƒจๆ ‡็ญพ. showAddingMoreTag: false, //่ฏ„่ฎบ็š„ๅบ—้“บไฟกๆฏ. shopInfo: null, //ๅฝ“ๅ‰็š„ๅŠ ่ฝฝ็Šถๆ€. pageState: 0, //ๅฝ“ๅ‰ๆ˜ฏๅฆๆปก่ถณๅ‘่กจ่ฏ„่ฎบ็š„ๆกไปถ. postingEnable: false, }, customerData: { //ๅ…จ้ƒจ็š„ๆ ‡็ญพ. tags: [], shopId: '', //่ฏ„่ฎบๆœๅŠก็š„id. serviceId: '', //ๅทฒไธŠไผ ็š„ๅ›พ็‰‡url. uploadedImageUrls: [], //ๅฝ“ๅ‰ๆ˜ฏๅฆๅค„ไบŽ็ฝ‘็ปœไบคไบ’็Šถๆ€. isInNetworking: false, }, onLoad:function(options){ // ็”Ÿๅ‘ฝๅ‘จๆœŸๅ‡ฝๆ•ฐ--็›‘ๅฌ้กต้ขๅŠ ่ฝฝ // ้œ€่ฆ็™ปๅฝ•ๆ‰่ƒฝ็‚น่ตž๏ผŒๅฆๅˆ™ๅ…ˆ็™ปๅฝ•. var that = this setTimeout(function() { if (app.globalData.loginSuccessed) { that.viewDidLoad(options) } else { app.login(function() { that.viewDidLoad(options) }) } }, 500) }, ///////////////////////////////////////////view events//////////////////////////////////////// clickOnPlacehoderView: function() { this.setData({ pageState: 0 }) $options = { shopId: this.customerData.shopId, category_id: this.customerData.serviceId } this.viewDidLoad($options) }, clickOnDeleteImageView: function(e) { var index = e.currentTarget.dataset.index var images = this.data.images if (images.length <= index) { return } util.arrayRemoteAt(images, index) this.setData({ images: images }) }, clickOnPhotoView: function(e) { var images = this.data.images var index = e.currentTarget.dataset.index if (images.length <= index) { return } wx.previewImage({ current: this.data.images[index], urls: this.data.images, }) }, clickOnAddingImageView: function() { var that = this wx.chooseImage({ count: config.kMaxCommentImageCount - this.data.images.count, // ๆœ€ๅคšๅฏไปฅ้€‰ๆ‹ฉ็š„ๅ›พ็‰‡ๅผ ๆ•ฐ๏ผŒ้ป˜่ฎค9 sizeType: ['compressed'], // original ๅŽŸๅ›พ๏ผŒcompressed ๅŽ‹็ผฉๅ›พ๏ผŒ้ป˜่ฎคไบŒ่€…้ƒฝๆœ‰ sourceType: ['album', 'camera'], // album ไปŽ็›ธๅ†Œ้€‰ๅ›พ๏ผŒcamera ไฝฟ็”จ็›ธๆœบ๏ผŒ้ป˜่ฎคไบŒ่€…้ƒฝๆœ‰ success: function(res){ // success if (!res.tempFilePaths || res.tempFilePaths.length == 0) { return } let images = that.data.images images = images.concat(res.tempFilePaths) that.setData({ images: images, canAddingMorePhotos: images.length < config.kMaxCommentImageCount }) }, }) }, clickOnCommentInputView: function() { this.setData({ adviceActive: false, commentActive: true }) }, clickOnAdviceInputView: function() { this.setData({ adviceActive: true, commentActive: false }) }, clickOnShowMoreTagsView: function() { //็‚นๅ‡ปๆ˜พ็คบๆ›ดๅคš็š„ๅฏ้€‰่ฏ„ไปท. var tags = this.data.tags var hideTags = this.customerData.tags.slice(config.kMaxCommentLimitShowedTagCount, this.customerData.length) tags = tags.concat(hideTags) this.setData({ tags: tags, showAddingMoreTag: false }) }, clickOnScoreView: function(e) { //็‚นๅ‡ปๅœจ็ปผๅˆ่ฏ„ๅˆ†ไธŠ let key = e.currentTarget.dataset.key if (!key) { return } switch(key) { case 'totalScore': { this.setData({ totalScoreLabel: config.kCommentScoreLabels[e.currentTarget.dataset.score], totalScore: e.currentTarget.dataset.score }) this.updatePostintViewEnable() break; } case 'pinzhiScore': { this.setData({ pinzhiScore: e.currentTarget.dataset.score, pinzhiScoreLabel: config.kCommentScoreLabels[e.currentTarget.dataset.score] }) break; } case 'suduScore': { this.setData({ suduScore: e.currentTarget.dataset.score, suduScoreLabel: config.kCommentScoreLabels[e.currentTarget.dataset.score] }) break; } case 'taiduScore': { this.setData({ taiduScore: e.currentTarget.dataset.score, taiduScoreLabel: config.kCommentScoreLabels[e.currentTarget.dataset.score] }) break; } default:{} } }, clickOnShopTagView: function(e) { var tags = this.data.tags var tag = tags[e.currentTarget.dataset.index] //ๅชๅฏไปฅ้€‰ๆ‹ฉๆœ€ๅคšไธ‰ไธชtag. if (!tag.isSelected&&!this.data.tagEnable) { wx.showToast({ title: 'ๆ ‡็ญพๆœ€ๅคšๅฏไปฅ้€‰ๆ‹ฉไธ‰ไธช.', icon: 'success', duration: 2000 }) return } if (tag.isSelected) { tag.isSelected = !tag.isSelected this.setData({ tags: tags, tagEnable: true }) this.updatePostintViewEnable() return } var selectedTagC = 0 for (let i = 0 ; i < tags.length; i++) { let tt = tags[i] if (tt.isSelected) { selectedTagC++; } if (selectedTagC==2) { break } } tag.isSelected = !tag.isSelected if (tag.isSelected) { selectedTagC++; } this.setData({ tags: tags, tagEnable: selectedTagC < config.kMaxCommentSelectedTagCount }) this.updatePostintViewEnable() }, onCommentAreatextChanged: function(e) { this.setData({ comment: e.detail.value, canInputCommentCount: config.kMaxCommentInputCount - e.detail.value.length }) }, onAdviceAreatextChanged: function(e) { this.setData({ advice: e.detail.value, canInputAdviceCount: config.kMaxCommentInputCount - e.detail.value.length }) }, clickOnPostingCommentView: function() { if (this.customerData.isInNetworking) { return } this.customerData.isInNetworking = true this.showLoadingView('ๅ‘ๅธƒไธญ, ่ฏท็จๅŽ...') this.uploadImages() }, ////////////////////////////////////////////private events/////////////////////////////////////// viewDidLoad: function(options) { this.customerData.shopId = options['shopId'] this.customerData.serviceId = options['category_id'] var that = this app.loadShopCommentTags(function(tags) { that.setData({ showAddingMoreTag: (tags.length > config.kMaxCommentLimitShowedTagCount), tags: tags.slice(0, tags.length > config.kMaxCommentLimitShowedTagCount ? config.kMaxCommentLimitShowedTagCount : tags.length) }) that.customerData.tags = tags }) shopManager.loadShopDetailWithParams({shopId: this.customerData.shopId, success: function(shopInfo) { that.setData({ pageState: 1, shopInfo: shopInfo }) }, fail: function() { that.setData({ pageState: 2 }) }}) }, updatePostintViewEnable: function() { var hasSelectedTag = false var tags = this.data.tags for (let i = 0; i < tags.length; i++) { let tag = tags[i] if (tag.isSelected) { hasSelectedTag = true break; } } this.setData({ postingEnable: hasSelectedTag && this.data.totalScore > 0 }) }, uploadImages: function() { //ๅทฒ็ปๅ…จ้ƒจไธŠไผ ๅฎŒ๏ผŒๅฏไปฅไธŠไผ ๅ…ทไฝ“็š„่ฏ„่ฎบๅ†…ๅฎน. if (this.data.images.length == 0 || this.customerData.uploadedImageUrls.length == this.data.images.length) { this.postShopComment() } else { var that = this var image = this.data.images[this.customerData.uploadedImageUrls.length] appManager.uploadImage({filePath: image, success: function(image) { that.customerData.uploadedImageUrls.push(image.url) that.uploadImages() }, fail: function(er) { that.customerData.uploadedImageUrls = [] that.showLoadingView(er || 'ไธŠไผ ๅ›พ็‰‡ๅ‘็”Ÿ้”™่ฏฏ๏ผŒ่ฏทๆฃ€ๆŸฅ็ฝ‘็ปœ...') setTimeout(function() { wx.hideToast() }, 2000) }}) } }, postShopComment: function() { var params = { attitude_score: this.data.taiduScore, category_id: this.customerData.serviceId, images: this.customerData.uploadedImageUrls, overall_score: this.data.totalScore, quality_score: this.data.pinzhiScore, speed_score: this.data.suduScore, tags: this.selectedTagsForPosting(), content: this.data.comment, suggestion: this.data.advice, id: this.customerData.shopId } var that = this commentManager.commentShopWithParams({shopId:this.customerData.shopId, params: params, success: function(res) { that.showLoadingView('ๅ‘ๅธƒๆˆๅŠŸ!') setTimeout(function() { that.gotoShopCommentDetailView(that.data.shopInfo, res) }, 2000) }, fail: function(){ that.showLoadingView('ๅ‘ๅธƒๅคฑ่ดฅ!') }, complete: function() { setTimeout(function(){ that.customerData.isInNetworking = false wx.hideToast() }, 2000) }}) }, selectedTagsForPosting: function() { var tags = this.data.tags var selectedTags = [] for (let i = 0; i < tags.length; i++) { let tempTag = tags[i] if (tempTag.isSelected) { selectedTags.push(tempTag.id) } if (selectedTags.length == 3) { break } } return selectedTags }, showLoadingView(msg) { wx.showToast({ title: msg, icon: 'loading', duration: 1000000 }) }, gotoShopCommentDetailView: function(shop, comment) { app.globalData.shop = shop app.globalData.shopComment = comment var url = '../shopcommentdetail/shopcommentdetail?shopId=' + shop.id + '&commentId=' + comment.id wx.redirectTo({ url: url }) } })
"use strict"; var devices_directives_1 = require("./devices-directives"); exports.IsDesktop = devices_directives_1.IsDesktop; exports.IsTablet = devices_directives_1.IsTablet; exports.IsMobile = devices_directives_1.IsMobile; exports.IsSmartTv = devices_directives_1.IsSmartTv; exports.ShowItDevice = devices_directives_1.ShowItDevice; exports.HideItDevice = devices_directives_1.HideItDevice; exports.IsIphone = devices_directives_1.IsIphone; exports.IsIpad = devices_directives_1.IsIpad; exports.IsAndroidMobile = devices_directives_1.IsAndroidMobile; exports.IsAndroidTablet = devices_directives_1.IsAndroidTablet; exports.IsWindowsPhone = devices_directives_1.IsWindowsPhone; exports.ShowItStandard = devices_directives_1.ShowItStandard; exports.HideItStandard = devices_directives_1.HideItStandard; exports.IsPortrait = devices_directives_1.IsPortrait; exports.IsLandscape = devices_directives_1.IsLandscape; exports.DeviceInfo = devices_directives_1.DeviceInfo; exports.DeviceStandardInfo = devices_directives_1.DeviceStandardInfo; exports.OrientationInfo = devices_directives_1.OrientationInfo; exports.DEVICES_DIRECTIVES = [ devices_directives_1.IsDesktop, devices_directives_1.IsTablet, devices_directives_1.IsMobile, devices_directives_1.IsSmartTv, devices_directives_1.ShowItDevice, devices_directives_1.HideItDevice, devices_directives_1.IsIphone, devices_directives_1.IsIpad, devices_directives_1.IsAndroidMobile, devices_directives_1.IsAndroidTablet, devices_directives_1.IsWindowsPhone, devices_directives_1.ShowItStandard, devices_directives_1.HideItStandard, devices_directives_1.IsPortrait, devices_directives_1.IsLandscape, devices_directives_1.DeviceInfo, devices_directives_1.DeviceStandardInfo, devices_directives_1.OrientationInfo ]; //# sourceMappingURL=index.js.map
"atomic component"; "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var PubSub = require("pubsub-js"); var BaseSceneController_1 = require("BaseSceneController"); var Constants_1 = require("Constants"); var AttributeSelectionSceneController = (function (_super) { __extends(AttributeSelectionSceneController, _super); function AttributeSelectionSceneController() { _super.apply(this, arguments); this.inspectorFields = { debug: false, scenePlay: "intro", sceneTitle: "title" }; } AttributeSelectionSceneController.prototype.sceneLoaded = function (message, data) { _super.prototype.sceneLoaded.call(this, message, data); PubSub.publish(Constants_1.BroadcastEvents.uiAttributeSelectionShow, {}); }; AttributeSelectionSceneController.prototype.sceneUnloaded = function (message, data) { PubSub.publish(Constants_1.BroadcastEvents.uiAttributeSelectionHide, {}); _super.prototype.sceneUnloaded.call(this, message, data); }; AttributeSelectionSceneController.prototype.doSceneAction = function (message, data) { _super.prototype.doSceneAction.call(this, message, data); switch (data.action) { case "show_playfield": this.switchScene(this.scenePlay); break; } }; return AttributeSelectionSceneController; }(BaseSceneController_1.default)); module.exports = AttributeSelectionSceneController;
var markdown = require('markdown-it'), gutil = require('gulp-util'), through = require('through2'); var md = markdown({html:true}) .use(require('markdown-it-container'), 'gengo') .use(require('markdown-it-container', 'table-reponsive')); module.exports = function () { return through.obj(function (file, encoding, callback) { if (file.isNull() || file.content === null) { callback(null, file); return; } if (file.isStream()) { callback(new gutil.PluginError('gulp-markdown-it', 'stream content is not supported')); return; } try { file.contents = new Buffer(md.render(file.contents.toString())); file.path = gutil.replaceExtension(file.path, '.html'); this.push(file); } catch (error) { callback(new gutil.PluginError('gulp-markdown-it', error, { fileName: file.path, showstack: true })); } callback(); }); };
/** * Module dependencies. */ var EventEmitter = require('events').EventEmitter; var _ = require('underscore')._; /** * Client. */ function Client(connParams) { this.connParams = connParams; this.connected = false; this.lastError = null; }; Client.prototype.__proto__ = EventEmitter.prototype; Client.prototype.connect = function() { var self = this; self.statements = require("./statements") var pg = require('pg'); self.client = new pg.Client(self.connParams); // if there are any problems w/ the pg client, record the error self.client.on('error', function(err){ self.lastError = err; return true; }); self.on('query', function(query, values, callback) { // if there were any errors with the pg client, surface them here then clear if(self.lastError !== null){ var error = self.lastError; self.lastError = null; callback(error,0); }else{ if (!_.isUndefined(values[0])) values = _.flatten(values); self.connected || self.doConnect(); self.client.query(query, values, callback); } }); } Client.prototype.disconnect = function() { if (this.client.queryQueue.length === 0) { this.client.end(); } else { this.client.on('drain', this.client.end.bind(this.client)); } } Client.prototype.doConnect = function() { this.client.connect(); return this.connected = true; } module.exports = Client;
'use strict'; /** * Main Controller */ angular.module('basic') .controller('MainCtrl', function () { this.awesomeThings = [ 'HTML5 Boilerplate', 'AngularJS', 'Karma' ]; });
var async = require('async'), landmark = require('landmark-serve'), async = require('async'), _ = require('underscore'); var Location = landmark.list('Location'), Tour = landmark.list('Tour'); /** * List Locations * /api/locations/list for GET */ exports.list = function(req, res) { Location.model.find().populate('tours').populate('architecturalStyle').exec(function(err, items) { if (err) return res.apiError('database error', err); res.apiResponse({ locations: items }); }); } /** * Get Location by ID * /api/locations/:location_id for GET */ exports.get = function(req, res) { Location.model.findById(req.params.id).populate('tours').populate('architecturalStyle').exec(function(err, item) { if (err) return res.apiError('database error', err); if (!item) return res.apiError('not found'); res.apiResponse({ location: item }); }); }
/** * Created by krakenboss on 2015-08-02. * * route to create new account. * */ var http = require('./API/protocol'); var express = require('express'); var app = express(); var account = require('../model/account'); var protocol = require('./API/protocol'); var mail = require('../bin/mail'); app.post('/', function (req, res) { if (req.body.password && req.body.username) { if (req.body.password.length >= 8 && req.body.username.length >= 5) { account.registered(req.body.username, function (result) { if (result) { res.sendStatus(http.conflict); } else { account.create(req.body.username, req.body.password, function (err, key) { mail.send(req.body.username, key, function (err) { if (err) { // rollback: remove the account, the email could not be sent. res.sendStatus(http.illegal); account.remove(req.body.username, function() {}); } else { res.sendStatus(http.success); } }); }); } }); } else res.sendStatus(http.unaccepted); } else res.sendStatus(http.unaccepted); }); app.get('/verify', function (req, res) { token = req.query.token; if (token) { account.verify(token, function (err, result) { if (result.verification) { res.render('registered.jade', {activation: result.verification, username: result.name}); } else res.render('registered.jade', {activation: result.verification}); }); } else res.sendStatus(protocol.error); }); module.exports = app;
/** * Created by JChhabda on 6/2/2016. */ var oViewDataClient =null ; $(document).ready (function () { oViewDataClient =new Autodesk.ADN.Toolkit.ViewData.AdnViewDataClient ( 'https://developer.api.autodesk.com', 'https://whiting-turner-auth.herokuapp.com/auth' ) ; $('#btnTranslateThisOne').click (function (evt) { var files =document.getElementById('files').files ; if ( files.length == 0 ) return ; var bucket = 'model' + new Date ().toISOString ().replace (/T/, '-').replace (/:+/g, '-').replace (/\..+/, '') + '-' + 'R57eWPf8zHOoszCfbSaIjwsY87GW1SaZ'.toLowerCase ().replace (/\W+/g, '') ; createBucket (bucket, files) }) ; $('#btnAddThisOne').click (function (evt) { var urn =$('#urn').val ().trim () ; if ( urn == '' ) return ; AddThisOne (urn) ; }) ; }) ; function AddThisOne (urn) { var id =urn.replace (/=+/g, '') ; $('#list').append ('<div class="list-group-item row">' + '<button id="' + id + '" type="text" class="form-control">' + urn + '</button>' + '</div>' ) ; $('#' + id).click (function (evt) { window.open ('/?urn=' + $(this).text (), '_blank') ; }) ; } function createBucket (bucket, files) { var bucketData ={ bucketKey: bucket, servicesAllowed: {}, policy: 'temporary' } ; oViewDataClient.createBucketAsync ( bucketData, //onSuccess function (response) { console.log ('Bucket creation successful:') ; console.log (response) ; $('#msg').text ('Bucket creation successful') ; uploadFiles (response.key, files) ; }, //onError function (error) { console.log ('Bucket creation failed:'); console.log (error) ; $('#msg').text ('Bucket creation failed!') ; } ) ; } function uploadFiles (bucket, files) { for ( var i =0 ; i < files.length ; i++ ) { var file =files [i] ; //var filename =file.replace (/^.*[\\\/]/, '') ; console.log ('Uploading file: ' + file.name + ' ...') ; $('#msg').text ('Uploading file: ' + file.name + ' ...') ; oViewDataClient.uploadFileAsync ( file, bucket, file.name, //onSuccess function (response) { console.log ('File was uploaded successfully:') ; console.log (response) ; $('#msg').text ('File was uploaded successfully') ; var fileId =response.objects [0].id ; var registerResponse =oViewDataClient.register (fileId) ; if ( registerResponse.Result === "Success" || registerResponse.Result === "Created" ) { console.log ("Registration result: " + registerResponse.Result) ; console.log ('Starting translation: ' + fileId) ; $('#msg').text ('Your model was uploaded successfully. Translation starting...') ; checkTranslationStatus ( fileId, 1000 * 60 * 10, // 10 mins timeout //onSuccess function (viewable) { console.log ("Translation was successful: " + response.file.name) ; console.log ("Viewable: ") ; console.log (viewable) ; $('#msg').text ('Translation was successful: ' + response.file.name + '.') ; //var fileId =oViewDataClient.fromBase64 (viewable.urn) ; AddThisOne (viewable.urn) ; } ) ; } }, //onError function (error) { console.log ('File upload failed:') ; console.log (error) ; $('#msg').text ('File upload failed!') ; } ) ; } } function checkTranslationStatus (fileId, timeout, onSuccess) { var startTime =new Date ().getTime () ; var timer =setInterval (function () { var dt =(new Date ().getTime () - startTime) / timeout ; if ( dt >= 1.0 ) { clearInterval (timer) ; } else { oViewDataClient.getViewableAsync ( fileId, function (response) { var msg ='Translation Progress ' + fileId + ': ' + response.progress ; console.log (msg) ; $('#msg').text (msg) ; if ( response.progress === 'complete' ) { clearInterval (timer) ; onSuccess (response) ; } }, function (error) { } ) ; } }, 2000 ) ; }/** * Created by JChhabda on 6/3/2016. */
import Component from '@ember/component'; import layout from '../../../templates/components/bootstrap/simple-form/-controls'; export default Component.extend({ tagName: '', layout, });
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), errorHandler = require('./errors'), Article = mongoose.model('Article'), _ = require('lodash'); /** * Create a article */ exports.create = function(req, res) { var article = new Article(req.body); article.user = req.user; console.log(article); article.save(function(err) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(article); } }); }; /** * Show the current article */ exports.read = function(req, res) { res.jsonp(req.article); }; /** * Update a article */ exports.update = function(req, res) { var article = req.article; article = _.extend(article, req.body); article.save(function(err) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(article); } }); }; /** * Delete an article */ exports.delete = function(req, res) { var article = req.article; article.remove(function(err) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(article); } }); }; /** * List of Articles */ exports.list = function(req, res) { Article.find().sort('-created').populate('user', 'displayName').exec(function(err, articles) { if (err) { return res.status(400).send({ message: errorHandler.getErrorMessage(err) }); } else { res.jsonp(articles); } }); }; /** * Article middleware */ exports.articleByID = function(req, res, next, id) { Article.findById(id).populate('user', 'displayName').exec(function(err, article) { if (err) return next(err); if (!article) return next(new Error('Failed to load article ' + id)); req.article = article; next(); }); }; /** * Article authorization middleware */ exports.hasAuthorization = function(req, res, next) { if (req.article.user.id !== req.user.id) { return res.status(403).send({ message: 'User is not authorized' }); } next(); };
$('#post_register').on('click', e => { const username = $('#reg_username').val() const password = $('#reg_password').val() $.ajax({ url:'/u/register', type: 'post', data: { username: username, password: password }, success: result => { console.log(result) }, error: err => { console.log(err) } }) })
export { default } from 'ember-bootstrap-controls/components/freestyle-prop-types/-one-of';
import graphqlite from 'graphqlite' import _ from 'lodash' import Mapper from './mapper' import Node from './node' export default class App { static Node = Node mappers = [] // Process GraphQL and return response async process(query, request, resolver) { if (!resolver) throw 'No resolver callback provided' let shape = graphqlite.parse(query) let response = {} // wait for all definitions to be resolved and mapped await Promise.all(shape.map(async def => { // call resolver let result = await resolver(def) if (_.isArray(result)) throw 'Cannot return array at root' // run the mapper let mapper = new Mapper(this, request) await mapper.map(result, def) // merge mapper result into the final response _.merge(response, mapper.result) })) // return response return response } // Add mapper callback mapper(callback) { this.mappers.push(callback) } }
(function(ko){ // Wrap ko.observable and ko.observableArray var methods = ['observable', 'observableArray']; try { ko.utils.arrayForEach(methods, function(method){ var saved = ko[method]; ko[method] = function(initialValue, options){ options = options || {}; var key = options.persist; // Load existing value if set if(key && localStorage.hasOwnProperty(key)){ try{ initialValue = JSON.parse(localStorage.getItem(key)) }catch(e){}; } // Create observable from saved method var observable = saved(initialValue); // Subscribe to changes, and save to localStorage if(key){ observable.subscribe(function(newValue){ localStorage.setItem(key, ko.toJSON(newValue)); }); }; return observable; } }) } catch() {} })(ko);
/*jslint devel:true, browser:true */ /*global $, d3, google */ var DrawD3GoogleMapsGeoJSONChart = {}; DrawD3GoogleMapsGeoJSONChart.init = function (targetElement, mapElement, dataset, geojson) { 'use strict'; var map, max, styleFeature, data, dataSettlement, dataValue, i, j, jsonSettlement; data = dataset.data; map = new google.maps.Map($(mapElement)[0], { zoom: 9, center: {lat: 41.0121782, lng: 140.6787885} }); max = d3.max(data, function (d) { return d.value; }); //ใƒใƒชใ‚ดใƒณใƒ‡ใƒผใ‚ฟใฎใ‚นใ‚ฟใ‚คใƒซใ‚’ๆŒ‡ๅฎš styleFeature = function (max) { //ใ‚ซใƒฉใƒผใ‚นใ‚ฑใƒผใƒซใ‚’ๆŒ‡ๅฎš var colorScale = d3.scale.quantize() .range(['rgb(255,255,229)', 'rgb(247,252,185)', 'rgb(217,240,163)', 'rgb(173,221,142)', 'rgb(120,198,121)', 'rgb(65,171,93)', 'rgb(35,132,67)', 'rgb(0,104,55)', 'rgb(0,69,41)']) .domain([0, max]); return function (feature) { return { strokeWeight: 1, strokeColor: 'gray', strokeOpcity: 0.4, zIndex: 4, fillColor: colorScale(feature.getProperty('value')), fillOpacity: 0.75, visible: true }; }; }; i = 0; while (i < data.length) { dataSettlement = data[i].municipality; dataValue = parseFloat(data[i].value); j = 0; while (j < geojson.features.length) { jsonSettlement = geojson.features[j].properties.N03_004; jsonSettlement = jsonSettlement.replace("ๅ…ญใ‚ฑๆ‰€ๆ‘", "ๅ…ญใƒถๆ‰€ๆ‘"); if (dataSettlement === jsonSettlement) { geojson.features[j].properties.value = dataValue; } j += 1; } i += 1; } map.data.addGeoJson(geojson); map.data.setStyle(styleFeature(max)); };
$(document).foundation(); // BLOG ICON $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 110) { $("#blog-icon").addClass("locked"); } else { $("#blog-icon ").removeClass("locked"); } }); // SOCIAL BUBBLE OPEN/CLOSE $('#twitter').click(function () { if (!$("#tweet-button").hasClass('visible')) { $("#tweet-button").addClass('visible'); $("#twitter").addClass("active"); $('#tweet-button').fadeIn(200); } else { $('#tweet-button').fadeOut(200); $("#twitter").removeClass("active") setTimeout (function() { $("#tweet-button").removeClass('visible'); }, 200); } }); $('#twitter').mouseleave(function() { if ($("#tweet-button").hasClass('visible')) { $('#tweet-button').fadeOut(200); $("#twitter").removeClass("active") setTimeout (function() { $("#tweet-button").removeClass('visible'); }, 200); } }); $('#gplus').click(function () { if (!$("#gplus-button").hasClass('visible')) { $("#gplus-button").addClass('visible'); $("#gplus").addClass("active"); $('#gplus-button').fadeIn(200); } else { $('#gplus-button').fadeOut(200); $("#gplus").removeClass("active") setTimeout (function() { $("#gplus-button").removeClass('visible'); }, 200); } }); $('#gplus').mouseleave(function() { if ($("#gplus-button").hasClass('visible')) { $('#gplus-button').fadeOut(200); $("#gplus").removeClass("active") setTimeout (function() { $("#gplus-button").removeClass('visible'); }, 200); } }); $('#hacker').click(function () { if (!$("#hnews-button").hasClass('visible')) { $("#hnews-button").addClass('visible'); $("#hacker").addClass("active"); $('#hnews-button').fadeIn(200); } else { $('#hnews-button').fadeOut(200); $("#hacker").removeClass("active") setTimeout (function() { $("#hnews-button").removeClass('visible'); }, 200); } }); $('#hacker').mouseleave(function() { if ($("#hnews-button").hasClass('visible')) { $('#hnews-button').fadeOut(200); $("#hacker").removeClass("active") setTimeout (function() { $("#hnews-button").removeClass('visible'); }, 200); } }); jQuery.sharedCount = function(url, fn) { url = encodeURIComponent(url || location.href); var domain = "//free.sharedcount.com/"; var apikey = "02932b7bba7fd2509fdb0bd669f24fda047d9201" var arg = { data: { url : url, apikey : apikey }, url: domain, cache: true, dataType: "json" }; if ('withCredentials' in new XMLHttpRequest) { arg.success = fn; } else { var cb = "sc_" + url.replace(/\W/g, ''); window[cb] = fn; arg.jsonpCallback = cb; arg.dataType += "p"; } return jQuery.ajax(arg); }; jQuery(document).ready(function($){ $.sharedCount(location.href, function(data){ $("#twitter>a>.count.num").html(data.Twitter); $("#gplusr>a>.count.num").html(data.GooglePlusOne); $("#sharedcount").fadeIn(); }); }); ////////////////////// SMOOTH SCROLL //////////////////////// $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 800); return false; } } }); }); var disqus_shortname = 'pagoda-blog'; /* * * DON'T EDIT BELOW THIS LINE * * */ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }());
import { connect } from 'react-redux'; import { push } from 'react-router-redux'; import ExerciseSelectType from './ExerciseSelectType'; import { setEditedExerciseType } from '../../exercises/Actions'; /* eslint no-console: 0 */ const mapStateToProps = state => ({ exercises: state.exerciseTypes.list, }); const mapDispatchToProps = dispatch => ({ setEditedExerciseType: item => dispatch(setEditedExerciseType(item)), goToExercise: () => dispatch(push('/add/exercise')), }); const RExerciseSelectType = connect( mapStateToProps, mapDispatchToProps, )(ExerciseSelectType); export default RExerciseSelectType;
'use strict' const Pair = require('./pair') class TextEditor { constructor () { this.inputStack = [] this.string = '' } createOperation (op, word) { return new Pair(op, word) } append (input) { if (typeof input === 'string' || input instanceof String) { this.inputStack.push(this.createOperation(1, input)) this.string += input } else { console.log(`Invalid input type. Type of ${input} is not of type string...`) process.exit(1) } } delete (k) { if (Number.isInteger(k)) { const suffix = this.string.slice(-k) this.string = this.string.substr(0, this.string.length - k) this.inputStack.push(this.createOperation(2, suffix)) } else { console.log(`Tried to delete a non integer value: ${k}`) process.exit(1) } } print (k) { if (Number.isInteger(k)) { const output = this.string.slice(0, k) console.log(output) return output } else { console.log(`Tried to print a non integer amount of chars: ${k}`) process.exit(1) } } undo () { if (this.inputStack.length === 0) { return '' } const pair = this.inputStack.pop() if (pair.operation === 1) { const wordLen = pair.text.length return this.delete(wordLen) } else if (pair.operation === 2) { return this.append(pair.text) } } } module.exports = TextEditor
/** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: config.language = 'es'; // config.uiColor = '#AADC6E'; //config.removeButtons = 'Underline,Subscript,Superscript,Strike'; //config.removePlugins = 'elementspath,enterkey,entities,forms,pastefromword,htmldataprocessor,specialchar,horizontalrule,wsc' ; //config.toolbar = 'Basic'; config.toolbar = [ ['Styles','Format','Font','FontSize'], '/', ['Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'], '/', ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Image','Table','-','Link','TextColor','BGColor'] ] ; };
import React from 'react'; import classNames from 'classnames'; import PropTypes from 'prop-types'; import MuiPaper from '@material-ui/core/Paper'; import { capitalize } from '@material-ui/core/utils/helpers'; import { withStyles } from '@material-ui/core/styles'; const styles = theme => ({ backgroundLight: { backgroundColor: theme.palette.secondary.light, }, backgroundMain: { backgroundColor: theme.palette.secondary.main, }, backgroundDark: { backgroundColor: theme.palette.secondary.dark, }, padding: { padding: theme.spacing.unit, }, }); function Paper(props) { const { background, classes, className, padding, ...other } = props; return ( <MuiPaper elevation={0} square className={classNames( classes[`background${capitalize(background)}`], { [classes.padding]: padding, }, className, )} {...other} /> ); } Paper.propTypes = { background: PropTypes.oneOf(['light', 'main', 'dark']), classes: PropTypes.object.isRequired, className: PropTypes.string, padding: PropTypes.bool, }; Paper.defaultProps = { background: 'light', padding: false, }; export default withStyles(styles)(Paper);
function decodeFusionJuncSpan(tokens, header) { /* Format: 0 #scaffold 1 fusion_break_name 2 break_left 3 break_right 4 num_junction_reads 5 num_spanning_frags 6 spanning_frag_coords 0 B3GNT1--NPSR1 1 B3GNT1--NPSR1|2203-10182 2 2203 3 10182 4 189 5 1138 6 1860-13757,1798-13819,1391-18127,1443-17174,... */ if (tokens.length < 7) return undefined var chr = tokens[0] var fusion_name = tokens[1] var junction_left = parseInt(tokens[2]) var junction_right = parseInt(tokens[3]) var num_junction_reads = parseInt(tokens[4]) var num_spanning_frags = parseInt(tokens[5]) var spanning_frag_coords_text = tokens[6] var feature = { chr: chr, name: fusion_name, junction_left: junction_left, junction_right: junction_right, num_junction_reads: num_junction_reads, num_spanning_frags: num_spanning_frags, spanning_frag_coords: [], start: -1, end: -1 } // set start and end later based on min/max of span coords var min_coord = junction_left var max_coord = junction_right if (num_spanning_frags > 0) { var coord_pairs = spanning_frag_coords_text.split(',') for (var i = 0; i < coord_pairs.length; i++) { var split_coords = coord_pairs[i].split('-') var span_left = split_coords[0] var span_right = split_coords[1] if (span_left < min_coord) { min_coord = span_left } if (span_right > max_coord) { max_coord = span_right } feature.spanning_frag_coords.push({left: span_left, right: span_right}) } } feature.start = min_coord feature.end = max_coord return feature } export {decodeFusionJuncSpan}
var myapp = angular.module('app', [ 'angucomplete-alt', 'generalFilters' ]); function answerController($scope, $http) { // Variabelen var self = this; $scope.reverse = false; $scope.selectedAnswer = {}; $scope.order = 'text'; $scope.answers = {}; $scope.questions = {}; $scope.curPage = 0; $scope.pageSize = 10; $scope.lang = window.language.answers; // Initialisatie functie self.init = function() { self.getList(); }; // Haal lijsten op self.getList = function() { self.getAnswers(); self.getQuestions(); }; // Haal alle vragen op. self.getQuestions = function() { $http.get('api/questions') .success(function(data) { $scope.questions = data; }) .error(function() { $scope.questions = {}; }); }; // Haal alle antwoorden op. self.getAnswers = function() { $http.get('api/answers') .success(function(data) { $scope.answers = data; }) .error(function() { $scope.answers = {}; }); }; // Haal totaal aantal pagina's pagination op. $scope.numberOfPages = function() { if($scope.curPage>(Math.ceil($scope.filtered.length / $scope.pageSize))){ $scope.curPage = (Math.ceil($scope.filtered.length / $scope.pageSize))-1; } return Math.ceil($scope.filtered.length / $scope.pageSize); }; // Functie om vraag aan geselecteerd antwoord toe te voegen. $scope.addQuestion = function(question) { var alreadyInThere = $.Enumerable.From($scope.selectedAnswer.questions) .Any(function (item) { return item.id == question.id}); if (question.id < 1 || !alreadyInThere) { $scope.selectedAnswer.questions.push(question); } }; // Functie om een nieuwe vraag toe te voegen. $scope.addNewQuestion = function (text) { if (text.length > 0) { var question = { id: 0, text: text }; $http({ method: 'POST', url: '/api/questions', data: question, headers: { 'Content-type': 'application/json', 'Accept': 'application/json' } }) .success(function(data) { question.id = data.id; $scope.addQuestion(question); }) .error(function(data) { }); } }; // Functie om een vraag te verwijderen bij een antwoord. $scope.removeQuestion = function (id) { //Delete answer for question here var oldList = $scope.selectedAnswer.questions; $scope.selectedAnswer.questions = []; angular.forEach(oldList, function(question) { if (question.id != id) { $scope.selectedAnswer.questions.push(question); } }); }; // Functie om een antwoord bij te werken. $scope.saveAnswer = function(answer) { var url; var method; if (answer.id == 0) { url = '/api/answers'; method = 'POST'; } else { url = '/api/answers/' + answer.id; method = 'PUT'; } $http({ method: method, url: url, data: answer, headers: { 'Content-type': 'application/json', 'Accept': 'application/json' } }) .success(function(data) { answer.id = data.id; self.getList(); $scope.closeEditAnswerModal(); }) .error(function(data) { }); }; // Functie om een nieuwe antwoord met vragen toe te voegen. $scope.saveNewAnswer = function(vraag, antwoord) { $scope.closeEditAnswerModal(); self.getList(); }; // Functie om een antwoord te verwijderen. $scope.deleteAnswer = function(id) { $scope.closeDeleteAnswerModal(); $http.delete('/api/answers/'+id).success(function(){ self.getList(); }); }; // Functie om het modal te maken bij het wijzigen. $scope.openEditAnswerModal = function (id) { $scope.$broadcast('angucomplete-alt:clearInput'); if (id < 1) { $scope.selectedAnswer = { id: 0, text: "", "questions": [] } } else { $http.get('/api/answers/'+id). success(function(data) { $scope.selectedAnswer = data; }). error(function() { $scope.selectedAnswer = {}; }); } $('#editAnswerModal').modal('show'); }; // Functie om antwoord wijzigen scherm af te sluiten. $scope.closeEditAnswerModal = function() { $('#editAnswerModal').modal('hide'); $scope.selectedAnswer = {}; }; // Functie om het modal te maken voor het verwijderen van een antwoord. $scope.openDeleteAnswerModal = function (id) { var temp = $.Enumerable.From($scope.answers) .Where("$.id == " + id) .First(); $scope.selectedAnswer = temp; $('#deleteAnswerModal').modal('show'); }; $scope.closeDeleteAnswerModal = function () { $scope.selectedAnswer = {}; $('#deleteAnswerModal').modal('hide'); }; // Functie om bestaand antwoord te selecteren. $scope.autoSelectQuestion = function(selected){ var question = selected.originalObject; if ("string" == typeof(question)) { $scope.addNewQuestion(question); } else if ("object" == typeof(question)) { $scope.addQuestion(question); } }; // Voer initialisatie functie uit. self.init(); } angular.module('app').filter('pagination', function() { return function(input, start) { start = +start; if(angular.isArray(input) && input.length > 0) { return input.slice(start); } } });
/* * Wegas * http://wegas.albasim.ch * * Copyright (c) 2013-2021 School of Management and Engineering Vaud, Comem, MEI * Licensed under the MIT License */ /** * @fileoverview * @author Maxence Laurent (maxence.laurent gmail.com) */ YUI.add('wegas-sendmail', function(Y) { 'use strict'; var Wegas = Y.Wegas, CONTENTBOX = "contentBox", SendMail = Y.Base.create("wegas-sendmail", Y.Widget, [Y.WidgetChild, Wegas.Widget, Wegas.Editable], { BOUNDING_TEMPLATE: '<div class="wegas-sendmail"></div>', renderUI: function() { var cb = this.get(CONTENTBOX), emailsList = this.get("emails") || "(Hidden list of e-mails)", cfg = { type: "object", properties: { "@class": { type: "string", value: "Email", view: { type: "hidden" } }, "from": { type: "string", value: Y.Wegas.Facade.User.get("currentUser").get("accounts")[0].get("email"), view: { label: "From", readOnly: true } }, "to": { type: "string", value: Y.Array.map(this.get("players"), function(e) { return e.toObject(); }), view: { type: "hidden", readOnly: true } }, "dummy": { type: "string", value: emailsList, view: { readOnly: true, label: "To" } }, "subject": { type: "string", minLength: 1, view: { label: "Subject" } }, "body": { type: "string", minLength: 1, view: { type: "html", label: "Body" } } } }; this.form = new Y.Wegas.RForm({ values: {}, cfg: cfg, buttons: [] }); this.form.render(this.get("contentBox")); cb.append('<div><div class="results wegas-advanced-feature"></div><div class="status"></div></div>'); }, setStatus: function(status) { this.get("contentBox").one(".status").setHTML(status); }, setErrorStatus: function(errorMsg) { this.get("contentBox").one(".status").setHTML('<span style="color:red; font-weight:bold">' + errorMsg + '</span>'); }, send: function() { if (!this.form.validate().length) { this.setErrorStatus("Please complete these fields"); var ctx = this; setTimeout(function() { ctx.setStatus(""); }, 5000); return; } this.setStatus(""); Wegas.Panel.confirm("This will send a real e-mail", Y.bind(function() { this.setStatus("Sending..."); var data = this.form.getValue(); if (data.dummy) { // delete data.dummy; } Wegas.Facade.User.sendRequest({ request: "/SendMail", cfg: { method: "POST", updateEvent: false, data: data, headers: { "Managed-Mode": true } }, on: { success: Y.bind(function() { this.setStatus("OK"); Y.later(1000, this, function() { this.fire("email:sent"); }); }, this), failure: Y.bind(function(request) { try { var errorMsg = JSON.parse(request.data.response).events[0].exceptions[0].message; this.setErrorStatus(errorMsg); } catch (e) { this.setErrorStatus('Something went wrong'); } }, this) } }, this); }, this)); }, destructor: function() { this.form && this.form.destroy(); } }, { ATTRS: { players: { type: "array" }, emails: { type: "string" } } }); Wegas.SendMail = SendMail; });
import { INIT_PARTS_NUM } from '../constants/puzzle' import { UPDATE_IMAGE_GRID_STATE } from '../constants/actionTypes' export default (state = { vn: INIT_PARTS_NUM, hn: INIT_PARTS_NUM, lineColor: null }, action) => { switch (action.type) { case UPDATE_IMAGE_GRID_STATE: return { ...state, ...action.state } default: return state } }
//app.js var util=require('utils/util.js') App({ onLaunch: function () { var that=this // ่Žทๅ–openIdๅนถๆ”พๅ…ฅ็ผ“ๅญ˜ wx.login({ success: res => { if (!that.globalData.getOpenId){ wx.request({ url: 'https://api.beckbuy.com/api/openId/', data:{ 'code':res.code }, success:res=>{ if (res.data.error_code==0){ that.globalData.getOpenId=true, console.log("ๅˆๆฌก่Žทๅ–openIdๆˆๅŠŸ"+res.data.result.openId) wx.setStorage({ key: 'openId', data: res.data.result.openId, }) }else{ wx.showToast({ title:"่Žทๅ–openIdๅคฑ่ดฅ", image: '../../icon/error.png' , complete:()=>{ wx.switchTab({ url: '../index/index', }) } }) } } }) } setTimeout(function(){ wx.getStorage({ key: 'openId', success: function (openidres) { var openidres = openidres.data wx.getStorage({ key: 'userId', success: res => { wx.showToast({ title: 'ไปฅๆฃ€ๆต‹ๅˆฐ็ป‘ๅฎš็”จๆˆท', }) }, fail: () => { wx.showLoading({ title: 'ๆญฃๅœจ่Žทๅ–็ป‘ๅฎš็”จๆˆท', success: () => { wx.request({ url: 'https://api.beckbuy.com/api/isBind?openId=' + openidres, success: res => { var info = res.data var error_code = info.error_code if (error_code == 0 && info.result.isbind) { wx.setStorage({ key: 'userId', data: info.result.userId, success: () => { wx.setStorage({ key: 'isBind', data: true, }) wx.showToast({ title: 'ๅทฒ่Žทๅ–็ป‘ๅฎš็”จๆˆท', }) setTimeout(() => { wx.hideToast() }, 3000) } }) } else if (error_code == 0 && !info.result.isbind) { wx.showLoading({ title: 'ๅฝ“ๅ‰่ดฆๆˆทๆœช็ป‘ๅฎš๏ผŒๆญฃๅœจ่ทณ่ฝฌ..', }) setTimeout(function () { wx.hideLoading() // wx.navigateTo({ // url: '../../pages/bindAccount/bindAccount?fromIndex=true', // }) }, 500) } else { wx.showToast({ title: '็ฝ‘็ปœๅผ‚ๅธธ,่ฏท้‡่ฏ•', image: '../../icon/error.png' }) } } }) }, }) } }) }, }) },500) } }) }, onShow:function(){ console.log('app.js onshow') }, globalData: { getOpenId:null, userInfo: null, goods: [ {} ] } })
var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var tools = require('./tools'); var ROOT_PATH = path.resolve(__dirname); var BUILD_PATH = path.resolve(ROOT_PATH, 'build'); var APP_PATH = path.resolve(ROOT_PATH, 'app'); module.exports = { entry: { app: path.resolve(APP_PATH, 'index.jsx') }, output: { path: BUILD_PATH, filename: 'bundle.js' }, devtool: 'eval-source-map', devServer: { host: tools.getLocalIps(), historyApiFallback: true, hot: true, inline: true }, module: { loaders: [ //้…็ฝฎpreLoaders,ๅฐ†eslintๆทปๅŠ ่ฟ›ๅ…ฅ { enforce : 'pre', test : /\.jsx?$/, loaders : ['eslint-loader'], include : APP_PATH }, //้…็ฝฎloader๏ผŒๅฐ†BabelๆทปๅŠ ่ฟ›ๅŽป { test : /\.jsx?$/, loaders : ['babel-loader'], include : APP_PATH } ] }, plugins: [ new HtmlWebpackPlugin({ title: 'ใ€ŠReact ๅ…จๆ ˆใ€‹Flux ๆžถๆž„ๅŠๅ…ถๅฎž็Žฐ' }) ], resolve: { extensions: ['.js', '.jsx'] }, watchOptions: { poll: 1000 } };
/* * Copyright (c) Andrรฉ Bargull * Alle Rechte vorbehalten / All Rights Reserved. Use is subject to license terms. * * <https://github.com/anba/es6draft> */ const { assertSame } = Assert; // 14.4.13 EvaluateBody: Invalid assertion in step 1 // https://bugs.ecmascript.org/show_bug.cgi?id=2640 // no crash (function*(a = 0){})();
var CILJS = require("../CilJs.Runtime/Runtime"); var asm1 = {}; var asm = asm1; var asm0 = CILJS.findAssembly("mscorlib"); asm.FullName = "Exceptions.cs.ciljs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null";/* A..ctor()*/ asm.x6000001 = function _ctor(arg0) { /* IL_00: ldarg.0 */ /* IL_01: ldstr Exception A */ /* IL_06: call Void .ctor(System.String) */ asm0.x6000076(arg0,CILJS.newString("Exception A")); /* IL_0B: nop */ /* IL_0C: nop */ /* IL_0D: ret */ return ; };;/* B..ctor()*/ asm.x6000002 = function _ctor(arg0) { /* IL_00: ldarg.0 */ /* IL_01: ldstr Exception B */ /* IL_06: call Void .ctor(System.String) */ asm0.x6000076(arg0,CILJS.newString("Exception B")); /* IL_0B: nop */ /* IL_0C: nop */ /* IL_0D: ret */ return ; };;/* B..ctor(String)*/ asm.x6000003 = function _ctor(arg0, arg1) { /* IL_00: ldarg.0 */ /* IL_01: ldarg.1 */ /* IL_02: call Void .ctor(System.String) */ asm0.x6000076(arg0,arg1); /* IL_07: nop */ /* IL_08: nop */ /* IL_09: ret */ return ; };;/* C..ctor()*/ asm.x6000004 = function _ctor(arg0) { /* IL_00: ldarg.0 */ /* IL_01: ldstr Exception C */ /* IL_06: call Void .ctor(System.String) */ asm1.x6000003(arg0,CILJS.newString("Exception C")); /* IL_0B: nop */ /* IL_0C: nop */ /* IL_0D: ret */ return ; };;/* static System.Void Program.Main()*/ asm.x6000005_init = function () { (asm1.A().init)(); (asm1.B().init)(); (asm1.C().init)(); asm.x6000005 = asm.x6000005_; };; asm.x6000005 = function () { asm.x6000005_init(); return asm.x6000005_(); };; asm.x6000005_ = function Main() { var t0; var t1; var t2; CILJS.initBaseTypes(); t0 = asm1.A(); t1 = asm1.B(); t2 = asm1.C(); /* IL_00: nop */ /* IL_01: newobj Void .ctor() */ /* IL_06: call Void TestTryCatch(System.Exception) */ asm1.x6000006(CILJS.newobj(t0,asm1.x6000001,[null])); /* IL_0B: nop */ /* IL_0C: newobj Void .ctor() */ /* IL_11: call Void TestTryCatch(System.Exception) */ asm1.x6000006(CILJS.newobj(t1,asm1.x6000002,[null])); /* IL_16: nop */ /* IL_17: newobj Void .ctor() */ /* IL_1C: call Void TestTryCatch(System.Exception) */ asm1.x6000006(CILJS.newobj(t2,asm1.x6000004,[null])); /* IL_21: nop */ /* IL_22: ret */ return ; };/* static System.Void Program.TestTryCatch(Exception)*/ asm.x6000006 = function TestTryCatch(arg0) { var t0; var in_block_0; var __pos__; var in_block_1; var __finally_continuation_1__; var in_block_2; var __error_handled_2__; var loc0; var loc1; var loc2; t0 = asm0["System.Object"](); in_block_0 = true; __pos__ = 0x0; while (in_block_0){ switch (__pos__){ case 0x0: /* IL_00: nop */ try { in_block_1 = true; __finally_continuation_1__ = __pos__; if (__pos__ < 0x1){ __pos__ = 0x1; } while (in_block_1){ switch (__pos__){ case 0x1: try { in_block_2 = true; if (__pos__ < 0x1){ __pos__ = 0x1; } while (in_block_2){ switch (__pos__){ case 0x1: /* IL_01: nop */ /* IL_02: ldarg.0 */ /* IL_03: throw */ throw arg0; } } } catch (__error__) { __error_handled_2__ = false; if ((!(__error_handled_2__)) && (__error__ instanceof asm1.C())){ in_block_2 = true; if (__pos__ < 0x4){ __pos__ = 0x4; } while (in_block_2){ switch (__pos__){ case 0x4: st_01 = __error__; __error_handled_2__ = true; /* IL_04: stloc.0 */ loc0 = st_01; /* IL_05: nop */ /* IL_06: ldloc.0 */ /* IL_07: callvirt String get_Message() */ /* IL_0C: ldc.i4.0 */ /* IL_0D: newarr System.Object */ /* IL_12: call Void WriteLine(System.String, System.Object[]) */ asm0.x6000073((loc0.vtable)["asm0.x600007a"](loc0),CILJS.newArray(t0,0)); /* IL_17: nop */ /* IL_18: nop */ /* IL_19: leave.s IL_49 */ in_block_2 = false; __pos__ = 0x49; continue; } } } if ((!(__error_handled_2__)) && (__error__ instanceof asm1.B())){ in_block_2 = true; if (__pos__ < 0x1B){ __pos__ = 0x1B; } while (in_block_2){ switch (__pos__){ case 0x1B: st_06 = __error__; __error_handled_2__ = true; /* IL_1B: stloc.1 */ loc1 = st_06; /* IL_1C: nop */ /* IL_1D: ldloc.1 */ /* IL_1E: callvirt String get_Message() */ /* IL_23: ldc.i4.0 */ /* IL_24: newarr System.Object */ /* IL_29: call Void WriteLine(System.String, System.Object[]) */ asm0.x6000073((loc1.vtable)["asm0.x600007a"](loc1),CILJS.newArray(t0,0)); /* IL_2E: nop */ /* IL_2F: nop */ /* IL_30: leave.s IL_49 */ in_block_2 = false; __pos__ = 0x49; continue; } } } if ((!(__error_handled_2__)) && (__error__ instanceof asm1.A())){ in_block_2 = true; if (__pos__ < 0x32){ __pos__ = 0x32; } while (in_block_2){ switch (__pos__){ case 0x32: st_0B = __error__; __error_handled_2__ = true; /* IL_32: stloc.2 */ loc2 = st_0B; /* IL_33: nop */ /* IL_34: ldloc.2 */ /* IL_35: callvirt String get_Message() */ /* IL_3A: ldc.i4.0 */ /* IL_3B: newarr System.Object */ /* IL_40: call Void WriteLine(System.String, System.Object[]) */ asm0.x6000073((loc2.vtable)["asm0.x600007a"](loc2),CILJS.newArray(t0,0)); /* IL_45: nop */ /* IL_46: nop */ /* IL_47: leave.s IL_49 */ in_block_2 = false; __pos__ = 0x49; continue; } } } if ((!(__error_handled_2__))){ throw __error__; } } continue; case 0x49: /* IL_49: leave.s IL_5F */ in_block_1 = false; __pos__ = 0x5F; continue; } } } finally { in_block_1 = true; __finally_continuation_1__ = __pos__; __pos__ = 0x4B; while (in_block_1){ switch (__pos__){ case 0x4B: /* IL_4B: nop */ /* IL_4C: ldstr Finally */ /* IL_51: ldc.i4.0 */ /* IL_52: newarr System.Object */ /* IL_57: call Void WriteLine(System.String, System.Object[]) */ asm0.x6000073(CILJS.newString("Finally"),CILJS.newArray(t0,0)); /* IL_5C: nop */ /* IL_5D: nop */ /* IL_5E: endfinally */ in_block_1 = false; __pos__ = __finally_continuation_1__; continue; } break; } } continue; case 0x5F: /* IL_5F: ret */ return ; } } };;/* Program..ctor()*/ asm.x6000007 = function _ctor(arg0) { /* IL_00: ldarg.0 */ /* IL_01: call Void .ctor() */ /* IL_06: nop */ /* IL_07: ret */ return ; };; asm.A = CILJS.declareType( [], function () { return asm0["System.Exception"](); }, function (type) { type.init = CILJS.nop; CILJS.initType(type,asm,"A",false,false,false,false,false,[],[],asm0["System.Exception"](),CILJS.isInstDefault(type),Array,"asm1.t2000002",null); type.TypeMetadataName = "asm1.t2000002"; CILJS.declareVirtual(type,"asm0.x600007a",asm0,"x600007a"); CILJS.declareVirtual(type,"asm0.x600007b",asm0,"x600007b"); CILJS.declareVirtual(type,"asm0.x600009b",asm0,"x600007c"); CILJS.declareVirtual(type,"asm0.x600009e",asm0,"x600009e"); CILJS.declareVirtual(type,"asm0.x600009f",asm0,"x600009f"); }, function () { return function A() { A.init(); }; }); asm.B = CILJS.declareType( [], function () { return asm0["System.Exception"](); }, function (type) { type.init = CILJS.nop; CILJS.initType(type,asm,"B",false,false,false,false,false,[],[],asm0["System.Exception"](),CILJS.isInstDefault(type),Array,"asm1.t2000003",null); type.TypeMetadataName = "asm1.t2000003"; CILJS.declareVirtual(type,"asm0.x600007a",asm0,"x600007a"); CILJS.declareVirtual(type,"asm0.x600007b",asm0,"x600007b"); CILJS.declareVirtual(type,"asm0.x600009b",asm0,"x600007c"); CILJS.declareVirtual(type,"asm0.x600009e",asm0,"x600009e"); CILJS.declareVirtual(type,"asm0.x600009f",asm0,"x600009f"); }, function () { return function B() { B.init(); }; }); asm.C = CILJS.declareType( [], function () { return asm1.B(); }, function (type) { type.init = CILJS.nop; CILJS.initType(type,asm,"C",false,false,false,false,false,[],[],asm1.B(),CILJS.isInstDefault(type),Array,"asm1.t2000004",null); type.TypeMetadataName = "asm1.t2000004"; CILJS.declareVirtual(type,"asm0.x600007a",asm0,"x600007a"); CILJS.declareVirtual(type,"asm0.x600007b",asm0,"x600007b"); CILJS.declareVirtual(type,"asm0.x600009b",asm0,"x600007c"); CILJS.declareVirtual(type,"asm0.x600009e",asm0,"x600009e"); CILJS.declareVirtual(type,"asm0.x600009f",asm0,"x600009f"); }, function () { return function C() { C.init(); }; }); asm.Program = CILJS.declareType( [], function () { return asm0["System.Object"](); }, function (type) { type.init = CILJS.nop; CILJS.initType(type,asm,"Program",false,false,false,false,false,[],[],asm0["System.Object"](),CILJS.isInstDefault(type),Array,"asm1.t2000005",null); type.TypeMetadataName = "asm1.t2000005"; CILJS.declareVirtual(type,"asm0.x600009b",asm0,"x600009b"); CILJS.declareVirtual(type,"asm0.x600009e",asm0,"x600009e"); CILJS.declareVirtual(type,"asm0.x600009f",asm0,"x600009f"); }, function () { return function Program() { Program.init(); }; }); asm.entryPoint = asm.x6000005; CILJS.declareAssembly("Exceptions.cs.ciljs",asm); if (typeof module != "undefined"){ module.exports = asm1; } //# sourceMappingURL=Exceptions.cs.ciljs.exe.js.map
define(['js/views/card/itemview', 'js/mtapi', 'js/commands', 'moment', 'moment.lang', 'cards/feedbacks/models/comments_model', 'hbs!cards/feedbacks/templates/reply' ], function (CardItemView, mtapi, commands, moment, momentLang, Model, template) { 'use strict'; return CardItemView.extend({ template: template, ui: { replyButton: '#reply-button', doReplyButton: '#do-reply-button', replyTextarea: '#reply-textarea' }, initialize: function (options) { CardItemView.prototype.initialize.apply(this, Array.prototype.slice.call(arguments)); this.type = options.type; this.blogId = options.blogId; this.commentId = options.commentId; this.model = options.model; this.collection = options.collection; this.entryModel = options.entryModel; this.initial = true; this.loading = false; this.setTranslation(); commands.setHandler('card:feedbacks:reply:render', this.render); }, commentIsApproved: function () { var comment = this.model.toJSON(); return comment.status === 'Approved'; }, entryIsPublished: function () { var entry = this.entryModel.toJSON(); return entry.status === 'Publish'; }, commentApprovePerm: function () { var entry = this.entryModel.toJSON(), ret = false; if (entry.status === 'Publish') { if (this.userIsSystemAdmin() || (this.userHasPermission('manage_feedback') || this.userHasPermission('edit_all_posts'))) { ret = true; } else { if ((entry.author && entry.author.id === this.user.id) && this.userHasPermission('publish_post')) { ret = true; } } } return ret; }, onRender: function () { if (this.entryIsPublished() && this.commentIsApproved() && this.commentApprovePerm()) { this.ui.replyButton.hammer(this.hammerOpts).on('tap', _.bind(function (e) { this.addTapClass(e.currentTarget, _.bind(function () { this.initial = false; this.form = true; this.body = false; this.replied = false; this.loading = false; this.render(); }, this)); }, this)); this.ui.doReplyButton.hammer(this.hammerOpts).on('tap', _.bind(function (e) { this.addTapClass(e.currentTarget, _.bind(function () { var body = this.ui.replyTextarea.val(); var data = this.model.toJSON(); if (body.length) { var reply = { author: this.user, entry: data.entry, blog: data.blog, parent: this.commentId, date: moment().format(), body: body } this.body = body; this.loading = true; this.render(); mtapi.api.createReplyComment(this.blogId, data.entry.id, this.commentId, reply, _.bind(function (resp) { if (!resp.error) { this.form = false; this.replied = true; this.body = body; this.loading = false; var newComment = new Model(); newComment.set(resp); this.collection.unshift(newComment); this.render(); } else { this.form = true; this.replied = false; this.body = body; this.loading = false; this.error = resp.error && resp.error.message ? resp.error.message : 'request failed'; this.render(); } }, this)); } }, this)); }, this)); } }, serializeData: function () { var data = this.serializeDataInitialize(); data = _.extend(data, this.model.toJSON()); data.commentIsApproved = this.commentIsApproved(); data.entryIsPublished = this.entryIsPublished(); data.commentApprovePerm = this.commentApprovePerm(); data.error = this.error; data.initial = this.initial; data.form = this.form; data.replied = this.replied; data.body = this.body || ''; return data; } }); });
angular.module('ordercloud-assignment-helpers', []) .factory('Assignments', AssignmentHelpers) ; function AssignmentHelpers($q, Underscore, $state) { return { //getAssigned: getAssigned, //getSelected: getSelected, //getUnselected: getUnselected, //getToAssign: getToAssign, //getToDelete: getToDelete, saveAssignments: saveAssignments }; function getAssigned(AssignmentsArray, ID_Name) { //TODO: Save this result in temp variable so I don't do this operation twice every time. return Underscore.pluck(AssignmentsArray, ID_Name); } function getSelected(ListArray) { return Underscore.pluck(Underscore.where(ListArray, {selected: true}), 'ID'); } function getUnselected(ListArray) { return Underscore.pluck(Underscore.filter(ListArray, function(item) { return !item.selected; }), 'ID'); } function getToAssign(ListArray, AssignmentsArray, ID_Name) { return Underscore.difference(getSelected(ListArray), getAssigned(AssignmentsArray, ID_Name)); } function getToDelete(ListArray, AssignmentsArray, ID_Name) { return Underscore.intersection(getUnselected(ListArray), getAssigned(AssignmentsArray, ID_Name)); } function saveAssignments(ListArray, AssignmentsArray, SaveFunc, DeleteFunc, ID_Name) { var id_name = ID_Name ? ID_Name : 'UserGroupID'; var toAssign = getToAssign(ListArray, AssignmentsArray, id_name); var toDelete = getToDelete(ListArray, AssignmentsArray, id_name); var queue = []; var dfd = $q.defer(); angular.forEach(toAssign, function(ItemID) { console.log(ItemID); queue.push(SaveFunc(ItemID)); }); angular.forEach(toDelete, function(ItemID) { queue.push(DeleteFunc(ItemID)); }); $q.all(queue).then(function() { dfd.resolve(); $state.reload($state.current); }); return dfd.promise; } }
import localstate from './localstate' import statefull from './statefull' import root from './root' export default { localstate, statefull, root }
'use strict'; import { Rooms } from '../../api/rooms.js'; import { playState } from '../lib.js'; Template.play.onCreated(() => { let templateInstance = Template.instance(); templateInstance.playState = playState; const roomId = localStorage.getItem('roomId'); const userId = localStorage.getItem('userId'); templateInstance.subscribe('Room', roomId, userId); Tracker.autorun(() => { // continue to run after template onDestroyed const room = Rooms.findOne({}); if (room) { // wait until subscription ready switch (room.status) { case 1: BlazeLayout.render('main', { content: 'panel' }); break; case 2: Meteor.clearInterval(templateInstance.playState.get('panelIntervalHandler')); if (room.userId === userId) { // if current user is drawer BlazeLayout.render('main', { content: 'draw' }); } else { BlazeLayout.render('main', { content: 'view' }); } break; case 3: case 4: Meteor.clearInterval(templateInstance.playState.get('roundIntervalHandler')); BlazeLayout.render('main', { content: 'panel' }); break; } } }); });
var show = (function(){ var move = function(e) { var DIRECTIONS = { 37: -1, // > 38: -1, // up 39: 1, // < 40: 1, // down 32: 1, // _ 13: 1, // return 27: 'home', // esc left: -1, right: 1 }; if (dir = DIRECTIONS[e.which || e]) { if (dir == 'home') { e.preventDefault(); e.stopPropagation(); location.href = '/'; } else { show.setIndex(show.index() + dir); } } }; var clickMove = function(e) { if (e.pageX < ($(window).width() / 2)) { move('left'); } else { move('right'); } } var touchMove = function(e) { if (e.originalEvent.changedTouches[0].pageX < ($(window).width() / 2)) { move('left'); } else { move('right'); } } var dimensions = function() { return { width: $(window).width(), height: $(window).height() }; }; var setSlideDimensions = function() { var d = dimensions(); $('#slides').height(d.height).width(d.width); show.slides().height(d.height).width(d.width); }; var showCurrentSlide = function() { var d = dimensions(); var index = (show.index() || 0); var offset = index * $('#slides').width(); $('#reel').animate({ marginLeft: '-' + offset + 'px' }, 200); }; var verticalAlign = function() { var d = dimensions(); var margin = (dimensions.height - $(this).height()) / 2; $(this).css({ paddingTop: margin + 'px' }); }; var adjustSlides = function() { setSlideDimensions(); showCurrentSlide(); }; var followLinks = function(e) { e.stopPropagation(); e.preventDefault(); window.open(e.target.href); } $(window).bind('resize', function() { adjustSlides(); }); $(document).bind('keydown', move); $(document).bind("click", clickMove); $(document).bind("touchend", touchMove); return { slides: function() { return $('#slides .content'); }, index: function() { return Number(document.location.hash.split('#')[1]); }, setIndex: function(i) { var newSlide = '#slide-' + i; if ($(newSlide).size() < 1) { return false; } else { document.location.hash = '#' + i; adjustSlides(); $("a").unbind("click").click(followLinks); } }, go: function() { this.setIndex(this.index() || 0); } }; })(); $(document).ready(function() { show.go(); });
var express = require('express') var router = express.Router() var assert = require('assert') var session = require('express-session') var secret = require('../config/secret.config') var State = require('./state') const pjson = require('../package.json'); // Routes require('./stories')(router) require('./users')(router) require('./game')(router) require('./admin')(router) // GET / router.get('/', function (req, res, next) { res.send('groupwrite.io API server') }) // GET /version router.get('/version', function (req, res, next) { res.send(pjson.version) }) module.exports = router
import React from 'react' import RadioGroup from 'react-ions/lib/components/Radio/RadioGroup' import Button from 'react-ions/lib/components/Button' import style from './style.scss' const options = [ { value: true, label: 'Yes' }, { value: false, label: 'No' } ] class ExampleRadioChecked extends React.Component { constructor(props) { super(props) } state = { selected: true } updateSelected = value => { this.setState({ selected: value }) } render() { return ( <div> <div className={style.update}> <Button onClick={this.updateSelected.bind(this, true)}>Select 1st item</Button> <Button onClick={this.updateSelected.bind(this, false)}>Select 2nd item</Button> <Button onClick={this.updateSelected.bind(this, '')}>Uncheck</Button> </div> <RadioGroup name="checked-radio-group" options={options} changeCallback={event => console.log(event.target.value)} value={this.state.selected}> </RadioGroup> </div> ) } } export default ExampleRadioChecked
export Textarea from './Textarea';
function test(chart) { var point = chart.series[0].points[2], offset = $(chart.container).offset(); // Set hoverPoint chart.hoverSeries = point.series; // emulates element onmouseover point.onMouseOver(); chart.pointer.onContainerMouseMove({ type: 'mousemove', pageX: 310, pageY: 300, target: chart.container }); }
//Add watch window variables expRemoveAll() expAdd("fError", getNatural()) expAdd("fail", getNatural()) expAdd("pass", getNatural()) expAdd("Cla1Regs._MR0.i32", getNatural()) expAdd("Cla1Regs._MR0.f32", getNatural()) expAdd("Cla1Regs._MR0.f32", getHex()) expAdd("Cla1Regs._MR1.i32", getNatural()) expAdd("Cla1Regs._MR1.f32", getNatural()) expAdd("Cla1Regs._MR1.f32", getHex()) expAdd("Cla1Regs._MR2.i32", getNatural()) expAdd("Cla1Regs._MR2.f32", getNatural()) expAdd("Cla1Regs._MR2.f32", getHex()) expAdd("Cla1Regs._MR3.i32", getNatural()) expAdd("Cla1Regs._MR3.f32", getNatural()) expAdd("Cla1Regs._MR3.f32", getHex()) openAnalysisView('Dual Time','C:/TI/controlSUITE/libs/math/CLAmath/v4.02.00.00/examples/2837x_ln/cpu01/ln.graphProp')
'use strict'; var React = require('react'); var SvgIcon = require('../../svg-icon'); var NotificationSimCardAlert = React.createClass({ displayName: 'NotificationSimCardAlert', render: function render() { return React.createElement( SvgIcon, this.props, React.createElement('path', { d: "M18 2h-8L4.02 8 4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-5 15h-2v-2h2v2zm0-4h-2V8h2v5z" }) ); } }); module.exports = NotificationSimCardAlert;
// ==UserScript== // @name Table to Markdown Copier // @name:vi Chรฉp bแบฃng HTML qua dแบกng markdown // @namespace https://github.com/hotmit/table-markdown-userscript // @version 1.0.1 // @description Convert html table to markdown format // @description:vi Chuyแปƒn bแบฃng html (table) qua dแบกng markdown. // @author Du Dang // @include http://*/* // @include https://*/* // @grant none // @require https://code.jquery.com/jquery-3.1.1.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.16/clipboard.min.js // @license MIT // ==/UserScript== (function($) { 'use strict'; // max cell with in chars count var MAX_COL_SIZE = 80; var Str = {}; $(function(){ var lastThreeKeys = [], combinationLength = 3; // region [ Display Control ] /** * Insert the "MD" button to all the last cell in the header of * all the tables in the current page. * @private */ function displayTableControl(){ $('table').each(function(i, e){ var id = 'btn-copy-md-' + i, $tb = $(e), $btnMd = $('<button type="button" class="convert-to-markdown btn btn-primary" />'), $lastCell = $tb.find('tr:first').find('td:last, th:last').first(); $btnMd.css({ height: '20px', width: '30px', 'background-color': '#81358c', color: '#fff', padding: '0' }).text('MD').attr('id', id); // copy markdown content to the clipboard new Clipboard('#' + id, { text: function() { return convertTableToMd($btnMd); } }); $lastCell.append($btnMd); }); //$('.convert-to-markdown').click(convertTableToMd); } // endregion // region [ Code ] /** * Extract the data from the table. Return array of row of data along with * the maximum length for each column. * * @param $table * @returns {{maxLengths: Array, tableData: Array}} * @private */ function getData($table){ var maxLengths = [], tableData = []; function setMax(index, length){ // create new column if does not exist while(index >= maxLengths.length){ maxLengths.push(0); } maxLengths[index] = Math.max(maxLengths[index], length); } $table.find('tr').each(function(trIndex, tr){ var $tr = $(tr), row = [], offset = 0; $tr.find('td, th').each(function(i, td){ var $td = $(td), text = getText($td, trIndex), tl = text.length, index = i + offset, colspan = $td.attr('colspan'); setMax(index, tl); row.push(text); if (colspan && $.isNumeric(colspan) && Number(colspan) > 1){ colspan = Number(colspan); offset += colspan - 1; for (var k=0; k<colspan; k++){ row.push(''); } } }); tableData.push(row); }); return { maxLengths: maxLengths, tableData: tableData }; } /** * Convert the data from getData to actual markdown content. * * @param $btn - The "MD" button housed inside the table. * @returns {string} - The markdown table content * @private */ function convertTableToMd($btn){ var md = '', $table = $btn.parents('table').first(), data = getData($table), i, k, maxLengths = data.maxLengths; for (i=0; i<data.tableData.length; i++){ var row = data.tableData[i], rowMd = '| ', sepMd = '| '; for(k=0; k<row.length; k++){ var rowWidth = Math.min(maxLengths[k], MAX_COL_SIZE), text = Str.padRight(row[k], ' ', rowWidth); rowMd += text + ' | '; // add header separator if (i === 0){ sepMd += Str.repeat(' ', rowWidth) + ' | '; } } if (rowMd.length > 2){ md += Str.trim(rowMd) + "\n"; if (sepMd.length > 2){ md += Str.trim(sepMd).replace(/ /g, '-') + "\n"; } } } md += getReferenceLink($table); // copied indicator $btn.css('background-color', '#6AB714'); setTimeout(function(){ $btn.css('background-color', '#81358c'); }, 3000); return md; } /** * Generate markdown link to the table for future reference. * * @param $table * @returns {*} */ function getReferenceLink($table) { var refLink, $anchor, refId = $table.attr('id'), href = location.href; if(!refId) { $anchor = $table.parents('[id]').first(); if ($anchor.length){ refId = $anchor.attr('id'); } } if (refId) { if (href.indexOf('#') != -1) { refLink = href.replace(/#.+/, '#' + refId); } else { refLink = href + '#' + refId; } } // if no id link, then just use the main link as reference refLink = refLink || href; return '[Table Source](' + refLink + ')'; } /** * Clean up the text for the cell content. Like remove new line so it doesn't break the table. * * @param $td * @param trIndex * @returns {string|*} */ function getText($td, trIndex) { var text = $td.text(); if (trIndex === 0){ // remove the MD link from the text text = text.replace(/MD$/, ''); } text = text.replace("\n", ''); text = text.replace(/\s/g, ' '); return Str.trim(text); } // endregion // region [ Capture shortcut keys ] // Activate Markdown Converter Interface // => Shift, Shift, T (3 key strokes as a sequence, NOT press all together) $(document).on('keydown', function(e) { lastThreeKeys.push(e.which); lastThreeKeys = lastThreeKeys.slice(-combinationLength); if (lastThreeKeys.toString() == '16,16,84') { displayTableControl(); e.preventDefault(); return false; } }); // endregion // uncomment for dev // displayTableControl(); }); //end jqReady // region [ Str Lib ] Str.trim = function (s) { return s.replace(/^\s+/, '').replace(/\s+$/, ''); }; Str.padRight = function(s, padStr, totalLength){ return s.length >= totalLength ? s : s + Str.repeat(padStr, (totalLength-s.length)/padStr.length); }; Str.repeat = function(s, count) { var newS = "", i; for (i=0; i<count; i++) { newS += s; } return newS; }; // endregion })(jQuery.noConflict(true));
import should from 'should'; import '../../utils/assertions.js'; import nock from 'nock'; import fs from 'fs-extra'; import scrape from 'website-scraper'; const testDirname = './test/functional/base/.tmp2'; describe('Functional: check it works', function() { beforeEach(function () { nock.cleanAll(); nock.disableNetConnect(); }); afterEach(function () { nock.cleanAll(); nock.enableNetConnect(); fs.removeSync(testDirname); }); it('should work with promise', () => { nock('http://example.com/').get('/').reply(200, 'TEST PROMISES'); const options = { urls: [ 'http://example.com/' ], directory: testDirname }; return scrape(options).then((result) => { should(result[0].url).be.eql('http://example.com/'); should(result[0].filename).be.eql('index.html'); should(result[0].text).be.eql('TEST PROMISES'); }); }); });
(function() { "use strict"; angular .module('app.createHall') .controller('CreateHallController', CreateHallController); /* @ngInject */ function CreateHallController (hallService, $state, $rootScope) { var ctrl = this; ctrl.hall = { ScreenX: 0, ScreenY: 0 }; ctrl.createHall = createHall; function createHall () { $rootScope.$broadcast('$globalLoadStart'); hallService.createHall(ctrl.hall) .then(function () { $rootScope.$broadcast('$globalLoadEnd'); $state.go('myHalls'); }); } } })();
import { Light } from './Light'; import { DirectionalLightShadow } from './DirectionalLightShadow'; import { Object3D } from '../core/Object3D'; /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ */ function DirectionalLight( color, intensity ) { Light.call( this, color, intensity ); this.type = 'DirectionalLight'; this.position.copy( Object3D.DefaultUp ); this.updateMatrix(); this.target = new Object3D(); this.shadow = new DirectionalLightShadow(); } DirectionalLight.prototype = Object.assign( Object.create( Light.prototype ), { constructor: DirectionalLight, isDirectionalLight: true, copy: function ( source ) { Light.prototype.copy.call( this, source ); this.target = source.target.clone(); this.shadow = source.shadow.clone(); return this; } } ); export { DirectionalLight };