code stringlengths 2 1.05M | repo_name stringlengths 5 114 | path stringlengths 4 991 | language stringclasses 1 value | license stringclasses 15 values | size int32 2 1.05M |
|---|---|---|---|---|---|
import { h } from 'omi';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(h(h.f, null, h("circle", {
cx: "15.5",
cy: "9.5",
r: "1.5"
}), h("circle", {
cx: "8.5",
cy: "9.5",
r: "1.5"
}), h("path", {
d: "M12 16c-1.48 0-2.75-.81-3.45-2H6.88c.8 2.05 2.79 3.5 5.12 3.5s4.32-1.45 5.12-3.5h-1.67c-.7 1.19-1.97 2-3.45 2zm-.01-14C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
})), 'SentimentSatisfiedOutlined'); | AlloyTeam/Nuclear | components/icon/esm/sentiment-satisfied-outlined.js | JavaScript | mit | 537 |
var content = '<abcdテスト>';
var result = '';
result = encodeURI(content);
console.log("encodeURI('abcdテスト')", result);
console.log("decodeURI(encodeURI('abcdテスト'))", decodeURI(encodeURI(content)));
result = encodeURIComponent(content);
console.log("encodeURIComponent('abcdテスト')", result);
console.log("decodeURIComponent(encodeURIComponent('abcdテスト'))", decodeURIComponent(encodeURIComponent(content)));
result = 'var a=1,b=2;console.log(a+b);';
eval(result);
console.log("isFinite('aa')", isFinite('aa'));
console.log("isFinite('1111')", isFinite('1111'));
console.log("isFinite('1111.23')", isFinite('1111.23'));
console.log("isFinite(null)", isFinite(null));
console.log("isFinite(undefined)", isFinite(undefined));
console.log("isFinite(NaN)", isFinite(NaN));
console.log("isFinite(true)", isFinite(true));
console.log("isNaN('aa')", isNaN('aa'));
console.log("isNaN('1111')", isNaN('1111'));
console.log("isNaN('1111.23')", isNaN('1111.23'));
console.log("isNaN(null)", isNaN(null));
console.log("isNaN(undefined)", isNaN(undefined));
console.log("isNaN(NaN)", isNaN(NaN));
console.log("isNaN(true)", isNaN(true));
console.log("parseFloat('aa')", parseFloat('aa'));
console.log("parseFloat('1111')", parseFloat('1111'));
console.log("parseFloat('1111.23')", parseFloat('1111.23'));
console.log("parseFloat(null)", parseFloat(null));
console.log("parseFloat(undefined)", parseFloat(undefined));
console.log("parseFloat(NaN)", parseFloat(NaN));
console.log("parseFloat(true)", parseFloat(true));
console.log("parseInt('aa')", parseInt('aa'));
console.log("parseInt('1111')", parseInt('1111'));
console.log("parseInt('1111.73')", parseInt('1111.73'));
console.log("parseInt(null)", parseInt(null));
console.log("parseInt(undefined)", parseInt(undefined));
console.log("parseInt(NaN)", parseInt(NaN));
console.log("parseInt(true)", parseInt(true));
| osser/nodejs-sample | javascript/globalfunc.js | JavaScript | mit | 1,887 |
// 使用缓存优化标签选择
// 如果没有缓存的话建立缓存,否则返回缓存中的标签对象
function getElements(name) {
if (!getElements.cache) {
getElements.cache = {};
}
return getElements.cache[name] = getElements.cache[name] || document.getElementsByTagName(name);
} | caronyan/JavascriptRecipe | usage/getElementsByCache.js | JavaScript | mit | 298 |
function ajaxChimpCallback(a) {
if ("success" === a.result) {
$(".beta-request-result").show();
$(".beta-request-form").hide();
$(".beta-request-title").hide();
$.featherlight.current().close();
}
else
{
a.msg.indexOf("already subscribed") >= 0 ? ($(".beta-request-form").hide(), $(".beta-request-title").hide(), $(".beta-request-already-subscribed").show()) : $(".beta-request-error").show(), $(".beta-request-btn").html("Invite me")
}
};
function contactLightbox()
{
var configuration = ({
afterOpen: function(event)
{
$('body').toggleClass('body-open-modal');
setContactTabindex();
sendContactMessage();
},
afterClose: function(event)
{
$('body').toggleClass('body-open-modal');
}
});
$('body').on('click', '.open-contact-form', function(event)
{
event.preventDefault();
$.featherlight('#contactLightbox', configuration);
});
}
function setContactTabindex()
{
var $form = $('.featherlight-content form.sendingContactMessage');
$form.find('input[name=from_name]').focus().attr('tabindex', 1);
$form.find('input[name=from_email]').attr('tabindex', 2);
$form.find('textarea[name=message]').attr('tabindex', 3);
}
function setBetaTabIndex()
{
var $form = $('.beta-request-form');
$form.find('.first-name').focus().attr('tabindex', 1);
$form.find('.email').attr('tabindex', 2);
}
function sendContactMessage()
{
$('.featherlight-content form.sendingContactMessage').validate({
rules: {
from_name: "required",
from_email: {
required: true,
email: true
},
message: "required"
},
messages: {
from_name: "Please enter your name",
from_email: "Please enter a valid email address",
message: "Please enter a message."
},
submitHandler: function(form, event) {
event.preventDefault();
var $form = $('.featherlight-content form.sendingContactMessage'),
service_id = "default_service",
template_id = "trado_contact_message",
currentModal = $.featherlight.current();
params = $form.serializeArray().reduce(function(obj, item) {
obj[item.name] = item.value;
return obj;
}, {});
$form.find('input').prop('disabled', true);
$form.find('textarea').prop('disabled', true);
$form.find("button").text("Sending...");
$('#errors, #success').html('');
emailjs.send(service_id,template_id,params)
.then(function(){
$form.find('#success').html('<p>Message has been sent. We will get back to you within 24 hours.</p>');
setTimeout(function(){
currentModal.close();
$form.find('input').prop('disabled', false);
$form.find('textarea').prop('disabled', false);
$form.find("button").text("Send");
}, 5000);
}, function(err) {
$form.find('input').prop('disabled', false);
$form.find('textarea').prop('disabled', false);
$form.find("#errors").html('<p>' + JSON.parse(err.text).service_error + '</p>');
$form.find("button").text("Send");
});
}
});
}
function scrollingNavbar()
{
$(window).on('scroll', function() {
var y_scroll_pos = window.pageYOffset;
var scroll_pos_test = 150; // set to whatever you want it to be
if(y_scroll_pos > scroll_pos_test)
{
$('header.scrolling').fadeIn();
$('#home-layout .slicknav_menu').addClass('home-scrolling');
}
else
{
$('header.scrolling').stop().fadeOut();
$('#home-layout .slicknav_menu').removeClass('home-scrolling');
}
});
$('.menu').slicknav({
label: "",
brand: "<a href='/'><img src=\"https://dlczmkt02tnnw.cloudfront.net/trado-promo/assets/img/cropped.png\" height=\"100\"></a>"
});
}
function betaLightbox()
{
$(".beta-request-form").ajaxChimp({
url: "https://tomdallimore.us9.list-manage.com/subscribe/post?u=b141eef8b30b7dc5813bd752a&id=95c7eadbb9",
callback: ajaxChimpCallback
});
$(".beta-request-form").submit(function() {
ga("send", "event", "invite", "request");
$(".beta-request-btn").html("<i class='fa fa-spinner fa-spin'></i>");
$(".beta-request-error").hide();
$(".beta-request-already-subscribed").hide();
});
if (!readCookie('tradoPopup'))
{
var configuration = ({
afterOpen: function(event)
{
$('body').toggleClass('body-open-modal');
setBetaTabIndex();
sendContactMessage();
},
afterClose: function(event)
{
$('body').toggleClass('body-open-modal');
}
});
setTimeout( function()
{
$.featherlight('#newsletterLightbox', configuration);
createCookie('tradoPopup','1',1);
}, 3000);
}
}
$(document).ready(function() {
contactLightbox();
betaLightbox();
scrollingNavbar();
if(!$('html').hasClass('touch'))
{
$(".first-name").first().focus();
}else{
bouncefix.add('html');
}
$('[data-ga="true"]').click(function()
{
var dataCategory = $(this).attr('data-event-category'),
dataAction = $(this).attr('data-event-action');
if(dataCategory == '' || dataAction == '')
{
return false;
}
else
{
ga("send", "event", dataCategory, dataAction);
}
});
});
jQuery.fn.capitalize = function() {
return $(this).each(function(a, b) {
$(b).keyup(function(a) {
var b = a.target,
c = $(this).val(),
d = b.selectionStart,
e = b.selectionEnd;
$(this).val(c.replace(/^(.)|(\s|\-)(.)/g, function(a) {
return a.toUpperCase()
})), b.setSelectionRange(d, e)
})
}), this
};
$(".first-name").capitalize();
$('#documentation .content, #documentation .sidebar').theiaStickySidebar(
{
additionalMarginTop: 120
});
// cookies
function createCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
} | Jellyfishboy/trado-promo | app/js/application.js | JavaScript | mit | 7,261 |
export default class Definition {
get module() { return this._module; }
set module(value) { this._module = value; }
get classArguments() { return this._arguments || []; }
set classArguments(value) { this._arguments = value; }
get tags() { return this._tags || []; }
set tags(value) { this._tags = value; }
constructor(module = '', classArguments = [], tags = []) {
this.module = module;
this.classArguments = classArguments;
this.tags = tags;
}
setModule(module) {
this.module = module;
}
addArgument(argument) {
this.classArguments.push(argument);
return this;
}
setArgument(index, argument) {
this.classArguments[index] = argument;
return this;
}
removeArgument(index) {
if (undefined !== this.classArguments[index]) {
delete this.classArguments[index];
}
return this;
}
setArguments(classArguments) {
this.classArguments = classArguments;
}
setTags(tags) {
this.tags = tags;
}
getTags() {
return this.tags;
}
addTag(name) {
this.tags.push(name);
}
} | aequasi/Crate | src/Definition.js | JavaScript | mit | 1,215 |
/* eslint-disable no-console*/
import low from 'lowdb';
import fse from 'fs-extra';
import uuid from 'uuid';
import slug from 'slug';
import constants from './constants';
import { crypt } from '../utils';
const user = {
id: uuid(),
name: constants.USER_NAME,
password: crypt.encrypt(constants.USER_PASSWORD),
role: 'admin',
slug: slug(constants.USER_NAME),
};
fse.ensureFileSync(constants.DATA_FILE);
const db = low(constants.DATA_FILE);
db.defaults({
users: [user],
containers: [],
imageSources: [],
images: [],
templates: [],
volumes: [],
}).write();
console.log('DB is running');
export default () => (db);
| ShamatienkoYaroslav/colibri | src/server/config/database.js | JavaScript | mit | 639 |
/**
* Fetch configuration data using an API Key and the Application Secret Key.
* By doing so, the sconfig servers will just apply firewall rules (if any) and return
* the encrypted configuration data. The client will then decrypt the configuration
* data using the App Secret Key
* Note: Ff no API Key or App Secret is provided, it will look for it in process.env.SCONFIG_KEY and process.env.SCONFIG_SECRET
* */
var sconfig = require('sconfig');
sconfig({
key: '{YOUR_API_KEY}', // the 32-char version of an API Key
secret: '{YOUR_APP_SECRET}', // the 32 char secret key found under the App Details tab
//version: '{YOUR_VERSION}', // version name to fetch, defaults to latest version created
// json: true // expect the result data to be JSON. This is true by default.
sync: true // persist the configuration data locally in the event of an sconfig server outage
}, function(err, config) {
if (err) {
console.log(err);
return;
}
console.log("OK", config);
}); | UNLOQIO/sconfig-node-client | example/fetch-zero-knowledge.js | JavaScript | mit | 1,027 |
// Lecture 11
function b() {
console.log('Called b!');
}
b();
console.log(a);
// Will return undefined as only set in Creation Phase
var a = 'Hello World!';
console.log(a);
// Lecture 12 Conceptual Aside
/*
-Single Threaded: One command at a time
-Caveat, Javascript is not the only thing happening within a browser.
-Synchronous: One line (and order in this case) at a time
-How do asynchronous calls in AJAX work?
*/
// Lecture 14
// -Invocation: Running the function, use () in JS
function b() {
var d;
}
function a() {
b();
var c;
}
a();
var d;
/*
-Parser parses code. Global Execution Context is created. Compiler does this.
-Window object created and code attached. Executes line by line.
-New Execution Context is created and placed in Execution Stack. Whatever is on top, that is currently running.
-Own space for functions and variables.
- a() runs, then function a(), then b() within function a()
-When finished b() pops out
*/
// Lecture 15
/*
-Variable Environment: Where variables live an how they live relative to each other.
*/
function b() {
var myVar;
console.log(myVar);
}
function a() {
var myVar = 2;
console.log(myVar);
b();
}
var myVar = 1;
console.log(myVar);
a();
console.log(myVar);
// Second console.log will still give you 1 as you are in Global Execution Context.
// Lecture 16
/*
-Scope Chain: Link of Outer Environments
-Every Execution Context has a Reference to Outer Environment
-Lexical Environment...
*/
function a() {
function b() {
console.log(myVar);
}
var myVar = 2;
b();
}
var myVar = 1;
a();
b();
// a() is 2, b() is undefined
// b()'s Outer Reference is a() now
// Lexical refers to when it is created
// Lecture 17: Scope, ES6, and let
/*
-Scope: Where a variable is available in your code
-ECMAScript 6
-let can be used instead of var
-Allows JS engine to use blockscoping
-Not allowed to use until line of code is run
-Declared inside a block ()
if (a > b) {
let c = true;
}
*/
// Lecture 18
/*
-What about Asynchronous Callbacks
-Asynchronous: More than one at a time
-Click events etc
-JS Engine:
-Doesn't exist by itself. Other elements, engines running.
-Rendering Engine, HTTP Request
-Has hooks to talk to each other
-Event Queue: List of events that are happening. If JS Engine wants to be notified, gets placed.
-When stack is empty, JS engine looks at Event Queue periodically and then creates Execution Context
-Browser is putting things asynchronously
-Asynchronous is possible in JS but it's about events happening outside JS Engine.
*/
function waitThreeSeconds() {
var ms = 3000 + new Date().getTime();
while (new Date() < ms){}
console.log('Finished Function');
}
function clickHandler() {
console.log('Click Event');
}
document.addEventListener('click', clickHandler);
waitThreeSeconds();
console.log('Finished Execution');
// Section 3
// Lecture 19: Conceptual Aside: Types and JS
/*
-Dynamic Typing: You don't tell the engine what type of data a variable holds, it figures it out while your code is running.
-C# using Static Typing hence you have to tell.
*/
// Lecture 20: Primitive Types
/*
-Primitive or Simple Type: A type of data that represents a single value aka not an object.
-Undefined: Lack of existence, default.
-Null: Lack of existence, but you can set this etc.
-Boolean: True or false.
-Number: Floating point # (there's always some decimals)...you can fake it, makes math weird.
-String: A sequence of characters using '' or "".
-Symbol: Used in ES6
*/
// Lecture 21: Conceptual Aside
/*
-Operators: A special function that is syntactically (written) differently
-Take two parameters and return one result.
-Infix notation: Operators sits in between two parameters.
*/
var a = 3 + 4;
console.log(a);
// Lecture 22: Operator Precedence and Associativity
/*
-Associativity: What order operator functions gets called in: L-R or R-L (when functions have same precedence).
-If they have same precedence, helps to resolve.
-Operator Precedence: Which operator function gets called first; in order of precedence.
-What happens if you have the same associativity?
*/
var a = 3 + 4 * 5;
console.log(a);
var a = 2, b = 3, c = 4;
a = b = c;
console.log(a);
console.log(b);
console.log(c);
// Lecture 23: Coercion
/*
Coercion: Convering a value from one type to another
-Due to it be a dynamic type language
*/
// Lecture 24: Comparison Operators
/*
*/
console.log(1 < 2 < 3) // returns true
console.log(3 < 2 < 1) //returns true (L to R, gives False < 1 aka 0 < 1)
// true becomes a 1
// undefined is notation
// null is 0, however null == 0 (returns false)
"" == 0
"" == false
// Both return true
// Use strict equality aka ===
// Object.is in ES6
// Lecture 27: Existence and Booleans
/*
-All things with a lack of existence will yield False
*/
var a;
a = 0;
if (a || a === 0) {
console.log('Something is there.');
};
// returns true and console logs it...
// Lecture 28: Default Values
/*
-Operators are functions that return values
*/
function greet(name) {
console.console.log(name);
console.log('Hello' + name);
}
greet();
// Lecture 29: Framework Aside
// Lecture 30: Objects and Functions
/*
-Objects: Collections of NV pairs
-How does it reside in memory?
-Primitive (Property), Object (Property), Function (Method)
-Core Address with References
-Dot is just a function that takes the objects and passes the string.
-Below is not preferred way to create new object
*/
var person = new Object();
person["firstname"] = "Tony";
person["lastname"] = "Alicia";
var firstNameProperty = "firstname";
console.log(person);
console.log(person[firstNameProperty]);
console.log(person.firstname);
console.log(person.lastname);
person.address = new Object();
person.address.street = "111 Main St.";
// Lecture 31: Objects and Object Literals
/*
-When JS engine is parsing syntax, assumes you are creating a new object.
-Can setup and initialize...
-JS is very liberal about using white space.
*/
var person = {firstname: 'Tony'};
function greet(person) {
console.log('Hi' + person.firstname);
}
greet(Tony);
greet({
firstname: 'Mary';
});
// Above shows creating object on the fly.
// Object Literal, Dot, Operators do the same thing under the hood.
// Lecture 32: Framework Aside: Faking Namespace
/*
-Namespace: Container for Variables and functions
-Typically to keep variables and functions with the same name separate
-No Namespacing in JS
*/
// Lecture 33: JSON and Object Literals
/*
-Use to be XML
-<object></object>
-Properties have to be in quotes
-JSON has stricter rules. Can use JSON.stringify or JSON.parse to go back and forth.
*/
// Lecture 34: Functions are Objects
/*
-First Class Functions: Everything you can do with other types you can do with functions.
-Assign them to variables, pass them around, or crate them on the fly.
-Has special Properties
-Can be Anonymous
-Code can be set. Will be invocable.
-Code is a property of that function.
*/
// Lecture 35: Functions Statements and Expressions
/*
Function Expression: Unit of code that results in a value; doesn't have to save in a variable
Statement: Does not result in value.
*/
greet();
function greet() {
console.log('Hi');
}
// Above is hoisted while below sets variable as undefined primitive.
// Hence function expressions are not hoisted.
anonymousGreet();
var anonymousGreet =m function() {
console.log('Hi');
}
function log(a) {
a();
}
log(function() {
console.log('Hi');
});
// Example of Functional Programming above
// Lecture 36: Conceptual Aside: By Value vs By Reference
/*
-In both cases talking about Variables.
-Reference points to same memory space whereas Value makes a clone and separate memoryspace.
-Mutate: To change something.
-Equal operator sets up new memory space (new address)
*/
var a = 3;
var b;
b = a;
a = 2;
console.log(a);
console.log(b);
// By Reference
var c = { greeting: 'Hi' };
var d;
d = c;
c.greeting = 'hello';
// Both pointing to same point aka greeting. Just aliases.
console.log(c);
console.log(d);
// Lecture 37: Objects, Functions, and 'This'
/*
-When function invoked, execution context is created (Creation Phase)
-Every time a function is run, JS engine gives us this.
*/
var c = {
name: 'The c object';
log: function() {
this.name = 'Updated c object';
console.log(this);
var setname = function(newname) {
this.name = newname;
}
setname('Updated again! The c object');
console.log(this);
};
};
c.log();
// Setname changes in global namespace but console.log will not reflect.
// If you set var self = this right below log function and then use self instead of this.
// Let keyword is to replace the var keyword to help with this issue.
// Lecture 38: Conceptual Aside: Arrays
// Lecture 39: Arguments
/*
-Next version won't have this.
-Arguments: Contains list of all parameters/values you pass to a function.
-Will become depracted.
-Spread: Add ...name
*/
// Lecture 40: Framework Aside: Function Overloading
// Lecture 41: Conceptual Aside: Syntax Parsers
/*
-Intermediate programs that translates code so that your computer can understand.
*/
// Lecture 42: Dangerous Aside
/*
-Automatic Semicolon Insertion: Injects where character return is.
*/
// Lecture 43: Framework Aside: Whitespace
/*
-Whitespace: Invisible characters that create literal 'space' in your written code.
*/
// Lecture 44: IIFEs
/*
-You can invoke at point of creation.
-Put parentheses around function.
-With new execution context, can call desired variable so as to not interfere with other code.
-Wrap entire code with parentheses
-Global is reusable accross server whereas window is not.
*/
// Function Statement
function greet(name) {
console.log('Hello' + name);
}
greet();
// Function Expression (sort of Object Literal, not in memoryspace)
var greetFunc = function(name) {
console.log('Hello' + name);
};
greetFunc();
// IIFE
var greetFunc = function(name) {
return 'Hello' + name;
}();
// Lecture 46: Understanding Closures
/*
-Closure: Execution context can close in outside variables.
*/
function greet(whattosay) {
return function (name) {
console.log(whattosay) + ' ' + name);
}
}
greet('Hi')('Tony');
var sayHi = greet('Hi');
sayHi('Tony');
// Lecture 47: Understanding Closures Part 2
/*
-
*/
function buildFunctions() {
var arr = [];
for (var i = 0; i < 3, i++) {
arr.push(
function () {
console.log(i);
}
)
}
return arr;
}
var fs = buildFunctions()
fs[0]();
fs[1]();
fs[2]();
// All return 3 because that is what i is.
// Lecture 48: Framework Aside: Function Factories
/*
-Factory: Returns or makes something for you.
-
*/
function makeGreeting(language) {
return function (firstname, lastname) {
if (language === 'en') {
console.log('Hello ' + firstname + ' ' + lastname);
}
if (language === 'es') {
console.log('Hola ' + firstname + ' ' + lastname);
}
}
}
var greetEnglish = makeGreeting('en');
var greetSpanish = makeGreeting('es');
greetEnglish('John', 'Doe');
greetSpanish('John', 'Doe');
// Lecture 49: Closures and Callbacks
/*
-setTimeout uses Expressions and Closures.
*/
// Lecture 50: Calls(), Bind() and Apply()
/*
-Bind functions makes a copy of function.
logName();
logName.call(person, 'en');
logName.apply (person, ['en'])
-Latter determines what this is and actually calls it.
-Apply requires an array.
*/
// Function Borrowing
// Function Carrying
function multiply(a,b) {
return a*b;
}
var multipleByTwo = multiply.bind(this, 2);
// Lecture 51: Functional Programming
/*
-Utilizes first class functions.
-You functions should not mutate data at lower levels.
*/
var checkPastLimitSimplified = function (limiter) {
return function (limiter, item) {
return item > limiter;
}.bind(this, limiter);
};
// Lecture 52: Functional Programming Continued
/*
-Underscore.JS Library
-Shows how it does what is does.
-Underscore.JS
-Implements a lot of Functional Programming
-Alternate called Lodash
-Works a bit faster.
-
*/
// SECTION 5
// SECTION 6
// Lecture 57: Function Constructors, 'new', and the History of JS
/*
-Built by Brandon Eich
-Netscape, Microsoft, Oracle and Sun. Written eventually for browser. Named to attract Java developers.
-A class in Java is not an object but used to define an object.
-Class in JS isn't really a class like in C++.
-Function Constructors: A normal function that is used to construct objects
*/
Function Person() {
this.firstname = 'John';
this.lastname = 'Doe';
}
var john = new Person();
console.log('John');
// Gives you function with firstname and lastname
// New is an operator. Immediately empty object is created. Then invokes function. When function is called, execution context generates variable called this.
// As long as function doesn't return value then JS engine will return that object that was created by the new operator.
// Lecture 58: Function Constructors and '.prototype'
/*
-The prototype property on a function is NOT the prototype of the function.
-It's the prototype of any objects created if you're using function constructors.
-Why add method to the prototype method? Takes up memory space.
*/
Person.prototype.getFullName = function() {
return this.firstname + ' ' + this.lastname;
}
// Lecture 59: Danger Aside: 'new' and Functions
/*
-Function constructors likely going away.
*/
// Lecture 60: Conceptual Aside: Built-In Function Constructors
/*
-Actually created objects that contain primitives
*/
String.prototype.isLengthGreaterThan = function(limit) {
return this.length > limit;
}
console.log("John".isLengthGreaterThan(3));
// Lecture 61: Dangerous Aside: Built-In Function Constructors
/*
-Moment.js (library on dates)
*/
// Lecture 62: Dangerous Aside: Arrays and for..in
// Lecture 63: Object.create and Pure Prototypal Inheritance
/*
-Polyfill: Code that adds a Feature which the engine may lack.
*/
// Polyfill
if (!Object.create) {
Object.create = function (o) {
if (arguments.length > 1) {
throw new Error('Object.create implementation' + ' only accepts the first parameter.');
}
function F() {}
F.prototype = o;
return new F();
};
}
// Lecture 64: ES6 and Classes
/*
-Classes are not objects in other languages, but in JS it is.
-extend sets prototype.
-Syntactic Sugar: A different way to type somethign that doesn't change how it works under the hood.
*/
class Person {
constructor(firstname, lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
greet() {
return 'Hi' + firstname;
}
}
var john = new Person('John', 'Doe');
class InformalPerson extends Person {
constructor(firstname, lastname) {
super(firstname, lastname);
}
greet() {
return 'Yo' + firstname;
}
}
// SECTION 7
// Lecture 65: Initialization
// Lecture 66: 'typeof', 'instanceof', and Figuring What Something Is
/*
-typeof and instanceof
-Do different things.
*/
// Lecture 67: Strict Mode
/*
-Must declare variable to define it
-Top of file or top of function
-Not every engine implements it the same way.
*/
function Person(a) {
'use strict';
console.log(a)
}
// Lecture 68: Strict Mode Reference
// SECTION 8:
// Lecture 69: Learning From Other's Good Code
// Lectures 70-72: Deep Dive into Source Code: jQuery
/*
-Manipulate the DOM.
-Method Chaining: Calling one method after another, and each affects the parent object
-Because methods are on the prototype it points back using return this.
*/
addChild().removeClass();
// SECTION 9
// Lecture 73: Requirements
// Lecture 74: Structuring Safe Code
// Lecture 75: Our Object and Its prototype
// Lecture 76: Properties and Chainable Methods
// Lecture 77: Adding jQuery Support
// Lecture 78: Good Commenting
// Lecture 79: Let's Use Our Framework
// Lecture 80: A Side Note
// SECTION 10
// Lecture 81: TypeScript, ES6, and Transpiled Languages
// Lecture 82: Transpiled Languages References
// SECTION 11
// Lecture 83: Existing and Upcoming Features
// Lecture 84: ES6 Features Reference
| UmarFBajwa/JS | practice.js | JavaScript | mit | 16,114 |
'use strict';
var mongoose = require('mongoose')
, Schema = mongoose.Schema;
// 스키마 구조
var PollReplySchema = new Schema({
_id: { type:Schema.Types.ObjectId, required:true },
itemMulti: [{
_id: { type:Schema.Types.ObjectId, required:true },
reply: [{
_id: { type:Schema.Types.ObjectId, required:true },
user: { type:String, required:true, trim:true }
}]
}],
itemShort: [{
_id: { type:Schema.Types.ObjectId, required:true },
reply: [{
user: { type:String, required:true, trim:true },
content: { type:String, required:true, trim:true }
}]
}],
characters: [{
_id: { type:Schema.Types.ObjectId, required:true },
reply: [{
_id: { type:Schema.Types.ObjectId, required:true },
user: { type:String, required:true, trim:true }
}]
}],
users: [{
_id: { type:String, required:true, trim:true },
ip: { type:String, trim:true },
agent: { type:String, trim:true }
}],
created: { type: Date, default: Date.now }
});
// 후킹
PollReplySchema.pre('save', function(next) {
next();
});
// 자주쓰는 Model
PollReplySchema.static({
load: function(id, callback, isCount) {
if (isCount) {
this.count({ _id: id }, callback);
} else {
this.findOne({ _id: id }, callback);
}
}
});
mongoose.model('PollReply', PollReplySchema); | CatsMiaow/PollK | server/models/pollReply.js | JavaScript | mit | 1,489 |
/**
* @author sole / http://soledadpenades.com
* @author mrdoob / http://mrdoob.com
* @author Robert Eisele / http://www.xarg.org
* @author Philippe / http://philippe.elsass.me
* @author Robert Penner / http://www.robertpenner.com/easing_terms_of_use.html
* @author Paul Lewis / http://www.aerotwist.com/
* @author lechecacharro
* @author Josh Faul / http://jocafa.com/
* @author egraether / http://egraether.com/
*/
if ( Date.now === undefined ) {
Date.now = function () {
return new Date().valueOf();
}
}
var TWEEN = TWEEN || ( function () {
var _tweens = [];
return {
REVISION: '8',
getAll: function () {
return _tweens;
},
removeAll: function () {
_tweens = [];
},
add: function ( tween ) {
_tweens.push( tween );
},
remove: function ( tween ) {
var i = _tweens.indexOf( tween );
if ( i !== -1 ) {
_tweens.splice( i, 1 );
}
},
update: function ( time ) {
if ( _tweens.length === 0 ) return false;
var i = 0, numTweens = _tweens.length;
time = time !== undefined ? time : Date.now();
while ( i < numTweens ) {
if ( _tweens[ i ].update( time ) ) {
i ++;
} else {
_tweens.splice( i, 1 );
numTweens --;
}
}
return true;
}
};
} )();
TWEEN.Tween = function ( object ) {
var _object = object;
var _valuesStart = {};
var _valuesEnd = {};
var _duration = 1000;
var _delayTime = 0;
var _startTime = null;
var _easingFunction = TWEEN.Easing.Linear.None;
var _interpolationFunction = TWEEN.Interpolation.Linear;
var _chainedTweens = [];
var _onStartCallback = null;
var _onStartCallbackFired = false;
var _onUpdateCallback = null;
var _onCompleteCallback = null;
this.to = function ( properties, duration ) {
if ( duration !== undefined ) {
_duration = duration;
}
_valuesEnd = properties;
return this;
};
this.start = function ( time ) {
TWEEN.add( this );
_onStartCallbackFired = false;
_startTime = time !== undefined ? time : Date.now();
_startTime += _delayTime;
for ( var property in _valuesEnd ) {
// This prevents the interpolation of null values or of non-existing properties
if( _object[ property ] === null || !(property in _object) ) {
continue;
}
// check if an Array was provided as property value
if ( _valuesEnd[ property ] instanceof Array ) {
if ( _valuesEnd[ property ].length === 0 ) {
continue;
}
// create a local copy of the Array with the start value at the front
_valuesEnd[ property ] = [ _object[ property ] ].concat( _valuesEnd[ property ] );
}
_valuesStart[ property ] = _object[ property ];
}
return this;
};
this.stop = function () {
TWEEN.remove( this );
return this;
};
this.delay = function ( amount ) {
_delayTime = amount;
return this;
};
this.easing = function ( easing ) {
_easingFunction = easing;
return this;
};
this.interpolation = function ( interpolation ) {
_interpolationFunction = interpolation;
return this;
};
this.chain = function () {
_chainedTweens = arguments;
return this;
};
this.onStart = function ( callback ) {
_onStartCallback = callback;
return this;
};
this.onUpdate = function ( callback ) {
_onUpdateCallback = callback;
return this;
};
this.onComplete = function ( callback ) {
_onCompleteCallback = callback;
return this;
};
this.update = function ( time ) {
if ( time < _startTime ) {
return true;
}
if ( _onStartCallbackFired === false ) {
if ( _onStartCallback !== null ) {
_onStartCallback.call( _object );
}
_onStartCallbackFired = true;
}
var elapsed = ( time - _startTime ) / _duration;
elapsed = elapsed > 1 ? 1 : elapsed;
var value = _easingFunction( elapsed );
for ( var property in _valuesStart ) {
var start = _valuesStart[ property ];
var end = _valuesEnd[ property ];
if ( end instanceof Array ) {
_object[ property ] = _interpolationFunction( end, value );
} else {
_object[ property ] = start + ( end - start ) * value;
}
}
if ( _onUpdateCallback !== null ) {
_onUpdateCallback.call( _object, value );
}
if ( elapsed == 1 ) {
if ( _onCompleteCallback !== null ) {
_onCompleteCallback.call( _object );
}
for ( var i = 0, numChainedTweens = _chainedTweens.length; i < numChainedTweens; i ++ ) {
_chainedTweens[ i ].start( time );
}
return false;
}
return true;
};
};
TWEEN.Easing = {
Linear: {
None: function ( k ) {
return k;
}
},
Quadratic: {
In: function ( k ) {
return k * k;
},
Out: function ( k ) {
return k * ( 2 - k );
},
InOut: function ( k ) {
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;
return - 0.5 * ( --k * ( k - 2 ) - 1 );
}
},
Cubic: {
In: function ( k ) {
return k * k * k;
},
Out: function ( k ) {
return --k * k * k + 1;
},
InOut: function ( k ) {
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k;
return 0.5 * ( ( k -= 2 ) * k * k + 2 );
}
},
Quartic: {
In: function ( k ) {
return k * k * k * k;
},
Out: function ( k ) {
return 1 - ( --k * k * k * k );
},
InOut: function ( k ) {
if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k;
return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 );
}
},
Quintic: {
In: function ( k ) {
return k * k * k * k * k;
},
Out: function ( k ) {
return --k * k * k * k * k + 1;
},
InOut: function ( k ) {
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k;
return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 );
}
},
Sinusoidal: {
In: function ( k ) {
return 1 - Math.cos( k * Math.PI / 2 );
},
Out: function ( k ) {
return Math.sin( k * Math.PI / 2 );
},
InOut: function ( k ) {
return 0.5 * ( 1 - Math.cos( Math.PI * k ) );
}
},
Exponential: {
In: function ( k ) {
return k === 0 ? 0 : Math.pow( 1024, k - 1 );
},
Out: function ( k ) {
return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k );
},
InOut: function ( k ) {
if ( k === 0 ) return 0;
if ( k === 1 ) return 1;
if ( ( k *= 2 ) < 1 ) return 0.5 * Math.pow( 1024, k - 1 );
return 0.5 * ( - Math.pow( 2, - 10 * ( k - 1 ) ) + 2 );
}
},
Circular: {
In: function ( k ) {
return 1 - Math.sqrt( 1 - k * k );
},
Out: function ( k ) {
return Math.sqrt( 1 - ( --k * k ) );
},
InOut: function ( k ) {
if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1);
return 0.5 * ( Math.sqrt( 1 - ( k -= 2) * k) + 1);
}
},
Elastic: {
In: function ( k ) {
var s, a = 0.1, p = 0.4;
if ( k === 0 ) return 0;
if ( k === 1 ) return 1;
if ( !a || a < 1 ) { a = 1; s = p / 4; }
else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );
return - ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );
},
Out: function ( k ) {
var s, a = 0.1, p = 0.4;
if ( k === 0 ) return 0;
if ( k === 1 ) return 1;
if ( !a || a < 1 ) { a = 1; s = p / 4; }
else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );
return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 );
},
InOut: function ( k ) {
var s, a = 0.1, p = 0.4;
if ( k === 0 ) return 0;
if ( k === 1 ) return 1;
if ( !a || a < 1 ) { a = 1; s = p / 4; }
else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );
if ( ( k *= 2 ) < 1 ) return - 0.5 * ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) );
return a * Math.pow( 2, -10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) * 0.5 + 1;
}
},
Back: {
In: function ( k ) {
var s = 1.70158;
return k * k * ( ( s + 1 ) * k - s );
},
Out: function ( k ) {
var s = 1.70158;
return --k * k * ( ( s + 1 ) * k + s ) + 1;
},
InOut: function ( k ) {
var s = 1.70158 * 1.525;
if ( ( k *= 2 ) < 1 ) return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) );
return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 );
}
},
Bounce: {
In: function ( k ) {
return 1 - TWEEN.Easing.Bounce.Out( 1 - k );
},
Out: function ( k ) {
if ( k < ( 1 / 2.75 ) ) {
return 7.5625 * k * k;
} else if ( k < ( 2 / 2.75 ) ) {
return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
} else if ( k < ( 2.5 / 2.75 ) ) {
return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
} else {
return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
}
},
InOut: function ( k ) {
if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5;
return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5;
}
}
};
TWEEN.Interpolation = {
Linear: function ( v, k ) {
var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.Linear;
if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f );
if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f );
return fn( v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i );
},
Bezier: function ( v, k ) {
var b = 0, n = v.length - 1, pw = Math.pow, bn = TWEEN.Interpolation.Utils.Bernstein, i;
for ( i = 0; i <= n; i++ ) {
b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i );
}
return b;
},
CatmullRom: function ( v, k ) {
var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = TWEEN.Interpolation.Utils.CatmullRom;
if ( v[ 0 ] === v[ m ] ) {
if ( k < 0 ) i = Math.floor( f = m * ( 1 + k ) );
return fn( v[ ( i - 1 + m ) % m ], v[ i ], v[ ( i + 1 ) % m ], v[ ( i + 2 ) % m ], f - i );
} else {
if ( k < 0 ) return v[ 0 ] - ( fn( v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f ) - v[ 0 ] );
if ( k > 1 ) return v[ m ] - ( fn( v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m ) - v[ m ] );
return fn( v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i );
}
},
Utils: {
Linear: function ( p0, p1, t ) {
return ( p1 - p0 ) * t + p0;
},
Bernstein: function ( n , i ) {
var fc = TWEEN.Interpolation.Utils.Factorial;
return fc( n ) / fc( i ) / fc( n - i );
},
Factorial: ( function () {
var a = [ 1 ];
return function ( n ) {
var s = 1, i;
if ( a[ n ] ) return a[ n ];
for ( i = n; i > 1; i-- ) s *= i;
return a[ n ] = s;
};
} )(),
CatmullRom: function ( p0, p1, p2, p3, t ) {
var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;
return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
}
}
};
| dvcolgan/ludumdare29 | vendor/tween.js | JavaScript | mit | 11,354 |
var geometry = new (function() {
var pub = this;
pub.distance = function(object1, object2) {
return Math.sqrt(Math.pow(object1.x - object2.x, 2) + Math.pow(object1.y - object2.y, 2));
}
})();
| asolntsev/towers | js/geometry.js | JavaScript | mit | 203 |
/* eslint no-unused-vars:0 */
import {util} from '../../math';
/**
* Particle Emitter base class
*
* @property {number|string} id
* @property {string} name
* @property {Tw2ParticleSystem} particleSystem
* @class
*/
export class Tw2ParticleEmitter
{
constructor()
{
this._id = util.generateID();
this.name = '';
this.particleSystem = null;
}
/**
* Initializes the particle emitter
*/
Initialize()
{
}
/**
* Per frame update
* @param {number} dt - delta time
*/
Update(dt)
{
}
} | ccpgames/ccpwgl | src/particle/emitters/Tw2ParticleEmitter.js | JavaScript | mit | 581 |
var should = require('chai').should();
var pathFn = require('path');
var fs = require('hexo-fs');
var Promise = require('bluebird');
var crypto = require('crypto');
var util = require('hexo-util');
var Pattern = util.Pattern;
var testUtil = require('../../util');
function shasum(content){
var hash = crypto.createHash('sha1');
hash.update(content);
return hash.digest('hex');
}
describe('Box', function(){
var Hexo = require('../../../lib/hexo');
var baseDir = pathFn.join(__dirname, 'box_tmp');
var Box = require('../../../lib/box');
function newBox(path){
var hexo = new Hexo(baseDir, {silent: true});
var base = path ? pathFn.join(baseDir, path) : baseDir;
return new Box(hexo, base);
}
before(function(){
return fs.mkdir(baseDir);
});
after(function(){
return fs.rmdir(baseDir);
});
it('constructor - add trailing "/" to the base path', function(){
var box = newBox('foo');
box.base.should.eql(pathFn.join(baseDir, 'foo') + pathFn.sep);
});
it('addProcessor() - no pattern', function(){
var box = newBox();
box.addProcessor(function(){
return 'test';
});
var p = box.processors[0];
p.pattern.match('').should.eql({});
p.process().should.eql('test');
});
it('addProcessor() - with regex', function(){
var box = newBox();
box.addProcessor(/^foo/, function(){
return 'test';
});
var p = box.processors[0];
p.pattern.match('foobar').should.be.ok;
p.pattern.should.be.an.instanceof(Pattern);
p.process().should.eql('test');
});
it('addProcessor() - with pattern', function(){
var box = newBox();
box.addProcessor(new Pattern(/^foo/), function(){
return 'test';
});
var p = box.processors[0];
p.pattern.match('foobar').should.be.ok;
p.pattern.should.be.an.instanceof(Pattern);
p.process().should.eql('test');
});
it('addProcessor() - no fn', function(){
var box = newBox();
try {
box.addProcessor('test');
} catch (err){
err.should.have.property('message', 'fn must be a function');
}
});
it('_loadFiles() - create', function(){
var box = newBox('test');
var path = pathFn.join(box.base, 'a.txt');
return fs.writeFile(path, 'a').then(function(){
return Promise.all([
box._loadFiles(),
fs.stat(path)
]);
}).spread(function(files, stats){
var cacheId = 'test/a.txt';
files.should.eql([
{path: 'a.txt', type: 'create'}
]);
box.Cache.toArray({lean: true}).should.eql([
{_id: cacheId, shasum: shasum('a'), modified: stats.mtime.getTime()}
]);
return fs.rmdir(box.base);
});
});
it('_loadFiles() - update', function(){
var box = newBox('test');
var path = pathFn.join(box.base, 'a.txt');
var cacheId = 'test/a.txt';
var Cache = box.Cache;
return Promise.all([
fs.writeFile(path, 'a'),
Cache.insert({_id: cacheId, shasum: 'a'})
]).then(function(){
return Promise.all([
box._loadFiles(),
fs.stat(path)
]);
}).spread(function(files, stats){
files.should.eql([
{path: 'a.txt', type: 'update'}
]);
Cache.toArray({lean: true}).should.eql([
{_id: cacheId, shasum: shasum('a'), modified: stats.mtime.getTime()}
]);
return fs.rmdir(box.base);
});
});
it('_loadFiles() - skip', function(){
var box = newBox('test');
var path = pathFn.join(box.base, 'a.txt');
var cacheId = 'test/a.txt';
var hash = shasum('a');
var Cache = box.Cache;
var mtime = Date.now()
return Promise.all([
fs.writeFile(path, 'a'),
Cache.insert({_id: cacheId, shasum: hash, modified: mtime})
]).then(function(){
return box._loadFiles();
}).then(function(files){
files.should.eql([
{type: 'skip', path: 'a.txt'}
]);
Cache.toArray({lean: true}).should.eql([
{_id: cacheId, shasum: hash, modified: mtime}
]);
return fs.rmdir(box.base);
});
});
it('_loadFiles() - delete', function(){
var box = newBox('test');
var cacheId = 'test/a.txt';
var Cache = box.Cache;
return Cache.insert({
_id: cacheId,
shasum: 'a'
}).then(function(){
return box._loadFiles();
}).then(function(files){
files.should.eql([
{type: 'delete', path: 'a.txt'}
]);
should.not.exist(Cache.findById(cacheId));
});
});
it('_dispatch()', function(){
var box = newBox();
var path = 'a.txt';
var data;
box.addProcessor(function(file){
box.processingFiles[path].should.be.true;
data = file;
});
return box._dispatch({
path: path,
type: 'create'
}).then(function(){
box.processingFiles[path].should.be.false;
data.source.should.eql(pathFn.join(box.base, path));
data.path.should.eql(path);
data.type.should.eql('create');
data.params.should.eql({});
});
});
it('_dispatch() - params', function(){
var box = newBox();
var data = new Array(2);
box.addProcessor(/(.*).js/, function(file){
data[0] = file;
});
box.addProcessor(function(file){
data[1] = file;
});
return box._dispatch({
path: 'server.js',
type: 'create'
}).then(function(){
data[0].params[1].should.eql('server');
data[1].params.should.eql({});
});
});
it('process()', function(){
var box = newBox('test');
var data = {};
box.addProcessor(function(file){
data[file.path] = file;
});
return Promise.all([
fs.writeFile(pathFn.join(box.base, 'a.txt'), 'a'),
fs.writeFile(pathFn.join(box.base, 'b', 'c.js'), 'c')
]).then(function(){
return box.process();
}).then(function(){
var keys = Object.keys(data);
var key, item;
for (var i = 0, len = keys.length; i < len; i++){
key = keys[i];
item = data[key];
item.path.should.eql(key);
item.source.should.eql(pathFn.join(box.base, key));
item.type.should.eql('create');
item.params.should.eql({});
}
return fs.rmdir(box.base);
});
});
it('process() - do nothing if target does not exist', function(){
var box = newBox('test');
return box.process();
});
it('watch() - create', function(callback){
var box = newBox('test');
var path = 'a.txt';
var src = pathFn.join(box.base, path);
box.watch().then(function(){
box.isWatching().should.be.true;
box.addProcessor(function(file){
file.source.should.eql(src);
file.path.should.eql(path);
file.type.should.eql('create');
file.params.should.eql({});
file.content.toString().should.eql('a');
box.unwatch();
fs.rmdir(box.base, callback);
});
fs.writeFile(src, 'a');
});
});
it('watch() - update', function(callback){
var box = newBox('test');
var path = 'a.txt';
var src = pathFn.join(box.base, path);
var cacheId = 'test/' + path;
var Cache = box.Cache;
Promise.all([
fs.writeFile(src, 'a'),
Cache.insert({_id: cacheId, shasum: 'a'})
]).then(function(){
return box.watch();
}).then(function(){
return testUtil.wait(300);
}).then(function(){
box.addProcessor(function(file){
file.source.should.eql(src);
file.path.should.eql(path);
file.type.should.eql('update');
file.params.should.eql({});
file.content.should.eql(new Buffer('ab'));
box.unwatch();
fs.rmdir(box.base, callback);
});
fs.appendFile(src, 'b');
});
});
it('watch() - delete', function(callback){
var box = newBox('test');
var path = 'a.txt';
var src = pathFn.join(box.base, path);
var cacheId = 'test/' + path;
var Cache = box.Cache;
Promise.all([
fs.writeFile(src, 'a'),
Cache.insert({_id: cacheId, shasum: 'a'})
]).then(function(){
return box.watch();
}).then(function(){
return testUtil.wait(300);
}).then(function(){
box.addProcessor(function(file){
file.source.should.eql(src);
file.path.should.eql(path);
file.type.should.eql('delete');
file.params.should.eql({});
should.not.exist(file.content);
box.unwatch();
fs.rmdir(box.base, callback);
});
fs.unlink(src);
});
});
it.skip('watch() - watcher has started', function(callback){
var box = newBox();
box.watch().then(function(){
box.watch().catch(function(err){
err.should.have.property('message', 'Watcher has already started.');
box.unwatch();
callback();
});
});
});
it('watch() - run process() before start watching', function(){
var box = newBox('test');
var data = [];
box.addProcessor(function(file){
data.push(file.path);
});
return Promise.all([
fs.writeFile(pathFn.join(box.base, 'a.txt'), 'a'),
fs.writeFile(pathFn.join(box.base, 'b', 'c.js'), 'c')
]).then(function(){
return box.watch();
}).then(function(){
data.should.have.members(['a.txt', 'b/c.js']);
box.unwatch();
return fs.rmdir(box.base);
});
});
it.skip('unwatch()', function(callback){
var box = newBox('test');
box.watch().then(function(){
var emitted = false;
box.addProcessor(function(file){
emitted = true;
});
box.unwatch();
fs.writeFile(pathFn.join(box.base, 'a.txt'), 'a').then(function(){
emitted.should.be.false;
fs.rmdir(box.base, callback);
});
});
});
it('unwatch() - watcher not started', function(){
var box = newBox();
try {
box.unwatch();
} catch (err){
err.should.have.property('message', 'Watcher hasn\'t started yet.');
}
});
it.skip('isWatching()', function(){
var box = newBox();
return box.watch().then(function(){
box.isWatching().should.be.true;
return box.unwatch();
}).then(function(){
box.isWatching().should.be.false;
});
});
it('processBefore & processAfter events');
}); | zhi1ong/hexo | test/scripts/box/box.js | JavaScript | mit | 10,219 |
jQuery(function($) {
$('ul li.active').qtip({
content: 'This is an active list element',
show: 'mouseover',
hide: 'mouseout',
position: { target: 'mouse' }
})
}); | linki/australia | public/javascripts/qtip.js | JavaScript | mit | 191 |
/**
The MIT License (MIT)
Copyright (c) 2014 MyChannel-Apps.de
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@author Christoph Kühl <djchrisnet>, Adrian Preuß <Bizarrus>
*/
if(!Array.prototype.each) {
Object.defineProperty(Array.prototype, 'each', {
enumerable: false,
configurable: false,
writable: false,
value: function(callback) {
for(var index = 0; index < this.length; index++) {
if(callback.apply(this[index], index) === false) {
break;
}
}
}
});
}
if(!Array.prototype.random) {
Object.defineProperty(Array.prototype, 'random', {
enumerable: false,
configurable: false,
writable: false,
value: function() {
return this[RandomOperations.nextInt(this.length)];
}
});
}
if(!Array.prototype.exists) {
Object.defineProperty(Array.prototype, 'exists', {
enumerable: false,
configurable: false,
writable: false,
value: function(value) {
return (this.indexOf(value) > -1);
}
});
}
if(!Array.prototype.size) {
Object.defineProperty(Array.prototype, 'size', {
enumerable: false,
configurable: false,
writable: false,
value: function() {
return this.length;
}
});
} | MyChannel-Apps/Examples | SpamMessages/framework/tools/Array.js | JavaScript | mit | 2,159 |
module.exports = function(app){
var validacao = require('../validacoes/usuarios');
var Usuario = app.models.usuarios;
var UsuarioController = {
index: function(req,res){
Usuario.find(function(err,dados){
if(err){
req.flash('erro', 'Erro ao buscar usuários: '+err);
res.redirect('/usuarios');
}else{
res.render('usuarios/index', {lista: dados});
}
});
},
create: function(req,res){
res.render('usuarios/create', {user: new Usuario()});
},
post: function(req,res){
if(validacao(req,res)){
var model = new Usuario();
model.nome = req.body.nome;
model.email = req.body.email;
model.telefone = req.body.telefone;
model.password = model.generateHash(req.body.password);
Usuario.findOne({'email': model.email}, function(err,data){
if(data){
req.flash('erro', 'E-mail encontra-se cadastrado, tente outro.');
res.render('usuarios/create', {user: model});
}else{
model.save(function(err){
if(err){
req.flash('erro', 'Erro ao cadastrar: '+err);
res.render('usuarios/create', {user: req.body});
}else{
req.flash('info', 'Registro cadastrado com sucesso!');
res.redirect('/usuarios');
}
});
}
});
}else{
res.render('usuarios/create', {user: req.body});
}
},
show: function(req,res){
Usuario.findById(req.params.id, function(err,dados){
if(err){
req.flash('erro', 'Erro ao visualizar usuário: '+err);
res.redirect('/usuarios');
}else{
res.render('usuarios/show', {dados: dados});
}
});
},
delete: function(req,res){
Usuario.remove({_id: req.params.id}, function(err){
if(err){
req.flash('erro', 'Erro ao excluir usuário: '+err);
res.redirect('/usuarios');
}else{
req.flash('info', 'Registro excluído com sucesso!');
res.redirect('/usuarios');
}
});
},
edit: function(req,res){
Usuario.findById(req.params.id, function(err,data){
if(err){
req.flash('erro', 'Erro ao editar: '+err);
res.redirect('/usuarios');
}else{
res.render('usuarios/edit', {dados: data});
}
});
},
update: function(req,res){
if(validacao(req,res)){
Usuario.findById(req.params.id, function(err,data){
var model = data;
model.nome = req.body.nome;
model.telefone = req.body.telefone;
model.save(function(err){
if(err){
req.flash('erro', 'Erro ao editar: '+err);
res.render('usuarios/edit', {dados: model});
}else{
req.flash('info', 'Registro atualizado com sucesso!');
res.redirect('/usuarios');
}
});
});
}else{
res.render('usuarios/edit', {user: req.body});
}
}
}
return UsuarioController;
} | felipemarques8/csdesafio-node | controllers/usuarios.js | JavaScript | mit | 2,794 |
console.log("J U I loaded");
var timer;
var timer2;
var timer3;
var counter;
var cell;
var curCount = 0;
var gameLost = false;
var multiUp = 0;
var total = 10;
var score = 0;
var points = 100;
var board = [ 0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0];
var cellTypes = [
{name: "empty", color: "white"},
{name: "normal", color: "black"},
{name: "freeze", color: "blue"},
{name: "multi", color: "green"},
{name: "max", color: "yellow"},
{name: "super", color: "red"}
];
var WHITE = 0,
BLACK = 1,
BLUE = 2,
GREEN = 3,
YELLOW = 4,
RED = 5;
var randomType = function() {
var randomNum = Math.floor((Math.random() * 100) + 1);
if (randomNum < 88) return BLACK; // 88%
else if (randomNum < 91) return BLUE; // 3%
else if (randomNum < 94) return GREEN; // 3%
else if (randomNum < 97) return YELLOW; // 3%
else return RED; // 3%
};
// EFFECTS -------------------------------------------------------------
var freezeEffect = function() {
clearInterval(timer2);
setTimeout(function() {
timer2 = setInterval(tickCell, counter);
}, 2000);
};
var multiEffect = function() {
multiUp++;
points = Math.floor((1 + (multiUp * 0.1)) * points);
};
var maxEffect = function() {
total++;
};
var superEffect = function() {
for (var i = 0; i < board.length; i++) {
if (board[i] < 2) board[i] = 0;
};
};
// LOSING & PRINTSTATE ------------------------------------------------
var hasLost = function() {
var count = 0;
for (var i = 0; i < board.length; i++) {
if (board[i] > 0 && board[i] < 2) count++;
if (count > total) break;
};
curCount = count;
return count > total;
};
var printState = function() {
$("#max2").text(curCount);
$("#max4").text(total);
$("#score2").text(score);
};
// PICKCELL & FADE ----------------------------------------------------
var pickCell = function() {
var randomIndex;
do {
randomIndex = Math.floor(Math.random() * board.length);
}
while (board[randomIndex] !== 0);
board[randomIndex] = randomType();
var $fade = $("#cell" + randomIndex);
if (board[randomIndex] > BLACK) {
setTimeout(function() {
$fade.animate({backgroundColor: "white"}, 700);
setTimeout(function() {
board[randomIndex] = 0;
}, 690);
}, 1000);
};
};
// CLICK MOVE ---------------------------------------------------------
var click = function(evt) {
clickValue = parseInt(this.id.substr(4));
if (board[clickValue] > BLACK) {
$(this).stop()
.toggle("explode", {pieces:16})
.css({backgroundColor: "white"})
.fadeIn();
};
if (board[clickValue] === BLACK) score += points;
else if (board[clickValue] === BLUE) freezeEffect();
else if (board[clickValue] === GREEN) multiEffect();
else if (board[clickValue] === YELLOW) maxEffect();
else if (board[clickValue] === RED) superEffect();
board[clickValue] = 0;
render();
};
// RENDER -------------------------------------------------------------
var render = function() {
if (gameLost === false) renderBoard();
function renderBoard() {
board.forEach(function(cell, idx) {
var el = $('#cell' + idx);
el.css('background-color', cellTypes[cell].color);
});
};
};
// TICKS --------------------------------------------------------------
var tick = function() {
printState();
if (hasLost()) {
clearInterval(timer);
clearInterval(timer2);
gameLost = true;
var lose = function() {
$(".lose").css({opacity:1});
setTimeout(function() {
$(".lose").css({opacity:0});
}, 400);
};
timer3 = setInterval(lose, 800);
};
printState();
};
var tickCell = function() {
pickCell();
render();
clearInterval(timer2);
counter *= 0.99;
timer2 = setInterval(tickCell, counter);
};
// STARTGAME ----------------------------------------------------------
var startGame = function() {
for (var i = 0; i < board.length; i++) {
board[i] = 0;
};
curCount = 0;
gameLost = false;
multiUp = 0;
total = 10;
score = 0;
points = 100;
counter = 800;
printState();
render();
clearInterval(timer3);
clearInterval(timer2);
clearInterval(timer);
timer = setInterval(tick, 10);
timer2 = setInterval(tickCell, counter);
};
// BUTTONS ------------------------------------------------------------
$("#startgame").on('click', function() {
$(".one").css("display", "none");
$(".two").css("display","inline");
$(".three").css("display","none");
startGame();
});
$("#restart").on('click', function() {
startGame();
});
$("#mainmenu").on('click', function() {
$(".one").css("display", "inline");
$(".two").css("display","none");
$(".three").css("display","none");
});
$("#howtoplay").on('click', function() {
$(".one").css("display", "none");
$(".two").css("display","none");
$(".three").css("display","inline");
});
$("#mainmenu2").on('click', function() {
$(".one").css("display", "inline");
$(".two").css("display","none");
$(".three").css("display","none");
});
$("#startgame2").on('click', function() {
$(".one").css("display", "none");
$(".two").css("display","inline");
$(".three").css("display","none");
startGame();
});
var audio = document.getElementById("tomb");
var mute = document.getElementById('mute');
mute.onclick = function() {
audio.muted = !audio.muted;
};
audio.addEventListener('ended', function() {
this.currentTime = 0;
this.play();
}, false);
// EVENTLISTENERS -----------------------------------------------------
document.addEventListener("DOMContentLoaded", function(evt) {
var cellEls = document.querySelectorAll("td");
for (var i = 0; i < board.length; i++) {
cellEls[i].addEventListener("click", click);
};
});
| JYC422/JUI | js/main.js | JavaScript | mit | 6,021 |
module.exports = {
label: {
display: 'block',
width: '90%',
marginBottom: 15
},
labelText: {
color: '#777',
fontSize: '15px',
display: 'block'
},
input: {
display: 'block',
fontSize: '20px',
padding: 10,
width: '100%',
border: '1px solid #ddd'
},
textarea: {
display: 'block',
fontSize: '20px',
border: '1px solid #ddd',
width: 'auto',
height: 100,
padding: 10,
width: '100%'
}
};
| sebringj/glut-admin | src/app/styles/form.js | JavaScript | mit | 425 |
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
"download-atom-shell": {
version: "0.23.0",
outputDir: "./atom-shell",
rebuild: true
}
});
grunt.loadNpmTasks('grunt-download-atom-shell');
};
| leungwensen/lab | atom-shell/build/Gruntfile.js | JavaScript | mit | 306 |
// Dependencies
var UFirst = require("ucfirst");
/**
* CrossStyle
* Returns an array of cross-browser CSS properties for given input.
*
* @name CrossStyle
* @function
* @param {String} input The CSS property (e.g. `"transform"` or `"transformOrigin"`).
* @return {Array} An array of strings representing the cross-browser CSS properties for the given input.
*/
function CrossStyle(input) {
var uInput = UFirst(input);
return [
"webkit" + uInput
, "moz" + uInput
, "ms" + uInput
, "o" + uInput
, input
]
}
module.exports = CrossStyle;
| IonicaBizau/cross-style.js | lib/index.js | JavaScript | mit | 588 |
export default {
forward: "转发",
reply: "回复",
ignore: "忽略",
toVoicemail: "到语音信箱",
answer: "接听",
answerAndEnd: "接听并结束",
answerAndHold: "接听并保持"
};
// @key: @#@"forward"@#@ @source: @#@"Forward"@#@
// @key: @#@"reply"@#@ @source: @#@"Reply"@#@
// @key: @#@"ignore"@#@ @source: @#@"Ignore"@#@
// @key: @#@"toVoicemail"@#@ @source: @#@"To Voicemail"@#@
// @key: @#@"answer"@#@ @source: @#@"Answer"@#@
// @key: @#@"answerAndEnd"@#@ @source: @#@"Answer & End"@#@
// @key: @#@"answerAndHold"@#@ @source: @#@"Answer & Hold"@#@
| ringcentral/ringcentral-js-widget | packages/ringcentral-widgets/components/IncomingCallPad/i18n/zh-CN.js | JavaScript | mit | 578 |
/*
用 action 来描述“发生了什么”,和使用 reducers 来根据 action 更新 state 的用法。
Store 就是把它们联系到一起的对象。Store 有以下职责:
维持应用的 state;
提供 getState() 方法获取 state;
提供 dispatch(action) 方法更新 state;
通过 subscribe(listener) 注册监听器;
通过 subscribe(listener) 返回的函数注销监听器。
再次强调一下 Redux 应用只有一个单一的 store。当需要拆分数据处理逻辑时,你应该使用 reducer 组合 而不是创建多个 store
*/
import { AsyncStorage } from 'react-native';
import { Iterable } from 'immutable';
import { applyMiddleware, createStore, compose } from 'redux';
import { autoRehydrate, persistStore, purgeStoredState } from 'redux-persist';
import reduxThunk from 'redux-thunk';
import createLogger from 'redux-logger';
import rootReducer from '../reducers/rootReducer';
let reduxMiddleware = [reduxThunk];
let reduxLogger = createLogger(
/* {
level = 'log': 'log' | 'console' | 'warn' | 'error' | 'info', // console's level
duration = false: Boolean, // Print the duration of each action?
timestamp = true: Boolean, // Print the timestamp with each action?
colors: ColorsObject, // Object with color getters. See the ColorsObject interface.
logger = console: LoggerObject, // Implementation of the `console` API.
logErrors = true: Boolean, // Should the logger catch, log, and re-throw errors?
collapsed, // Takes a boolean or optionally a function that receives `getState` function for accessing current store state and `action` object as parameters. Returns `true` if the log group should be collapsed, `false` otherwise.
predicate, // If specified this function will be called before each action is processed with this middleware.
stateTransformer, // Transform state before print. Eg. convert Immutable object to plain JSON.
actionTransformer, // Transform state before print. Eg. convert Immutable object to plain JSON.
errorTransformer, // Transform state before print. Eg. convert Immutable object to plain JSON.
titleFormatter, // Format the title used when logging actions.
diff = false: Boolean, // Show diff between states.
diffPredicate // Filter function for showing states diff.'
}*/
{
level: 'log',
duration: true,
timestamp: true,
colors: {
title: () => 'inherit',
prevState: () => '#9E9E9E',
action: () => '#03A9F4',
nextState: () => '#4CAF50',
error: () => '#F20404',
},
logger: console,
logErrors: true,
collapsed : (getState, action) => (
action.type === 'REACT_NATIVE_ROUTER_FLUX_FOCUS' ||
action.type === 'REACT_NATIVE_ROUTER_FLUX_RESET'
),
stateTransformer: (state) => {
if (Iterable.isIterable(state)) {
return state.toJS();
}
return state;
},
actionTransformer: (action) => {
// if() { some judgement code}
return action;
},
errorTransformer: (error) => {
// if() {some judgement code}
return error;
},
diff: true,
diffPredicate: (getState, action) => (
action.type === 'ADD_TODO' ||
action.type === 'SET_VISIBILITY_FILTER' ||
action.type === 'SHOW_ACTIVE'
)
}
);
if (__DEV__) {
// 开发环境打印 action 日志
reduxMiddleware.push(reduxLogger);
}
export let store = null;
let enhancers = compose(...[
applyMiddleware(...reduxMiddleware),
autoRehydrate()
]);
function hotReloading() {
// https://github.com/gaearon/redux-devtools/issues/233#issuecomment-176210686
// Enable Webpack hot module replacement for reducers
if (module.hot) {
let reducerPath = '../reducers/rootReducer';
module.hot.accept(reducerPath, () => {
let nextRootReducer = require(reducerPath).default;
store.replaceReducer(nextRootReducer);
});
}
}
export default function configureStore(initialState = {}) {
store = createStore(rootReducer, initialState, enhancers);
hotReloading();
setPersistStore();
return store;
}
function setPersistStore() {
// more information: http://gold.xitu.io/entry/57cac7b167f3560057bb00a7
persistStore(store, {
blacklist: ['signIn', 'someKey'], // 黑名单数组,可以忽略指定 reducers 中的 key
// whitelist: ['auth'], // 白名单数组,一旦设置,其他的 key 都会被忽略。
storage: AsyncStorage,
// transforms: // 在 rehydration 和 storage 阶段被调用的转换器
debounce: 100 // storage 操作被调用的频度, ms
// store: // redux store 我们要存储的 store
// config: // 对象
}, () => {
});
}
export function resetPersistStore() {
purgeStoredState({storage: AsyncStorage});
} | Kennytian/learning-redux | src/stores/configureStore.js | JavaScript | mit | 4,738 |
'use strict';
angular.module('citizenForumsShowApp', [
'citizenForumsShowApp.services',
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute',
'uiGmapgoogle-maps',
'xeditable',
'restangular',
'nl2br'
]).config(['$interpolateProvider', function($interpolateProvider) {
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
}]).config(function(uiGmapGoogleMapApiProvider) {
uiGmapGoogleMapApiProvider.configure({
// key: '', // TODO set Google Maps API key
v: '3.17',
language: 'es',
sensor: false,
libraries: 'drawing,geometry,visualization'
});
})
.run(function(editableOptions) {
editableOptions.theme = 'bs3'; // X-editable form theme
})
.constant('CFG', {
DELAY: 600,
RANGE_STEPS: 20,
GMAPS_ZOOM: 14,
GPS_CENTER_POS: { lat: 41.4926867, lng: 2.3613954}, // Premià de Mar (Barcelona) center
PROCESS_PARTICIPATION_STATE: { DRAFT: 1, PRESENTATION: 2, DEBATE: 3, CLOSED: 4 }
})
;
| teclliure/demofony2 | app/Resources/public/frontend/js/citizen-forums/show/app.js | JavaScript | mit | 1,145 |
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=8a41afce6c65a5315ae2)
* Config saved to config.json and https://gist.github.com/8a41afce6c65a5315ae2
*/
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+function ($) {
'use strict';
var version = $.fn.jquery.split(' ')[0].split('.')
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
}
}(jQuery);
/* ========================================================================
* Bootstrap: alert.js v3.3.5
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.3.5'
Alert.TRANSITION_DURATION = 150
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.closest('.alert')
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
// detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
removeElement()
}
// ALERT PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.alert
$.fn.alert = Plugin
$.fn.alert.Constructor = Alert
// ALERT NO CONFLICT
// =================
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT DATA-API
// ==============
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);
/* ========================================================================
* Bootstrap: button.js v3.3.5
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// BUTTON PUBLIC CLASS DEFINITION
// ==============================
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}
Button.VERSION = '3.3.5'
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
var d = 'disabled'
var $el = this.$element
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
$el[val](data[state] == null ? this.options[state] : data[state])
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d)
}
}, this), 0)
}
Button.prototype.toggle = function () {
var changed = true
var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked')) changed = false
$parent.find('.active').removeClass('active')
this.$element.addClass('active')
} else if ($input.prop('type') == 'checkbox') {
if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
this.$element.toggleClass('active')
}
$input.prop('checked', this.$element.hasClass('active'))
if (changed) $input.trigger('change')
} else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
this.$element.toggleClass('active')
}
}
// BUTTON PLUGIN DEFINITION
// ========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
var old = $.fn.button
$.fn.button = Plugin
$.fn.button.Constructor = Button
// BUTTON NO CONFLICT
// ==================
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
// BUTTON DATA-API
// ===============
$(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
})
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
})
}(jQuery);
/* ========================================================================
* Bootstrap: carousel.js v3.3.5
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CAROUSEL CLASS DEFINITION
// =========================
var Carousel = function (element, options) {
this.$element = $(element)
this.$indicators = this.$element.find('.carousel-indicators')
this.options = options
this.paused = null
this.sliding = null
this.interval = null
this.$active = null
this.$items = null
this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION = '3.3.5'
Carousel.TRANSITION_DURATION = 600
Carousel.DEFAULTS = {
interval: 5000,
pause: 'hover',
wrap: true,
keyboard: true
}
Carousel.prototype.keydown = function (e) {
if (/input|textarea/i.test(e.target.tagName)) return
switch (e.which) {
case 37: this.prev(); break
case 39: this.next(); break
default: return
}
e.preventDefault()
}
Carousel.prototype.cycle = function (e) {
e || (this.paused = false)
this.interval && clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getItemIndex = function (item) {
this.$items = item.parent().children('.item')
return this.$items.index(item || this.$active)
}
Carousel.prototype.getItemForDirection = function (direction, active) {
var activeIndex = this.getItemIndex(active)
var willWrap = (direction == 'prev' && activeIndex === 0)
|| (direction == 'next' && activeIndex == (this.$items.length - 1))
if (willWrap && !this.options.wrap) return active
var delta = direction == 'prev' ? -1 : 1
var itemIndex = (activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to = function (pos) {
var that = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
}
Carousel.prototype.pause = function (e) {
e || (this.paused = true)
if (this.$element.find('.next, .prev').length && $.support.transition) {
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval = clearInterval(this.interval)
return this
}
Carousel.prototype.next = function () {
if (this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev = function () {
if (this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || this.getItemForDirection(type, $active)
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
var that = this
if ($next.hasClass('active')) return (this.sliding = false)
var relatedTarget = $next[0]
var slideEvent = $.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if (slideEvent.isDefaultPrevented()) return
this.sliding = true
isCycling && this.pause()
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator && $nextIndicator.addClass('active')
}
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
if ($.support.transition && this.$element.hasClass('slide')) {
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () {
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd(Carousel.TRANSITION_DURATION)
} else {
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger(slidEvent)
}
isCycling && this.cycle()
return this
}
// CAROUSEL PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.carousel')
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
})
}
var old = $.fn.carousel
$.fn.carousel = Plugin
$.fn.carousel.Constructor = Carousel
// CAROUSEL NO CONFLICT
// ====================
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
// CAROUSEL DATA-API
// =================
var clickHandler = function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
Plugin.call($target, options)
if (slideIndex) {
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
}
$(document)
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
$(window).on('load', function () {
$('[data-ride="carousel"]').each(function () {
var $carousel = $(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: dropdown.js v3.3.5
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// DROPDOWN CLASS DEFINITION
// =========================
var backdrop = '.dropdown-backdrop'
var toggle = '[data-toggle="dropdown"]'
var Dropdown = function (element) {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.3.5'
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
return $parent && $parent.length ? $parent : $this.parent()
}
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $this = $(this)
var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate
$(document.createElement('div'))
.addClass('dropdown-backdrop')
.insertAfter($(this))
.on('click', clearMenus)
}
var relatedTarget = { relatedTarget: this }
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this
.trigger('focus')
.attr('aria-expanded', 'true')
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget)
}
return false
}
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
if (!isActive && e.which != 27 || isActive && e.which == 27) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc = ' li:not(.disabled):visible a'
var $items = $parent.find('.dropdown-menu' + desc)
if (!$items.length) return
var index = $items.index(e.target)
if (e.which == 38 && index > 0) index-- // up
if (e.which == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items.eq(index).trigger('focus')
}
// DROPDOWN PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.dropdown
$.fn.dropdown = Plugin
$.fn.dropdown.Constructor = Dropdown
// DROPDOWN NO CONFLICT
// ====================
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
// APPLY TO STANDARD DROPDOWN ELEMENTS
// ===================================
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
}(jQuery);
/* ========================================================================
* Bootstrap: modal.js v3.3.5
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options
this.$body = $(document.body)
this.$element = $(element)
this.$dialog = this.$element.find('.modal-dialog')
this.$backdrop = null
this.isShown = null
this.originalBodyPad = null
this.scrollbarWidth = 0
this.ignoreBackdropClick = false
if (this.options.remote) {
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function () {
this.$element.trigger('loaded.bs.modal')
}, this))
}
}
Modal.VERSION = '3.3.5'
Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150
Modal.DEFAULTS = {
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle = function (_relatedTarget) {
return this.isShown ? this.hide() : this.show(_relatedTarget)
}
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.checkScrollbar()
this.setScrollbar()
this.$body.addClass('modal-open')
this.escape()
this.resize()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$dialog.on('mousedown.dismiss.bs.modal', function () {
that.$element.one('mouseup.dismiss.bs.modal', function (e) {
if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
})
})
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(that.$body) // don't move modals dom position
}
that.$element
.show()
.scrollTop(0)
that.adjustDialog()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element.addClass('in')
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$dialog // wait for modal to slide in
.one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide = function (e) {
if (e) e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
this.resize()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal')
this.$dialog.off('mousedown.dismiss.bs.modal')
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(Modal.TRANSITION_DURATION) :
this.hideModal()
}
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keydown.dismiss.bs.modal')
}
}
Modal.prototype.resize = function () {
if (this.isShown) {
$(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
} else {
$(window).off('resize.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.$body.removeClass('modal-open')
that.resetAdjustments()
that.resetScrollbar()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $(document.createElement('div'))
.addClass('modal-backdrop ' + animate)
.appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (this.ignoreBackdropClick) {
this.ignoreBackdropClick = false
return
}
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus()
: this.hide()
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
var callbackRemove = function () {
that.removeBackdrop()
callback && callback()
}
$.support.transition && this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
callbackRemove()
} else if (callback) {
callback()
}
}
// these following methods are used to handle overflowing modals
Modal.prototype.handleUpdate = function () {
this.adjustDialog()
}
Modal.prototype.adjustDialog = function () {
var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
})
}
Modal.prototype.resetAdjustments = function () {
this.$element.css({
paddingLeft: '',
paddingRight: ''
})
}
Modal.prototype.checkScrollbar = function () {
var fullWindowWidth = window.innerWidth
if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
var documentElementRect = document.documentElement.getBoundingClientRect()
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
this.scrollbarWidth = this.measureScrollbar()
}
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
this.originalBodyPad = document.body.style.paddingRight || ''
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', this.originalBodyPad)
}
Modal.prototype.measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div')
scrollDiv.className = 'modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
// MODAL PLUGIN DEFINITION
// =======================
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
})
}
var old = $.fn.modal
$.fn.modal = Plugin
$.fn.modal.Constructor = Modal
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
// MODAL DATA-API
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);
/* ========================================================================
* Bootstrap: tooltip.js v3.3.5
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type = null
this.options = null
this.enabled = null
this.timeout = null
this.hoverState = null
this.$element = null
this.inState = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.3.5'
Tooltip.TRANSITION_DURATION = 150
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
}
if (self.tip().hasClass('in') || self.hoverState == 'in') {
self.hoverState = 'in'
return
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.isInStateTrue = function () {
for (var key in this.inState) {
if (this.inState[key]) return true
}
return false
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
}
if (self.isInStateTrue()) return
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
this.$element.trigger('inserted.bs.' + this.type)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var viewportDim = this.getPosition(this.$viewport)
placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
var prevHoverState = that.hoverState
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
if (prevHoverState == 'out') that.leave(that)
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top += marginTop
offset.left += marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var isVertical = /top|bottom/.test(placement)
var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
this.arrow()
.css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isVertical ? 'top' : 'left', '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function (callback) {
var that = this
var $tip = $(this.$tip)
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element
.removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
callback && callback()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && $tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element
var el = $element[0]
var isBody = el.tagName == 'BODY'
var elRect = el.getBoundingClientRect()
if (elRect.width == null) {
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
}
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
return $.extend({}, elRect, scroll, outerDims, elOffset)
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
if (!this.$tip) {
this.$tip = $(this.options.template)
if (this.$tip.length != 1) {
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
}
}
return this.$tip
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
if (e) {
self.inState.click = !self.inState.click
if (self.isInStateTrue()) self.enter(self)
else self.leave(self)
} else {
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
}
Tooltip.prototype.destroy = function () {
var that = this
clearTimeout(this.timeout)
this.hide(function () {
that.$element.off('.' + that.type).removeData('bs.' + that.type)
if (that.$tip) {
that.$tip.detach()
}
that.$tip = null
that.$arrow = null
that.$viewport = null
})
}
// TOOLTIP PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip = Plugin
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: popover.js v3.3.5
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.5'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
}
// POPOVER PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data && /destroy|hide/.test(option)) return
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.popover
$.fn.popover = Plugin
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: tab.js v3.3.5
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
}
Tab.VERSION = '3.3.5'
Tab.TRANSITION_DURATION = 150
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var $previous = $ul.find('.active:last a')
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()
}
$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab
$.fn.tab = Plugin
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
var clickHandler = function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
/* ========================================================================
* Bootstrap: affix.js v3.3.5
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed = null
this.unpin = null
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.3.5'
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
var targetHeight = this.$target.height()
if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
if (this.affixed == 'bottom') {
if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
}
var initializing = this.affixed == null
var colliderTop = initializing ? scrollTop : position.top
var colliderHeight = initializing ? targetHeight : height
if (offsetTop != null && scrollTop <= offsetTop) return 'top'
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
return false
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var height = this.$element.height()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
var scrollHeight = Math.max($(document).height(), $(document.body).height())
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
if (this.affixed != affix) {
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
}
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - height - offsetBottom
})
}
}
// AFFIX PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix = Plugin
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
if (data.offsetTop != null) data.offset.top = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: collapse.js v3.3.5
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning = null
if (this.options.parent) {
this.$parent = this.getParent()
} else {
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
}
if (this.options.toggle) this.toggle()
}
Collapse.VERSION = '3.3.5'
Collapse.TRANSITION_DURATION = 350
Collapse.DEFAULTS = {
toggle: true
}
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var activesData
var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
if (actives && actives.length) {
activesData = actives.data('bs.collapse')
if (activesData && activesData.transitioning) return
}
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
if (actives && actives.length) {
Plugin.call(actives, 'hide')
activesData || actives.data('bs.collapse', null)
}
var dimension = this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)
this.$trigger
.removeClass('collapsed')
.attr('aria-expanded', true)
this.transitioning = 1
var complete = function () {
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning = 0
this.$element
.trigger('shown.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var dimension = this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)
this.$trigger
.addClass('collapsed')
.attr('aria-expanded', false)
this.transitioning = 1
var complete = function () {
this.transitioning = 0
this.$element
.removeClass('collapsing')
.addClass('collapse')
.trigger('hidden.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
}
Collapse.prototype.toggle = function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
Collapse.prototype.getParent = function () {
return $(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element) {
var $element = $(element)
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
}, this))
.end()
}
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
var isOpen = $element.hasClass('in')
$element.attr('aria-expanded', isOpen)
$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
}
function getTargetFromTrigger($trigger) {
var href
var target = $trigger.attr('data-target')
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
return $(target)
}
// COLLAPSE PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.collapse
$.fn.collapse = Plugin
$.fn.collapse.Constructor = Collapse
// COLLAPSE NO CONFLICT
// ====================
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
// COLLAPSE DATA-API
// =================
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
var $this = $(this)
if (!$this.attr('data-target')) e.preventDefault()
var $target = getTargetFromTrigger($this)
var data = $target.data('bs.collapse')
var option = data ? 'toggle' : $this.data()
Plugin.call($target, option)
})
}(jQuery);
/* ========================================================================
* Bootstrap: scrollspy.js v3.3.5
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
this.$body = $(document.body)
this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector = (this.options.target || '') + ' .nav li > a'
this.offsets = []
this.targets = []
this.activeTarget = null
this.scrollHeight = 0
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
this.refresh()
this.process()
}
ScrollSpy.VERSION = '3.3.5'
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh = function () {
var that = this
var offsetMethod = 'offset'
var offsetBase = 0
this.offsets = []
this.targets = []
this.scrollHeight = this.getScrollHeight()
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#./.test(href) && $(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
that.offsets.push(this[0])
that.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.getScrollHeight()
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (this.scrollHeight != scrollHeight) {
this.refresh()
}
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop < offsets[0]) {
this.activeTarget = null
return this.clear()
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
&& this.activate(targets[i])
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
this.clear()
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear = function () {
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.scrollspy
$.fn.scrollspy = Plugin
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load.bs.scrollspy.data-api', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.3.5
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);
| MuddyPaw/testcalendar | web/vendor/bootstrap/js/bootstrap.js | JavaScript | mit | 69,126 |
window.onload = function () {
// Start a new marked instance and renderer
var marked = window.marked;
var renderer = new marked.Renderer();
var counter = 0;
var specs = [];
var opts = {"mode": "vega-lite", "renderer": "svg" };
// Render the ```vis as a div and save the json spec
renderer.code = function (code, lang, escaped) {
if (lang == "vis") {
jsonVis = YAML.parse(code);
specs.push(jsonVis);
counter++;
el = "#vis-" + counter;
htmlChart = "<div id='vis-" + counter + "'></div>";
return htmlChart;
}
var result = marked.Renderer.prototype.code.call(this, code, lang, escaped);
return result;
};
// Render the vega-lite chart for each json spec
vegaliteRender = function (err, content) {
for (var i=0; i < specs.length; i++) {
j = i + 1;
el = "#vis-" + j;
vega.embed(el, specs[i], opts);
}
return content;
};
// Convert from Markdown to HTML
var input = document.querySelector("#visdown-input");
var output = document.querySelector("#visdown-output");
window.visdown = function () {
console.log('visdown');
var markdownText = input.value;
output.innerHTML = marked(markdownText, { renderer: renderer});
vegaliteRender();
}
visdown()
}
| amitkaps/visdown | js/visdown-marked.js | JavaScript | mit | 1,216 |
module.exports = require("npm:lodash._createassigner@3.1.1/index"); | nayashooter/ES6_React-Bootstrap | public/jspm_packages/npm/lodash._createassigner@3.1.1.js | JavaScript | mit | 67 |
import React from 'react';
import { Gateway } from 'react-gateway';
import ReactModal2 from './ReactModal2';
import Icon from '../Icon';
import './Modal.scss';
/**
* This component is only created to facilitate the process of using react-modal2 with react gateway
*
* You can import this Modal and use onClose props with internal state to control its appearance:
*
*export default class MyComponent extends React.Component {
* state = {
* isModalOpen: false
* };
*
* handleOpen = () => {
* this.setState({ isModalOpen: true });
* };
*
* handleClose = () => {
* this.setState({ isModalOpen: false });
* };
*
* render() {
* return (
* <div>
* <button onClick={this.handleOpen}>Open</button>
* {this.state.isModalOpen && (
* <MyCustomModal onClose={this.handleClose}>
* <h1>Hello from Modal</h1>
* <button onClick={this.handleClose}>Close</button>
* </MyCustomModal>
* )}
* </div>
* );
* }
*}
*
* more info: https://www.npmjs.com/package/react-modal2
*/
const freezeTheScroll = () => {
// eslint-disable-next-line
const body = window.document.querySelector('body');
body.style.overflow = 'hidden';
};
const unfreezeTheScroll = () => {
// eslint-disable-next-line
const body = window.document.querySelector('body');
body.style.overflow = 'initial';
};
export default class Modal extends React.Component {
static propTypes = {
onClose: React.PropTypes.func.isRequired,
};
static defaultProps = {
closeOnEsc: true,
closeOnBackdropClick: true,
};
/* eslint-disable */
componentDidMount() {
if (window) {
freezeTheScroll();
}
}
componentWillUnmount() {
if (window) {
unfreezeTheScroll();
}
}
/* eslint-enable */
render() {
return (
<Gateway into="modal">
<ReactModal2
onClose={this.props.onClose}
closeOnEsc={this.props.closeOnEsc}
closeOnBackdropClick={this.props.closeOnEsc}
backdropClassName="BusyModalBackdrop"
modalClassName="BusyModal"
>
<a className="BusyModal--close" onClick={this.props.onClose}>
<Icon name="close" />
</a>
{this.props.children}
</ReactModal2>
</Gateway>
);
}
}
| Sekhmet/busy | src/widgets/modal/Modal.js | JavaScript | mit | 2,306 |
function solve(args) {
var text = args[0].split('\n');
var textA = text[0];
var textB = text[1];
var state = 0;
for (var i = 0; i < Math.min(textA.length, textB.length); i += 1) {
if (textA[i] > textB[i]) {
state = 1;
break;
}
if (textA[i] < textB[i]) {
state = 2;
break;
}
}
if (state === 0 && textA.length > textB.length) {
state = 1;
}
if (state === 0 && textB.length > textA.length) {
state = 2;
}
switch (state) {
case 0:
console.log('=');
break;
case 1:
console.log('>');
break;
case 2:
console.log('<');
break;
default:
break;
}
} | jorosoft/Telerik-Academy | Homeworks/JS Fundamentals/07. Arrays/02. Lexicographically comparison/lexicographically-comparison.js | JavaScript | mit | 797 |
/* animation.js */
Janice._Animation = {};
Janice._Animation.staticm = {};
Janice._Animation.method = {};
Janice._Animation.staticm.decomposeVersion = function(versionNumber) {
var major = Math.floor(versionNumber)
var minor = parseInt(('' + (versionNumber - major)).substr(2));
return {
major: major,
minor: minor
};
};
Janice._Animation.method.draw = function(context, t) {
this.container.draw(context, t);
};
Janice._Animation.method.save = function() {
var saveStr = '{';
saveStr += '"v":' + this.version;
saveStr += ',';
saveStr += '"w":' + this.width;
saveStr += ',';
saveStr += '"h":' + this.height;
saveStr += ',';
saveStr += '"d":' + this.duration;
saveStr += ',';
saveStr += '"c":' + Janice._Container.staticm.save(this.container);
return saveStr + '}';
};
Janice._Animation.method.load = function(data) {
if (typeof data == 'string') {
try {
data = jsonParse(data);
}
catch (ex) {
throw 'InvalidJsonData';
}
}
// Check version:
var thisVersion = Janice._Animation.staticm.decomposeVersion(this.version);
var dataVersion = Janice._Animation.staticm.decomposeVersion(data.v);
if (thisVersion.major !== dataVersion.major) {
throw 'IncompatibleMajorVersion';
}
else if (thisVersion.minor < dataVersion.minor) {
throw 'IncompatibleMinorVersion';
}
// Load animation settings:
this.width = data.w;
this.height = data.h;
this.duration = data.d;
// Load contents:
this.container = Janice._Container.staticm.load(data.c);
};
Janice.Animation = function(duration) {
var animation = {};
animation.version = 0.1;
animation.width = 480;
animation.height = 320;
animation.duration = duration ? parseInt(duration) : 5000; // In milliseconds.
animation.container = Janice.Container();
animation.draw = Janice._Animation.method.draw;
animation.save = Janice._Animation.method.save;
animation.load = Janice._Animation.method.load;
return animation;
};
| tbknl/Janice | src/common/animation.js | JavaScript | mit | 2,121 |
function f() {
console.log(1);
console.log(2);
} | jdeal/doctor | test/fixture/source/nodes.js | JavaScript | mit | 52 |
/* SPDX-License-Identifier: MIT */
function GHDataReport(apiUrl) {
apiUrl = apiUrl || '/';
var owner = this.getParameterByName('owner');
var repo = this.getParameterByName('repo');
this.api = new GHDataAPIClient(apiUrl, owner, repo);
this.buildReport();
}
GHDataReport.prototype.getParameterByName = function(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
};
GHDataReport.prototype.buildReport = function () {
if (this.api.owner && this.api.repo) {
document.getElementById('repo-label').innerHTML = this.api.owner + ' / ' + this.api.repo;
// Commits
this.api.commitsByWeek().then(function (commits) {
MG.data_graphic({
title: "Commits/Week",
data: MG.convert.date(commits, 'date', '%Y-%m-%dT%H:%M:%S.%LZ'),
chart_type: 'point',
least_squares: true,
full_width: true,
height: 300,
color_range: ['#aaa'],
x_accessor: 'date',
y_accessor: 'commits',
target: '#commits-over-time'
});
});
// Stargazers
this.api.stargazersByWeek().then(function (stargazers) {
MG.data_graphic({
title: "Stars/Week",
data: MG.convert.date(stargazers, 'date', '%Y-%m-%dT%H:%M:%S.%LZ'),
chart_type: 'point',
least_squares: true,
full_width: true,
height: 300,
color_range: ['#aaa'],
x_accessor: 'date',
y_accessor: 'watchers',
target: '#stargazers-over-time'
});
});
// Forks
this.api.forksByWeek().then(function (forks) {
MG.data_graphic({
title: "Forks/Week",
data: MG.convert.date(forks, 'date', '%Y-%m-%dT%H:%M:%S.%LZ'),
chart_type: 'point',
least_squares: true,
full_width: true,
height: 300,
color_range: ['#aaa'],
x_accessor: 'date',
y_accessor: 'projects',
target: '#forks-over-time'
});
});
// Issues
this.api.issuesByWeek().then(function (issues) {
MG.data_graphic({
title: "Issues/Week",
data: MG.convert.date(issues, 'date', '%Y-%m-%dT%H:%M:%S.%LZ'),
chart_type: 'point',
least_squares: true,
full_width: true,
height: 300,
color_range: ['#aaa'],
x_accessor: 'date',
y_accessor: 'issues',
target: '#issues-over-time'
});
});
// Pull Requests
this.api.pullRequestsByWeek().then(function (pulls) {
MG.data_graphic({
title: "Pull Requests/Week",
data: MG.convert.date(pulls, 'date', '%Y-%m-%dT%H:%M:%S.%LZ'),
chart_type: 'point',
least_squares: true,
full_width: true,
height: 300,
color_range: ['#aaa'],
x_accessor: 'date',
y_accessor: 'pull_requests',
target: '#pulls-over-time'
});
});
}
};
var client = new GHDataReport();
| srobins259/InternetSystemsDevelopment | static/scripts/health-report.js | JavaScript | mit | 3,149 |
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<g><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z" /></g>
, 'PermIdentity');
| cherniavskii/material-ui | packages/material-ui-icons/src/PermIdentity.js | JavaScript | mit | 397 |
// -------------------------------------------------------------------------------
// OEA Original colors
// --------------------------------------------------------------------------------
export default {
blue: "#3299BB",
lightBlue: "#88D4E1",
lighterBlue: "#D6EBF1",
white: "#fff",
black: "#000",
backgroundGray: "#E9E9E9",
backgroundGreen:"#d1f1eb",
darkGreen: "#1abc9c",
backgroundRed: "#f7c9c4",
red: "#E74C3C",
textGrey: "#333333",
buttonFace: "buttonface",
textColor: "#555",
linkColor: "#1abc9c",
// Colors
almost_black: "#424242",
firm: "#1abc9c",
gray: "#BCBCBC",
lightergrey: "#F3F3F3",
lightgray: "#E9E9E9",
inverse: "#fff",
// Kate Colors
kateDarkOrange: "rgb(25,153,0)",
kateOrange: "rgb(255,153,0)",
kateLightOrange: "rgb(255,173,51)",
kateLightBlue: "#A6F2FF",
// MIT OCW colors
mitocwRed: "#D20035",
mitocwDarkBrown: "#574B49",
mitocwMediumBrown: "#775C57",
mitocwLightBrown: "#E7E0DB",
mitocwDarkGray: "#363636",
mitocwLightGray: "#999",
// pony
ponyLightGray: "#EDEDED",
ponyDarkGray: "#BFBFBF",
ponyLightBlue: "#8FF1FF",
ponyLightPurple: "#770073",
ponyPink: "#FF002C",
ponyOrange: "#FF6728",
ponyYellow: "#FFF8B0",
ponyLightGreen: "#82D771",
ponyGreen: "#44C635",
ponyBlue: "#008DCF",
ponyPurple: "#A756A3",
// Lumen Learing
lumenSeafoam: "#108043",
lumenDarkGreen: "#003136",
lumenBlue: "#1e74d1",
lumenRed: "#ad4646",
// Twitter bootstrap overrides
navbarInverseBg: "#424242",
navbarInverseLinkColor: "#E9E9E9",
navbarInverseLinkHoverColor: "rgb(255,173,51)",
navbarInverseLinkHoverBg: "#424242",
navbarInverseLinkActiveColor: "rgb(255,173,51)",
navbarInverseLinkActiveBg: "#E9E9E9",
inputColor: "#4d4d4d",
}
| lumenlearning/OpenAssessments | client/js/themes/defines.js | JavaScript | mit | 1,909 |
// Modules
const Config = require('../config/main'),
Good = require('good');
module.exports = {
options: Config.HAPI.GOOD_OPTIONS,
register: Good
};
| waterkhair/template | server/plugins/good.js | JavaScript | mit | 162 |
var chokidar = require('chokidar');
process.chdir(__dirname + '/../');
chokidar.watch('.', {ignoreInitial: true, useFsEvents: true}).on('all', function(event, path) {
console.log(new Date, event, path);
});
| dmitry-kulikov/test-node-watchers | chokidar/fsevents-with-hack.js | JavaScript | mit | 212 |
$(function(){
function notOk(s, m) {equal(!!s,false,m);}
module("lock");
test('create', function () {
var lock1 = $.lock(),
lock2 = $.lock(false),
lock3 = $.lock(true);
expect(3);
ok(!lock1.isLocked());
ok(!lock2.isLocked());
ok(lock3.isLocked());
});
var lock = $.lock();
test('lock', function () {
lock.unlock().lock();
expect(1);
ok(lock.isLocked());
});
test('unlock', function () {
lock.lock().unlock();
expect(1);
ok(!lock.isLocked());
});
}) | kodmunki/ku4js-kernel | tests/_base/lock.test.js | JavaScript | mit | 603 |
var should=require('should');
var toast=('../toast');
describe('test/toast.js', function () {
it('toast', function () {
toast.should.equal(toast);
});
});
| devWayne/toast.js | test/test.js | JavaScript | mit | 164 |
var gm = require('gm');
var request = require('request');
var cors = require('cors');
var upload = require('./s3-upload');
function crop(req, res) {
try {
var q = req.query;
var image = gm(request(q.image), 'tempImage');
image.crop(q.width, q.height, q.left, q.top).toBuffer(function(err, buffer) {
if (err) {
throw err;
}
var fileObj = {
alteration: 'cropped',
protocol: req.get('x-orig-proto') || req.protocol,
prefix: q.prefix,
buffer: buffer
};
upload(fileObj, res);
});
} catch(e) {
res.status(500).send(e);
}
}
module.exports = function (app) {
app.get('/crop', cors(), crop);
};
| ndnhat/envision | routes/crop.js | JavaScript | mit | 688 |
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Created by skytzi on 15.4.17.
*/
var core_1 = require("@angular/core");
var common_1 = require("@angular/common");
var router_1 = require("@angular/router");
var login_component_1 = require("./login.component");
var LoginModule = (function () {
function LoginModule() {
}
return LoginModule;
}());
LoginModule = __decorate([
core_1.NgModule({
imports: [router_1.RouterModule, common_1.CommonModule],
declarations: [login_component_1.LoginComponent],
exports: [login_component_1.LoginComponent]
})
], LoginModule);
exports.LoginModule = LoginModule;
//# sourceMappingURL=authentication.module.js.map
| kubeIot/wish | src/app/authentication/login/login.module.js | JavaScript | mit | 1,300 |
'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 _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _libs = require('../../libs');
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; }
var Radio = function (_Component) {
_inherits(Radio, _Component);
function Radio(props) {
_classCallCheck(this, Radio);
var _this = _possibleConstructorReturn(this, (Radio.__proto__ || Object.getPrototypeOf(Radio)).call(this, props));
_this.state = {
checked: _this.getChecked(props)
};
return _this;
}
_createClass(Radio, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
var checked = this.getChecked(props);
if (this.state.checked != checked) {
this.setState({ checked: checked });
}
}
}, {
key: 'onChange',
value: function onChange(e) {
var checked = e.target.checked;
if (checked) {
if (this.props.onChange) {
if (this.props.hasOwnProperty('model')) {
this.props.onChange(this.props.value);
} else {
this.props.onChange(e);
}
}
}
this.setState({ checked: checked });
}
}, {
key: 'onFocus',
value: function onFocus() {
this.setState({
focus: true
});
}
}, {
key: 'onBlur',
value: function onBlur() {
this.setState({
focus: false
});
}
}, {
key: 'getChecked',
value: function getChecked(props) {
return props.model == props.value || Boolean(props.checked);
}
}, {
key: 'render',
value: function render() {
var checked = this.state.checked;
var _props = this.props,
disabled = _props.disabled,
focus = _props.focus,
value = _props.value,
children = _props.children;
return _react2.default.createElement(
'label',
{ style: this.style(), className: this.className('el-radio') },
_react2.default.createElement(
'span',
{ className: this.classNames({
'el-radio__input': true,
'is-checked': checked,
'is-disabled': disabled,
'is-focus': focus
}) },
_react2.default.createElement('span', { className: 'el-radio__inner' }),
_react2.default.createElement('input', {
type: 'radio',
className: 'el-radio__original',
checked: checked,
disabled: disabled,
onChange: this.onChange.bind(this),
onFocus: this.onFocus.bind(this),
onBlur: this.onBlur.bind(this)
})
),
_react2.default.createElement(
'span',
{ className: 'el-radio__label' },
children || value
)
);
}
}]);
return Radio;
}(_libs.Component);
var _default = Radio;
exports.default = _default;
Radio.propTypes = {
value: _libs.PropTypes.oneOfType([_libs.PropTypes.string, _libs.PropTypes.number]).isRequired,
onChange: _libs.PropTypes.func,
disabled: _libs.PropTypes.bool,
focus: _libs.PropTypes.bool,
/* eslint-disable */
checked: _libs.PropTypes.bool
/* eslint-enable */
};
;
var _temp = function () {
if (typeof __REACT_HOT_LOADER__ === 'undefined') {
return;
}
__REACT_HOT_LOADER__.register(Radio, 'Radio', 'src/radio/Radio.jsx');
__REACT_HOT_LOADER__.register(_default, 'default', 'src/radio/Radio.jsx');
}();
; | allanfish/elementui | dist/npm/src/radio/Radio.js | JavaScript | mit | 5,024 |
// Manipulating JavaScript Objects
// I worked on this challenge: [by myself, with: ]
// There is a section below where you will write your code.
// DO NOT ALTER THIS OBJECT BY ADDING ANYTHING WITHIN THE CURLY BRACES!
var terah = {
name: "Terah",
age: 32,
height: 66,
weight: 130,
hairColor: "brown",
eyeColor: "brown"
}
// __________________________________________
// Write your code below.
var adam = {
}
adam.name = "Adam";
terah.spouse = adam;
terah.weight = 125;
delete terah.eyeColor;
adam.spouse = terah;
terah.children = new Object();
var carson = {
name: "Carson",
}
terah.children.carson = carson;
var carter = {
name: "Carter",
}
terah.children.carter = carter;
var colton = {
name: "Colton",
}
terah.children.colton = colton;
adam.children = terah.children;
// __________________________________________
// Reflection: Use the reflection guidelines
/*
What tests did you have trouble passing? What did you do to make
it pass? Why did that work?
There were two tests that I had difficulty with, the first was
assigning terah a spouse. This was mainly because I had misread
the instructions and I was passing terah adam.name and not the
object adam. The second was assigning carson to terah.children,
again this ending up being more a confusion with the instructions
and I failed to initially create carson as a property of
terah.children. Once I realized the mistake, I passed the tests
and moved on.
How difficult was it to add and delete properties outside of the
object itself?
It was easy for the most part and I just needed to spend more
time reading the directions and figuring out what was being asked.
What did you learn about manipulating objects in this challenge?
I started this challenge before finishing 7.2 Eloquent
JavaScript, having only completed the Codecademy JavaScript
track. So I had to do some research on deleting a property. Other
than that, it was mostly things I had already covered.
*/
// __________________________________________
// Driver Code: Do not alter code below this line.
function assert(test, message, test_number) {
if (!test) {
console.log(test_number + "false");
throw "ERROR: " + message;
}
console.log(test_number + "true");
return true;
}
assert(
(adam instanceof Object),
"The value of adam should be an Object.",
"1. "
)
assert(
(adam.name === "Adam"),
"The value of the adam name property should be 'Adam'.",
"2. "
)
assert(
terah.spouse === adam,
"terah should have a spouse property with the value of the object adam.",
"3. "
)
assert(
terah.weight === 125,
"The terah weight property should be 125.",
"4. "
)
assert(
terah.eyeColor === undefined || null,
"The terah eyeColor property should be deleted.",
"5. "
)
assert(
terah.spouse.spouse === terah,
"Terah's spouse's spouse property should refer back to the terah object.",
"6. "
)
assert(
(terah.children instanceof Object),
"The value of the terah children property should be defined as an Object.",
"7. "
)
assert(
(terah.children.carson instanceof Object),
"carson should be defined as an object and assigned as a child of Terah",
"8. "
)
assert(
terah.children.carson.name === "Carson",
"Terah's children should include an object called carson which has a name property equal to 'Carson'.",
"9. "
)
assert(
(terah.children.carter instanceof Object),
"carter should be defined as an object and assigned as a child of Terah",
"10. "
)
assert(
terah.children.carter.name === "Carter",
"Terah's children should include an object called carter which has a name property equal to 'Carter'.",
"11. "
)
assert(
(terah.children.colton instanceof Object),
"colton should be defined as an object and assigned as a child of Terah",
"12. "
)
assert(
terah.children.colton.name === "Colton",
"Terah's children should include an object called colton which has a name property equal to 'Colton'.",
"13. "
)
assert(
adam.children === terah.children,
"The value of the adam children property should be equal to the value of the terah children property",
"14. "
)
console.log("\nHere is your final terah object:")
console.log(terah) | toddseller/phase-0 | week-7/manipulating_objects.js | JavaScript | mit | 4,261 |
function Logger () {
}
Logger.getBeats = function (attacker, defender) {
return attacker.role.title + attacker.name + (attacker.weapon.name? '用' + attacker.weapon.name: '') +
'攻击了' + defender.role.title + defender.name + ', ';
};
Logger.getDetails = function (attacker, defender, damage, extra) {
var mainBody = defender.name + '受到了' + damage + '点伤害, ';
var extraText = '';
var before = false;
if(extra && extra.type == 'strike') {
extraText = attacker.name + '发动了致命一击' + ', ';
before = true;
}
else if(extra && extra.type) {
extraText = defender.name + extra.describe + '了, ';
}
return before? extraText + mainBody: mainBody + extraText;
};
Logger.getRemain = function (player) {
return player.name + '剩余生命:' + player.life;
};
Logger.getExtraDamage = function (attacker, defender, extra) {
var map = {
toxin: attacker.name + '受到' + extra.damage + '点毒性伤害, ' + attacker.name + '剩余生命:' + attacker.life,
flame: attacker.name + '受到' + extra.damage + '点火焰伤害, ' + attacker.name + '剩余生命:' + attacker.life,
frozen: attacker.name + '冻得直哆嗦, 没有击中' + defender.name,
faint: attacker.name + '晕倒了, 无法攻击, 眩晕还剩:' + --extra.remain + '轮'
};
return map[extra.type];
};
Logger.getEffect = function (attacker, defender, effect, damage) {
if(!effect) {
return '';
}
if(effect.repel) {
return defender.name + '被击退了, ';
}
if(effect.double) {
return attacker.name + '发动了连击, ' + defender.name + '受到了' + damage[0] + '点伤害, ';
}
if(effect.defence) {
return defender.name + '发动了隔挡反击, ' + attacker.name + '受到了' + damage[1] + '点伤害, ';
}
return '';
};
Logger.getDeath = function (player) {
return player.name + '被打败了.';
};
Logger.getForward = function (attacker, defender) {
return attacker.name + '靠近了' + defender.name + '.';
};
| trotyl/Weapon-Evolution | src/Logger.js | JavaScript | mit | 2,017 |
var webpack = require('webpack');
var helpers = require('./helpers');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: {
'polyfills': './app/polyfills.ts',
'vendor': './app/vendor.ts',
'app': './app/boot.ts'
},
output: {
path: helpers.root('dist'),
publicPath: 'http://localhost:8084/',
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
resolve: {
extensions: ['', '.ts', '.js']
},
module: {
loaders: [{
test: /\.ts$/,
exclude: path.resolve(__dirname, "node_modules"),
loaders: ['awesome-typescript-loader', 'angular2-template-loader', 'angular2-router-loader']
},
{
test: /\.html$/,
loader: 'html'
},
{
test: /\.(png|jpe?g|gif|ico)$/,
loader: 'file-loader?name=images/[name].[ext]'
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream'
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader'
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=image/svg+xml'
},
{
// site wide css (excluding all css under the app dir)
test: /\.css$/,
exclude: helpers.root('app'),
loader: ExtractTextPlugin.extract('style', 'css?sourceMap')
},
{
// included styles under the app directory - these are for styles included
// with styleUrls
test: /\.css$/,
include: helpers.root('app'),
loader: 'raw'
},
{
test: /\.scss$/,
include: helpers.root('node_modules'),
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
},
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor', 'polyfills']
}),
new ExtractTextPlugin('[name].css'),
new HtmlWebpackPlugin({
template: 'config/index.html'
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.APP_VERSION': JSON.stringify(process.env.npm_package_version),
})
],
devServer: {
historyApiFallback: true,
stats: 'minimal',
}
}; | paololersey/mea4n-aws | frontend/config/webpack.dev.js | JavaScript | mit | 3,257 |
---
layout: null
---
$(document).ready(function(){
console.log("exam.js: document is ready");
$('.template').each(function(i) {
$(this).css('display','none');
});
// Use with <div class="copy-of" data-id="foo"></div>
// Use <div id="foo" class="template"></div> on the stuff you want to copy
// The class="template" will hide it the first time.
// The class="copy-of" data-id="foo" signals that you want a copy of foo inserted here.
$('.copy-of').each(function(i) {
var id = $(this).data('id')
$(this).html($(document.getElementById(id)).clone().html());
});
$('.page-break-before').each(function(i) {
var pageNum = i+1;
var prev = $(this).prev();
var evenOddClass = (pageNum % 2 == 0)?
"even-page" : "odd-page";
$(this).addClass(evenOddClass);
var $div = $("<div>", {class: "pagebreak " + evenOddClass});
prev.append($div);
$('.exam-page-header-template').first().clone().appendTo($div);
if (pageNum %2 ==0) {
var img = $('<img>');
img.addClass("even-page-staple-img");
img.attr('src', "/images/Staple-Even-Pages.png");
img.appendTo($div);
} else {
$('.exam-name-header-template').first().clone().appendTo($div);
}
prev.css('margin-bottom','0');
});
$('td.page-num').each(function(i) {
var pageNum = i + 1
$(this).html(pageNum); // re-calculate page numbers
$(this).data("pageNum",pageNum);
if (pageNum % 2==0) {
$(this).parents(".pagebreak").removeClass("odd-page");
$(this).parents(".pagebreak").addClass("even-page");
} else {
$(this).parents(".pagebreak").removeClass("even-page");
$(this).parents(".pagebreak").addClass("odd-page");
}
});
console.log("exam.js: done");
});
| UCSB-CS56-F17/ucsb-cs56-f17.github.io | exam.js | JavaScript | mit | 1,736 |
/*-
* #%L
* ARROWHEAD::WP5::Market Manager
* %%
* Copyright (C) 2016 The ARROWHEAD Consortium
* %%
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* #L%
*/
'use strict';
angular.module('marketManApp')
.controller('HeaderCtrl', function ($scope, $location, $timeout, serviceMarket) {
$scope.isActive = function (viewLocation) {
return viewLocation === $location.path();
};
$scope.connect = function(connect) {
var c = new serviceMarket.Connection();
c.value = connect;
c.$save();
};
$scope.isConnected = { value: false };
(function tick() {
serviceMarket.Connection.get().$promise.then(
function(val) {
$scope.isConnected = val;
}, function(error){
$scope.isConnected = null;
});
$timeout(tick, 2000);
})();
});
| lawrizs/ARROWHEAD_VME | market-manager/src/main/resources/app/scripts/controllers/headerfooter.js | JavaScript | mit | 1,886 |
// this is a little Node program, running on a Node server
// require() will look inside of a folder and get information, similar to import
// NOTE: gulpfile.js must be in the main directory
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var autoprefixer = require('gulp-autoprefixer');
var minifyCss = require('gulp-minify-css');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var jade = require('gulp-jade');
var plumber = require('gulp-plumber');
////////////////////////////////////////////
// JADE COMPILE
////////////////////////////////////////////
gulp.task('jade', function() {
var jade_locals = {};
// using src = ./*.jade causes index.layout.jade to also compile which we don't want... unless we have multiple main directory files... in which case we do use ./*.jade
// otherwise use src = ./index.jade if there aren't other jade files in ./ (i.e. contact.jade, about.jade, etc.)
return gulp.src('./index.jade')
.pipe(plumber())
.pipe(jade({
locals: jade_locals,
pretty: true
}))
.pipe(gulp.dest('./'))
});
////////////////////////////////////////////
// END JADE COMPILE
////////////////////////////////////////////
////////////////////////////////////////////
// SASS COMPILE
////////////////////////////////////////////
gulp.task('sass', function () {
return gulp.src('css/*.scss')
.pipe(plumber())
.pipe(sass({
'sourcemap=none':true,
'errLogToConsole':true
}))
.pipe(concat('style.css'))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
// .pipe(minifyCss({compatibility: 'ie8'}))
.pipe(gulp.dest('css/'))
.pipe(browserSync.stream());
});
////////////////////////////////////////////
// END SASS COMPILE
////////////////////////////////////////////
////////////////////////////////////////////
// BROWSER SYNC
////////////////////////////////////////////
gulp.task('server', ['sass','jade'], function() {
browserSync.init({
server: "./",
});
gulp.watch("css/*.scss", ['sass']);
// to get SASS partials to trigger changes
// the SCSS partials need to be in their own folder because css/*.scss causes all of them to trigger in the same directory, in the order they currently are which messes up everything
gulp.watch("css/partials/*.scss", ['sass']);
gulp.watch('./*.jade',['jade']);
// to get jade partials to trigger changes
gulp.watch('includes/*.jade',['jade']);
// whenever the .js files change reload
gulp.watch("js/*.js").on('change', reload);
// whenever the .css file changes reload
gulp.watch("css/*.css").on('change', reload);
// whenever the .html file changes reload
gulp.watch("*.html").on('change', reload);
});
////////////////////////////////////////////
// END BROWSER SYNC
////////////////////////////////////////////
////////////////////////////////////////////
// DEFAULT
////////////////////////////////////////////
gulp.task('default', ['server'], function () {
// place everything in here in 'server'
});
////////////////////////////////////////////
// END DEFAULT
////////////////////////////////////////////
| sunnylam13/3D-Holocron-053015 | gulpfile.js | JavaScript | mit | 3,278 |
var $ = require('jquery');
var Backbone = require('backbone');
Backbone.$ = $;
//CHALLENGE: "bring in" the appropriate template for this view
var TodoListView = Backbone.View.extend({
tagName: 'div',
className: 'list-group',
initialize: function () {
this.listenTo(this.collection,'all', this.render);
},
render: function () {
var data = [];
this.collection.models.forEach(function (item) {
data.push({title: item.escape('title'), description: item.escape('description') });
});
this.$el.html(myTemplate({todoData:data}));
}
});
module.exports = TodoListView;
| portlandcodeschool/js-night | backbone-lessons-OLD/7-npm-style-backbone-question/public/js/views/todo-list-view.js | JavaScript | mit | 605 |
// MinuteRepeater Class
// @params dial: object
// @params settings: object
// @params parentWatch: Watch instance
//
// The minuterepeater class accepts a dial, or defaults to the 0th index of the
// dials array on the parent Watch class, and based on the hands' rotation values
// calculates the amount of hours, quarter hours, and remaining minutes. With
// these values, the class then plays back chimes to audibly indicate the time.
class MinuteRepeater {
constructor(dial, repeater, parentWatch) {
this.errorChecking(dial, repeater);
this.hands = dial.hands;
this.hourAngle = 0;
this.hourChimes = 0;
this.hourElement = null;
this.hourDivisor = dial.format === 12 ?
30 :
15;
this.allMinutes = 0;
this.minuteAngle = 0;
this.fifteenMinuteChimes = 0;
this.fifteenMinuteElement = null;
this.minuteChimes = 0;
this.minuteElement = null;
this.trigger = document.getElementById(repeater.id || repeater.trigger);
this.chimes = repeater.chimes;
this.hourChimeDuration = 0;
this.counter = 1;
this.isPlaying = false;
this.quartersPlaying = false;
this.minutesPlaying = false;
this.parent = parentWatch;
if (!this.parent.testing) this.init();
}
errorChecking(dial, settings) {
if (!settings.id && !settings.trigger) throw new ReferenceError('The MinuteRepeater class requires that an ID of the repeater element be provided.');
if (!dial.hands.minute) throw new ReferenceError('The minute repeater, like, by definition, requires a dial which supports a minute hand.');
}
convertAngleToIncrements() {
this.hourAngle = this.parent.getCurrentRotateValue(this.hands.hour);
if (this.hourAngle > 360) {
this.hourAngle -= 360;
}
this.hourChimes = Math.floor(this.hourAngle / this.hourDivisor) || 12;
this.minuteAngle = this.parent.getCurrentRotateValue(this.hands.minute);
if (this.minuteAngle > 360) {
this.minuteAngle %= 360;
}
this.allMinutes = Math.floor(this.minuteAngle / 6);
this.fifteenMinuteChimes = Math.floor(this.allMinutes / 15);
this.minuteChimes = Math.floor(this.allMinutes - (this.fifteenMinuteChimes * 15));
}
bindEvents() {
this.trigger.addEventListener('click', () => {
this.toggleActiveState(this.trigger);
this.togglePlaying();
});
this.trigger.addEventListener('transitionend', () => {
if (this.trigger.classList.contains('active')) this.toggleActiveState(this.trigger);
});
this.hourElement.addEventListener('ended', () => {
if (!this.quartersPlaying && !this.minutesPlaying) {
this.playHours();
}
});
if (this.chimes.quarter) {
this.fifteenMinuteElement.addEventListener("ended", () => {
this.playQuarterHours();
});
}
this.minuteElement.addEventListener('ended', () => {
if (this.quartersPlaying) {
this.playQuarterHours();
} else {
this.playMinutes();
}
});
}
toggleActiveState(btn) {
btn.classList.toggle('active');
}
stopAll() {
this.hourElement.pause();
this.hourElement.currentTime = 0;
if (this.chimes.quarter) {
this.fifteenMinuteElement.pause();
this.fifteenMinuteElementcurrentTime = 0;
}
this.minuteElement.pause();
this.minuteElementcurrentTime = 0;
this.counter = 1;
this.isPlaying = false;
this.quartersPlaying = false;
this.minutesPlaying = false;
}
togglePlaying() {
if (this.parent.globalInterval) {
this.isPlaying = !this.isPlaying;
if (this.isPlaying) {
this.convertAngleToIncrements();
this.playHours();
} else {
this.stopAll();
}
}
}
playHours() {
if (this.counter <= this.hourChimes) {
this.hourElement.play();
this.counter++;
} else if (this.counter === this.hourChimes + 1) {
this.counter = 1;
this.playQuarterHours();
}
}
playQuarterHours() {
if (this.chimes.quarter) {
this.playFifteenMinutes();
} else {
if (this.counter <= this.fifteenMinuteChimes) {
this.quartersPlaying = true;
this.hourElement.play();
setTimeout(() => {
this.minuteElement.play();
this.counter++;
}, this.hourChimeDuration / 2 * 500);
} else {
this.quartersPlaying = false;
this.minutesPlaying = true;
this.counter = 1;
this.playMinutes();
}
}
}
playFifteenMinutes() {
if (this.counter <= this.fifteenMinuteChimes) {
this.fifteenMinuteElement.play();
this.counter++;
} else if (this.counter === this.fifteenMinuteChimes + 1) {
this.counter = 1;
this.playMinutes();
}
}
playMinutes() {
if (this.counter <= this.minuteChimes) {
this.minuteElement.play();
this.counter++;
} else if (this.counter === this.minuteChimes + 1) {
this.stopAll();
}
}
buildAudioElements() {
this.hourElement = document.createElement('audio');
this.hourElement.src = this.chimes.hour;
document.body.appendChild(this.hourElement);
this.hourElement.addEventListener("loadedmetadata", () => {
this.hourChimeDuration = this.hourElement.duration;
}, false);
if (this.chimes.quarter) {
this.fifteenMinuteElement = document.createElement("audio");
this.fifteenMinuteElement.src = this.chimes.quarter;
document.body.appendChild(this.fifteenMinuteElement);
}
this.minuteElement = document.createElement('audio');
this.minuteElement.src = this.chimes.minute;
document.body.appendChild(this.minuteElement);
}
updateCursorForTrigger() {
this.trigger.style.cursor = 'pointer';
}
init() {
this.buildAudioElements();
this.bindEvents();
this.updateCursorForTrigger();
}
}
module.exports = MinuteRepeater; | yuschick/TickTock | src/modules/MinuteRepeater.js | JavaScript | mit | 6,618 |
import {first, uniq, compact, startsWith} from 'lodash'
import cheerio from 'cheerio'
import urijs from 'urijs'
import {flattenDeepCheerioElements} from 'utils'
export function getRelevantTags(htmlText, urlToFetch){
return new Promise((resolve, reject) => {
const doc = cheerio.load(htmlText, {
ignoreWhitespace: true,
decodeEntities: true,
lowerCaseTags: true,
lowerCaseAttributeNames: true,
recognizeCDATA: true,
recognizeSelfClosing: true
})
resolve({
title: extractTitle(doc) || '',
description: extractDescription(doc) || '',
imageUrls: extractImages(doc, urlToFetch)
})
})
}
function extractDescription(doc){
return first(compact([
doc("meta[name='description']").attr('content'),
doc("meta[property='og:description']").attr('content')
]))
}
function extractTitle(doc) {
return first(compact([
doc("meta[name='title']").attr('content'),
doc("meta[property='og:title']").attr('content'),
doc('title').text(),
]))
}
function extractImages(doc, urlToFetch) {
const imageUrls = flattenDeepCheerioElements([
doc("meta[name='image']").attr("content"),
doc("meta[property='og:image']").attr("content"),
doc("img").map((i, imgNode) => doc(imgNode).attr("src"))
])
return uniq(imageUrls
.map(imageUrl => imageUrl.replace('\\', '/'))
.map(imageUrl => {
const imageProtocol = urijs(imageUrl).protocol()
if(imageProtocol){
return imageUrl
}
if(startsWith(imageUrl, '//')){
const urlToFetchProtocol = urijs(urlToFetch).protocol()
return urijs(imageUrl).protocol(urlToFetchProtocol).toString()
}
return urijs(imageUrl).absoluteTo(urlToFetch).toString()
})
)
} | welldone-software/reembed.me | client/src/services/siteProcessor.js | JavaScript | mit | 1,755 |
!function($,t,e,n){"use strict";function i(t,e){this.element=t,this.settings=$.extend({},s,e),this._defaults=s,this._name=u,this.init()}var u="defaultPluginName",s={propertyName:"value"};$.extend(i.prototype,{init:function(){$(this.element).hide(),this.yourOtherFunction("jQuery Boilerplatess")},yourOtherFunction:function(t){$(this.element).text(t)}}),$.fn[u]=function(t){return this.each(function(){$.data(this,"plugin_"+u)||$.data(this,"plugin_"+u,new i(this,t))})}}(jQuery,window,document); | mikesterific/site-stub-jquery | dist/jquery.boilerplate-min.js | JavaScript | mit | 494 |
import { Response } from 'aurelia-fetch-client';
import toastr from 'toastr';
/**
* Defines the logger service that provides logging/messaging capabilities.
*/
export class LoggerService {
/**
* @function {logApiError}
* @param {Fault} fault - The http fault message.
* @return {type} {Logs an error concerning an API call.}
*/
logApiError(fault) {
let message = fault.statusText;
if (fault.message) message = fault.message;
fault.json()
.then(result => {
if (fault.status === 500) {
toastr.error(message, 'API error:')
}
else {
toastr.warning(result.message)
}
})
.catch(() =>
toastr.error(message, 'API error:'))
}
/**
* @function {show}
* @param {string} message - The message to show.
* @return {type} {Popups a message.}
*/
show(message) {
toastr.success(message);
}
} | easee-csr/CSR | Csr.Web/src/services/logger-service.js | JavaScript | mit | 985 |
import Boolius from "./boolius"; // which in turn imports all the classes it depends upon
import XMLius from "./xmlius";
import Mathius from "./mathius";
window.onload = function () {
d3.select("#modeSelect").on("change", function (e) {
var selectedMode = d3.select("#modeSelect").node().value.toLowerCase();
changeMode(selectedMode);
});
function changeMode(newMode) {
if (newMode.indexOf("arithmetic") > -1) {
// the user wants to look at arithmetic expressions.
// is boolius already loaded?
if (!evaluator || !(evaluator instanceof Mathius)) {
var grammarObject = [
[["NUMERIC", "^", "NUMERIC"], "NUMERIC"],
[["NUMERIC", "*", "NUMERIC"], "NUMERIC"],
[["NUMERIC", "+", "NUMERIC"], "NUMERIC", ["*", "/", "^"]],
[["NUMERIC", "-", "NUMERIC"], "NUMERIC", ["*", "/", "^"]],
[["NUM_LIT"], "NUMERIC"],
[["(", "NUMERIC", ")"], "NUMERIC"],
];
let IGNORE = true;
let tokenDefinitions = [
[/\s+/, "", IGNORE], // ignore whitespace
[/\^/, "^"], // this is the escaped form of ^
[/\(/, "("],
[/\)/, ")"],
[/\+/, "+"],
[/-/, "-"],
[/\*/, "*"],
[/\//, "/"],
[/[-+]?[0-9]*\.?[0-9]+/, "NUM_LIT"],
[/[a-zA-Z]+/, "IDENT"],
[/.+/, "DIRTYTEXT"],
];
makeEvaluatorAndInitialize(
new Mathius(tokenDefinitions, grammarObject),
"1 + 2 ^ (5 - 2) * 3",
"Click operators to expand or collapse."
);
}
} else if (newMode.indexOf("boolean") > -1) {
// the user wants to look at boolean expressions.
// is boolius already loaded?
if (!evaluator || !(evaluator instanceof Boolius)) {
var grammarObject = [
[["TRUE"], "BOOLEAN"],
[["FALSE"], "BOOLEAN"],
[["IDENT"], "BOOLEAN"],
[["!", "BOOLEAN"], "BOOLEAN"],
[["BOOLEAN", "&", "BOOLEAN"], "BOOLEAN"],
[["BOOLEAN", "|", "BOOLEAN"], "BOOLEAN"],
[["(", "BOOLEAN", ")"], "BOOLEAN"],
];
let IGNORE = true;
let tokenDefinitions = [
[/\s+/, "", IGNORE], // ignore whitespace
[/&&/, "&"],
[/AND/i, "&"],
[/\|\|/, "|"], // this is the escaped form of ||
[/XOR/i, "^"],
[/OR/i, "|"],
[/\^/, "^"], // this is the escaped form of ^
[/\!/, "!"], // this is the escaped form of !
[/NOT/i, "!"],
[/\(/, "("],
[/\)/, ")"],
[/(true)(?![a-zA-Z0-9])/i, "TRUE"],
[/(false)(?![a-zA-Z0-9])/i, "FALSE"],
[/[a-zA-Z]+/, "IDENT"],
[/.+/, "DIRTYTEXT"],
];
makeEvaluatorAndInitialize(
new Boolius(tokenDefinitions, grammarObject),
"((d && c)) || (!b && a) && (!d || !a) && (!c || !b)",
"Click operators to expand or collapse. Click leaf nodes to toggle true/false."
);
}
} else if (newMode.indexOf("xml") > -1) {
// the user wants to look at boolean expressions.
// is boolius already loaded?
if (!evaluator || !(evaluator instanceof XMLius)) {
let grammarObject = [
[["OPENCOMMENT", "WILDCARD", "CLOSECOMMENT"], "COMMENT"],
// comments will be engulfed by the text of a node
// and ignored when the node is asked for its text as a string
[["COMMENT"], "#TEXT_NODE"],
[["<", "/", "IDENT", ">"], "CLOSETAG"],
[["<", "IDENT", ">"], "OPENTAG"],
[["<", "IDENT", "/", ">"], "XMLNODE"],
[["<", "IDENT", "IDENT", "=", '"', "WILDCARD", '"'], "OPENTAGSTART"],
/* Some recursive self-nesting here */
[
["OPENTAGSTART", "IDENT", "=", '"', "WILDCARD", '"'],
"OPENTAGSTART",
],
[["OPENTAGSTART", ">"], "OPENTAG"],
// can't have two identifiers in a row, unless we're between an opening and closing tag
// a/k/a node.text
[["IDENT", "IDENT"], "#TEXT_NODE"],
[["IDENT", "#TEXT_NODE"], "#TEXT_NODE"],
[["#TEXT_NODE", "#TEXT_NODE"], "#TEXT_NODE"],
// let's also have nested nodes engulfed in the NODETEXT
[["XMLNODE", "#TEXT_NODE"], "#TEXT_NODE"],
[["XMLNODES", "#TEXT_NODE"], "#TEXT_NODE"],
[["#TEXT_NODE", "XMLNODE"], "#TEXT_NODE"],
[["#TEXT_NODE", "XMLNODES"], "#TEXT_NODE"],
[["OPENTAG", "CLOSETAG"], "XMLNODE"],
[["OPENTAG", "#TEXT_NODE", "CLOSETAG"], "XMLNODE"],
[["OPENTAG", "XMLNODE", "CLOSETAG"], "XMLNODE"],
[["XMLNODE", "XMLNODE"], "XMLNODES"],
[["OPENTAG", "XMLNODES", "CLOSETAG"], "XMLNODE"],
];
let IGNORE = true;
let tokenDefinitions = [
[/\s+/, "", IGNORE],
[/<!--/, "OPENCOMMENT"],
[/-->/, "CLOSECOMMENT"],
[/\//, "/"],
[/>/, ">"],
[/</, "<"],
[/=/, "="],
[/"/, '"'],
[/'/, '"'],
[/[-+]?[0-9]*\.?[0-9]+/, "NUM_LIT"],
[/[a-zA-Z]+[a-zA-Z0-9-]*/, "IDENT"],
// having trapped all these things, what's left is nodetext
[/[^<]+/, "#TEXT_NODE"],
];
makeEvaluatorAndInitialize(
new XMLius(tokenDefinitions, grammarObject),
`<div class="hintwrapper"><div class="hint">Click operators to expand or collapse. Click leaf nodes to toggle true/false.</div><div class="styled-select green semi-square" style="bold"></div></div>`,
"Mouseover nodes to see attributes. Click nodetext to see content."
);
}
}
}
function makeEvaluatorAndInitialize(newEvaluator, statement, hintText) {
assignEvaluator(newEvaluator);
d3.select("#statement").node().value = statement;
d3.select("div.hint").text(hintText);
evaluateStatement();
}
function assignEvaluator(newEvaluator) {
// don't change if the user wants what they already have
if (evaluator && newEvaluator.constructor === evaluator.constructor) return;
evaluator = newEvaluator;
}
var evaluator;
var winWidth = Math.max(1000, window.innerWidth);
let header = document.querySelector("header")[0];
var winHeight = Math.max(500, window.innerHeight - 240);
var winWidth = Math.max(800, window.innerWidth);
var m = [0, 120, 140, 120],
w = winWidth - m[1] - m[3],
h = winHeight - m[0] - m[2],
i = 0,
root;
var tree = d3.layout.tree().size([h, w]);
var diagonal = d3.svg.diagonal().projection(function (d) {
return [d.y, d.x];
});
var vis = d3
.select("#body")
.append("svg:svg")
.attr("width", w + m[1] + m[3])
.attr("height", h + m[0] + m[2])
.append("svg:g")
.attr("transform", "translate(" + m[3] + "," + m[0] + ")");
vis
.append("text")
.attr("opacity", 1)
.attr("y", 246)
.attr("dy", "1.71em")
.style("font-size", "34px")
.style("text-anchor", "end")
.attr("id", "result")
.text("");
d3.select("#testbutton").on("click", function (e) {
evaluateStatement();
});
d3.select("#statement").on("keyup", function () {
if (d3.event.keyCode == 13) {
d3.select("#testbutton").on("click")();
}
});
var parseTree;
function evaluateStatement() {
var statement = d3.select("#statement").node().value;
parseTree = evaluator.parse(statement);
displayJSON(parseTree);
}
function displayJSON(json) {
if (json == null) return;
root = json;
root.x0 = h / 2;
root.y0 = 0;
//d3.select("#statement").val( root.title );
d3.select("#statement").property("value", root.expressionString);
d3.select("#result").text(root.value);
function toggleAll(d, delay) {
if (!delay) delay = 1;
if (d.children) {
toggle(d);
}
if (d._children) {
toggle(d);
}
}
// Initialize the display to show all nodes.
root.children.forEach(toggleAll, 444);
update(root);
}
// Toggle children.
function toggle(d, showOverlay) {
if (d == undefined) return;
//boolean
if (d.value === true || d.value === false) {
if (d.children) {
// hide the children by moving them into _children
d._children = d.children;
d.children = null;
} else {
// bring back the hidden children
d.children = d._children;
d._children = null;
}
var hasNoChildren = !d.children && !d._children;
if (!hasNoChildren) {
// has an array in d.children or d._children
// but it might be empty!
if (d.children && d.children.length == 0) hasNoChildren = true;
if (d._children && d._children.length == 0) hasNoChildren = true;
}
if (hasNoChildren) {
// it's a leaf
// toggle true/false
if (d.value === true || d.value === false) {
d.value = !d.value;
//var myInt = parseInt( d.name );
//conditionTruthValues[ myInt ] = d.value;
var myVar = d.name;
evaluator.state[myVar] = d.value;
updateWithoutDeleting(root);
}
}
} // you clicked something that isn't in a boolean flow
else {
if (showOverlay) {
var attributeText = d.attributes
? JSON.stringify(d.attributes)
: "None";
if (!d.children && !d._children) {
// it's a leaf
//showValueOverlay( d.value );
showValueOverlay(
"Attributes: " + attributeText + "</br>Content: " + d.value
);
} //oops, we wanted to collapse this thing
else {
//showValueOverlay( "Attributes: " + attributeText + "</br>Content: " + d.value );
if (d.children) {
// hide the children by moving them into _children
d._children = d.children;
d.children = null;
} else {
// bring back the hidden children
d.children = d._children;
d._children = null;
}
}
}
}
}
function showValueOverlay(val) {
$("#valueModalText").html(val);
$("#valueModal").modal("show");
}
function updateWithoutDeleting() {
parseTree = evaluator.evaluateParseTree();
updateObjectAndItsChildren(parseTree, root);
d3.select("#result").text(root.value);
}
function updateObjectAndItsChildren(newObjectTemp, rootTemp) {
rootTemp.value = newObjectTemp.value;
if (!newObjectTemp.children) return;
for (var i = 0; i < newObjectTemp.children.length; i++) {
if (rootTemp.children) {
updateObjectAndItsChildren(
newObjectTemp.children[i],
rootTemp.children[i]
);
} else {
if (rootTemp._children) {
updateObjectAndItsChildren(
newObjectTemp.children[i],
rootTemp._children[i]
);
}
}
}
}
function update(source) {
var duration = d3.event && d3.event.altKey ? 5000 : 500;
// Compute the new tree layout.
var nodes = tree.nodes(root).reverse();
// Normalize for fixed-depth.
// OK -- why is d.y correlated with the horizontal position here???
widthPerNode = 110;
var body = d3.select("body");
var svg = body.select("svg");
var widthInPixels = svg.style("width").replace("px", "");
widthInPixels = parseInt(widthInPixels);
var widthPerNode = widthInPixels / nodes.length;
nodes.forEach(function (d) {
d.y = d.depth * widthPerNode;
});
d3.select("#result")
.transition()
.duration(duration)
.attr("x", nodes[nodes.length - 1].y - 40)
.attr("y", function (d) {
return nodes[nodes.length - 1].x - 48;
});
// Update the nodes…
var node = vis.selectAll("g.node").data(nodes, function (d) {
return d.id || (d.id = ++i);
});
var modalOverlayTimeout;
// Enter any new nodes at the parent's previous position.
var nodeEnter = node
.enter()
.append("svg:g")
.attr("class", "node")
.attr("transform", function (d) {
return "translate(" + source.y0 + "," + source.x0 + ")";
})
.on("click", function (d) {
if (modalOverlayTimeout != null) clearTimeout(modalOverlayTimeout);
toggle(d, true);
update(d);
})
.on("mouseover", function (d) {
var attributeText = d.attributes ? JSON.stringify(d.attributes) : "";
if (attributeText.length > 0) {
if (modalOverlayTimeout != null) clearTimeout(modalOverlayTimeout);
modalOverlayTimeout = setTimeout(() => {
showValueOverlay(
"Attributes: " + attributeText + "</br>Content: " + d.value
);
}, 800);
}
});
nodeEnter
.append("svg:circle")
.attr("r", 1e-6)
.style("stroke", function (d) {
return d.value ? "green" : "red";
})
.style("fill", function (d) {
return d._children ? "grey" : "#fff";
});
nodeEnter
.append("svg:text")
.attr("x", function (d) {
return d.children || d._children ? -1 : 17;
})
.attr("y", function (d) {
return d.children || d._children ? 18 : -1;
})
.attr("dy", ".35em")
.attr("text-anchor", function (d) {
return d.children || d._children ? "middle" : "left";
})
// .attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; })
.text(function (d) {
return d.name;
})
.style("fill-opacity", 1e-6);
// Transition nodes to their new position.
var nodeUpdate = node
.transition()
.duration(duration)
.style("stroke", function (d) {
return d.value ? "green" : "red";
})
.attr("transform", function (d) {
return "translate(" + d.y + "," + d.x + ")";
});
nodeUpdate
.select("circle")
.attr("r", 8.5)
.style("stroke", function (d) {
return d.value ? "green" : "red";
})
.style("fill", function (d) {
return d._children ? "lightsteelblue" : "#fff";
});
nodeUpdate.select("text").style("fill-opacity", 1);
// Transition exiting nodes to the parent's new position.
var nodeExit = node
.exit()
.transition()
.duration(duration)
.attr("transform", function (d) {
return "translate(" + source.y + "," + source.x + ")";
})
.remove();
nodeExit.select("circle").attr("r", 1e-6);
nodeExit.select("text").style("fill-opacity", 1e-6);
// Update the links…
var link = vis.selectAll("path.link").data(tree.links(nodes), function (d) {
return d.target.id;
});
// Enter any new links at the parent's previous position.
link
.enter()
.insert("svg:path", "g")
.attr("class", "link")
.attr("d", function (d) {
var o = { x: source.x0, y: source.y0 };
return diagonal({ source: o, target: o });
})
.transition()
.duration(duration)
.attr("d", diagonal);
// Transition links to their new position.
link.transition().duration(duration).attr("d", diagonal);
// Transition exiting nodes to the parent's new position.
link
.exit()
.transition()
.duration(duration)
.attr("d", function (d) {
var o = { x: source.x, y: source.y };
return diagonal({ source: o, target: o });
})
.remove();
// Stash the old positions for transition.
nodes.forEach(function (d) {
d.x0 = d.x;
d.y0 = d.y;
});
}
changeMode("boolean");
evaluateStatement();
};
| pbalogh/candiru | src/visualizer.js | JavaScript | mit | 15,687 |
var ErrorHandler = require('./error').errorHandler;
module.exports = exports = function(app) {
// The main page of the blog
app.get('/', function(req, res, next){
return res.render('index', {
title: 'Editor homepage'
});
});
/* The main page of the blog, filtered by tag
app.get('/tag/:tag', contentHandler.displayMainPageByTag);
app.get("/post/:permalink", contentHandler.displayPostByPermalink);
app.post('/newcomment', contentHandler.handleNewComment);
app.get("/post_not_found", contentHandler.displayPostNotFound);
app.get('/newpost', contentHandler.displayNewPostPage);
app.post('/newpost', contentHandler.handleNewPost);
app.get('/login', sessionHandler.displayLoginPage);
app.post('/login', sessionHandler.handleLoginRequest);
app.get('/logout', sessionHandler.displayLogoutPage);
app.get("/welcome", sessionHandler.displayWelcomePage);
app.get('/signup', sessionHandler.displaySignupPage);
app.post('/signup', sessionHandler.handleSignup);
app.use(ErrorHandler);
*/
}
| duvanjamid/gimli | routes/index.js | JavaScript | mit | 1,089 |
var Transform = require('stream').Transform,
util = require('util');
var StreamConcat = function(streams, options) {
Transform.call(this, options);
var self = this;
this.streams = streams;
this.canAddStream = true;
this.currentStream = null;
this.streamIndex = 0;
var nextStream = function() {
self.currentStream = null;
if (self.streams.constructor === Array && self.streamIndex < self.streams.length) {
self.currentStream = self.streams[self.streamIndex++];
} else if (typeof self.streams === 'function') {
this.canAddStream = false;
self.currentStream = self.streams();
}
if (self.currentStream === null) {
this.canAddStream = false;
self.push(null);
} else {
self.currentStream.pipe(self, {end: false});
self.currentStream.on('end', nextStream);
}
};
nextStream();
};
util.inherits(StreamConcat, Transform);
StreamConcat.prototype._transform = function(chunk, encoding, callback) {
callback(null, chunk);
};
StreamConcat.prototype.addStream = function(newStream) {
if (this.canAddStream)
this.streams.push(newStream);
else
this.emit('error', new Error('Can\'t add stream.'));
};
module.exports = StreamConcat; | scottsfarley93/IceSheetsViz | data/LIG/node_modules/geojson-merge/node_modules/stream-concat/index.js | JavaScript | mit | 1,228 |
'use strict';
angular.module('home', ['ngMessages'])
.controller('homeCtrl', [function() {
}]); | amolv/lalajs | app/view1/homeCtrl.js | JavaScript | mit | 99 |
/**
* @author 도플광어
-버전 0.13
Box2d 추가
*
* 버전 0.12
* matrix 추가
* box2d 추가
*
*/
this.gbox3d = {
core : {}
};
///
//수학 함수관련 선언
///
gbox3d.core.PI = 3.14159265359;
gbox3d.core.RECIPROCAL_PI = 1 / 3.14159265359;
gbox3d.core.HALF_PI = 3.14159265359 / 2;
gbox3d.core.PI64 = 3.141592653589793;
gbox3d.core.DEGTORAD = 3.14159265359 / 180;
gbox3d.core.RADTODEG = 180 / 3.14159265359;
gbox3d.core.TOLERANCE = 1e-8;
gbox3d.core.radToDeg = function(a) {
return a * gbox3d.core.RADTODEG
};
gbox3d.core.degToRad = function(a) {
return a * gbox3d.core.DEGTORAD
};
gbox3d.core.iszero = function(b) {
return (b < 1e-8) && (b > -1e-8)
};
gbox3d.core.isone = function(b) {
return (b + 1e-8 >= 1) && (b - 1e-8 <= 1)
};
gbox3d.core.equals = function(d, c) {
return (d + 1e-8 >= c) && (d - 1e-8 <= c)
};
gbox3d.core.clamp = function(c, a, b) {
if (c < a) {
return a
}
if (c > b) {
return b
}
return c
};
//일정 범위의 랜덤 값 만들기
gbox3d.core.randomIntFromTo = function (from, to){
return Math.floor(Math.random() * (to - from + 1) + from);
}
gbox3d.core.randomFloatFromTo = function(from, to){
return Math.random() * (to - from + 1) + from;
}
gbox3d.core.fract = function(a) {
return a - Math.floor(a)
};
gbox3d.core.max3 = function(e, d, f) {
if (e > d) {
if (e > f) {
return e
}
return f
}
if (d > f) {
return d
}
return f
};
gbox3d.core.min3 = function(e, d, f) {
if (e < d) {
if (e < f) {
return e
}
return f
}
if (d < f) {
return d
}
return f
};
gbox3d.core.round = function(num, valid) {
v = Math.pow(10, valid);
return Math.round(num * v) / v;
}
gbox3d.core.epsilon = function ( value ) {
return Math.abs( value ) < 0.000001 ? 0 : value;
};
gbox3d.core.getAlpha = function(a) {
return ((a & 4278190080) >>> 24)
};
gbox3d.core.getRed = function(a) {
return ((a & 16711680) >> 16)
};
gbox3d.core.getGreen = function(a) {
return ((a & 65280) >> 8)
};
gbox3d.core.getBlue = function(a) {
return ((a & 255))
};
gbox3d.core.createColor = function(d, f, e, c) {
d = d & 255;
f = f & 255;
e = e & 255;
c = c & 255;
return (d << 24) | (f << 16) | (e << 8) | c
};
gbox3d.core.ColorF = function() {
this.A = 1;
this.R = 1;
this.G = 1;
this.B = 1
};
gbox3d.core.ColorF.prototype.clone = function() {
var a = new gbox3d.core.Light();
a.A = this.A;
a.R = this.R;
a.G = this.G;
a.B = this.B;
return a
};
gbox3d.core.ColorF.prototype.A = 1;
gbox3d.core.ColorF.prototype.R = 1;
gbox3d.core.ColorF.prototype.G = 1;
gbox3d.core.ColorF.prototype.B = 1;
//타이머 객체
//gbox3d.core.CLTimer = function() {
//
//};
//
//gbox3d.core.CLTimer.getTime = function() {
// var a = new Date();
// return a.getTime()
//};
gbox3d.core.Timer = function() {
this.prevTime = (new Date()).getTime();
};
gbox3d.core.Timer.prototype.getTime = function() {
var a = new Date();
return a.getTime()
};
gbox3d.core.Timer.prototype.getDeltaTime = function() {
var current = this.getTime();
var delta = current - this.prevTime;
this.prevTime = current;
return delta/1000.0;
}
gbox3d.core.Timer.prototype.getDeltaTick = function() {
var current = this.getTime();
var delta = current - this.prevTime;
this.prevTime = current;
return delta;
}
// Vect3D (3D 벡터 )
gbox3d.core.Vect3d = function(a, c, b) {
if (a == null) {
this.X = 0;
this.Y = 0;
this.Z = 0
} else {
this.X = a;
this.Y = c;
this.Z = b
}
};
gbox3d.core.Vect3d.prototype.X = 0;
gbox3d.core.Vect3d.prototype.Y = 0;
gbox3d.core.Vect3d.prototype.Z = 0;
gbox3d.core.Vect3d.prototype.set = function(a, c, b) {
this.X = a;
this.Y = c;
this.Z = b
};
gbox3d.core.Vect3d.prototype.clone = function() {
return new gbox3d.core.Vect3d(this.X, this.Y, this.Z)
};
gbox3d.core.Vect3d.prototype.copyTo = function(a) {
a.X = this.X;
a.Y = this.Y;
a.Z = this.Z
};
gbox3d.core.Vect3d.prototype.setTo = function(a) {
this.X = a.X;
this.Y = a.Y;
this.Z = a.Z;
return this
};
gbox3d.core.Vect3d.prototype.substract = function(a) {
return new gbox3d.core.Vect3d(this.X - a.X, this.Y - a.Y, this.Z - a.Z)
};
gbox3d.core.Vect3d.prototype.substractFromThis = function(a) {
this.X -= a.X;
this.Y -= a.Y;
this.Z -= a.Z
};
gbox3d.core.Vect3d.prototype.add = function(a) {
return new gbox3d.core.Vect3d(this.X + a.X, this.Y + a.Y, this.Z + a.Z)
};
gbox3d.core.Vect3d.prototype.addToThis = function(a) {
this.X += a.X;
this.Y += a.Y;
this.Z += a.Z
};
gbox3d.core.Vect3d.prototype.addToThisReturnMe = function(a) {
this.X += a.X;
this.Y += a.Y;
this.Z += a.Z;
return this
};
gbox3d.core.Vect3d.prototype.normalize = function() {
var a = this.X * this.X + this.Y * this.Y + this.Z * this.Z;
if (a > -1e-7 && a < 1e-7) {
return
}
a = 1 / Math.sqrt(a);
this.X *= a;
this.Y *= a;
this.Z *= a;
return this;
};
gbox3d.core.Vect3d.prototype.getNormalized = function() {
var a = this.X * this.X + this.Y * this.Y + this.Z * this.Z;
if (a > -1e-7 && a < 1e-7) {
return new gbox3d.core.Vect3d(0, 0, 0)
}
a = 1 / Math.sqrt(a);
return new gbox3d.core.Vect3d(this.X * a, this.Y * a, this.Z * a)
};
gbox3d.core.Vect3d.prototype.setLength = function(b) {
var a = this.X * this.X + this.Y * this.Y + this.Z * this.Z;
if (a > -1e-7 && a < 1e-7) {
return
}
a = b / Math.sqrt(a);
this.X *= a;
this.Y *= a;
this.Z *= a
};
gbox3d.core.Vect3d.prototype.equals = function(a) {
return gbox3d.core.equals(this.X, a.X) && gbox3d.core.equals(this.Y, a.Y) && gbox3d.core.equals(this.Z, a.Z)
};
gbox3d.core.Vect3d.prototype.equalsZero = function() {
return gbox3d.core.iszero(this.X) && gbox3d.core.iszero(this.Y) && gbox3d.core.iszero(this.Z)
};
gbox3d.core.Vect3d.prototype.equalsByNumbers = function(a, c, b) {
return gbox3d.core.equals(this.X, a) && gbox3d.core.equals(this.Y, c) && gbox3d.core.equals(this.Z, b)
};
gbox3d.core.Vect3d.prototype.isZero = function() {
return this.X == 0 && this.Y == 0 && this.Z == 0
};
gbox3d.core.Vect3d.prototype.getLength = function() {
return Math.sqrt(this.X * this.X + this.Y * this.Y + this.Z * this.Z)
};
gbox3d.core.Vect3d.prototype.getDistanceTo = function(b) {
var a = b.X - this.X;
var d = b.Y - this.Y;
var c = b.Z - this.Z;
return Math.sqrt(a * a + d * d + c * c)
};
gbox3d.core.Vect3d.prototype.getDistanceFromSQ = function(b) {
var a = b.X - this.X;
var d = b.Y - this.Y;
var c = b.Z - this.Z;
return a * a + d * d + c * c
};
gbox3d.core.Vect3d.prototype.getLengthSQ = function() {
return this.X * this.X + this.Y * this.Y + this.Z * this.Z
};
gbox3d.core.Vect3d.prototype.multiplyWithScal = function(a) {
return new gbox3d.core.Vect3d(this.X * a, this.Y * a, this.Z * a)
};
gbox3d.core.Vect3d.prototype.multiplyThisWithScal = function(a) {
this.X *= a;
this.Y *= a;
this.Z *= a
};
gbox3d.core.Vect3d.prototype.multiplyThisWithScalReturnMe = function(a) {
this.X *= a;
this.Y *= a;
this.Z *= a;
return this
};
gbox3d.core.Vect3d.prototype.multiplyThisWithVect = function(a) {
this.X *= a.X;
this.Y *= a.Y;
this.Z *= a.Z
};
gbox3d.core.Vect3d.prototype.multiplyWithVect = function(a) {
return new gbox3d.core.Vect3d(this.X * a.X, this.Y * a.Y, this.Z * a.Z)
};
gbox3d.core.Vect3d.prototype.divideThisThroughVect = function(a) {
this.X /= a.X;
this.Y /= a.Y;
this.Z /= a.Z
};
gbox3d.core.Vect3d.prototype.divideThroughVect = function(a) {
return new gbox3d.core.Vect3d(this.X / a.X, this.Y / a.Y, this.Z / a.Z)
};
gbox3d.core.Vect3d.prototype.crossProduct = function(a) {
return new gbox3d.core.Vect3d(this.Y * a.Z - this.Z * a.Y, this.Z * a.X - this.X * a.Z, this.X * a.Y - this.Y * a.X)
};
gbox3d.core.Vect3d.prototype.dotProduct = function(a) {
return this.X * a.X + this.Y * a.Y + this.Z * a.Z;
};
//(0,0,1)을 기준으로 각도를 구한다
gbox3d.core.Vect3d.prototype.getHorizontalAngle = function() {
var b = new gbox3d.core.Vect3d();
b.Y = gbox3d.core.radToDeg(Math.atan2(this.X, this.Z));
if (b.Y < 0) {
b.Y += 360
}
if (b.Y >= 360) {
b.Y -= 360
}
var a = Math.sqrt(this.X * this.X + this.Z * this.Z);
b.X = gbox3d.core.radToDeg(Math.atan2(a, this.Y)) - 90;
if (b.X < 0) {
b.X += 360
}
if (b.X >= 360) {
b.X -= 360
}
return b;
};
gbox3d.core.Vect3d.prototype.toString = function() {
return "(x: " + this.X + " y:" + this.Y + " z:" + this.Z + ")";
};
///////////////////////////////////////////////////////////
//벡터 2D
gbox3d.core.Vect2d = function(a, b) {
if (a == null) {
this.X = 0;
this.Y = 0
} else {
if (a.x != null) {
this.X = a.x;
this.Y = a.y;
} else if (a.X != null) {
this.X = a.X;
this.Y = a.Y;
} else {
this.X = a;
this.Y = b;
}
}
};
gbox3d.core.Vect2d.prototype.X = 0;
gbox3d.core.Vect2d.prototype.Y = 0;
gbox3d.core.Vect2d.prototype.rotate = function(angle, center) {
var cs = Math.cos(angle);
var sn = Math.sin(angle);
var x, y;
if (center == undefined) {
center = new gbox3d.core.Vect2d(0, 0);
}
this.X -= center.X;
this.Y -= center.Y;
this.set((this.X * cs - this.Y * sn), -(this.X * sn + this.Y * cs));
this.X += center.X;
this.Y += center.Y;
}
gbox3d.core.Vect2d.prototype.translate = function( param ) {
this.X += param.X;
this.Y += param.Y;
return this;
}
gbox3d.core.Vect2d.prototype.multiply = function(mult) {
this.X *= mult;
this.Y *= mult;
return this;
}
gbox3d.core.Vect2d.prototype.add = function(a) {
return new gbox3d.core.Vect2d(this.X + a.X, this.Y + a.Y);
};
gbox3d.core.Vect2d.prototype.addToThis = function(a) {
this.X += a.X;
this.Y += a.Y;
return this;
}
gbox3d.core.Vect2d.prototype.sub = function(a,b) {
if(!b) {
return new gbox3d.core.Vect2d(this.X - a.X, this.Y - a.Y);
}
else
return new gbox3d.core.Vect2d(this.X - a, this.Y - b);
};
gbox3d.core.Vect2d.prototype.subToThis = function(a) {
this.X -= a.X;
this.Y -= a.Y;
return this;
}
gbox3d.core.Vect2d.prototype.getDistance = function() {
return Math.sqrt(this.X * this.X + this.Y * this.Y);
}
gbox3d.core.Vect2d.prototype.normalize = function() {
dist = this.getDistance();
// Math.sqrt(this.X * this.X + this.Y * this.Y);
this.X /= dist;
this.Y /= dist;
return this;
}
gbox3d.core.Vect2d.prototype.set = function(x, y) {
this.X = x;
this.Y = y;
return this;
}
gbox3d.core.Vect2d.prototype.copy = function(a) {
this.X = a.X;
this.Y = a.Y;
return this;
}
gbox3d.core.Vect2d.prototype.set_point = function(a) {
this.X = a.x;
this.Y = a.y;
return this;
}
gbox3d.core.Vect2d.prototype.clone = function() {
return new gbox3d.core.Vect2d(this.X, this.Y);
}
gbox3d.core.Vect2d.prototype.getAngle = function() {
var X = this.X;
var Y = this.Y;
if (Y == 0)// corrected thanks to a suggestion by Jox
return X < 0 ? 180 : 0;
else if (X == 0)
return Y < 0 ? 90 : 270;
// don't use getLength here to avoid precision loss with s32 vectors
var tmp = Y / Math.sqrt((X * X + Y * Y));
tmp = Math.atan(Math.sqrt(1 - tmp * tmp) / tmp) * gbox3d.core.RADTODEG;
if (X > 0 && Y > 0)
return tmp + 270;
else if (X > 0 && Y < 0)
return tmp + 90;
else if (X < 0 && Y < 0)
return 90 - tmp;
else if (X < 0 && Y > 0)
return 270 - tmp;
return tmp;
}
gbox3d.core.Vect2d.prototype.getDistanceTo = function(b) {
var a = b.X - this.X;
var d = b.Y - this.Y;
return Math.sqrt(a * a + d * d);
}
gbox3d.core.Vect2d.prototype.formSVG = function(svgElement) {
switch(svgElement.tagName)
{
case 'circle':
case 'ellipse':
this.X = parseInt(svgElement.getAttribute('cx'));
this.Y = parseInt(svgElement.getAttribute('cy'));
break;
case 'rect':
this.X = parseInt(svgElement.getAttribute('x'));
this.Y = parseInt(svgElement.getAttribute('y'));
break;
}
}
gbox3d.core.Vect2d.prototype.toSVG = function(svgElement) {
switch(svgElement.tagName)
{
case 'circle':
case 'ellipse':
svgElement.setAttribute('cx',this.X);
svgElement.setAttribute('cy',this.Y);
break;
case 'rect':
svgElement.setAttribute('x',this.X);
svgElement.setAttribute('y',this.Y);
break;
}
}
gbox3d.core.Vect2d.prototype.InPolygon = function(points) {
var length = points.length;
var counter = 0;
var x_inter;
var p1 = points[0];
for ( var i = 1; i <= length; i++ ) {
var p2 = points[i%length];
if ( this.Y > Math.min(p1.Y, p2.Y)) {
if ( this.Y <= Math.max(p1.Y, p2.Y)) {
if ( this.X <= Math.max(p1.X, p2.X)) {
if ( p1.Y != p2.y ) {
x_inter = (this.Y - p1.Y) * (p2.X - p1.X) / (p2.Y - p1.Y) + p1.X;
//console.log(x_inter);
if ( p1.X == p2.X || this.X <= x_inter) {
counter++;
}
}
}
}
}
p1 = p2;
}
/*
var p1 = this.handles[0].point;
for ( var i = 1; i <= length; i++ ) {
var p2 = this.handles[i%length].point;
if ( point.y > Math.min(p1.y, p2.y)) {
if ( point.y <= Math.max(p1.y, p2.y)) {
if ( point.x <= Math.max(p1.x, p2.x)) {
if ( p1.y != p2.y ) {
x_inter = (point.y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y) + p1.x;
if ( p1.x == p2.x || point.x <= x_inter) {
counter++;
}
}
}
}
}
p1 = p2;
}
*/
return ( counter % 2 == 1 );
};
gbox3d.core.Vect2d.prototype.toString = function() {
return '{"X" :' + this.X + ',"Y":' + this.Y + '}';
}
///////////////////////////////////////////////////////////
//box 2D
gbox3d.core.Box2d = function(param) {
//param = param || {topleft:new,bottomright:0};
if(param) {
this.topLeft = param.topleft;
this.bottomRight = param.bottomright;
}
};
gbox3d.core.Box2d.prototype.ptInBox = function(x,y) {
if(this.topLeft.X < x && this.bottomRight.X > x ) {
if(this.topLeft.Y < y && this.bottomRight.Y > y ) {
return true;
}
}
return false;
}
//DOM 앨리먼트의 충돌 사각형 영역 얻기
gbox3d.core.Box2d.prototype.getCollisionArea = function (node) {
var width = parseInt( node.css('width').slice(0,-2));
var height = parseInt (node.css('height').slice(0,-2));
//console.log(node.css('-webkit-transform'));
var sx,sy
var strmat = node.css('-webkit-transform');
if(strmat == 'none') {
sx = 0;
sy = 0;
}
else {
strmat = strmat.slice(0,-1);
strmat = strmat.slice(7,strmat.length);
var temp = strmat.split(',');
sx = parseInt( temp[4]);
sy = parseInt( temp[5] );
//console.log(strmat);
}
this.topLeft = new gbox3d.core.Vect2d(sx,sy);
this.bottomRight = new gbox3d.core.Vect2d(sx+width,sy+height);
// return new gbox3d.core.Box2d({
//
// topleft : new gbox3d.core.Vect2d(sx,sy),
// bottomright: new gbox3d.core.Vect2d(sx+width,sy+height)
//
// });
};
///////////////matrix2d
///
/*
var computedStyle = window.getComputedStyle(element);
var css_transform = computedStyle.getPropertyValue('-webkit-transform');
*/
gbox3d.core.matrix2d = function(css_transform) {
if(css_transform) {
this.matrix = new WebKitCSSMatrix(css_transform);
}
else {
this.matrix = new WebKitCSSMatrix();
}
};
gbox3d.core.matrix2d.prototype.setupFromElement = function(element)
{
var computedStyle = window.getComputedStyle(element);
var css_transform = computedStyle.getPropertyValue('-webkit-transform');
this.matrix = new WebKitCSSMatrix(css_transform);
}
gbox3d.core.matrix2d.prototype.translate = function(x,y) {
this.matrix = this.matrix.translate(x,y);
};
gbox3d.core.matrix2d.prototype.rotate = function(angle) {
this.matrix = this.matrix.rotate(angle);
};
gbox3d.core.matrix2d.prototype.scale = function(x,y) {
this.matrix = this.matrix.scale(x,y);
};
//행렬 분해
gbox3d.core.matrix2d.prototype.decompose = function() {
var cssmat = this.matrix;
//이동변환 얻기
var x = cssmat.e;
var y = cssmat.f;
//스케일 얻기
var scalex = Math.sqrt(cssmat.a*cssmat.a + cssmat.b*cssmat.b);
var scaley = Math.sqrt(cssmat.c*cssmat.c + cssmat.d*cssmat.d);
//회전 얻기
var angle = Math.round(Math.atan2(cssmat.b/scalex, cssmat.a/scalex) * (180/Math.PI));
return {
x: x,
y: y,
scalex : scalex,
scaley : scaley,
angle:angle
}
}
gbox3d.core.matrix2d.prototype.compose = function(param) {
this.matrix = new WebKitCSSMatrix();
if(param.translation) {
this.matrix = this.matrix.translate(param.translation.x,param.translation.y);
}
if(param.angle)
this.matrix = this.matrix.rotate(param.angle);
if(param.scale)
this.matrix = this.matrix.scale(param.scale.x,param.scale.y);
}
gbox3d.core.matrix2d.prototype.setTranslation = function(x,y) {
//this.matrix = this.matrix = new WebKitCSSMatrix();
this.matrix.e = x;
this.matrix.f = y;
};
/*
gbox3d.core.matrix2d.prototype.setRotation = function(angle) {
//단위행렬로 재초기화
//this.matrix = this.matrix = new WebKitCSSMatrix();
this.matrix = this.matrix.rotate(angle);
};
gbox3d.core.matrix2d.prototype.setScale = function(x,y) {
//this.matrix = this.matrix = new WebKitCSSMatrix();
this.matrix = this.matrix.scale(x,y);
};
*/
gbox3d.core.matrix2d.prototype.toString = function() {
return this.matrix.toString();
};
/////////////////////////
//애니미에션 프레임 초기화
//타이머 보단 좀 나은듯?
(function() {
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame
|| function(callback) {
//60 fps.
window.setTimeout(callback, 1000 / 60);
};
window.requestAnimationFrame = requestAnimationFrame;
})();
///////System 관련 모듈////
/////////////////////////
gbox3d.system = {
//코루틴 관리자.(지연 실행 관리자, 지연후 특정 타이밍 호출할필요가 있을때 사용한다.)
CoroutineManger : function(param) {
this.Callbacks = new Array();
this.Apply = function(deltatime) {
while(this.Callbacks.length > 0) {
var callback = this.Callbacks.pop();
callback({
deltaTime : deltatime
});
}
}
this.yield = function(coroutin) {
this.Callbacks.push(coroutin);
}
}
};
///////helper 모듈////
/////////////////////////
gbox3d.helper = {
css : {
getElementWidth : function(element) {
return parseInt(element.style.width.slice(0,-2));
},
getElementHeight : function(element) {
return parseInt(element.style.height.slice(0,-2));
}
}
}
| gbox3d/pig2d | libs/pig2d/js/core.js | JavaScript | mit | 19,199 |
/*! glimpse 08-03-2014 */
function Glimpse(a){if(!(this instanceof Glimpse))return new Glimpse(a);"undefined"==typeof a&&(a=window);var b=this;return b.domEl="string"==typeof a?document.getElementById(a):a,b.lastFocused=void 0,b.lastBlurred=void 0,b.lastChanged=void 0,b.blurredCallback=void 0,b.focusedCallback=void 0,function(){b.domEl.onfocus=function(a){b.lastFocused=+new Date,b.lastChanged=b.lastFocused-b.lastBlurred,"function"==typeof b.focusedCallback&&b.focusedCallback.call(b,a)},b.domEl.onblur=function(a){b.lastBlurred=+new Date,b.lastChanged=b.lastBlurred-b.lastFocused,"function"==typeof b.blurredCallback&&b.blurredCallback.call(b,a)}}(),b}Glimpse.prototype.blurred=function(a){return"function"==typeof a&&(this.blurredCallback=a),this},Glimpse.prototype.focused=function(a){return"function"==typeof a&&(this.focusedCallback=a),this}; | mattvvhat/Glimpse | dist/glimpse.min.js | JavaScript | mit | 850 |
/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v0.10.1-rc2-master-7bbfd1f
*/
goog.provide('ng.material.components.radioButton');
goog.require('ng.material.core');
/**
* @ngdoc module
* @name material.components.radioButton
* @description radioButton module!
*/
angular.module('material.components.radioButton', [
'material.core'
])
.directive('mdRadioGroup', mdRadioGroupDirective)
.directive('mdRadioButton', mdRadioButtonDirective);
/**
* @ngdoc directive
* @module material.components.radioButton
* @name mdRadioGroup
*
* @restrict E
*
* @description
* The `<md-radio-group>` directive identifies a grouping
* container for the 1..n grouped radio buttons; specified using nested
* `<md-radio-button>` tags.
*
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
* the radio button is in the accent color by default. The primary color palette may be used with
* the `md-primary` class.
*
* Note: `<md-radio-group>` and `<md-radio-button>` handle tabindex differently
* than the native `<input type='radio'>` controls. Whereas the native controls
* force the user to tab through all the radio buttons, `<md-radio-group>`
* is focusable, and by default the `<md-radio-button>`s are not.
*
* @param {string} ng-model Assignable angular expression to data-bind to.
* @param {boolean=} md-no-ink Use of attribute indicates flag to disable ink ripple effects.
*
* @usage
* <hljs lang="html">
* <md-radio-group ng-model="selected">
*
* <md-radio-button
* ng-repeat="d in colorOptions"
* ng-value="d.value" aria-label="{{ d.label }}">
*
* {{ d.label }}
*
* </md-radio-button>
*
* </md-radio-group>
* </hljs>
*
*/
function mdRadioGroupDirective($mdUtil, $mdConstant, $mdTheming, $timeout) {
RadioGroupController.prototype = createRadioGroupControllerProto();
return {
restrict: 'E',
controller: ['$element', RadioGroupController],
require: ['mdRadioGroup', '?ngModel'],
link: { pre: linkRadioGroup }
};
function linkRadioGroup(scope, element, attr, ctrls) {
$mdTheming(element);
var rgCtrl = ctrls[0];
var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel();
function setFocus() {
if (!element.hasClass('md-focused')) { element.addClass('md-focused'); }
}
function keydownListener(ev) {
var keyCode = ev.which || ev.keyCode;
switch(keyCode) {
case $mdConstant.KEY_CODE.LEFT_ARROW:
case $mdConstant.KEY_CODE.UP_ARROW:
ev.preventDefault();
rgCtrl.selectPrevious();
setFocus();
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
case $mdConstant.KEY_CODE.DOWN_ARROW:
ev.preventDefault();
rgCtrl.selectNext();
setFocus();
break;
case $mdConstant.KEY_CODE.ENTER:
var form = angular.element($mdUtil.getClosest(element[0], 'form'));
if (form.length > 0) {
form.triggerHandler('submit');
}
break;
}
}
rgCtrl.init(ngModelCtrl);
scope.mouseActive = false;
element.attr({
'role': 'radiogroup',
'tabIndex': element.attr('tabindex') || '0'
})
.on('keydown', keydownListener)
.on('mousedown', function(event) {
scope.mouseActive = true;
$timeout(function() {
scope.mouseActive = false;
}, 100);
})
.on('focus', function() {
if(scope.mouseActive === false) { rgCtrl.$element.addClass('md-focused'); }
})
.on('blur', function() { rgCtrl.$element.removeClass('md-focused'); });
}
function RadioGroupController($element) {
this._radioButtonRenderFns = [];
this.$element = $element;
}
function createRadioGroupControllerProto() {
return {
init: function(ngModelCtrl) {
this._ngModelCtrl = ngModelCtrl;
this._ngModelCtrl.$render = angular.bind(this, this.render);
},
add: function(rbRender) {
this._radioButtonRenderFns.push(rbRender);
},
remove: function(rbRender) {
var index = this._radioButtonRenderFns.indexOf(rbRender);
if (index !== -1) {
this._radioButtonRenderFns.splice(index, 1);
}
},
render: function() {
this._radioButtonRenderFns.forEach(function(rbRender) {
rbRender();
});
},
setViewValue: function(value, eventType) {
this._ngModelCtrl.$setViewValue(value, eventType);
// update the other radio buttons as well
this.render();
},
getViewValue: function() {
return this._ngModelCtrl.$viewValue;
},
selectNext: function() {
return changeSelectedButton(this.$element, 1);
},
selectPrevious: function() {
return changeSelectedButton(this.$element, -1);
},
setActiveDescendant: function (radioId) {
this.$element.attr('aria-activedescendant', radioId);
}
};
}
/**
* Change the radio group's selected button by a given increment.
* If no button is selected, select the first button.
*/
function changeSelectedButton(parent, increment) {
// Coerce all child radio buttons into an array, then wrap then in an iterator
var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);
if (buttons.count()) {
var validate = function (button) {
// If disabled, then NOT valid
return !angular.element(button).attr("disabled");
};
var selected = parent[0].querySelector('md-radio-button.md-checked');
var target = buttons[increment < 0 ? 'previous' : 'next'](selected, validate) || buttons.first();
// Activate radioButton's click listener (triggerHandler won't create a real click event)
angular.element(target).triggerHandler('click');
}
}
}
mdRadioGroupDirective.$inject = ["$mdUtil", "$mdConstant", "$mdTheming", "$timeout"];
/**
* @ngdoc directive
* @module material.components.radioButton
* @name mdRadioButton
*
* @restrict E
*
* @description
* The `<md-radio-button>`directive is the child directive required to be used within `<md-radio-group>` elements.
*
* While similar to the `<input type="radio" ng-model="" value="">` directive,
* the `<md-radio-button>` directive provides ink effects, ARIA support, and
* supports use within named radio groups.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
* @param {string} ngValue Angular expression which sets the value to which the expression should
* be set when selected.*
* @param {string} value The value to which the expression should be set when selected.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} aria-label Adds label to radio button for accessibility.
* Defaults to radio button's text. If no text content is available, a warning will be logged.
*
* @usage
* <hljs lang="html">
*
* <md-radio-button value="1" aria-label="Label 1">
* Label 1
* </md-radio-button>
*
* <md-radio-button ng-model="color" ng-value="specialValue" aria-label="Green">
* Green
* </md-radio-button>
*
* </hljs>
*
*/
function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) {
var CHECKED_CSS = 'md-checked';
return {
restrict: 'E',
require: '^mdRadioGroup',
transclude: true,
template: '<div class="md-container" md-ink-ripple md-ink-ripple-checkbox>' +
'<div class="md-off"></div>' +
'<div class="md-on"></div>' +
'</div>' +
'<div ng-transclude class="md-label"></div>',
link: link
};
function link(scope, element, attr, rgCtrl) {
var lastChecked;
$mdTheming(element);
configureAria(element, scope);
rgCtrl.add(render);
attr.$observe('value', render);
element
.on('click', listener)
.on('$destroy', function() {
rgCtrl.remove(render);
});
function listener(ev) {
if (element[0].hasAttribute('disabled')) return;
scope.$apply(function() {
rgCtrl.setViewValue(attr.value, ev && ev.type);
});
}
function render() {
var checked = (rgCtrl.getViewValue() == attr.value);
if (checked === lastChecked) {
return;
}
lastChecked = checked;
element.attr('aria-checked', checked);
if (checked) {
element.addClass(CHECKED_CSS);
rgCtrl.setActiveDescendant(element.attr('id'));
} else {
element.removeClass(CHECKED_CSS);
}
}
/**
* Inject ARIA-specific attributes appropriate for each radio button
*/
function configureAria( element, scope ){
scope.ariaId = buildAriaID();
element.attr({
'id' : scope.ariaId,
'role' : 'radio',
'aria-checked' : 'false'
});
$mdAria.expectWithText(element, 'aria-label');
/**
* Build a unique ID for each radio button that will be used with aria-activedescendant.
* Preserve existing ID if already specified.
* @returns {*|string}
*/
function buildAriaID() {
return attr.id || ( 'radio' + "_" + $mdUtil.nextUid() );
}
}
}
}
mdRadioButtonDirective.$inject = ["$mdAria", "$mdUtil", "$mdTheming"];
ng.material.components.radioButton = angular.module("material.components.radioButton"); | CirceThanis/bower-material | modules/closure/radioButton/radioButton.js | JavaScript | mit | 9,695 |
var webpack = require('webpack');
var path = require('path');
var mainPath = path.resolve(__dirname,'..','..','src','index.jsx');
var srcPath = path.resolve(__dirname,'..','..', 'src');
var config = require("./webpack.config.js");
var packageJson = require('../../package.json')
/** ============
NOTE: change the following per the dependencies
of the component you are developing.
============ **/
config.externals = {
// "react": "react",
// "react-dom": "react-dom",
// your dependencies here
// "d3": "d3",
}
config.entry = mainPath;
config.devtool = 'none';
config.plugins = [
new webpack.optimize.UglifyJsPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.ProvidePlugin({
'react': "react"
})
];
config.module.loaders.unshift({
test: /\.jsx$/,
loaders: ['babel'],
exclude: ['node_modules']
})
module.exports = config;
| desduggan/generator-simple-react-webpack | generators/app/templates/tools/webpack/webpack.config.dist.js | JavaScript | mit | 955 |
//main.js
// const greeter = require('./Greeter.js');
// document.querySelector("#root").appendChild(greeter());
import React from 'react';
import {render} from 'react-dom';
import Greeter from './Greeter';
import './main.css';//使用require导入css文件
render(<Greeter />, document.getElementById('root')); | csxiaoyaojianxian/JavaScriptStudy | 11-构建工具/01-webpack/app/main.js | JavaScript | mit | 316 |
/**
* Created by eirikskogland on 24.09.15.
*/
angular.module('ExamApp').directive('solutionTableCell', function() {
return {
restrict: 'E',
templateUrl: 'templates/directives/solution-table-cell.html',
scope: {
tableIndex: '@',
hasSolution: '@'
},
controller: function($scope) {
console.log("Solution Table Cell Controller");
$scope.showingSolutionRow = false;
$scope.showSolutionForm = function(index) {
$(document.getElementById("solutionForm"+index)).toggle();
};
$scope.showSolutionPDF = function(index) {
$(document.getElementById("solutionPDF"+index)).toggle();
};
$scope.showSolutionClicked = function(index) {
$scope.showingSolutionRow = !$scope.showingSolutionRow;
if($scope.hasSolution) {
// show solution
$scope.showSolutionPDF(index);
} else {
// if logged in
// show solution form
$scope.showSolutionForm(index);
// else
// show login message
}
};
},
controllerAs: 'ctrl'
}
}); | skogland/exams | exams/js/directives/solution-table-cell-directive.js | JavaScript | mit | 1,344 |
//
// Copyright (c) 2011 - 2015 ASPECTRON Inc.
// All Rights Reserved.
//
// This file is part of JSX (https://github.com/aspectron/jsx) project.
//
// Distributed under the MIT software license, see the accompanying
// file LICENSE
//
var registry = (function()
{
var log = require("log");
var _registry = new rt.bindings.library("registry");
function Registry(hkey_root_string, path)
{
var self = this;
self.__proto__ = new _registry.Registry(hkey_root_string, path);
return self;
}
function split_path(full_path) // HKEY\\...\\VALUE
{
full_path = full_path.replace(/\//g, "\\");
var list = full_path.split('\\');
if(list.length < 2)
throw new Error("Invalid registry path supplied: "+full_path);
var hkey = list[0];
var filename = list[list.length-1];
var sub_path_start = hkey.length+1;
var path_to_value = full_path.substring(sub_path_start);//, full_path.length-sub_path_start);
var sub_path_length = full_path.length-sub_path_start-(filename.length+1);
var sub_path = path_to_value.substring(0, sub_path_length);
var result =
{
hkey : hkey, // HKEY
filename: filename, // VALUE
sub_path : sub_path, // HKEY/[SUB_PATH]/VALUE
path : path_to_value, // SUB_PATH/VALUE
full_path : full_path // HKEY/SUB_PATH/VALUE
}
return result;
}
function registry_iface()
{
var self = this;
self.Registry = Registry; // Registry class for creation
self.write = function(path, value)
{
var target = split_path(path);
//log.info(target);
var inst = new Registry(target.hkey); // , target.path);
inst.write(target.path,value);
}
self.enumerate_values = function(path, cb_fn)
{
var target = split_path(path);
// log.info(target);
var inst = new Registry(target.hkey);//, target.path);
var index = 0;
while(true)
{
var filename = inst.enum_values(target.path,index++);
if(!filename)
break;
cb_fn.call(filename,filename);
}
}
self.erase_values = function(path, cb_fn)
{
var target = split_path(path);
var inst = new Registry(target.hkey);
var values = [];
var index = 0;
while(true)
{
var filename = inst.enum_values(target.path,index++);
if(!filename)
break;
values.push(filename);
}
for(var i = 0; i < values.length; i++)
{
if(cb_fn.call(values[i]))
inst.erase_value(target.path+'\\'+values[i]);
}
}
return self;
}
return new registry_iface();
})();
exports.$ = registry; | aspectron/jsx | rte/libraries/registry.js | JavaScript | mit | 3,213 |
'use strict';
module.exports = {
skip: {
type: 'integer',
format: 'int32',
minimum: 0,
maximum: 500,
default: 0,
description: 'The number of results to skip before returning matches. Use this to support paging. Maximum of 500'
},
limit: {
type: 'integer',
format: 'int32',
minimum: 1,
maximum: 200,
default: 20,
description: 'Limit the number of results returned. Defaults to 20. Maximum of 200'
}
};
| dennoa/cruddy-express-api | lib/swagger/search-control-properties.js | JavaScript | mit | 458 |
// Use this file to change prototype configuration.
// Note: prototype config can be overridden using environment variables (eg on heroku)
module.exports = {
// Service name used in header. Eg: 'Renew your passport'
serviceName: "Publish data",
// Default port that prototype runs on
port: '3000',
// Enable or disable password protection on production
useAuth: 'true',
// Force HTTP to redirect to HTTPs on production
useHttps: 'true',
// Cookie warning - update link to service's cookie page.
cookieText: 'GOV.UK uses cookies to make the site simpler. <a href="#" title="Find out more about cookies">Find out more about cookies</a>'
};
| datagovuk/publish_data | app/config.js | JavaScript | mit | 668 |
import config from '../../config/common';
import Context from '../../src/server/context';
import range from 'range';
/**
* Create an instance of Context with the given list of blacklisted IPs.
*
* @param {Array=} blacklistIPs Array of IPs to blacklist in the context.
* @returns {Object} Initialized context object.
*/
function create(blacklistIPs) {
const ctx = {
blacklist: Context.prototype.initBlacklistCache(),
db: {},
yubikey: Context.prototype.initYubikeyValidator()
};
ctx.allu = {
template: () => {}
};
range
.range(0, config.blacklist.maxFailedAttempts + 1)
.forEach(() => (blacklistIPs || []).forEach((ip) => ctx.blacklist.increment(ip)));
return ctx;
}
const contextFactory = {
create
};
export default contextFactory;
| LINKIWI/apache-auth | test/util/context-factory.js | JavaScript | mit | 780 |
// @flow
import { workspacesRun, toWorkspacesRunOptions } from '../run';
test('bolt workspaces run');
| boltpkg/bolt | src/commands/workspaces/__tests__/run.test.js | JavaScript | mit | 103 |
'use strict';
var eslint = require('eslint');
var ruleTester = new eslint.RuleTester();
ruleTester.run('rules/no-exports-typo', require('../rules/no-exports-typo'), {
valid: [
'module.exports = true;',
'module.exports.house()',
'exports.mouse = 234',
'exports = module.exports = {}',
'var House = module.exports = function() {}'
],
invalid: [
{ code: 'module.exprts = 123;', errors: [ { message: 'Expected module.exports.' }] },
{ code: 'module.exprts = 123;', errors: [ { message: 'Expected module.exports.' }] },
{ code: 'module.export = 123;', errors: [ { message: 'Expected module.exports.' }] },
{ code: 'module.export()', errors: [ { message: 'Expected module.exports.' }] },
{ code: 'module.extorts.house()', errors: [ { message: 'Expected module.exports.' }] }
]
});
| xjamundx/eslint-plugin-modules | test/no-exports-typo.js | JavaScript | mit | 802 |
"use strict";
/**
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint maxlen: false */
const apirequest_1 = require("../../lib/apirequest");
/**
* Google Cloud Datastore API
*
* Accesses the schemaless NoSQL database to provide fully managed, robust, scalable storage for your application.
*
* @example
* const google = require('googleapis');
* const datastore = google.datastore('v1beta1');
*
* @namespace datastore
* @type {Function}
* @version v1beta1
* @variation v1beta1
* @param {object=} options Options for Datastore
*/
function Datastore(options) {
const self = this;
self._options = options || {};
self.projects = {
/**
* datastore.projects.export
*
* @desc Exports a copy of all or a subset of entities from Google Cloud Datastore to another storage system, such as Google Cloud Storage. Recent updates to entities may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage.
*
* @alias datastore.projects.export
* @memberOf! datastore(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.projectId Project ID against which to make the request.
* @param {datastore(v1beta1).GoogleDatastoreAdminV1beta1ExportEntitiesRequest} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
export: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://datastore.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/v1beta1/projects/{projectId}:export').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['projectId'],
pathParams: ['projectId'],
context: self
};
return apirequest_1.default(parameters, callback);
},
/**
* datastore.projects.import
*
* @desc Imports entities into Google Cloud Datastore. Existing entities with the same key are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportEntities operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Datastore.
*
* @alias datastore.projects.import
* @memberOf! datastore(v1beta1)
*
* @param {object} params Parameters for request
* @param {string} params.projectId Project ID against which to make the request.
* @param {datastore(v1beta1).GoogleDatastoreAdminV1beta1ImportEntitiesRequest} params.resource Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
import: function (params, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options || (options = {});
const rootUrl = options.rootUrl || 'https://datastore.googleapis.com/';
const parameters = {
options: Object.assign({
url: (rootUrl + '/v1beta1/projects/{projectId}:import').replace(/([^:]\/)\/+/g, '$1'),
method: 'POST'
}, options),
params: params,
requiredParams: ['projectId'],
pathParams: ['projectId'],
context: self
};
return apirequest_1.default(parameters, callback);
}
};
}
module.exports = Datastore;
//# sourceMappingURL=v1beta1.js.map | htonkovac/ieee-raspored | node_modules/googleapis/apis/datastore/v1beta1.js | JavaScript | mit | 5,153 |
var express = require('express');
var router = express.Router();
/**
* 获得主页内容
*
*/
router.get('/', function(req, res, next) {
res.render('user/index', {
title: 'Express'
});
});
module.exports = router;
| NewBeeJet/forum-demo | routes/index.js | JavaScript | mit | 236 |
import Channels from './Channels'
export default Channels
export ChannelBackButton from './ChannelBackButton'
export ChannelBalance from './ChannelBalance'
export ChannelCapacity from './ChannelCapacity'
export ChannelCardList from './ChannelCardList'
export ChannelCardListItem from './ChannelCardListItem'
export ChannelCloseDialog from './ChannelCloseDialog'
export ChannelCount from './ChannelCount'
export ChannelCreate from './ChannelCreate'
export ChannelCreateForm from './ChannelCreateForm'
export ChannelCreateHeader from './ChannelCreateHeader'
export ChannelCreateSummary from './ChannelCreateSummary'
export ChannelData from './ChannelData'
export ChannelDetail from './ChannelDetail'
export ChannelFilter from './ChannelFilter'
export ChannelFooter from './ChannelFooter'
export ChannelHeader from './ChannelHeader'
export ChannelMoreButton from './ChannelMoreButton'
export ChannelNodeSearch from './ChannelNodeSearch'
export ChannelSearch from './ChannelSearch'
export ChannelStatus from './ChannelStatus'
export ChannelSummaryList from './ChannelSummaryList'
export ChannelSummaryListItem from './ChannelSummaryListItem'
export ChannelsActions from './ChannelsActions'
export ChannelsCapacity from './ChannelsCapacity'
export ChannelsCapacityDonut from './ChannelsCapacityDonut'
export ChannelsHeader from './ChannelsHeader'
export ChannelsInfo from './ChannelsInfo'
export ChannelsRefresh from './ChannelsRefresh'
export ChannelsSummaryDonut from './ChannelsSummaryDonut'
export ChannelsViewSwitcher from './ChannelsViewSwitcher'
export NodeCardList from './NodeCardList'
export NodeCardView from './NodeCardView'
| LN-Zap/zap-desktop | renderer/components/Channels/index.js | JavaScript | mit | 1,633 |
var allcoin = require('..');
var api = allcoin.PublicApi;
api.depth('mona_btc').then(console.log);
| you21979/node-allcoin | example/depth.js | JavaScript | mit | 100 |
function test(){return 5} | andrewpen/andrewpen.github.io | js/scripts.js | JavaScript | mit | 25 |
var _privateMethod = babelHelpers.classPrivateFieldLooseKey("privateMethod");
class Foo {
constructor() {
Object.defineProperty(this, _privateMethod, {
value: _privateMethod2
});
this.publicField = babelHelpers.classPrivateFieldLooseBase(this, _privateMethod)[_privateMethod]();
}
}
var _privateMethod2 = function _privateMethod2() {
return 42;
};
| jridgewell/babel | packages/babel-plugin-proposal-private-methods/test/fixtures/private-method-loose/assignment/output.js | JavaScript | mit | 375 |
// @flow
import type {Action} from '../actions/types';
const initialState = {
firstMonth: -1,
dates: []
};
export type State = {
firstMonth: number;
dates: Array<Array<number>>;
};
export default function calendar(state: State = initialState, action: Action) : State {
switch (action.type) {
case 'CALENDAR_UPDATE':
return action.data;
default:
return state;
}
}
| kilimondjaro/react-native-couchsurfing-app | js/redux/reducers/calendar.js | JavaScript | mit | 398 |
import {Entity} from 'aframe-react';
import React from 'react';
export default class Seat extends React.Component {
constructor(props) {
super(props);
this.state = {
opacity: 1,
};
}
render() {
return (
<Entity position={this.props.seatPos} >
<Entity visible={ true }
material={{ color: this.props.buttonColor, transparent: true, shader: 'flat', opacity: this.props.Opacity }}
geometry={{ primitive: "plane", width: 0.2, height: 0.1 }}
id={this.props.componentId}
opacity={ this.props.Opacity }
onClick={ this.props.seatAnimation }
/>
</Entity>
);
}}
| csepreghy/VR-Cinema-Website-with-React.js | src/js/components/navigation/seats/Seat.js | JavaScript | mit | 722 |
var sample5__unittest_8cc =
[
[ "QuickTest", "class_quick_test.html", "class_quick_test" ],
[ "IntegerFunctionTest", "class_integer_function_test.html", null ],
[ "QueueTest", "class_queue_test.html", "class_queue_test" ],
[ "TEST_F", "sample5__unittest_8cc.html#ad7679328025ef6d95ee2f45d5604aa89", null ],
[ "TEST_F", "sample5__unittest_8cc.html#ab941323e5a68b9aa8125cb81f5ff3d7c", null ],
[ "TEST_F", "sample5__unittest_8cc.html#ac3e547171299114162b1e8cd5946eb5c", null ],
[ "TEST_F", "sample5__unittest_8cc.html#a0149784588d6ea2a29e0f50a05ee198e", null ]
]; | bhargavipatel/808X_VO | docs/html/sample5__unittest_8cc.js | JavaScript | mit | 588 |
(function() {
'use strict';
angular.module('civic.events.genes', ['ui.router']);
angular.module('civic.events.assertions', ['ui.router']);
angular.module('civic.events.variants', ['ui.router']);
angular.module('civic.events.variantGroups', ['ui.router']);
angular.module('civic.events.evidence', ['ui.router']);
angular.module('civic.events.common', []);
angular.module('civic.events')
.config(EventsViewConfig);
// @ngInject
function EventsViewConfig($stateProvider) {
$stateProvider
.state('events', {
abstract: true,
url: '/events',
template: '<ui-view id="events-view"></ui-view>',
onExit: /* @ngInject */ function($deepStateRedirect) {
$deepStateRedirect.reset();
}
});
}
})();
| genome/civic-client | src/app/views/events/EventsView.js | JavaScript | mit | 778 |
// flow-typed signature: ec6537b935587fad87c821c01929901f
// flow-typed version: <<STUB>>/react-test-renderer_v^15.6.1/flow_v0.47.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-test-renderer'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-test-renderer' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-test-renderer/lib/accumulate' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/accumulateInto' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/adler32' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/CallbackQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/canDefineProperty' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/checkReactTypeSpec' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/deprecated' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/EventConstants' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/EventPluginHub' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/EventPluginRegistry' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/EventPluginUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/EventPropagators' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/flattenChildren' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/forEachAccumulated' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/getHostComponentFromComposite' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/getIteratorFn' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/instantiateReactComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/isTextInputElement' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/KeyEscapeUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/lowPriorityWarning' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/PluginModuleType' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/PooledClass' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactChildFiber' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactChildReconciler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactComponentEnvironment' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactCompositeComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactCoroutine' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactDebugTool' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactDefaultBatchingStrategy' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactElementSymbol' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactErrorUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactEventEmitterMixin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFeatureFlags' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiber' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberBeginWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberCommitWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberCompleteWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberReconciler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberRoot' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberScheduler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactFiberUpdateQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactHostComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactHostOperationHistoryHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactInstanceMap' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactInstanceType' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactInstrumentation' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactInvalidSetStateWarningHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactMultiChild' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactMultiChildUpdateTypes' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactNodeTypes' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactOwner' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactPerf' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactPriorityLevel' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/reactProdInvariant' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactPropTypeLocationNames' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactPropTypeLocations' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactPropTypesSecret' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactReconciler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactRef' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactReifiedYield' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactShallowRenderer' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactSimpleEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactSyntheticEventType' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTestEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTestMount' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTestReconcileTransaction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTestRenderer' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTestTextComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTypeOfWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactTypes' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactUpdateQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactUpdates' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ReactVersion' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ResponderEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ResponderSyntheticEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/ResponderTouchHistoryStore' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/accumulate' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/accumulateInto' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/adler32' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ARIADOMPropertyConfig' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/AutoFocusUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/BeforeInputEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/CallbackQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/canDefineProperty' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ChangeEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/checkReactTypeSpec' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/createMicrosoftUnsafeLocalFunction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/CSSProperty' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/CSSPropertyOperations' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/Danger' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/dangerousStyleValue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/DefaultEventPluginOrder' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/deprecated' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/DOMChildrenOperations' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/DOMLazyTree' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/DOMNamespaces' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/DOMProperty' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/DOMPropertyOperations' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/EnterLeaveEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/escapeTextContentForBrowser' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/EventConstants' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/EventPluginHub' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/EventPluginRegistry' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/EventPluginUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/EventPropagators' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/FallbackCompositionState' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/findDOMNode' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/flattenChildren' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/forEachAccumulated' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getEventCharCode' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getEventKey' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getEventModifierState' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getEventTarget' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getHostComponentFromComposite' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getIteratorFn' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getNodeForCharacterOffset' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getTextContentAccessor' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/getVendorPrefixedEventName' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/HTMLDOMPropertyConfig' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/inputValueTracking' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/instantiateReactComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/isEventSupported' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/isTextInputElement' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/KeyEscapeUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/LinkedValueUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/lowPriorityWarning' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/PluginModuleType' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/PooledClass' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/quoteAttributeValueForBrowser' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactBrowserEventEmitter' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactChildFiber' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactChildReconciler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactComponentBrowserEnvironment' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactComponentEnvironment' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactCompositeComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactCoroutine' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDebugTool' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDefaultBatchingStrategy' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDefaultInjection' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOM' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMComponentFlags' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMComponentTree' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMContainerInfo' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMFeatureFlags' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMFiber' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMIDOperations' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMInput' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMInvalidARIAHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMNullInputValuePropHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMOption' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMSelect' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMSelection' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMServer' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMTextarea' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMTextComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMTreeTraversal' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMUnknownPropertyHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactElementSymbol' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactErrorUtils' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactEventEmitterMixin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactEventListener' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFeatureFlags' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiber' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberBeginWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberCommitWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberCompleteWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberReconciler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberRoot' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberScheduler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberUpdateQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactHostComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactHostOperationHistoryHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactInjection' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactInputSelection' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactInstanceMap' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactInstanceType' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactInstrumentation' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactInvalidSetStateWarningHook' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactMarkupChecksum' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactMount' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactMultiChild' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactMultiChildUpdateTypes' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactNodeTypes' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactOwner' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactPerf' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactPriorityLevel' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/reactProdInvariant' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactPropTypeLocationNames' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactPropTypeLocations' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactPropTypesSecret' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactReconciler' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactReconcileTransaction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactRef' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactReifiedYield' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactServerBatchingStrategy' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactServerRendering' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactServerRenderingTransaction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactServerUpdateQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactShallowRenderer' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactSimpleEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactSyntheticEventType' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTestEmptyComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTestMount' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTestReconcileTransaction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTestRenderer' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTestTextComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTypeOfWork' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactTypes' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactUpdateQueue' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactUpdates' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ReactVersion' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/renderSubtreeIntoContainer' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ResponderEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ResponderSyntheticEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ResponderTouchHistoryStore' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SelectEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/setInnerHTML' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/setTextContent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/shouldUpdateReactComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SimpleEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SVGDOMPropertyConfig' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticAnimationEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticClipboardEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticCompositionEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticDragEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticFocusEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticInputEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticKeyboardEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticMouseEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticTouchEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticTransitionEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticUIEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/SyntheticWheelEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/TapEventPlugin' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/TouchHistoryMath' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/Transaction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/traverseAllChildren' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/validateDOMNesting' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shallow/ViewportMetrics' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/shouldUpdateReactComponent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/SyntheticEvent' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/TouchHistoryMath' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/Transaction' {
declare module.exports: any;
}
declare module 'react-test-renderer/lib/traverseAllChildren' {
declare module.exports: any;
}
declare module 'react-test-renderer/shallow' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-test-renderer/index' {
declare module.exports: $Exports<'react-test-renderer'>;
}
declare module 'react-test-renderer/index.js' {
declare module.exports: $Exports<'react-test-renderer'>;
}
declare module 'react-test-renderer/lib/accumulate.js' {
declare module.exports: $Exports<'react-test-renderer/lib/accumulate'>;
}
declare module 'react-test-renderer/lib/accumulateInto.js' {
declare module.exports: $Exports<'react-test-renderer/lib/accumulateInto'>;
}
declare module 'react-test-renderer/lib/adler32.js' {
declare module.exports: $Exports<'react-test-renderer/lib/adler32'>;
}
declare module 'react-test-renderer/lib/CallbackQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/CallbackQueue'>;
}
declare module 'react-test-renderer/lib/canDefineProperty.js' {
declare module.exports: $Exports<'react-test-renderer/lib/canDefineProperty'>;
}
declare module 'react-test-renderer/lib/checkReactTypeSpec.js' {
declare module.exports: $Exports<'react-test-renderer/lib/checkReactTypeSpec'>;
}
declare module 'react-test-renderer/lib/deprecated.js' {
declare module.exports: $Exports<'react-test-renderer/lib/deprecated'>;
}
declare module 'react-test-renderer/lib/EventConstants.js' {
declare module.exports: $Exports<'react-test-renderer/lib/EventConstants'>;
}
declare module 'react-test-renderer/lib/EventPluginHub.js' {
declare module.exports: $Exports<'react-test-renderer/lib/EventPluginHub'>;
}
declare module 'react-test-renderer/lib/EventPluginRegistry.js' {
declare module.exports: $Exports<'react-test-renderer/lib/EventPluginRegistry'>;
}
declare module 'react-test-renderer/lib/EventPluginUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/EventPluginUtils'>;
}
declare module 'react-test-renderer/lib/EventPropagators.js' {
declare module.exports: $Exports<'react-test-renderer/lib/EventPropagators'>;
}
declare module 'react-test-renderer/lib/flattenChildren.js' {
declare module.exports: $Exports<'react-test-renderer/lib/flattenChildren'>;
}
declare module 'react-test-renderer/lib/forEachAccumulated.js' {
declare module.exports: $Exports<'react-test-renderer/lib/forEachAccumulated'>;
}
declare module 'react-test-renderer/lib/getHostComponentFromComposite.js' {
declare module.exports: $Exports<'react-test-renderer/lib/getHostComponentFromComposite'>;
}
declare module 'react-test-renderer/lib/getIteratorFn.js' {
declare module.exports: $Exports<'react-test-renderer/lib/getIteratorFn'>;
}
declare module 'react-test-renderer/lib/instantiateReactComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/instantiateReactComponent'>;
}
declare module 'react-test-renderer/lib/isTextInputElement.js' {
declare module.exports: $Exports<'react-test-renderer/lib/isTextInputElement'>;
}
declare module 'react-test-renderer/lib/KeyEscapeUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/KeyEscapeUtils'>;
}
declare module 'react-test-renderer/lib/lowPriorityWarning.js' {
declare module.exports: $Exports<'react-test-renderer/lib/lowPriorityWarning'>;
}
declare module 'react-test-renderer/lib/PluginModuleType.js' {
declare module.exports: $Exports<'react-test-renderer/lib/PluginModuleType'>;
}
declare module 'react-test-renderer/lib/PooledClass.js' {
declare module.exports: $Exports<'react-test-renderer/lib/PooledClass'>;
}
declare module 'react-test-renderer/lib/ReactChildFiber.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactChildFiber'>;
}
declare module 'react-test-renderer/lib/ReactChildReconciler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactChildReconciler'>;
}
declare module 'react-test-renderer/lib/ReactComponentEnvironment.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactComponentEnvironment'>;
}
declare module 'react-test-renderer/lib/ReactCompositeComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactCompositeComponent'>;
}
declare module 'react-test-renderer/lib/ReactCoroutine.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactCoroutine'>;
}
declare module 'react-test-renderer/lib/ReactDebugTool.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactDebugTool'>;
}
declare module 'react-test-renderer/lib/ReactDefaultBatchingStrategy.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactDefaultBatchingStrategy'>;
}
declare module 'react-test-renderer/lib/ReactElementSymbol.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactElementSymbol'>;
}
declare module 'react-test-renderer/lib/ReactEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactEmptyComponent'>;
}
declare module 'react-test-renderer/lib/ReactErrorUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactErrorUtils'>;
}
declare module 'react-test-renderer/lib/ReactEventEmitterMixin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactEventEmitterMixin'>;
}
declare module 'react-test-renderer/lib/ReactFeatureFlags.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFeatureFlags'>;
}
declare module 'react-test-renderer/lib/ReactFiber.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiber'>;
}
declare module 'react-test-renderer/lib/ReactFiberBeginWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberBeginWork'>;
}
declare module 'react-test-renderer/lib/ReactFiberCommitWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberCommitWork'>;
}
declare module 'react-test-renderer/lib/ReactFiberCompleteWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberCompleteWork'>;
}
declare module 'react-test-renderer/lib/ReactFiberReconciler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberReconciler'>;
}
declare module 'react-test-renderer/lib/ReactFiberRoot.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberRoot'>;
}
declare module 'react-test-renderer/lib/ReactFiberScheduler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberScheduler'>;
}
declare module 'react-test-renderer/lib/ReactFiberUpdateQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactFiberUpdateQueue'>;
}
declare module 'react-test-renderer/lib/ReactHostComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactHostComponent'>;
}
declare module 'react-test-renderer/lib/ReactHostOperationHistoryHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactHostOperationHistoryHook'>;
}
declare module 'react-test-renderer/lib/ReactInstanceMap.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactInstanceMap'>;
}
declare module 'react-test-renderer/lib/ReactInstanceType.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactInstanceType'>;
}
declare module 'react-test-renderer/lib/ReactInstrumentation.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactInstrumentation'>;
}
declare module 'react-test-renderer/lib/ReactInvalidSetStateWarningHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactInvalidSetStateWarningHook'>;
}
declare module 'react-test-renderer/lib/ReactMultiChild.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactMultiChild'>;
}
declare module 'react-test-renderer/lib/ReactMultiChildUpdateTypes.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactMultiChildUpdateTypes'>;
}
declare module 'react-test-renderer/lib/ReactNodeTypes.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactNodeTypes'>;
}
declare module 'react-test-renderer/lib/ReactOwner.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactOwner'>;
}
declare module 'react-test-renderer/lib/ReactPerf.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactPerf'>;
}
declare module 'react-test-renderer/lib/ReactPriorityLevel.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactPriorityLevel'>;
}
declare module 'react-test-renderer/lib/reactProdInvariant.js' {
declare module.exports: $Exports<'react-test-renderer/lib/reactProdInvariant'>;
}
declare module 'react-test-renderer/lib/ReactPropTypeLocationNames.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactPropTypeLocationNames'>;
}
declare module 'react-test-renderer/lib/ReactPropTypeLocations.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactPropTypeLocations'>;
}
declare module 'react-test-renderer/lib/ReactPropTypesSecret.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactPropTypesSecret'>;
}
declare module 'react-test-renderer/lib/ReactReconciler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactReconciler'>;
}
declare module 'react-test-renderer/lib/ReactRef.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactRef'>;
}
declare module 'react-test-renderer/lib/ReactReifiedYield.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactReifiedYield'>;
}
declare module 'react-test-renderer/lib/ReactShallowRenderer.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactShallowRenderer'>;
}
declare module 'react-test-renderer/lib/ReactSimpleEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactSimpleEmptyComponent'>;
}
declare module 'react-test-renderer/lib/ReactSyntheticEventType.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactSyntheticEventType'>;
}
declare module 'react-test-renderer/lib/ReactTestEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTestEmptyComponent'>;
}
declare module 'react-test-renderer/lib/ReactTestMount.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTestMount'>;
}
declare module 'react-test-renderer/lib/ReactTestReconcileTransaction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTestReconcileTransaction'>;
}
declare module 'react-test-renderer/lib/ReactTestRenderer.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTestRenderer'>;
}
declare module 'react-test-renderer/lib/ReactTestTextComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTestTextComponent'>;
}
declare module 'react-test-renderer/lib/ReactTypeOfWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTypeOfWork'>;
}
declare module 'react-test-renderer/lib/ReactTypes.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactTypes'>;
}
declare module 'react-test-renderer/lib/ReactUpdateQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactUpdateQueue'>;
}
declare module 'react-test-renderer/lib/ReactUpdates.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactUpdates'>;
}
declare module 'react-test-renderer/lib/ReactVersion.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ReactVersion'>;
}
declare module 'react-test-renderer/lib/ResponderEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ResponderEventPlugin'>;
}
declare module 'react-test-renderer/lib/ResponderSyntheticEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ResponderSyntheticEvent'>;
}
declare module 'react-test-renderer/lib/ResponderTouchHistoryStore.js' {
declare module.exports: $Exports<'react-test-renderer/lib/ResponderTouchHistoryStore'>;
}
declare module 'react-test-renderer/lib/shallow/accumulate.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/accumulate'>;
}
declare module 'react-test-renderer/lib/shallow/accumulateInto.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/accumulateInto'>;
}
declare module 'react-test-renderer/lib/shallow/adler32.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/adler32'>;
}
declare module 'react-test-renderer/lib/shallow/ARIADOMPropertyConfig.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ARIADOMPropertyConfig'>;
}
declare module 'react-test-renderer/lib/shallow/AutoFocusUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/AutoFocusUtils'>;
}
declare module 'react-test-renderer/lib/shallow/BeforeInputEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/BeforeInputEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/CallbackQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/CallbackQueue'>;
}
declare module 'react-test-renderer/lib/shallow/canDefineProperty.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/canDefineProperty'>;
}
declare module 'react-test-renderer/lib/shallow/ChangeEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ChangeEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/checkReactTypeSpec.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/checkReactTypeSpec'>;
}
declare module 'react-test-renderer/lib/shallow/createMicrosoftUnsafeLocalFunction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/createMicrosoftUnsafeLocalFunction'>;
}
declare module 'react-test-renderer/lib/shallow/CSSProperty.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/CSSProperty'>;
}
declare module 'react-test-renderer/lib/shallow/CSSPropertyOperations.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/CSSPropertyOperations'>;
}
declare module 'react-test-renderer/lib/shallow/Danger.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/Danger'>;
}
declare module 'react-test-renderer/lib/shallow/dangerousStyleValue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/dangerousStyleValue'>;
}
declare module 'react-test-renderer/lib/shallow/DefaultEventPluginOrder.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/DefaultEventPluginOrder'>;
}
declare module 'react-test-renderer/lib/shallow/deprecated.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/deprecated'>;
}
declare module 'react-test-renderer/lib/shallow/DOMChildrenOperations.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/DOMChildrenOperations'>;
}
declare module 'react-test-renderer/lib/shallow/DOMLazyTree.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/DOMLazyTree'>;
}
declare module 'react-test-renderer/lib/shallow/DOMNamespaces.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/DOMNamespaces'>;
}
declare module 'react-test-renderer/lib/shallow/DOMProperty.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/DOMProperty'>;
}
declare module 'react-test-renderer/lib/shallow/DOMPropertyOperations.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/DOMPropertyOperations'>;
}
declare module 'react-test-renderer/lib/shallow/EnterLeaveEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/EnterLeaveEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/escapeTextContentForBrowser.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/escapeTextContentForBrowser'>;
}
declare module 'react-test-renderer/lib/shallow/EventConstants.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/EventConstants'>;
}
declare module 'react-test-renderer/lib/shallow/EventPluginHub.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/EventPluginHub'>;
}
declare module 'react-test-renderer/lib/shallow/EventPluginRegistry.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/EventPluginRegistry'>;
}
declare module 'react-test-renderer/lib/shallow/EventPluginUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/EventPluginUtils'>;
}
declare module 'react-test-renderer/lib/shallow/EventPropagators.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/EventPropagators'>;
}
declare module 'react-test-renderer/lib/shallow/FallbackCompositionState.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/FallbackCompositionState'>;
}
declare module 'react-test-renderer/lib/shallow/findDOMNode.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/findDOMNode'>;
}
declare module 'react-test-renderer/lib/shallow/flattenChildren.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/flattenChildren'>;
}
declare module 'react-test-renderer/lib/shallow/forEachAccumulated.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/forEachAccumulated'>;
}
declare module 'react-test-renderer/lib/shallow/getEventCharCode.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getEventCharCode'>;
}
declare module 'react-test-renderer/lib/shallow/getEventKey.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getEventKey'>;
}
declare module 'react-test-renderer/lib/shallow/getEventModifierState.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getEventModifierState'>;
}
declare module 'react-test-renderer/lib/shallow/getEventTarget.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getEventTarget'>;
}
declare module 'react-test-renderer/lib/shallow/getHostComponentFromComposite.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getHostComponentFromComposite'>;
}
declare module 'react-test-renderer/lib/shallow/getIteratorFn.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getIteratorFn'>;
}
declare module 'react-test-renderer/lib/shallow/getNodeForCharacterOffset.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getNodeForCharacterOffset'>;
}
declare module 'react-test-renderer/lib/shallow/getTextContentAccessor.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getTextContentAccessor'>;
}
declare module 'react-test-renderer/lib/shallow/getVendorPrefixedEventName.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/getVendorPrefixedEventName'>;
}
declare module 'react-test-renderer/lib/shallow/HTMLDOMPropertyConfig.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/HTMLDOMPropertyConfig'>;
}
declare module 'react-test-renderer/lib/shallow/inputValueTracking.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/inputValueTracking'>;
}
declare module 'react-test-renderer/lib/shallow/instantiateReactComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/instantiateReactComponent'>;
}
declare module 'react-test-renderer/lib/shallow/isEventSupported.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/isEventSupported'>;
}
declare module 'react-test-renderer/lib/shallow/isTextInputElement.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/isTextInputElement'>;
}
declare module 'react-test-renderer/lib/shallow/KeyEscapeUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/KeyEscapeUtils'>;
}
declare module 'react-test-renderer/lib/shallow/LinkedValueUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/LinkedValueUtils'>;
}
declare module 'react-test-renderer/lib/shallow/lowPriorityWarning.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/lowPriorityWarning'>;
}
declare module 'react-test-renderer/lib/shallow/PluginModuleType.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/PluginModuleType'>;
}
declare module 'react-test-renderer/lib/shallow/PooledClass.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/PooledClass'>;
}
declare module 'react-test-renderer/lib/shallow/quoteAttributeValueForBrowser.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/quoteAttributeValueForBrowser'>;
}
declare module 'react-test-renderer/lib/shallow/ReactBrowserEventEmitter.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactBrowserEventEmitter'>;
}
declare module 'react-test-renderer/lib/shallow/ReactChildFiber.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactChildFiber'>;
}
declare module 'react-test-renderer/lib/shallow/ReactChildReconciler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactChildReconciler'>;
}
declare module 'react-test-renderer/lib/shallow/ReactComponentBrowserEnvironment.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactComponentBrowserEnvironment'>;
}
declare module 'react-test-renderer/lib/shallow/ReactComponentEnvironment.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactComponentEnvironment'>;
}
declare module 'react-test-renderer/lib/shallow/ReactCompositeComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactCompositeComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactCoroutine.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactCoroutine'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDebugTool.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDebugTool'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDefaultBatchingStrategy.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDefaultBatchingStrategy'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDefaultInjection.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDefaultInjection'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOM.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOM'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMComponentFlags.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMComponentFlags'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMComponentTree.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMComponentTree'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMContainerInfo.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMContainerInfo'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMEmptyComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMFeatureFlags.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMFeatureFlags'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMFiber.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMFiber'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMIDOperations.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMIDOperations'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMInput.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMInput'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMInvalidARIAHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMInvalidARIAHook'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMNullInputValuePropHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMNullInputValuePropHook'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMOption.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMOption'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMSelect.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMSelect'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMSelection.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMSelection'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMServer.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMServer'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMTextarea.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMTextarea'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMTextComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMTextComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMTreeTraversal.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMTreeTraversal'>;
}
declare module 'react-test-renderer/lib/shallow/ReactDOMUnknownPropertyHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactDOMUnknownPropertyHook'>;
}
declare module 'react-test-renderer/lib/shallow/ReactElementSymbol.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactElementSymbol'>;
}
declare module 'react-test-renderer/lib/shallow/ReactEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactEmptyComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactErrorUtils.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactErrorUtils'>;
}
declare module 'react-test-renderer/lib/shallow/ReactEventEmitterMixin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactEventEmitterMixin'>;
}
declare module 'react-test-renderer/lib/shallow/ReactEventListener.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactEventListener'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFeatureFlags.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFeatureFlags'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiber.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiber'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberBeginWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberBeginWork'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberCommitWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberCommitWork'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberCompleteWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberCompleteWork'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberReconciler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberReconciler'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberRoot.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberRoot'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberScheduler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberScheduler'>;
}
declare module 'react-test-renderer/lib/shallow/ReactFiberUpdateQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactFiberUpdateQueue'>;
}
declare module 'react-test-renderer/lib/shallow/ReactHostComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactHostComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactHostOperationHistoryHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactHostOperationHistoryHook'>;
}
declare module 'react-test-renderer/lib/shallow/ReactInjection.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactInjection'>;
}
declare module 'react-test-renderer/lib/shallow/ReactInputSelection.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactInputSelection'>;
}
declare module 'react-test-renderer/lib/shallow/ReactInstanceMap.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactInstanceMap'>;
}
declare module 'react-test-renderer/lib/shallow/ReactInstanceType.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactInstanceType'>;
}
declare module 'react-test-renderer/lib/shallow/ReactInstrumentation.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactInstrumentation'>;
}
declare module 'react-test-renderer/lib/shallow/ReactInvalidSetStateWarningHook.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactInvalidSetStateWarningHook'>;
}
declare module 'react-test-renderer/lib/shallow/ReactMarkupChecksum.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactMarkupChecksum'>;
}
declare module 'react-test-renderer/lib/shallow/ReactMount.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactMount'>;
}
declare module 'react-test-renderer/lib/shallow/ReactMultiChild.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactMultiChild'>;
}
declare module 'react-test-renderer/lib/shallow/ReactMultiChildUpdateTypes.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactMultiChildUpdateTypes'>;
}
declare module 'react-test-renderer/lib/shallow/ReactNodeTypes.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactNodeTypes'>;
}
declare module 'react-test-renderer/lib/shallow/ReactOwner.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactOwner'>;
}
declare module 'react-test-renderer/lib/shallow/ReactPerf.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactPerf'>;
}
declare module 'react-test-renderer/lib/shallow/ReactPriorityLevel.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactPriorityLevel'>;
}
declare module 'react-test-renderer/lib/shallow/reactProdInvariant.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/reactProdInvariant'>;
}
declare module 'react-test-renderer/lib/shallow/ReactPropTypeLocationNames.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactPropTypeLocationNames'>;
}
declare module 'react-test-renderer/lib/shallow/ReactPropTypeLocations.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactPropTypeLocations'>;
}
declare module 'react-test-renderer/lib/shallow/ReactPropTypesSecret.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactPropTypesSecret'>;
}
declare module 'react-test-renderer/lib/shallow/ReactReconciler.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactReconciler'>;
}
declare module 'react-test-renderer/lib/shallow/ReactReconcileTransaction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactReconcileTransaction'>;
}
declare module 'react-test-renderer/lib/shallow/ReactRef.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactRef'>;
}
declare module 'react-test-renderer/lib/shallow/ReactReifiedYield.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactReifiedYield'>;
}
declare module 'react-test-renderer/lib/shallow/ReactServerBatchingStrategy.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactServerBatchingStrategy'>;
}
declare module 'react-test-renderer/lib/shallow/ReactServerRendering.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactServerRendering'>;
}
declare module 'react-test-renderer/lib/shallow/ReactServerRenderingTransaction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactServerRenderingTransaction'>;
}
declare module 'react-test-renderer/lib/shallow/ReactServerUpdateQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactServerUpdateQueue'>;
}
declare module 'react-test-renderer/lib/shallow/ReactShallowRenderer.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactShallowRenderer'>;
}
declare module 'react-test-renderer/lib/shallow/ReactSimpleEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactSimpleEmptyComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactSyntheticEventType.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactSyntheticEventType'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTestEmptyComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTestEmptyComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTestMount.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTestMount'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTestReconcileTransaction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTestReconcileTransaction'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTestRenderer.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTestRenderer'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTestTextComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTestTextComponent'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTypeOfWork.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTypeOfWork'>;
}
declare module 'react-test-renderer/lib/shallow/ReactTypes.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactTypes'>;
}
declare module 'react-test-renderer/lib/shallow/ReactUpdateQueue.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactUpdateQueue'>;
}
declare module 'react-test-renderer/lib/shallow/ReactUpdates.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactUpdates'>;
}
declare module 'react-test-renderer/lib/shallow/ReactVersion.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ReactVersion'>;
}
declare module 'react-test-renderer/lib/shallow/renderSubtreeIntoContainer.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/renderSubtreeIntoContainer'>;
}
declare module 'react-test-renderer/lib/shallow/ResponderEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ResponderEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/ResponderSyntheticEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ResponderSyntheticEvent'>;
}
declare module 'react-test-renderer/lib/shallow/ResponderTouchHistoryStore.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ResponderTouchHistoryStore'>;
}
declare module 'react-test-renderer/lib/shallow/SelectEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SelectEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/setInnerHTML.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/setInnerHTML'>;
}
declare module 'react-test-renderer/lib/shallow/setTextContent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/setTextContent'>;
}
declare module 'react-test-renderer/lib/shallow/shouldUpdateReactComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/shouldUpdateReactComponent'>;
}
declare module 'react-test-renderer/lib/shallow/SimpleEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SimpleEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/SVGDOMPropertyConfig.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SVGDOMPropertyConfig'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticAnimationEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticAnimationEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticClipboardEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticClipboardEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticCompositionEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticCompositionEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticDragEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticDragEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticFocusEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticFocusEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticInputEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticInputEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticKeyboardEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticKeyboardEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticMouseEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticMouseEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticTouchEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticTouchEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticTransitionEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticTransitionEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticUIEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticUIEvent'>;
}
declare module 'react-test-renderer/lib/shallow/SyntheticWheelEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/SyntheticWheelEvent'>;
}
declare module 'react-test-renderer/lib/shallow/TapEventPlugin.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/TapEventPlugin'>;
}
declare module 'react-test-renderer/lib/shallow/TouchHistoryMath.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/TouchHistoryMath'>;
}
declare module 'react-test-renderer/lib/shallow/Transaction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/Transaction'>;
}
declare module 'react-test-renderer/lib/shallow/traverseAllChildren.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/traverseAllChildren'>;
}
declare module 'react-test-renderer/lib/shallow/validateDOMNesting.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/validateDOMNesting'>;
}
declare module 'react-test-renderer/lib/shallow/ViewportMetrics.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shallow/ViewportMetrics'>;
}
declare module 'react-test-renderer/lib/shouldUpdateReactComponent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/shouldUpdateReactComponent'>;
}
declare module 'react-test-renderer/lib/SyntheticEvent.js' {
declare module.exports: $Exports<'react-test-renderer/lib/SyntheticEvent'>;
}
declare module 'react-test-renderer/lib/TouchHistoryMath.js' {
declare module.exports: $Exports<'react-test-renderer/lib/TouchHistoryMath'>;
}
declare module 'react-test-renderer/lib/Transaction.js' {
declare module.exports: $Exports<'react-test-renderer/lib/Transaction'>;
}
declare module 'react-test-renderer/lib/traverseAllChildren.js' {
declare module.exports: $Exports<'react-test-renderer/lib/traverseAllChildren'>;
}
declare module 'react-test-renderer/shallow.js' {
declare module.exports: $Exports<'react-test-renderer/shallow'>;
}
| canofm/complete-intro-to-react | flow-typed/npm/react-test-renderer_vx.x.x.js | JavaScript | mit | 66,362 |
$(document).ready(function() {
$('#login-form').on('submit', login());
function login(){
$.ajax({
url: "http://localhost:9999/main/login",
type: "GET",
data: {
username:$("#username-field").val(),
password:$("#password-field").val()
},
success: function(response) {
window.location.href = "feed.php?id="+response;
},
error: function(xhr) {
console.log("Error");
}
});
};
}); | galacemiguel/bluehacks2017 | js/login.js | JavaScript | mit | 474 |
(function(){
'use strict';
angular
.module('app')
.constant('LSVER', 1);
angular
.module('app')
.constant('LSKEYS', {
fontSize: 'fontSize',
fontBold: 'fontBold',
themeDarK: 'themeDarK',
auth: 'auth',
data: 'data'
});
angular
.module('app')
.service('LsService', function LsService(LSKEYS, LSVER){
var svc = this;
// prefix for keys in local storage
var keyPrefix = 'ntlyrics';
// linker between prefix and provided key, eg: cs.myNewKey
var keyLink = '.';
/**
* Set value to local storage
* @param {string} key
* @param {object} value
*/
function set(key, value){
localStorage.setItem(prefixKey(key), angular.toJson(value));
}
/**
* Get value from local storage
* @param {string} key
* @returns {Object|Array|string|number|*}
*/
function get(key){
var value = localStorage.getItem(prefixKey(key));
if(value){
return angular.fromJson(value);
}
return undefined;
}
/**
* Remove value from local storage
* @param {string} key
*/
function remove(key){
localStorage.removeItem(prefixKey(key));
}
/**
* Prefix the given key with keyPrefix string + keyLink symbol
* @param {string} key
* @returns {string}
*/
function prefixKey(key){
var prefixAndLink = keyPrefix + keyLink;
if(key.indexOf(prefixAndLink) === 0){
return key;
}
return prefixAndLink + key;
}
//var lsver = get(LSKEYS.lsVersion);
//if(!lsver || LSKEYS > lsver){
// localStorage.clear();
// set(LSKEYS.lsVersion, LSVER);
//}
svc.set = set;
svc.get = get;
svc.remove = remove;
svc.prefixKey = prefixKey;
});
})();
| dedabyte/nt-lyrics | www/js/model/ls-service.js | JavaScript | mit | 1,913 |
'use strict';
const fs = require('fs');
const execa = require('execa');
const Bluebird = require('bluebird');
const log = require('npmlog');
const fsStatAsync = Bluebird.promisify(fs.stat);
const isWin = require('./utils/is-win')();
exports.fileExists = function fileExists(path) {
return fsStatAsync(path).then(stat => stat.isFile()).catchReturn(false);
};
exports.executableExists = function executableExists(exe, options) {
let cmd = isWin ? 'where' : 'which';
let test = execa(cmd, [exe], options);
test.on('error', error => log.error('Error spawning "' + cmd + exe + '"', error));
return test.then(result => result.code === 0, () => false);
};
| gabz75/ember-cli-deploy-redis-publish | node_modules/testem/lib/fileutils.js | JavaScript | mit | 666 |
var classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error =
[
[ "OCSResponseError", "classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.html#a4a8be342eabdb1ff56309de41bb27376", null ],
[ "OCSResponseError", "classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.html#abe1faed2e2f100a1d5e5c051413be70a", null ],
[ "OCSResponseError", "classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.html#a140bbc4910589e73d076ba7a977b9e88", null ]
]; | bnoffer/owncloud-sharp | doc/html/classowncloudsharp_1_1_exceptions_1_1_o_c_s_response_error.js | JavaScript | mit | 473 |
var config = require('./config.console'),
mongoose = require('mongoose'),
chalk = require('chalk'),
http = require('http'),
fs = require('fs');
var db = mongoose.connect(config.db, function(err) {
if (err) {
console.error(chalk.red('Could not connect to MongoDB!'));
console.log(chalk.red(err));
//process.exit();
} else {
console.log(chalk.green('Connected to MongoDB'));
console.log('Do something here');
mongoose.disconnect();
//fetchWebData();
}
}); | chrisedg87/premier-predictor | app/console/mongo-test.js | JavaScript | mit | 476 |
(function($) {
'use strict';
Crafty.scene('editor', function editorScene () {
showEditorForm();
var _width = Crafty.viewport.width;
var _height = Crafty.viewport.height;
var bricksCreated = 0;
var lvl = {
name: "Dynamic Level",
bricks: []
};
var brickSet = {};
Crafty.e('Line, 2D, Canvas, Color')
.color('#AAAAAA')
.attr({ x:0, y:8*_height/10, w:_width, h:2});
Crafty.e('Line, 2D, Canvas, Color')
.color('#000000')
.attr({ x:0, y:8*_height/10, w:_width, h:1});
var BrickCreator = Crafty.e('BrickCreator, 2D, Canvas, Color, BrickC, Mouse');
// Adds brick to level by its ID
// It will overwrite any info already saved with this ID
var addBrickToSet = function addBrickToSet (brick) {
brickSet[brick._brickID] = {
w: brick.w,
h: brick.h,
x: brick.x,
y: brick.y
};
console.log('Added brick', brickSet[brick._brickID]);
};
var onBrickDropped = function onBrickDropped (mouseEvent) {
console.log('brick %d dropped', this._brickID);
addBrickToSet(this);
};
var createBrick = function createBrick () {
console.log('Cloning');
bricksCreated++;
var newBrick = Crafty.e('DynamicBrick'+bricksCreated+', 2D, Canvas, Color, BrickC, Draggable')
.attr({_brickID: bricksCreated})
.startDrag()
.bind('StopDrag', onBrickDropped);
};
BrickCreator.bind('MouseUp', createBrick);
// SAVE BUTTON
var saveText = Crafty.e("2D, DOM, Text, Mouse").attr({
x : 5*_width / 6 + 20 - 8,
y : 9*_height / 10 + 3
})
.text('Save')
.textFont({ size: '25px', weight: 'bold' })
.textColor('#FFFFFF');
var saveButton = Crafty.e("2D, DOM, greyBtn, SpriteAnimation, Mouse").attr({
x : 5*_width / 6 - 8,
y : 9*_height / 10 + 3,
w : 100,
h : 30
})
.bind('Click', function() {
lvl.name = getLevelName();
var lvlWithBricks = withBricks(lvl);
if (lvlWithBricks.bricks.length <= 0) {
window.alert('Your level is empty, please add at least 1 brick!');
return false;
}
var lvlData = JSON.stringify(lvlWithBricks);
console.log('Trying to save level to file. ', lvl, lvlData);
var isFileSaverSupported = false;
try { isFileSaverSupported = !!new Blob(); } catch(e){}
if (isFileSaverSupported) {
var blob = new Blob([lvlData], {type: "text/plain;charset=utf-8"});
window.saveAs(blob, lvl.name+".json");
} else {
console.warn('Blob is not supported.');
window.prompt("Copy it go! (Ctrl/Cmd + C and Enter)", lvlData);
}
})
.attach(saveText);
// CANCEL BUTTON
var cancelText = Crafty.e("2D, DOM, Text, Mouse").attr({
x : 4*_width / 6,
y : 9*_height / 10 + 3
})
.text('Cancel')
.textFont({ size: '25px', weight: 'bold' })
.textColor('#FFFFFF');
var cancelButton = Crafty.e("2D, DOM, greyBtn, SpriteAnimation, Mouse").attr({
x : 4*_width / 6 - 10,
y : 9*_height / 10 + 3,
w : 100,
h : 30
})
.bind('Click', function() {
if (window.confirm('You will lose any unsaved data if you continue, are you sure?')) {
clearLevelName();
hideEditorForm();
Crafty.scene('menu');
}
})
.attach(cancelText);
function withBricks(lvl) {
lvl.bricks = [];
for (var brick in brickSet) {
if (Object.prototype.hasOwnProperty.call(brickSet, brick)) {
lvl.bricks.push(brickSet[brick]);
}
}
return lvl;
}
});
function showEditorForm () {
var $form = $('form[name="levelNameForm"]');
if ($form) {
$form.show();
}
}
function hideEditorForm () {
var $form = $('form[name="levelNameForm"]');
if ($form) {
$form.hide();
}
}
function getLevelName () {
var $input = $('input[name="levelName"]');
if ($input) {
return $input.val() || 'dynamic_' + getRandomInt(1, 10000000);
}
}
function clearLevelName () {
var $input = $('input[name="levelName"]');
if ($input) {
$input.val('');
}
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
})(jQuery);
| jonashartmann/arkanoid | app/scripts/scene/editor.js | JavaScript | mit | 4,987 |
module.exports = cdn
var MaxCDN = require('maxcdn')
function cdn (self) {
if (self.settings.maxcdn.zoneId) {
var maxcdn = new MaxCDN(
self.settings.maxcdn.companyAlias,
self.settings.maxcdn.consumerKey,
self.settings.maxcdn.consumerSecret
)
maxcdn.del('zones/pull.json/' + self.settings.maxcdn.zoneId + '/cache', function (err, res) {
console.log('MAXCDN: STATUS')
if (err) {
console.error('PURGE ERROR: ', err.stack || err.message || err)
return
} else if (res.code !== 200) {
console.error('PURGE ERROR: ', res.code)
return
}
console.log('PURGE SUCCESS')
})
}
}
| JavierPDev/Meangular | server/cdn.js | JavaScript | mit | 664 |
'use strict';
var https = require('https');
var q = require('q');
function logError(error) {
console.log("[Lightify] Error!");
if (error.statusMessage) {
console.log("[Lightify] HTTP Error: " + error.statusCode + " - " + error.statusMessage);
console.log("[Lightify] HTTP Headers: ");
console.log(error.headers);
}
else {
console.log(error);
}
}
var internal = {
// global Osram Lightify constants
lightifyBaseUrl : "us.lightify-api.org",
lightifySessionUrl : "/lightify/services/session",
lightifyDevicesUrl : "/lightify/services/devices/",
deviceSerialNumber: undefined,
username: undefined,
password: undefined,
securityToken: undefined,
getSecurityToken : function () {
var postData = JSON.stringify({
username: this.username,
password: this.password,
serialNumber: this.deviceSerialNumber
});
return this.makeLightifyRequest(this.lightifyBaseUrl, this.lightifySessionUrl, false, false, 'POST', postData)
.then((data) => {
this.securityToken = data.securityToken;
return data;
});
},
getDevices : function () {
return this.makeLightifyRequest(this.lightifyBaseUrl, this.lightifyDevicesUrl, this.securityToken, false, 'GET', undefined);
},
makeLightifyRequest : function (url, path, securityToken, returnRawBody, method, content) {
console.log("[Lightify] -------------------------")
console.log("[Lightify] method : " + method);
console.log("[Lightify] makeLightifyRequest: " + url)
console.log("[Lightify] path : " + path);
console.log("[Lightify] securityToken : " + securityToken);
var deferred = q.defer();
var requestOptions = {
protocol: 'https:',
host: url,
path: path,
method: method,
headers: {}
};
if (securityToken) {
requestOptions.headers['Authorization'] = securityToken;
}
else if (content) {
requestOptions.headers['Content-Type'] = 'application/json';
requestOptions.headers['Content-Length'] = content.length;
}
var request = https.request(requestOptions);
request.on('response', function(response) {
var body = '';
response.setEncoding('utf8');
response.on('data', function(data) {
body += data;
});
response.on('end', function() {
if (response.statusCode != 200) {
deferred.reject(new Error("Invalid HTTP response: " + response.statusCode + " - " + response.statusMessage));
} else {
if (returnRawBody) {
deferred.resolve(body);
}
else {
var parsedBody = JSON.parse(body);
deferred.resolve(parsedBody);
}
}
});
response.on('error', function(e) {
deferred.reject(e);
});
});
request.on('error', (e) => {
deferred.reject(e);
});
if (content) {
request.write(content);
}
request.end();
return deferred.promise;
},
};
module.exports = {
inputNeeded : [
{
type: 'input',
name: 'deviceSerialNumber',
message: 'Osram Lightify Device Serial Number (alpha-numeric without trailing -XX): ',
validate: function(value) {
var pass = !!value;
if (pass) {
return true;
} else {
return 'Please enter a valid Serial Number.';
}
}
},
{
type: 'input',
name: 'username',
message: 'Osram Lightify User Name (create this in the Osram Lightify app): ',
validate: function(value) {
var pass = !!value;
if (pass) {
return true;
} else {
return 'Please enter a valid User Name.';
}
}
},
{
type: 'password',
name: 'password',
message: 'Osram Lightify Password (create this in the Osram Lightify app): ',
validate: function(value) {
var pass = !!value;
if (pass) {
return true;
} else {
return 'Please enter a valid Password.';
}
}
}
],
// devices list as returned by the server
devices: undefined,
// the is the serial number of the Lightify hub device
deviceSerialNumber: undefined,
// this is the oauth security token for the current session
securityToken: undefined,
// authorizes to the server based on the properties saved in the object
authorize: function() {
// get initial set of authorization info, including account server
return internal.getSecurityToken().then((data) => {
// get the list of devices
return internal.getDevices().then((devices) => {
this.securityToken = data.securityToken;
this.devices = devices;
this.deviceSerialNumber = internal.deviceSerialNumber;
return devices;
})
});
},
// connects to the hub based on the answers provided
connect : function(answers) {
var deferred = q.defer();
console.log("[Lightify] connect");
if (!answers.deviceSerialNumber && !answers.username && ! answers.password) {
logError("Invalid input");
setImmediate(function () { deferred.reject(new Error("Invalid input")); });
}
else {
internal.username = answers.username;
internal.password = answers.password;
internal.deviceSerialNumber = answers.deviceSerialNumber;
this.authorize().then(function (data) {
deferred.resolve(data);
},
function (error) {
logError(error);
deferred.reject(error);
});
}
return deferred.promise;
},
printDevices: function (devices) {
devices.forEach(function(device) {
console.log(device.name + " (" + device.deviceId + ") - " + device.deviceType);
});
}
}; | openT2T/onboarding | org.OpenT2T.Onboarding.LightifyHub/node/hub.js | JavaScript | mit | 6,731 |
/* Copyright 2015 Dietrich Epp.
This file is part of Dash and the Jetpack Space Pirates. The Dash
and the Jetpack Space Pirates source code is distributed under the
terms of the MIT license. See LICENSE.txt for details. */
'use strict';
var glm = require('gl-matrix');
var vec2 = glm.vec2;
var color = require('./color');
var param = require('./param');
var physics = require('./physics');
function destroy(body) {
if (body.world) {
body.world.removeBody(body);
}
}
var Types = {};
/*
* Register entity types.
*
* category: The category name, or null.
* types: Mapping from type names to types
*/
function registerTypes(types, category) {
var prefix = category ? category + '.' : '';
_.forOwn(types, function(value, key) {
var inh = value.inherit, i;
if (inh) {
for (i = 0; i < inh.length; i++) {
_.defaults(value, inh[i]);
}
delete value.inherit;
}
var tname = prefix + key;
if (Types.hasOwnProperty(tname)) {
console.error('Duplicate type registered: ' + tname);
return;
}
Types[tname] = value;
});
}
function getType(type) {
return Types[type];
}
module.exports = {
destroy: destroy,
registerTypes: registerTypes,
getType: getType,
};
| depp/jetpack | src/entity.js | JavaScript | mit | 1,206 |
var searchData=
[
['parser_2ecpp',['Parser.cpp',['../_parser_8cpp.html',1,'']]],
['parser_2eh',['Parser.h',['../_parser_8h.html',1,'']]],
['parsercollision_2ecpp',['ParserCollision.cpp',['../_parser_collision_8cpp.html',1,'']]],
['parsercollision_2eh',['ParserCollision.h',['../_parser_collision_8h.html',1,'']]],
['pausemenu_2ecpp',['PauseMenu.cpp',['../_pause_menu_8cpp.html',1,'']]],
['pausemenu_2eh',['PauseMenu.h',['../_pause_menu_8h.html',1,'']]],
['physicalentity_2ecpp',['PhysicalEntity.cpp',['../_physical_entity_8cpp.html',1,'']]],
['physicalentity_2eh',['PhysicalEntity.h',['../_physical_entity_8h.html',1,'']]],
['physicalworld_2ecpp',['PhysicalWorld.cpp',['../_physical_world_8cpp.html',1,'']]],
['physicalworld_2eh',['PhysicalWorld.h',['../_physical_world_8h.html',1,'']]],
['player_2ecpp',['Player.cpp',['../_player_8cpp.html',1,'']]],
['player_2eh',['Player.h',['../_player_8h.html',1,'']]],
['power_2ecpp',['Power.cpp',['../_power_8cpp.html',1,'']]],
['power_2eh',['Power.h',['../_power_8h.html',1,'']]]
];
| Symptogen/Symptogen | doc/html/search/files_70.js | JavaScript | mit | 1,052 |
/* *************************
* "CLASS": Player
* *************************/
function Player(x, y){
/* ### ATTRIBUTES ### */
Entity.call(this, x, y);
this.vx = 0;
this.vy = 0;
this.currentMaxHealth = 2;
this.health = 2;
this.sprite = new Sprite('res/spritesheet.png', [0, 0], [32,32] , 12, [0,1,2,3,4,5,6,7]);
this.speed = STARTING_PLAYER_SPEED;
this.isBlocking = false;
this.blockRadius = (PLAYER_SPRITE_WIDTH/2) + BLOCK_RADIUS;
this.radius = PLAYER_SPRITE_WIDTH/2;
this.handle = PLAYER_HANDLE; // the ability to turn better
this.teleportRange = 100;
this.bulletRange = 180;
this.fireDelay = 3*1000000; // in microseconds
/* METHODS */
this.checkBoundaries = function(){
if(this.x + this.sprite.width >= canvas.width){
this.x = canvas.width - this.sprite.width;
this.vx /= 2;
}
else if(this.x <= 0){
this.x = 0;
this.vx /= 2;
}
if(this.y + this.sprite.height >= canvas.height){
this.y = canvas.height - this.sprite.height;
this.vy /= 2;
}
else if(this.y <= 0){
this.y = 0;
this.vy /= 2;
}
}
this.update = function(dt){
this.sprite.update(dt);
this.checkEnemiesCollision();
this.vx *= PLAYER_FRICTION;
this.vy *= PLAYER_FRICTION;
this.x += this.vx;
this.y += this.vy;
this.checkBoundaries();
};
this.render = function(){
renderEntity(this);
drawBar(this.x, this.y-12, this.sprite.width, 6, this.health, this.currentMaxHealth, true, "green");
//posx, posy, size, width, state, maxState, horizontal, colorInside
};
this.checkEnemiesCollision = function(){
for(var i = 0; i<enemies.length; i++){
var enemy = enemies[i];
if(circleCollision(this, enemy) ){
enemy.destroy();
createExplosion(enemy.x, enemy.y);
this.health--;
this.checkHealth();
}
}
};
this.checkHealth = function(){
if(this.health <= 0){
//todo upgrade menu, so game over instead
alert("Game over! You survived for " + gameTime.toFixed(2) + " seconds!");
location.reload(true);
}
}
/*this.block = function(){
this.isBlocking = true;
var blockX = this.x + (this.sprite.width/2);
var blockY = this.y + (this.sprite.height/2);
daux.beginPath();
daux.arc(blockX, blockY, this.blockRadius, 0, Math.PI*2, true);
daux.stroke();
setTimeout(function(){
daux.clearRect(0, 0, auxcanvas.width, auxcanvas.height);
}, 50);
setTimeout(function(){
player.isBlocking = false;
}, BLOCK_DELAY);
};*/
return this;
}
var PLAYER_START_X = (canvas.width/2) - 32/2;
var PLAYER_START_Y = (canvas.height/2) - 32/2;
var player = new Player(PLAYER_START_X, PLAYER_START_Y);
| CaioIcy/Gladiator | game/js/1.0.0_Player.js | JavaScript | mit | 2,609 |
/**
* Common utilities
* @module glMatrix
*/
// Configuration Constants
export var EPSILON = 0.000001;
export var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
export var RANDOM = Math.random;
/**
* Sets the type of array used when creating new vectors and matrices
*
* @param {Type} type Array type, such as Float32Array or Array
*/
export function setMatrixArrayType(type) {
ARRAY_TYPE = type;
}
var degree = Math.PI / 180;
/**
* Convert Degree To Radian
*
* @param {Number} a Angle in Degrees
*/
export function toRadian(a) {
return a * degree;
}
/**
* Tests whether or not the arguments have approximately the same value, within an absolute
* or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
* than or equal to 1.0, and a relative tolerance is used for larger values)
*
* @param {Number} a The first number to test.
* @param {Number} b The second number to test.
* @returns {Boolean} True if the numbers are approximately equal, false otherwise.
*/
export function equals(a, b) {
return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
}
if (!Math.hypot) Math.hypot = function () {
var y = 0,
i = arguments.length;
while (i--) {
y += arguments[i] * arguments[i];
}
return Math.sqrt(y);
}; | ycabon/presentations | 2020-devsummit/ArcGIS-API-for-JavaScript-Under-The-Hood/src/libs/gl-matrix/esm/common.js | JavaScript | mit | 1,347 |
/* jshint node: true */
'use strict';
var util = require('util');
var _ = require('underscore');
var defaults = require('../defaults');
var options = require('../options');
var descriptor = defaults.defaultDescriptor({
'productName': {
name: 'Product Name',
required: true
},
'productDesc': {
name: 'Description'
},
'proxies': {
name: 'API Proxies',
required: true
},
'environments':{
name: 'Environments',
required: true
},
'approvalType': {
name: 'Approval Type',
required: true
},
'quota' : {
name: 'Quota',
},
'quotaInterval':{
name: 'Quota Interval'
},
'quotaTimeUnit': {
name:'Quota Time Unit'
},
'scopes': {
name: "Scope",
}
});
module.exports.descriptor = descriptor;
module.exports.run = function(opts, cb) {
options.validateSync(opts, descriptor);
if (opts.debug) {
console.log('createProduct: %j', opts);
}
var request = defaults.defaultRequest(opts);
createProduct(opts, request, function(err, results) {
if (err) {
cb(err);
} else {
if (opts.debug) {
console.log('results: %j', results);
}
cb(undefined, results);
}
});
};
function createProduct(opts,request,done){
var product = {
"approvalType": "auto",
"attributes":
[ {"name": "access", "value": "public"} ],
"scopes": []
}
product.name = opts.productName
product.displayName = opts.productName
product.description = opts.productDesc
product.proxies = []
if(opts.proxies){
var split = opts.proxies.split(',')
split.forEach(function(s){
if(s && s.trim()!= '') {
product.proxies.push(s.trim())
}
})
}
product.apiResources = []
if(opts.apiResources){
var split = opts.apiResources.split(',')
split.forEach(function(s){
if(s && s.trim()!= '') {
product.apiResources.push(s.trim())
}
})
}
if(opts.scopes){
var split = opts.scopes.split(',')
split.forEach(function(s){
if(s && s.trim()!= '') {
product.scopes.push(s.trim())
}
})
}
product.environments = []
if(opts.environments){
var split = opts.environments.split(',')
split.forEach(function(s){
if(s && s.trim()!= '') {
product.environments.push(s.trim())
}
})
}
if(opts.quota && opts.quotaInterval && opts.quotaTimeUnit){
product.quota = opts.quota
product.quotaInterval = opts.quotaInterval
product.quotaTimeUnit = opts.quotaTimeUnit
}
var uri = util.format('%s/v1/o/%s/apiproducts', opts.baseuri, opts.organization);
request({
uri: uri,
method:'POST',
body: product,
json:true
},function(err,res,body){
var jsonBody = body
if(err){
if (opts.debug) {
console.log('Error occured %s', err);
}
done(err)
}else if (res.statusCode === 201) {
if (opts.verbose) {
console.log('Create successful');
}
if (opts.debug) {
console.log('%s', body);
}
done(undefined, jsonBody);
}else {
if (opts.verbose) {
console.error('Create Product result: %j', body);
}
var errMsg;
if (jsonBody && (jsonBody.message)) {
errMsg = jsonBody.message;
} else {
errMsg = util.format('Create Product failed with status code %d', res.statusCode);
}
done(new Error(errMsg));
}
})
}
| apigee-internal/apigeetool-node | lib/commands/createproduct.js | JavaScript | mit | 3,326 |
const zlib = require('zlib');
const log = require('winston');
const Mutex = require('../mutex');
const database = require('../models/mysql');
const ENV = process.env.NODE_ENV || 'development';
const config = ENV !== 'test' ? require('../config') : require('../config.sample');
// Constants
const CHARACTERS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const SECONDS_TO_TIMESTAMP = 43.45;
const MAX_ROWS = 30;
const MIN_MATCH_PERCENT = 0.1;
const MATCH_SLOP = 2;
// Exports
exports.decodeCodeString = decodeCodeString;
exports.cutFPLength = cutFPLength;
exports.getCodesToTimes = getCodesToTimes;
exports.bestMatchForQuery = bestMatchForQuery;
exports.getTrackMetadata = getTrackMetadata;
exports.ingest = ingest;
exports.SECONDS_TO_TIMESTAMP = SECONDS_TO_TIMESTAMP;
exports.MATCH_SLOP = MATCH_SLOP;
// Globals
const gTimestamp = +new Date();
const gMutex = Mutex.getMutex();
/**
* Takes a base64 encoded representation of a zlib-compressed code string
* and passes a fingerprint object to the callback.
*/
function decodeCodeString(codeStr, callback) {
// Fix url-safe characters
codeStr = codeStr.replace(/-/g, '+').replace(/_/g, '/');
// Expand the base64 data into a binary buffer
const compressed = new Buffer(codeStr, 'base64');
// Decompress the binary buffer into ascii hex codes
zlib.inflate(compressed, function(err, uncompressed) {
if (err) return callback(err, null);
// Convert the ascii hex codes into codes and time offsets
const fp = inflateCodeString(uncompressed);
log.debug('Inflated ' + codeStr.length + ' byte code string into ' +
fp.codes.length + ' codes');
callback(null, fp);
});
}
/**
* Takes an uncompressed code string consisting of zero-padded fixed-width
* sorted hex integers and converts it to the standard code string.
*/
function inflateCodeString(buf) {
// 5 hex bytes for hash, 5 hex bytes for time (40 bits per tuple)
const count = Math.floor(buf.length / 5);
const endTimestamps = count / 2;
let i;
const codes = new Array(count / 2);
const times = new Array(count / 2);
for (i = 0; i < endTimestamps; i++) {
times[i] = parseInt(buf.toString('ascii', i * 5, i * 5 + 5), 16);
}
for (i = endTimestamps; i < count; i++) {
codes[i - endTimestamps] = parseInt(buf.toString('ascii', i * 5, i * 5 + 5), 16);
}
// Sanity check
for (i = 0; i < codes.length; i++) {
if (isNaN(codes[i]) || isNaN(times[i])) {
log.error('Failed to parse code/time index ' + i);
return { codes: [], times: [] };
}
}
return { codes: codes, times: times };
}
/**
* Clamp this fingerprint to a maximum N seconds worth of codes.
*/
function cutFPLength(fp, maxSeconds) {
if (!maxSeconds) maxSeconds = 60;
const newFP = {};
for(const key in fp) {
if (fp.hasOwnProperty(key))
newFP[key] = fp[key];
}
const firstTimestamp = fp.times[0];
const sixtySeconds = maxSeconds * SECONDS_TO_TIMESTAMP + firstTimestamp;
for (const i = 0; i < fp.times.length; i++) {
if (fp.times[i] > sixtySeconds) {
log.debug('Clamping ' + fp.codes.length + ' codes to ' + i + ' codes');
newFP.codes = fp.codes.slice(0, i);
newFP.times = fp.times.slice(0, i);
return newFP;
}
}
newFP.codes = fp.codes.slice(0);
newFP.times = fp.times.slice(0);
return newFP;
}
/**
* Finds the closest matching track, if any, to a given fingerprint.
*/
function bestMatchForQuery(fp, threshold, callback) {
fp = cutFPLength(fp);
if (!fp.codes.length)
return callback('No valid fingerprint codes specified', null);
log.debug('Starting query with ' + fp.codes.length + ' codes');
database.fpQuery(fp, MAX_ROWS, function(err, matches) {
if (err) return callback(err, null);
if (!matches || !matches.length) {
log.debug('No matched tracks');
return callback(null, { status: 'NO_RESULTS' });
}
log.debug('Matched ' + matches.length + ' tracks, top code overlap is ' +
matches[0].score);
// If the best result matched fewer codes than our percentage threshold,
// report no results
if (matches[0].score < fp.codes.length * MIN_MATCH_PERCENT)
return callback(null, { status: 'MULTIPLE_BAD_HISTOGRAM_MATCH' });
// Compute more accurate scores for each track by taking time offsets into
// account
const newMatches = [];
for (const i = 0; i < matches.length; i++) {
const match = matches[i];
match.ascore = getActualScore(fp, match, threshold, MATCH_SLOP);
if (match.ascore && match.ascore >= fp.codes.length * MIN_MATCH_PERCENT)
newMatches.push(match);
}
matches = newMatches;
if (!matches.length) {
log.debug('No matched tracks after score adjustment');
return callback(null, { status: 'NO_RESULTS_HISTOGRAM_DECREASED' });
}
// Sort the matches based on actual score
matches.sort(function(a, b) { return b.ascore - a.ascore; });
// If we only had one track match, just use the threshold to determine if
// the match is good enough
if (matches.length === 1) {
if (matches[0].ascore / fp.codes.length >= MIN_MATCH_PERCENT) {
// Fetch metadata for the single match
log.debug('Single good match with actual score ' + matches[0].ascore +
'/' + fp.codes.length);
return getTrackMetadata(matches[0], matches,
'SINGLE_GOOD_MATCH_HISTOGRAM_DECREASED', callback);
} else {
log.debug('Single bad match with actual score ' + matches[0].ascore +
'/' + fp.codes.length);
return callback(null, { status: 'SINGLE_BAD_MATCH' });
}
}
const origTopScore = matches[0].ascore;
// Sort by the new adjusted score
matches.sort(function(a, b) { return b.ascore - a.score; });
const topMatch = matches[0];
const newTopScore = topMatch.ascore;
log.debug('Actual top score is ' + newTopScore + ', next score is ' +
matches[1].ascore);
// If the best result actually matched fewer codes than our percentage
// threshold, report no results
if (newTopScore < fp.codes.length * MIN_MATCH_PERCENT)
return callback(null, { status: 'MULTIPLE_BAD_HISTOGRAM_MATCH' });
// If the actual score was not close enough, then no match
if (newTopScore <= origTopScore / 2)
return callback(null, { status: 'MULTIPLE_BAD_HISTOGRAM_MATCH' });
// If the difference in actual scores between the first and second matches
// is not significant enough, then no match
if (newTopScore - matches[1].ascore < newTopScore / 2)
return callback(null, { status: 'MULTIPLE_BAD_HISTOGRAM_MATCH' });
// Fetch metadata for the top track
getTrackMetadata(topMatch, matches,
'MULTIPLE_GOOD_MATCH_HISTOGRAM_DECREASED', callback);
});
}
/**
* Attach track metadata to a query match.
*/
function getTrackMetadata(match, allMatches, status, callback) {
database.getTrack(match.track_id, function(err, track) {
if (err) return callback(err, null);
if (!track)
return callback('Track ' + match.track_id + ' went missing', null);
match.track = track.name;
match.artist = track.artist_name;
match.artist_id = track.artist_id;
match.length = track.length;
match.import_date = track.import_date;
callback(null, { success: true, status: status, match: match },
allMatches);
});
}
/**
* Build a mapping from each code in the given fingerprint to an array of time
* offsets where that code appears, with the slop factor accounted for in the
* time offsets. Used to speed up getActualScore() calculation.
*/
function getCodesToTimes(match, slop) {
const codesToTimes = {};
for (const i = 0; i < match.codes.length; i++) {
const code = match.codes[i];
const time = Math.floor(match.times[i] / slop) * slop;
if (codesToTimes[code] === undefined)
codesToTimes[code] = [];
codesToTimes[code].push(time);
}
return codesToTimes;
}
/**
* Computes the actual match score for a track by taking time offsets into
* account.
*/
function getActualScore(fp, match, threshold, slop) {
const MAX_DIST = 32767;
if (match.codes.length < threshold)
return 0;
const timeDiffs = {};
let i, j;
const matchCodesToTimes = getCodesToTimes(match, slop);
// Iterate over each {code,time} tuple in the query
for (i = 0; i < fp.codes.length; i++) {
const code = fp.codes[i];
const time = Math.floor(fp.times[i] / slop) * slop;
const minDist = MAX_DIST;
const matchTimes = matchCodesToTimes[code];
if (matchTimes) {
for (j = 0; j < matchTimes.length; j++) {
const dist = Math.abs(time - matchTimes[j]);
// Increment the histogram bucket for this distance
if (timeDiffs[dist] === undefined)
timeDiffs[dist] = 0;
timeDiffs[dist]++;
}
}
}
match.histogram = timeDiffs;
// Convert the histogram into an array, sort it, and sum the top two
// frequencies to compute the adjusted score
const keys = Object.keys(timeDiffs);
const array = new Array(keys.length);
for (i = 0; i < keys.length; i++)
array[i] = [ keys[i], timeDiffs[keys[i]] ];
array.sort(function(a, b) { return b[1] - a[1]; });
if (array.length > 1)
return array[0][1] + array[1][1];
else if (array.length === 1)
return array[0][1];
return 0;
}
/**
* Takes a track fingerprint (includes codes and time offsets plus any
* available metadata), adds it to the database and returns a track_id,
* artist_id, and artist name if available.
*/
function ingest(fp, callback) {
const MAX_DURATION = 60 * 60 * 4;
fp.codever = fp.codever || fp.version;
log.info('Ingesting track "' + fp.track + '" by artist "' + fp.artist +
'", ' + fp.length + ' seconds, ' + fp.codes.length + ' codes (' + fp.codever + ')');
if (!fp.codes.length)
return callback('Missing "codes" array', null);
if (typeof fp.length !== 'number')
return callback('Missing or invalid "length" field', null);
if (!fp.codever)
return callback('Missing or invalid "version" field', null);
if (!fp.track)
return callback('Missing or invalid "track" field', null);
if (!fp.artist)
return callback('Missing or invalid "artist" field', null);
fp = cutFPLength(fp, MAX_DURATION);
// Acquire a lock while modifying the database
gMutex.lock(function() {
// Check if this track already exists in the database
bestMatchForQuery(fp, config.code_threshold, function(err, res) {
if (err) {
gMutex.release();
return callback('Query failed: ' + err, null);
}
if (res.success) {
const match = res.match;
log.info('Found existing match with status ' + res.status +
', track ' + match.track_id + ' ("' + match.track + '") by "' +
match.artist + '"');
const checkUpdateArtist = function() {
if (!match.artist) {
// Existing artist is unnamed but we have a name now. Check if this
// artist name already exists in the database
log.debug('Updating track artist');
database.getArtistByName(fp.artist, function(err, artist) {
if (err) { gMutex.release(); return callback(err, null); }
if (artist) {
log.debug('Setting track artist_id to ' + artist.artist_id);
// Update the track to point to the existing artist
database.updateTrack(match.track_id, match.track,
artist.artist_id, function(err)
{
if (err) { gMutex.release(); return callback(err, null); }
match.artist_id = artist.artist_id;
match.artist = artist.name;
finished(match);
});
} else {
log.debug('Setting artist ' + artist.artist_id + ' name to "' +
artist.name + '"');
// Update the artist name
database.updateArtist(match.artist_id, fp.artist,
function(err)
{
if (err) { gMutex.release(); return callback(err, null); }
match.artist = fp.artist;
finished(match);
});
}
});
} else {
if (match.artist != fp.artist) {
log.warn('New artist name "' + fp.artist + '" does not match ' +
'existing artist name "' + match.artist + '" for track ' +
match.track_id);
}
log.debug('Skipping artist update');
finished(match);
}
};
const finished = function(match) {
// Success
log.info('Track update complete');
gMutex.release();
callback(null, { track_id: match.track_id, track: match.track,
artist_id: match.artist_id, artist: match.artist });
};
if (!match.track && fp.track) {
// Existing track is unnamed but we have a name now. Update the track
log.debug('Updating track name to "' + fp.track + '"');
database.updateTrack(match.track_id, fp.track, match.artist_id,
function(err)
{
if (err) { gMutex.release(); return callback(err, null); }
match.track = fp.track;
checkUpdateArtist();
});
} else {
log.debug('Skipping track name update');
checkUpdateArtist();
}
} else {
// Track does not exist in the database yet
log.debug('Track does not exist in the database yet, status ' +
res.status);
// Does this artist already exist in the database?
database.getArtistByName(fp.artist, function(err, artist) {
if (err) { gMutex.release(); return callback(err, null); }
if (!artist)
createArtistAndTrack();
else
createTrack(artist.artist_id, artist.name);
});
}
// Function for creating a new artist and new track
function createArtistAndTrack() {
log.debug('Adding artist "' + fp.artist + '"')
database.addArtist(fp.artist, function(err, artistID) {
if (err) { gMutex.release(); return callback(err, null); }
// Success
log.info('Created artist ' + artistID + ' ("' + fp.artist + '")');
createTrack(artistID, fp.artist);
});
}
// Function for creating a new track given an artistID
function createTrack(artistID, artist) {
log.debug('Adding track "' + fp.track + '" for artist "' + artist + '" (' + artistID + ')');
database.addTrack(artistID, fp, function(err, trackID) {
if (err) { gMutex.release(); return callback(err, null); }
// Success
log.info('Created track ' + trackID + ' ("' + fp.track + '")');
gMutex.release();
callback(null, { track_id: trackID, track: fp.track,
artist_id: artistID, artist: artist });
});
}
});
});
}
| andela-kakpobome/hazaam | api/node-echoprint-server/controllers/fingerprinter.js | JavaScript | mit | 15,052 |
//~ name b486
alert(b486);
//~ component b487.js
| homobel/makebird-node | test/projects/large/b486.js | JavaScript | mit | 52 |
'use strict';
var React = require('react');
var classNames = require('classnames');
var fecha = require('fecha');
var ClassNameMixin = require('./mixins/ClassNameMixin');
var dateUtils = require('./utils/dateUtils');
var Icon = require('./Icon');
var DatePicker = React.createClass({
mixins: [ClassNameMixin],
propTypes: {
onSelect: React.PropTypes.func.isRequired,
onClose: React.PropTypes.func,
getWidget: React.PropTypes.func,
onSubtractMonth: React.PropTypes.func,
onAddMonth: React.PropTypes.func,
viewMode: React.PropTypes.string,
minViewMode: React.PropTypes.string,
daysOfWeekDisabled: React.PropTypes.array,
format: React.PropTypes.string,
date: React.PropTypes.object,
weekStart: React.PropTypes.number,
minDate: React.PropTypes.string,
maxDate: React.PropTypes.string,
locale: React.PropTypes.string
},
getDefaultProps: function() {
return {
classPrefix: 'datepicker',
date: new Date(),
daysOfWeekDisabled: [],
viewMode: 'days',
minViewMode: 'days',
format: 'YYYY-MM-DD',
displayed: {
days: {display: 'block'},
months: {display: 'none'},
years: {display: 'none'}
}
};
},
getInitialState: function() {
var displayed;
switch (this.props.viewMode) {
case 'days':
displayed = {
days: {display: 'block'},
months: {display: 'none'},
years: {display: 'none'}
};
break;
case 'months':
displayed = {
days: {display: 'none'},
months: {display: 'block'},
years: {display: 'none'}
};
break;
case 'years':
displayed = {
days: {display: 'none'},
months: {display: 'none'},
years: {display: 'block'}
};
break;
}
return {
locale: dateUtils.getLocale(this.props.locale),
viewDate: this.props.date,
selectedDate: this.props.date,
displayed: displayed
};
},
// DaysPicker props function
subtractMonth: function() {
const { prevLoading, viewDate } = this.state;
if(prevLoading){
return;
}
var newDate = new Date(viewDate.valueOf());
newDate.setMonth(viewDate.getMonth() - 1);
const { onSubtractMonth } = this.props;
if(onSubtractMonth) {
this.setState({
prevLoading: true
});
onSubtractMonth(newDate, () => {
this.setState({
viewDate: newDate,
prevLoading: false
});
});
}
else{
this.setState({
viewDate: newDate
});
}
},
addMonth: function() {
const { nextLoadingIcon, viewDate } = this.state;
if(nextLoadingIcon){
return;
}
var newDate = new Date(viewDate.valueOf());
newDate.setMonth(viewDate.getMonth() + 1);
const { onAddMonth } = this.props;
if(onAddMonth) {
this.setState({
nextLoading: true
});
onAddMonth(newDate, () => {
this.setState({
viewDate: newDate,
nextLoading: false
});
});
}
else{
this.setState({
viewDate: newDate
});
}
},
setSelectedDate: function(params) {
const { className, date } = params;
if (/disabled|new|old/ig.test(className)) {
return;
}
var viewDate = this.state.viewDate;
//if (/new/ig.test(className)) {
// viewDate.setMonth(viewDate.getMonth() + 1);
//} else if (/old/ig.test(className)) {
// viewDate.setMonth(viewDate.getMonth() - 1);
//}
viewDate.setDate(date);
this.setViewDate(viewDate);
},
setViewDate: function(viewDate) {
this.setState({
viewDate: viewDate,
selectedDate: new Date(viewDate.valueOf())
}, function() {
this.props.onSelect(this.state.selectedDate);
this.props.onClose && this.props.onClose();
});
},
showMonths: function() {
return this.setState({
displayed: {
days: {display: 'none'},
months: {display: 'block'},
years: {display: 'none'}
}
});
},
// MonthsPicker props function
subtractYear: function() {
var viewDate = this.state.viewDate;
var newDate = new Date(viewDate.valueOf());
newDate.setFullYear(viewDate.getFullYear() - 1);
return this.setState({
viewDate: newDate
});
},
addYear: function() {
var viewDate = this.state.viewDate;
var newDate = new Date(viewDate.valueOf());
newDate.setFullYear(viewDate.getFullYear() + 1);
return this.setState({
viewDate: newDate
});
},
showYears: function() {
return this.setState({
displayed: {
days: {display: 'none'},
months: {display: 'none'},
years: {display: 'block'}
}
});
},
setViewMonth: function(event) {
var viewDate = this.state.viewDate;
var month = event.target.innerHTML;
var months = this.state.locale.monthsShort;
var i = 0;
var len = months.length;
for (; i < len; i++) {
if (month === months[i]) {
viewDate.setMonth(i);
}
}
if (this.props.minViewMode === 'months') {
this.setViewDate(viewDate);
}
this.setState({
viewDate: viewDate,
displayed: {
days: {display: 'block'},
months: {display: 'none'},
years: {display: 'none'}
}
});
},
// YearsPicker props function
setViewYear: function(event) {
var year = event.target.innerHTML;
var viewDate = this.state.viewDate;
viewDate.setFullYear(year);
if (this.props.minViewMode === 'years') {
this.setViewDate(viewDate);
}
this.setState({
viewDate: viewDate,
displayed: {
days: {display: 'none'},
months: {display: 'block'},
years: {display: 'none'}
}
});
},
addDecade: function() {
var viewDate = this.state.viewDate;
var newDate = new Date(viewDate.valueOf());
newDate.setFullYear(viewDate.getFullYear() + 10);
this.setState({
viewDate: newDate
});
},
subtractDecade: function() {
var viewDate = this.state.viewDate;
var newDate = new Date(viewDate.valueOf());
newDate.setFullYear(viewDate.getFullYear() - 10);
this.setState({
viewDate: newDate
});
},
// render children
renderDays: function() {
return (
<DaysPicker
{...this.state}
subtractMonth={this.subtractMonth}
addMonth={this.addMonth}
setSelectedDate={this.setSelectedDate}
showMonths={this.showMonths}
getWidget={this.props.getWidget}
weekStart={this.props.weekStart}
daysOfWeekDisabled={this.props.daysOfWeekDisabled}
minDate={this.props.minDate}
maxDate={this.props.maxDate}
/>
);
},
renderMonths: function() {
return (
<MonthsPicker
style={this.state.displayed.months}
locale={this.state.locale}
addYear={this.addYear}
subtractYear={this.subtractYear}
viewDate={this.state.viewDate}
selectedDate={this.state.selectedDate}
showYears={this.showYears}
setViewMonth={this.setViewMonth} />
);
},
renderYears: function() {
return (
<YearsPicker
style={this.state.displayed.years}
viewDate={this.state.viewDate}
selectDate={this.state.selectedDate}
setViewYear={this.setViewYear}
addDecade={this.addDecade}
subtractDecade={this.subtractDecade} />
);
},
render: function() {
return (
<div className={this.prefixClass('body')}>
{this.renderDays()}
{this.renderMonths()}
{this.renderYears()}
</div>
);
}
});
var DaysPicker = React.createClass({
mixins: [ClassNameMixin],
//propTypes: {
// subtractMonth: React.PropTypes.func.isRequired,
// addMonth: React.PropTypes.func.isRequired,
//
// setSelectedDate: React.PropTypes.func.isRequired,
// selectedDate: React.PropTypes.object.isRequired,
//
// viewDate: React.PropTypes.object.isRequired,
// showMonths: React.PropTypes.func.isRequired,
//
// locale: React.PropTypes.object,
// weekStart: React.PropTypes.number,
// daysOfWeekDisabled: React.PropTypes.array,
// minDate: React.PropTypes.string,
// maxDate: React.PropTypes.string
//},
getInitialState: function() {
return {
prevLoading: this.props.prevLoading,
nextLoading: this.props.nextLoading
};
},
getDefaultProps: function() {
return {
classPrefix: 'datepicker'
};
},
renderDays: function(getWidget = ({year, month, date}) => date) {
var row;
var i;
var _ref;
var _i;
var _len;
var prevY;
var prevM;
var classes = {};
var html = [];
var cells = [];
var weekStart = this.props.weekStart || this.props.locale.weekStart;
var weekEnd = ((weekStart + 6) % 7);
var d = this.props.viewDate;
var year = d.getFullYear();
var month = d.getMonth();
var selectedDate = this.props.selectedDate;
var currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate(), 0, 0, 0, 0).valueOf();
var prevMonth = new Date(year, month - 1, 28, 0, 0, 0, 0);
var day = dateUtils.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
prevMonth.setDate(day);
prevMonth.setDate(day - (prevMonth.getDay() - weekStart + 7) % 7);
var nextMonth = new Date(prevMonth);
nextMonth.setDate(nextMonth.getDate() + 42);
nextMonth = nextMonth.valueOf();
var minDate = this.props.minDate && fecha.parse(this.props.minDate);
var maxDate = this.props.maxDate && fecha.parse(this.props.maxDate);
while (prevMonth.valueOf() < nextMonth) {
classes[this.prefixClass('day')] = true;
prevY = prevMonth.getFullYear();
prevM = prevMonth.getMonth();
// set className old new
if ((prevM < month && prevY === year) || prevY < year) {
classes[this.prefixClass('old')] = true;
} else if ((prevM > month && prevY === year) || prevY > year) {
classes[this.prefixClass('new')] = true;
}
// set className active
if (prevMonth.valueOf() === currentDate) {
classes[this.setClassNamespace('active')] = true;
}
// set className disabled
if ((minDate && prevMonth.valueOf() < minDate)
|| (maxDate && prevMonth.valueOf() > maxDate)) {
classes[this.setClassNamespace('disabled')] = true;
}
// week disabled
if (this.props.daysOfWeekDisabled) {
_ref = this.props.daysOfWeekDisabled;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
i = _ref[_i];
if (prevMonth.getDay() === this.props.daysOfWeekDisabled[i]) {
classes[this.setClassNamespace('disabled')] = true;
break;
}
}
}
let date = prevMonth.getDate();
let className = classNames(classes);
cells.push(
<td
key={prevMonth.getMonth() + '-' + date}
className={className}
onClick={() => this.props.setSelectedDate({
className,
date
})}>
{getWidget({
year: d.getFullYear(),
month: prevMonth.getMonth(),
date
})}
</td>
);
// add tr
if (prevMonth.getDay() === weekEnd) {
row = <tr key={prevMonth.getMonth() + '-' + prevMonth.getDate()}>{cells}</tr>;
html.push(row);
cells = [];
}
classes = {};
prevMonth.setDate(prevMonth.getDate() + 1);
}
return html;
},
renderWeek: function() {
var ths = [];
var locale = this.props.locale;
var weekStart = this.props.weekStart || this.props.locale.weekStart;
var weekEnd = weekStart + 7;
while (weekStart < weekEnd) {
ths.push(
<th key={weekStart} className={this.prefixClass('dow')}>
{locale.daysMin[weekStart++ % 7]}
</th>
);
}
return (
<tr>
{ths}
</tr>
);
},
componentWillReceiveProps: function(nextProps) {
const { prevLoading, nextLoading } = nextProps;
this.setState({
prevLoading,
nextLoading
})
},
render: function() {
var prefixClass = this.prefixClass;
var { viewDate, locale, getWidget } = this.props;
return (
<div
className={prefixClass('days')}
style={this.props.displayed.days}>
<table className={prefixClass('table')}>
<thead>
<tr className={prefixClass('header')}>
<th className={prefixClass('prev')} onClick={this.props.subtractMonth}>
{
this.state.prevLoading ?
<Icon spin icon="circle-o-notch" />
:
<i className={prefixClass('prev-icon')}></i>
}
</th>
<th
className={prefixClass('switch')}
colSpan="5"
onClick={this.props.showMonths}>
<div className={this.prefixClass('select')}>
{locale.monthsShort[viewDate.getMonth()]}
{viewDate.getFullYear()}
</div>
</th>
<th className={prefixClass('next')} onClick={this.props.addMonth}>
{
this.state.nextLoading ?
<Icon spin icon="circle-o-notch" />
:
<i className={prefixClass('next-icon')}></i>
}
</th>
</tr>
{this.renderWeek()}
</thead>
<tbody>
{this.renderDays(getWidget)}
</tbody>
</table>
</div>
);
}
});
var MonthsPicker = React.createClass({
mixins: [ClassNameMixin],
propTypes: {
locale: React.PropTypes.object,
subtractYear: React.PropTypes.func.isRequired,
addYear: React.PropTypes.func.isRequired,
viewDate: React.PropTypes.object.isRequired,
selectedDate: React.PropTypes.object.isRequired,
showYears: React.PropTypes.func.isRequired,
setViewMonth: React.PropTypes.func.isRequired,
minDate: React.PropTypes.string,
maxDate: React.PropTypes.string
},
getDefaultProps: function() {
return {
classPrefix: 'datepicker'
};
},
renderMonths: function() {
var classes = {};
var month = this.props.selectedDate.getMonth();
var year = this.props.selectedDate.getFullYear();
var i = 0;
var months = [];
var minDate = this.props.minDate && fecha.parse(this.props.minDate);
var maxDate = this.props.maxDate && fecha.parse(this.props.maxDate);
var prevMonth = new Date(year, month);
// TODO: minDate maxDate months
while (i < 12) {
classes[this.prefixClass('month')] = true;
if (this.props.viewDate.getFullYear() ===
this.props.selectedDate.getFullYear()
&& i === month) {
classes[this.setClassNamespace('active')] = true;
}
// set className disabled
if ((minDate && prevMonth.valueOf() < minDate)
|| (maxDate && prevMonth.valueOf() > maxDate)) {
classes[this.setClassNamespace('disabled')] = true;
}
months.push(
<span
className={classNames(classes)}
onClick={this.props.setViewMonth}
key={i}>
{this.props.locale.monthsShort[i]}
</span>
);
classes = {};
i++;
}
return months;
},
render: function() {
return (
<SubPicker
displayName="months"
style={this.props.style}
subtract={this.props.subtractYear}
add={this.props.addYear}
showFunc={this.props.showYears}
showText={this.props.viewDate.getFullYear()}
body={this.renderMonths()} />
);
}
});
var YearsPicker = React.createClass({
mixins: [ClassNameMixin],
propTypes: {
viewDate: React.PropTypes.object.isRequired,
selectDate: React.PropTypes.object.isRequired,
subtractDecade: React.PropTypes.func.isRequired,
addDecade: React.PropTypes.func.isRequired,
setViewYear: React.PropTypes.func.isRequired
},
getDefaultProps: function() {
return {
classPrefix: 'datepicker'
};
},
renderYears: function() {
var classes = {};
var years = [];
var i = -1;
var year = parseInt(this.props.viewDate.getFullYear() / 10, 10) * 10;
year--;
while (i < 11) {
classes[this.prefixClass('year')] = true;
if (i === -1 || i === 10) {
classes[this.prefixClass('old')] = true;
}
if (this.props.selectDate.getFullYear() === year) {
classes[this.setClassNamespace('active')] = true;
}
years.push(
<span
className={classNames(classes)}
onClick={this.props.setViewYear}
key={year}>
{year}
</span>
);
classes = {};
year++;
i++;
}
return years;
},
render: function() {
var year = parseInt(this.props.viewDate.getFullYear() / 10, 10) * 10;
var addYear = year + 9;
var showYear = year + '-' + addYear;
return (
<SubPicker
displayName="years"
style={this.props.style}
subtract={this.props.subtractDecade}
add={this.props.addDecade}
showText={showYear}
body={this.renderYears()} />
);
}
});
var SubPicker = React.createClass({
mixins: [ClassNameMixin],
getDefaultProps: function() {
return {
classPrefix: 'datepicker'
};
},
render: function() {
var prefixClass = this.prefixClass;
return (
<div
className={prefixClass(this.props.displayName)}
style={this.props.style}>
<table className={prefixClass('table')}>
<thead>
<tr className={prefixClass('header')}>
<th className={prefixClass('prev')} onClick={this.props.subtract}>
<i className={prefixClass('prev-icon')}></i>
</th>
<th
className={prefixClass('switch')}
colSpan="5"
onClick={this.props.showFunc}>
<div className={this.prefixClass('select')}>
{this.props.showText}
</div>
</th>
<th className={prefixClass('next')} onClick={this.props.add}>
<i className={prefixClass('next-icon')}></i>
</th>
</tr>
</thead>
<tbody>
<tr>
<td colSpan="7">
{this.props.body}
</td>
</tr>
</tbody>
</table>
</div>
);
}
});
module.exports = DatePicker;
| sunnylqm/amazeui-react | src/DatePicker.js | JavaScript | mit | 18,696 |
/* ========================================================================
* DOM-based Routing
* Based on http://goo.gl/EUTi53 by Paul Irish
*
* Only fires on body classes that match. If a body class contains a dash,
* replace the dash with an underscore when adding it to the object below.
*
* .noConflict()
* The routing is enclosed within an anonymous function so that you can
* always reference jQuery with $, even when in .noConflict() mode.
* ======================================================================== */
(function($) {
// Use this variable to set up the common and page specific functions. If you
// rename this variable, you will also need to rename the namespace below.
var Gruntd = {
// All pages
'common': {
init: function() {
// JavaScript to be fired on all pages
},
finalize: function() {
// JavaScript to be fired on all pages, after page specific JS is fired
}
},
// Home page
'home': {
init: function() {
// JavaScript to be fired on the home page
},
finalize: function() {
// JavaScript to be fired on the home page, after the init JS
}
},
// About us page, note the change from about-us to about_us.
'about_us': {
init: function() {
// JavaScript to be fired on the about us page
}
}
};
// The routing fires all common scripts, followed by the page specific scripts.
// Add additional events for more control over timing e.g. a finalize event
var UTIL = {
fire: function(func, funcname, args) {
var fire;
var namespace = Gruntd;
funcname = (funcname === undefined) ? 'init' : funcname;
fire = func !== '';
fire = fire && namespace[func];
fire = fire && typeof namespace[func][funcname] === 'function';
if (fire) {
namespace[func][funcname](args);
}
},
loadEvents: function() {
// Fire common init JS
UTIL.fire('common');
// Fire page-specific init JS, and then finalize JS
$.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) {
UTIL.fire(classnm);
UTIL.fire(classnm, 'finalize');
});
// Fire common finalize JS
UTIL.fire('common', 'finalize');
}
};
// Load Events
$(document).ready(UTIL.loadEvents);
})(jQuery); // Fully reference jQuery after this point. | GFargo/gruntd | assets/js/src/main.js | JavaScript | mit | 2,425 |
var searchData=
[
['barelog_5fbuf_5fmax_5fsize',['BARELOG_BUF_MAX_SIZE',['../barelog__internal_8h.html#a8d9cd5cdc907ebe2a557b3ab745a7da2',1,'barelog_internal.h']]],
['barelog_5fbuffer_2eh',['barelog_buffer.h',['../barelog__buffer_8h.html',1,'']]],
['barelog_5fcheck_5fmode',['BARELOG_CHECK_MODE',['../barelog__config_8h.html#a21643c66dcad774fec1747abf3f7833b',1,'barelog_config.h']]],
['barelog_5fclean',['barelog_clean',['../barelog__logger_8h.html#a35151c45dc22a94d4ef0b1e8d8da34d7',1,'barelog_logger.h']]],
['barelog_5fclean_5fbuffer',['barelog_clean_buffer',['../barelog__logger_8h.html#a38ece7d71d09e3965c534f9b39b02ebb',1,'barelog_logger.h']]],
['barelog_5fclean_5fmemory',['barelog_clean_memory',['../barelog__logger_8h.html#a18b4d799895114f1cef69879206f9c43',1,'barelog_logger.h']]],
['barelog_5fconfig_2eh',['barelog_config.h',['../barelog__config_8h.html',1,'']]],
['barelog_5fdebug_5flog',['barelog_debug_log',['../barelog__device__mem__manager_8h.html#ae41a0e6ea107251288d2e0ca4de4c81e',1,'barelog_device_mem_manager.c']]],
['barelog_5fdebug_5fmem_5fsize',['BARELOG_DEBUG_MEM_SIZE',['../barelog__internal_8h.html#a5443c867d828e16a561c6202f18a4927',1,'barelog_internal.h']]],
['barelog_5fdebug_5fmode_5fi',['BARELOG_DEBUG_MODE_I',['../barelog__internal_8h.html#ab843abc36635fd4f46988ded99b1d4a6',1,'barelog_internal.h']]],
['barelog_5fdebug_5foff',['BARELOG_DEBUG_OFF',['../barelog__internal_8h.html#a372dbd94e3623bd817e72b79208968ae',1,'barelog_internal.h']]],
['barelog_5fdevice_5fmem_5fmanager_2eh',['barelog_device_mem_manager.h',['../barelog__device__mem__manager_8h.html',1,'']]],
['barelog_5fdevice_5fmem_5fmanager_5ft',['barelog_device_mem_manager_t',['../structbarelog__device__mem__manager__t.html',1,'']]],
['barelog_5ferr',['BARELOG_ERR',['../barelog__internal_8h.html#ae86020de5c6cb50535fefba1017d4b76',1,'barelog_internal.h']]],
['barelog_5fevent_2eh',['barelog_event.h',['../barelog__event_8h.html',1,'']]],
['barelog_5fevent_5fbuffer_5ft',['barelog_event_buffer_t',['../structbarelog__event__buffer__t.html',1,'']]],
['barelog_5fevent_5fconversion_5ferr',['BARELOG_EVENT_CONVERSION_ERR',['../barelog__internal_8h.html#adf293d3662c5eb9dde0a9131b6788c5a',1,'barelog_internal.h']]],
['barelog_5fevent_5finitializer',['BARELOG_EVENT_INITIALIZER',['../barelog__event_8h.html#a2da2edea64e53dd86c4d7480987b260c',1,'barelog_event.c']]],
['barelog_5fevent_5fmax_5fsize',['BARELOG_EVENT_MAX_SIZE',['../barelog__config_8h.html#adbd7a03a709aa4ad63455907ff05b98a',1,'barelog_config.h']]],
['barelog_5fevent_5fper_5fcore_5fmax',['BARELOG_EVENT_PER_CORE_MAX',['../barelog__internal_8h.html#a0db5f41516ff95d960031b9e9710015e',1,'barelog_internal.h']]],
['barelog_5fevent_5fper_5fcore_5fshr_5fmem_5fmax',['BARELOG_EVENT_PER_CORE_SHR_MEM_MAX',['../barelog__internal_8h.html#a75ca1f6b4314062cd744575f81c95d14',1,'barelog_internal.h']]],
['barelog_5fevent_5fshared_5fmem_5fmax',['BARELOG_EVENT_SHARED_MEM_MAX',['../barelog__config_8h.html#a3678960a8851bdd48135dff9c5213e7a',1,'barelog_config.h']]],
['barelog_5fevent_5fto_5fstring',['barelog_event_to_string',['../barelog__event_8h.html#a6ab0a60f23ea76c67dd90f4cb0ee3faf',1,'barelog_event.c']]],
['barelog_5fevents_5fto_5fstrings',['barelog_events_to_strings',['../barelog__event_8h.html#a5823fda9b5116074be16949a43bb59dc',1,'barelog_event.c']]],
['barelog_5fflush',['barelog_flush',['../barelog__logger_8h.html#a4e17f1118b4323a4713ad3fd44029ad6',1,'barelog_logger.h']]],
['barelog_5fflush_5fbuffer',['barelog_flush_buffer',['../barelog__logger_8h.html#a1f8c580e0d20aa7b1e46ac6460d3dc75',1,'barelog_logger.h']]],
['barelog_5fhost_2eh',['barelog_host.h',['../barelog__host_8h.html',1,'']]],
['barelog_5fhost_5ffinalize',['barelog_host_finalize',['../barelog__host_8h.html#a251f4daf501e3e81586ebccebeacabe9',1,'barelog_host.h']]],
['barelog_5fhost_5finit',['barelog_host_init',['../barelog__host_8h.html#adc51587704401a7222bd82433c881477',1,'barelog_host.h']]],
['barelog_5fhost_5fmem_5fmanager_2eh',['barelog_host_mem_manager.h',['../barelog__host__mem__manager_8h.html',1,'']]],
['barelog_5fhost_5fmem_5fmanager_5ft',['barelog_host_mem_manager_t',['../structbarelog__host__mem__manager__t.html',1,'']]],
['barelog_5fhost_5fnb_5fmem_5fspace',['BARELOG_HOST_NB_MEM_SPACE',['../barelog__internal_8h.html#a8b7b9073115ca0b347395e670a18b5ae',1,'barelog_internal.h']]],
['barelog_5fimmediate_5flog',['barelog_immediate_log',['../barelog__logger_8h.html#a077e57831374ce9a9d03ba3f219e9aab',1,'barelog_logger.c']]],
['barelog_5finconsistent_5fparam_5ferr',['BARELOG_INCONSISTENT_PARAM_ERR',['../barelog__internal_8h.html#abe27725d8e59d581efada773fd7fb744',1,'barelog_internal.h']]],
['barelog_5finit_5ferr',['BARELOG_INIT_ERR',['../barelog__internal_8h.html#ae561d4cd02833b3e78fb34330b3c584d',1,'barelog_internal.h']]],
['barelog_5finit_5flogger',['barelog_init_logger',['../barelog__logger_8h.html#a6c9c8e207a3c017a4af8fc45740c810e',1,'barelog_logger.c']]],
['barelog_5finternal_2eh',['barelog_internal.h',['../barelog__internal_8h.html',1,'']]],
['barelog_5fis_5fbuffer_5ffull',['barelog_is_buffer_full',['../barelog__logger_8h.html#a708663a1f867c54263802c197f2ea9a9',1,'barelog_logger.h']]],
['barelog_5flocal_5fmem_5fattribute',['BARELOG_LOCAL_MEM_ATTRIBUTE',['../barelog__config_8h.html#af198078f08d5e61dc440b2cf7e31286b',1,'barelog_config.h']]],
['barelog_5flocal_5fmem_5fper_5fcore',['BARELOG_LOCAL_MEM_PER_CORE',['../barelog__config_8h.html#a46d23e6eb872fe6d3c97dbcd52005386',1,'barelog_config.h']]],
['barelog_5flog',['barelog_log',['../barelog__logger_8h.html#a3f42b27ec9aa7b19502fe9db114a39f4',1,'barelog_logger.c']]],
['barelog_5flogger_2eh',['barelog_logger.h',['../barelog__logger_8h.html',1,'']]],
['barelog_5flogger_5ft',['barelog_logger_t',['../structbarelog__logger__t.html',1,'']]],
['barelog_5flvl_5ft',['barelog_lvl_t',['../barelog__logger_8h.html#a09445da48188bdd9761a1d9bf15deade',1,'barelog_logger.h']]],
['barelog_5fmem_5fspace_2eh',['barelog_mem_space.h',['../barelog__mem__space_8h.html',1,'']]],
['barelog_5fmutex_5ftry_5fmax',['BARELOG_MUTEX_TRY_MAX',['../barelog__internal_8h.html#ad3cba03f5fc2b6448a15ea8a34f0e87c',1,'barelog_internal.h']]],
['barelog_5fnb_5fcores',['BARELOG_NB_CORES',['../barelog__config_8h.html#a3405b9c787df23d99fcc3dad7c0420fe',1,'barelog_config.h']]],
['barelog_5fnb_5fmutex_5fbytes',['BARELOG_NB_MUTEX_BYTES',['../barelog__internal_8h.html#a56153de1682f3a1ddc452d6c87c227e4',1,'barelog_internal.h']]],
['barelog_5fparallella_2eh',['barelog_parallella.h',['../barelog__parallella_8h.html',1,'']]],
['barelog_5fplatform_2eh',['barelog_platform.h',['../barelog__platform_8h.html',1,'']]],
['barelog_5fplatform_5fname_5flength',['BARELOG_PLATFORM_NAME_LENGTH',['../barelog__config_8h.html#af3972df4d0e009ef87735cebe7fe05d5',1,'barelog_config.h']]],
['barelog_5fplatform_5ft',['barelog_platform_t',['../structbarelog__platform__t.html',1,'']]],
['barelog_5fpolicy_2eh',['barelog_policy.h',['../barelog__policy_8h.html',1,'']]],
['barelog_5fpolicy_5ft',['barelog_policy_t',['../barelog__policy_8h.html#adf17e1225b1df5ab70f4acb5a0eb2492',1,'barelog_policy.h']]],
['barelog_5fread_5fdebug',['barelog_read_debug',['../barelog__host_8h.html#af16c1c90ec01a10f79c15bca92b1b4e5',1,'barelog_host.h']]],
['barelog_5fread_5flog',['barelog_read_log',['../barelog__host_8h.html#a39f8463674313efe620ad779bed94bed',1,'barelog_host.h']]],
['barelog_5fresult_5fbuffer_5ft',['barelog_result_buffer_t',['../structbarelog__result__buffer__t.html',1,'']]],
['barelog_5fsafe_5fmem_5fsize',['BARELOG_SAFE_MEM_SIZE',['../barelog__internal_8h.html#a6ba206438e1c8724ce901ff59a29569f',1,'barelog_internal.h']]],
['barelog_5fsafe_5fmode_5fi',['BARELOG_SAFE_MODE_I',['../barelog__internal_8h.html#a6719c2e921ad3698290fdfc28302c4f7',1,'barelog_internal.h']]],
['barelog_5fshared_5fmem_5fbuffer_5ft',['barelog_shared_mem_buffer_t',['../structbarelog__shared__mem__buffer__t.html',1,'']]],
['barelog_5fshared_5fmem_5fdata_5foffset',['BARELOG_SHARED_MEM_DATA_OFFSET',['../barelog__internal_8h.html#a694628a89d860b954b30562d0c201af0',1,'barelog_internal.h']]],
['barelog_5fshared_5fmem_5fmax',['BARELOG_SHARED_MEM_MAX',['../barelog__internal_8h.html#a03842085df1dfd440a5dbb0032507fdb',1,'barelog_internal.h']]],
['barelog_5fshared_5fmem_5fper_5fcore_5fmax',['BARELOG_SHARED_MEM_PER_CORE_MAX',['../barelog__internal_8h.html#a81d48d8a2d9ba70a5710be211002df02',1,'barelog_internal.h']]],
['barelog_5fshrmem_5fmutex_5ft',['barelog_shrmem_mutex_t',['../barelog__internal_8h.html#a85371d0996813ce16cd2a06e448ecb9a',1,'barelog_internal.h']]],
['barelog_5fshrmem_5fread_5ferr',['BARELOG_SHRMEM_READ_ERR',['../barelog__internal_8h.html#a04e118632fee1fd5faf8712b889416c1',1,'barelog_internal.h']]],
['barelog_5fshrmem_5fwrite_5ferr',['BARELOG_SHRMEM_WRITE_ERR',['../barelog__internal_8h.html#a26d0e9c86ed3cc25b150255627659b88',1,'barelog_internal.h']]],
['barelog_5fstart',['barelog_start',['../barelog__logger_8h.html#ad368580e97a1ce261a3172f99e11efc0',1,'barelog_logger.c']]],
['barelog_5fsuccess',['BARELOG_SUCCESS',['../barelog__internal_8h.html#a7906d289cf4c344e7e93efe1330f0182',1,'barelog_internal.h']]],
['barelog_5ftimeout_5ferr',['BARELOG_TIMEOUT_ERR',['../barelog__internal_8h.html#a7921720d17d197465d04cdb33ba1804e',1,'barelog_internal.h']]],
['barelog_5funinitialized_5fparam_5ferr',['BARELOG_UNINITIALIZED_PARAM_ERR',['../barelog__internal_8h.html#a62a01b98a93da6ef07f3019c51c43779',1,'barelog_internal.h']]],
['buffer',['buffer',['../structbarelog__event__buffer__t.html#a788be0cb9a3d0b2fa0f2267751d291fd',1,'barelog_event_buffer_t::buffer()'],['../structbarelog__result__buffer__t.html#a676e81d3d45d9e435813ed4d8b1836a6',1,'barelog_result_buffer_t::buffer()']]],
['buffer_5flength',['buffer_length',['../structbarelog__result__buffer__t.html#ad807aed2908c3ad38248e48671962732',1,'barelog_result_buffer_t']]]
];
| SkinnerSweet/barelog | doc/html/search/all_1.js | JavaScript | mit | 9,924 |
// App.js
import React from 'react';
import { browserHistory } from 'react-router';
// import components
import NavBar from './navbar/components/NavBar';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {}
this.getComponentsXHR = this.getComponentsXHR.bind(this);
this.checkUser = this.checkUser.bind(this);
this.sendComponentsToStore = this.sendComponentsToStore.bind(this);
this.getPostsXHR = this.getPostsXHR.bind(this);
this.sendPostsToStore = this.sendPostsToStore.bind(this);
}
componentDidMount() {
this.getComponentsXHR();
this.getPostsXHR();
let token = localStorage.getItem('token');
if(!token) {
this.checkUser();
}
}
checkUser() {
let that = this;
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if(xhr.status === 200 && xhr.readyState === 4) {
that.handleUserData(JSON.parse(xhr.responseText));
}
}
xhr.open('GET', '/api/users');
xhr.send();
}
handleUserData(userData) {
if(userData.length === 0) {
browserHistory.push('/signup')
}
}
getComponentsXHR() {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if(xhr.status === 200 && xhr.readyState === 4) {
this.sendComponentsToStore(JSON.parse(xhr.responseText));
}
}
xhr.open('GET', '/api/plugins');
xhr.send();
}
sendComponentsToStore(pluginData) {
let plugins = [];
pluginData.forEach(plugin => {
plugins.push(plugin);
})
this.props.getComponents(plugins);
}
getPostsXHR() {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if(xhr.status === 200 && xhr.readyState === 4) {
this.sendPostsToStore(JSON.parse(xhr.responseText));
}
}
xhr.open('GET', '/api/posts');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send();
}
sendPostsToStore(postData) {
let posts = {};
postData.forEach(post => {
posts[post._id] = post;
})
this.props.getPosts(posts);
}
logoutUser() {
localStorage.removeItem('token');
localStorage.removeItem('userId')
}
render() {
return (
<div>
<NavBar hasToken={this.props.user} logoutUser={this.logoutUser} />
<div className="container-fluid">
{React.cloneElement(this.props.children, this.props)}
</div>
</div>
)
}
}
| synthesis-js/react-synthesis | admin/lib/App.js | JavaScript | mit | 2,467 |
const vboxm = require('./vboxm.js');
//vboxm.clone('8a07a800-4bef-4cc7-9581-6d03a2fab45f', 'vboxm.cloneテスト');
// vboxm.delete('db7cd51b-ac5b-4915-859e-20b88bcf68c2');
let name = 'aiueo,kakikukeko???kdfajlsd';
let regResult = name.match(/^[a-zA-Z0-9!\(\)-=^~\\|@`\[{;+:*\]},<.>/?\_ ]+$/);
console.log(regResult);
| okayumoka/vbwm | vm/test.js | JavaScript | mit | 322 |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function get() {
return _uxcorePopover.default;
}
});
var _uxcorePopover = _interopRequireDefault(require("uxcore-popover"));
module.exports = exports.default; | uxcore/uxcore | lib/Popover.js | JavaScript | mit | 405 |
/*
Load a block from github.io.
Accepts a url as a parameter which can include url parameters e.g. https://megjlow.github.io/extension2.js?name=SUN&ip=10.0.0.1
*/
new (function() {
var ext = this;
var descriptor = {
blocks: [
[' ', 'Load extension block ip %s', 'loadBlock', 'ip', 'ip'],
[' ', 'Load extension block name %s', 'loadBlock', 'name', 'name'],
],
url: 'http://www.warwick.ac.uk/tilesfortales'
};
ext._shutdown = function() {};
ext._getStatus = function() {
return {status: 2, msg: 'Device connected'}
};
ext.loadBlock = function(ip) {
ScratchExtensions.loadExternalJS("https://megjlow.github.io/socket.js?ip=" + ip);
};
ext.loadBlockName = function(name) {
ScratchExtensions.loadExternalJS("https://megjlow.github.io/socket.js?name=" + name);
};
ScratchExtensions.register("extensionloader", descriptor, ext);
}); | megjlow/megjlow.github.io | el.js | JavaScript | mit | 944 |