text
stringlengths
2
6.14k
import s from 'underscore.string'; RocketChat.Migrations.add({ version: 55, up() { RocketChat.models.Rooms.find({ topic: { $exists: 1, $ne: '' } }, { topic: 1 }).forEach(function(room) { const topic = s.escapeHTML(room.topic); RocketChat.models.Rooms.update({ _id: room._id }, { $set: { topic } }); RocketChat.models.Messages.update({ t: 'room_changed_topic', rid: room._id }, { $set: { msg: topic } }); }); }, });
var path = require("path"), child_process = require("child_process"), fs = require("fs"), clientModules = path.join(__dirname, "modules") function readFiles(dir) { fs.readdir(dir, function (err, files) { //console.log("reading files", files) files.forEach(function (file) { file = path.join(dir, file) //console.log("stat", file) fs.stat(file, function (err, stat) { if (err) { console.log(err) } if (stat.isDirectory()) { readFiles(file) } else if (stat.isFile()) { fs.watchFile(file, build) } }) }) }) } function build() { console.log("building") child_process.exec("make ncore") } readFiles(clientModules) build()
import { Component, EventEmitter, Input, Output, ChangeDetectionStrategy, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ButtonModule } from 'primeng/button'; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var InplaceDisplay = /** @class */ (function () { function InplaceDisplay() { } InplaceDisplay = __decorate([ Component({ selector: 'p-inplaceDisplay', template: '<ng-content></ng-content>' }) ], InplaceDisplay); return InplaceDisplay; }()); var InplaceContent = /** @class */ (function () { function InplaceContent() { } InplaceContent = __decorate([ Component({ selector: 'p-inplaceContent', template: '<ng-content></ng-content>' }) ], InplaceContent); return InplaceContent; }()); var Inplace = /** @class */ (function () { function Inplace() { this.closeIcon = 'pi pi-times'; this.onActivate = new EventEmitter(); this.onDeactivate = new EventEmitter(); } Inplace.prototype.onActivateClick = function ($event) { if (!this.preventClick) this.activate(event); }; Inplace.prototype.onDeactivateClick = function (event) { if (!this.preventClick) this.deactivate(event); }; Inplace.prototype.activate = function (event) { if (!this.disabled) { this.active = true; this.onActivate.emit(event); } }; Inplace.prototype.deactivate = function (event) { if (!this.disabled) { this.active = false; this.hover = false; this.onDeactivate.emit(event); } }; Inplace.prototype.onKeydown = function (event) { if (event.which === 13) { this.activate(event); event.preventDefault(); } }; __decorate([ Input() ], Inplace.prototype, "active", void 0); __decorate([ Input() ], Inplace.prototype, "closable", void 0); __decorate([ Input() ], Inplace.prototype, "disabled", void 0); __decorate([ Input() ], Inplace.prototype, "preventClick", void 0); __decorate([ Input() ], Inplace.prototype, "style", void 0); __decorate([ Input() ], Inplace.prototype, "styleClass", void 0); __decorate([ Input() ], Inplace.prototype, "closeIcon", void 0); __decorate([ Output() ], Inplace.prototype, "onActivate", void 0); __decorate([ Output() ], Inplace.prototype, "onDeactivate", void 0); Inplace = __decorate([ Component({ selector: 'p-inplace', template: "\n <div [ngClass]=\"{'ui-inplace ui-widget': true, 'ui-inplace-closable': closable}\" [ngStyle]=\"style\" [class]=\"styleClass\">\n <div class=\"ui-inplace-display\" (click)=\"onActivateClick($event)\" tabindex=\"0\" (keydown)=\"onKeydown($event)\" \n [ngClass]=\"{'ui-state-disabled':disabled}\" *ngIf=\"!active\">\n <ng-content select=\"[pInplaceDisplay]\"></ng-content>\n </div>\n <div class=\"ui-inplace-content\" *ngIf=\"active\">\n <ng-content select=\"[pInplaceContent]\"></ng-content>\n <button type=\"button\" [icon]=\"closeIcon\" pButton (click)=\"onDeactivateClick($event)\" *ngIf=\"closable\"></button>\n </div>\n </div>\n ", changeDetection: ChangeDetectionStrategy.Default }) ], Inplace); return Inplace; }()); var InplaceModule = /** @class */ (function () { function InplaceModule() { } InplaceModule = __decorate([ NgModule({ imports: [CommonModule, ButtonModule], exports: [Inplace, InplaceDisplay, InplaceContent, ButtonModule], declarations: [Inplace, InplaceDisplay, InplaceContent] }) ], InplaceModule); return InplaceModule; }()); /** * Generated bundle index. Do not edit. */ export { Inplace, InplaceContent, InplaceDisplay, InplaceModule }; //# sourceMappingURL=primeng-inplace.js.map
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppRootPortal = void 0; var _jsxRuntime = require("../../lib/jsxRuntime"); var React = _interopRequireWildcard(require("react")); var _reactDom = require("react-dom"); var _AppRootContext = require("./AppRootContext"); var _AppearanceProvider = require("../AppearanceProvider/AppearanceProvider"); var _useAppearance = require("../../hooks/useAppearance"); var AppRootPortal = function AppRootPortal(_ref) { var _forcePortal; var children = _ref.children, className = _ref.className, forcePortal = _ref.forcePortal; var _React$useContext = React.useContext(_AppRootContext.AppRootContext), portalRoot = _React$useContext.portalRoot, mode = _React$useContext.mode; var appearance = (0, _useAppearance.useAppearance)(); forcePortal = (_forcePortal = forcePortal) !== null && _forcePortal !== void 0 ? _forcePortal : mode !== "full"; return portalRoot && forcePortal ? /*#__PURE__*/(0, _reactDom.createPortal)((0, _jsxRuntime.createScopedElement)(_AppearanceProvider.AppearanceProvider, { appearance: appearance }, (0, _jsxRuntime.createScopedElement)("div", { className: className }, children)), portalRoot) : (0, _jsxRuntime.createScopedElement)(React.Fragment, null, children); }; exports.AppRootPortal = AppRootPortal; //# sourceMappingURL=AppRootPortal.js.map
hljs.registerLanguage("csharp",(()=>{"use strict";return e=>{var n={ keyword:["abstract","as","base","break","case","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]).join(" "), built_in:"bool byte char decimal delegate double dynamic enum float int long nint nuint object sbyte short string ulong unit ushort", literal:"default false null true"},a=e.inherit(e.TITLE_MODE,{ begin:"[a-zA-Z](\\.?\\w)*"}),i={className:"number",variants:[{ begin:"\\b(0b[01']+)"},{ begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{ begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" }],relevance:0},s={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}] },t=e.inherit(s,{illegal:/\n/}),r={className:"subst",begin:/\{/,end:/\}/, keywords:n},l=e.inherit(r,{illegal:/\n/}),c={className:"string",begin:/\$"/, end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/ },e.BACKSLASH_ESCAPE,l]},o={className:"string",begin:/\$@"/,end:'"',contains:[{ begin:/\{\{/},{begin:/\}\}/},{begin:'""'},r]},d=e.inherit(o,{illegal:/\n/, contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},l]}) ;r.contains=[o,c,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,e.C_BLOCK_COMMENT_MODE], l.contains=[d,c,t,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,e.inherit(e.C_BLOCK_COMMENT_MODE,{ illegal:/\n/})];var g={variants:[o,c,s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] },E={begin:"<",end:">",contains:[{beginKeywords:"in out"},a] },_=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",b={ begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"], keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0, contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{ begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}] }),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#", end:"$",keywords:{ "meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum" }},g,i,{beginKeywords:"class interface",relevance:0,end:/[{;=]/, illegal:/[^\s:,]/,contains:[{beginKeywords:"where class" },a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace", relevance:0,end:/[{;=]/,illegal:/[^\s:]/, contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/, contains:[a,E,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta", begin:"^\\s*\\[",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{ className:"meta-string",begin:/"/,end:/"/}]},{ beginKeywords:"new return throw await else",relevance:0},{className:"function", begin:"("+_+"\\s+)+"+e.IDENT_RE+"\\s*(<.+>\\s*)?\\(",returnBegin:!0, end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{ beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", relevance:0},{begin:e.IDENT_RE+"\\s*(<.+>\\s*)?\\(",returnBegin:!0, contains:[e.TITLE_MODE,E],relevance:0},{className:"params",begin:/\(/,end:/\)/, excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0, contains:[g,i,e.C_BLOCK_COMMENT_MODE] },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},b]}}})());
/* ========================================================================== Assign Code copied from the following with moderate modifications : - https://github.com/maslennikov/shallow-extend Copyright (c) 2014 Alexey Maslennikov ========================================================================== */ 'use strict'; var fnBind = require( './fn-bind' ).fnBind; /** * @param {object} object - JavaScript object. * @returns {boolean} True if object is plain Javascript object. */ function _isPlainObject( object ) { return Object.prototype.toString.call( object ) === '[object Object]'; } /** * Copies properties of all sources to the destination object overriding its own * existing properties. When assigning from multiple sources, fields of every * next source will override same named fields of previous sources. * * @param {Object} destination object. * @returns {Object} assigned destination object. */ function assign( destination ) { destination = destination || {}; var hasOwnProp; for ( var i = 1; i < arguments.length; i++ ) { var source = arguments[i] || {}; hasOwnProp = fnBind( Object.hasOwnProperty, source ); for ( var key in source ) { if ( hasOwnProp( key ) ) { var value = source[key]; if ( _isPlainObject( value ) ) { assign( destination[key] = {}, value ); } else { destination[key] = source[key]; } } } } return destination; } // Expose public methods. module.exports = { assign: assign };
(function (window) { 'use strict'; window.opspark = window.opspark || {}; var Proton = window.Proton; window.opspark.makeParticleManager = function (stage) { var _proton, _renderer, _particleManager; _proton = new Proton; _renderer = new Proton.Renderer('easel', _proton, stage); _renderer.start(); function tick() { requestAnimationFrame(tick); _proton.update(); } tick(); function makeEmitter(radiusMin, radiusMax, color, velocity, behaviours) { var emitter, protonEmitter; protonEmitter = makeProtonEmitter(radiusMin, radiusMax, color, velocity, behaviours); emitter = { protonEmitter: protonEmitter, emit: function (point, emitTime) { protonEmitter.emit(emitTime); protonEmitter.p.x = point.x; protonEmitter.p.y = point.y; }, stop: function () { protonEmitter.stopEmit(); }, destroy: function () { _proton.removeEmitter(protonEmitter); } }; return emitter; } function makeProtonEmitter(radiusMin, radiusMax, color, velocity, behaviours) { var emtr; emtr = new Proton.Emitter(); emtr.rate = new Proton.Rate(new Proton.Span(1, 2), .012); emtr.addInitialize(velocity || new Proton.Velocity(new Proton.Span(1, 2), new Proton.Span(0, 360), 'polar')); emtr.addInitialize(new Proton.Mass(1)); emtr.addInitialize(new Proton.Radius(radiusMin || 2, radiusMax|| 4)); emtr.addInitialize(new Proton.Life(0.5, 0.5)); emtr.addBehaviour(new Proton.Collision(emtr)); emtr.addBehaviour(new Proton.Color(color || "rgba(0, 0, 0, 0.2)")); if (behaviours) { behaviours.forEach(function (behaviour) { emtr.addBehaviour(behaviour); }); } emtr.addBehaviour(new Proton.CrossZone(new Proton.RectZone(0, 0, canvas.width, canvas.height), 'bound')); emtr.damping = 0.02; _proton.addEmitter(emtr); return emtr; } /* * Some game defaults */ function makePlayerEmitter() { return makeEmitter(null, null, null, new Proton.Velocity(new Proton.Span(1, 2), [45, 135, 225, 315], 'polar')); } _particleManager = { makeEmitter: makeEmitter, makePlayerEmitter: makePlayerEmitter, removeEmitter: function (emitter) { _proton.removeEmitter(emitter); }, proton: _proton }; return _particleManager; }; }(window));
define(['jQuery', 'fnchecked', 'emby-checkbox'], function ($) { 'use strict'; function loadMediaFolders(page, mediaFolders) { var html = ''; html += '<h3 class="checkboxListLabel">' + Globalize.translate('HeaderLibraries') + '</h3>'; html += '<div class="checkboxList paperList" style="padding:.5em 1em;">'; for (var i = 0, length = mediaFolders.length; i < length; i++) { var folder = mediaFolders[i]; var checkedAttribute = ' checked="checked"'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '"' + checkedAttribute + '/><span>' + folder.Name + '</span></label>'; } html += '</div>'; $('.folderAccess', page).html(html).trigger('create'); $('#chkEnableAllFolders', page).checked(true).trigger('change'); } function loadChannels(page, channels) { var html = ''; html += '<h3 class="checkboxListLabel">' + Globalize.translate('HeaderChannels') + '</h3>'; html += '<div class="checkboxList paperList" style="padding:.5em 1em;">'; for (var i = 0, length = channels.length; i < length; i++) { var folder = channels[i]; var checkedAttribute = ' checked="checked"'; html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '"' + checkedAttribute + '/><span>' + folder.Name + '</span></label>'; } html += '</div>'; $('.channelAccess', page).show().html(html).trigger('create'); if (channels.length) { $('.channelAccessContainer', page).show(); } else { $('.channelAccessContainer', page).hide(); } $('#chkEnableAllChannels', page).checked(true).trigger('change'); } function loadUser(page) { $('#txtUserName', page).val(''); Dashboard.showLoadingMsg(); var promise4 = ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false })); var promise5 = ApiClient.getJSON(ApiClient.getUrl("Channels")); Promise.all([promise4, promise5]).then(function (responses) { loadMediaFolders(page, responses[0].Items); loadChannels(page, responses[1].Items); Dashboard.hideLoadingMsg(); }); } function saveUser(page) { var name = $('#txtUserName', page).val(); ApiClient.createUser(name).then(function (user) { user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).checked(); user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : $('.chkFolder', page).get().filter(function (i) { return i.checked; }).map(function (i) { return i.getAttribute('data-id'); }); user.Policy.EnableAllChannels = $('#chkEnableAllChannels', page).checked(); user.Policy.EnabledChannels = user.Policy.EnableAllChannels ? [] : $('.chkChannel', page).get().filter(function (i) { return i.checked; }).map(function (i) { return i.getAttribute('data-id'); }); ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () { Dashboard.navigate("useredit.html?userId=" + user.Id); }); }, function (response) { if (response.status == 400) { Dashboard.alert({ message: page.querySelector('.labelNewUserNameHelp').innerHTML }); } else { require(['toast'], function (toast) { toast(Globalize.translate('DefaultErrorMessage')); }); } Dashboard.hideLoadingMsg(); }); } function onSubmit() { var page = $(this).parents('.page')[0]; Dashboard.showLoadingMsg(); saveUser(page); // Disable default form submission return false; } function loadData(page) { loadUser(page); } $(document).on('pageinit', "#newUserPage", function () { var page = this; $('#chkEnableAllChannels', page).on('change', function () { if (this.checked) { $('.channelAccessListContainer', page).hide(); } else { $('.channelAccessListContainer', page).show(); } }); $('#chkEnableAllFolders', page).on('change', function () { if (this.checked) { $('.folderAccessListContainer', page).hide(); } else { $('.folderAccessListContainer', page).show(); } }); $('.newUserProfileForm').off('submit', onSubmit).on('submit', onSubmit); }).on('pageshow', "#newUserPage", function () { var page = this; loadData(page); }); });
require('should') var weak = require('../') function checkFunction (prop) { it('should have a function "' + prop + '"', function () { weak.should.have.property(prop) weak[prop].should.be.a('function') }) } describe('exports', function () { it('should be a function', function () { weak.should.be.a('function') }) checkFunction('get') checkFunction('create') checkFunction('isWeakRef') checkFunction('isNearDeath') checkFunction('isDead') checkFunction('callbacks') checkFunction('addCallback') it('should be a circular reference to "create"', function () { weak.should.equal(weak.create) }) })
/** * Select2 Finnish translation */ (function ($) { "use strict"; $.fn.select2.locales['fi'] = { formatNoMatches: function () { return "Ei tuloksia"; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Ole hyvä ja anna " + n + " merkkiä lisää"; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Ole hyvä ja anna " + n + " merkkiä vähemmän"; }, formatSelectionTooBig: function (limit) { return "Voit valita ainoastaan " + limit + " kpl"; }, formatLoadMore: function (pageNumber) { return "Ladataan lisää tuloksia…"; }, formatSearching: function () { return "Etsitään…"; } }; $.extend($.fn.select2.defaults, $.fn.select2.locales['fi']); })(jQuery);
define( ({ showLayerLabels: "Geef laagnamen weer op de widget voor lagen met tijdfunctionaliteit." }) );
// Valeur de depart pour le calendrier var timestampStart = new Date(2014,0,1,5,0,11,0)/1000; // Valeur de timestamp pour une journee var oneDay = (new Date(2014,0,2,5,0,11,0)/1000)- timestampStart; // Array des timestamp et valeurs pour le heatmap var datas = new Array(); // Initialisation de toutes les valeurs a 0 for (var i = 0; i < 365; i++) { datas[i]= {date: timestampStart + (i*oneDay), value: 0}; }; // retourne une array sur la forme : data[timestamp] = valeur; var parser = function(data) { var stats = {}; for (var d in data) { stats[data[d].date] = data[d].value; } return stats; }; // Premiere ligne du heatmap---------------------------------------------------------------------------------------------------// var heatMapHigher = new CalHeatMap(); heatMapHigher.init({ // Data par defaut data: datas, afterLoadData: parser, // Layout par mois domain: "month", // Sous-domaine par jour subDomain: "x_day", // Seting pour legende legend: [ 2, 3], range: 6, // Color of legend legendColors: { empty: "#C9C9C9", min: "#0000FF", max: "#FFFF00" }, displayLegend: false, tooltip: false, // Start Date start: new Date(2014, 0, 1, 1), }); // Seconde ligne du heatmap---------------------------------------------------------------------------------------------------// var heatMaplower = new CalHeatMap(); heatMaplower.init({ // Data par defaut data: datas, afterLoadData: parser, // Layout par mois domain: "month", // Sous-domaine par jour subDomain: "x_day", // Seting pour legende legend: [ 2, 3], range: 6, // Color of legend legendColors: { empty: "#C9C9C9", min: "#0000FF", max: "#FFFF00" }, legendTitleFormat: { lower: "0 Personnes", inner: "{down} Personnes avec la meme date", upper: "Plus de {max} Personnes avec la meme date" }, tooltip: false, // Start Date start: new Date(2014, 6, 1, 1), }); //--------------------------------------------------------------------------------------------------------------------------------------------------// /* // Add one to the value of the data at a specific index function incrementData (data, index) { data[index] = {date: data[index]["date"], value: data[index]["value"]+1}; return data; } var newData = {}; var randomNumber = 0; for (var i = 0; i < 50; i++) { randomNumber = Math.floor((Math.random() * 366)); newData = parser(incrementData(datas, randomNumber)); setTimeout(setData(heatMaplower,newData), 3000 ); setData(heatMapHigher,newData); }; // setTimeout est non blocante, alors la boucle ne fait que repasser sur elle meme var i = 0; // set your counter to 1 function myLoop () { // create a loop function setTimeout(function () { randomNumber = Math.floor((Math.random() * 366)); newData = parser(incrementData(datas, randomNumber)); setData(heatMaplower,newData); setData(heatMapHigher,newData); i++; // increment the counter if (i < 500) { // if the counter < 50, call the loop function myLoop(); // .. again which will trigger another } // .. setTimeout() }, 500) } myLoop(); // start the loop */
Ext.define('Rd.store.sRadpostauths', { extend: 'Ext.data.Store', model: 'Rd.model.mRadpostauth', //To make it load AJAXly from the server specify the follown 3 attributes buffered: true, leadingBufferZone: 150, pageSize: 50, //To force server side sorting: remoteSort: true, proxy: { type : 'ajax', format : 'json', batchActions: true, url : '/cake2/rd_cake/radpostauths/index.json', reader: { type: 'json', root: 'items', messageProperty: 'message', totalProperty: 'totalCount' //Required for dynamic paging }, api: { // destroy : '/cake2/rd_cake/devices/delete.json' }, simpleSortMode: true //This will only sort on one column (sort) and a direction(dir) value ASC or DESC } });
var gulp = require('gulp'); var mocha = require('gulp-mocha'); gulp.task('test', function() { 'use strict'; return gulp.src('tests/**/*.js') .pipe(mocha()); });
/* Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing */ if(!dojo._hasResource["dojo.rpc.JsonpService"]){ dojo._hasResource["dojo.rpc.JsonpService"]=true; dojo.provide("dojo.rpc.JsonpService"); dojo.require("dojo.rpc.RpcService"); dojo.require("dojo.io.script"); dojo.declare("dojo.rpc.JsonpService",dojo.rpc.RpcService,{constructor:function(_1,_2){ if(this.required){ if(_2){ dojo.mixin(this.required,_2); } dojo.forEach(this.required,function(_3){ if(_3==""||_3==undefined){ throw new Error("Required Service Argument not found: "+_3); } }); } },strictArgChecks:false,bind:function(_4,_5,_6,_7){ var _8=dojo.io.script.get({url:_7||this.serviceUrl,callbackParamName:this.callbackParamName||"callback",content:this.createRequest(_5),timeout:this.timeout,handleAs:"json",preventCache:true}); _8.addCallbacks(this.resultCallback(_6),this.errorCallback(_6)); },createRequest:function(_9){ var _a=(dojo.isArrayLike(_9)&&_9.length==1)?_9[0]:{}; dojo.mixin(_a,this.required); return _a; }}); }
/** * jQuery EasyUI 1.3.5 * * Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved. * * Licensed under the GPL or commercial licenses * To use it on other terms please contact us: info@jeasyui.com * http://www.gnu.org/licenses/gpl.txt * http://www.jeasyui.com/license_commercial.php * */ (function ($) { function _1(_2) { var cp = document.createElement("div"); while (_2.firstChild) { cp.appendChild(_2.firstChild); } _2.appendChild(cp); var _3 = $(cp); _3.attr("style", $(_2).attr("style")); $(_2).removeAttr("style").css("overflow", "hidden"); _3.panel({border: false, doSize: false, bodyCls: "dialog-content"}); return _3; }; function _4(_5) { var _6 = $.data(_5, "dialog").options; var _7 = $.data(_5, "dialog").contentPanel; if (_6.toolbar) { if ($.isArray(_6.toolbar)) { $(_5).find("div.dialog-toolbar").remove(); var _8 = $("<div class=\"dialog-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_5); var tr = _8.find("tr"); for (var i = 0; i < _6.toolbar.length; i++) { var _9 = _6.toolbar[i]; if (_9 == "-") { $("<td><div class=\"dialog-tool-separator\"></div></td>").appendTo(tr); } else { var td = $("<td></td>").appendTo(tr); var _a = $("<a href=\"javascript:void(0)\"></a>").appendTo(td); _a[0].onclick = eval(_9.handler || function () { }); _a.linkbutton($.extend({}, _9, {plain: true})); } } } else { $(_6.toolbar).addClass("dialog-toolbar").prependTo(_5); $(_6.toolbar).show(); } } else { $(_5).find("div.dialog-toolbar").remove(); } if (_6.buttons) { if ($.isArray(_6.buttons)) { $(_5).find("div.dialog-button").remove(); var _b = $("<div class=\"dialog-button\"></div>").appendTo(_5); for (var i = 0; i < _6.buttons.length; i++) { var p = _6.buttons[i]; var _c = $("<a href=\"javascript:void(0)\"></a>").appendTo(_b); if (p.handler) { _c[0].onclick = p.handler; } _c.linkbutton(p); } } else { $(_6.buttons).addClass("dialog-button").appendTo(_5); $(_6.buttons).show(); } } else { $(_5).find("div.dialog-button").remove(); } var _d = _6.href; var _e = _6.content; _6.href = null; _6.content = null; _7.panel({closed: _6.closed, cache: _6.cache, href: _d, content: _e, onLoad: function () { if (_6.height == "auto") { $(_5).window("resize"); } _6.onLoad.apply(_5, arguments); }}); $(_5).window($.extend({}, _6, {onOpen: function () { if (_7.panel("options").closed) { _7.panel("open"); } if (_6.onOpen) { _6.onOpen.call(_5); } }, onResize: function (_f, _10) { var _11 = $(_5); _7.panel("panel").show(); _7.panel("resize", {width: _11.width(), height: (_10 == "auto") ? "auto" : _11.height() - _11.children("div.dialog-toolbar")._outerHeight() - _11.children("div.dialog-button")._outerHeight()}); if (_6.onResize) { _6.onResize.call(_5, _f, _10); } }})); _6.href = _d; _6.content = _e; }; function _12(_13, _14) { var _15 = $.data(_13, "dialog").contentPanel; _15.panel("refresh", _14); }; $.fn.dialog = function (_16, _17) { if (typeof _16 == "string") { var _18 = $.fn.dialog.methods[_16]; if (_18) { return _18(this, _17); } else { return this.window(_16, _17); } } _16 = _16 || {}; return this.each(function () { var _19 = $.data(this, "dialog"); if (_19) { $.extend(_19.options, _16); } else { $.data(this, "dialog", {options: $.extend({}, $.fn.dialog.defaults, $.fn.dialog.parseOptions(this), _16), contentPanel: _1(this)}); } _4(this); }); }; $.fn.dialog.methods = {options: function (jq) { var _1a = $.data(jq[0], "dialog").options; var _1b = jq.panel("options"); $.extend(_1a, {closed: _1b.closed, collapsed: _1b.collapsed, minimized: _1b.minimized, maximized: _1b.maximized}); var _1c = $.data(jq[0], "dialog").contentPanel; return _1a; }, dialog: function (jq) { return jq.window("window"); }, refresh: function (jq, _1d) { return jq.each(function () { _12(this, _1d); }); }}; $.fn.dialog.parseOptions = function (_1e) { return $.extend({}, $.fn.window.parseOptions(_1e), $.parser.parseOptions(_1e, ["toolbar", "buttons"])); }; $.fn.dialog.defaults = $.extend({}, $.fn.window.defaults, {title: "New Dialog", collapsible: false, minimizable: false, maximizable: false, resizable: false, toolbar: null, buttons: null}); })(jQuery);
var utils = require('utils'), casper = require('casper').create({ logLevel: 'info', waitTimeout: 18000, pageSettings: { webSecurityEnabled: false, loadImages: true, loadPlugins: false } }), startUrl = casper.cli.options.url; casper.start(startUrl); casper.waitFor(function() { return casper.evaluate(function() { return !$('#loading').is(':visible') && !$('#overlay').is(':visible') && $('#search-btn').is(':visible'); }); }, undefined, function(){ casper.exit(151);});casper.waitFor(function() { return casper.evaluate(function() { return $('#departure-airport>option').size()>0 && $('#arrival-airport>option').size()>0; }); }, undefined, function(){ casper.exit(152);});casper.waitFor(function() { return casper.evaluate(function() { var d = new Date(); var str = ((d.getDate()+'').length == 1 ? '0'+d.getDate() : d.getDate()) +'/'+(d.getMonth()+1)+'/'+d.getFullYear() ; return $('#date').val() == str; }); }, undefined, function(){ casper.exit(153);});casper.run(function() { casper.exit(0); });
$(document).ready(function () { const table = $('#resultsTable').DataTable({ pageLength: $('#navbar').data('defaultpagesize'), ajax: function (data, callback, settings) { const params = {} if ($('#id_summary').val()) { params.summary__icontains = $('#id_summary').val() } if ($('#id_product').val()) { params.product = $('#id_product').val() }; if ($('#id_version').val()) { params.version = $('#id_version').val() }; if ($('#id_build').val()) { params.build = $('#id_build').val() }; if ($('#id_reporter').val()) { params.reporter__username__startswith = $('#id_reporter').val() }; if ($('#id_assignee').val()) { params.assignee__username__startswith = $('#id_assignee').val() }; if ($('#id_before').val()) { params.created_at__lte = $('#id_before').data('DateTimePicker').date().format('YYYY-MM-DD 23:59:59') } if ($('#id_after').val()) { params.created_at__gte = $('#id_after').data('DateTimePicker').date().format('YYYY-MM-DD 00:00:00') } params.status = $('#id_status').is(':checked') dataTableJsonRPC('Bug.filter', params, callback) }, columns: [ { data: 'pk' }, { data: null, render: function (data, type, full, meta) { return '<a href="/bugs/' + data.pk + '/" target="_parent">' + escapeHTML(data.summary) + '</a>' } }, { data: 'created_at' }, { data: 'product__name' }, { data: 'version__value' }, { data: 'build__name' }, { data: 'reporter__username' }, { data: 'assignee__username' } ], dom: 't', language: { loadingRecords: '<div class="spinner spinner-lg"></div>', processing: '<div class="spinner spinner-lg"></div>', zeroRecords: 'No records found' }, order: [[0, 'asc']] }) hookIntoPagination('#resultsTable', table) $('#btn_search').click(function () { table.ajax.reload() return false // so we don't actually send the form }) $('#id_product').change(function () { updateVersionSelectFromProduct() }) $('#id_version').change(function () { updateBuildSelectFromVersion(true) }) $('.bootstrap-switch').bootstrapSwitch() $('.selectpicker').selectpicker() })
// UsingProxyClass.js // The Web service default color. var defaultRgb; // The proxy class instance. var proxyInstance; // The page feedback display element. var displayResult; // This function intializes the global variables and // assigns default values to the generated proxy. function pageLoad() { // Get page feedback display element. displayResult = document.getElementById("ResultId"); // Assign default values to the generated proxy. //Sys.Net.UsingProxyClass.UsingProxyClass.set_timeout(200); Sys.Net.UsingProxyClass.UsingProxyClass.set_defaultUserContext("Default context"); Sys.Net.UsingProxyClass.UsingProxyClass.set_defaultSucceededCallback(SucceededCallback); Sys.Net.UsingProxyClass.UsingProxyClass.set_defaultFailedCallback(FailedCallback); } // This function shows how to get // a server object. function GetDefaultColor() { // Gets the default color obiect. Sys.Net.UsingProxyClass.UsingProxyClass.GetDefaultColor(); } // This function shows how to instantiate // the proxy class to assign its default values. function SetColor() { // Instantiate a color object. var color = new Sys.Net.UsingProxyClass.ColorObject(); // Define a color array (blue). var colorArray = new Array("00", "00", "FF"); // Assign the new values to the server color object. color.message = "The new color is Blue"; color.rgb = colorArray; // Assign default values for the generated proxy using // a proxy instance. proxyInstance = new Sys.Net.UsingProxyClass.UsingProxyClass(); proxyInstance.set_timeout(1000); proxyInstance.set_defaultUserContext("New context"); proxyInstance.set_defaultSucceededCallback(SucceededCallback); proxyInstance.set_defaultFailedCallback(FailedCallback); // Set the default color object. proxyInstance.SetColor(color); } // Callback function invoked when the call to // the Web service methods succeeds. function SucceededCallback(result, userContext, methodName) { var message; switch(methodName) { case ("GetDefaultColor"): case ("SetColor"): { // Get the server default color. message = result.message; defaultRgb = result.rgb; // Transform the rgb array into a string. var serverColor = defaultRgb[0]+ defaultRgb[1] + defaultRgb[2]; // Display the result. displayResult.style.color = "yellow"; displayResult.style.fontWeight = "bold"; displayResult.style.backgroundColor = "#" + serverColor; DisplayMessage(message); break; } default: { DisplayMessage("Method unknown"); } } } // Callback function invoked when the call to // the Web service methods fails. function FailedCallback(error, userContext, methodName) { if(error !== null) { displayResult.innerHTML = "An error occurred: " + error.get_message(); } } function DisplayMessage(message) { if (document.all) displayResult.innerText = message; else // Firefox displayResult.textContent = message; } if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
module.exports = function(grunt) { grunt.initConfig({ pkg: {}, handlebars: { compile: { options: { namespace: 'joint.templates.halo', processName: function(filePath) { // input: templates/handle.html var pieces = filePath.split('/'); return pieces[pieces.length - 1]; // output: handle.html } }, files: { 'dist/template.js': ['templates/*'] } } }, watch: { files: ['*.html'], tasks: ['handlebars'] }, copy: { dist: { files: [ { src: 'joint.ui.Halo.js', dest: 'dist/joint.ui.Halo.js' }, { src: 'lib/handlebars.js', dest: 'dist/handlebars.js' } ] } }, imageEmbed: { // Convert images to data-uris for the Halo ui plugin. dist: { src: [ 'halo.css' ], dest: 'dist/halo.css', options: { deleteAfterEncoding : false } } } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-handlebars'); grunt.loadNpmTasks("grunt-image-embed"); grunt.loadNpmTasks("grunt-contrib-copy"); // Default task(s). grunt.registerTask('default', ['handlebars', 'imageEmbed', 'copy']); };
const logger = require('tracer').colorConsole() exports.up = function(knex, Promise) { return Promise.all([ knex.schema.hasTable('messages').then((exists) => { if(!exists) { return knex.schema.createTable('messages', (table) => { table.increments() table.integer('discussion_id').unsigned().references('discussions.id') table.integer('user_id').unsigned().references('users.id') table.text('message') table.timestamp('created_at').defaultTo(knex.fn.now()) table.timestamp('updated_at').defaultTo(knex.fn.now()) }) .then(() => logger.info('MESSAGES table has been created')) } }) ]) } exports.down = function(knex, Promise) { return Promise.all([ knex.schema.dropTable('messages') ]) }
'use strict'; let autoprefixer = require('autoprefixer') , browserSync = require('browser-sync') , cssnano = require('cssnano') , gulp = require('gulp') , babel = require('gulp-babel') , eslint = require('gulp-eslint') , nodemon = require('gulp-nodemon') , notify = require('gulp-notify') , postcss = require('gulp-postcss') , rename = require('gulp-rename') , sass = require('gulp-sass') , uglify = require('gulp-uglify') ; const PROCESSORS = [ autoprefixer({browser: ['last 3 versions']}), cssnano({autoprefixer: false}) ]; const BROWSER_SYNC_RELOAD_DELAY = 500; gulp.task('bs-reload', () => { browserSync.reload(); }); gulp.task('sass', () => { return gulp.src('src/sass/**/*.scss') .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) .pipe(postcss(PROCESSORS)) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('dist/css')) .pipe(browserSync.stream()) .pipe(notify({ message: 'Sass compiled to CSS' })) ; }); gulp.task('js', () => { return gulp.src('src/js/**/*.js') .pipe(eslint()) .pipe(eslint.formatEach()).on('error', function(err) { console.log('Lint'); } ) .pipe(babel()) .pipe(gulp.dest('dist/js')) .pipe(uglify()) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('dist/js')) .pipe(browserSync.stream()) .pipe(notify({ message: 'Javascript compiled successfully.' })) ; }); gulp.task('nodemon', (callback) => { let called = false; return nodemon({ script: 'index.js' , watch: ['index.js'] , env: { 'NODE_ENV': 'development' } }).on('start', function() { if (!called) callback(); called = true; }).on('restart', function() { setTimeout(function() { browserSync.reload({stream: false}); }, BROWSER_SYNC_RELOAD_DELAY); }); }); gulp.task('browser-sync', ['nodemon'], () => { browserSync.init({ proxy: 'http://localhost:5000', port: 4000, injectChanges: true, open: false }); }); gulp.task('default', ['browser-sync'], () => { gulp.watch('src/**/*.js', ['js']); gulp.watch('src/**/*.scss', ['sass']); gulp.watch('test/**/*.html', ['bs-reload']); });
import React, { PropTypes, Component } from 'react'; import { View } from 'react-native'; import _ from 'lodash'; import ContactMethodBox from './ContactMethodBox'; import AddItemButton from '../SharedComponents/AddItemButton'; class ContactMethods extends Component { constructor() { super(); this.onMethodAdded = this.onMethodAdded.bind(this); this.state = { addingNewMethod: false }; } onAddNewMethod() { this.setState({ addingNewMethod: true }); } onMethodAdded() { this.setState({ addingNewMethod: false }); } render() { const props = this.props; const contact = props.contact; const contactMethods = _.map(contact.contactMethods, (contactMethod, index) => ( <View key={index} > <ContactMethodBox contactId={contact.id} contactMethod={contactMethod} onContactMethodUpdate={this.props.onContactMethodUpdate} /> </View> ) ); return ( <View> {contactMethods} {this.state.addingNewMethod ? <ContactMethodBox isEditing contactId={contact.id} onCloseEdit={this.onMethodAdded} onContactMethodUpdate={this.props.onContactMethodUpdate} contactMethod={{ id: contactMethods.length }} /> : <AddItemButton onPress={() => this.onAddNewMethod()} text="add contact method" /> } </View> ); } } ContactMethods.propTypes = { contact: PropTypes.object.isRequired, onContactMethodUpdate: PropTypes.func.isRequired, }; export default ContactMethods;
define([ 'metapolator/errors' ], function( errors ) { "use strict"; var unhandledPromise = errors.unhandledPromise; function MastersImportController($scope, $timeout) { this.$scope = $scope; this.$timeout = $timeout; this.items = []; this.current = null; this.next = this._next.bind(this); this.importProcess.initialized .then(this.next // should not happen because importProcess // should handle this , unhandledPromise ); } MastersImportController.$inject = ['$scope', '$timeout']; var _p = MastersImportController.prototype; _p._next = function() { this._updateItems(); if(!this.current) return; this.$timeout(this.next, 0, false); this.$scope.$apply(); }; _p.cancel = function(fileName) { if(this.current.file === fileName) this.current.cancel = true; else { this.importProcess.cancelScheduled(fileName); this.$scope.$apply(); } }; _p._updateItems = function() { var i, l, item; this.current = this.importProcess.next(this.current ? !this.current.cancel : true/* carryOn */) || null; this.items = []; for(i=0,l=this.importProcess.itemsLength;i<l;i++) { item = this.importProcess.getItem(i); this.items.push(item.file); } this.$scope.$apply(); }; return MastersImportController; });
/** * Module dependencies. */ var settings = require('./settings.js') var sinergisVar = { version: '0.1', appName: 'Sinergis' } var express = require('express') , app = express() , cons = require('consolidate') , http = require('http'); app.sidebarSettings = __dirname + '/sidebar-settings.js'; app.db = function(modelName) { return settings.model(settings.db, modelName); } app.validator = settings.validator; app.configure('development', function(){ var MemStore = express.session.MemoryStore; app.use(express.cookieParser(' default ')); app.use(express.session({secret:' default ', store: MemStore({ reapInterval: 60000 * 10 }) })); app.use(express.errorHandler()); sinergisVar.version += '-devel'; }); app.configure(function(){ app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.engine('html', cons.hogan); app.set('view engine', 'html'); app.use(express.static(__dirname + '/public')); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.set('sinergisVar', sinergisVar); }); var routes = require('./routes')(app) http.createServer(app).listen(app.get('port'), function(){ console.log("Express server listening on port " + app.get('port')); });
HostCMS 6.7 = 75c777a77d3a7173055c95f49bd3e074
// Lazy man's symbols for states exports.REJECTED = ['REJECTED']; exports.FULFILLED = ['FULFILLED']; exports.PENDING = ['PENDING'];
$(document).ready(function() { $('#FormChangePassword').on('submit',function(event) { event.preventDefault() var url = $('#FormChangePassword').attr('action') var data = $(this).serialize() $.ajax({ type : "POST", dataType : "json", url : url, data : data, beforeSend: function(){ $('#submit__button').prop("disabled", true) showLoading(true) clearErrorMessage() }, success: function(data) { if (data.status == false) { if(data.is_error_form_validation) { $.each(data.message, function(key, value){ $('input[name="' + key.replace(".", "_") + '"]').focus(); $("#form--error--message--" + key.replace(".", "_")).text(value) }); } else { pushNotif(data.status, data.message); } } else { resetForm() pushNotif(data.status, data.message); $('#close__button').click(); } }, complete: function(response){ hideLoading() $('#submit__button').prop("disabled", false) } }); }); function clearErrorMessage(){ $(".form--error--message").text('') } function resetForm(){ $("#old_password").val('') $("#new_password").val('') $("#confirm_password").val('') } });
(function () { 'use strict'; angular .module('app') .controller('PortfolioItemCtrl', PortfolioItemCtrl); PortfolioItemCtrl.$inject = ['$scope', 'IMAGES_URL']; function PortfolioItemCtrl ($scope, IMAGES_URL) { $scope.images_url = IMAGES_URL; } })();
/* Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'scayt', 'ro', { btn_about: 'About SCAYT', btn_dictionaries: 'Dictionaries', btn_disable: 'Disable SCAYT', btn_enable: 'Enable SCAYT', btn_langs:'Languages', btn_options: 'Options', text_title: 'Spell Check As You Type' // MISSING });
//* TITLE Themes **// //* VERSION 0.1 REV B **// //* DESCRIPTION Themes for your dashboard **// //* DETAILS This extension allows you to install themes from the XKit Theme Gallery onto your dashboard. New themes are added regularly, and if you are good with CSS, send an ask to xkit-dev.tumblr.com to get your theme added here! **// //* DEVELOPER STUDIOXENIX **// //* FRAME false **// //* BETA false **// XKit.extensions.themes = new Object({ running: false, current_theme: "", gallery_themes_file: new Array(), gallery_themes_contents: new Array(), gallery_themes_version: new Array(), m_theme_count: 0, run: function() { this.running = true; this.current_theme = XKit.storage.get("themes","my_theme",""); if (typeof this.current_theme === "undefined") { this.current_theme = ""; } XKit.tools.init_css("themes"); if(this.current_theme !== "") { if (typeof XKit.extensions.yahoo !== "undefined") { if (XKit.extensions.yahoo.running === true) { return; } } this.load_theme(); } }, cpanel_add: function(obj) { var m_class = ""; if (obj.file === XKit.extensions.themes.current_theme) { m_class = "selected"; } XKit.extensions.themes.gallery_themes_file.push(obj.file); XKit.extensions.themes.gallery_themes_contents.push(obj.contents); XKit.extensions.themes.gallery_themes_version.push(obj.version); var m_html = "<div class=\"xkit-theme-obj " + m_class + "\" data-theme-id=\"" + obj.file + "\">" + "<div class=\"xkit-theme-title\">" + obj.name + "</div>" + "<div class=\"xkit-theme-description\">" + obj.description + "</div>" + "<div class=\"xkit-theme-developer\">by " + obj.developer + "</div>" + "</div>"; $("#xkit-themes-theme-list").append(m_html); XKit.extensions.themes.m_theme_count++; }, replace_all: function(string, find, replace) { find = find.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); return string.replace(new RegExp(find, 'g'), replace); }, load_theme: function() { $("#xkit-themes-user-theme").remove(); var m_file_contents = XKit.storage.get("themes","my_theme_contents",""); m_file_contents = XKit.extensions.themes.replace_all(m_file_contents, "#content", ".l-content"); m_file_contents = XKit.extensions.themes.replace_all(m_file_contents, "#header", ".l-header"); $("body").append("<style id=\"xkit-themes-user-theme\">" + m_file_contents + "</style>"); }, load_gallery_theme: function(theme_name) { // Unload the previous theme if loaded. $("#xkit-themes-user-theme").remove(); XKit.storage.set("themes","my_theme", theme_name); // Stop if default theme. if (theme_name === "") { return; } var m_index = XKit.extensions.themes.gallery_themes_file.indexOf(theme_name); if (m_index === -1) { XKit.storage.set("themes","my_theme",""); alert("Unable to load theme."); return; } XKit.storage.set("themes","my_theme_version", XKit.extensions.themes.gallery_themes_version[m_index]); // Voila! XKit.storage.set("themes","my_theme_contents",XKit.extensions.themes.gallery_themes_contents[m_index]); //$("body").append("<style id=\"xkit-themes-user-theme\">" + XKit.extensions.themes.gallery_themes_contents[m_index] + "</style>"); XKit.extensions.themes.load_theme(); }, cpanel: function(obj) { if (typeof XKit.extensions.yahoo !== "undefined") { if (XKit.extensions.yahoo.running === true) { var m_html = "<div id=\"xkit-themes-loading\"><b>Yoohoo is on</b><br/><small>Please disable the \"Yoohoo!\" before running this extension.</small></div>"; $(obj).html(m_html); return; } } var m_html = "<div id=\"xkit-themes-loading\"><b>Loading theme gallery</b><br/><small>Please wait, I'm fetching the latest themes for you.</small></div>"; $(obj).html(m_html); $("#xkit-extensions-panel-right").nanoScroller(); $("#xkit-extensions-panel-right").nanoScroller({ scroll: 'top' }); XKit.download.page("themes/index.php", function(mdata) { if (mdata.server_down === true) { $("#xkit-themes-loading").html("<b>Server unreachable</b><br/><small>Please try again later.</small>"); return; } $("#xkit-themes-loading").remove(); XKit.extensions.themes.m_theme_count = 0; $(obj).html("<div id=\"xkit-themes-theme-list\"></div>"); // Create default theme object: var def_theme = new Object(); def_theme.name = "Tumblr Default"; def_theme.version = "1"; def_theme.developer = "Tumblr, Inc."; def_theme.file = ""; def_theme.description = "The standard Tumblr theme"; XKit.extensions.themes.cpanel_add(def_theme); for(var theme in mdata.themes) { XKit.extensions.themes.cpanel_add(mdata.themes[theme]); } $(".xkit-theme-obj").click(function() { if ($(this).hasClass("selected") === true) { return; } $(".xkit-theme-obj.selected").removeClass("selected"); XKit.extensions.themes.load_gallery_theme($(this).attr('data-theme-id')); $(this).addClass("selected"); }); if (XKit.extensions.themes.m_theme_count >= 3) { $(".xkit-theme-obj:last-child").css("border-bottom","0"); } $("#xkit-extensions-panel-right").nanoScroller(); $("#xkit-extensions-panel-right").nanoScroller({ scroll: 'top' }); }); }, destroy: function() { XKit.tools.remove_css("themes"); $("#xkit-themes-user-theme").remove(); this.running = false; } });
/* vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 cc=80; */ /** * @package omeka * @subpackage neatline * @copyright 2012 Rector and Board of Visitors, University of Virginia * @license http://www.apache.org/licenses/LICENSE-2.0.html */ Neatline.module('Editor.Exhibit.Search', function(Search) { Search.Controller = Neatline.Shared.Controller.extend({ slug: 'EDITOR:EXHIBIT:SEARCH', events: [ { 'MAP:ingest': 'mirror' } ], commands: [ 'display', 'hydrate', 'execute', 'mirror' ], requests: [ 'getQueryForUrl' ], /** * Create the view. */ init: function() { this.view = new Search.View(); }, /** * Append the form to the editor container. * * @param {Object} container: The container element. */ display: function(container) { this.view.showIn(container); }, /** * Populate the record list from route parameters. * * @param {String} query: The search query. * @param {Number} start: The paging offset. */ hydrate: function(query, start) { this.view.setQueryFromUrl(query); this.execute(start); }, /** * Perform the query current search query. * * @param {Number} start: The paging offset. */ execute: function(start) { // Apply map mirroring. if (this.view.mirroring) this.mirror(); else { // Merge route parameters into query. var params = _.extend(this.view.query, { limit: Neatline.g.neatline.per_page, start: start || 0 }); // Load the list of records. Neatline.execute('EDITOR:EXHIBIT:RECORDS:load', params); } }, /** * If mirroring is enabled, show map records in the browser. * * @param {Object} records: The records on the map. */ mirror: function(records) { // Break if not mirroring. if (!this.view.mirroring) return; // Display the map collection in the browser. records = records || Neatline.request('MAP:getRecords') Neatline.execute('EDITOR:EXHIBIT:RECORDS:ingest', records); }, /** * Get the current query as a route parameter. * * @return {String}: The query. */ getQueryForUrl: function() { return this.view.getQueryForUrl(); } }); });
'use strict'; define(['lodash'], function(_) { var dependencies = [ '$stateParams', 'NetworkMetaAnalysisService' ]; var ContrastEvidenceTable = function( $stateParams, NetworkMetaAnalysisService ) { return { restrict: 'E', templateUrl: './contrastEvidenceTableDirective.html', scope: { rows: '=', editMode: '=', studies: '=', analysis: '=', project: '=' }, link: function(scope) { scope.doesInterventionHaveAmbiguousArms = doesInterventionHaveAmbiguousArms; scope.changeArmExclusion = changeArmExclusion; scope.changeMeasurementMoment = changeMeasurementMoment; scope.$watch('rows', refreshStuff); scope.userId = Number($stateParams.userUid); function refreshStuff(newValue) { if (newValue) { scope.momentSelections = NetworkMetaAnalysisService.buildMomentSelections(scope.studies, scope.analysis); scope.missingValuesByStudy = NetworkMetaAnalysisService.buildMissingValueByStudy(scope.rows, scope.momentSelections); scope.referenceArms = NetworkMetaAnalysisService.getReferenceArms(scope.rows); } } function doesInterventionHaveAmbiguousArms(interventionId, studyUri) { return NetworkMetaAnalysisService.doesInterventionHaveAmbiguousArms(interventionId, studyUri, scope.studies, scope.analysis); } function changeArmExclusion(row) { scope.analysis = NetworkMetaAnalysisService.changeArmExclusion(row, scope.analysis); scope.$emit('armExclusionChanged'); } function changeMeasurementMoment(newMeasurementMoment, row) { // always remove old inclusion for this study scope.analysis.includedMeasurementMoments = _.reject(scope.analysis.includedMeasurementMoments, ['study', row.studyUri]); if (!newMeasurementMoment.isDefault) { var newInclusion = { analysisId: scope.analysis.id, study: row.studyUri, measurementMoment: newMeasurementMoment.uri }; scope.analysis.includedMeasurementMoments.push(newInclusion); } scope.$emit('saveAnalysisAndReload'); } } }; }; return dependencies.concat(ContrastEvidenceTable); });
const chai = require('chai'); const assert = chai.assert; suite('Unit testing', () => { suite('', () => { test('', (done) => { done(); }); }) });
var _ = require('@sailshq/lodash'); // Create the customized merge function. var merge = function(dictA, dictB) { return _.merge(dictA, dictB, function(a, b) { // If `a` is not a POJO, or it's an empty POJO, just replace it with `b`. // _.isPlainObject is fine here because we don't care about clobbering dictionaries that // came from custom constructors; our use case is merging config files together, so any // left-hand values should either be literals, POJOS or `undefined`. if (!_.isPlainObject(a) || _.keys(a).length === 0) { return b; } // For non-empty dictionaries (POJO or otherwise), use the default merge strategy. }); }; // Allow variadic usage. // e.g. mergeDictionarys(dictOne, dictTwo, dictThree, dictFour, ...) module.exports = function() { // Special case: if only one arg is provided, just return it. if (arguments.length === 1) { return arguments[0]; } // Otherwise use `_.reduce` to merge arguments from left to right. var args = Array.prototype.slice.call(arguments); var firstArg = args.shift(); return _.reduce(args, function(memo, arg) { return merge(memo, arg); }, firstArg); };
// LICENCE https://github.com/adaptlearning/adapt_authoring/blob/master/LICENSE define(function(require) { var Backbone = require('backbone'); var Origin = require('core/origin'); var SidebarItemView = require('modules/sidebar/views/sidebarItemView'); var EditorThemingSidebarView = SidebarItemView.extend({ events: { 'click .editor-theming-sidebar-save': 'saveEditing', 'click .editor-theming-sidebar-savePreset': 'savePreset', 'click .editor-theming-sidebar-reset': 'reset', 'click .editor-theming-sidebar-cancel': 'cancelEditing' }, initialize: function() { SidebarItemView.prototype.initialize.apply(this, arguments); this.listenTo(Origin, 'theming:showPresetButton', this.showPresetButton); }, showPresetButton: function(show) { var btn = this.$('.editor-theming-sidebar-savePreset'); if (show) { btn.show(); } else { btn.hide(); } }, saveEditing: function(event) { event && event.preventDefault(); this.updateButton('.editor-theming-sidebar-save', Origin.l10n.t('app.saving')); Origin.trigger('editorThemingSidebar:views:save'); }, savePreset: function(event) { event && event.preventDefault(); Origin.trigger('editorThemingSidebar:views:savePreset'); }, reset: function(event) { event && event.preventDefault(); Origin.trigger('editorThemingSidebar:views:resetToPreset'); }, cancelEditing: function(event) { event && event.preventDefault(); Origin.trigger('editorThemingSidebar:views:cancel'); Backbone.history.history.back(); Origin.trigger('editingOverlay:views:hide'); } }, { template: 'editorThemingSidebar' }); return EditorThemingSidebarView; });
/** * @prettier */ const { assert, itMacro, beforeEachMacro, describeMacro, lintHTML } = require('./utils'); const jsdom = require('jsdom'); const locales = { 'en-US': { ResourcesURI: 'Resources and URIs' }, es: { ResourcesURI: 'Recursons y URIs' } }; function checkSidebarDom(dom, locale) { let section = dom.querySelector('section'); assert( section.classList.contains('Quick_links'), 'Section does not contain Quick_links class' ); let summaries = dom.querySelectorAll('summary'); assert.equal(summaries[0].textContent, locales[locale].ResourcesURI); } describeMacro('HTTPSidebar', function() { beforeEachMacro(function(macro) { macro.ctx.env.path = '/en-US/docs/Web/HTTP/Overview'; }); itMacro('Creates a sidebar object for en-US', function(macro) { macro.ctx.env.locale = 'en-US'; return macro.call().then(function(result) { expect(lintHTML(result)).toBeFalsy(); let dom = jsdom.JSDOM.fragment(result); checkSidebarDom(dom, 'en-US'); }); }); itMacro('Creates a sidebar object for es', function(macro) { macro.ctx.env.locale = 'es'; return macro.call().then(function(result) { expect(lintHTML(result)).toBeFalsy(); let dom = jsdom.JSDOM.fragment(result); checkSidebarDom(dom, 'es'); }); }); });
import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent('css-var', 'helper:css-var', { integration: true, }); // Replace this with your real tests. test("it renders nothing if the variable doesn't exist", function(assert) { this.set('inputValue', '1234'); this.render(hbs`{{css-var inputValue}}`); assert.equal( this.$() .text() .trim(), '' ); }); test("it renders a default if the variable doesn't exist", function(assert) { this.set('inputValue', '1234'); this.render(hbs`{{css-var inputValue 'none'}}`); assert.equal( this.$() .text() .trim(), 'none' ); });
/** * @module viewmodels/Field */ 'use strict'; var ko = require('knockout'); /** * Creates an observable with an error observable string. * The error string is reset whenever the value of the field changes. * * @class **/ var Field = function() { var obs = ko.observable(''); obs.error = ko.observable(''); // Reset error after a change: obs.subscribe(function() { obs.error(''); }); return obs; }; module.exports = Field;
// // Deploy - Continuous Delivery, Faster // Copyright (C) 2016 by David Edmonds // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // import log4js from 'log4js'; export const logger = log4js.getLogger();
#!/usr/bin/env node require("babel-core/register"); require("./src/server");
$(document).ready(function () { if (!config.isLoggedIn) $('body').addClass('isAnonymous') $('.supported-file-formats').click(function (e) { e.preventDefault() $('.supported-formats').show() }) $('.close, .grayed').click(function (e) { e.preventDefault() $('.grayed').fadeOut() $('.popup').fadeOut('fast') }) $('#deselectMultilang').click(function (e) { e.preventDefault() $('.listlang li.on input[type=checkbox]').click() }) $('#swaplang').click(function (e) { e.preventDefault() var src = $('#source-lang').dropdown('get value') var trg = $('#target-lang').dropdown('get value') if (trg.split(',').length > 1) { APP.alert({ msg: 'Cannot swap languages when <br>multiple target languages are selected!', }) return false } $('#source-lang').dropdown('set selected', trg) $('#target-lang').dropdown('set selected', src) APP.changeTargetLang(src) if ($('.template-download').length) { if (UI.conversionsAreToRestart()) { APP.confirm({ msg: 'Source language changed. The files must be reimported.', callback: 'confirmRestartConversions', }) } } else if ($('.template-gdrive').length) { APP.confirm({ msg: 'Source language has been changed.<br/>The files will be reimported.', callback: 'confirmGDriveRestartConversions', }) } }) })
const Base64Option = { Base64Encoding: 0, Base64UrlEncoding: 1, KeepTrailingEquals: 0, OmitTrailingEquals: 2, } const SortOrder = { AscendingOrder: 0, DescendingOrder: 1, } const ResizeMode = { Interactive: 0, Stretch: 1, Fixed: 2, ResizeToContents: 3, Custom: 2, } const NetworkReplyError = { Ok: 0, UnsupportedScheme: 1, Connection: 2, Connection400: 3, Connection401: 4, Connection403: 5, Connection404: 6, Connection4XX: 7, Connection5XX: 8, FileTooLarge: 9, Download: 10, Aborted: 11, } const PagesMode = { Single: 0, Multi : 1, List: 2, } const CompleterMode = { None: 0, Continuous: 1, All: 2, } const ItemDataRole = { UserRole: 0x0100, } %1 (() => { return { getInfo: getInfo, prepareWidget: prepareWidget, finalize: finalize, getQMPlay2Url: getQMPlay2Url, getSearchReply: getSearchReply, addSearchResults: addSearchResults, pagesMode: pagesMode, getPagesList: getPagesList, hasWebpage: hasWebpage, getWebpageUrl: getWebpageUrl, completerMode: completerMode, getCompleterReply: getCompleterReply, getCompletions: getCompletions, completerListCallbackSet: completerListCallbackSet, hasAction: hasAction, convertAddress: convertAddress, }})()
var class_pre_render_callback = [ [ "callback", "class_pre_render_callback.html#a5d91bce906bcbac5a85c350dbaaa2c81", null ] ];
MultiViewPresentationModel = function() { this.selectionField = new br.presenter.node.SelectionField(['a','b', 'c'], "b"); this.selectionField.controlName.setValue("aSelectionField"); this.multiSelectField = new br.presenter.node.MultiSelectionField(["A","B","C"], ["A","C"]); this.multiSelectField.controlName.setValue("aMultiSelectionField"); }; br.Core.extend(MultiViewPresentationModel, br.presenter.PresentationModel);
'use strict'; import * as angular from 'angular'; import { TaskExecutor } from '@spinnaker/core'; describe('Controller: modifyScalingProcesses', function () { beforeEach(window.module(require('./modifyScalingProcesses.controller').name)); beforeEach( window.inject(function ($controller, $rootScope, $q) { this.$uibModalInstance = { close: angular.noop, result: { then: angular.noop } }; this.$scope = $rootScope.$new(); this.initializeController = function (serverGroup, processes) { this.processes = processes; spyOn(TaskExecutor, 'executeTask').and.returnValue($q.when(null)); this.controller = $controller('ModifyScalingProcessesCtrl', { $scope: this.$scope, serverGroup: serverGroup, processes: this.processes, application: { serverGroups: { refresh: angular.noop } }, $uibModalInstance: this.$uibModalInstance, }); }; }), ); describe('isDirty', function () { beforeEach(function () { this.serverGroup = { name: 'the-asg' }; this.processes = [ { name: 'Launch', enabled: true }, { name: 'Terminate', enabled: true }, ]; }); it('starts as not dirty', function () { this.initializeController(this.serverGroup, this.processes); expect(this.controller.isDirty()).toBe(false); }); it('becomes dirty when a process is changed, becomes clean when the process is changed back', function () { this.initializeController(this.serverGroup, this.processes); expect(this.controller.isDirty()).toBe(false); this.$scope.command[0].enabled = false; expect(this.controller.isDirty()).toBe(true); this.$scope.command[1].enabled = false; expect(this.controller.isDirty()).toBe(true); this.$scope.command[0].enabled = true; expect(this.controller.isDirty()).toBe(true); this.$scope.command[1].enabled = true; expect(this.controller.isDirty()).toBe(false); }); }); describe('form submission', function () { beforeEach(function () { this.serverGroup = { name: 'the-asg', region: 'us-east-1', account: 'test' }; this.processes = [ { name: 'Launch', enabled: true }, { name: 'Terminate', enabled: true }, { name: 'AddToLoadBalancer', enabled: false }, ]; }); it('sends a resume job when processes are enabled', function () { this.initializeController(this.serverGroup, this.processes); this.$scope.command[2].enabled = true; this.controller.submit(); var job = TaskExecutor.executeTask.calls.mostRecent().args[0].job; expect(job.length).toBe(1); expect(job[0].action).toBe('resume'); expect(job[0].processes).toEqual(['AddToLoadBalancer']); }); it('sends a suspend job when processes are enabled', function () { this.initializeController(this.serverGroup, this.processes); this.$scope.command[1].enabled = false; this.controller.submit(); var job = TaskExecutor.executeTask.calls.mostRecent().args[0].job; expect(job.length).toBe(1); expect(job[0].action).toBe('suspend'); expect(job[0].processes).toEqual(['Terminate']); }); it('sends both a resume and suspend job when processes are enabled', function () { this.initializeController(this.serverGroup, this.processes); this.$scope.command[0].enabled = false; this.$scope.command[2].enabled = true; this.controller.submit(); var job = TaskExecutor.executeTask.calls.mostRecent().args[0].job; expect(job.length).toBe(2); expect(job[0].action).toBe('resume'); expect(job[0].processes).toEqual(['AddToLoadBalancer']); expect(job[1].action).toBe('suspend'); expect(job[1].processes).toEqual(['Launch']); }); }); });
//// [templateStringInFunctionExpression.ts] var x = function y() { `abc${ 0 }def` return `abc${ 0 }def`; }; //// [templateStringInFunctionExpression.js] var x = function y() { "abc".concat(0, "def"); return "abc".concat(0, "def"); };
'use strict'; angular.module("openshiftConsole") .directive("editLink", function ($modal, Logger) { return { restrict: "E", scope: { resource: "=", kind: "@", alerts: "=?" }, templateUrl: "views/directives/edit-link.html", // Replace so ".dropdown-menu > li > a" styles are applied. replace: true, link: function(scope) { scope.openEditModal = function() { // Clear any previous edit success message to avoid confusion if the edit is cancelled if (scope.alerts) { delete scope.alerts['edit-yaml']; } var modalInstance = $modal.open({ animation: true, templateUrl: 'views/modals/edit-resource.html', controller: 'EditModalController', scope: scope, size: 'lg', backdrop: 'static' // don't close modal and lose edits when clicking backdrop }); modalInstance.result.then(function(result) { if (scope.alerts) { switch (result) { case 'no-changes': scope.alerts['edit-yaml'] = { type: "warning", message: "There were no changes to " + scope.resource.metadata.name + " to save. Edit cancelled." }; break; case 'save': scope.alerts['edit-yaml'] = { type: "success", message: scope.resource.metadata.name + " was updated." }; break; default: Logger.warn('Unknown edit modal result: ' + result); } } }); }; } }; });
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var App = require('app'); /** * Create custom styled checkbox with appropriate bindings and HTML template. * You can specify <code><label></code> text with <code>label</code> property, or pass I18n translation key * to <code>labelTranslate</code> property. Checkbox specific attributes can be bound in the same way as * for Ember.Checkbox <code>checked</code>, <code>disabled</code>. * Additional class names can be added with <code>labelClassNames</code> and <code>checkboxClassNames</code> * properties. * * @example * Usage: * {{view App.CheckboxView checkedBinding="someBinding" label="someLabel"}} * {{view App.CheckboxView checkedBinding="someBinding" labelTranslate="i18n.translate"}} * {{view App.CheckboxView checkedBinding="someBinding" * labelClassNames="class-1 class-2" * checkboxClassNames="class-3 class-4"}} * * <!-- will append additional markup after <code><label></code> tag * {{#view App.CheckboxView}} * <span>Additional content</span> * {{/view}} * * <!-- custom template --> * {{#view App.CheckboxView isCustomTemplate="true"}} * <!-- any markup here --> * <label {{bindAttr for="view.checkboxId"}}>Left aligned label</label> * <!-- minimal template to display checkbox --> * {{view view.checkboxView}} * {{view view.labelView}} * {{/view}} * @type {Ember.View} */ App.CheckboxView = Em.View.extend({ layoutName: require('templates/common/checkbox'), concatenatedProperties: ['labelClassNames', 'checkboxClassNames'], classNames: ['checkbox'], /** * Checkbox id generated by Ember. Used for <code>for</code> label attribute * @private * @type {String} */ checkboxId: '', /** * When <code>true</code> custom html markup will be used. * @type {Boolean} */ isCustomTemplate: false, /** * Stores checkbox's <code>checked</code> attribute value * @type {Boolean} */ checked: false, /** * Stores checkbox's <code>disabled</code> attribute value * @type {Boolean} */ disabled: false, /** * Label's text * @type {String} */ label: '', /** * Label's i18n code * @type {[type]} */ labelTranslate: null, /** * Checkbox's <code>name</code> attribute value * @type {String} */ name: '', /** * Default class for label element * @type {String[]} */ labelClassNames: ['checkbox-label'], /** * Label's text to display. <code>label</code> property value will be used if no * <code>labelTranslate</code> passed * @return {String} */ labelText: function() { return this.get('labelTranslate') ? Em.I18n.t(this.get('labelTranslate')) : this.get('label'); }.property('label', 'labelTranslate'), /** * Ember checkbox view * @type {Em.View} */ checkboxView: Ember.Checkbox.extend({ attributeBindings: ['name'], checkedBinding: 'parentView.checked', disabledBinding: 'parentView.disabled', nameBinding: 'parentView.name', classNameBindings: 'parentView.checkboxClassNames', didInsertElement: function() { this.set('parentView.checkboxId', this.get('elementId')); this._super(); }, change: function() { if (typeof this.get('parentView.change') === 'function') { this.get('parentView.change').apply(this.get('parentView'), arguments); } } }), /** * Label view * @type {[type]} */ labelView: Em.View.extend({ labelTextBinding: 'parentView.labelText', classNameBindings: 'parentView.labelClassNames', tagName: 'label', attributeBindings: ['for', 'parentView.checked:checked'], 'data-qaBinding': 'parentView.labelIdentifier', template: Em.Handlebars.compile('{{view.labelText}}'), for: Em.computed.alias('parentView.checkboxId') }) });
var args = arguments[0] || {}; var rows = [Ti.UI.createTableViewRow({ title : 'Simple', className : 'simple', objName : 'simple' }), Alloy.createController('tableviewrow_gallery').getView(), Ti.UI.createTableViewRow({ title : 'Simple 2', className : 'simple', objName : 'simple' }), Alloy.createController('tableviewrow', { image : 'http://www.codejobs.biz/www/lib/files/images/b312953ac30ff5d.png' }).getView(), Alloy.createController('tableviewrow_gallery').getView(), Alloy.createController('tableviewrow_gallery').getView(), Alloy.createController('tableviewrow', { image : 'https://cdn2.iconfinder.com/data/icons/ios-7-style-metro-ui-icons/512/Flurry_Google_Android_Market.png' }).getView(), Ti.UI.createTableViewRow({ title : 'Simple3', className : 'simple', objName : 'simple' }), Ti.UI.createTableViewRow({ title : 'Simple4', className : 'simple', objName : 'simple' }), Alloy.createController('tableviewrow_gallery').getView()]; var section = Ti.UI.createTableViewSection(); for (var i = 0, j = rows.length; i < j; i++) { var row = rows[i]; section.add(row); }; $.table.setData([section]); Alloy.Globals.BottomBar.dinamicBottomBar($.table);
/** * Listens for the app launching then creates the window * * @see http://developer.chrome.com/trunk/apps/app.runtime.html * @see http://developer.chrome.com/trunk/apps/app.window.html */ chrome.app.runtime.onLaunched.addListener(function() { chrome.app.window.create('index.html', {frame:"none", bounds: {width: 500, height: 400}}); });
/** * Copyright IBM Corp. 2016, 2018 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { settings } from 'carbon-components'; import cx from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; const { prefix } = settings; const Content = ({ className: customClassName, children, tagName, ...rest }) => { const className = cx(`${prefix}--content`, customClassName); return React.createElement( tagName, { ...rest, className, }, children ); }; Content.propTypes = { /** * Optionally provide a custom class name that is applied to the container */ className: PropTypes.string, /** * Provide children nodes to be rendered in the content container */ children: PropTypes.node, /** * Optionally specify the tag of the content node. Defaults to `main` */ tagName: PropTypes.string, }; Content.defaultProps = { tagName: 'main', }; export default Content;
//>>built define( "dojo/cldr/nls/ki/currency", //begin v1.x content { "CHF_displayName": "Faranga ya Uswisi", "EUR_displayName": "Yuro", "CAD_displayName": "Ndora ya Kananda", "GBP_displayName": "Mbauini cia Ngeretha", "JPY_displayName": "Sarafu ya Kijapani", "AUD_displayName": "Dola ya Australia", "CNY_displayName": "Yuan Renminbi ya China", "USD_displayName": "Ndora cia Amerika" } //end v1.x content );
define( ({ map: { error: "Žemėlapio sukurti nepavyko", views: "peržiūros." }, report: { flag: "Pažymėkite kaip netinkamą", error: "Klaida", success: "Pažymėta", loading: "Įkeliama&hellip;" }, mapNotes:{ notesUnavailable: "Aprašo nėra", bookmarks: "Žymės", zoomTo: "Padidinkite šią vietą ir sužinokite daugiau.", untitledNote: "Bevardis" }, social: { flickr: "Flickr", mediaLayers: "Įvairialypės informacijos sluoksniai", mediaLayersDescription: "Žemėlapyje rodyti visuomenės įvestus duomenis.", flickrSettings: "Flickr nustatymai", twitter: "Twitter", twitterSettings: "Twitter nustatymai", twitterUser: "Twitter paskyra", twitterSignIn: "Prisijungti Twitter", webcams: "Webcams.travel", instagram: "Instagram", instagramSettings: "Instagram nustatymai", igTime: "Nusiųsta per paskutinių dienų skaičių", youtube: "YouTube", youtubeSettings: "YouTube nustatymai", ytSettingsInfo: "Peržiūrėkite vartotojų sukurtus vaizdo įrašus, įskaitant tinklo ir profesionalų turinį.", ytTime: "Nusiųsta per paskutinį laikotarpį", today: "Diena", this_week: "Savaitė", this_month: "Mėnuo", all_time: "Visas laikas", moreInfo: "Daugiau informacijos", searchTerms: "Paieškos terminai", search: "Ieškoti", flSettingsInfo: "Pateikia rezultatus, atitinkančius nuotraukos pavadinimą, aprašą arba raktažodžius.", twSettingsInfo: "Matykite, kas vyksta šiuo metu.", igSettingsInfo: "Instagram – tai spartus, gražus ir smagus būdas informacijai bendrinti su draugais ir šeimos nariais.", advancedOperators: "Patarimas: išplėstines ieškas kurkite naudodami <a target=\"_blank\" href=\"https://support.twitter.com/articles/71577-using-advanced-search\">operatorius</a>", tweetsFilteredBy: "tweet žinutės filtruojamos pagal:", photosFilteredBy: "fotografijos filtruojamos pagal:", videosFilteredBy: "vaizdo įrašai, filtruoti pagal:", twitterAccountStatus: "Įjunkite Twitter sluoksnį savo būsenos matymui." }, general: { map: "Žemėlapis", mapInfo: "Žemėlapio informacija", legend: "Legenda", featured: "Rastos vietos", layers: "Sluoksniai", share: "Bendrinti", about: "Apie", find: "Pašto kodas, miestas, kt.", moreInfo: "Daugiau informacijos", dateModified: "Pakeitimo data", noSearchResult: "Rezultatų nerasta", switchAccount: "Perjungti paskyrą", signIn: "Prisijunkite", settings: "Nuostatos" } }) );
/*! * ${copyright} */ sap.ui.define([ 'sap/ui/fl/Utils', 'sap/ui/fl/changeHandler/Base', 'sap/ui/fl/changeHandler/JsControlTreeModifier' ], function (Utils, Base, JsControlTreeModifier) { "use strict"; /* * Change handler for adding a simple form group. * @alias sap.ui.layout.changeHandler.AddSimpleFormGroup * @author SAP SE * @version ${version} * @experimental Since 1.27.0 */ var AddSimpleFormGroup = {}; AddSimpleFormGroup.CONTENT_AGGREGATION = "content"; var fnFirstGroupWithoutTitle = function(oModifier, aStopToken, aContent) { for (var i = 0; i < aContent.length; i++) { var sType = oModifier.getControlType(aContent[i]); if (aStopToken.indexOf(sType) === -1) { if (aContent[i].getVisible()) { return true; } } else { return false; } } }; var fnMapGroupIndexToContentAggregationIndex = function(oModifier, aStopToken, aContent, iGroupIndex) { var oResult; var iCurrentGroupIndex = -1; // Empty simpleform case, when there are no elements inside the single formContainer if (iGroupIndex === 0) { return iGroupIndex; } if (fnFirstGroupWithoutTitle(oModifier, aStopToken, aContent)) { iCurrentGroupIndex++; } for (var i = 0; i < aContent.length; i++) { var sType = oModifier.getControlType(aContent[i]); if (aStopToken.indexOf(sType) > -1) { iCurrentGroupIndex++; if (iCurrentGroupIndex === iGroupIndex) { oResult = aContent[i]; return aContent.indexOf(oResult); } } } return aContent.length; }; /** * Adds a smart form group. * * @param {sap.ui.fl.Change} oChangeWrapper change wrapper object with instructions to be applied on the control map * @param {sap.ui.layout.SimpleForm} oForm smart form control that matches the change selector for applying the change * @param {object} mPropertyBag * @param {sap.ui.core.UIComponent} mPropertyBag.appComponent component in which the change should be applied * @public */ AddSimpleFormGroup.applyChange = function (oChangeWrapper, oForm, mPropertyBag) { var oModifier = mPropertyBag.modifier; var oView = mPropertyBag.view; var oAppComponent = mPropertyBag.appComponent; var oChange = oChangeWrapper.getDefinition(); if (oChange.texts && oChange.texts.groupLabel && oChange.texts.groupLabel.value && oChange.content && oChange.content.group && (oChange.content.group.selector || oChange.content.group.id)) { var oGroupSelector = oChange.content.group.selector; var sGroupId; if (oGroupSelector) { if (oGroupSelector.idIsLocal) { sGroupId = oAppComponent.createId(oGroupSelector.id); } else { sGroupId = oGroupSelector.id; } } else { sGroupId = oChange.content.group.id; } var sLabelText = oChange.texts.groupLabel.value; var aContent = oModifier.getAggregation(oForm, AddSimpleFormGroup.CONTENT_AGGREGATION); var iInsertIndex; var iRelativeIndex; if (typeof oChange.content.group.index === "number") { // The old code support iInsertIndex = oChange.content.group.index; } else { iRelativeIndex = oChange.content.group.relativeIndex; iInsertIndex = fnMapGroupIndexToContentAggregationIndex(oModifier, ["sap.ui.core.Title", "sap.m.Title", "sap.m.Toolbar", "sap.m.OverflowToolbar"], aContent, iRelativeIndex); } var oTitle = oModifier.createControl("sap.ui.core.Title", oAppComponent, oView, sGroupId); oModifier.setProperty(oTitle, "text", sLabelText); oModifier.insertAggregation(oForm, "content", oTitle, iInsertIndex, oView); } else { Utils.log.error("Change does not contain sufficient information to be applied: [" + oChange.layer + "]" + oChange.namespace + "/" + oChange.fileName + "." + oChange.fileType); //however subsequent changes should be applied } return true; }; /** * Completes the change by adding change handler specific content * * @param {sap.ui.fl.Change} oChangeWrapper change wrapper object to be completed * @param {object} oSpecificChangeInfo with attributes "groupLabel", the group label to be included in the change and "newControlId", the control ID for the control to be added * @param {object} mPropertyBag * @param {sap.ui.core.UIComponent} mPropertyBag.appComponent component in which the change should be applied * @public */ AddSimpleFormGroup.completeChangeContent = function (oChangeWrapper, oSpecificChangeInfo, mPropertyBag) { var oChange = oChangeWrapper.getDefinition(); var oAppComponent = mPropertyBag.appComponent; if (oSpecificChangeInfo.newLabel) { Base.setTextInChange(oChange, "groupLabel", oSpecificChangeInfo.newLabel, "XFLD"); } else { throw new Error("oSpecificChangeInfo.newLabel attribute required"); } if (!oChange.content) { oChange.content = {}; } if (!oChange.content.group) { oChange.content.group = {}; } if (oSpecificChangeInfo.newControlId) { oChange.content.group.selector = JsControlTreeModifier.getSelector(oSpecificChangeInfo.newControlId, oAppComponent); } else { throw new Error("oSpecificChangeInfo.newControlId attribute required"); } if (oSpecificChangeInfo.index === undefined) { throw new Error("oSpecificChangeInfo.index attribute required"); } else { oChange.content.group.relativeIndex = oSpecificChangeInfo.index; } }; /** * Gets the id from the group to be added. * * @param {sap.ui.fl.Change} oChange - addSimpleFormGroup change, which contains the group id within the content * @returns {string} groupId * @public */ AddSimpleFormGroup.getControlIdFromChangeContent = function (oChange) { var sControlId; if (oChange && oChange._oDefinition) { sControlId = oChange._oDefinition.content.group.id; } return sControlId; }; return AddSimpleFormGroup; }, /* bExport= */true);
(function(){ function Fixtures(){ var Fixtures = {}; var albumPicasso = { title: 'The Colors', artist: 'Pablo Picasso', label: 'Cubism', year: '1881', albumArtUrl: '/assets/images/album_covers/01.png', songs: [ { title: 'Blue', duration: '161.71', audioUrl: 'assets/music/blue'}, {title: 'Green', duration: '103.96', audioUrl: 'assets/music/green'}, {title: 'Red', duration: '268.45', audioUrl: 'assets/music/red'}, {title: 'Pink', duration: '153.14', audioUrl: 'assets/music/pink'}, {title: 'Magenta', duration: '374.22', audioUrl: 'assets/music/magenta'} ] }; var albumMarconi = { title: 'The Telephone', artist: 'Gugliermo Marconi', label: 'EM', year: '1989', albumArtUrl: '/assets/images/album_covers/20.png', songs: [ {title: 'Hello, Operator?', duration: '1:01'}, {title: 'Ring, ring, ring', duration: '5:01'}, {title: 'Fits in your pocket' , duration: '3:21'}, {title: 'Can you hear me now?' , duration: '3:14'}, {title: 'Wrong phone number' , duration: '2:15'}, ] }; Fixtures.getAlbum = function(){ return albumPicasso; }; Fixtures.getCollection = function(numberOfAlbums){ var albums = []; for (var i=0;i<numberOfAlbums;i++){ albums.push(albumPicasso); } return albums; }; return Fixtures; }; angular .module('blocJams') .factory('Fixtures', Fixtures); })();
topology().then(function(topo) { var App = React.createClass({ render: function() { return ( <div> <h1>WildFly Swarm Ribbon Example</h1> <Topology /> </div> ); } }); var Topology = React.createClass({ getInitialState: function() { return {data: []}; }, componentDidMount: function() { var component = this; topo.onTopologyChange(function(topology) { component.setState({data: topology}); }); }, render: function() { var services = []; for (var service in this.state.data) { var addresses = this.state.data[service]; services.push( ( <Service service={service} addresses={addresses} key={service} /> ) ); } return ( <div id='topology'> <h2>Service Topology</h2> {services} </div> ); } }); var Service = React.createClass({ render: function() { var addresses = this.props.addresses.map(function(address) { return ( <Address address={address} key={address.endpoint}/> ); }); if (this.props.service === 'time') { return ( <div className='service'> <TimeService endpoints={addresses} /> </div> ); } if ( this.props.service == 'events' ) { return ( <div className='service'> <EventService endpoints={addresses} /> </div> ); } else { return ( <div className='service'> <OtherService service={this.props.service} endpoints={addresses} /> </div> ) } } }); function formatTime(obj) { return obj['h'] + ':' + obj['m'] + ':' + obj['s'] + '.' + obj['ms'] + ' on ' + obj['Y'] + '-' + obj['M'] + '-' + obj['D'] + ' '; } var TimeService = React.createClass({ getInitialState: function() { return {responses: []}; }, updatePanel: function(response) { console.log(response); this.setState({ responses: this.state.responses.concat([response]) }); }, render: function() { return ( <div className='time-service'> <h2>Time Service</h2> <div className='endpoints'> <h3>Endpoints</h3> {this.props.endpoints} </div> <GetJSONButton serviceName='time' responseHandler={this.updatePanel} /> {this.state.responses.reverse().map(function(response) { return ( <TimeStamp key={response['ms']} timestamp={response} /> ); })} </div> ); } }); var TimeStamp = React.createClass({ render: function() { return ( <div className='timestamp'> {formatTime(this.props.timestamp)} </div> ); } }); var EventService = React.createClass({ getInitialState: function() { return {response: []}; }, updatePanel: function(response) { console.log(response); this.setState({ response: response }); }, render: function() { return ( <div className='event-service'> <h2>Event Service</h2> <div className='endpoints'> <h3>Endpoints</h3> {this.props.endpoints} </div> <GetJSONButton serviceName='events' responseHandler={this.updatePanel} /> <PostJSONButton serviceName='events' responseHandler={this.updatePanel} /> {this.state.response.reverse().map(function(evt) { return ( <Event key={evt.id} event={evt} /> ); })} </div> ); } }); var Event = React.createClass({ render: function() { return ( <ul className='event'> <li>Event ID: {this.props.event.id}</li> <li>Event Type: {this.props.event.name}</li> <li>Timestamp: <TimeStamp key={'e' + this.props.event.timestamp['ms']} timestamp={this.props.event.timestamp} /></li> </ul> ); } }); var OtherService = React.createClass({ getInitialState: function() { return {response: []}; }, updatePanel: function(response) { console.log(response); this.setState({ response: response }); }, render: function() { return ( <div className='other-service'> <h2>{this.props.service} Service</h2> <div className='endpoints'> <h3>Endpoints</h3> {this.props.endpoints} </div> </div> ); } }); var GetJSONButton = React.createClass({ handleClick: function(event) { topo.getJSON(this.props.serviceName) .then(this.props.responseHandler); }, render: function() { return ( <div> <p onClick={this.handleClick}> <span className='btn get-btn'> Click to GET {this.props.serviceName} </span> </p> </div> ); } }); var PostJSONButton = React.createClass({ handleClick: function(event) { topo.postJSON(this.props.serviceName, {name: 'User POST'}) .then(this.props.responseHandler); }, render: function() { return ( <div> <p onClick={this.handleClick}> <span className='btn post-btn'> Click to post a new item to {this.props.serviceName} </span> </p> </div> ); } }); var Address = React.createClass({ render: function() { return ( <div> <p className='service-address'>{this.props.address.endpoint}</p> {this.props.address.tags.map( function(tag) { return (<span key={tag}>{tag}</span>); })} </div> ); } }); ReactDOM.render( <App />, document.getElementById('app') ); });
// test/lib/email.js // // Some utilities for testing email behaviour // // Copyright 2012-2013, E14N https://e14n.com/ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. "use strict"; var assert = require("assert"), vows = require("vows"), _ = require("lodash"), smtpserver = require("smtp-server"), oauthutil = require("./oauth"), apputil = require("./app"), httputil = require("./http"), Step = require("step"), http = require("http"), newClient = oauthutil.newClient, accessToken = oauthutil.accessToken, register = oauthutil.register, registerEmail = oauthutil.registerEmail, setupApp = apputil.setupApp, setupAppConfig = apputil.setupAppConfig; var SMTPServer = smtpserver.SMTPServer, emailAccumulator = []; var createSmtpServer = function(options) { return new SMTPServer(_.extend({ onData: onDataEmail, onAuth(auth, session, callback) { callback(null, { user: auth.username }); } }, options)); }; var oneEmail = function(addr, callback) { var onEmailCallback = function(err, msg) { clearTimeout(timeoutID); callback(err, msg); }, timeoutID = setTimeout(function() { onEmailCallback(new Error("Timeout waiting for email"), null); }, 5000); emailAccumulator.push({ addr, callback: onEmailCallback }); }; var onDataEmail = function(stream, session, callback) { var data, timeoutID, envelope = session.envelope, emailIndex = emailAccumulator.findIndex((email) => { return envelope.rcptTo.find((to) => (to.address === email.addr)); }), accumulator = function(chunk) { if (emailIndex > -1) { data = data + chunk.toString(); } }, ender = function() { var msg, emailData = emailAccumulator[emailIndex]; if (emailData) { msg = _.clone(envelope); msg.data = data; if (typeof emailData.callback === "function") { emailData.callback(null, msg); } emailAccumulator.splice(emailIndex, 1); process.nextTick(function() { callback(null, emailData); }); } }; stream.on("data", accumulator); stream.on("end", ender); }; var confirmEmail = function(message, callback) { var urlre = /http:\/\/localhost:4815\/main\/confirm\/[a-zA-Z0-9_\-]+/, match = urlre.exec(message.data), url = (match.length > 0) ? match[0] : null; if (!url) { callback(new Error("No URL matched"), null); return; } http.get(url, function(res) { var body = ""; res.on("data", function(chunk) { body += chunk; }); res.on("end", function() { if (res.statusCode < 200 || res.statusCode >= 300) { callback(new Error("Bad status code " + res.statusCode + ": " + body)); } else { callback(null); } }); }).on("error", function(err) { callback(err); }); }; exports.createSmtpServer = createSmtpServer; exports.oneEmail = oneEmail; exports.onDataEmail = onDataEmail; exports.confirmEmail = confirmEmail;
/** * The main module to run the linters. */ var async = require("async"); var flatten = require("lodash.flatten"); var less = require("less"); var postcss = require("postcss"); var sourceMap = require("source-map"); var abcLint = require("./lib/abc-lint"); var colorVariableLint = require("./lib/color-variable-lint"); var overqualifiedLint = require("./lib/overqualified-lint"); var nestingLint = require("./lib/nesting-lint"); const CSS_LINTERS = [overqualifiedLint]; const LESS_LINTERS = [abcLint, colorVariableLint, nestingLint]; module.exports = function(filename, code, options, next) { options = options || {}; // If there's no code to lint, return 0 errors. if (!code.trim()) { return next(0); } function runLessLinters(done) { less.parse(code, function(err, ast) { if (err) { return done(err); } var callbacks = []; LESS_LINTERS.forEach(function(lessLinter) { callbacks.push(function(callback) { try { lessLinter(code, ast, options, callback); } catch (err) { // Critical failure, fail with a stack trace for // debugging console.log(err.stack); process.exit(1); } }); }); // Run the linters in parallel return async.parallel(callbacks, done); }); } function runCSSLinters(done) { var options = { sourceMap: { outputSourceFiles: true, }, }; less.render(code, options, function(err, result) { if (err) { return done(err); } // If no map exists, this function has compiled into empty CSS, // so we can safely do nothing. if (!result.map) { return done(null, []); } var callbacks = []; // Establish a SourceMapConsumer to point to the original less var smc = new sourceMap.SourceMapConsumer(result.map); var ast = postcss.parse(result.css); CSS_LINTERS.forEach(function(cssLinter) { callbacks.push(function(callback) { try { cssLinter(ast, smc, options, callback); } catch (err) { // Critical failure, fail with a stack trace for // debugging console.log(err.stack); process.exit(1); } }); }); // Run the linters in parallel return async.parallel(callbacks, done); }); } function defaultReporter(entries) { entries.forEach(function(entry) { var error = entry.error; console.log( "(" + error.line + ":" + error.character + ") " + error.reason); }); } var reporter = options.reporter || defaultReporter; // Run the linter groups in parallel async.parallel([runLessLinters, runCSSLinters], function(err, results) { if (err) { var reason = err.message; var line = err.line; var character = err.column + 1; // 1-indexed // If `err.filename` is something other than "input," the error // is in an @imported file. Display this filename in the error // message. if (err.filename !== "input") { reason = "Error parsing " + err.filename + ": " + reason; // TODO: Get the line/col of `filename` that leads to this // problematic import line = 1; character = 1; } // Parsing error, report a single error with code "E0" reporter([{ file: err.filename, error: { line: line, character: character, code: "E0", reason: reason, }, }]); // Report 1 error return next(1); } // `results` is a deeply-nested structure due to multiple // `async.parallel` calls. Flatten the results, with the `isDeep` // parameter set to true. var flatResults = flatten(results, true); // Report any errors if (flatResults.length) { reporter(flatResults.map(function(error) { return { file: filename, error: error, }; })); // Report `flatResults.length` errors next(flatResults.length); } else { // Report zero errors next(0); } }); };
var Util = require('lib/Util'); var BaseModel = require('model/BaseModel'); // create the category model that inherits from the BaseModel var RecipeModel = new BaseModel('Recipe.php'); /** * * Gets all of the recipes based upon the criteria * * @param {RecipeSearch} criteria * @param {Function} callback */ RecipeModel.getAll = function(criteria, callback) { criteria = criteria || {}; this.GET(criteria, callback); }; /** * Inserts a recipe * * @param {Recipe} recipe * @param {Function} callback * */ RecipeModel.insert = function(recipe, callback) { // prep arrays for PHP recipe.instructions = JSON.stringify(recipe.instructions); recipe.ingredients = JSON.stringify(recipe.ingredients); recipe.categories = JSON.stringify(recipe.categories); this.POST(recipe, callback); }; module.exports = RecipeModel;
define([ './swipe' ], function ( Swipe ) { 'use strict'; /** * Warning object * @class * @extends Phaser.Group * @memberof Warning * @param x {int} x position * @param y {int} y position * @param angle {int} angle to the world center * @param game {Phaser.Game} game instance * @param scale {scale} default 1 **/ function Warning(x, y, game, scale) { scale = scale || 0.4; Phaser.Group.call(this, game); this.gameRef = game; this.paused = false; this.x = x; this.y = y; this.warningSprite = game.add.sprite(0, 0, 'warning'); this.warningSprite.anchor.setTo(0.5, 0.5); this.warningSprite.scale.x = scale; this.warningSprite.scale.y = scale; this.add(this.warningSprite) this.warningSprite.tween = this.game.add.tween(this.warningSprite); this.warningSprite.tween.to({ alpha: 0 }, 600, Phaser.Easing.Linear.In, true, 0, -1, true); this.warningSprite.visible = false; this.initEvents(); }; Warning.prototype = Object.create(Phaser.Group.prototype); Warning.constructor = Warning; Warning.prototype.destroy = function () { delete this; } Warning.prototype.toggle = function (bool) { this.warningSprite.visible = bool; } Warning.prototype.updatePosition = function (x, y) { this.x = x; this.y = y; } /** * init all events * @private **/ Warning.prototype.initEvents = function () { this.game.eventManager.on('pause', function () { this.paused = true; }, this); this.game.eventManager.on('unPause', function () { this.paused = false; }, this); } Warning.prototype.update = function () { } return Warning; });
/** * @license * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function(window) { 'use strict'; // Prevent redefinition. if (window.GrEtagDecorator) { return; } // Limit cache size because /change/detail responses may be large. const MAX_CACHE_SIZE = 30; function GrEtagDecorator() { this._etags = new Map(); this._payloadCache = new Map(); } /** * Get or upgrade fetch options to include an ETag in a request. * * @param {string} url The URL being fetched. * @param {!Object=} opt_options Optional options object in which to include * the ETag request header. If omitted, the result will be a fresh option * set. * @return {!Object} */ GrEtagDecorator.prototype.getOptions = function(url, opt_options) { const etag = this._etags.get(url); if (!etag) { return opt_options; } const options = Object.assign({}, opt_options); options.headers = options.headers || new Headers(); options.headers.set('If-None-Match', this._etags.get(url)); return options; }; /** * Handle a response to a request with ETag headers, potentially incorporating * its result in the payload cache. * * @param {string} url The URL of the request. * @param {!Response} response The response object. * @param {string} payload The raw, unparsed JSON contained in the response * body. Note: because response.text() cannot be read twice, this must be * provided separately. */ GrEtagDecorator.prototype.collect = function(url, response, payload) { if (!response || !response.ok || response.status !== 200 || response.status === 304) { // 304 Not Modified means etag is still valid. return; } this._payloadCache.set(url, payload); const etag = response.headers && response.headers.get('etag'); if (!etag) { this._etags.delete(url); } else { this._etags.set(url, etag); this._truncateCache(); } }; /** * Get the cached payload for a given URL. * * @param {string} url * @return {string|undefined} Returns the unparsed JSON payload from the * cache. */ GrEtagDecorator.prototype.getCachedPayload = function(url) { return this._payloadCache.get(url); }; /** * Limit the cache size to MAX_CACHE_SIZE. */ GrEtagDecorator.prototype._truncateCache = function() { for (const url of this._etags.keys()) { if (this._etags.size <= MAX_CACHE_SIZE) { break; } this._etags.delete(url); this._payloadCache.delete(url); } }; window.GrEtagDecorator = GrEtagDecorator; })(window);
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 Subscriber_1 = require('../Subscriber'); function dematerialize() { return this.lift(new DeMaterializeOperator()); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = dematerialize; var DeMaterializeOperator = (function () { function DeMaterializeOperator() { } DeMaterializeOperator.prototype.call = function (subscriber) { return new DeMaterializeSubscriber(subscriber); }; return DeMaterializeOperator; })(); var DeMaterializeSubscriber = (function (_super) { __extends(DeMaterializeSubscriber, _super); function DeMaterializeSubscriber(destination) { _super.call(this, destination); } DeMaterializeSubscriber.prototype._next = function (value) { value.observe(this.destination); }; return DeMaterializeSubscriber; })(Subscriber_1.default); //# sourceMappingURL=dematerialize.js.map
var searchData= [ ['editplayer',['editPlayer',['../d9/dc6/class_main_window.html#a22c2cf54c567c2de6ec7bd6f7c79ced8',1,'MainWindow']]], ['editteam',['editTeam',['../d9/dc6/class_main_window.html#a637b22ad7b085a1664384ea3ab8084cd',1,'MainWindow']]], ['erase',['erase',['../d1/d34/class_list.html#a7b33f41a6fd235d8e4e61e3aa7ffad71',1,'List']]] ];
//// [tests/cases/compiler/declarationEmitStringEnumUsedInNonlocalSpread.ts] //// //// [class.ts] export const enum TestEnum { Test1 = '123123', Test2 = '12312312312', } export interface ITest { [TestEnum.Test1]: string; [TestEnum.Test2]: string; } export class A { getA(): ITest { return { [TestEnum.Test1]: '123', [TestEnum.Test2]: '123', }; } } //// [index.ts] import { A } from './class'; export class B extends A { getA() { // TS4053 error return { ...super.getA(), a: '123', }; } } //// [class.js] "use strict"; exports.__esModule = true; exports.A = void 0; var A = /** @class */ (function () { function A() { } A.prototype.getA = function () { var _a; return _a = {}, _a["123123" /* TestEnum.Test1 */] = '123', _a["12312312312" /* TestEnum.Test2 */] = '123', _a; }; return A; }()); exports.A = A; //// [index.js] "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; exports.__esModule = true; exports.B = void 0; var class_1 = require("./class"); var B = /** @class */ (function (_super) { __extends(B, _super); function B() { return _super !== null && _super.apply(this, arguments) || this; } B.prototype.getA = function () { return __assign(__assign({}, _super.prototype.getA.call(this)), { a: '123' }); }; return B; }(class_1.A)); exports.B = B; //// [class.d.ts] export declare const enum TestEnum { Test1 = "123123", Test2 = "12312312312" } export interface ITest { [TestEnum.Test1]: string; [TestEnum.Test2]: string; } export declare class A { getA(): ITest; } //// [index.d.ts] import { A } from './class'; export declare class B extends A { getA(): { a: string; 123123: string; 12312312312: string; }; }
/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ (function(exports) { var _registry = {}; var _run = Date.now(); var PerfLog = { startTracing: function(name) { if (!Config.performanceLog.enabled) { return; } if (_registry[name]) { console.warn('Already tracing ' + name); return; } _registry[name] = { start: Date.now(), logs: [], milestones: [] }; }, log: function log(name, record) { if (!Config.performanceLog.enabled || !_registry[name]) { return; } _registry[name].logs.push({ timestamp: Date.now(), record: record }); }, milestone: function milestone(name, milestoneName) { if (!Config.performanceLog.enabled || !_registry[name]) { return; } _registry[name].milestones.push({ name: milestoneName, timestamp: Date.now() }); }, stopTracing: function stopTracing(name) { if (!Config.performanceLog.enabled || !_registry[name]) { return; } var logs = ['[================== PERF LOG ' + name + '===============]\n']; var lastTimestamp; console.log(logs[0]); while (_registry[name].logs.length) { var logObj = _registry[name].logs.shift(); var log = 'Global: ' + (logObj.timestamp - _registry[name].start) + 'ms'; log += lastTimestamp ? ' || Step: ' + (logObj.timestamp - lastTimestamp) + 'ms' : ''; for (var i = 0, l = _registry[name].milestones.length; i < l; i++) { var milestone = _registry[name].milestones[i]; var time = logObj.timestamp - milestone.timestamp; if (time < 0) { continue; } log += ' || Milestone[' + milestone.name + ']: ' + time + 'ms'; } log += ' || Log: ' + logObj.record + '\n'; lastTimestamp = logObj.timestamp; console.log(log); logs.push(log); } _registry[name] = null; if (!Config.performanceLog.persistent) { return; } var file = new Blob(logs, { type: 'text/plain' }); var sdcard = navigator.getDeviceStorage('sdcard'); sdcard.addNamed(file, name + '.' + Date.now() + '.perflog.txt') .onerror =function(event) { console.error('Could not save performance log to disk ' + event.target.error.name); }; } }; exports.PerfLog = PerfLog; })(this);
function __processArg(obj, key) { var arg = null; if (obj) { arg = obj[key] || null; delete obj[key]; } return arg; } function Controller() { require("alloy/controllers/BaseController").apply(this, Array.prototype.slice.call(arguments)); this.__controllerPath = "loading"; this.args = arguments[0] || {}; if (arguments[0]) { { __processArg(arguments[0], "__parentSymbol"); } { __processArg(arguments[0], "$model"); } { __processArg(arguments[0], "__itemTemplate"); } } var $ = this; var exports = {}; $.__views.loadingBar = Ti.UI.createView({ layout: "vertical", id: "loadingBar", height: "120", width: "120", borderRadius: "15", backgroundColor: "#2E2E2E" }); $.__views.loadingBar && $.addTopLevelView($.__views.loadingBar); $.__views.activityIndicator = Ti.UI.createActivityIndicator({ top: "30", left: "30", width: "60", id: "activityIndicator", style: Ti.UI.iPhone.ActivityIndicatorStyle.BIG }); $.__views.loadingBar.add($.__views.activityIndicator); $.__views.__alloyId48 = Ti.UI.createLabel({ color: "#ffffff", width: Ti.UI.FILL, height: Ti.UI.SIZE, font: { fontFamily: "Lato-Regular", fontSize: 12 }, textAlign: "center", top: "5", text: "Loading", id: "__alloyId48" }); $.__views.loadingBar.add($.__views.__alloyId48); exports.destroy = function() {}; _.extend($, $.__views); arguments[0] || {}; $.loadingBar.hide(); $.activityIndicator.hide(); $.start = function() { $.loadingBar.show(); $.activityIndicator.show(); }; $.finish = function(_callback) { $.loadingBar.hide(); $.activityIndicator.hide(); _callback && _callback(); }; _.extend($, exports); } var Alloy = require("alloy"), Backbone = Alloy.Backbone, _ = Alloy._; module.exports = Controller;
/** * Geocoder Utilities Base Class */ function org_scn_geocode_base(options){ this.mode = "component"; this.resourcePrefix = ""; this.geoCache = {}; // Compare two 1-D arrays this.arraysIdentical = function(a, b) { var i = a.length; if (i != b.length) return false; while (i--) { if (a[i] !== b[i]) return false; } return true; }; // Convert Dimension Index to Dimension Key this.indexDimension = function(idx, metadata){ if(idx==-1) return null; // user to be -1 if(!metadata) return null; if(metadata.dimensions.length>=idx) return metadata.dimensions[idx].key; return null; }; // Convert Dimension Key to Dimension Index this.dimensionIndex = function(key, metadata){ if(key=="NONE") return null; // used to be -1 if(!metadata) return null; for(var i=0;i<metadata.dimensions.length;i++){ if(metadata.dimensions[i].key==key) return i; } return null; }; // Convert a given Dimension's Member Key to Dimension Index this.memberIndex = function(key, dimId, metadata){ if(!metadata) return null; var dim = metadata.dimensions[dimId]; for(var i=0;i<dim.members.length;i++){ if(dim.members[i].key==key) return i; } return null; }; this.issueCallback = function(options,payload){ if(options.callback) { if(!options.scope) options.scope = this; options.callback.apply(options.scope,[payload,options.conf]); } } } /** * Override * @param options */ org_scn_geocode_base.prototype.getLatLngs = function(options){ // Override this.issueCallback(options,{ solved : [], unsolved :[] }) };
var mongoose = require('mongoose'); var productsSchema = mongoose.Schema({ nameAndColor: category: price: sizes: photos: description: dateCreated: /*so the lady can see when she most recently updated a given product*/ dateUpdated: }) productsSchema.pre('update', function() { this.dateUp }) module.exports = mongoose.model("Product", productsSchema);
var searchData= [ ['jalkiehtovirhe',['Jalkiehtovirhe',['../class_julkinen_1_1_jalkiehtovirhe.html',1,'Julkinen']]] ];
; define("translation:widget/translate/input/flash.js", function() { var a = $("#btpm-swf-src").attr("src"), e = /msie/i.test(navigator.userAgent) === !0, t = /ipad/i.test(navigator.userAgent) === !0, r = { isIE: ['<object id="bt-flash-object" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="200" align="middle">', '<param name="movie" value="' + a + '" />', '<param name="allowScriptAccess" value="always" />', '<param name="allowNetworking" value="all" />', '<param name="flashVars" value="_instanceName=BTPM" />', '<param name="wmode" value="window" />', '<param name="scale" value="noscale" />', '<param name="salign" value="lt" />', "</object>"].join(""), notIE: ['<embed id="bt-flash-embed" src="' + a + '"', 'width="0" height="0" allowScriptAccess="always"', 'allowNetworking="all" flashVars="_instanceName=BTPM"', 'quality="high" type="application/x-shockwave-flash"', 'pluginspage="http://www.adobe.com/go/getflashplayer"></embed>'].join("") } [e ? "isIE": "notIE"]; $(".bt-flash").html(r), window.BTPM = e ? $("#bt-flash-object")[0] : $("#bt-flash-embed")[0]; var n; t && !n && (n = $('<audio id="dictVoice" style="display: none"></audio>'), $("body").append(n), BTPM = $("#dictVoice")[0]), BTPM.setUrl = function(a) { if (t) return BTPM.src = a, BTPM.load(a), void BTPM.play(); try { BTPM._setVar && BTPM._setVar("url", a) } catch(e) {} return BTPM }, BTPM.getUrl = function() { try { if (BTPM._getVar) return BTPM._getVar("url") } catch(a) {} return BTPM }, BTPM.pause = function() { try { BTPM._pause && BTPM._pause() } catch(a) {} return BTPM }, BTPM.getCurrentPosition = function() { return BTPM._getVar ? BTPM._getVar("currentPosition") / 1e3: BTPM }, BTPM.getDuration = function() { return BTPM._getVar ? BTPM._getVar("duration") / 1e3: BTPM }, BTPM.getDownloadProgress = function() { return BTPM._getVar ? 100 * BTPM._getVar("downloadProgress") : BTPM } });
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ module.exports = angular.module('trafficPortal.private.admin.physLocations', []) .controller('PhysLocationsController', require('./PhysLocationsController')) .config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('trafficPortal.private.admin.physLocations', { url: '/phys-locations', abstract: true, views: { adminContent: { templateUrl: 'modules/private/admin/physLocations/physLocations.tpl.html', controller: 'PhysLocationsController' } } }) ; $urlRouterProvider.otherwise('/'); });
/* jshint node: true */ /* jshint esnext: true */ 'use strict'; let pdf = require('./pdf/pdfGeneration'); let pdfRequests = {}; pdfRequests.setup = (redis) => { redis.subscribe('pace-pdf', (err, count) => {}); redis.on('message', pdfRequests.process); }; pdfRequests.process = (channnel, msg) => { pdf.generate(pdfRequests.parse(msg)); }; pdfRequests.parse = (message) => { return JSON.parse(message); }; module.exports = pdfRequests;
import { factory } from '../../utils/factory.js' const name = 'hex' const dependencies = ['typed', 'format'] /** * Format a number as hexadecimal. * * Syntax: * * math.hex(value) * * Examples: * * //the following outputs "0xF0" * math.hex(240) * * See also: * * oct * bin * * @param {number} value Value to be stringified * @param {number} wordSize Optional word size (see `format`) * @return {string} The formatted value */ export const createHex = factory(name, dependencies, ({ typed, format }) => { return typed(name, { 'number | BigNumber': function (n) { return format(n, { notation: 'hex' }) }, 'number | BigNumber, number': function (n, wordSize) { return format(n, { notation: 'hex', wordSize: wordSize }) } }) })
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: String.prototype.search (regexp) es5id: 15.5.4.12_A1_T12 description: > Argument is object, and instance is string. Object with overrided toString and valueOf functions, valueOf throw exception ---*/ var __obj = { toString: function() { return {}; }, valueOf: function() { throw "intostr"; } } var __str = new String("ABB\u0041BABAB"); ////////////////////////////////////////////////////////////////////////////// //CHECK#1 try { var x = __str.search(__obj); $ERROR('#1: var x = __str.search(__obj) lead to throwing exception'); } catch (e) { if (e !== "intostr") { $ERROR('#1.1: Exception === "intostr". Actual: ' + e); } } // //////////////////////////////////////////////////////////////////////////////
async a => a;
const _ = require("lodash"); const expectErrorMessage = require("./expect_error_message.js"); const cache = require("../factories.js").getCache(); if(_.isEmpty(cache.rootRegions())) { throw new Error("cache.rootRegions didn't return regions before cache.close"); } cache.close(); try { cache.executeQuery("SELECT * FROM /exampleRegion", function(){}); throw new Error("cache.executeQuery did not throw an exception after cache.close"); } catch (error) { expectErrorMessage(error, "Cannot execute query; cache is closed."); } try { cache.executeFunction("io.pivotal.node_gemfire.TestFunction", function(){}); throw new Error("cache.executeFunction did not throw an exception after cache.close"); } catch (error) { expectErrorMessage(error, "Cannot execute function; cache is closed."); } if (!_.isUndefined(cache.getRegion('exampleRegion'))) { throw("cache.getRegion did not return undefined after the cache was closed."); } if(!_.isEmpty(cache.rootRegions())) { throw new Error("cache.rootRegions didn't return an empty array after cache.close"); }
////////////////////////////////////////////////////////////////////////////// /** * Create a new instance of class polygonFeature * * @class * @extends geo.feature * @returns {geo.polygonFeature} */ ////////////////////////////////////////////////////////////////////////////// geo.polygonFeature = function (arg) { "use strict"; if (!(this instanceof geo.polygonFeature)) { return new geo.polygonFeature(arg); } arg = arg || {}; geo.feature.call(this, arg); //////////////////////////////////////////////////////////////////////////// /** * @private */ //////////////////////////////////////////////////////////////////////////// var m_this = this, m_position, m_polygon, s_init = this._init, s_data = this.data, m_coordinates = {outer: [], inner: []}; if (arg.polygon === undefined) { m_polygon = function (d) { return d; }; } else { m_polygon = arg.polygon; } if (arg.position === undefined) { m_position = function (d) { return d; }; } else { m_position = arg.position; } //////////////////////////////////////////////////////////////////////////// /** * Override the parent data method to keep track of changes to the * internal coordinates. */ //////////////////////////////////////////////////////////////////////////// this.data = function (arg) { var ret = s_data(arg); if (arg !== undefined) { getCoordinates(); } return ret; }; //////////////////////////////////////////////////////////////////////////// /** * Get the internal coordinates whenever the data changes. For now, we do * the computation in world coordinates, but we will need to work in GCS * for other projections. * @private */ //////////////////////////////////////////////////////////////////////////// function getCoordinates() { var posFunc = m_this.position(), polyFunc = m_this.polygon(); m_coordinates = m_this.data().map(function (d, i) { var poly = polyFunc(d); var outer, inner; outer = (poly.outer || []).map(function (d0, j) { return posFunc.call(m_this, d0, j, d, i); }); inner = (poly.inner || []).map(function (hole) { return (hole || []).map(function (d0, k) { return posFunc.call(m_this, d0, k, d, i); }); }); return { outer: outer, inner: inner }; }); } //////////////////////////////////////////////////////////////////////////// /** * Get/Set polygon accessor * * @returns {geo.pointFeature} */ //////////////////////////////////////////////////////////////////////////// this.polygon = function (val) { if (val === undefined) { return m_polygon; } else { m_polygon = val; m_this.dataTime().modified(); m_this.modified(); getCoordinates(); } return m_this; }; //////////////////////////////////////////////////////////////////////////// /** * Get/Set position accessor * * @returns {geo.pointFeature} */ //////////////////////////////////////////////////////////////////////////// this.position = function (val) { if (val === undefined) { return m_position; } else { m_position = val; m_this.dataTime().modified(); m_this.modified(); getCoordinates(); } return m_this; }; //////////////////////////////////////////////////////////////////////////// /** * Point searce method for selection api. Returns markers containing the * given point. * @argument {Object} coordinate * @returns {Object} */ //////////////////////////////////////////////////////////////////////////// this.pointSearch = function (coordinate) { var found = [], indices = [], data = m_this.data(); m_coordinates.forEach(function (coord, i) { var inside = geo.util.pointInPolygon( coordinate, coord.outer, coord.inner ); if (inside) { indices.push(i); found.push(data[i]); } }); return { index: indices, found: found }; }; //////////////////////////////////////////////////////////////////////////// /** * Initialize */ //////////////////////////////////////////////////////////////////////////// this._init = function (arg) { s_init.call(m_this, arg); var defaultStyle = $.extend( {}, { "fillColor": { r: 0.0, g: 0.5, b: 0.5 }, "fillOpacity": 1.0 }, arg.style === undefined ? {} : arg.style ); m_this.style(defaultStyle); if (m_position) { m_this.dataTime().modified(); } }; this._init(arg); return this; }; inherit(geo.polygonFeature, geo.feature);
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* ========================================= * Copyright (c) 2015-present, Billgo. * Copyright (c) 2015-present, Yiminghe. * Copyright (c) 2015-present, Facebook, Inc. * * All rights reserved. *======================================== */ function getAlignOffset(region, align) { var V = align.charAt(0); var H = align.charAt(1); var w = region.width; var h = region.height; var x = void 0; var y = void 0; x = region.left; y = region.top; if (V === "c") { y += h / 2; } else if (V === "b") { y += h; } if (H === "c") { x += w / 2; } else if (H === "r") { x += w; } return { left: x, top: y }; } exports.default = getAlignOffset;
#!/usr/bin/env node require("../../proof")(14, function (tz, equal) { var tz = tz(require("timezone/bg_BG")); // bg_BG abbreviated days of week equal(tz("2006-01-01", "%a", "bg_BG"), "нд", "Sun"); equal(tz("2006-01-02", "%a", "bg_BG"), "пн", "Mon"); equal(tz("2006-01-03", "%a", "bg_BG"), "вт", "Tue"); equal(tz("2006-01-04", "%a", "bg_BG"), "ср", "Wed"); equal(tz("2006-01-05", "%a", "bg_BG"), "чт", "Thu"); equal(tz("2006-01-06", "%a", "bg_BG"), "пт", "Fri"); equal(tz("2006-01-07", "%a", "bg_BG"), "сб", "Sat"); // bg_BG days of week equal(tz("2006-01-01", "%A", "bg_BG"), "неделя", "Sunday"); equal(tz("2006-01-02", "%A", "bg_BG"), "понеделник", "Monday"); equal(tz("2006-01-03", "%A", "bg_BG"), "вторник", "Tuesday"); equal(tz("2006-01-04", "%A", "bg_BG"), "сряда", "Wednesday"); equal(tz("2006-01-05", "%A", "bg_BG"), "четвъртък", "Thursday"); equal(tz("2006-01-06", "%A", "bg_BG"), "петък", "Friday"); equal(tz("2006-01-07", "%A", "bg_BG"), "събота", "Saturday"); });
/* Language: STEP Part 21 Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com> Description: Syntax highlighter for STEP Part 21 files (ISO 10303-21). Website: https://en.wikipedia.org/wiki/ISO_10303-21 */ function(hljs) { var STEP21_IDENT_RE = '[A-Z_][A-Z0-9_.]*'; var STEP21_KEYWORDS = { keyword: 'HEADER ENDSEC DATA' }; var STEP21_START = { className: 'meta', begin: 'ISO-10303-21;', relevance: 10 }; var STEP21_CLOSE = { className: 'meta', begin: 'END-ISO-10303-21;', relevance: 10 }; return { aliases: ['p21', 'step', 'stp'], case_insensitive: true, // STEP 21 is case insensitive in theory, in practice all non-comments are capitalized. lexemes: STEP21_IDENT_RE, keywords: STEP21_KEYWORDS, contains: [ STEP21_START, STEP21_CLOSE, hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.COMMENT('/\\*\\*!', '\\*/'), hljs.C_NUMBER_MODE, hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}), hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}), { className: 'string', begin: "'", end: "'" }, { className: 'symbol', variants: [ { begin: '#', end: '\\d+', illegal: '\\W' } ] } ] }; }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** * @fileoverview Polymer element for Parental Handoff screen. */ /* #js_imports_placeholder */ /** * @constructor * @extends {PolymerElement} * @implements {OobeI18nBehaviorInterface} * @implements {LoginScreenBehaviorInterface} */ const ParentalHandoffElementBase = Polymer.mixinBehaviors( [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior], Polymer.Element); class ParentalHandoff extends ParentalHandoffElementBase { static get is() { return 'parental-handoff-element'; } /* #html_template_placeholder */ static get properties() { return { /** * The username to be displayed */ username_: { type: String, }, }; } constructor() { super(); this.username_ = ''; } /** @override */ get EXTERNAL_API() { return []; } /** * Event handler that is invoked just before the frame is shown. * @param {Object} data Screen init payload */ onBeforeShow(data) { if ('username' in data) { this.username_ = data.username; } } ready() { super.ready(); this.initializeLoginScreen('ParentalHandoffScreen', { resetAllowed: true, }); } /* * Executed on language change. */ updateLocalizedContent() { this.i18nUpdateLocale(); } /** * On-tap event handler for Next button. * * @private */ onNextButtonPressed_() { this.userActed('next'); } } customElements.define(ParentalHandoff.is, ParentalHandoff);
var searchData= [ ['vehicle_2ecpp',['Vehicle.cpp',['../_vehicle_8cpp.html',1,'']]], ['vehicle_2eh',['Vehicle.h',['../_vehicle_8h.html',1,'']]], ['vehiclecreator_2ecpp',['VehicleCreator.cpp',['../_vehicle_creator_8cpp.html',1,'']]], ['vehiclecreator_2eh',['VehicleCreator.h',['../_vehicle_creator_8h.html',1,'']]], ['vehiclestate_2eh',['VehicleState.h',['../_vehicle_state_8h.html',1,'']]] ];
import React, { Component } from "react" import PropTypes from "prop-types" import { connect } from "react-redux" import { Helmet } from "react-helmet" import EvaluationTopbar from "../components/EvaluationTopbar/EvaluationTopbar" import { NOMAD_WATCH_EVAL, NOMAD_UNWATCH_EVAL, NOMAD_WATCH_ALLOCS_SHALLOW, NOMAD_UNWATCH_ALLOCS_SHALLOW, NOMAD_WATCH_NODES, NOMAD_UNWATCH_NODES } from "../sagas/event" import shortUUID from "../helpers/uuid" class Evaluation extends Component { componentWillMount() { this.props.dispatch({ type: NOMAD_WATCH_EVAL, payload: this.props.params.evalId }) this.props.dispatch({ type: NOMAD_WATCH_ALLOCS_SHALLOW }) this.props.dispatch({ type: NOMAD_WATCH_NODES }) } componentWillUnmount() { this.props.dispatch({ type: NOMAD_UNWATCH_EVAL, payload: this.props.params.evalId }) this.props.dispatch({ type: NOMAD_UNWATCH_ALLOCS_SHALLOW }) this.props.dispatch({ type: NOMAD_UNWATCH_NODES }) } render() { if (this.props.evaluation.ID == null) { return <div>Loading ...</div> } return ( <div> <Helmet> <title> Evaluation {shortUUID(this.props.evaluation.ID)} - Nomad - Hashi-UI </title> </Helmet> <EvaluationTopbar {...this.props} /> <div style={{ padding: 10, paddingBottom: 0 }}> <h2> Evaluation: {this.props.evaluation.ID} </h2> <br /> {this.props.children} </div> </div> ) } } function mapStateToProps({ evaluation }) { return { evaluation } } Evaluation.propTypes = { dispatch: PropTypes.func.isRequired, params: PropTypes.object.isRequired, evaluation: PropTypes.object.isRequired, children: PropTypes.object.isRequired } export default connect(mapStateToProps)(Evaluation)
support.dom.Tabs = support.dom.Base.extend({ selector: '.tabs_view', tabNames: function() { return this.$el.find('[data-tab-name]').map(function() { return $(this).data('tabName'); }).get(); } });
import Switch from './src/switch.vue'; export default Switch;
const shallowEqual = require('../utils/shallow-equal'); function relevantContextKeysEqual(classObject, currentContext, nextContext) { //Get those keys from current object's context that we care //about and check whether those keys have changed or not if (classObject.getRelevantContextKeys) { const currentContextKeys = classObject.getRelevantContextKeys(currentContext); const nextContextKeys = classObject.getRelevantContextKeys(nextContext); if (!shallowEqual(currentContextKeys, nextContextKeys)) { return false; } } //Check if children context keys changed if (classObject.getChildrenClasses) { const childrenArray = classObject.getChildrenClasses(); for (let i = 0; i < childrenArray.length; i++) { if (!relevantContextKeysEqual(childrenArray[i], currentContext, nextContext)) { return false; } } } //context keys are equal return true; } module.exports = { //Don't update if state, prop, and context are equal shouldComponentUpdate(nextProps, nextState, nextContext) { const staticTheme = this.context.muiTheme && this.context.muiTheme.static; const isExactlyOneThemeUndefined = (!this.context.muiTheme && nextContext.muiTheme) || (this.context.muiTheme && !nextContext.muiTheme); return ( !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState) || isExactlyOneThemeUndefined || (!staticTheme && !relevantContextKeysEqual(this.constructor, this.context.muiTheme, nextContext.muiTheme)) ); }, };
"use strict"; it("should hoist exports", function() { var result = require("./foo").default; (typeof result.foo).should.have.eql("function"); (typeof result.foo2).should.have.eql("function"); result.foo().should.be.eql("ok"); result.foo2().should.be.eql("ok"); });
'use strict'; var assert = chai.assert; describe('ordinal', function() { var ordinalFilter; beforeEach(function() { module('ordinal'); inject(function($injector) { ordinalFilter = $injector.get('ordinalFilter'); }); }); it('returns ordinal string from numeric input', function() { assert.equal(ordinalFilter(1), '1st'); }); it('returns ordinal string from string[0] == number', function() { assert.equal(ordinalFilter('1'), '1st'); }); it('returns original string from string[0] != number', function() { assert.equal(ordinalFilter('Not a number'), 'Not a number'); }); });
import buble from 'rollup-plugin-buble'; export default { entry: 'src/walk/index.js', moduleName: 'acorn.walk', plugins: [ buble({ transforms: { dangerousForOf: true } }) ], targets: [ { dest: 'dist/walk.js', format: 'umd' }, { dest: 'dist/walk.es.js', format: 'es' } ] };
/* * Asset list */ +function ($) { "use strict"; var AssetList = function (form, alias) { this.$form = $(form) this.alias = alias this.$form.on('ajaxSuccess', $.proxy(this.onAjaxSuccess, this)) this.$form.on('click', 'ul.list > li.directory > a', $.proxy(this.onDirectoryClick, this)) this.$form.on('click', 'ul.list > li.file > a', $.proxy(this.onFileClick, this)) this.$form.on('click', 'p.parent > a', $.proxy(this.onDirectoryClick, this)) this.$form.on('click', 'a[data-control=delete-asset]', $.proxy(this.onDeleteClick, this)) this.$form.on('oc.list.setActiveItem', $.proxy(this.onSetActiveItem, this)) this.setupUploader() } // Event handlers // ================= AssetList.prototype.onDirectoryClick = function(e) { this.gotoDirectory( $(e.currentTarget).data('path'), $(e.currentTarget).parent().hasClass('parent') ) return false; } AssetList.prototype.gotoDirectory = function(path, gotoParent) { var $container = $('div.list-container', this.$form), self = this if (gotoParent !== undefined && gotoParent) $container.addClass('goBackward') else $container.addClass('goForward') $.oc.stripeLoadIndicator.show() this.$form.request(this.alias+'::onOpenDirectory', { data: { path: path, d: 0.2 }, complete: function() { self.updateUi() $container.trigger('oc.scrollbar.gotoStart') }, error: function(jqXHR, textStatus, errorThrown) { $container.removeClass('goForward goBackward') alert(jqXHR.responseText.length ? jqXHR.responseText : jqXHR.statusText) } }).always(function(){ $.oc.stripeLoadIndicator.hide() }) } AssetList.prototype.onDeleteClick = function(e) { var $el = $(e.currentTarget), self = this if (!confirm($el.data('confirmation'))) return false this.$form.request(this.alias+'::onDeleteFiles', { success: function(data) { if (data.error !== undefined && $.type(data.error) === 'string' && data.error.length) $.oc.flashMsg({text: data.error, 'class': 'error'}) }, complete: function() { self.refresh() } }) return false } AssetList.prototype.onAjaxSuccess = function() { this.updateUi() } AssetList.prototype.onUploadFail = function(file, message) { if (!message) { message = 'Error uploading file' } $.oc.alert(message) this.refresh() } AssetList.prototype.onUploadSuccess = function(file, data) { if (data !== 'success') { $.oc.alert(data) } } AssetList.prototype.onUploadComplete = function(file, data) { $.oc.stripeLoadIndicator.hide() this.refresh() } AssetList.prototype.onUploadStart = function() { $.oc.stripeLoadIndicator.show() } AssetList.prototype.onFileClick = function(event) { var $link = $(event.currentTarget), $li = $link.parent() var e = $.Event('open.oc.list', {relatedTarget: $li.get(0), clickEvent: event}) this.$form.trigger(e, this) if (e.isDefaultPrevented()) return false; } AssetList.prototype.onSetActiveItem = function(event, dataId) { $('ul li.file', this.$form).removeClass('active') if (dataId) $('ul li.file[data-id="'+dataId+'"]', this.$form).addClass('active') } // Service functions // ================= AssetList.prototype.updateUi = function() { $('button[data-control=asset-tools]', self.$form).trigger('oc.triggerOn.update') } AssetList.prototype.refresh = function() { var self = this; this.$form.request(this.alias+'::onRefresh', { complete: function() { self.updateUi() } }) } AssetList.prototype.setupUploader = function() { var self = this, $link = $('[data-control="upload-assets"]', this.$form), uploaderOptions = { method: 'POST', url: window.location, paramName: 'file_data', previewsContainer: $('<div />').get(0), clickable: $link.get(0) } var dropzone = new Dropzone($('<div />').get(0), uploaderOptions) dropzone.on('error', $.proxy(self.onUploadFail, self)) dropzone.on('success', $.proxy(self.onUploadSuccess, self)) dropzone.on('complete', $.proxy(self.onUploadComplete, self)) dropzone.on('sending', function(file, xhr, formData) { $.each(self.$form.serializeArray(), function (index, field) { formData.append(field.name, field.value) }) self.onUploadStart() }) } $(document).ready(function(){ new AssetList($('#asset-list-container').closest('form'), $('#asset-list-container').data('alias')) }) }(window.jQuery);
'use strict'; const common = require('../common'); const assert = require('assert'); const http = require('http'); for (const destroyer of ['destroy', 'abort']) { let socketsCreated = 0; class Agent extends http.Agent { createConnection(options, oncreate) { const socket = super.createConnection(options, oncreate); socketsCreated++; return socket; } } const server = http.createServer((req, res) => res.end()); server.listen(0, common.mustCall(() => { const port = server.address().port; const agent = new Agent({ keepAlive: true, maxSockets: 1 }); http.get({ agent, port }, (res) => res.resume()); const req = http.get({ agent, port }, common.mustNotCall()); req[destroyer](); if (destroyer === 'destroy') { req.on('error', common.mustCall((err) => { assert.strictEqual(err.code, 'ECONNRESET'); })); } else { req.on('error', common.mustNotCall()); } http.get({ agent, port }, common.mustCall((res) => { res.resume(); assert.strictEqual(socketsCreated, 1); agent.destroy(); server.close(); })); })); }
(function(win){ var ns = FL.ns("billd"); eval(FL.import("FL", "Utils, MovieClip")); var speed = 7; var Fish = ns.Fish = function(){ MovieClip.apply(this, arguments); this.alive = true; this.pos = new Vector(); this.v = new Vector(0, 0); this.a = new Vector(0, .1); }; Utils.extends(Fish, MovieClip); Fish.prototype.init = function() { this.addAnimation("move", [0, 1, 2, 3], true, 4); this.time = 0; this.setImg(R.images["fish"], 32, 42); this.originX = 0; this.originY = this.height>>1; }; Fish.prototype.update = function() { this.time += this.timeStep; this.v.plus(this.a); this.pos.plus(this.v); if(this.pos.y > ns.map.height + this.height) { this.v.y = -speed; } var scale = .8; this.scaleY = this.v.y>0?-scale:scale; this.scaleX = scale; this.x = this.pos.x + ns.map.x; this.y = this.pos.y + ns.map.y; }; Fish.create = function(x, y) { var ball = new Fish(); ball.init(); ball.play("move"); ball.pos.set(x||0, y||0); ball.update(); return ball; } })(window);
import React from 'react'; import ReactDOM from 'react-dom'; import JqxChart from '../../../jqwidgets-react/react_jqxchart.js'; class App extends React.Component { render() { let dataStatCounter = [ { Browser: 'Chrome', Share: 45.6 }, { Browser: 'IE', Share: 24.6 }, { Browser: 'Firefox', Share: 20.4 }, { Browser: 'Safari', Share: 5.1 }, { Browser: 'Opera', Share: 1.3 }, { Browser: 'Other', Share: 3.0 } ]; let dataW3CCounter = [ { Browser: 'Chrome', Share: 34.1 }, { Browser: 'IE', Share: 20.3 }, { Browser: 'Firefox', Share: 18.3 }, { Browser: 'Safari', Share: 17.8 }, { Browser: 'Opera', Share: 2.7 }, { Browser: 'Other', Share: 6.8 } ]; let dataWikimedia = [ { Browser: 'Chrome', Share: 42.7 }, { Browser: 'IE', Share: 18.0 }, { Browser: 'Firefox', Share: 15.3 }, { Browser: 'Safari', Share: 6.1 }, { Browser: 'Opera', Share: 2.4 }, { Browser: 'Other', Share: 15.6 } ]; let dataNetApplications = [ { Browser: 'Chrome', Share: 16.4 }, { Browser: 'IE', Share: 55.2 }, { Browser: 'Firefox', Share: 18.0 }, { Browser: 'Safari', Share: 5.8 }, { Browser: 'Opera', Share: 1.3 }, { Browser: 'Other', Share: 3.4 } ]; let charts = [ { title: 'Stat counter', label: 'Stat', dataSource: dataStatCounter }, { title: 'W3C counter', label: 'W3C', dataSource: dataW3CCounter }, { title: 'Wikimedia', label: 'Wikimedia', dataSource: dataWikimedia }, { title: 'Net Applications', label: 'NetApp', dataSource: dataNetApplications } ]; let padding = { left: 5, top: 5, right: 5, bottom: 5 }; let titlePadding = { left: 0, top: 0, right: 0, bottom: 10 }; let seriesGroups = [ { type: 'pie', showLegend: true, enableSeriesToggle: true, series: [ { dataField: 'Share', displayText: 'Browser', showLabels: true, labelRadius: 160, labelLinesEnabled: true, labelLinesAngles: true, labelsAutoRotate: false, initialAngle: 0, radius: 125, minAngle: 0, maxAngle: 180, centerOffset: 0, offsetY: 170, formatFunction: (value, itemIdx, serieIndex, groupIndex) => { if (isNaN(value)) return value; return value + '%'; } } ] } ]; return ( <div> <JqxChart style={{ width: 400, height: 250, float: 'left' }} title={''} description={charts[0].title} source={charts[0].dataSource} showLegend={true} enableAnimations={false} padding={padding} titlePadding={titlePadding} showBorderLine={true} colorScheme={'scheme03'} seriesGroups={seriesGroups} /> <JqxChart style={{ width: 400, height: 250, float: 'left' }} title={''} description={charts[1].title} source={charts[1].dataSource} showLegend={true} enableAnimations={false} padding={padding} titlePadding={titlePadding} showBorderLine={true} colorScheme={'scheme03'} seriesGroups={seriesGroups} /> <JqxChart style={{ width: 400, height: 250, float: 'left' }} title={''} description={charts[2].title} source={charts[2].dataSource} showLegend={true} enableAnimations={false} padding={padding} titlePadding={titlePadding} showBorderLine={true} colorScheme={'scheme03'} seriesGroups={seriesGroups} /> <JqxChart style={{ width: 400, height: 250, float: 'left' }} title={''} description={charts[3].title} source={charts[3].dataSource} showLegend={true} enableAnimations={false} padding={padding} titlePadding={titlePadding} showBorderLine={true} colorScheme={'scheme03'} seriesGroups={seriesGroups} /> </div> ) } } ReactDOM.render(<App />, document.getElementById('app'));
function ownerUrl(owner) { return FlowRouter.path("profile", { username: owner.username }); } export default ownerUrl;
/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./app.ts": /*!****************!*\ !*** ./app.ts ***! \****************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lib_1 = __webpack_require__(/*! ./lib */ \"./lib/index.ts\");\nconsole.log(lib_1.lib.one, lib_1.lib.two, lib_1.lib.three, lib_1.lib.four);\n\n\n//# sourceURL=webpack:///./app.ts?"); /***/ }), /***/ "./lib/index.ts": /*!**********************!*\ !*** ./lib/index.ts ***! \**********************/ /***/ ((__unused_webpack_module, exports) => { eval("\nexports.__esModule = true;\nexports.lib = void 0;\nexports.lib = {\n one: 1,\n two: 2,\n three: 3\n};\n\n\n//# sourceURL=webpack:///./lib/index.ts?"); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module can't be inlined because the eval devtool is used. /******/ var __webpack_exports__ = __webpack_require__("./app.ts"); /******/ /******/ })() ;
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ "use strict"; const EvalSourceMapDevToolModuleTemplatePlugin = require("./EvalSourceMapDevToolModuleTemplatePlugin"); const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin"); class EvalSourceMapDevToolPlugin { constructor(options) { if (arguments.length > 1) throw new Error( "EvalSourceMapDevToolPlugin only takes one argument (pass an options object)" ); if (typeof options === "string") { options = { append: options }; } if (!options) options = {}; this.options = options; } apply(compiler) { const options = this.options; compiler.hooks.compilation.tap( "EvalSourceMapDevToolPlugin", compilation => { new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); new EvalSourceMapDevToolModuleTemplatePlugin( compilation, options ).apply(compilation.moduleTemplates.javascript); } ); } } module.exports = EvalSourceMapDevToolPlugin;
/* global Stem, Backbone */ // Trivial Backbone model for a tag. Stem.Models = Stem.Models || {}; (function () { 'use strict'; Stem.Models.Tag = Backbone.Model.extend({ // Define the default properties of a model. defaults: { selected: false } }); })();
import React from 'react'; import { shallow } from 'enzyme'; import { UserProfile } from 'components'; const defaultProps = { type: 'org', initialUser: { avatar_url: {}, updated_at: '12/12/12', }, user: { public_repos: 15, updated_at: '12/12/12', repositoryList: { title: 'repo title', }, followers: 15, following: 15, }, starCount: '12', isFollowing: false, isFollower: false, locale: 'en', navigation: {}, }; describe('<UserProfile />', () => { it('should render user profile if user has public repos and has starred repos', () => { const wrapper = shallow(<UserProfile {...defaultProps} />); const container = wrapper.find({ nativeId: 'user-profile-container' }); expect(container.length).toBeTruthy(); }); it('should return an uri based on initialUser data if initialUser has the property avatar_url', () => { const initialUser = { avatar_url: 'foo.jpg', updated_at: '01/01/01', }; const wrapper = shallow( <UserProfile {...defaultProps} initialUser={initialUser} /> ); const result = wrapper.instance().getUserUri(); const expectedResult = { uri: `${initialUser.avatar_url}&lastModified=${initialUser.updated_at}`, }; expect(result).toEqual(expectedResult); }); it("should return an uri based on user data if initialUser doesn't have the property avatar_url", () => { const initialUser = { updated_at: '01/01/01', }; const user = { avatar_url: 'foo.jpg', updated_at: '01/01/01', }; const wrapper = shallow( <UserProfile {...defaultProps} initialUser={initialUser} user={user} /> ); const result = wrapper.instance().getUserUri(); const expectedResult = { uri: `${user.avatar_url}&lastModified=${user.updated_at}`, }; expect(result).toEqual(expectedResult); }); it('should call navigation when user press Repository List TouchableOpacity component', () => { const navigationMock = jest.fn(); const navigation = { navigate: navigationMock, }; const wrapper = shallow( <UserProfile {...defaultProps} navigation={navigation} /> ); const expectedSecondArgument = { repoCount: 15, title: 'Repositories', user: { ...defaultProps.user, }, }; wrapper.find({ nativeId: 'touchable-repository-list' }).simulate('press'); expect(navigationMock).toHaveBeenCalledTimes(1); expect(navigationMock).toHaveBeenCalledWith( 'RepositoryList', expectedSecondArgument ); }); it('should call navigation when user press Start Count List TouchableOpacity component', () => { const navigationMock = jest.fn(); const navigation = { navigate: navigationMock, }; const wrapper = shallow( <UserProfile {...defaultProps} navigation={navigation} type="foo" /> ); const expectedSecondArgument = { followerCount: 15, title: 'Followers', user: defaultProps.user, }; wrapper.find({ nativeId: 'touchable-followers-list' }).simulate('press'); expect(navigationMock).toHaveBeenCalledTimes(1); expect(navigationMock).toHaveBeenCalledWith( 'FollowerList', expectedSecondArgument ); }); it('should call navigation when user press Following List TouchableOpacity component', () => { const navigationMock = jest.fn(); const navigation = { navigate: navigationMock, }; const wrapper = shallow( <UserProfile {...defaultProps} navigation={navigation} type="foo" /> ); const expectedSecondArgument = { followingCount: 15, title: 'Following', user: defaultProps.user, }; wrapper.find({ nativeId: 'touchable-following-list' }).simulate('press'); expect(navigationMock).toHaveBeenCalledTimes(1); expect(navigationMock).toHaveBeenCalledWith( 'FollowingList', expectedSecondArgument ); }); });
'use strict' const cheerio = require('cheerio') const fetch = require('./../fetch') const constants = require('./../../constants') class SearchScraper { static _fetch (query) { let options = { payload: Object.assign(constants.MOBILE.payload, { [constants.MOBILE.elements.form.submit_button]: true, [constants.MOBILE.elements.form.stop_input]: query }) } return fetch(constants.MOBILE.url, options) } static _parse (html) { return new Promise((resolve, reject) => { let $ = cheerio.load(html) let error = $('body').find(`#${constants.MOBILE.elements.dom.error}`) let stops = $('body').find(`#${constants.MOBILE.elements.dom.stop_select}`) if (error.length > 0 || !stops || stops.length <= 0) { let e = new Error('Found no results.') e.status = 400 return reject(e) } let response = stops.find('option').slice(1).map((i, option) => { option = $(option) let stop = option.attr('value') let stopName = option.text().split(',')[1].trim() if (!(stop && stopName)) { return {} } return { stop, stop_name: stopName } }).get() return resolve(response) }) } static scrape (stop, cb) { SearchScraper._fetch(stop) .then(response => SearchScraper._parse(response.body)) .then(parsed => cb(null, parsed)) .catch(error => cb(error)) } } module.exports = SearchScraper