text
stringlengths 2
6.14k
|
|---|
/*!
* Config For UZ
* Power by FIS3
* https://github.com/gavinning/aimee
*
* Aimee-app
* Date: <%= time %>
*/
|
MODX Evolution 1.0.5 = 20a76a48f4b845d16315829fc3249d80
|
/*
This file is part of CaptureTheData!
Copyright (c) 2011, Bobbie Smulders
Contact: mail@bsmulders.com
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
*/
Ext.define('CTD.view.GpsSpeedWindow', {
extend : 'CTD.view.WidgetWindow',
alias : 'widget.gpsspeedwindow',
requires : 'CTD.store.Measurements',
title : 'GPS Speed',
items : [ {
xtype : 'chart',
style : 'background : #4A4A4A',
animate : {
duration : 300,
easing : 'ease',
},
store : 'Measurements',
insetPadding : 5,
flex : 1,
axes : [ {
type : 'gauge',
position : 'gauge',
minimum : 0,
maximum : 160,
steps : 8,
margin : -7,
title : 'km/h',
} ],
series : [ {
type : 'gauge',
field : 'GPS.Speed',
donut : 72,
colorSet : [ '#FB3', '#7A7A7A' ],
} ]
} ]
});
|
'use strict';
var app = require('../..');
import request from 'supertest';
var newMoviemapping;
describe('Moviemapping API:', function() {
describe('GET /api/moviemappings', function() {
var moviemappings;
beforeEach(function(done) {
request(app)
.get('/api/moviemappings')
.expect(200)
.expect('Content-Type', /json/)
.end((err, res) => {
if (err) {
return done(err);
}
moviemappings = res.body;
done();
});
});
it('should respond with JSON array', function() {
expect(moviemappings).to.be.instanceOf(Array);
});
});
describe('POST /api/moviemappings', function() {
beforeEach(function(done) {
request(app)
.post('/api/moviemappings')
.send({
name: 'New Moviemapping',
info: 'This is the brand new moviemapping!!!'
})
.expect(201)
.expect('Content-Type', /json/)
.end((err, res) => {
if (err) {
return done(err);
}
newMoviemapping = res.body;
done();
});
});
it('should respond with the newly created moviemapping', function() {
expect(newMoviemapping.name).to.equal('New Moviemapping');
expect(newMoviemapping.info).to.equal('This is the brand new moviemapping!!!');
});
});
describe('GET /api/moviemappings/:id', function() {
var moviemapping;
beforeEach(function(done) {
request(app)
.get('/api/moviemappings/' + newMoviemapping._id)
.expect(200)
.expect('Content-Type', /json/)
.end((err, res) => {
if (err) {
return done(err);
}
moviemapping = res.body;
done();
});
});
afterEach(function() {
moviemapping = {};
});
it('should respond with the requested moviemapping', function() {
expect(moviemapping.name).to.equal('New Moviemapping');
expect(moviemapping.info).to.equal('This is the brand new moviemapping!!!');
});
});
describe('PUT /api/moviemappings/:id', function() {
var updatedMoviemapping;
beforeEach(function(done) {
request(app)
.put('/api/moviemappings/' + newMoviemapping._id)
.send({
name: 'Updated Moviemapping',
info: 'This is the updated moviemapping!!!'
})
.expect(200)
.expect('Content-Type', /json/)
.end(function(err, res) {
if (err) {
return done(err);
}
updatedMoviemapping = res.body;
done();
});
});
afterEach(function() {
updatedMoviemapping = {};
});
it('should respond with the updated moviemapping', function() {
expect(updatedMoviemapping.name).to.equal('Updated Moviemapping');
expect(updatedMoviemapping.info).to.equal('This is the updated moviemapping!!!');
});
});
describe('DELETE /api/moviemappings/:id', function() {
it('should respond with 204 on successful removal', function(done) {
request(app)
.delete('/api/moviemappings/' + newMoviemapping._id)
.expect(204)
.end((err, res) => {
if (err) {
return done(err);
}
done();
});
});
it('should respond with 404 when moviemapping does not exist', function(done) {
request(app)
.delete('/api/moviemappings/' + newMoviemapping._id)
.expect(404)
.end((err, res) => {
if (err) {
return done(err);
}
done();
});
});
});
});
|
var classvm =
[
[ "SandBox", "d0/d0a/classvm.html#a8e842bfbf905fcd1ef830b1074f59a34", null ]
];
|
'use strict';
import { writable, derived } from "svelte/store";
export const McuBootCount = writable(0);
export const McuErrorMask = writable(0);
export const McuGitTagNames = writable([]);
export const McuFirmwareVersion = writable("");
export const McuChipId = writable("");
export const McuFirmwareBuildDate = writable("");
export const McuFirmwareUpdState = writable(0);
export const McuFirmwareUpdProgress = writable(0);
export const McuFirmwareUpdChip = writable('');
const reBeta = /\d+\.\d+\.\d+\.\d+/;
export const McuGitTagNamesMaster = derived(McuGitTagNames, (allNames) => {
return allNames.filter((item) => {
return !item.match(reBeta);
});
});
export const McuGitTagNamesBeta = derived(McuGitTagNames, (allNames) => {
return allNames.filter((item) => {
return item.match(reBeta);
});
});
export const McuGitTagNameLatestMaster = derived(McuGitTagNamesMaster, (masterNames) => {
return (masterNames.length) ? masterNames[0] : "";
});
export const McuGitTagNameLatestBeta = derived(McuGitTagNamesBeta, (betaNames) => {
return (betaNames.length) ? betaNames[0] : "";
});
|
Wordpress 4.5.3 = 24c29760815a7dc701c4fd4401804d93
Wordpress 3.4.2 = 3211fa8ad9b5ff52a438e30c3b7c2998
|
define("ace/snippets/vbscript",["require","exports","module"],function(e,t,n){"use strict";t.snippetText=undefined,t.scope="vbscript"});
(function() {
window.require(["ace/snippets/vbscript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
|
define([
'./_Node'
, 'Atem-MOM/errors'
, './validators'
, './PenStrokeLeft'
, './PenStrokeRight'
], function(
Parent
, errors
, validators
, PenStrokeLeft
, PenStrokeRight
) {
"use strict";
var DeprecatedError = errors.Deprecated;
/**
* This Element represents a point of a of a MoM PenStroke contour.
* Its properties are the absolute coordinates of an on-curve point
* of the centerline of a contour.
*
* Eventually it may have a name and an identifier etc.
*
* It has three children, in order: left, center, right
* It doesn't accept add or removal of children.
*
*/
function PenStrokeCenter() {
Parent.call(this);
this.add(new PenStrokeLeft()); // 0
this.add(new PenStrokeRight()); // 1
Object.freeze(this._children);
}
var _p = PenStrokeCenter.prototype = Object.create(Parent.prototype);
_p.constructor = PenStrokeCenter;
//inherit from parent
_p._cps_whitelist = {
left: 'left'
, center: 'center'
, right: 'right'
};
//inherit from parent
(function(source) {
for(var k in source) if(!this.hasOwnProperty(k)) this[k] = source[k];
}).call(_p._cps_whitelist, Parent.prototype._cps_whitelist);
Object.defineProperty(_p, 'MOMType', {
value: 'MOM PenStrokeCenter'
});
Object.defineProperty(_p, 'type', {
/* this is used for CPS selectors */
value: 'center'
});
Object.defineProperty(_p, 'left', {
get: function() {
return this._children[0];
}
});
/**
* This is a legacy construct, when center was a sibling of left and
* right and point was the common parent. center has now taken the
* role of the old point.
*
* I'm going to raise these errors for a while, until `parent:center`
* is no longer used by CPS.
*
* When removing this, also remove the entry in _cps_whitelist.
*/
Object.defineProperty(_p, 'center', {
get: function() {
//return this;
throw new DeprecatedError('What used to be the "center" property of this '
+ 'element is now equivalent with the element '
+ 'itself: ' + this);
}
});
Object.defineProperty(_p, 'right', {
get: function() {
return this._children[1];
}
});
_p._validators = Object.create(null);
_p._validators.on = validators.validateVector;
_p._validators.in = validators.validateVector;
_p._validators.out = validators.validateVector;
_p._validators.inLength = validators.validateNumber;
_p._validators.outLength = validators.validateNumber;
_p._validators.inDir = validators.validateNumber;
_p._validators.outDir = validators.validateNumber;
_p._validators.inTension = validators.validateNumber;
_p._validators.outTension = validators.validateNumber;
_p._validators.pointBefore = validators.validateMOMSameType;
_p._validators.pointAfter = validators.validateMOMSameType;
_p._acceptedChildren = Object.create(null);
_p._acceptedChildren[PenStrokeLeft.prototype.type] = PenStrokeLeft;
_p._acceptedChildren[PenStrokeRight.prototype.type] = PenStrokeRight;
return PenStrokeCenter;
});
|
function getXMLHttp()
{
var xmlHttp;
try
{
xmlHttp = new XMLHttpRequest();
}
catch(e)
{
//Internet Explorer is different than the others
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("Old browser? Upgrade today so you can use AJAX!")
return false;
}
}
}
return xmlHttp;
}
function AjaxRequest()
{
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
HandleResponse(xmlHttp.responseText);
}
}
xmlHttp.open("GET", "myfirstprogram.php", true);
xmlHttp.send(null);
}
function HandleResponse(response)
{
document.getElementById('AjaxResponse').innerHTML = response;
}
|
'use strict';
var common = require('../common');
var path = require('path');
var assert = require('assert');
try {
require(path.join(common.fixturesDir, 'invalid.json'));
} catch (err) {
var re = /test[/\\]fixtures[/\\]invalid.json: Unexpected string/;
var i = err.message.match(re);
assert.notStrictEqual(null, i, 'require() json error should include path');
}
|
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.2/15.2.3/15.2.3.10/15.2.3.10-3-4.js
* @description Object.preventExtensions - indexed properties cannot be added into an Array object
*/
function testcase() {
var arrObj = [];
var preCheck = Object.isExtensible(arrObj);
Object.preventExtensions(arrObj);
arrObj[0] = 12;
return preCheck && !arrObj.hasOwnProperty("0");
}
runTestCase(testcase);
|
'use strict';
// Modules
const _ = require('lodash');
const LandoApiClient = require('./../lib/api');
module.exports = lando => {
// Get the API client
const api = new LandoApiClient(lando.log);
// Return the task
return {
command: 'contrib:remove',
level: 'tasks',
describe: 'Removes a Lando Contributor',
options: {
id: {
describe: 'The resource id to remove',
alias: ['i'],
string: true,
interactive: {
type: 'list',
message: 'Which contributor do you want to remove?',
choices: _(api.read('contributors'))
.map(contributor => ({name: contributor.name, value: contributor.id}))
.value(),
},
},
yes: lando.cli.confirm('Are you sure?'),
},
run: options => {
const id = api.delete('contributors', options.id);
console.log(`Removed contributor with id ${id}`);
},
};
};
|
SIN.setCookie = function (key, value, options) {
options = options || {};
value = value || '';
if (typeof options.expires === 'number') {
var ms = options.expires * 1000 * 60 * 60 * 24;
options.expires = new Date(Date.now() + ms);
}
document.cookie = [
encodeURIComponent(key), '=', encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '',
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join('');
};
SIN.readCookie = function (key) {
var cookies, result, count, i, parts, name, value;
cookies = document.cookie ? document.cookie.split('; ') : [];
result = key ? undefined : {};
for (i = 0, count = cookies.length; i < count; i += 1) {
parts = cookies[i].split('=');
name = parts.shift();
value = parts.join('=');
if (key && key === name) {
return value;
}
if (key === undefined) {
result[name] = value;
}
}
return result;
};
SIN.deleteCookie = function (key, options) {
options = options || {};
options.expires = -1;
setCookie(key, '', options);
return !(readCookie(key));
};
|
import Adapt from 'core/js/adapt';
import McqView from './McqView';
import McqModel from './McqModel';
export default Adapt.register('mcq', {
model: McqModel,
view: McqView
});
|
blm.actions.Enochian = function(observers) {
var action = observers.actionObserver.action;
var multiplier = jobActions.utils.calculateDamageBuffs(observers.effectObserver.effects);
var effects = observers.effectObserver.activeEffects();
indexOfAstralFire = observers.effectObserver.indexOf(blm.traits.AstralFire);
indexOfUmbralIce = observers.effectObserver.indexOf(blm.traits.UmbralIce);
// Apply AF multipliers
if (indexOfAstralFire > -1) {
astralFire = effects[indexOfAstralFire].obj;
multiplier = multiplier * astralFire.attributes().fireDmgMultiplier;
}
enochian = new blm.traits.Enochian();
effect = new Effect(enochian);
observers.effectObserver.add(effect);
// If weaved between GCDs then do not count towards encounter time
// observers.effectObserver.tick(castTime);
// Table viewer wrapper
this.viewer = new Viewer({
name: action.name,
potency: 0,
castTime: action.castTime,
potencyPerSecond: 0,
multiplier: multiplier,
activeEffects: effects,
encounterTime: observers.encounterObserver.timeAt()
});
}
|
"use strict";
const events = require("../events.js");
const defaultSettings = {
listPosts: {
safe: true,
sketchy: true,
unsafe: false,
},
upscaleSmallPosts: false,
endlessScroll: false,
keyboardShortcuts: true,
transparencyGrid: true,
fitMode: "fit-both",
tagSuggestions: true,
autoplayVideos: false,
postsPerPage: 42,
tagUnderscoresAsSpaces: false,
darkTheme: false,
postFlow: false,
};
class Settings extends events.EventTarget {
constructor() {
super();
this.cache = this._getFromLocalStorage();
}
_getFromLocalStorage() {
let ret = Object.assign({}, defaultSettings);
try {
Object.assign(ret, JSON.parse(localStorage.getItem("settings")));
} catch (e) {
// continue regardless of error
}
return ret;
}
save(newSettings, silent) {
newSettings = Object.assign(this.cache, newSettings);
localStorage.setItem("settings", JSON.stringify(newSettings));
this.cache = this._getFromLocalStorage();
if (silent !== true) {
this.dispatchEvent(
new CustomEvent("change", {
detail: {
settings: this.cache,
},
})
);
}
}
get() {
return this.cache;
}
}
module.exports = new Settings();
|
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'showblocks', 'ka', {
toolbar: 'არეების ჩვენება'
});
|
import bodyParser from 'body-parser';
import express from 'express';
import morgan from 'morgan';
import mongoose from 'mongoose';
import path from 'path';
import passport from 'passport';
import reactEngine from 'express-react-engine';
import routers from './routers';
import './stores';
import settingsStore from './stores/settings';
import forEach from 'lodash.foreach';
import session from 'express-session';
import connectMongo from 'connect-mongo';
var app = express();
app.use(morgan('short'));
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json({limit: 100000000}));
// View engine
app.set('views', path.join(__dirname, '../components'));
app.engine('jsx', reactEngine({wrapper: 'html.jsx', babel: false}));
// session
var MongoStore = connectMongo(session);
app.use(session({
secret: 'Is very secret',
store: new MongoStore({mongooseConnection: mongoose.connection})
}));
// Passport
app.use(passport.initialize());
app.use(passport.session());
// Static files
app.use('/', express.static(path.join(__dirname, '../../public')));
app.use((req, res, next) => {
settingsStore
.findAll()
.then((settings) => {
settings = settingsStore.parseSettings(settings);
// header
res.locals.header = [
{
tag: 'title',
content: settings.title
},
{
tag: 'link',
props: {
rel: 'stylesheet',
type: 'text/css',
href: '/css/main.css'
}
},
{
tag: 'link',
props: {
rel: 'stylesheet',
type: 'text/css',
href: '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'
}
},
{
tag: 'script',
props: {
src: '//ajax.googleapis.com/ajax/libs/webfont/1.5.10/webfont.js'
}
},
{
tag: 'link',
props: {
href: 'https://fonts.googleapis.com/icon?family=Material+Icons',
rel: 'stylesheet'
}
}
];
// Custom fonts
if (settings.fonts && settings.fonts.customFonts) {
const customFonts = settings.fonts.customFonts;
var css = '';
forEach(customFonts, (customFont) => {
const family = customFont.family;
const map = customFont.files;
const location = '/fonts/'+customFont.id+'/';
css += '@font-face {';
css += 'font-family: "'+family+'";';
css += 'src: url("'+location+map.eot+'"); ';
css += 'src: ';
// try woff2
if (map.woff2) {
css += 'url("'+location+map.woff2+'"), ';
}
css += 'url("'+location+map.woff+'"), ';
css += 'url("'+location+map.ttf+'"); ';
css += '}';
});
res.locals.header.push({
tag: 'style',
props: {
type: 'text/css'
},
content: css
});
if (settings.fonts.webfontloader) {
res.locals.header.push({
tag: 'script',
content: 'WebFont.load('+JSON.stringify(settings.fonts.webfontloader)+');'
});
}
}
// footer
res.locals.footer = [{
tag: 'script',
props: {
src: '/js/common.js'
}
}];
next();
})
.catch(() => {
res.status(404).end();
});
});
// Block access to API endpoints when user is not authenticated
app.use('/api*', (req, res, next) => {
if (req.method !== 'GET' && !req.isAuthenticated()) {
res.status(401).send();
} else {
next();
}
});
(function iterateRouters (routers) {
for (let key in routers) {
if (Object.getPrototypeOf(routers[key]).route) {
app.use('/', routers[key]);
} else {
iterateRouters(routers[key]);
}
}
})(routers);
app.use((req, res, next) => {
res.status(404).end();
});
app.use((error, req, res) => {
var statusCode = error.statusCode || 500;
var err = {
error: statusCode,
message: error.message
};
if (!res.headersSent) {
res.status(statusCode).send(err);
}
});
export default app;
|
/**
GaiaEHR (Electronic Health Records)
Copyright (C) 2013 Certun, LLC.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Ext.define('App.store.administration.PreventiveCareActiveProblems',
{
model : 'App.model.administration.PreventiveCareActiveProblems',
extend : 'Ext.data.Store',
proxy :
{
type : 'direct',
api :
{
read : PreventiveCare.getGuideLineActiveProblems,
create : PreventiveCare.addGuideLineActiveProblems,
destroy : PreventiveCare.removeGuideLineActiveProblems
}
},
remoteSort : false,
autoLoad : false
});
|
(function() {
var LocationSelector,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
LocationSelector = (function(_super) {
__extends(LocationSelector, _super);
function LocationSelector() {
return LocationSelector.__super__.constructor.apply(this, arguments);
}
LocationSelector.prototype.className = 'location-selector';
LocationSelector.prototype.events = {
'click .bit': 'handleClick'
};
LocationSelector.prototype.render = function() {
this.$el.html('');
return this.draw();
};
LocationSelector.prototype.draw = function() {
this._addBit('top left');
this._addBit('top right');
this._addBit('top');
this._addBit('bottom left');
this._addBit('bottom right');
return this._addBit('bottom');
};
LocationSelector.prototype._addBit = function(classes) {
var bit;
bit = $('<div>');
bit.addClass("bit " + classes);
bit.attr('data-position', classes);
this.$el.append(bit);
return bit;
};
LocationSelector.prototype.handleClick = function(e) {
var $bit;
$bit = $(e.target);
return this.trigger('update', $bit.attr('data-position').split(' '));
};
return LocationSelector;
})(Backbone.View);
$.fn.locationSelector = function(opts) {
var loc;
loc = new LocationSelector($.extend({}, opts, {
el: this
}));
$(this).addClass(loc.className);
loc.render();
return loc;
};
}).call(this);
|
'use strict';
var BankAccountInquiryPage = function() {
browser.ignoreSynchronization = true;
var page = this;
this.pageElements = function() {
page.account = element(by.name('bank_account'));
page.dateFrom = element(by.name('TransAfterDate'));
page.dateTo = element(by.name('TransToDate'));
page.submit = element(by.name('Show'));
}
this.search = function(account, from, to) {
page.account.element(by.cssContainingText('option', account)).click();
browser.sleep(700);
page.dateFrom.clear();
page.dateFrom.sendKeys(from);
page.dateTo.clear();
page.dateTo.sendKeys(to);
page.submit.click();
browser.sleep(700);
this.pageElements();
};
this.getTitle = function() {
return browser.getTitle();
};
this.getResultRow = function(row) {
this.pageElements();
var items = element.all(by.css('div#trans_tbl tr'))
.get(row + 2)
.all(by.tagName('td'))
.map(function(cellElement, cellIndex) {
return {
column: cellIndex,
text: cellElement.getText()
};
});
return items;
};
this.getBalance = function() {
this.pageElements();
var items = element.all(by.css('div#trans_tbl tr.inquirybg'))
.get(1)
.all(by.tagName('td'))
.map(function(cellElement, cellIndex) {
return {
column: cellIndex,
text: cellElement.getText()
};
});
return items;
}
browser.get('/gl/inquiry/bank_inquiry.php');
this.pageElements();
}
module.exports = BankAccountInquiryPage;
|
var lastFocusedControlId = "";
function focusHandler(e) {
if ((e.originalTarget != undefined) && (e.originalTarget != null)) {
try {
if (!e.originalTarget.focus) {
e.originalTarget.focus = true;
}
}
catch (err) { }
}
}
function appInit() {
if (typeof (window.addEventListener) !== "undefined") {
window.addEventListener("focus", focusHandler, true);
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler);
}
function pageLoadingHandler(sender, args) {
lastFocusedControlId = typeof (document.activeElement) === "undefined"
? "" : document.activeElement.id;
}
function focusControl(targetControl) {
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
var focusTarget = targetControl;
if (focusTarget && (typeof (focusTarget.contentEditable) !== "undefined")) {
oldContentEditableSetting = focusTarget.contentEditable;
focusTarget.contentEditable = false;
}
else {
focusTarget = null;
}
try
{
targetControl.focus();
if (focusTarget) {
focusTarget.contentEditable = oldContentEditableSetting;
}
}
catch (err) { }
}
else {
try {
targetControl.focus();
}
catch (err) { }
}
}
function pageLoadedHandler(sender, args) {
if (typeof (lastFocusedControlId) !== "undefined" && lastFocusedControlId != "") {
var newFocused = $get(lastFocusedControlId);
if ((newFocused != null) && (newFocused != undefined) && (newFocused.disabled != undefined) && (newFocused.disabled != null) && (newFocused.disabled == false)) {
focusControl(newFocused);
}
}
}
Sys.Application.add_init(appInit);
|
(function (App) {
'use strict';
var apiUrl = 'http://vodo.net/popcorn',
db = new Datastore();
function Vodo() {
if (!(this instanceof Vodo)) {
return new Vodo();
}
App.Providers.Generic.call(this);
}
inherits(Vodo, App.Providers.Generic);
function formatForButter(items) {
var results = {};
var movieFetch = {};
movieFetch.results = [];
movieFetch.hasMore = (Number(items.length) > 1 ? true : false);
_.each(items, function (movie) {
if (movie.Quality === '3D') {
return;
}
var imdb = movie.ImdbCode;
// Calc torrent health
var seeds = 0; //XXX movie.TorrentSeeds;
var peers = 0; //XXX movie.TorrentPeers;
var torrents = {};
torrents[movie.Quality] = {
url: movie.TorrentUrl,
size: movie.SizeByte,
filesize: movie.Size,
seed: seeds,
peer: peers
};
var ptItem = results[imdb];
if (!ptItem) {
ptItem = {
imdb_id: imdb,
title: movie.MovieTitleClean.replace(/\([^)]*\)|1080p|DIRECTORS CUT|EXTENDED|UNRATED|3D|[()]/g, ''),
year: movie.MovieYear,
genre: [movie.Genre],
rating: movie.MovieRating,
image: movie.CoverImage,
cover: movie.CoverImage,
backdrop: movie.CoverImage,
torrents: torrents,
subtitle: {}, // TODO
trailer: false,
synopsis: movie.Synopsis || 'No synopsis available.',
type: 'movie'
};
movieFetch.results.push(ptItem);
} else {
_.extend(ptItem.torrents, torrents);
}
results[imdb] = ptItem;
});
return movieFetch.results;
}
Vodo.prototype.extractIds = function (items) {
return _.pluck(items.results, 'imdb_id');
};
Vodo.prototype.config = {
uniqueId: 'imdb_id',
tabName: 'Vodo',
type: 'movie',
/* should be removed */
//subtitle: 'ysubs',
metadata: 'trakttv:movie-metadata'
};
Vodo.prototype.updateAPI = function () {
var self = this;
var defer = Q.defer();
win.info('Request to Vodo', apiUrl);
request({
uri: apiUrl,
strictSSL: false,
json: true,
timeout: 10000
},
function (err, res, data) {
/*
data = _.map (helpers.formatForButter(data), function (item) {
item.rating = item.rating.percentage * Math.log(item.rating.votes);
return item;
});
*/
db.insert(formatForButter(data.downloads), function (err, newDocs) {
if (err) {
win.error('Vodo.updateAPI(): Error inserting', err);
}
db.find({}).limit(2).exec(function (err, docs) {
//win.debug('FIND ---->', err, docs);
});
defer.resolve(newDocs);
});
});
return defer.promise;
};
Vodo.prototype.fetch = function (filters) {
var self = this;
if (!self.fetchPromise) {
self.fetchPromise = this.updateAPI();
}
var defer = Q.defer();
var params = {
sort: 'rating',
limit: 50
};
var findOpts = {};
if (filters.keywords) {
findOpts = {
title: new RegExp(filters.keywords.replace(/\s/g, '\\s+'))
};
}
if (filters.genre) {
params.genre = filters.genre;
}
if (filters.order) {
params.order = filters.order;
}
if (filters.sorter && filters.sorter !== 'popularity') {
params.sort = filters.sorter;
}
var sortOpts = {};
sortOpts[params.sort] = params.order;
self.fetchPromise.then(function () {
db.find(findOpts)
.sort(sortOpts)
.skip((filters.page - 1) * params.limit)
.limit(Number(params.limit))
.exec(function (err, docs) {
docs.forEach(function (entry) {
entry.type = 'movie';
});
return defer.resolve({
results: docs,
hasMore: docs.length ? true : false
});
});
});
return defer.promise;
};
Vodo.prototype.detail = function (torrent_id, old_data) {
return Q(old_data);
};
App.Providers.Vodo = Vodo;
})(window.App);
|
'use strict';
var cheerio = require( 'cheerio' );
function isJsonString( data ) {
try {
JSON.parse( data );
} catch (e) {
return false;
}
return true;
}
function parseArticles( html ) {
var el = cheerio.load( html || '' );
var articles = el( 'article.badge-entry-container' );
var result = [];
result = ( Object.keys( articles ) ).map( function getItemHtml( key ) {
return !isNaN( key ) ? el.html( articles[key] ) : null;
} ) || [];
return result.filter( function filterValidElement( item ) {
return !!item;
} );
}
function getArticlesFromObject( data ) {
data = data.items || {};
return Object.keys( data ).map( function getItemHtml( itemId ) {
return data[itemId];
}) || [];
}
function parse( dataToParse ) {
var articleList = [];
if ( typeof dataToParse === 'object' ) {
articleList = getArticlesFromObject( dataToParse );
} else {
articleList = parseArticles( dataToParse );
}
return articleList;
}
module.exports = {
/**
* Method responsible for parse given data. This data should be a stringified JSON or HTML.
*
* @param {String}
* @return {Object}
*/
parse: parse
};
|
var $animText = $("#anim_text");
$animText.html( $animText.html().replace(/./g, "<span>$&</span>").replace(/\s/g, " "));
//TweenMax.staggerFromTo( $animText.find("span"), 0.1, {autoAlpha:0}, {autoAlpha:1}, 0.1 );
$animText.find("span").each(function(){
TweenMax.fromTo(this, 2.5, {autoAlpha:0, rotation:randomNum(-360, 360), rotationX:randomNum(-360, 360), rotationY:randomNum(-360, 360), rotationZ:randomNum(-360, 360), scale:0}, {autoAlpha:1, rotation:0, rotationX:0, rotationY:0, rotationZ:0, scale:1});
});
//helper random function
function randomNum (min, max) {
return Math.random() * (max - min) + min;
}
|
CanyonRunner.NavigationHome = function (game) {
this.advanceButton = null;
};
CanyonRunner.NavigationHome.prototype = {
create: function () {
this.sound = this.game.add.audioSprite('sound');
//Show Navigation Supply Screen
this.background = this.add.sprite(0, 0, 'sprites', 'navigation-home');
/////////////////////////////
//CREATE SOUND TOGGLE BUTTON
/////////////////////////////
this.mute = false;
this.soundButton = this.game.add.button(this.game.world.centerX + 240, this.game.world.centerY -290, 'sprites', this.toggleMute, this, 'sound-icon', 'sound-icon', 'sound-icon');
this.soundButton.fixedToCamera = true;
if (!this.game.sound.mute){
this.soundButton.tint = 16777215;
} else {
this.soundButton.tint = 16711680;
}
this.advanceButton = this.add.button(320, 500, 'sprites', this.startGame, this, 'start-button', 'start-button', 'start-button');
//Set Content
this.content = [
" ",
"Night Falls. You Approach Your Home Sector",
"There Are 50 Major Spires To Avoid Here...",
"Heavy Meteor Showers Detected In This Area",
"You Must Obtain a Fix On Your Home Beacon",
"Navigate Through the Storm. Ping Your Home."
];
this.index = 0;
this.line = '';
//Show Specific Level Objective Text
this.level1ObjectiveTextStyle = { font: "35px Helvetica", fill: "#05c619", stroke: "#000", strokeThickness: 10, align: "center" };
this.text = this.game.add.text(this.game.world.centerX - 350, this.game.world.centerY -275, this.level1ObjectiveTextString, this.level1ObjectiveTextStyle);
//Loop Sonar Sound on This Screen
this.sound.play('sonar');
this.nextLine();
},
updateLine: function() {
if (this.line.length < this.content[this.index].length) {
this.line = this.content[this.index].substr(0, this.line.length + 1);
this.text.setText(this.line);
} else {
this.game.time.events.add(Phaser.Timer.SECOND * 2, this.nextLine, this);
}
},
nextLine: function() {
this.index++;
if (this.index < this.content.length) {
this.line = '';
this.game.time.events.repeat(80, this.content[this.index].length + 1, this.updateLine, this);
}
},
update: function () {
},
toggleMute: function() {
if (!this.mute) {
this.game.sound.mute = true;
this.mute = true;
this.soundButton.tint = 16711680;
} else {
this.game.sound.mute = false;
this.mute = false;
this.soundButton.tint = 16777215;
}
},
startGame: function (pointer) {
this.sound.stop('sonar');
this.state.start('Level3');
}
};
|
// **********************************************************************
//
// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.6.1
//
// <auto-generated>
//
// Generated from file `LXSliceLotteryDraw.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//
(function(module, require, exports)
{
var Ice = require("ice").Ice;
var __M = Ice.__M;
var LXGrid = __M.require(module,
[
"LXGrid.Common/LXSliceDefine",
"LXGrid.App/Lottery/LXSliceLotteryDefine"
]).LXGrid;
var Slice = Ice.Slice;
LXGrid.App = __M.module("LXGrid.App");
LXGrid.App.Lottery = __M.module("LXGrid.App.Lottery");
Object.defineProperty(LXGrid.App.Lottery, 'IObjectLotteryDrawName', {
value: "IObjectLotteryDraw"
});
LXGrid.App.Lottery.IObjectLotteryDraw = Slice.defineObject(
undefined,
Ice.Object,
[
LXGrid.Common.IObjectBase
], 1,
[
"::Ice::Object",
"::LXGrid::App::Lottery::IObjectLotteryDraw",
"::LXGrid::Common::IObjectBase"
],
-1, undefined, undefined, false);
LXGrid.App.Lottery.IObjectLotteryDrawPrx = Slice.defineProxy(Ice.ObjectPrx, LXGrid.App.Lottery.IObjectLotteryDraw.ice_staticId, [
LXGrid.Common.IObjectBasePrx]);
Slice.defineOperations(LXGrid.App.Lottery.IObjectLotteryDraw, LXGrid.App.Lottery.IObjectLotteryDrawPrx,
{
"GetLotteryDrawInfo": [, , , , , [LXGrid.Common.LXReturn], [[3]], [["LXGrid.App.Lottery.LXLotteryInfo", true], ["LXGrid.App.Lottery.LXPrizeInfoSeqHelper"]], , , true],
"GetPrizeInfo": [, , , , , [LXGrid.Common.LXReturn], [[3], [3]], [["LXGrid.App.Lottery.LXPrizeInfo", true]], , , true],
"GetTicketCount": [, , , , , [LXGrid.Common.LXReturn], [[3], [3]], [[3], [3]], , , ],
"GetTicketList": [, , , , , [LXGrid.Common.LXReturn], [[3], [3]], [["LXGrid.App.Lottery.LXTicketInfoSeqHelper"]], , , true],
"GetWinList": [, , , , , [LXGrid.Common.LXReturn], [[3]], [["LXGrid.App.Lottery.LXWinInfoSeqHelper"]], , , true],
"LuckDraw": [, , , 1, , [LXGrid.Common.LXReturn], [[3], [3]], [["LXGrid.App.Lottery.LXTicketInfoSeqHelper"]], , , true],
"ExchangeTicket": [, , , 1, , [LXGrid.Common.LXReturn], [[3], [3], [3]], [["LXGrid.App.Lottery.LXTicketInfoSeqHelper"]], , , true],
"GetCashInfo": [, , , , , [LXGrid.Common.LXReturn], [[3]], [["LXGrid.App.Lottery.LXCashInfo", true]], , , true],
"SubmitCashInfo": [, , , 1, , [LXGrid.Common.LXReturn], [[3], [3], [7], [7], [7], [7]], , , , ],
"CreateLotteryDraw": [, , , 1, , [LXGrid.Common.LXReturn], [[3], ["LXGrid.App.Lottery.LXLotteryInfo", true], ["LXGrid.App.Lottery.LXPrizeCommInfoSeqHelper"]], [[3]], , true, ],
"ModifyLotteryDraw": [, , , 1, , [LXGrid.Common.LXReturn], [[3], ["LXGrid.App.Lottery.LXLotteryInfo", true], ["LXGrid.App.Lottery.LXPrizeCommInfoSeqHelper"]], , , true, ],
"DeleteLotteryDraw": [, , , 1, , [LXGrid.Common.LXReturn], [[3]], , , , ],
"GetLotteryDrawList": [, , , , , [LXGrid.Common.LXReturn], [[3], [3]], [[3], ["LXGrid.App.Lottery.LXLotteryCommInfoSeqHelper"], ["LXGrid.App.Lottery.LXLotteryPrizeSeqHelper"]], , , true],
"SetTicketInfo": [, , , 1, , [LXGrid.Common.LXReturn], [[3], ["LXGrid.App.Lottery.LXTicketInfo", true]], , , true, ],
"CreateTicket": [, , , 1, , [LXGrid.Common.LXReturn], [[3], [3]], [["LXGrid.App.Lottery.LXTicketInfo", true]], , , true],
"SetPresetTicket": [, , , 1, , [LXGrid.Common.LXReturn], [[3], [3], [3]], [["LXGrid.App.Lottery.LXTicketInfo", true]], , , true],
"SetCashInfo": [, , , 1, , [LXGrid.Common.LXReturn], [[3], [3], ["LXGrid.App.Lottery.LXCashInfo", true]], , , true, ],
"GetTicketStream": [, , , , , [LXGrid.Common.LXReturn], [[3], [3], [3], [3], [3], [3]], [["LXGrid.App.Lottery.LXTicketInfoSeqHelper"]], , , true],
"GetLotteryStatCount": [, , , , , [LXGrid.Common.LXReturn], [[3]], [["LXGrid.App.Lottery.LXLotteryStat", true]], , , true],
"ReturnExpireExchangeTicket": [, , , 1, , [LXGrid.Common.LXReturn], [[3]], , , , ]
});
exports.LXGrid = LXGrid;
}
(typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? module : undefined,
typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? require : window.Ice.__require,
typeof(global) !== "undefined" && typeof(global.process) !== "undefined" ? exports : window));
|
/*globals define, document, module, ReadNES, window*/
(function (document, window, undefined) {
"use strict";
var ReadNESshiv = {
init: function () {
ReadNES.vars.shiv = "../shiv/ReadNESshiv.php";
ReadNES.extend({
events: function () {
var input = this.el.input;
input.onchange = this.iframe;
return this;
},
iframe: function () {
var $this = ReadNES, drag = $this.el.drag, iframe = {};
drag.action = $this.vars.shiv;
drag.target = "iframe";
iframe = document.createElement("iframe");
iframe.name = "iframe";
iframe.id = "iframe";
iframe.width = 0;
iframe.height = 0;
iframe.frameborder = 0;
drag.appendChild(iframe);
drag.submit();
$this.el.iframe = iframe;
if (iframe.addEventListener) {
iframe.addEventListener("load", $this.read, false);
} else {
iframe.attachEvent("onload", $this.read);
}
return this;
},
read: function () {
var $this = ReadNES, iframe = $this.el.iframe, data = {},
content = iframe.contentDocument || iframe.contentWindow.document;
data = $this.util.json(content.getElementsByTagName("body")[0].innerHTML);
$this.rom.data.main = $this.util.base64_decode(data.main);
$this.rom.data.name = data.name;
$this.loaded();
}
});
}
};
if (typeof module === "object" && module && typeof module.exports === "object") {
module.exports = ReadNESshiv;
} else {
window.ReadNESshiv = ReadNESshiv;
if (typeof define === "function" && define.amd) {
define("ReadNESshiv", [], function () {
return ReadNESshiv;
});
}
}
}(document, window));
|
import { getResource } from './../common.js'
export const domain = '9now';
export const resource = {
buttonClassName: 'vjs-control vjs-button',
buttonHoverStyle: /** CSS */ (`
filter: brightness(50%) sepia(1) hue-rotate(167deg) saturate(253%) brightness(104%);
`),
buttonInsertBefore: function(/** Element */ parent) {
return parent.querySelector('.vjs-fullscreen-control');
},
buttonParent: function() {
return document.querySelector('.vjs-control-bar');
},
buttonScale: 0.7,
buttonStyle: /** CSS */ (`
order: 999999;
cursor: pointer;
height: 44px;
width: 40px;
`),
captionElement: function() {
const e = getResource().videoElement();
return e && e.parentElement.querySelector('.vjs-text-track-display');
},
videoElement: function() {
return document.querySelector('video.vjs-tech');
},
};
|
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.4/15.4.4/15.4.4.21/15.4.4.21-9-c-i-19.js
* @description Array.prototype.reduce - element to be retrieved is own accessor property without a get function that overrides an inherited accessor property on an Array-like object
*/
function testcase() {
var testResult = false;
var initialValue = 0;
function callbackfn(prevVal, curVal, idx, obj) {
if (idx === 1) {
testResult = (curVal === undefined);
}
}
try {
Object.defineProperty(Object.prototype, "1", {
get: function () {
return 1;
},
configurable: true
});
var obj = { 0: 0, 2: 2, length: 3 };
Object.defineProperty(obj, "1", {
set: function () { },
configurable: true
});
Array.prototype.reduce.call(obj, callbackfn, initialValue);
return testResult;
} finally {
delete Object.prototype[1];
}
}
runTestCase(testcase);
|
// jslint configuration. Don't put spaces before 'jslint' and 'global'.
/*jslint browser: true */
/*global $, window */
// Format the form.
$(document).ready(function () {
$('div#content').addClass('container');
// Bootstrap tooltip, not to be confused with jQuery tools tooltip.
$('div.help_tooltip').tooltip({placement: 'left'});
//$('form p').wrap('<div class="row" />')
//$('form p input[type="text"]').wrap('<div class="span4" />')
//$('form p label').wrap('<div class="span4 offset1" />')
//$('form p div.help_tooltip').wrap('<div class="span1" />')
//$('form input[type="submit"]').wrap('<div class="span4" />')
//$('form li label').parents('ul').wrap('<div class="span8" />')
})
|
/*jslint browser: true*/
'use strict';
//Fungsi untuk memudahkan buat Node
function createNode(element) {
return document.createElement(element); // Membuat tipe elemen yang dilewatkan melalui parameter
};
//Fungsi untuk menambahkan sub node di bawah Node
function append(parent, el) {
return parent.appendChild(el); // Append parameter kedua ke yang pertama
};
var aksaraAsal = document.getElementById('aksaraAsal');
var petunjukAksara = document.getElementById('petunjukAksara');
kataAsal.onkeyup = function () {
//Merubah ke huruf kecil semua agar tidak ada perbedaan huruf kecil dan besar
let kataAsals = kataAsal.value.toLowerCase();
// Jika spasi saja, tidak diproses
if (!kataAsals.replace(/\s/g, '').length) {
hasilTerjemah.innerHTML = 'Silakan mengaksarakan';
hasilTerjemah.classList.remove("alert", "alert-info", "alert-warning");
hasilTerjemah.classList.add("alert", "alert-info");
} else {
// Mengubah kata/kalimat yang diketik menjadi array String
let kataAl = kataAsals.split(/\s+/);
// jika elemen akhir kosong, elemen akhir dibuang
if (kataAl[kataAl.length - 1] == ('')) {
kataAl.pop();
}
//Mengosongkan nilai dan menghilangkan style
hasilTerjemah.innerHTML = '';
hasilTerjemah.classList.remove("alert", "alert-info", "alert-warning");
let strong = createNode("strong");
strong.innerHTML = kataAsal.value + ' : <br/>';
let spanAksara = createNode('span');
spanAksara.classList.add("aksaraLampung");
append(strong, spanAksara);
append(hasilTerjemah, strong);
for (let i = 0; i < kataAl.length; i++) {
//menambahkan ke bagian strong untuk diaksarakan
spanAksara.innerHTML += aksarakan(kataAl[i]) + ' ';
}
hasilTerjemah.classList.add("alert", "alert-info");
}
};
aksaraAsal.onkeyup = function () {
let aksaraAsals = aksaraAsal.value;
// Jika spasi saja, tidak diproses
if (!aksaraAsals.replace(/\s/g, '').length) {
aksaraAsal.classList.remove("aksaraLampung");
hasilTerjemah.innerHTML = 'Silakan mengaksarakan';
hasilTerjemah.classList.remove("alert", "alert-info", "alert-warning");
hasilTerjemah.classList.add("alert", "alert-info");
} else {
aksaraAsal.classList.add("aksaraLampung");
// Mengubah kata/kalimat yang diketik menjadi array String
let aksaraAl = aksaraAsals.split(/\s+/);
// jika elemen akhir kosong, elemen akhir dibuang
if (aksaraAl[aksaraAl.length - 1] == ('')) {
aksaraAl.pop();
}
//Mengosongkan nilai dan menghilangkan style
hasilTerjemah.innerHTML = '';
hasilTerjemah.classList.remove("alert", "alert-info", "alert-warning");
let strong = createNode("strong");
strong.innerHTML = alfabetkan(aksaraAsal.value) + ' : <br/>';
let spanAksara = createNode('span');
spanAksara.classList.add("aksaraLampung");
append(strong, spanAksara);
append(hasilTerjemah, strong);
for (let i = 0; i < aksaraAl.length; i++) {
//menambahkan ke bagian strong untuk diaksarakan
spanAksara.innerHTML += aksaraAl[i] + ' ';
}
hasilTerjemah.classList.add("alert", "alert-info");
}
};
|
setInterval(function () {
update();
}, 1000);
function update() {
var currentdate = new Date();
var arrTime = [currentdate.getHours(),currentdate.getMinutes(),currentdate.getSeconds()];
//arrTime = [23,59,59];
var i = 0;
var d = 1;
do{
lightsOn(d, Math.floor(arrTime[i]/10));
lightsOn(d+1, arrTime[i] % 10);
d=d+2;
i++;
}
while(i<arrTime.length);
}
/**
*
* @param digit
* @param lights
*/
function lightsOn(digit, lights) {
if (lights) {
var i = 1;
do {
var $el = $(".linearWatch ul:nth-child(" + digit + ") li:nth-child(" + i + ")");
$el.addClass("active");
i++;
}
while (i<=lights);
}else{
$(".linearWatch ul:nth-child(" + digit + ") li").removeClass("active");
}
}
|
var SSLYeah = require('../ssl-yeah.js');
const constants = require('../modules/constants.js');
var progressRefreshInterval = '';
//*************INIT**************//
process.stdin.setEncoding('utf8');
var crawler = new SSLYeah();
crawler.on('crawlDone', conclude);
//*************MAIN*************//
if(process.argv[2]){
crawler.startCrawl(process.argv[2]);
progressRefreshInterval = setInterval(trackProgress, 500);
testing = true;
}else{
help();
}
process.stdin.on('readable', function() {
var chunk = process.stdin.read();
if (chunk !== null) {
var command = chunk.toString().replace(/\r?\n$/, '');
if(command.match(/^do\s(?:.*\.)*.{1,}$/)){
//TODO -- could queue additional commands instead of blocking them...
//then we'd have to clear all data after each request is done... or export as a new instance every time?
if(testing == false){
testing = true;
crawler.startCrawl(command.substr(3, command.length-3));
progressRefreshInterval = setInterval(trackProgress, 500);
}
}else{
switch (command){
case 'exit':
sslyeah.logEnd();
process.exit(0);
break;
case 'help':
case '?':
help();
break;
default:
console.log('unrecognised command: ' + command);
}
}
}
});
process.on('exit', function(code) {
console.log('Goodbye - Exiting with code:', code);
});
//***********FUNCTIONS***********//
function help(){
clearConsole();
console.log('---------------------- Welcome to SSL-Yeah ------------------------');
console.log('- ');
console.log('- Settings can be changed in the config file under config/config.js');
console.log('- ');
console.log('- Commands:');
console.log('- "do **domain name**" to create a rule');
console.log('- "exit" to quit');
console.log('- "help" or "?" to display this');
console.log('- ');
console.log('---------------------------------------------------------------------- ');
}
function clearConsole(){
if (process.platform == 'win32'){
process.stdout.write('\033c');
}else{
process.stdout.write('\033[2J'); //needs testing on linux
}
}
function trackProgress(){
var showMaxHosts = 17;
var activeTestsCount = 0;
var activeHostsCount = 0;
var doneHostsCount = 0;
var pagesDone = 0;
var pass = 0;
var fail = 0;
crawler.hosts.forEach(function(host){
pagesDone = pagesDone + host.pages.length;
activeTestsCount = activeTestsCount + host.activeTests;
if(host.activeTests == 0){
doneHostsCount ++;
}else{
activeHostsCount ++;
}
if(host.assessment == constants['pass'] || host.assessment == constants['mixedPassive']){
pass ++;
}else{
fail ++;
}
});
if(crawler.settings.outputDebugToConsole == false){
if(typeof(trackProgress.blink) == 'undefined' || trackProgress.blink == ''){
trackProgress.blink = 'Still working...';
}else{
trackProgress.blink = '';
}
clearConsole();
console.log('SSL-Yeah - Progress - ' + pagesDone + ' pages requested so far. ' + trackProgress.blink);
console.log('----------------------------------------------------------------------------');
if(crawler.hosts.length < showMaxHosts){
crawler.hosts.forEach(function(host){
console.log(host.url + ' - ' + host.activeTests + ' pages in queue - ' + host.getFinalAssessment());
});
}else{
var shownCount = 0;
crawler.hosts.forEach(function(domain){
if(host.activeTests > 0 && shownCount < showMaxHosts){
shownCount ++;
console.log(host.url + ' - ' + host.activeTests + ' pages in queue - ' + host.getFinalAssessment());
}
});
console.log('');
console.log('+ ' + (activeHostsCount - shownCount) + ' other domains in test');
console.log('+ ' + doneHostsCount + ' domains done');
console.log('Results so far ==> Pass, Warn, N/A: ' + pass + ' Fail: ' + fail);
}
}
}
function conclude(){
clearInterval(progressRefreshInterval);
console.log('');
console.log('Crawl done... Writing to file...');
if(crawler.settings.outputReport){
crawler.writeReport(end);
}
if(crawler.settings.outputRule){
crawler.writeRule(end);
}
}
function end(){
if(crawler.writingRule == false && crawler.writingReport == false){
SSLYeah.logWrite('All Done');
console.log('All Done');
SSLYeah.logEnd();
process.exit(0);
}
}
|
const Config = require('./Config');
module.exports = require('./' + Config.dal);
|
/*
* This file is part of Saladay <https://www.crimx.com/rn-saladay/>.
* Copyright (C) 2017 CRIMX <straybugs@gmail.com>
*
* Saladay is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* Saladay 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Saladay. If not, see <http://www.gnu.org/licenses/>.
*/
import { SQLite } from 'expo'
import { pickle } from './helpers'
export default class GoalLists {
constructor (db) {
this.db = db || SQLite.openDatabase('saladay.db')
}
/**
* @param {object|object[]} data
* @return Promse
*/
insert (data) {
let arr = Array.isArray(data) ? data : [data]
const keys = ['list_id', 'list_title', 'list_color', 'list_order']
const sql = (
`INSERT INTO goal_lists
(${keys.join(',')})
VALUES
(${Array(keys.length).fill('?').join(',')});`
)
return new Promise((resolve, reject) => {
this.db.transaction(tx => {
pickle(arr, keys).forEach(d => {
tx.executeSql(
sql,
keys.map(k => d[k])
)
})
}, reject, resolve)
})
}
/**
* @return Promse<object[]>
*/
getAll () {
return new Promise((resolve, reject) => {
this.db.transaction(tx => {
tx.executeSql(
`SELECT * FROM goal_lists ORDER BY list_order`,
[],
(_, {rows}) => resolve(rows._array)
)
}, reject)
})
}
update (listItem) {
return new Promise((resolve, reject) => {
if (!listItem.list_id) { return reject('updateListItem: Missing PK list_id') }
let keys = [
'list_title',
'list_color',
'list_order'
].filter(k => listItem[k] !== undefined)
this.db.transaction(tx => {
tx.executeSql(
`UPDATE goal_lists
SET ${keys.map(k => k + ' = ?').join(',')}
WHERE list_id = ?`,
[...keys.map(k => listItem[k]), listItem.list_id]
)
}, reject, resolve)
})
}
}
|
// ------------------------------------
// Off-Canvas Navigation
// ------------------------------------
angular.module("risevision.common.header")
.service("offCanvas", ["$window",
function ($window) {
var service = {
visible: false,
enabled: false
};
service.enabled = angular.element($window).width() <= 1200 ? true :
false;
service.toggle = function (event) {
if (event) {
event.stopPropagation();
}
if (!service.enabled && !service.visible) {
return;
}
service.visible = !service.visible;
if (service.visible) {
service.nav.addClass("is-off-canvas-opened");
} else {
service.nav.removeClass("is-off-canvas-opened");
}
};
service.registerNav = function (nav) {
service.nav = nav;
service.nav.addClass("off-canvas--container");
};
window.onresize = function () {
service.enabled = angular.element($window).width() <= 1200 ? true :
false;
};
return service;
}
])
.directive("offCanvasContent", ["offCanvas", "$swipe",
function (offCanvas, $swipe) {
return {
restrict: "A",
link: function (scope, iElement) {
// Swipe coords
var startCoords;
// Handle swipe gesture
$swipe.bind(iElement, {
"start": function (coords) {
startCoords = coords;
},
"end": function (coords) {
if (coords.x - startCoords.x > 0) {
offCanvas.toggle();
}
}
});
}
};
}
])
.directive("offCanvasNav", ["offCanvas", "$swipe",
function (offCanvas, $swipe) {
return {
restrict: "A",
link: function (scope, iElement) {
iElement.addClass("off-canvas--nav");
offCanvas.registerNav(iElement);
// Swipe coords
var startCoords;
// Handle swipe gesture
$swipe.bind(iElement, {
"start": function (coords) {
startCoords = coords;
},
"end": function (coords) {
if (coords.x - startCoords.x < 0) {
offCanvas.toggle();
}
}
});
// Handle Click
iElement.bind("tap", offCanvas.toggle);
iElement.bind("click", offCanvas.toggle);
}
};
}
])
.directive("offCanvasToggle", ["offCanvas",
function (offCanvas) {
return {
restrict: "A",
link: function (scope, iElement) {
iElement.bind("tap", offCanvas.toggle);
iElement.bind("click", offCanvas.toggle);
}
};
}
]);
|
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { addTodo } from '../actions/index'
import { bindActionCreators } from 'redux'
/*** REDUX AWARE ***/
class TodoList extends Component {
renderList() { // since this is iterating, the todo is a single item from the overall array
return this.props.todos.map((todo) => {
return (
<li
/* on click, dispatch the ADD_TODO action */
onClick={() => this.props.addTodo(todo)}
>
{todo.name}
</li>
)
})
}
render() {
return (
<ul className="">
{this.renderList()}
</ul>
)
}
}
// map state to a react prop | or anything to be honest
function mapStateToProps(state) {
// whatever is returned will show up as props in TodoList
return {
todos: state.todos
}
}
//map action dispatch to a property??
function mapDispatchToProps(dispatch) {
// ??
// could possibly just throw the action creator inside
return bindActionCreators({ addTodo }, dispatch)
}
// can also assign connect function to an object and then export that instead
// literally connects react to redux
export default connect(mapStateToProps, mapDispatchToProps)(TodoList)
|
$.fn.countTo = function(a) {
a = a || {};
return $(this).each(function() {
var c = $.extend({},
$.fn.countTo.defaults, {
from: $(this).data("from"),
to: $(this).data("to"),
speed: $(this).data("speed"),
refreshInterval: $(this).data("refresh-interval"),
decimals: $(this).data("decimals")
},
a);
var h = Math.ceil(c.speed / c.refreshInterval),
i = (c.to - c.from) / h;
var j = this,
f = $(this),
e = 0,
g = c.from,
d = f.data("countTo") || {};
f.data("countTo", d);
if (d.interval) {
clearInterval(d.interval)
}
d.interval = setInterval(k, c.refreshInterval);
b(g);
function k() {
g += i;
e++;
b(g);
if (typeof(c.onUpdate) == "function") {
c.onUpdate.call(j, g)
}
if (e >= h) {
f.removeData("countTo");
clearInterval(d.interval);
g = c.to;
if (typeof(c.onComplete) == "function") {
c.onComplete.call(j, g)
}
}
}
function b(m) {
var l = c.formatter.call(j, m, c);
f.html(l)
}
})
};
$.fn.countTo.defaults = {
from: 0,
to: 0,
speed: 1000,
refreshInterval: 100,
decimals: 0,
formatter: formatter,
onUpdate: null,
onComplete: null
};
function formatter(value, settings) {
return value.toFixed(settings.decimals);
}
function count(a) {
var b = $(this);
a = $.extend({},
a || {},
b.data("countToOptions") || {});
b.countTo(a)
};
function startCount(dom,options){
var opt={
speed:44*1000,
formatter: function(b, a) {
return Number(b).toFixed(a.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ",")
}
};
if(options){
opt= $.extend(opt,options);
dom.data("countToOptions",opt);
}
dom.each(count);
}
|
// @flow
'use strict';
const grid = 12;
// functions for correcting responsive sizes in bootstrap subgrids
// determine size wanted based on size in
function sizeIt(gridSize, sizeEle, sizeScreen = 'xs') {
// determine outer size
let outerSize = _getOuterSize(gridSize, sizeScreen);
// subtract outer from this size
let size = sizeEle * grid/outerSize;
if (size > grid) size = grid;
else if (size < 1) size = 1;
return Math.round(size);
}
exports.sizeIt = sizeIt;
/**
* determine size of outer element
*/
function _getOuterSize(gridSize, sizeScreen) {
if ('lg' === sizeScreen) {
if (gridSize && gridSize.lg) {
return gridSize.lg;
}
else if (gridSize && gridSize.md) {
return gridSize.md;
}
else if (gridSize && gridSize.sm) {
return gridSize.sm;
}
else if (gridSize && gridSize.xs) {
return gridSize.xs;
}
}
else if ('md' === sizeScreen) {
if (gridSize && gridSize.md) {
return gridSize.md;
}
else if (gridSize && gridSize.sm) {
return gridSize.sm;
}
else if (gridSize && gridSize.xs) {
return gridSize.xs;
}
}
else if ('sm' === sizeScreen) {
if (gridSize && gridSize.sm) {
return gridSize.sm;
}
else if (gridSize && gridSize.xs) {
return gridSize.xs;
}
}
else if ('xs' === sizeScreen) {
if (gridSize && gridSize.xs) {
return gridSize.xs;
}
}
// default
return grid;
}
|
/*
* Theme JavaScript and JQuery code for the frontend pages of website
*
* Copyright (c) 2021, Space X-Chimp ( https://www.spacexchimp.com ).
* All Rights Reserved.
*/
jQuery(document).ready(function($) {
});
|
var searchData=
[
['oncompletecallback',['onCompleteCallBack',['../class_doxy_runner.html#ac1401822d6b3dea5626b786a94aa98d5',1,'DoxyRunner']]],
['originalposition',['originalPosition',['../class_item_inventory.html#a8241142f518996f0f091bc828aff9c70',1,'ItemInventory']]]
];
|
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'quicktable', 'fr', {
more: 'Plus...'
} );
|
// Meteor.after to call after
ReactionCore.MethodHooks.after("cart/submitPayment", function (options) {
// if cart/submit had an error we won't copy cart to Order
// and we'll throw an error.
ReactionCore.Log.debug("MethodHooks after cart/submitPayment", options);
if (options.error === undefined) {
let cart = ReactionCore.Collections.Cart.findOne({
userId: Meteor.userId()
});
// update workflow
Meteor.call("workflow/pushCartWorkflow", "coreCartWorkflow",
"paymentSubmitted");
if (cart) {
if (cart.items && cart.billing[0].paymentMethod) {
Meteor.call("cart/copyCartToOrder", cart._id);
} else {
throw new Meteor.Error(
"An error occurred verifing payment method. Failed to save order."
);
}
}
}
return options.result;
});
|
// RaspiCam module via node.js
var rootDirectory = '/var/www/'
var imageDirectory = '/timelapse_movies/'
var defaultDirectory = 'default'
var picturesName = 'snapshot%04d.jpg'
var currentWebDirectory = imageDirectory + defaultDirectory;
var fs=require('fs');
var projectName ="default";
var RaspiCam = require('raspicam');
var io = require('socket.io').listen(1234);
var exec = require('child_process').exec;
var camera = new RaspiCam({
mode: 'timelapse',
output: rootDirectory + imageDirectory + defaultDirectory + picturesName,
timeout: 3000,
timelapse: 1000
});
// camera Lock variable
camera.lock = false;
camera.on("exit", function(timestamp){
camera.lock = false;
});
// Socket handle
io.sockets.on('connection', function (socket) {
if(camera.lock){
console.log('started');
socket.emit('stillWorking');
} else console.log('stopped');
console.log(projectName);
// Get the project name
socket.on('getProjectName', function(){
socket.emit('projectName', projectName);
});
// Timelapse command
socket.on('startTimelaps', function(conf){
if(!camera.lock){
var workingDirectory;
currentWebDirectory = imageDirectory + projectName + '/';
workingDirectory = rootDirectory + currentWebDirectory;
if(!fs.existsSync(workingDirectory))
fs.mkdirSync(workingDirectory);
camera.opts.mode= 'timelapse';
camera.opts.output= workingDirectory + '/' + picturesName;
camera.opts.timelapse= conf.interval;
camera.opts.timeout= (conf.hours * 3600 + conf.minutes * 60 + conf.seconds) * 1000;
camera.lock = true;
camera.start();
}
});
// Take a snapshot command
socket.on('takeSnapshot', function(conf){
if(!camera.lock){
delete camera.opts.timelapse;
delete camera.opts.timeout;
camera.opts.mode = 'photo';
camera.opts.output = rootDirectory + imageDirectory + 'snapshot.png';
currentWebDirectory = imageDirectory;
camera.lock = true;
camera.start();
}
});
socket.on('createProject', function(_projectName){
projectName = _projectName;
if(!fs.existsSync(rootDirectory + imageDirectory + projectName)){
fs.mkdirSync(rootDirectory + imageDirectory + projectName);
socket.emit('projectCreated');
} else socket.emit('projectAlreadyExist');
});
socket.on('continueProject', function(_projectName){
projectName = _projectName;
if(fs.existsSync(rootDirectory + imageDirectory + projectName)){
socket.emit('projectCreated');
} else socket.emit('projectDoesntExist');
});
socket.on('configureCamera', function(data){
camera.opts.width = data.cameraWidth;
camera.opts.height = data.cameraHeight;
camera.opts.exposure = data.exposure;
});
socket.on('startRendering', function(data){
var workingDirectory;
currentWebDirectory = imageDirectory + projectName + '/';
workingDirectory = rootDirectory + currentWebDirectory;
spawn = require("child_process").spawn;
var child_process = spawn('mencoder', ['mf://'+ workingDirectory +'/*.jpg', '-mf', 'fps=' + data.fps, '-o', workingDirectory+'/' + projectName + 'movie.avi', '-ovc', 'x264', '-x264encopts', 'bitrate='+data.bitrate]);
child_process.stdout.on('data', function (data) {
socket.emit('mencoderStdout', data);
console.log(data);
dout = data;
});
child_process.stderr.on('data', function (data) {
console.log('stderr: ' + data);
derr = data;
});
child_process.on('close', function (code) {
// Tell client rendering is done
socket.emit( "renderingStopped" );
child_process = null;
});
});
socket.on('raspimjpeg', function(_command){
if(_command == "start"){
exec('echo ru 0 > /var/www/raspimjpeg_FIFO', function(err) {
if(err) {
console.log(err);
} else {
console.log("RaspiMJPEG started");
}
});
} else if(_command == "stop") {
exec('echo ru 1 > /var/www/raspimjpeg_FIFO', function(err) {
if(err) {
console.log(err);
} else {
console.log("RaspiMjpeg stopped");
}
});
}
});
socket.on('sendSyncCommand', function(_command){
var fs = require('fs');
//LAUNCH timestamp width heigth delay duration project_name starttime
if(_command == "launch"){
var timestamp = Math.round(new Date().getTime()/1000);
var timestamp2 = timestamp + 10;
var command = "LAUNCH " + timestamp + " 1920 1080 3000 14400000 test " + timestamp2;
fs.writeFile("/var/www/server/order", command, function(err) {
if(err) {
console.log(err);
} else {
socket.emit("orderSent");
console.log("Order \"" + command + "\" send.");
}
});
} else {
fs.writeFile("/var/www/server/order", _command, function(err) {
if(err) {
console.log(err);
} else {
socket.emit("orderSent");
console.log("Order \"" + _command + "\" send.");
}
});
}
});
camera.on('read', function(err, timestamp, filename){
if(filename.search('~') == -1)
socket.emit('newImage', currentWebDirectory + filename)
});
camera.on("exit", function(timestamp){
camera.lock = false;
socket.emit('cameraStopped');
});
});
// Remove existing snapshot
if(fs.existsSync(rootDirectory + imageDirectory + 'snapshot.png'))
fs.unlinkSync(rootDirectory + imageDirectory + 'snapshot.png');
|
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
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 version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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/>.
*/
/*
Author : kevintjuh93
*/
var status = -1;
function start(mode, type, selection) {
status++;
if (mode != 1) {
if(type == 2 && mode == 0) {
qm.sendOk("Hm... You don't think that would help? Think about it. It could help, you know...");
qm.dispose();
return;
}else{
qm.dispose();
return;
}
}
if (status == 0)
qm.sendNext("Welcome, hero! What's that? You want to know how I knew who you were? That's easy. I eavesdropped on some people talking loudly next to me. I'm sure the rumor has spread through the entire island already. Everyone knows that you've returned!")
else if (status == 1) {
qm.sendNextPrev("Hm, how about trying out that sword? Wouldn't that bring back some memories? How about #bfighthing some monsters#k?");
} else if (status == 2) {
qm.sendAcceptDecline("Ah, I'm so sorry. I was so happy to have finally met you that I guess I got a little carried away. Whew, deep breaths. Deep breaths. Okay, I feel better now. But um...can I ask you a favor? Please?");
} else if (status == 3) {
qm.forceStartQuest();
qm.sendNext("It just so happens that there are a lot of #rTutorial Murus #knear here. How about defeating just #r3 #kof them? It could help you remember a thing or two.");
} else if (status == 4) {
qm.sendNextPrev("Ah, you've also forgotten how to use your skills? #bPlace skills in the quick slots for easy acces. #kYou can also place consumable items in the slots, so use the slots to your advantage.") ;
} else if (status == 5) {
qm.guideHint(17);
qm.dispose();
}
}
function end(mode, type, selection) {
status++;
if (mode != 1) {
if(type == 1 && mode == 0) {
qm.sendNext("What? You don't want the potion?");
qm.dispose();
return;
}else{
qm.dispose();
return;
}
}
if (status == 0)
qm.sendYesNo("Hm... Your expression tells me that the exercise didn't jog any memories. But don't you worry. They'll come back, eventually. Here, drink this potion and power up!\r\n\r\n#fUI/UIWindow.img/QuestIcon/4/0#\r\n#v2000022# 10 #t2000022#\r\n#v2000023# 10 #t2000023#\r\n\r\n#fUI/UIWindow.img/QuestIcon/8/0# 57 exp");
else if (status == 1) {
if(qm.isQuestCompleted(21012))
qm.dropMessage(1,"Unknown Error");
else if(qm.canHold(2000022) && qm.canHold(2000023)){
qm.gainExp(57);
qm.gainItem(2000022, 10);
qm.gainItem(2000023, 10);
qm.forceCompleteQuest();
qm.sendOk("#b(Even if you're really the hero everyone says you are... What good are you without any skills?)", 3);
qm.dispose();
}else
qm.dropMessage(1,"Your inventory is full");
qm.dispose();
}
}
|
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gTestfile = 'regress-352742-01.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 352742;
var summary = 'Array filter on {valueOf: Function}';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
print('If the test harness fails, this test fails.');
expect = 4;
z = {valueOf: Function};
actual = 2;
try {
[11].filter(z);
}
catch(e)
{
actual = 3;
print(e);
}
actual = 4;
reportCompare(expect, actual, summary);
exitFunc ('test');
}
|
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
*
* Date: 06 Mar 2002
* SUMMARY: Testing cloned function objects
* See http://bugzilla.mozilla.org/show_bug.cgi?id=127557
*
* Before this bug was fixed, this testcase would error when run:
*
* ReferenceError: h_peer is not defined
*
* The line |g.prototype = new Object| below is essential: this is
* what was confusing the engine in its attempt to look up h_peer
*/
//-----------------------------------------------------------------------------
var gTestfile = 'regress-127557.js';
var UBound = 0;
var BUGNUMBER = 127557;
var summary = 'Testing cloned function objects';
var cnCOMMA = ',';
var status = '';
var statusitems = [];
var actual = '';
var actualvalues = [];
var expect= '';
var expectedvalues = [];
function f(x,y)
{
function h()
{
return h_peer();
}
function h_peer()
{
return (x + cnCOMMA + y);
}
return h;
}
if (typeof clone == 'function')
{
status = inSection(1);
var g = clone(f);
g.prototype = new Object;
var h = g(5,6);
actual = h();
expect = '5,6';
addThis();
}
else
{
reportCompare('Test not run', 'Test not run', 'shell only test requires clone()');
}
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function addThis()
{
statusitems[UBound] = status;
actualvalues[UBound] = actual;
expectedvalues[UBound] = expect;
UBound++;
}
function test()
{
enterFunc('test');
printBugNumber(BUGNUMBER);
printStatus(summary);
for (var i=0; i<UBound; i++)
{
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
}
exitFunc ('test');
}
|
// Copyright (C) 2014 The Syncthing Authors.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
/*jslint browser: true, continue: true, plusplus: true */
/*global $: false, angular: false, console: false, validLangs: false */
var syncthing = angular.module('syncthing', [
'angularUtils.directives.dirPagination',
'pascalprecht.translate',
'syncthing.core',
'syncthing.device',
'syncthing.folder',
'syncthing.settings',
'syncthing.transfer',
'syncthing.usagereport'
]);
var urlbase = 'rest';
syncthing.config(function ($httpProvider, $translateProvider, LocaleServiceProvider) {
$httpProvider.interceptors.push(function xHeadersResponseInterceptor() {
var deviceId = null;
return {
response: function onResponse(response) {
var headers = response.headers();
// angular template cache sends no headers
if(Object.keys(headers).length === 0) {
return response;
}
if (!deviceId) {
deviceId = headers['x-syncthing-id'];
if (deviceId) {
var deviceIdShort = deviceId.substring(0, 5);
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token-' + deviceIdShort;
$httpProvider.defaults.xsrfCookieName = 'CSRF-Token-' + deviceIdShort;
}
}
return response;
}
};
});
// language and localisation
$translateProvider.useStaticFilesLoader({
prefix: 'assets/lang/lang-',
suffix: '.json'
});
$translateProvider.useMissingTranslationHandlerLog();
LocaleServiceProvider.setAvailableLocales(validLangs);
LocaleServiceProvider.setDefaultLocale('en');
});
// @TODO: extract global level functions into separate service(s)
function deviceCompare(a, b) {
if (typeof a.name !== 'undefined' && typeof b.name !== 'undefined') {
if (a.name < b.name)
return -1;
return a.name > b.name;
}
if (a.deviceID < b.deviceID) {
return -1;
}
return a.deviceID > b.deviceID;
}
function folderCompare(a, b) {
if (a.id < b.id) {
return -1;
}
return a.id > b.id;
}
function folderMap(l) {
var m = {};
l.forEach(function (r) {
m[r.id] = r;
});
return m;
}
function folderList(m) {
var l = [];
for (var id in m) {
l.push(m[id]);
}
l.sort(folderCompare);
return l;
}
function decimals(val, num) {
var digits, decs;
if (val === 0) {
return 0;
}
digits = Math.floor(Math.log(Math.abs(val)) / Math.log(10));
decs = Math.max(0, num - digits);
return decs;
}
function randomString(len) {
var chars = '01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-';
return randomStringFromCharset(len, chars);
}
function randomStringFromCharset(len, charset) {
var result = '';
for (var i = 0; i < len; i++) {
result += charset[Math.round(Math.random() * (charset.length - 1))];
}
return result;
}
function isEmptyObject(obj) {
var name;
for (name in obj) {
return false;
}
return true;
}
function debounce(func, wait) {
var timeout, args, context, timestamp, result, again;
var later = function () {
var last = Date.now() - timestamp;
if (last < wait) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (again) {
again = false;
result = func.apply(context, args);
context = args = null;
}
}
};
return function () {
context = this;
args = arguments;
timestamp = Date.now();
if (!timeout) {
timeout = setTimeout(later, wait);
result = func.apply(context, args);
context = args = null;
} else {
again = true;
}
return result;
};
}
|
import ServiceReducer from './ServiceReducer'
class MicrosoftMailServiceReducer extends ServiceReducer {
/* **************************************************************************/
// Class
/* **************************************************************************/
static get name () { return 'MicrosoftMailServiceReducer' }
/* **************************************************************************/
// Reducers
/* **************************************************************************/
/**
* Sets the basic profile info for this account
* @param service: the service to update
* @param userId: the users id
* @param email: the user email address
* @param userFullName: the users full name
*/
static setProfileInfo (service, userId, email, userFullName) {
return service.changeData({
userId: userId,
email: email,
userFullName: userFullName
})
}
/**
* Sets the service avatar url
* @param service: teh service to update
* @param avatarUrl: the url of the avatar
*/
static setServiceAvatarUrl (service, avatarUrl) {
return service.changeData({
serviceAvatarURL: avatarUrl
})
}
/**
* Sets the unread mode
* @param service: the service to update
* @param unreadMode: the new unread mode
*/
static setUnreadMode (service, unreadMode) {
if (service.unreadMode !== unreadMode) {
return service.changeData({ unreadMode: unreadMode })
}
}
}
export default MicrosoftMailServiceReducer
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _cheerio = require('cheerio');
var _cheerio2 = _interopRequireDefault(_cheerio);
var _iceCap = require('ice-cap');
var _iceCap2 = _interopRequireDefault(_iceCap);
var _DocBuilder2 = require('./DocBuilder.js');
var _DocBuilder3 = _interopRequireDefault(_DocBuilder2);
var _util = require('./util.js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Index output builder class.
*/
var IndexDocBuilder = function (_DocBuilder) {
_inherits(IndexDocBuilder, _DocBuilder);
/**
* create instance.
* @param {Taffy} data - doc object database.
* @param {ESDocConfig} config - use config to build output.
* @param {CoverageObject} coverage - use coverage to build output.
*/
function IndexDocBuilder(data, config, coverage) {
_classCallCheck(this, IndexDocBuilder);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(IndexDocBuilder).call(this, data, config));
_this._coverage = coverage;
return _this;
}
/**
* execute building output.
* @param {function(html: string, filePath: string)} callback - is called with output.
*/
_createClass(IndexDocBuilder, [{
key: 'exec',
value: function exec(callback) {
var ice = this._buildLayoutDoc();
var title = this._getTitle();
ice.load('content', this._buildIndexDoc());
ice.text('title', title, _iceCap2.default.MODE_WRITE);
callback(ice.html, 'index.html');
}
/**
* build index output.
* @returns {string} html of index output.
* @private
*/
}, {
key: '_buildIndexDoc',
value: function _buildIndexDoc() {
if (!this._config.index) return 'Please create README.md';
var indexContent = void 0;
try {
indexContent = _fs2.default.readFileSync(this._config.index, { encode: 'utf8' }).toString();
} catch (e) {
return 'Please create README.md';
}
var html = this._readTemplate('index.html');
var ice = new _iceCap2.default(html);
var ext = _path2.default.extname(this._config.index);
if (['.md', '.markdown'].includes(ext)) {
ice.load('index', (0, _util.markdown)(indexContent));
} else {
ice.load('index', indexContent);
}
var result = ice.html;
// fixme: deprecated
if (this._config.coverage) {
var $ = _cheerio2.default.load(result);
if ($('.esdoc-coverage').length) {
console.log('[31m[deprecated] coverage badge is deprecated. use badge of ESDoc Hosting Service(https://doc.esdoc.org)[0m');
}
}
return result;
}
}]);
return IndexDocBuilder;
}(_DocBuilder3.default);
exports.default = IndexDocBuilder;
module.exports = exports['default'];
|
'use strict';
import indent from './indent.js';
import transformCategories from './transformCategories.js';
/**
* Transforms data to text.
*
* @param {object} data - Normalized data from `GitHubInspectOrgs` to transform.
* @param {object} options - Optional parameters:
* ```
* (boolean) description - A boolean which will include more descriptive data while transforming.
* ```
*
* @returns {string}
*/
export default function(data, options)
{
return transformCategories(data, s_TRANSFORM, options);
}
// Module private ---------------------------------------------------------------------------------------------------
/**
* Provides a single pass transforming a given category and entry at a particular depth to text.
*
* @param {string} category - Current category type.
* @param {object} entry - Entry to transform.
* @param {number} depth - Current category depth.
* @param {object} options - Optional parameters:
* ```
* (boolean) description - A boolean which will include more descriptive data while transforming.
* ```
*
* @returns {string}
*/
const s_TRANSFORM = (category, entry, depth, options) =>
{
// Note text only responds to the first pass.
if (options._transformData[depth].pass > 0) { return ''; }
const lastEntry = options._transformData[depth].lastEntry;
const maxDepth = options._transformData[depth].maxDepth;
const desc = typeof options.description === 'boolean' ? options.description : false;
const prefix = indent(depth);
let tail = '\n';
let resultString = prefix;
switch (category)
{
case 'collaborators':
case 'contributors':
case 'members':
case 'owners':
case 'users':
if (depth > 0 && lastEntry && maxDepth) { tail += '\n'; }
if (desc) { resultString += `${entry.name}${entry.url !== '' ? ` - ${entry.url}` : ''}${tail}`; }
else { resultString += `${entry.name}${tail}`; }
break;
case 'orgs':
if (depth === 0 && options._maxDepthLength > 1 && maxDepth) { tail += '\n'; }
else if (depth > 0 && lastEntry && maxDepth) { tail += '\n'; }
if (desc)
{
resultString += `${entry.name}${entry.description !== '' ? ` - ${entry.description}` : ''}${tail}`;
}
else { resultString += `${entry.name}${tail}`; }
break;
case 'ratelimit':
if (depth > 0 && lastEntry && maxDepth) { tail += '\n'; }
resultString += `Core: limit: ${entry.core.limit}, remaining: ${entry.core.remaining}, reset: ${
new Date(entry.core.reset)}\n${indent(depth)}Search: limit: ${entry.search.limit}, remaining: ${
entry.search.remaining}, reset: ${new Date(entry.search.reset)}${tail}`;
break;
case 'repos':
case 'teams':
if (depth > 0 && options._maxDepthLength > 0 && lastEntry && maxDepth) { tail += '\n'; }
if (desc)
{
resultString += `${entry.name}${entry.description ? ` - ${entry.description}` : ''}${tail}`;
}
else { resultString += `${entry.name}${tail}`; }
break;
case 'stats':
if (depth > 0 && options._maxDepthLength > 0 && maxDepth) { tail += '\n'; }
resultString += `${JSON.stringify(entry)}${tail}`;
break;
}
return resultString;
};
|
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.3.0
build: 3167
*/
YUI.add('autocomplete-highlighters-accentfold', function(Y) {
/**
* <p>
* Provides pre-built accent-folding result highlighters for AutoComplete.
* </p>
*
* <p>
* These highlighters are similar to the ones provided by the
* <code>autocomplete-highlighters</code> module, but use accent-aware
* comparisons. For example, "resume" and "résumé" will be considered equal when
* using the accent-folding highlighters.
* </p>
*
* @module autocomplete
* @submodule autocomplete-highlighters-accentfold
*/
/**
* @class AutoCompleteHighlighters
* @static
*/
var Highlight = Y.Highlight,
YArray = Y.Array;
Y.mix(Y.namespace('AutoCompleteHighlighters'), {
/**
* Accent-folding version of <code>charMatch()</code>.
*
* @method charMatchFold
* @param {String} query Query to match
* @param {Array} results Results to highlight
* @return {Array} Highlighted results
* @static
*/
charMatchFold: function (query, results) {
var queryChars = YArray.unique(query.split(''));
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, queryChars);
});
},
/**
* Accent-folding version of <code>phraseMatch()</code>.
*
* @method phraseMatchFold
* @param {String} query Query to match
* @param {Array} results Results to highlight
* @return {Array} Highlighted results
* @static
*/
phraseMatchFold: function (query, results) {
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, [query]);
});
},
/**
* Accent-folding version of <code>startsWith()</code>.
*
* @method startsWithFold
* @param {String} query Query to match
* @param {Array} results Results to highlight
* @return {Array} Highlighted results
* @static
*/
startsWithFold: function (query, results) {
return YArray.map(results, function (result) {
return Highlight.allFold(result.text, [query], {
startsWith: true
});
});
},
/**
* Accent-folding version of <code>wordMatch()</code>.
*
* @method wordMatchFold
* @param {String} query Query to match
* @param {Array} results Results to highlight
* @return {Array} Highlighted results
* @static
*/
wordMatchFold: function (query, results) {
return YArray.map(results, function (result) {
return Highlight.wordsFold(result.text, query);
});
}
});
}, '3.3.0' ,{requires:['array-extras', 'highlight-accentfold']});
|
$(document).ready(function(){
temp_val = $("#relatietype_c").val();
show_hide_field(temp_val);
$("#relatietype_c").on('change', function(){
show_hide_field($(this).val());
});
});
function show_hide_field(val){
show = false;
if(val == null){
$("#deal_status").parent().parent().hide();
return;
}
if(typeof(val) == 'string'){
if(val.match(/Verzekering/g) == null){
$("#deal_status").parent().parent().hide();
}else{
$("#deal_status").parent().parent().show();
}
return;
}
relatie_val = val;
$.each(relatie_val, function(key, val){
if(trim(val) === 'Verzekering'){
show = true;
}
});
if(show){
$("#deal_status").parent().parent().show();
}else{
$("#deal_status").parent().parent().hide();
}
}
|
$(function() {
$('#list').bind('load-visible',function() {
$('.list-unprimed').each(function() {
/* Default position for small screens */
var x=-40;
var y=30;
/* Is there room for tooltips on the left? */
if($(this).offset().left > 10) {
x=-100;
y=0;
}
/* Create tooltips */
$('.list-image').each(function() {
$(this).parents('li').find('.list-data').
aqTip('<img src="'+$(this).attr('href')+'" height="120"/>',
{ relativeX: 0, relativeY: 0, marginX: x, marginY: y});
});
$(this).removeClass('list-unprimed');
});
});
});
|
import { t } from '@lingui/macro';
import { formatPercentage } from 'common/format';
import SPELLS from 'common/SPELLS';
import { SpellLink } from 'interface';
import Analyzer, { SELECTED_PLAYER } from 'parser/core/Analyzer';
import Events from 'parser/core/Events';
import Abilities from 'parser/core/modules/Abilities';
import SpellUsable from 'parser/shared/modules/SpellUsable';
import React from 'react';
const BETTER_SPELLS = [SPELLS.JUDGMENT_CAST_PROTECTION.id, SPELLS.AVENGERS_SHIELD.id];
export default class HammerOfTheRighteous extends Analyzer {
static dependencies = {
abilities: Abilities,
spells: SpellUsable,
};
activeSpell = SPELLS.HAMMER_OF_THE_RIGHTEOUS;
_badCasts = 0;
_casts = 0;
constructor(props) {
super(props);
if (this.selectedCombatant.hasTalent(SPELLS.BLESSED_HAMMER_TALENT.id)) {
this.activeSpell = SPELLS.BLESSED_HAMMER_TALENT;
}
this.addEventListener(
Events.cast.by(SELECTED_PLAYER).spell(this.activeSpell),
this._handleFiller,
);
}
_handleFiller(event) {
const hadBetterSpell = !BETTER_SPELLS.every(this.spells.isOnCooldown.bind(this.spells));
if (hadBetterSpell) {
this._badCasts += 1;
}
this._casts += 1;
}
get badCastRatio() {
return this._badCasts / this._casts;
}
get badCastThreshold() {
return {
actual: this.badCastRatio,
isGreaterThan: {
minor: 0.1,
average: 0.15,
major: 0.25,
},
style: 'percentage',
};
}
suggestions(when) {
when(this.badCastThreshold).addSuggestion((suggest, actual, recommended) =>
suggest(
<>
You should avoid casting <SpellLink id={this.activeSpell.id} /> while better spells
(namely <SpellLink id={SPELLS.JUDGMENT_CAST_PROTECTION.id} /> and{' '}
<SpellLink id={SPELLS.AVENGERS_SHIELD.id} />) are available. This is a <em>filler</em>{' '}
ability and should only be used when you have no better spells to cast.
</>,
)
.icon(this.activeSpell.icon)
.actual(
t({
id: 'paladin.protection.suggestions.hammerOfTheRighteous.efficiency',
message: `${formatPercentage(
this.badCastRatio,
)}% of casts while better spells were available`,
}),
)
.recommended(`< ${formatPercentage(recommended)}% is recommended`),
);
}
}
|
"use strict";
const MockStorage = (function() {
let storage = {};
return {
setItem: function(key, value) {
storage[key] = value || "";
},
getItem: function(key) {
return storage[key];
},
removeItem: function(key) {
delete storage[key];
},
get length() {
return Object.keys(storage).length;
},
key: function(i) {
let keys = Object.keys(storage);
return keys[i] || null;
}
};
})();
Object.defineProperty(window, "localStorage", {value: MockStorage});
Object.defineProperty(window, "sessionStorage", {value: MockStorage});
// Exports
module.exports = MockStorage;
|
/*
This file is part of the Juju GUI, which lets users view and manage Juju
environments within a graphical interface (https://launchpad.net/juju-gui).
Copyright (C) 2015 Canonical Ltd.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License version 3, as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
SATISFACTORY QUALITY, 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/>.
*/
'use strict';
YUI.add('entity-content-readme', function() {
juju.components.EntityContentReadme = React.createClass({
readmeXhr: null,
/* Define and validate the properites available on this component. */
propTypes: {
entityModel: React.PropTypes.object.isRequired,
getFile: React.PropTypes.func.isRequired,
renderMarkdown: React.PropTypes.func.isRequired
},
getInitialState: function() {
return {
readme: null,
};
},
componentDidMount: function() {
this._getReadme();
},
componentWillUnmount: function() {
if (this.readmeXhr) {
this.readmeXhr.abort();
}
},
/**
Get the content for the readme.
@method _getReadme
@return {Object} The readme content.
*/
_getReadme: function() {
var entityModel = this.props.entityModel;
var readmeFile = this._getReadmeFile(entityModel);
if (!readmeFile) {
this._getReadmeCallback('No readme file.');
} else {
var id = entityModel.get('id');
this.readmeXhr = this.props.getFile(
id, readmeFile, this._getReadmeCallback);
}
},
/**
Get the filename for the readme.
@method _getReadmeFile
@param {Object} entityModel The entity model.
@return {Object} The readme filename.
*/
_getReadmeFile: function(entityModel) {
var files = entityModel.get('files');
var match;
for (var i = 0, l = files.length; i < l; i++) {
var file = files[i];
if (file.toLowerCase().slice(0, 6) === 'readme') {
match = file;
break;
}
}
return match;
},
/**
Update the readme with the retrieved markdown.
@method _getReadmeCallback
@param {String} error The error message from the charmstore, if any.
@param {Object} data The returned data for the readme.
*/
_getReadmeCallback: function(error, data) {
if (error) {
console.error(error);
this.setState({readme: 'No readme.'});
} else {
var readme = data;
this.setState({readme: this.props.renderMarkdown(readme)});
}
},
render: function() {
return (
<div className="entity-content__readme">
<h2 className="entity-content__header" id="readme">Readme</h2>
<div ref="content" className="entity-content__readme-content"
dangerouslySetInnerHTML={{__html: this.state.readme}} />
</div>
);
}
});
}, '0.1.0', {
requires: []
});
|
import FacebookSetAccessTokenRoute from "./helpers/FacebookSetAccessTokenRoute";
import RouteLogger from "./RouteLogger";
import FacebookSourceRoute from "./helpers/FacebookSourceRoute";
import FacebookTokenDocumentRoute from "./helpers/FacebookTokenDocumentRoute";
export default (app) => {
app.post("/facebook-set-token", (request, response, next) => {
RouteLogger.instance().info("FacebookRoutes:: /facebook-set-token request received. url = %s", request.url);
new FacebookSetAccessTokenRoute(request, response, next).handle();
});
app.post("/facebook-sources", (request, response, next) => {
RouteLogger.instance().info("FacebookRoutes:: /facebook-sources request received. url = %s", request.url);
new FacebookSourceRoute(request, response, next).process();
});
app.get("/facebook-token-expired", (request, response, next) => {
RouteLogger.instance().info("FacebookRoutes:: /facebook-token-expire-time request received. url = %s", request.url);
new FacebookTokenDocumentRoute(request, response, next).isExpired();
});
};
|
function sendSeeFeedbackAnalytics() {
$.post("/api/analytics/", {
service: {
key: "manual_scoring_see_feedback",
name: "Manual Scoring - See feedback"
},
course_id: getCourseId(),
});
}
jQuery(document).ready(function () {
const codeField = new CodeArea(environmentType());
const rubric = new Rubric();
const currentGrade = $(`#${GRADE_ID}`).data("grade");
const grade = new Score(GRADE_ID, currentGrade);
let rubricStatusIds = rubricStatus();
codeField.displayCodeArea();
rubricStatusIds = JSON.parse(rubricStatusIds.replace(/"/g, "\""));
rubric.loadSelectedFields(rubricStatusIds);
loadFeedBack(FEEDBACK_FIELD_ID);
addToggleBehaviorToProblemDescription(TASK_NAME, TASK_DESCRIPTION_TEXT_ID);
grade.changeColor();
grade.updateScore();
sendSeeFeedbackAnalytics();
});
|
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments);
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-12373491-3', 'pubwebkit.com');
ga('send', 'pageview');
|
'use strict';
var core = require('../../core');
function setupRoute(app) {
app.get('/', function(req, res, next) {
if (core.configured()) {
return next();
}
res.render('setup/index');
});
function failIfConfigured(req, res, next) {
if (!core.configured()) {
return next();
}
return res.json(400, { error: { status: 400, message: 'Bad Request', details: 'the database connection is already configured'}});
}
app.put('/api/document-store/connection', failIfConfigured);
app.get('/api/document-store/connection/:hostname/:port/:dbname', failIfConfigured);
}
module.exports = setupRoute;
|
import React from 'react';
import { connect } from 'react-redux'
import Snackbar from 'material-ui/Snackbar';
import RaisedButton from 'material-ui/RaisedButton';
class Errors extends React.Component {
constructor(props) {
super(props);
this.state = {
open: false,
};
}
componentWillReceiveProps = () => {
if (this.props.error) {
console.error("An error occurred", this.props.error)
this.setState({ open: true })
}
}
handleActionClick = () => {
this.setState({
open: false,
});
};
handleRequestClose = () => {
this.setState({
open: false,
});
};
render() {
const { error } = this.props
if (!error || !error.message) {
return null
}
return (
<div>
<Snackbar
open={this.state.open}
message={error && error.message}
action="close"
autoHideDuration={5000}
onActionClick={this.handleActionClick}
onRequestClose={this.handleRequestClose}
/>
</div>
);
}
}
function mapStateToProps(state) {
const errors = state.errors.errors
const error = state.errors.lastError
return {
error,
}
}
export default connect(mapStateToProps, {})(Errors)
|
/*
* Data HUb Service (DHuS) - For Space data distribution.
* Copyright (C) 2013,2014,2015,2016 European Space Agency (ESA)
* Copyright (C) 2013,2014,2015,2016 GAEL Systems
* Copyright (C) 2013,2014,2015,2016 Serco Spa
*
* This file is part of DHuS software sources.
*
* 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/>.
*/
'use strict';
angular.module('DHuS-webclient')
.directive('odataSynchronizerList', function(ODataSynchronizerService,OdataSynchDetailsManager,OdataModel) {
return {
restrict: 'AE',
replace: true,
templateUrl: 'components/odata-synchronizer/odata-synchronizer-list/view.html',
compile: function(tElem, tAttrs){
var self = this;
return {
pre: function(scope, iElem, iAttrs){
scope.synchronizerCount = 0;
scope.currentPage = 1;
},
post: function(scope, iElem, iAttrs){
scope.init = function () {
ODataSynchronizerService.synchronizers()
.then(function(response) {
var modelFromServer = response.data.d.results;
OdataModel.createModel(modelFromServer,modelFromServer.length);
scope.list = OdataModel.model.list;
scope.synchronizerCount = OdataModel.synchronizerCount;
});
};
scope.$watch(function(){return OdataModel.model.list},function(newvalue){
scope.list=newvalue;
});
scope.$watch(function(){return OdataModel.synchronizerCount},function(newvalue){
scope.synchronizerCount=newvalue;
});
scope.synchronizersPerPage = 25;
scope.currentPage = 1;
scope.pageCount = Math.floor(scope.synchronizerCount / scope.synchronizersPerPage) + ((scope.synchronizerCount % scope.synchronizersPerPage)?1:0);
console.log(scope.pageCount);
scope.gotoFirstPage = function(){
goToPage(1);
};
scope.gotoPreviousPage = function(){
goToPage(scope.currentPage - 1);
};
scope.gotoNextPage = function() {
goToPage(scope.currentPage + 1);
};
scope.gotoLastPage = function(){
goToPage(scope.pageCount);
};
scope.selectPageDidClicked = function(xx){
};
scope.createOdataSynchronizer = function(){
OdataSynchDetailsManager.getOdataSynchDetails(-1, true);
};
scope.init();
}
}
}
};
});
|
/**
* Entrypoint for the react app
* Provides a basic app wrapper for react
* @author Fabian Beuke <mail@beuke.org>
* @license AGPL-3.0
*/
import { HashRouter } from "react-router-dom";
import Layout from "components/Layout"
import { getMaxDataDate } from "common/utils.js"
import { hydrate, render } from "react-dom"
const production = window.location.href.includes("madnight.github.io")
const main = async () => {
const { year, quarter } = await getMaxDataDate()
const defaultPath = "#/pull_requests/" + year + "/" + quarter
const loc = window.location.href
const validUrlParams = ["pull_requests", "pushes", "stars", "issues"]
const isValidURL = validUrlParams.some((v) => loc.includes(v))
const url = (production ? "/githut/" : "/") + defaultPath
if (!isValidURL) {
window.history.pushState("", "", url)
}
const rootElement = document.getElementById("root")
if (rootElement.hasChildNodes()) {
hydrate(
<HashRouter>
<Layout />
</HashRouter>,
document.getElementById("root")
)
} else {
render(
<HashRouter>
<Layout />
</HashRouter>,
document.getElementById("root")
)
}
}
main()
|
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _util = require('./util');
var _inject = require('./inject');
var StyleSheet = {
create: function create(sheetDefinition) {
return (0, _util.mapObj)(sheetDefinition, function (_ref) {
var _ref2 = _slicedToArray(_ref, 2);
var key = _ref2[0];
var val = _ref2[1];
return [key, {
// TODO(emily): Make a 'production' mode which doesn't prepend
// the class name here, to make the generated CSS smaller.
_name: key + '_' + (0, _util.hashObject)(val),
_definition: val
}];
});
},
rehydrate: function rehydrate() {
var renderedClassNames = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
(0, _inject.addRenderedClassNames)(renderedClassNames);
}
};
/**
* Utilities for using Aphrodite server-side.
*/
var StyleSheetServer = {
renderStatic: function renderStatic(renderFunc) {
(0, _inject.reset)();
(0, _inject.startBuffering)();
var html = renderFunc();
var cssContent = (0, _inject.flushToString)();
return {
html: html,
css: {
content: cssContent,
renderedClassNames: (0, _inject.getRenderedClassNames)()
}
};
}
};
/**
* Utilities for using Aphrodite in tests.
*
* Not meant to be used in production.
*/
var StyleSheetTestUtils = {
/**
* Prevent styles from being injected into the DOM.
*
* This is useful in situations where you'd like to test rendering UI
* components which use Aphrodite without any of the side-effects of
* Aphrodite happening. Particularly useful for testing the output of
* components when you have no DOM, e.g. testing in Node without a fake DOM.
*
* Should be paired with a subsequent call to
* clearBufferAndResumeStyleInjection.
*/
suppressStyleInjection: function suppressStyleInjection() {
(0, _inject.reset)();
(0, _inject.startBuffering)();
},
/**
* Opposite method of preventStyleInject.
*/
clearBufferAndResumeStyleInjection: function clearBufferAndResumeStyleInjection() {
(0, _inject.reset)();
}
};
var css = function css() {
for (var _len = arguments.length, styleDefinitions = Array(_len), _key = 0; _key < _len; _key++) {
styleDefinitions[_key] = arguments[_key];
}
var useImportant = true; // Append !important to all style definitions
return (0, _inject.injectAndGetClassName)(useImportant, styleDefinitions);
};
exports['default'] = {
StyleSheet: StyleSheet,
StyleSheetServer: StyleSheetServer,
StyleSheetTestUtils: StyleSheetTestUtils,
css: css
};
module.exports = exports['default'];
|
"use static";
/** This module will look for a cached IP address file on the local system
* containing the local IP address. If this is not found or is stale, it will
* discover the public IP address of the local machine and cache it. The
* export of this module is an object with the properties "address", which is
* a string containing the address in IPv4 notation, and ipv4, which is a
* number array containing the IPv4 address (index 0 is the high-order octet).
* A require on this module is SYNCHRONUS.
*
* @module PublicIpLookup
*/
var fs = require("fs"),
request = require('sync-request');
var reload = false;
try {
var stats = fs.statSync("publicAddress");
if(!stats.isFile()) {
throw 1;
}
if(stats.ctime.getTime() < Date.now() - 1000 * 60 * 60 * 24) {
fs.unlinkSync("publicAddress");
throw 2;
}
} catch(e) {
reload = true;
}
if(reload) {
log.info("Updating public IP address");
var res = request("GET", "http://ipecho.net/plain");
fs.writeFileSync("publicAddress", res.getBody());
}
var address = fs.readFileSync("publicAddress").toString("utf8");
var octets = address.split(".");
if(octets.length !== 4) {
log.error("Public IP address has incorrect format");
throw new Error("Public IP address has incorrect format");
}
var ipv4 = [];
ipv4[0] = parseInt(octets[0]);
ipv4[1] = parseInt(octets[1]);
ipv4[2] = parseInt(octets[2]);
ipv4[3] = parseInt(octets[3]);
exports.address = address;
exports.ipv4 = ipv4;
|
__ace_shadowed__.define('ace/snippets/rdoc', ['require', 'exports', 'module' ], function (require, exports, module) {
exports.snippetText = "";
exports.scope = "rdoc";
});
|
$(function(){
if($('#is_company').is(':checked')){
$('#LBL_COMPANY_INFO').show();
}
else{
$('#LBL_COMPANY_INFO').hide();
}
});
|
'use strict';
var _ = require('lodash');
var errorHandler = require('../errors.server.controller');
var mongoose = require('mongoose');
var passport = require('passport');
var User = mongoose.model('User');
exports.signup = function(req, res) {
// For security measurement we remove the roles from the req.body object
delete req.body.roles;
// Init Variables
var user = new User(req.body);
var message = null;
// Add missing user fields
user.provider = 'local';
user.displayName = user.firstName + ' ' + user.lastName;
// Then save the user
user.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
// Remove sensitive data before login
user.password = undefined;
user.salt = undefined;
req.login(user, function(err) {
if (err) {
res.status(400).send(err);
} else {
res.json(user);
}
});
}
});
};
exports.signin = function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (err || !user) {
res.status(400).send(info);
} else {
// Remove sensitive data before login
user.password = undefined;
user.salt = undefined;
req.login(user, function(err) {
if (err) {
res.status(400).send(err);
} else {
res.json(user);
}
});
}
})(req, res, next);
};
exports.signout = function(req, res) {
req.logout();
res.redirect('/');
};
|
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import contrast from 'contrast';
import Icon from './icon';
export default class PaperActionButtonOption extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e) {
this.props.onClick(e);
this.props.__close();
}
render() {
const {
label,
color,
__badgeStyle,
__labelStyle,
onClick,
iconName,
__close,
...props
} = this.props;
const bgColorShade = color ? contrast(color) : 'light';
return (
<div className="paper-action-button__option" {...props}>
<label style={__labelStyle} className="paper-action-button__label">
{label}
</label>
<button
className={classNames(
'paper-action-button__option-button',
`paper-action-button__option-button--${bgColorShade === 'light' ? 'light' : 'dark'}`
)}
style={{ backgroundColor: color, ...__badgeStyle }}
onClick={this.handleClick}
onMouseUp={() => this.myRef.blur()}
ref={myRef => {
this.myRef = myRef;
}}
>
<Icon>{iconName}</Icon>
</button>
</div>
);
}
}
PaperActionButtonOption.defaultProps = {
onClick: () => {},
__close: () => {}
};
PaperActionButtonOption.propTypes = {
__badgeStyle: PropTypes.object,
color: PropTypes.string,
iconName: PropTypes.string.isRequired,
__labelStyle: PropTypes.object,
label: PropTypes.string.isRequired,
onClick: PropTypes.func,
__close: PropTypes.func
};
|
/**
*
* @licstart The following is the entire license notice for the JavaScript code in this file.
*
* Melinda-related modules for recordLoader
*
* Copyright (c) 2015-2017 University Of Helsinki (The National Library Of Finland)
*
* This file is part of record-loader-melinda
*
* record-loader-melinda 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/>.
*
* @licend The above is the entire license notice
* for the JavaScript code in this file.
*
**/
(function(root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define([
'chai/chai',
'chai-as-promised',
'marc-record-js',
'@natlibfi/es6-polyfills/lib/polyfills/promise',
'../../lib/hostcomp/processors/preprocess/melinda'
], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(
require('chai'),
require('chai-as-promised'),
require('marc-record-js'),
require('@natlibfi/es6-polyfills/lib/polyfills/promise'),
require('../../lib/hostcomp/processors/preprocess/melinda')
);
}
}(this, factory));
function factory(chai, chaiAsPromised, MarcRecord, Promise, processorFactory)
{
'use strict';
var expect = chai.expect;
chai.use(chaiAsPromised);
describe('processors', function() {
describe('hostcomp-preprocess', function() {
function createProcessor()
{
return processorFactory({
validators: [{
name: 'sort-tag',
options: '500'
}]
}).setLogger({
info: function() {},
debug: function() {}
});
}
describe('factory', function() {
it('Should create the expected object', function() {
expect(createProcessor()).to.be.an('object')
.and.to.respondTo('setLogger')
.and.to.respondTo('run');
});
describe('object', function() {
describe('#setLogger', function() {
it('Should return itself', function() {
var processor = createProcessor();
expect(processor.setLogger()).to.eql(processor);
});
});
describe('#run', function() {
it('Should return a Promise which resolves with an object', function() {
return createProcessor().run({
record: new MarcRecord({
fields: [{
tag: '245',
subfields: [{
code: 'a',
value: 'foo'
}]
}]
})
}).then(function(result) {
expect(result).to.be.an('object');
});
});
it.skip('Should modify the record');
});
});
});
});
});
}
|
/*
* This program is part of the OpenLMIS logistics management information system platform software.
* Copyright © 2013 VillageReach
*
* 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. For additional information contact info@OpenLMIS.org.
*/
//Add the key constants for localStorage('key','value') pairs in the application
var localStorageKeys = {
RIGHT: "RIGHTS",
CURRENCY: "CURRENCY",
USERNAME: "USERNAME",
FULLNAME: "FULLNAME",
USER_ID: "USER_ID",
REPORTS: {STOCK_IMBALANCE: "REPORT_STOCK_IMBALANCE", SUPPLY_STATUS: "REPORT_SUPPLY_STATUS"},
PREFERENCE: {
DEFAULT_PROGRAM: "DEFAULT_PROGRAM",
DEFAULT_SCHEDULE: "DEFAULT_SCHEDULE",
DEFAULT_PERIOD: "DEFAULT_PERIOD",
DEFAULT_SUPERVISORY_NODE: "DEFAULT_SUPERVISORY_NODE",
DEFAULT_GEOGRAPHIC_ZONE: "DEFAULT_GEOGRAPHIC_ZONE",
DEFAULT_PRODUCT: "DEFAULT_PRODUCT",
DEFAULT_PRODUCTS: "DEFAULT_PRODUCTS",
DEFAULT_FACILITY: "DEFAULT_FACILITY",
ALERT_SMS_NOTIFICATION_OVERDUE_REQUISITION: "ALERT_SMS_NOTIFICATION_OVERDUE_REQUISITION",
ALERT_EMAIL_OVER_DUE_REQUISITION: "ALERT_EMAIL_OVER_DUE_REQUISITION"
},
DASHBOARD_FILTERS: {
"SUMMARY": "DASHBOARD_SUMMARY_PAGE",
"STOCK": "DASHBOARD_STOCK_EFFICIENCY_PAGE",
"STOCK-OUT": "DASHBOARD_STOCKED_OUT_PAGE",
"DISTRICT-STOCK-OUT": "DASHBOARD_STOCKED_OUT_BY_DISTRICT_PAGE",
"DISTRICT-STOCK-OUT-DETAIL": "DASHBOARD_STOCKED_OUT_DETAIL_PAGE",
"ORDER": "DASHBOARD_ORDER_TURNAROUND_PAGE",
"NOTIFICATION": "DASHBOARD_NOTIFICATION_PAGE",
"RNR-STATUS-SUMMARY": "DASHBOARD_RNR_STATUS_SUMMARY_PAGE"
}
};
|
// Copyright (C) 2012-present, The Authors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. 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/>.
function isA() {
return 0 === userObject.uid % 2;
}
function isB() {
return 1 === userObject.uid % 2;
}
module.exports = {
isA: isA,
isB: isB,
};
|
// mediawiki add categories
/*jslint node: true */
'use strict';
var qs = require('querystring');
var utils = require('../utils');
var bot = require('nodemw');
exports.search = function(api, context, callback) {
if (api.indexOf('mediawiki.category.') === 0) {
if (api === 'mediawiki.category.wikipedia') {
var bot = require('nodemw'), method = 'http://', host = 'en.wikipedia.org', apiPath = '/w', articlePath = '/wiki', client = new bot({
server: host,
path: apiPath
});
context.referers = 'http://en.wikipedia.org/w/api.php';
client.getPagesInCategory(context.query, function(pages) {
pages.forEach(function(page) {
callback(null, method + host + articlePath + '/' + page.title.replace(/ /g, '_'), context);
});
});
}
}
};
|
/**
* ownCloud
*
* @author John Molakvoæ
* @copyright 2016-2017 John Molakvoæ <skjnldsv@protonmail.com>
* @author Morris Jobke
* @copyright 2013 Morris Jobke <morris.jobke@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 library. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*
* Adds a background color to the element called on and adds the first character
* of the passed in string. This string is also the seed for the generation of
* the background color.
*
* You have following HTML:
*
* <div id="albumart"></div>
*
* And call this from Javascript:
*
* $('#albumart').imageplaceholder('The Album Title');
*
* Which will result in:
*
* <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">T</div>
*
* You may also call it like this, to have a different background, than the seed:
*
* $('#albumart').imageplaceholder('The Album Title', 'Album Title');
*
* Resulting in:
*
* <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">A</div>
*
*/
/*
* Alternatively, you can use the prototype function to convert your string to hsl colors:
*
* "a6741a86aded5611a8e46ce16f2ad646".toHsl()
*
* Will return the hsl parameters within an array:
*
* [290, 60, 68]
*
*/
(function ($) {
String.prototype.toHsl = function() {
var hash = this.toLowerCase().replace(/[^0-9a-f]+/g, '');
// Already a md5 hash?
if( !hash.match(/^[0-9a-f]{32}$/g) ) {
hash = md5(hash);
}
function rgbToHsl(r, g, b) {
r /= 255; g /= 255; b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2;
if(max === min) {
h = s = 0; // achromatic
} else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch(max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return [h, s, l];
}
// Init vars
var result = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var rgb = [0, 0, 0];
var sat = 70;
var lum = 68;
var modulo = 16;
// Splitting evenly the string
for(var i in hash) {
result[i%modulo] = result[i%modulo] + parseInt(hash.charAt(i), 16).toString();
}
// Converting our data into a usable rgb format
// Start at 1 because 16%3=1 but 15%3=0 and makes the repartition even
for(var count=1;count<modulo;count++) {
rgb[count%3] += parseInt(result[count]);
}
// Reduce values bigger than rgb requirements
rgb[0] = rgb[0]%255;
rgb[1] = rgb[1]%255;
rgb[2] = rgb[2]%255;
var hsl = rgbToHsl(rgb[0], rgb[1], rgb[2]);
// Classic formulla to check the brigtness for our eye
// If too bright, lower the sat
var bright = Math.sqrt( 0.299 * Math.pow(rgb[0], 2) + 0.587 * Math.pow(rgb[1], 2) + 0.114 * Math.pow(rgb[2], 2) );
if (bright >= 200) {
sat = 60;
}
return [parseInt(hsl[0] * 360), sat, lum];
};
$.fn.imageplaceholder = function(seed, text, size) {
text = text || seed;
// Compute the hash
var hsl = seed.toHsl();
this.css('background-color', 'hsl('+hsl[0]+', '+hsl[1]+'%, '+hsl[2]+'%)');
// Placeholders are square
var height = this.height() || size || 32;
this.height(height);
this.width(height);
// CSS rules
this.css('color', '#fff');
this.css('font-weight', 'normal');
this.css('text-align', 'center');
// calculate the height
this.css('line-height', height + 'px');
this.css('font-size', (height * 0.55) + 'px');
if(seed !== null && seed.length) {
this.html(text[0].toUpperCase());
}
};
$.fn.clearimageplaceholder = function() {
this.css('background-color', '');
this.css('color', '');
this.css('font-weight', '');
this.css('text-align', '');
this.css('line-height', '');
this.css('font-size', '');
this.html('');
this.removeClass('icon-loading');
};
}(jQuery));
|
'use strict';
/**
* @module portal/storages/openveVeoWebServiceErrors
*/
/**
* The list of OpenVeo web service errors with, for each error, its associated hexadecimal code.
*
* @namespace
*/
const OPENVEO_ERRORS = {
/**
* An error occurring when an unsupported ResourceFilter operation is used.
*
* @type {Object}
* @instance
* @readonly
*/
BUILD_FILTERS_UNKNOWN_OPERATION_ERROR: {
code: 0x001
}
};
Object.freeze(OPENVEO_ERRORS);
module.exports = OPENVEO_ERRORS;
|
// https://gist.github.com/1101534
$.extend({
parseQuerystring: function(){
var nvpair = {};
var qs;
if (window.location.search) {
qs = window.location.search.replace('?', '');
} else {
qs = window.location.href.split('?')[1];
}
if(qs !== undefined) {
var pairs = qs.split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
nvpair[pair[0]] = pair[1];
});
}
return nvpair;
}
});
$.extend({
setEqualWidth: function(first, other){
var width = first.width();
var otherWidth = other.width();
if (width > otherWidth) {
other.width(width);
} else if (width < otherWidth) {
first.width(otherWidth);
}
return this;
}
});
// append alert message to element and show it
$.fn.showAlert = function(heading, message, type, keep) {
if (keep === undefined || keep === false) {
this.empty();
}
var row = $('<div/>').appendTo(this);
if (heading) {
heading = heading + ' ';
$('<strong/>').appendTo(row).text(heading);
}
if (typeof message === 'string') {
$('<span/>').appendTo(row).text(message);
} else {
row.append(message);
}
row.attr('class', 'alert fade in');
row.addClass('alert-' + type);
this.show();
return this;
};
|
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2017 RonanLana
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 version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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/>.
*/
/* Nana, the Love fairy
Amoria (680000000)
Engagement ring NPC.
*/
var status;
var state;
var item;
var mats;
var matQty;
var cost;
var options;
function hasProofOfLoves(player) {
var count = 0;
for(var i = 4031367; i <= 4031372; i++) {
if(player.haveItem(i)) {
count++;
}
}
return count >= 4;
}
function getNanaLocation(player) {
var mapid = player.getMap().getId();
for(var i = 0; i < mapids.length; i++) {
if(mapid == mapids[i]) {
return i;
}
}
return -1;
}
var nanaLoc;
var mapids = [100000000, 103000000, 102000000, 101000000, 200000000, 220000000];
var questItems = [4000001, 4000037, 4000215, 4000026, 4000070, 4000128];
var questExp = [2000, 5000, 10000, 17000, 22000, 30000];
function processNanaQuest() {
if(cm.haveItem(questItems[nanaLoc], 50)) {
if(cm.canHold(4031367 + nanaLoc, 1)) {
cm.gainItem(questItems[nanaLoc], -50);
cm.gainItem(4031367 + nanaLoc, 1);
cm.sendOk("Kyaaaa~ Thank you a lot, here get the #b#t4031367##k.");
return true;
} else {
cm.sendOk("Please have a free ETC slot available to hold the token of love.");
}
} else {
cm.sendOk("Please gather to me #b50 #t" + questItems[nanaLoc] + "##k.");
}
return false;
}
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0 && type > 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if(status == 0) {
if(!cm.isQuestStarted(100400)) {
cm.sendOk("Hello #b#h0##k, I'm #p9201001# the fairy of Love.");
cm.dispose();
return;
}
nanaLoc = getNanaLocation(cm.getPlayer());
if(nanaLoc == -1) {
cm.sendOk("Hello #b#h0##k, I'm #p9201001# the fairy of Love.");
cm.dispose();
return;
}
if(!cm.haveItem(4031367 + nanaLoc, 1)) {
if(cm.isQuestCompleted(100401 + nanaLoc)) {
state = 1;
cm.sendAcceptDecline("Did you lost the #k#t4031367##k I gave to you? Well, I can share another one with you, but you will need to redo the favor I asked last time, is that ok? I need you to bring me #r50 #t" + questItems[nanaLoc] + "#'s.#k");
} else if(cm.isQuestStarted(100401 + nanaLoc)) {
if(processNanaQuest()) {
cm.gainExp(questExp[nanaLoc] * cm.getPlayer().getExpRate());
cm.completeQuest(100401 + nanaLoc);
}
cm.dispose();
} else {
state = 0;
cm.sendAcceptDecline("Are you searching for #k#t4031367#'s#k? I can share one with you, but you must do a favor for me, is that ok?");
}
} else {
cm.sendOk("Hey there. Did you get the #t4031367# from the other Nana's already?");
cm.dispose();
}
} else if(status == 1) {
if(state == 0) {
cm.startQuest(100401 + nanaLoc);
cm.sendOk("I need you to collect #r50 #t" + questItems[nanaLoc] + "##k.");
cm.dispose();
} else {
processNanaQuest();
cm.dispose();
}
}
}
}
|
module.exports = exports = {
CREATE: 'CREATE',
READ: 'READ',
UPDATE: 'UPDATE',
DELETE: 'DELETE'
};
|
import angular from 'angular';
angular.module('arrangementController', ['sipArrangeService']).
// This controller is responsible for the appraisal tab's implementation of SIP arrange.
// It doesn't have its own partial, and its scope is located in front_page/content.html
controller('ArrangementController', ['$scope', 'Alert', 'Transfer', 'SipArrange', function($scope, Alert, Transfer, SipArrange) {
var vm = this;
var load_data = () => {
SipArrange.list_contents().then(directories => {
vm.data = directories;
});
};
// angular-tree-view options
vm.options = {
dirSelectable: true,
isLeaf: node => {
return !node.has_children;
},
};
// Filters the displayed tree to omit items with the display property set to false
vm.filter_expression = {display: true};
vm.filter_comparator = true;
vm.refresh = node => {
if (node) {
load_element_children(node);
} else {
load_data();
}
};
var load_element_children = node => {
var path = '/arrange/' + node.path;
SipArrange.list_contents(path, node).then(entries => {
node.children = entries;
node.children_fetched = true;
});
};
vm.on_toggle = (node, expanded) => {
if (!expanded || node.children_fetched) {
return;
}
load_element_children(node);
};
vm.create_directory = parent => {
var path = prompt('Name of new directory?');
if (!path) {
return;
}
if (parent === undefined) {
var target = vm.data;
var full_path = path;
} else {
var target = parent.children;
var full_path = parent.path + '/' + path;
}
SipArrange.create_directory('/arrange/' + full_path, path, parent).then(result => {
target.push(result);
});
};
vm.delete_directory = element => {
SipArrange.remove('/arrange/' + element.path).then(success => {
// `element.parent` is undefined if this is a root-level directory
var parent = element.parent ? element.parent.children : vm.data;
var idx = parent.indexOf(element);
parent.splice(idx, 1);
vm.selected = undefined;
});
};
var hide_elements = node => {
node.display = false;
if (node.children) {
for (var i = 0; i < node.children.length; i++) {
hide_elements(node.children[i]);
}
}
};
vm.start_sip = directory => {
var on_success = success => {
// Hide elements from the UI so user doesn't try to start it again
hide_elements(directory);
Alert.alerts.push({
'type': 'success',
'message': 'SIP successfully started!',
});
};
var on_failure = error => {
Alert.alerts.push({
'type': 'danger',
'message': 'SIP could not be started! Check dashboard logs.',
});
};
SipArrange.start_sip('/arrange/' + directory.path + '/').then(on_success, on_failure);
};
var basename = path => path.replace(/\\/g, '/').replace( /.*\//, '' );
var generate_files_list = (file, source_path, destination_path) => {
let paths = {'source': [], 'destination': []};
if (!file.display) {
return paths;
}
if (file.type === 'file') {
paths.source.push(source_path + file.relative_path);
paths.destination.push(destination_path + basename(file.relative_path));
}
if (file.children) {
angular.forEach(file.children, child => {
let child_paths = generate_files_list(child, source_path,
destination_path + basename(file.relative_path) + '/');
paths.source = paths.source.concat(child_paths.source);
paths.destination = paths.destination.concat(child_paths.destination);
});
}
return paths;
};
// Called when files are dropped from either the transfer backlog
// or from elsewhere in arrange. Dispatches to the separate
// functions below.
vm.drop = function(unused, ui) {
if (ui.draggable.attr('file-type') === 'arrange') {
return drop_from_arrange.apply(this, [unused, ui]);
} else {
return drop_from_backlog.apply(this, [unused, ui]);
}
};
var on_copy_failure = error => {
Alert.alerts.push({
'type': 'danger',
'message': 'Failed to copy files to SIP arrange; check Dashboard logs.',
});
};
var on_copy_success = success => {
// Reload the tree, rather than recreating the structure locally,
// since it's possible the structure of the dragged files
// may differ from the structure of what actually entered arrange.
// TODO: when bugs about dragging contents into the wrong directory are
// resolved, maybe want to reload only the directory into which
// contents were dragged and not the entire tree.
load_data();
};
var drop_from_backlog = function(unused, ui) {
var file_uuid = ui.draggable.attr('uuid');
var file = Transfer.id_map[file_uuid];
let paths = generate_files_list(file,
'/originals/',
'/arrange/' + this.path + '/'
);
SipArrange.copy_to_arrange(paths.source, paths.destination).then(on_copy_success, on_copy_failure);
};
var drop_from_arrange = function(unused, ui) {
var path = ui.draggable.attr('file-path');
SipArrange.copy_to_arrange('/arrange/' + path, '/arrange/' + this.path + '/').then(on_copy_success, on_copy_failure);
};
load_data();
}]);
|
/*
* Conversión de UTM to LngLat *
* Example: UtmToLatLng("638149","5857111","32718");
* Return: Object(lng,lat)
*/
function UtmToLatLng(x,y,zonaUTM)
{
var zona=zonaUTM.substring(zonaUTM.length-2,zonaUTM.length);
Proj4js.defs["EPSG:" + zonaUTM] = "+proj=utm +zone=" + zona + " +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
var source = new Proj4js.Proj('EPSG:'+zonaUTM); // orignn UTM18
var dest = new Proj4js.Proj('EPSG:4326'); // Destino LatLng
// transforming point coordinates
var p = new Proj4js.Point(x,y); // pto x,y
//console.log(Proj4js.transform(source, dest, p));
var pto=Proj4js.transform(source, dest, p);
return { lng: pto.x, lat: pto.y };
}
/* Convert LatLng to UTM*/
/* Example: LatLngToUtm(-73.43871,-37.42252) */
/* Return: Object(x,y,zone)
*/
function LatLngToUtm(lng,lat)
{
// get zone UTM from Lng
zona=parseInt((lng / 6) + 31);
zonaUTM="327"+zona;
Proj4js.defs["EPSG:" + zonaUTM] = "+proj=utm +zone=" + zona + " +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs"; // UTM12
var source = new Proj4js.Proj('EPSG:4326'); // Origen LatLng
var dest = new Proj4js.Proj('EPSG:'+zonaUTM); // destino UTM18
// transforming point coordinates
var p = new Proj4js.Point(lng,lat); // pto Lng,Lat
var pto=Proj4js.transform(source, dest, p);
return { x: Math.floor(pto.x), y:Math.floor(pto.y), zona: zonaUTM };
}
/* Funcion que compara si dos puntos en UTM son el mismo */
function equalsUTM(p1,p2)
{
if((p1.zona==p2.zona)&&(p1.x==p2.x)&&(p1.y==p2.y)) return true;
return false;
}
/* Funcion que compara si dos puntos en LngLat son el mismo */
function equalsLngLat(p1,p2)
{
if((p1.lat==p2.lat)&&(p1.lng==p2.lng)) return true;
return false;
}
/* Funcion para transformar un array de UTM a array LatLng */
function array_UTMtoLatLng(arrayUTM)
{
var result=new Array();
if(arrayUTM.length>0)
{
for (var i=0; i<arrayUTM.length; i++) {
result[i]=UtmToLatLng(arrayUTM[i].x,arrayUTM[i].y,arrayUTM[i].zona);
}
}
return result;
}
|
define(['Ajax', 'Core', 'Language'], function(Ajax, Core, Language) {
"use strict";
var _buttonRunTest = null;
var _container = null;
return {
init: function () {
var smtpCheckbox = null;
var methods = elBySelAll('input[name="values[mail_send_method]"]', undefined, (function (radioCheckbox) {
radioCheckbox.addEventListener('change', this._onChange.bind(this));
if (radioCheckbox.value === 'smtp') smtpCheckbox = radioCheckbox;
}).bind(this));
// This configuration part is unavailable when running in enterprise mode.
if (methods.length === 0) {
return;
}
Core.triggerEvent(smtpCheckbox, 'change');
},
_onChange: function (event) {
var checkbox = event.currentTarget;
if (checkbox.value === 'smtp' && checkbox.checked) {
if (_container === null) this._initUi(checkbox);
elShow(_container);
}
else if (_container !== null) {
elHide(_container);
}
},
_initUi: function (checkbox) {
var html = '<dt>' + Language.get('wcf.acp.email.smtp.test') + '</dt>';
html += '<dd>';
html += '<a href="#" class="button">' + Language.get('wcf.acp.email.smtp.test.run') + '</a>';
html += '<small>' + Language.get('wcf.acp.email.smtp.test.description') + '</small>';
html += '</dd>';
_container = elCreate('dl');
_container.innerHTML = html;
_buttonRunTest = elBySel('a', _container);
_buttonRunTest.addEventListener(WCF_CLICK_EVENT, this._onClick.bind(this));
var insertAfter = checkbox.closest('dl');
insertAfter.parentNode.insertBefore(_container, insertAfter.nextSibling);
},
_onClick: function (event) {
event.preventDefault();
_buttonRunTest.disabled = true;
_buttonRunTest.innerHTML = '<span class="icon icon16 fa-spinner"></span> ' + Language.get('wcf.global.loading');
elInnerError(_buttonRunTest, false);
window.setTimeout((function () {
var startTls = elBySel('input[name="values[mail_smtp_starttls]"]:checked');
Ajax.api(this, {
parameters: {
host: elById('mail_smtp_host').value,
port: elById('mail_smtp_port').value,
startTls: (startTls) ? startTls.value : '',
user: elById('mail_smtp_user').value,
password: elById('mail_smtp_password').value
}
});
}).bind(this), 100);
},
_ajaxSuccess: function (data) {
var result = data.returnValues.validationResult;
if (result === '') {
this._resetButton(true);
}
else {
this._resetButton(false, result);
}
},
_ajaxFailure: function (data) {
var result = '';
if (data && data.returnValues && data.returnValues.fieldName) {
result = Language.get('wcf.acp.email.smtp.test.error.empty.' + data.returnValues.fieldName);
}
this._resetButton(false, result);
return (result === '');
},
_resetButton: function (success, errorMessage) {
_buttonRunTest.disabled = false;
if (success) _buttonRunTest.innerHTML = '<span class="icon icon16 fa-check green"></span> ' + Language.get('wcf.acp.email.smtp.test.run.success');
else _buttonRunTest.innerHTML = Language.get('wcf.acp.email.smtp.test.run');
if (errorMessage) elInnerError(_buttonRunTest, errorMessage);
},
_ajaxSetup: function () {
return {
data: {
actionName: 'emailSmtpTest',
className: 'wcf\\data\\option\\OptionAction'
},
silent: true
};
}
};
});
|
function UsersApi(http, api) {
var userSettingsRelation = "user-settings";
var userFeedsRelation = "user-feeds";
var userFeedRelation = "user-feed";
this.addUser = function (user) {
return api.withLink("user", function (userLink) {
return http.post(userLink, user);
});
};
this.getUsers = function (userListCallback, search) {
return api.withLink("users", this.getUsersFromUrl(userListCallback, search));
};
this.getUsersFromUrl = function (userListCallback, search) {
return function (url) {
var requestUrl = search ? url + "?search=" + search : url;
return http.get(requestUrl).success(userListCallback);
};
};
this.userInfo = function (userInfoCallback) {
return api.withLink("user-info", function (userLink) {
return http.get(userLink).success(userInfoCallback);
});
};
this.requestNewPassword = function(email) {
return api.withLink("password-reset", function (resetLink) {
return http.post(resetLink, {
"email": email
});
})
};
this.getSettings = function() {
return api.withLink(userSettingsRelation, function (settingsLink) {
return http.get(settingsLink);
})
};
this.getAccessTokens = function () {
return api.withLink("access-tokens", function (accessTokensLinks) {
return http.get(accessTokensLinks);
})
};
this.addAccessToken = function(clientId, expiryDate) {
return api.withLink("access-token", function (accessTokenLink) {
return http.post(accessTokenLink.replace("{id}", ""), {
"clientId": clientId,
"expiryDate": expiryDate
});
})
};
this.deleteAccessToken = function(accessTokenId) {
return api.withLink("access-token", function (accessTokenLink) {
return http.delete(accessTokenLink.replace("{id}", accessTokenId));
})
};
this.getRssFeeds = function() {
return api.withLink(userFeedsRelation, function (userFeedsLink) {
return http.get(userFeedsLink);
})
};
this.addRssFeed = function(url) {
return api.withLink(userFeedsRelation, function (userFeedsLink) {
return http.post(userFeedsLink, {
"url": url
});
})
};
this.deleteRssFeed = function(feedId) {
return api.withLink(userFeedRelation, function (userFeedLink) {
return http.delete(userFeedLink+"/"+feedId);
})
};
this.updateSettings = function(settings) {
return api.withLink(userSettingsRelation, function (settingsLink) {
return http.put(settingsLink, settings);
})
};
}
UsersApi.$inject = ["$http", "api"];
module.exports = UsersApi;
|
// Alert type warning
$('#btnWarning').click(function(e) {
e.preventDefault();
$.smkAlert({
text: 'Alert type "warning"',
type: 'warning',
});
});
// Alert type success, position top-left
$('#btnSuccess').click(function(e) {
e.preventDefault();
$.smkAlert({
text: 'Alert type "success"',
type: 'success',
position:'top-left'
});
});
// Alert type danger, position top-center, 10 seconds
$('#btnDanger').click(function(e) {
e.preventDefault();
$.smkAlert({
text: 'Alert type "danger" time 10 seconds',
type: 'danger',
position:'top-center',
time: 10
});
});
// Alert type info, position bottom-right, icon glyphicon-time, permanent
$('#btnInfo').click(function(e) {
e.preventDefault();
$.smkAlert({
text: 'Alert type "info" permanent',
type: 'info',
position:'bottom-right',
icon: 'glyphicon-time',
permanent: true
});
});
|
(function () {
CKEDITOR.plugins.add('virtualkey', {
init: function (editor) {
editor.addCommand('virtualkey',
new CKEDITOR.dialogCommand('virtualkey'));
editor.ui.addButton('virtualkey', {
label: "Universal Keyboard",
command: 'virtualkey',
icon: this.path + 'virtualkey.png',
toolbar: 'insert'
});
CKEDITOR.dialog.add('virtualkey', this.path + 'dialogs/virtualkey.js');
}
});
})();
|
const Table = require('cli-table');
const config = require('../config');
exports.update = function(json) {
const table = new Table({
head: [
'Name',
'id',
'HP',
'atk',
'def',
'matk',
'mdef',
'mnd',
'acc',
'eva',
'spd',
],
chars: {
top: '',
'top-mid': '',
'top-left': '',
'top-right': '',
bottom: '',
'bottom-mid': '',
'bottom-left': '',
'bottom-right': '',
left: '',
'left-mid': '',
mid: '',
'mid-mid': '',
right: '',
'right-mid': '',
middle: ' ',
}
});
for (let beast in json) {
const tmpRow = [];
let tmp = 0;
const params = json[beast].params[0];
tmpRow.push(params.disp_name);
tmpRow.push(params.id);
tmp = json[beast].init_hp;
json[beast].init_hp = parseInt(json[beast].max_hp);
tmpRow.push(tmp + '/' + json[beast].max_hp);
tmpRow.push(params.atk);
tmpRow.push(params.def);
tmpRow.push(params.matk);
tmpRow.push(params.mdef);
tmpRow.push(params.mnd);
tmpRow.push(params.acc);
tmpRow.push(params.eva);
tmpRow.push(params.spd);
/**
* Skill spammer
* Allows all super skills to be instant-cast
* Set cost to 100 ms. (Normal cost is 2.5 secs)
* Number of uses set to 20
*/
if (config.get('magicite.summon.skillSpammer')) {
const active_skill = json[beast].active_skills[0];
active_skill.options.cast_time = '100';
active_skill.num = '20';
active_skill.max_num = '20';
}
/**
* Summon charge time
* From start of battle or from previous cast
* Normal charge time is 10 seconds
*/
if (config.get('magicite.summon.gaugeFillTime')) {
params.required_time_to_fill_synchronization_gauge = config.get('magicite.summon.gaugeFillTime') || params.required_time_to_fill_synchronization_gauge;
}
/**
* Summon duration
* Normal duration is 20 seconds
*/
if (config.get('magicite.summon.duration')) {
params.synchronization_duration = config.get('magicite.summon.duration') || params.synchronization_duration;
}
table.push(tmpRow);
console.log(table.toString() + '\n');
}
return json;
};
|
"use strict";
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.default = setReadOnly;
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
var _info = _interopRequireDefault(require("./info.js"));
var _webService = _interopRequireDefault(require("../utils/webService.js"));
/**
@name $SP().list.setReadOnly
@function
@description Permits to change a readonly column (like "Created By", "Created","Modified" or "Modified By") to become editable... ATTENTION: it's not recommanded to edit a READONLY column, and it could have unexpected consequences on your list
@param {String} fieldID The internal field name (e.g. "Author", or "Modified"); The supported columns are: "Author", "Created", "Editor" and "Modified". You can also provide an XML string if you want to deal with another column (e.g. <'Field ID="{8c06beca-0777-48f7-91c7-6da68bc07b69}" Name="Created" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Created" Group="_Hidden" ColName="tp_Created" RowOrdinal="0" ReadOnly="TRUE" Type="DateTime" DisplayName="Created" StorageTZ="TRUE"/>')
@param {Boolean} readonly To define the readonly status of the column
@return {Promise} resolve(contentTypes), reject(error)
@example
// make "Created" column an editable column
$SP().list("List Name").setReadOnly('Created', false)
.then(function() {
$SP().list("List Name").update({ID:1, Created:'2019-01-19'})
})
*/
function setReadOnly(fieldID, readonly) {
var _this = this;
if (!this.listID) throw "[SharepointPlus 'setReadOnly']: the list ID/Name is required";
if (!this.url) throw "[SharepointPlus 'setReadOnly']: not able to find the URL!"; // we cannot determine the url
// do the request
var updateSystemFields = "<Fields><Method ID='1'>";
if (fieldID.charAt(0) === '<') updateSystemFields += fieldID; // get info
return _info.default.call(this).then(function (infos) {
var props = ["ID", "Name", "SourceID", "StaticName", "ColName", "RowOrdinal", "Type", "DisplayName"];
updateSystemFields += '<Field';
var _loop = function _loop(i) {
if (infos[i]["Name"] === fieldID) {
// add other properties based on the Field ID
switch (fieldID) {
case "Created":
case "Modified":
{
props.push("StorageTZ");
break;
}
case "Author":
case "Editor":
{
props.push("List");
break;
}
}
(0, _forEach.default)(props).call(props, function (prop) {
if (infos[i][prop]) updateSystemFields += ' ' + prop + '="' + infos[i][prop] + '"';
});
updateSystemFields += ' ReadOnly="' + (readonly ? "TRUE" : "FALSE") + '" />';
return "break";
}
};
for (var i = infos.length; i--;) {
var _ret = _loop(i);
if (_ret === "break") break;
}
updateSystemFields += "</Method></Fields>";
return _webService.default.call(_this, {
webURL: _this.url,
service: "Lists",
operation: "UpdateList",
properties: {
listName: _this.listID,
listProperties: "",
updateFields: updateSystemFields,
newFields: "",
deleteFields: "",
listVersion: ""
}
});
}).then(function (response) {
if (response.getElementsByTagName('ErrorCode')[0].firstChild.nodeValue !== "0x00000000") {
var errors = response.getElementsByTagName('ErrorText');
return _promise.default.reject(errors.length > 0 ? errors[0].firstChild.nodeValue : "Unknown Error");
}
});
}
module.exports = exports.default;
|
/* Copyright 2017 Assembleia Legislativa de Minas Gerais
*
* This file is part of Editor-Articulacao.
*
* Editor-Articulacao is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3.
*
* Editor-Articulacao 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Editor-Articulacao. If not, see <http://www.gnu.org/licenses/>.
*/
import { TransformacaoDoProximo } from './Transformacao';
/**
* Quando usuário encerra as aspas na continuação do caput de um artigo,
* então cria-se um novo artigo.
*/
class AoFecharAspas extends TransformacaoDoProximo {
constructor() {
super('"\n', '".\n');
}
get tipoTransformacao() {
return 'AoFecharAspas';
}
proximoTipo(editor, ctrl, contexto) {
return contexto.cursor.artigo && contexto.cursor.continuacao ? 'artigo' : null;
}
}
export default AoFecharAspas;
|
var searchData=
[
['msmaster_5ferror_5fcode',['MSMASTER_ERROR_CODE',['../class_m_s_master_error_aa1deb878016117b72d744363b49a16e4.html#aa1deb878016117b72d744363b49a16e4',1,'MSMasterError']]],
['msmastererror',['MSMasterError',['../class_m_s_master_error.html',1,'']]],
['msmastersplitter',['MSMasterSplitter',['../class_m_s_master_splitter.html',1,'MSMasterSplitter'],['../class_m_s_master_splitter_abb9f371e43978f5d0c8746d35e8debb4.html#abb9f371e43978f5d0c8746d35e8debb4',1,'MSMasterSplitter::MSMasterSplitter()']]]
];
|
"use strict";
Map = function(width, height) {
this.width = width;
this.height = height;
this.data = new Uint8Array(width * height);
}
Map.prototype.get = function(x, y, z) {
if(z != 0) {
return 1;
}
if( this.range(x, y) ) {
return this.data[this.offset(x, y)];
} else {
return 1;
}
}
Map.prototype.set = function(x, y, v) {
this.data[this.offset(x, y)] = v;
}
Map.prototype.range = function(x, y) {
return x >= 0 && y >= 0 && x < this.width && y < this.height;
}
Map.prototype.offset = function(x,y) {
return x + y * this.width;
}
Map.prototype.generate = function() {
for(var y=0; y<this.height; y++) {
for(var x=0; x<this.width; x++) {
this.set(x, y, x&y&1|(Math.random()>0.9?1:0));
}
}
}
Map.prototype.dump = function() {
var s = "";
for(var y=0; y<this.height; y++) {
for(var x=0; x<this.width; x++) {
s += this.get(x, y) + (x==this.width-1?"\n":" ");
}
}
return s;
}
Map.prototype.drawBlock = function(vertices, x, y, z) {
/* 0 3
+---------+
/ /|
/ / |
1 / 2 / |
+---------+ |
| | +
| | /
| | /
| |/
+---------+
*/
var face = [
[-.5, .5, .5],
[-.5, -.5, .5],
[ .5, -.5, .5],
[ .5, .5, .5],
];
var texCoord = [
[0, 0],
[0, 1],
[1, 1],
[1, 0],
];
var normal = [0, 0, 1];
var transparent = this.get(x, y, z) == 0;
var transforms = [
[ 0, 0, 0, 1],
[ 0.5, 0.5, 0.5, 0.5],
[ 0, Math.SQRT1_2, Math.SQRT1_2, 0],
[ -0.5, 0.5, 0.5, -0.5],
[ -Math.SQRT1_2, 0, 0, -Math.SQRT1_2 ],
[ -1, 0, 0, 0 ],
];
/*
var transforms = [];
{
var t = quat.create();
transforms.push(quat.clone(t));
t = quat.create();
quat.rotateY(t,t,-Math.PI/2);
transforms.push(quat.clone(t));
t = quat.create();
quat.rotateX(t,t,-Math.PI/2);
transforms.push(quat.clone(t));
t = quat.create();
quat.rotateX(t,t,Math.PI/2);
transforms.push(quat.clone(t));
t = quat.create();
quat.rotateX(t,t,Math.PI);
quat.rotateZ(t,t,Math.PI);
transforms.push(quat.clone(t));
t = quat.create();
quat.rotateY(t,t,Math.PI/2);
transforms.push(quat.clone(t));
t = quat.create();
quat.rotateY(t,t,-Math.PI/2);
transforms.push(quat.clone(t));
}
*/
for(var transform of transforms) {
var n = vec3.clone(normal);
vec3.transformQuat(n, n, transform);
if( transparent ) {
continue;
} else {
if(this.get(Math.round(x + n[0]), Math.round(y + n[1]), Math.round(z + n[2])) != 0) {
continue;
}
}
for(var triangle of [[0, 1, 2],[0, 2, 3]]) {
for(var v of triangle) {
var tface = vec3.clone(face[v]);
vec3.transformQuat(tface, tface, transform);
vec3.add(tface, tface, vec3.fromValues(x + 0.5, y + 0.5, z + 0.5));
for(var c of tface) {
vertices.push(c);
}
for(var c of transform) {
vertices.push(c);
}
var vertexTexCoord = vec2.clone(texCoord[v]);
vec2.scale(vertexTexCoord, vertexTexCoord, 62);
vec2.add(vertexTexCoord, vertexTexCoord, vec2.fromValues(1, 1));
vec2.scale(vertexTexCoord, vertexTexCoord, 1.0/256.0);
if( n[2] == 0 ) {
vertexTexCoord[0] += 0.25;
} else if( n[2] == -1 ) {
vertexTexCoord[0] += 0.50;
}
for(var c of vertexTexCoord) {
vertices.push(c);
}
}
}
}
}
Map.prototype.draw = function(gl) {
var vertices = [];
for(var y=-1;y<=this.height;y++) {
for(var x=-1;x<=this.width;x++) {
for(var z=-1;z<=1;z++) {
this.drawBlock(vertices, x, y, z);
}
}
}
var triangles = vertices.length / 9;
var buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
return {
attributes: [
{
name: 'vertexPosition',
size: 3,
},
{
name: 'vertexNormal',
size: 4,
},
{
name: 'vertexUV',
size: 2,
},
],
buffer: buffer,
triangles: triangles,
};
}
|
/**
* Logo rotates in.
*/
(function(Lunar, window, undefined) {
const AMPLITUDE = 35;
const TILT_FRONT = 20;
const WIDTH = 0.13;
const HEIGHT = 0.13;
const DEPTH = 0.01;
const CENTER_X = -0.1;
const CENTER_Y = 0.45;
const CENTER_Z = 0.50+0.20;
Lunar.Scene.BattleOpponentWiggle = class extends Lunar.Scene.Base {
constructor(battle, cube, {duration = 4.5, frequency = 1/2} = {}) {
super(battle.game);
this._cube = cube;
this._startTime = 0;
this._battle = battle;
this._duration = duration;
this._frequency2Pi = 2*Math.PI*frequency;
this._done = false;
}
destroy() {
this._cube = undefined;
super.destroy();
}
onAdd() {
this._initScene();
this._startTime = this.time;
super.onAdd();
}
onRemove() {
super.onRemove();
}
layout() {
super.layout();
const h = this.hierarchy;
const cubeSize = Math.min(this.game.dx(WIDTH), this.game.dy(HEIGHT));
this._cube.resetWorldTransform();
this._cube.resetLocalTransform();
this._cube.setDimensions(cubeSize, cubeSize, this.game.dx(DEPTH));
this._cube.translate3(this.game.x(CENTER_X), this.game.y(CENTER_Y), this.game.dx(CENTER_Z));
this._cube.rotate3Deg(TILT_FRONT, [1,0,0]);
//this._cube.rotate3Deg(5, [0,0,1]);
}
update(delta) {
super.update(delta);
this.layout();
let time = this.time - this._startTime;
if (time >= this._duration) {
if (!this._done)
this.emit('animation-done', {scene: this});
this._done = true;
}
const angle = AMPLITUDE*this.game.fmath.sin(this._frequency2Pi*time);
this._cube.preRotate3Deg(angle, [0,0,1]);
this._cube.update();
}
_initScene() {
this._cube.container.visible = true;
}
static createCube(battle) {
const r = battle.resources;
return new Lunar.PixiCube({
front: r.u_ava.texture,
back: PIXI.Texture.WHITE,
left: r.packed.spritesheet.textures["avatarside.png"],
right: r.packed.spritesheet.textures["avatarside.png"],
top: r.packed.spritesheet.textures["avatarside.png"],
bottom: r.packed.spritesheet.textures["avatarside.png"]
});
}
}
})(window.Lunar, window);
|
// Set the connection string based from the config vars of the production server
// To run locally use 'mongodb://localhost/Project-x' instead of process.env.DB
module.exports = {
db: 'mongodb://localhost:27017/cinemas'
};
|
function tutorial() {
var videos = ["1", "2", "3", "4", "5"];
var content = cEl("div").attr("id", "videoContainer").attr("class","row");
var video0 = cEl("div").attr("class", "description").tEl("How to play #1");
var video1 = cEl("div").attr("class", "description").tEl("How To Predict");
var video2 = cEl("div").attr("class", "description").tEl("How To Unlock");
var video3 = cEl("div").attr("class", "description").tEl("How To Join Another Clan");
var video4 = cEl("div").attr("class", "description").tEl("How To Use Clan & Global Chat");
for (var i = 0; i < videos.length; i++) {
var row = cEl("div").attr("class", "span5").attr("style","display:inline-block");
var video = cEl("video").attr("width","100%").attr("height","100%").attr("controls");
video.append(cEl("source").attr("src", "../style/videos/" + videos[i] + ".webm").attr("type", "video/mp4"))
.append(cEl("source").attr("src", "../style/videos/" + videos[i] + ".mp4").attr("type", "video/mp4"));
row.append(video);
if (i == 0) {
row.append(video0);
}else if(i == 1){
row.append(video1);
}else if(i == 2){
row.append(video2);
} else if (i == 3) {
row.append(video3);
}else {
row.append(video4);
}
content.append(row);
}
var mainC = document.getElementById("mainContainer");
mainC.append(content);
}
|
var canvas = null;
var gl = null;
var shader = null;
// ********************************************************
// ********************************************************
function initGL() {
gl = canvas.getContext("webgl");
if (!gl) {
alert("Could not initialise WebGL, sorry :-(");
return (null);
}
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
gl.clearColor(0.0, 0.0, 0.0, 1.0);
}
// ********************************************************
// ********************************************************
var vPosBuf;
var vColorBuf;
function initBuffers() {
var vPos = [-0.5, -0.5, 0.0,
0.5, -0.5, 0.0,
0.5, 0.5, 0.0,
-0.5, -0.5, 0.0,
0.5, 0.5, 0.0,
-0.5, 0.5, 0.0
];
var vColor = [1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
1.0, 0.0, 0.0,
0.0, 0.0, 1.0,
1.0, 1.0, 1.0
];
vPosBuf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vPosBuf);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vPos), gl.STATIC_DRAW);
vPosBuf.itemSize = 3;
vPosBuf.numItems = 6;
vColorBuf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vColorBuf);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vColor), gl.STATIC_DRAW);
vColorBuf.itemSize = 3;
vColorBuf.numItems = 6;
}
// ********************************************************
// ********************************************************
function drawScene(shader) {
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.useProgram(shader);
gl.bindBuffer(gl.ARRAY_BUFFER, vPosBuf);
gl.enableVertexAttribArray(shader.vPosAttr);
gl.vertexAttribPointer(shader.vPosAttr, vPosBuf.itemSize, gl.FLOAT, false, 0, 0);
gl.bindBuffer(gl.ARRAY_BUFFER, vColorBuf);
gl.enableVertexAttribArray(shader.vColorAttr);
gl.vertexAttribPointer(shader.vColorAttr, vColorBuf.itemSize, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLES, 0, vPosBuf.numItems);
gl.disableVertexAttribArray(shader.vPosAttr);
gl.disableVertexAttribArray(shader.vColorAttr);
gl.useProgram(null);
}
// ********************************************************
// ********************************************************
function webGLStart() {
canvas = document.getElementById("quadrado");
initGL();
shader = initShaders("shader", gl);
if (shader == null) {
alert("Erro na inicilização do shader!!");
return;
}
shader.vPosAttr = gl.getAttribLocation(shaderProgram, "aVertexPosition");
shader.vColorAttr = gl.getAttribLocation(shaderProgram, "aVertexColor");
if ( (shader.vPosAttr < 0) ||
(shader.vColorAttr < 0) ) {
alert("Shader attribute ou uniform não localizado!");
return;
}
initBuffers();
drawScene(shader);
}
|
'use strict';
angular.module('athenaApp')
.factory('Password', function ($resource) {
return $resource('api/account/change_password', {}, {
});
});
angular.module('athenaApp')
.factory('PasswordResetInit', function ($resource) {
return $resource('api/account/reset_password/init', {}, {
})
});
angular.module('athenaApp')
.factory('PasswordResetFinish', function ($resource) {
return $resource('api/account/reset_password/finish', {}, {
})
});
|
/**
Given a collection of integers that might contain duplicates, nums, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.
The solution set must not contain duplicate subsets.
For example,
If nums = [1,2,2], a solution is:
[
[2],
[1],
[1,2,2],
[2,2],
[1,2],
[]
]
*/
/**
* @param {number[]} nums
* @return {number[][]}
*/
var subsetsWithDup = function(nums) {
var result = [],
len = nums.length;
nums.sort(function(a, b) {
return a - b;
});
helper(nums, 0, len - 1, [], result);
return result;
};
function helper(nums, start, end, curArr, result) {
result.push(curArr);
var i;
for (i = start; i <= end; i++) {
// skip duplicates
if (i > start && nums[i] === nums[i - 1]) {
continue;
}
curArr.push(nums[i]);
helper(nums, i + 1, end, curArr.concat(), result);
curArr.pop();
}
}
|
// Available sections for content pages
var sections = [
{slug: 'about', label: "About"},
{slug: 'donate', label: "Donate"}
];
orion.addEntity('contentPages', {
// sectionSlug and slug are used for very simple routing of content pages, see router.js
sectionSlug: {
type: String,
label: 'Section',
optional: true,
autoform: {
type: "select",
options: sections.map(function(section) {
return {value: section.slug, label: section.label};
}),
afFieldInput: {
firstOption: "None (page will be in site root)"
}
}
},
slug: {
type: String,
label: 'Slug (must be unique among content pages)',
},
title: {
type: String,
label: 'Title',
},
body: orion.attribute('summernote', {
label: 'Body',
optional: true
})
}, {
icon: 'file-text',
sidebarName: 'Content Pages',
pluralName: 'Content Pages',
singularName: 'Content Page',
tableColumns: [
{data: 'title', title: 'Title'},
{data: 'sectionSlug', title: 'Section', render: function(val, type, doc) {
var section = _.findWhere(sections, {slug: val});
return section ? section.label : '';
}},
{data: 'slug', title: 'Slug'},
orion.attributeColumn('summernote', 'body', 'Preview')
]
});
|
const addConstantAndFraction = require('../../../lib/simplifyExpression/fractionsSearch/addConstantAndFraction');
const TestUtil = require('../../TestUtil');
function testAddConstantAndFraction(exprString, outputList) {
const lastString = outputList[outputList.length - 1];
TestUtil.testSubsteps(addConstantAndFraction, exprString, outputList, lastString);
}
describe('addConstantAndFraction', function () {
const tests = [
['7 + 1/2',
['14/2 + 1/2',
'(14 + 1) / 2',
'15/2']
],
['5/6 + 3',
['5/6 + 18/6',
'(5 + 18) / 6',
'23/6'],
],
['1/2 + 5.8',
['0.5 + 5.8',
'6.3'],
],
['1/3 + 5.8',
['0.3333 + 5.8',
'6.1333']
],
];
tests.forEach(t => testAddConstantAndFraction(t[0], t[1]));
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.