Merge remote-tracking branch 'upstream/master'

This commit is contained in:
David Deutsch
2015-04-15 09:18:47 -04:00
45 changed files with 4957 additions and 640 deletions
+1
View File
@@ -665,6 +665,7 @@ declare module angular {
// TODO undocumented, so we need to get it from the source code
///////////////////////////////////////////////////////////////////////////
interface IBrowserService {
defer: ng.ITimeoutService;
[key: string]: any;
}
+1 -1
View File
@@ -238,7 +238,7 @@ declare module Backbone {
initial(n: number): TModel[];
inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
isEmpty(object: any): boolean;
invoke(methodName: string, arguments?: any[]): any;
invoke(methodName: string, args?: any[]): any;
last(): TModel;
last(n: number): TModel[];
lastIndexOf(element: TModel, fromIndex?: number): number;
@@ -0,0 +1,68 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="bootstrap-touchspin.d.ts" />
$(function () {
// Example 1 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo1']").TouchSpin({
min: 0,
max: 100,
step: 0.1,
decimals: 2,
boostat: 5,
maxboostedstep: 10,
postfix: '%'
});
// Example 2 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo2']").TouchSpin({
min: -1000000000,
max: 1000000000,
stepinterval: 50,
maxboostedstep: 10000000,
prefix: '$'
});
// Example 3 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo_vertical']").TouchSpin({
verticalbuttons: true
});
// Example 4 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo_vertical2']").TouchSpin({
verticalbuttons: true,
verticalupclass: 'glyphicon glyphicon-plus',
verticaldownclass: 'glyphicon glyphicon-minus'
});
// Example 5 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo3']").TouchSpin();
// Example 6 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo3_21']").TouchSpin({
initval: 40
});
// Example 7 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo4']").TouchSpin({
postfix: "a button",
postfix_extraclass: "btn btn-default"
});
// Example 8 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo4_2']").TouchSpin({
postfix: "a button",
postfix_extraclass: "btn btn-default"
});
// Example 9 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo5']").TouchSpin({
prefix: "pre",
postfix: "post"
});
// Example 10 from http://www.virtuosoft.eu/code/bootstrap-touchspin/
$("input[name='demo6']").TouchSpin({
buttondown_class: "btn btn-link",
buttonup_class: "btn btn-link"
});
});
+130
View File
@@ -0,0 +1,130 @@
// Type definitions for Bootstrap TouchSpin
// Project: http://www.virtuosoft.eu/code/bootstrap-touchspin/
// Definitions by: Albin Sunnanbo <https://github.com/albinsunnanbo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/**
* TouchSpinOptions. All options are optional
*/
interface TouchSpinOptions {
/**
* Applied when no explicit value is set on the input with the value attribute.
* Empty string means that the value remains empty on initialization.
*/
initval?: number | string;
/**
* Minimum value.
*/
min?: number;
/**
* Maximum value.
*/
max?: number;
/**
* Incremental/decremental step on up/down change.
*/
step?: number;
/**
* How to force the value to be divisible by step value: 'none' | 'round' | 'floor' | 'ceil'
*/
forcestepdivisibility?: string;
/**
* Number of decimal points.
*/
decimals?: number;
/**
* Refresh rate of the spinner in milliseconds.
*/
stepinterval?: number;
/**
* Time in milliseconds before the spinner starts to spin.
*/
stepintervaldelay?: number;
/**
* Enables the traditional up/down buttons.
*/
verticalbuttons?: boolean;
/**
* Class of the up button with vertical buttons mode enabled.
*/
verticalupclass?: string;
/**
* Class of the down button with vertical buttons mode enabled.
*/
verticaldownclass?: string;
/**
* Text before the input.
*/
prefix?: string;
/**
* Text after the input.
*/
postfix?: string;
/**
* Extra class(es) for prefix.
*/
prefix_extraclass?: string;
/**
* Extra class(es) for postfix.
*/
postfix_extraclass?: string;
/**
* If enabled, the the spinner is continually becoming faster as holding the button.
*/
booster?: boolean;
/**
* Boost at every nth step.
*/
boostat?: number;
/**
* Maximum step when boosted.
*/
maxboostedstep?: number | boolean;
/**
* Enables the mouse wheel to change the value of the input.
*/
mousewheel?: boolean;
/**
* Class(es) of down button.
*/
buttondown_class?: string;
/**
* Class(es) of up button.
*/
buttonup_class?: string;
}
interface JQuery {
/**
* Initialize TouchSpin
*/
TouchSpin(): JQuery;
/**
* Inialize TouchSpin with options
* @param options a TouchSpinOptions object with one or more options
*/
TouchSpin(options: TouchSpinOptions): JQuery;
}
+28
View File
@@ -0,0 +1,28 @@
/// <reference path="calq.d.ts" />
function calq_base()
{
calq.init("bfff14a4e0225789be3d9d22c4bb42a1");
calq.init("bfff14a4e0225789be3d9d22c4bb42a1", { your: "config" });
calq.action.track("Product Review", {"Rating": 9.0});
calq.action.trackSale("Product Sale", { "Product Id": 149, "Product Name": "Dinosaur T-Shirt XL" }, "USD",10);
calq.action.trackHTMLLink('Link', { 'Target': 'Calq'});
calq.action.trackPageView();
calq.action.trackPageView("Custom Action");
calq.action.setGlobalProperty("Referral Source", "Google Campaign");
}
function calq_people()
{
calq.user.identify("1001");
calq.user.clear();
calq.user.profile( { "Company": "MegaCorp", "$email": "super_customer1@notarealemail.com" });
}
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for calq
// Project: https://calq.io/docs/client/javascript/reference
// Definitions by: Eirik Hoem <https://github.com/eirikhm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Calq
{
action:Calq.Action;
user:Calq.User;
init(writeKey:string, options?:{[index:string]:any}):void;
}
declare module Calq
{
interface Action
{
track(action:string, params?:{[index:string]:any}):void;
trackSale(action:string, params:{[index:string]:any}, currency:string, amount:number):void;
trackHTMLLink(action:string, params?:{[index:string]:any}):void;
trackPageView(action?:string):void;
setGlobalProperty(name:string,value:any):void;
}
interface User
{
identify(userId:string):void;
clear():void;
profile(params:{[index:string]:any}):void;
}
}
declare var calq:Calq;
+6 -6
View File
@@ -252,12 +252,12 @@ var myPolarAreaChart = new Chart(ctx).PolarArea(polarAreaData, {
var myPolarAreaChartLegend: string = myPolarAreaChart.generateLegend();
var myPolarAreaChartImage: string = myPolarAreaChart.toBase64Image();
myPolarAreaChart.addData([{
myPolarAreaChart.addData({
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}], 0);
}, 0);
myPolarAreaChart.clear();
myPolarAreaChart.removeData(0);
myPolarAreaChart.resize();
@@ -301,12 +301,12 @@ var myPieChart = new Chart(ctx).Pie(pieData, {
var myPieChartLegend: string = myPieChart.generateLegend();
var myPieChartImage: string = myPieChart.toBase64Image();
myPieChart.addData([{
myPieChart.addData({
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}], 0);
}, 0);
myPieChart.clear();
myPieChart.removeData(0);
myPieChart.resize();
@@ -329,12 +329,12 @@ var myDoughnutChart = new Chart(ctx).Doughnut(pieData, {
var myDoughnutChartLegend: string = myDoughnutChart.generateLegend();
var myDoughnutChartImage: string = myDoughnutChart.toBase64Image();
myPieChart.addData([{
myPieChart.addData({
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}], 0);
}, 0);
myDoughnutChart.clear();
myDoughnutChart.removeData(0);
myDoughnutChart.resize();
+2 -1
View File
@@ -113,8 +113,9 @@ interface LinearInstance extends ChartInstance {
interface CircularInstance extends ChartInstance {
getSegmentsAtEvent: (event: Event) => {}[];
update: () => void;
addData: (valuesArray: CircularChartData[], index: number) => void;
addData: (valuesArray: CircularChartData, index?: number) => void;
removeData: (index: number) => void;
segments: Array<CircularChartData>;
}
interface LineChartOptions extends ChartOptions {
+13 -8
View File
@@ -1,4 +1,4 @@
// Type definitions for Chosen.JQuery 0.9
// Type definitions for Chosen.JQuery 1.4.2
// Project: http://harvesthq.github.com/chosen/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -8,18 +8,23 @@
interface ChosenOptions {
allow_single_deselect?: boolean;
disable_search_threshold?: number;
disable_search?: boolean;
disable_search_threshold?: number;
enable_split_word_search?: boolean;
inherit_select_classes?: boolean;
max_selected_options?: number;
no_results_text?: string;
placeholder_text_multiple?: string;
placeholder_text_single?: string;
search_contains?: boolean;
single_backstroke_delete?: boolean;
max_selected_options?: number;
placeholder_text_multiple?: string;
placeholder_text?: string;
placeholder_text_single?: string;
no_results_text?: string;
width?: number;
display_disabled_options?: boolean;
display_selected_options?: boolean;
include_group_label_in_selected?: boolean;
}
interface JQuery {
chosen(): JQuery;
chosen(options: ChosenOptions): JQuery;
}
}
+8
View File
@@ -0,0 +1,8 @@
/// <reference path="dompurify.d.ts" />
import dompurify = require('dompurify');
dompurify.sanitize('<script>alert("hi")</script>');
dompurify.addHook('beforeSanitizeElements', (el, data, config) => {
return el;
});
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for DOM Purify
// Project: https://github.com/cure53/DOMPurify
// Definitions by: Dave Taylor <http://davetayls.me>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface IDOMPurify {
sanitize(s:string):string;
addHook(hook:string, cb:(currentNode:Element, data:any, config:any) => Element):void;
}
declare var DOMPurify:IDOMPurify;
declare module 'dompurify' {
export = DOMPurify;
}
+9 -9
View File
@@ -444,7 +444,7 @@ declare module Ember {
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
static initializer(arguments?: ApplicationInitializerArguments): void;
static initializer(args?: ApplicationInitializerArguments): void;
/**
Call advanceReadiness after any asynchronous setup logic has completed.
Each call to deferReadiness must be matched by a call to advanceReadiness
@@ -1318,9 +1318,9 @@ declare module Ember {
Creates an instance of the class.
@param arguments A hash containing values with which to initialize the newly instantiated object.
**/
static create<T extends Mixin>(arguments?: {}): T;
static create<T extends Mixin>(args: {}): T;
detect(obj: any): boolean;
reopen<T extends Mixin>(arguments?: {}): T;
reopen<T extends Mixin>(args?: {}): T;
}
class MutableArray implements Array, MutableEnumberable {
addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[];
@@ -1581,17 +1581,17 @@ declare module Ember {
/**
Creates a subclass of the Object class.
**/
static extend<T>(arguments?: CoreObjectArguments): T;
static extend<T>(mixins? : Mixin, arguments?: CoreObjectArguments): T;
static extend<T>(args?: CoreObjectArguments): T;
static extend<T>(mixins? : Mixin, args?: CoreObjectArguments): T;
/**
Creates an instance of the class.
@param arguments A hash containing values with which to initialize the newly instantiated object.
**/
static create<T extends {}>(arguments?: {}): T;
static create<T extends {}>(args?: {}): T;
/**
Equivalent to doing extend(arguments).create(). If possible use the normal create method instead.
**/
static createWithMixins<T extends {}>(arguments?: {}): T;
static createWithMixins<T extends {}>(args?: {}): T;
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
@@ -1608,13 +1608,13 @@ declare module Ember {
Augments a constructor's prototype with additional properties and functions.
To add functions and properties to the constructor itself, see reopenClass.
**/
static reopen<T extends {}>(arguments?: {}): T;
static reopen<T extends {}>(args?: {}): T;
/**
Augments a constructor's own properties and functions.
To add functions and properties to instances of a constructor by extending the
constructor's prototype see reopen.
**/
static reopenClass<T extends {}>(arguments?: {}): T;
static reopenClass<T extends {}>(args?: {}): T;
static isClass: boolean;
static isMethod: boolean;
addObserver: ModifyObserver;
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="express-debug.d.ts" />
import express = require('express');
import debug = require('express-debug');
var app = express();
debug(app, {
depth: 4,
theme: 'public/css/debug.css',
extra_panels: [{
name: 'mypanel',
template: '/absolute/path/to/mypanel.jade',
process: function(locals) {
return { locals: { mypanel: true, }};
}
}],
panels: ['locals', 'request', 'session'],
path: '/express-debug',
extra_attrs: '',
sort: false,
});
+83
View File
@@ -0,0 +1,83 @@
// Type definitions for express-debug 1.1.1
// Project: https://github.com/devoidfury/express-debug
// Definitions by: Federico Bond <https://github.com/federicobond/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* =================== USAGE ===================
import debug = require('express-debug');
debug(app, options);
=============================================== */
/// <reference path="../express/express.d.ts" />
declare module "express-debug" {
import express = require('express');
interface CustomPanel {
name: string;
template: string;
process(locals: any): any;
standalone?: boolean;
initialize?(req: express.Request): void;
finalize?(req: express.Request): void;
pre_render?(req: express.Request): void;
post_render?(req: express.Request): void;
options?: any;
}
/**
* Node.js middleware for serving a favicon.
*/
function debug(app: express.Application, settings?: {
/**
* How deep to recurse through printed objects. This is the default unless the
* print_obj function is passed an options object with a 'depth' property.
*/
depth?: number;
/**
* Absolute path to a css file to include and override EDT's default css.
*/
theme?: string;
/**
* Additional panels to show.
*/
extra_panels?: CustomPanel[];
/**
* Allows changing the default panel.
*/
panels?: string[];
/**
* Path to render standalone express-debug.
*/
path?: string;
/**
* If you need to add arbitrary attributes to the containing element of EDT,
* this allows you to.
*/
extra_attrs?: string;
/**
* Global option to determine sort order of printed object values. false for
* default order, true for basic default sort, or a function to use for sort.
*/
sort?: boolean | ((a: number, b: number) => number);
}): void;
export = debug;
}
+49
View File
@@ -1345,6 +1345,55 @@ declare module google.maps {
}
export module places {
export class AutocompleteService extends MVCObject {
constructor();
getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void;
getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void;
}
export interface AutocompletionRequest {
input: string;
bounds?: LatLngBounds;
componentRestrictions?: ComponentRestrictions;
location?: LatLng;
offset?: number;
radius?: number;
types?: string[];
}
export interface QueryAutocompletionRequest {
input: string;
bounds?: LatLngBounds;
location?: LatLng;
offset?: number;
radius?: number;
}
export interface AutocompletePrediction {
description: string;
matched_substrings: PredictionSubstring[];
place_id: string;
terms: PredictionTerm[];
types: string[]
}
export interface PredictionTerm {
offset: number;
value: string;
}
export interface PredictionSubstring {
length: number;
offset: number;
}
export interface QueryAutocompletePrediction {
description: string;
matched_substrings: PredictionSubstring[];
place_id: string;
terms: PredictionTerm[];
}
export class Autocomplete extends MVCObject {
constructor (inputField: HTMLInputElement, opts?: AutocompleteOptions);
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="grecaptcha.d.ts" />
var params: ReCaptchaV2.Parameters = {
"sitekey": "mySuperSecretKey",
"theme": "black", // no type-checking here.
"type": "image",
"tabindex": 5,
"callback": (response: string) => { },
"expired-callback": () => { },
}
var id1: number = grecaptcha.render("foo");
var id2: number = grecaptcha.render("foo", params);
var id3: number = grecaptcha.render(document.getElementById("foo"));
var id4: number = grecaptcha.render(document.getElementById("foo"), params);
// response takes a number and returns a string
var response1: string = grecaptcha.getResponse(id1);
// reset takes a number
grecaptcha.reset(id1);
+67
View File
@@ -0,0 +1,67 @@
// Type definitions for Google Recaptcha v2
// Project: https://www.google.com/recaptcha
// Definitions by: Kristof Mattei <http://kristofmattei.be>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var grecaptcha: ReCaptchaV2.ReCaptcha;
declare module ReCaptchaV2
{
class ReCaptcha
{
/**
* Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.
* @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself.
* @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters.
* @return the ID of the newly created widget.
**/
render(container: (string | HTMLElement), parameters?: Parameters): number;
/**
* Resets the reCAPTCHA widget.
* @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified.
**/
reset(opt_widget_id?: number): void;
/**
* Gets the response for the reCAPTCHA widget.
* @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified.
* @return the response of the reCAPTCHA widget.
**/
getResponse(opt_widget_id?: number): string;
}
interface Parameters
{
/**
* Your sitekey.
**/
sitekey: string;
/**
* Optional. The color theme of the widget.
* Accepted values: "light", "dark"
* @default "light"
**/
theme?: string;
/**
* Optional. The type of CAPTCHA to serve.
* Accepted values: "audio ", "image"
* @default "image"
**/
type?: string;
/**
* Optional. The tabindex of the widget and challenge.
* If other elements in your page use tabindex, it should be set to make user navigation easier.
**/
tabindex?: number;
/**
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
* The user's response, g-recaptcha-response, will be the input for your callback function.
**/
callback?: (response: string) => void;
/**
* Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA.
**/
// Notice to the reader
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
"expired-callback"?: () => void;
}
}
+13
View File
@@ -82,5 +82,18 @@ server.route([{
}
}]);
// config.validate parameters should be optional
server.route([{
method: 'GET',
path: '/hello2',
handler: function(request: Hapi.Request, reply: Function) {
reply('hello world2');
},
config: {
validate: {
}
}
}]);
// Start the server
server.start();
+7 -7
View File
@@ -568,7 +568,7 @@ declare module "hapi" {
optionsthe server validation options.
next(err, value)the callback function called when validation is completed.
*/
headers: boolean | IJoi | IValidationFunction;
headers?: boolean | IJoi | IValidationFunction;
/** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed:
@@ -579,7 +579,7 @@ declare module "hapi" {
valuethe object containing the path parameters.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
params: boolean | IJoi | IValidationFunction;
params?: boolean | IJoi | IValidationFunction;
/** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed:
trueany query parameters allowed (no validation performed).This is the default.
falseno query parameters allowed.
@@ -588,7 +588,7 @@ declare module "hapi" {
valuethe object containing the query parameters.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
query: boolean | IJoi | IValidationFunction;
query?: boolean | IJoi | IValidationFunction;
/** validation rules for an incoming request payload (request body).Values allowed:
trueany payload allowed (no validation performed).This is the default.
falseno payload allowed.
@@ -597,9 +597,9 @@ declare module "hapi" {
valuethe object containing the payload object.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
payload: boolean | IJoi | IValidationFunction;
payload?: boolean | IJoi | IValidationFunction;
/** an optional object with error fields copied into every validation error response. */
errorFields: any;
errorFields?: any;
/** determines how to handle invalid requests.Allowed values are:
'error'return a Bad Request (400) error response.This is the default value.
'log'log the error but continue processing the request.
@@ -609,9 +609,9 @@ declare module "hapi" {
replythe continuation reply interface.
sourcethe source of the invalid field (e.g. 'path', 'query', 'payload').
errorthe error object prepared for the client response (including the validation function error under error.data). */
failAction: string | IRouteFailFunction;
failAction?: string | IRouteFailFunction;
/** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */
options: any;
options?: any;
};
/** define timeouts for processing durations: */
timeout?: {
+55
View File
@@ -0,0 +1,55 @@
/// <reference path="jsonpath.d.ts" />
import jp = require('jsonpath');
var data: any;
/**
* jp.query(obj, pathExpression)
* Find elements in obj matching pathExpression. Returns an array of elements that satisfy the provided JSONPath expression, or an empty array if none were matched.
*/
var authors = jp.query(data, '$..author');
/**
* jp.paths(obj, pathExpression)
* Find elements in obj matching pathExpression. Returns an array of element paths that satisfy the provided JSONPath expression. Each path is itself an array of keys representing the location within obj of the matching element.
*/
var paths = jp.paths(data, '$..author');
/**
* jp.nodes(obj, pathExpression)
* Find elements and their corresponding paths in obj matching pathExpression. Returns an array of node objects where each node has a path containing an array of keys representing the location within obj, and a value pointing to the matched element.
*/
var nodes = jp.nodes(data, '$..author');
/**
* jp.value(obj, pathExpression, [newValue])
* Returns the value of the first element matching pathExpression. If newValue is provided, sets the value of the first matching element and returns the new value.
*/
var value = jp.value(data, '$.store..price');
jp.value(data, '$.store..price', 12.5);
/**
* jp.parent(obj, pathExpression)
* Returns the parent of the first matching element.
*/
var parent = jp.parent(data, '$.store..price');
/**
* jp.apply(obj, pathExpression, fn)
* Runs the supplied function fn on each matching element, and replaces each matching element with the return value from the function. The function accepts the value of the matching element as its only parameter. Returns matching nodes with their updated values.
*/
var nodes = jp.apply(data, '$..author', (value: string) => { return value.toUpperCase() });
/**
* jp.parse(pathExpression)
* Parse the provided JSONPath expression into path components and their associated operations.
*/
var path = jp.parse('$..author');
/**
* jp.stringify(path)
* Returns a path expression in string form, given a path. The supplied path may either be a flat array of keys, as returned by jp.nodes for example, or may alternatively be a fully parsed path expression in the form of an array of path components as returned by jp.parse.
*/
var pathExpression = jp.stringify(['$', 'store', 'book', 0, 'author']);
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for jsonpath 0.1.3
// Project: https://www.npmjs.org/package/jsonpath
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "jsonpath" {
type PathComponent = string|number;
export function query(obj: any, pathExpression: string): any[];
export function paths(obj: any, pathExpression: string): PathComponent[][];
export function nodes(obj: any, pathExpression: string): { path: PathComponent[]; value: any; }[];
export function value(obj: any, pathExpression: string): any;
export function value(obj: any, pathExpression: string, newValue: any): any;
export function parent(obj: any, pathExpression: string): any;
export function apply(obj: any, pathExpression: string, fn: (x: any) => any): { path: PathComponent[]; value: any; }[];
export function parse(pathExpression: string): any[];
export function stringify(path: PathComponent[]): string;
}
+20
View File
@@ -1573,6 +1573,26 @@ declare module L {
*/
getSouthEast(): LatLng;
/**
* Returns the west longitude in degrees of the bounds.
*/
getWest(): number;
/**
* Returns the east longitude in degrees of the bounds.
*/
getEast(): number;
/**
* Returns the north latitude in degrees of the bounds.
*/
getNorth(): number;
/**
* Returns the south latitude in degrees of the bounds.
*/
getSouth(): number;
/**
* Returns the center point of the bounds.
*/
+28
View File
@@ -0,0 +1,28 @@
/// <reference path="less-middleware.d.ts" />
import express = require('express');
import lessMiddleware = require('less-middleware');
var app = express();
app.use(lessMiddleware('public', {
cacheFile: null,
debug: false,
dest: 'dest',
force: false,
once: false,
pathRoot: 'root',
postprocess: {
css: function(css, req) { return css; },
},
preprocess: {
less: function(src, req) { return src; },
path: function(pathname, req) { return pathname; },
importPaths: function(paths, req) { return paths; }
},
render: {
compress: 'auto',
yuicompress: false,
paths: ['foo', 'bar']
},
storeCss: function(css, req, next) {},
}));
+108
View File
@@ -0,0 +1,108 @@
// Type definitions for less-middleware 2.0.1
// Project: https://github.com/emberfeather/less.js-middleware
// Definitions by: Federico Bond <https://github.com/federicobond/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* =================== USAGE ===================
import lessMiddleware = require('less-middleware');
app.use(lessMiddleware(source, options));
=============================================== */
/// <reference path="../express/express.d.ts" />
declare module "less-middleware" {
import express = require('express');
/**
* Middleware created to allow processing of Less files for Connect JS framework
* and by extension the Express JS framework
*/
function lessMiddleware(source: string, options?: {
/**
* Show more verbose logging?
*/
debug?: boolean;
/**
* Destination directory to output the compiled .css files.
*/
dest?: string;
/**
* Always re-compile less files on each request.
*/
force?: boolean;
/**
* Only recompile once after each server restart.
* Useful for reducing disk i/o on production.
*/
once?: boolean;
/**
* Common root of the source and destination.
* It is prepended to both the source and destination before being used.
*/
pathRoot?: string;
/**
* Object containing functions relevant to preprocessing data.
*/
postprocess?: {
/**
* Function that modifies the compiled css output before being stored.
*/
css?(css: string, req: express.Request): string;
};
/**
* Object containing functions relevant to preprocessing data.
*/
preprocess?: {
/**
* Function that modifies the raw less output before being parsed and compiled.
*/
less?(css: string, req: express.Request): string;
/**
* Function that modifies the less pathname before being loaded from the filesystem.
*/
path?(pathname: string, req: express.Request): string;
/**
* Function that modifies the import paths used by the less parser per request.
*/
importPaths?(paths: string[], req: express.Request): string[];
};
/**
* Options for the less render.
*/
render?: {
compress?: string;
yuicompress?: boolean;
paths?: string[];
};
/**
* Function that is in charge of storing the css in the filesystem.
*/
storeCss?(pathname: string, css: string, req: express.Request, next: Function): void;
/**
* Path to a JSON file that will be used to cache less data across server restarts.
* This can greatly speed up initial load time after a server restart - if the less
* files haven't changed and the css files still exist, specifying this option will
* mean that the less files don't need to be recompiled after a server restart.
*/
cacheFile?: string;
}): express.RequestHandler;
export = lessMiddleware;
}
+6 -27
View File
@@ -2,33 +2,12 @@
import less = require("less");
declare var __dirname: string;
less.render('.class { width: (1 + 1) }', (e, css) => console.log(css));
var parser: less.Parser = new less.Parser;
parser.parse('.class { width: (1 + 1) }', function (err, tree) {
if (err) return console.error(err);
tree.toCSS();
less.render(".class { width: (1 + 1) }").then((output) => {
console.log(output.css);
});
var parser2 = new less.Parser({
paths: ['.', './lib'],
filename: 'style.less'
less.render("fail").then((output) => {
throw new Error("promise should have been rejected");
}, () => {
console.log("rejected as expected");
});
parser2.parse('.class { width: (1 + 1) }', (e, tree) => tree.toCSS({ compress: true }));
var lessParser = new less.Parser({
paths: [__dirname],
filename: "out.less"
});
lessParser.parse('.class { width: (1 + 1) }', function (err, tree) {
tree.rules.forEach(function (rule) {
if (rule.path) {
console.log(rule.path);
}
});
});
+55 -536
View File
@@ -1,556 +1,75 @@
// Type definitions for LESS
// Project: http://lesscss.org/
// Definitions by: AndrewGaspar <https://github.com/AndrewGaspar>
// Definitions by: Tom Hasner <https://github.com/thasner>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module less {
class LessError {
constructor(e: Error, env);
declare module Less {
// Promise definitions from ../es6-promise/es6-promise.d.ts
interface Thenable<R> {
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
}
type: any;
message: string;
class Promise<R> implements Thenable<R> {
constructor(callback: (resolve : (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
finally<U>(finallyCallback: () => any): Promise<U>;
}
interface RootFileInfo {
filename: string;
index;
line: number;
callLine: number;
callExtract;
stack;
column;
extract: any[];
relativeUrls: boolean;
rootpath: string;
currentDirectory: string;
entryPath: string;
rootFilename: string;
}
class PluginManager {
constructor(less: LessStatic);
}
interface Plugin {
install: (less: LessStatic, pluginManager: PluginManager) => void;
}
interface SourceMapOption {
sourceMapURL: string;
sourceMapBasepath: string;
sourceMapRootpath: string;
outputSourceFiles: boolean;
sourceMapFileInline: boolean;
}
interface Options {
contents?;
rootpath?: string;
files?;
paths?: string[];
mime?: string;
sourceMap?: SourceMapOption;
filename?: string;
optimization?: number;
dumpLineNumbers?: boolean;
strictImports?;
entryPath?: string;
relativeUrls?;
errback? (path: string, paths: string[], callback: Function, env: Options);
frames?;
compress?: boolean;
plugins: Plugin[];
rootFileInfo?: RootFileInfo;
}
export module tree {
export module mixin { // TODO
export class Call {
}
export class Definition extends Ruleset {
}
}
export module functions {
export function rgb(r: number, g: number, b: number): Color;
export function rgba(r: number, g: number, b: number, a: number): Color;
export function hsl(h: number, s?: number, l?: number): Color;
export function hsla(h: number, s?: number, l?: number, a?: number): Color;
export function hsv(h: number, s: number, v: number): Color;
export function hsva(h: number, s: number, v: number, a: number): Color;
export function hue(color: Color): Dimension;
export function saturation(color: Color): Dimension;
export function lightness(color: Color): Dimension;
export function red(color: Color): Dimension;
export function green(color: Color): Dimension;
export function blue(color: Color): Dimension;
export function alpha(color: Color): Dimension;
export function luma(color: Color): Dimension;
export function saturate(color: Color, amount: IValuableNumber): Color;
export function desaturate(color: Color, amount: IValuableNumber): Color;
export function lighten(color: Color, amount: IValuableNumber): Color;
export function darken(color: Color, amount: IValuableNumber): Color;
export function fadein(color: Color, amount: IValuableNumber): Color;
export function fadeout(color: Color, amount: IValuableNumber): Color;
export function fade(color: Color, amount: IValuableNumber): Color;
export function spin(color: Color, amount: IValuableNumber): Color;
export function mix(color1: Color, color2: Color, weight: Dimension): Color;
export function greyscale(color: Color): Color;
export function contrast(color: Color, dark?: Color, light?: Color, threshold?: IValuableNumber): Color;
export function contrast(color: Color, dark?: Color, light?: Color, threshold?: number): Color;
export function e(str: string): Anonymous;
export function e(str: JavaScript): Anonymous;
export function escape(str: IValuableString): Anonymous;
export function unit(val: IValuableNumber, unit?: ICSSable): Dimension;
export function round(n: Dimension, f?: IValuableNumber): Dimension;
export function round(n: number, f?: IValuableNumber): number;
export function ceil(n: number): number;
export function ceil(n: Dimension): Dimension;
export function floor(n: number): number;
export function floor(n: Dimension): Dimension;
export function argb(color: Color): Anonymous;
export function percentage(n: IValuableNumber): Dimension;
export function color(n: Quoted): Color;
export function iscolor(n): Keyword;
export function isnumber(n): Keyword;
export function isstring(n): Keyword;
export function iskeyword(n): Keyword;
export function isurl(n): Keyword;
export function ispixel(n): Keyword;
export function ispercentage(n): Keyword;
export function isem(n): Keyword;
export function multiply(color1: Color, color2: Color): Color;
export function screen(color1: Color, color2: Color): Color;
export function overlay(color1: Color, color2: Color): Color;
export function softlight(color1: Color, color2: Color): Color;
export function hardlight(color1: Color, color2: Color): Color;
export function difference(color1: Color, color2: Color): Color;
export function exclusion(color1: Color, color2: Color): Color;
export function average(color1: Color, color2: Color): Color;
export function negation(color1: Color, color2: Color): Color;
export function tint(color: Color, amount: Dimension): Color;
export function shade(color: Color, amount: Dimension): Color;
}
export var colors: any; // Could be module - got lazy
interface HasDebugInfo {
debugInfo: DebugInfo;
}
interface DebugInfo {
lineNumber;
fileName: string;
}
interface HSL {
h: number;
s: number;
l: number;
a: number;
}
interface DebugInfoFunction {
(env: Options, ctx: HasDebugInfo): string;
asComment(ctx: HasDebugInfo): string;
asMediaQuery(ctx: HasDebugInfo): string;
}
interface RuleContainer {
[name: string]: Rule;
}
interface ICSSable {
toCSS(ctx?, env?: Options): string;
}
interface IEvalable {
eval(env: Options): IEvalable;
}
interface IInjectable extends ICSSable, IEvalable {}
interface IOperable {
operate(op: Operation, other: IOperable): IOperable;
}
interface IComparable {
compare(x: IComparable): number;
}
interface IColorable {
toColor(): Color;
}
interface IValuableNumber {
value: number;
}
interface IValuableString {
value: string;
}
export class Color implements IOperable, IInjectable, IComparable {
constructor(rgb: string, a: number);
constructor(rgb: number[], a: number);
rgb: number[];
alpha: number;
eval(): Color;
toCSS(): string;
operate(op: Operation, other: Color): Color;
operate(op: Operation, other: IColorable): Color;
toHSL(): HSL;
toARGB(): string;
compare(x: Color): number;
}
export class Directive implements IInjectable {
constructor(name, value);
name;
value: ICSSable;
ruleset: Ruleset;
toCSS(ctx?, env?: Options): string;
eval(env: Options): Directive;
variable(name);
find();
rulesets();
}
export class Operation implements IEvalable {
constructor(op, operands);
op: string;
operands: IEvalable;
eval(env: Options): IEvalable;
operate(op: string, a: number, b: number): number;
}
export class Dimension implements IColorable, IInjectable, IOperable, IComparable {
constructor(value: number, unit: string);
value: number;
unit: string;
eval(): Dimension;
toColor(): Color;
toCSS(): string;
operate(op: Operation, other: Dimension): Dimension;
compare(other: IComparable): number;
}
export class Keyword implements IInjectable, IComparable {
constructor(value: string);
value: string;
eval(): Keyword;
toCSS(): string;
compare(other: IComparable): number;
static True: Keyword;
static False: Keyword;
}
export class Variable implements IEvalable {
constructor(name: string, index, file: string);
name: string;
index;
file: string;
eval(env: Options): IEvalable;
}
export class AbstractRuleset implements IEvalable {
selectors: Selector[];
rules: any[];
strictImports;
eval(env: Options): Ruleset;
evalImports(env: Options): void;
makeImportant(): Ruleset;
matchArgs(args: any): boolean;
resetCache(): void;
variables(): RuleContainer;
variable(): Rule;
rulesets(): Ruleset[];
find(selector: Selector, self: Rule): Rule[];
joinSelectors(paths: string[], context: any[][], selectors: Selector[]): void;
joinSelector(paths: string[], context: any[][], selector: Selector): void;
mergeElementsOnToSelectors(elements: Element[], selectors: Selector[]): void;
}
export class Ruleset extends AbstractRuleset {
constructor(selectors: Selector[], rules: Rule[], strictImports);
toCSS(context?: any[][], env?: Options): string;
}
export class Element implements IInjectable {
constructor(combinator: Combinator, value, index);
combinator: Combinator;
value;
index;
eval(env: Options): Element;
toCSS(env?: Options): string;
}
export class Combinator implements ICSSable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
}
export class Selector implements IInjectable {
constructor(elements: Element[]);
match(other: Selector): boolean;
eval(env: Options): Selector;
toCSS(env?: Options): string;
}
export class Quoted implements IInjectable, IComparable {
constructor(str: string, content: string, escaped: boolean, i);
escaped: boolean;
value: string;
quote: string;
index;
toCSS(): string;
eval(env: Options): Quoted;
compare(x: IComparable): number;
}
export class Expression implements IInjectable {
constructor(value: IEvalable[]);
value: IEvalable[];
eval(env: Options): IEvalable;
toCSS(env?: Options): string;
}
export class Rule implements IInjectable {
constructor(name: string, value?: Value, important?: string, index?, inline?: boolean);
name: string;
value: Value;
important: string;
index;
inline: boolean;
toCSS(env?: Options): string;
eval(context): Rule;
makeImportant(): Rule;
}
export class Shorthand implements IInjectable {
constructor(a: ICSSable, b: ICSSable);
a: ICSSable;
b: ICSSable;
toCSS(env?: Options): string;
eval(): Shorthand;
}
export class Call implements IInjectable {
constructor(name: string, args: IEvalable[], index, filename: string);
name: string;
args: IEvalable[];
index;
filename: string;
eval(env: Options): IEvalable;
toCSS(env?: Options): string;
}
export class URL implements IInjectable {
constructor(val, rootpath: string);
value;
rootpath: string;
toCSS(): string;
eval(ctx): URL;
}
export class Alpha implements IInjectable {
constructor(val);
value;
toCSS(): string;
eval(env: Options): Alpha;
}
export class Import implements IInjectable {
constructor(path, imports, features: ICSSable, once: boolean, index, rootpath);
once: boolean;
index;
features: ICSSable;
rootpath;
path: string;
css: boolean;
toCSS(env?: Options): string;
eval(env: Options): IEvalable;
}
export class Comment implements IInjectable {
constructor(value: string, silent);
value: string;
silent: boolean;
toCSS(env?: Options): string;
eval(): Comment;
}
export class Anonymous implements IInjectable, IComparable {
constructor(value: string);
value: string;
toCSS(): string;
eval(): Anonymous;
compare(x): number;
}
export class Value implements IInjectable {
constructor(value: IEvalable[]);
value: IEvalable[];
is: string;
eval(env: Options): IEvalable;
toCSS(env?: Options): string;
}
export class JavaScript implements IEvalable {
constructor(expression: string, index, escaped: boolean);
escaped: boolean;
expression: string;
index;
eval(env: Options): IEvalable;
}
export class Assignment implements IInjectable {
constructor(key: string, val);
constructor(key: string, val: ICSSable);
constructor(key: string, val: IEvalable);
key: string;
value;
toCSS(): string;
eval(env: Options): Assignment;
}
export class Condition {
constructor(op: string, l, r, i, negate: boolean);
op: string;
lvalue;
rvalue;
index;
negate: boolean;
eval(env: Options): boolean;
}
export class Paren implements IInjectable {
constructor(node: IInjectable);
value: IInjectable;
toCSS(env?: Options): string;
eval(env: Options): Paren;
}
export class Media implements IInjectable {
constructor(value, features);
selectors: Selector[];
features: Value;
ruleset: Ruleset;
toCSS(ctx?, env?: Options): string;
eval(env: Options): IEvalable;
variable(name): Rule;
rulesets(): Ruleset[];
find(selector: Selector, self: Rule): Rule[];
emptySelectors(): Selector[];
evalTop(env: Options): IEvalable;
evalNested(env: Options): Ruleset;
permute(arr: any[]): any[];
bubbleSelectors(selectors: Selector[]): void;
}
export class Ratio implements IInjectable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
eval(): Ratio;
}
export class UnicodeDescriptor implements IInjectable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
eval(): UnicodeDescriptor;
}
export class Attribute implements IInjectable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
genCSS(env: Options, output): string;
eval(): Attribute;
}
export var debugInfo: DebugInfoFunction;
export function find(obj: any[], fun: Function): any;
export function jsify(obj: any): string;
export function operate(op: string, a: number, b: number): number;
export var True: Keyword;
export var False: Keyword;
interface RenderOutput {
css: string;
map: string;
imports: string[];
}
}
class ParserNode extends tree.AbstractRuleset {
toCSS(): string;
toCSS(options: { compress: boolean; }, variables?): string;
}
interface LessStatic {
render(input: string, callback: (output: Less.RenderOutput) => void): void;
render(input: string, options: Less.Options, callback: (output: Less.RenderOutput) => void): void;
export class Parser {
constructor(env?: Options);
render(input: string): Less.Promise<Less.RenderOutput>;
render(input: string, options: Less.Options): Less.Promise<Less.RenderOutput>;
imports: {
paths: string[];
queue: string[];
files;
contents;
mime: string;
error;
push(path: string, callback: (e, root, imported) => void);
}; // TODO
parse: (str: string, callback: (error: LessError, root: ParserNode) => void ) => void;
parsers: { // Major TODO
};
}
export function render(input: string, callback: (e, css: string) => void): void;
export function render(input: string, options: Options,
callback: (e, css: string) => void): void;
export function formatError(ctx, options: { color: boolean; }): string;
export function writeError(ctx, options: { color: boolean; }): void;
export var version: number[];
version: number[];
}
declare module "less" {
export = less;
export = less;
}
declare var less: LessStatic;
+12
View File
@@ -5745,6 +5745,18 @@ declare module _ {
**/
isEmpty(value: any): boolean;
}
//_.isError
interface LoDashStatic {
/**
* Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError,
* or URIError object.
* @param value The value to check.
* @return True if value is an error object, else false.
*/
isError(value: any): boolean;
}
//_.isEqual
interface LoDashStatic {
+62
View File
@@ -0,0 +1,62 @@
/// <reference path="./lory.js.d.ts" />
(function() {
var elm = document.querySelector('.js-foo');
var elm2 = document.querySelector('.js-bar');
var elm3 = document.querySelector('.js-baz');
var elm4 = document.querySelector('.js-foobar');
//////////////////////////////////////////////////
// Init
//////////////////////////////////////////////////
lory(elm);
// with options
lory(elm2, {
slidesToScroll: 1,
slideSpeed: 300,
rewindSpeed: 600,
snapBackSpeed: 200,
ease: 'ease',
rewind: true,
infinite: false
});
// with callbacks
lory(elm3, {
beforeInit: () => { },
afterInit: () => { },
beforePrev: () => { return 1; },
beforeNext: () => { return false; },
beforeTouch: () => { return ''; },
beforeResize: () => { }
});
// with options & callbacks
lory(elm4, {
slidesToScroll: 1,
slideSpeed: 300,
rewindSpeed: 600,
snapBackSpeed: 200,
ease: 'ease',
rewind: true,
infinite: 4,
beforeInit: () => { return function() { console.log('foo') }; },
afterInit: () => { return [0, 1]; },
beforePrev: () => { },
beforeNext: () => { },
beforeTouch: () => { },
beforeResize: () => { return {}; }
});
//////////////////////////////////////////////////
// Public API
//////////////////////////////////////////////////
lory.setup();
lory.prev();
lory.next();
lory.reset();
lory.slideTo(1);
}());
+110
View File
@@ -0,0 +1,110 @@
// Type definitions for lory 0.4.3
// Project: https://github.com/meandmax/lory/
// Definitions by: kubosho <https://github.com/kubosho/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var lory: LoryStatic;
interface LoryStatic {
(element: Element, options?: LoryOptions): LoryStatic;
/**
* slides to the previous slide.
*/
prev(): void;
/**
* slides to the next slide.
*/
next(): void;
/**
* slides to the index given as an argument.
*/
slideTo(index: number): void;
/**
* binds eventlisteners, merging default and user options, setup the slides based on DOM (called once during initialisation). Call setup if DOM or user options have changed or eventlisteners needs to be rebinded.
*/
setup(): void;
/**
* sets the slider back to the starting position and resets the current index (called on resize event).
*/
reset(): void;
}
interface LoryOptions {
//////////////////////////////////////////////////
// Options
//////////////////////////////////////////////////
/**
* slides scrolled at once (default: 1).
*/
slidesToScroll?: number;
/**
* time in milliseconds for the animation of a valid slide attempt (default: 300).
*/
slideSpeed?: number;
/**
* time in milliseconds for the animation of the rewind after the last slide (default: 600).
*/
rewindSpeed?: number;
/**
* time for the snapBack of the slider if the slide attempt was not valid (default: 200).
*/
snapBackSpeed?: number;
/**
* cubic bezier easing functions: http://easings.net/de (default: 'cubic-bezier(0.455, 0.03, 0.515, 0.955)').
*/
ease?: string;
/**
* if slider reached the last slide, with next click the slider goes back to the startindex (default: false).
*/
rewind?: boolean;
/**
* like carousel, works with multiple slides (default: false). (do not combine with rewind)
*/
infinite?: boolean | number;
//////////////////////////////////////////////////
// Callbacks
//////////////////////////////////////////////////
/**
* executed before initialisation (first in setup function)
*/
beforeInit?: <T>() => T;
/**
* executed after initialisation (end of setup function)
*/
afterInit?: <T>() => T;
/**
* executed on click of prev controls (prev function)
*/
beforePrev?: <T>() => T;
/**
* executed on click of next controls (next function)
*/
beforeNext?: <T>() => T;
/**
* executed on touch attempt (touchstart)
*/
beforeTouch?: <T>() => T;
/**
* executed on every resize event
*/
beforeResize?: <T>() => T;
}
+2 -2
View File
@@ -38,7 +38,7 @@ declare module Backbone {
include(value: any): boolean;
initial(): View<TModel>;
initial(n: number): View<TModel>[];
invoke(methodName: string, arguments?: any[]): any;
invoke(methodName: string, args?: any[]): any;
isEmpty(object: any): boolean;
last(): View<TModel>;
last(n: number): View<TModel>[];
@@ -533,7 +533,7 @@ declare module Marionette {
* Calls the method named by methodName on each value in the collection. Any extra
* arguments passed to invoke will be forwarded on to the method invocation.
*/
invoke(methodName: string, arguments?: any[]): any;
invoke(methodName: string, args?: any[]): any;
/**
* Returns true if the RegionManager contains no regions.
+5
View File
@@ -8,11 +8,16 @@ june.tz('America/Los_Angeles').format('ha z');
var a = moment.tz("2013-11-18 11:55", "America/Toronto");
var b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto");
var c = moment.tz(1403454068850, "America/Toronto");
var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto");
a.tz();
var arr = [2013, 5, 1],
str = "2013-12-01",
obj = { year : 2013, month : 5, day : 1 };
moment.tz("America/Los_Angeles");
moment.tz(arr, "America/Los_Angeles");
moment.tz(str, "America/Los_Angeles");
moment.tz(obj, "America/Los_Angeles");
+3
View File
@@ -7,6 +7,7 @@
declare module moment {
interface Moment {
tz(): string;
tz(timezone: string): Moment;
}
@@ -27,9 +28,11 @@ interface MomentZone {
}
interface MomentTimezone {
(timezone: string): moment.Moment;
(date: number, timezone: string): moment.Moment;
(date: number[], timezone: string): moment.Moment;
(date: string, format: string, timezone: string): moment.Moment;
(date: string, format: string, useStrict: boolean, timezone: string): moment.Moment;
(date: Date, timezone: string): moment.Moment;
(date: moment.Moment, timezone: string): moment.Moment;
(date: Object, timezone: string): moment.Moment;
+15 -15
View File
@@ -63,7 +63,7 @@ selectionProvider.selectedItems = [];
selectionProvider.selectedIndex = 1;
selectionProvider.lastClickedRow = {};
selectionProvider.ignoreSelectedItemChanges = false;
selectionProvider.pKeyParser = <ng.ICompiledExpression>{};
selectionProvider.pKeyParser = <angular.ICompiledExpression>{};
selectionProvider.ChangeSelection({}, {});
nr = selectionProvider.getSelection({});
nr = selectionProvider.getSelectionIndex({});
@@ -256,15 +256,15 @@ nr = gridScope.totalRowWidth();
a = gridScope.headerScrollerDim();
var gridInstance: ngGrid.IGridInstance = <ngGrid.IGridInstance>{};
gridInstance.$canvas = <ng.IAugmentedJQuery>{};
gridInstance.$viewport = <ng.IAugmentedJQuery>{};
gridInstance.$groupPanel = <ng.IAugmentedJQuery>{};
gridInstance.$footerPanel = <ng.IAugmentedJQuery>{};
gridInstance.$headerScroller = <ng.IAugmentedJQuery>{};
gridInstance.$headerContainer = <ng.IAugmentedJQuery>{};
gridInstance.$headers = <ng.IAugmentedJQuery>{};
gridInstance.$topPanel = <ng.IAugmentedJQuery>{};
gridInstance.$root = <ng.IAugmentedJQuery>{};
gridInstance.$canvas = <angular.IAugmentedJQuery>{};
gridInstance.$viewport = <angular.IAugmentedJQuery>{};
gridInstance.$groupPanel = <angular.IAugmentedJQuery>{};
gridInstance.$footerPanel = <angular.IAugmentedJQuery>{};
gridInstance.$headerScroller = <angular.IAugmentedJQuery>{};
gridInstance.$headerContainer = <angular.IAugmentedJQuery>{};
gridInstance.$headers = <angular.IAugmentedJQuery>{};
gridInstance.$topPanel = <angular.IAugmentedJQuery>{};
gridInstance.$root = <angular.IAugmentedJQuery>{};
gridInstance.config = <ngGrid.IGridOptions>{};
gridInstance.data = {};
gridInstance.elementDims = <ngGrid.IElementDimension>{};
@@ -290,7 +290,7 @@ gridInstance.clearSortingData();
gridInstance.configureColumnWidths();
gridInstance.fixColumnIndexes();
gridInstance.fixGroupIndexes();
var p:ng.IPromise<any> = gridInstance.getTemplate('');
var p:angular.IPromise<any> = gridInstance.getTemplate('');
p = gridInstance.init();
p = gridInstance.initTemplates();
gridInstance.minRowsToRender();
@@ -302,12 +302,12 @@ gridInstance.sortColumnsInit();
gridInstance.sortData(<ngGrid.IColumn>{}, {});
var test_styleProvider:ngGrid.IStyleProvider = new ngStyleProvider(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{});
var test_searchProvider:ngGrid.ISearchProvider = new ngSearchProvider(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <ng.IFilterService>{});
var test_selectionProvider:ngGrid.ISelectionProvider = new ngSelectionProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <ng.IParseService>{});
var test_eventProvider:ngGrid.IEventProvider = new ngEventProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <ngGrid.service.IDomUtilityService>{}, <ng.ITimeoutService>{});
var test_searchProvider:ngGrid.ISearchProvider = new ngSearchProvider(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <angular.IFilterService>{});
var test_selectionProvider:ngGrid.ISelectionProvider = new ngSelectionProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <angular.IParseService>{});
var test_eventProvider:ngGrid.IEventProvider = new ngEventProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <ngGrid.service.IDomUtilityService>{}, <angular.ITimeoutService>{});
var test_aggregate:ngGrid.IAggregate = new ngAggregate({}, <ngGrid.IRowFactory>{}, 10, true);
var test_renderedRange:ngGrid.IRenderedRange = new ngRenderedRange(1, 2);
var test_dimension:ngGrid.IDimension = new ngDimension({});
var test_row:ngGrid.IRow = new ngRow({}, <ngGrid.IRowConfig>{}, <ngGrid.ISelectionProvider>{}, 0, {});
var test_column:ngGrid.IColumn = new ngColumn(<ngGrid.IGridOptions>{}, <ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <ngGrid.service.IDomUtilityService>{}, <ng.ITemplateCacheService>{}, {});
var test_column:ngGrid.IColumn = new ngColumn(<ngGrid.IGridOptions>{}, <ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <ngGrid.service.IDomUtilityService>{}, <angular.ITemplateCacheService>{}, {});
var test_footer:ngGrid.IFooter = new ngFooter(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{});
+21 -21
View File
@@ -30,9 +30,9 @@ declare module ngGrid {
export interface IDomAccessProvider {
previousColumn:IColumn;
grid:IGridInstance;
changeUserSelect(elm:ng.IAugmentedJQuery, value:string):void;
changeUserSelect(elm:angular.IAugmentedJQuery, value:string):void;
focusCellElement($scope:IGridScope, index:number):void;
selectionHandlers($scope:IGridScope, elm:ng.IAugmentedJQuery):void;
selectionHandlers($scope:IGridScope, elm:angular.IAugmentedJQuery):void;
}
export interface IStyleProviderStatic {
@@ -43,7 +43,7 @@ declare module ngGrid {
}
export interface ISearchProviderStatic {
new($scope:IGridScope, grid:IGridInstance, $filter:ng.IFilterService):ISearchProvider;
new($scope:IGridScope, grid:IGridInstance, $filter:angular.IFilterService):ISearchProvider;
}
export interface ISearchProvider {
@@ -53,7 +53,7 @@ declare module ngGrid {
}
export interface ISelectionProviderStatic {
new(grid:IGridInstance, $scope:IGridScope, $parse:ng.IParseService):ISelectionProvider;
new(grid:IGridInstance, $scope:IGridScope, $parse:angular.IParseService):ISelectionProvider;
}
export interface ISelectionProvider {
@@ -62,7 +62,7 @@ declare module ngGrid {
selectedIndex:number;
lastClickedRow:any;
ignoreSelectedItemChanges:boolean;
pKeyParser:ng.ICompiledExpression;
pKeyParser:angular.ICompiledExpression;
ChangeSelection(rowItem:any, event:any):void;
getSelection(entity:any):number;
getSelectionIndex(entity:any):number;
@@ -71,7 +71,7 @@ declare module ngGrid {
}
export interface IEventProviderStatic {
new(grid:IGridInstance, $scope:IGridScope, domUtilityService:service.IDomUtilityService, $timeout:ng.ITimeoutService):IEventProvider;
new(grid:IGridInstance, $scope:IGridScope, domUtilityService:service.IDomUtilityService, $timeout:angular.ITimeoutService):IEventProvider;
}
export interface IEventProvider {
@@ -203,7 +203,7 @@ declare module ngGrid {
}
export interface IColumnStatic {
new(config:IGridOptions, $scope:IGridScope, grid:IGridInstance, domUtilityService:service.IDomUtilityService, $templateCache:ng.ITemplateCacheService, $utils:any):IColumn;
new(config:IGridOptions, $scope:IGridScope, grid:IGridInstance, domUtilityService:service.IDomUtilityService, $templateCache:angular.ITemplateCacheService, $utils:any):IColumn;
}
export interface IColumn {
@@ -251,7 +251,7 @@ declare module ngGrid {
setVars(fromCol:IColumn):void;
}
export interface IGridScope extends ng.IScope {
export interface IGridScope extends angular.IScope {
elementsNeedMeasuring:boolean;
columns:any[];
renderedRows:any[];
@@ -292,15 +292,15 @@ declare module ngGrid {
}
export interface IGridInstance {
$canvas:ng.IAugmentedJQuery;
$viewport:ng.IAugmentedJQuery;
$groupPanel:ng.IAugmentedJQuery;
$footerPanel:ng.IAugmentedJQuery;
$headerScroller:ng.IAugmentedJQuery;
$headerContainer:ng.IAugmentedJQuery;
$headers:ng.IAugmentedJQuery;
$topPanel:ng.IAugmentedJQuery;
$root:ng.IAugmentedJQuery;
$canvas:angular.IAugmentedJQuery;
$viewport:angular.IAugmentedJQuery;
$groupPanel:angular.IAugmentedJQuery;
$footerPanel:angular.IAugmentedJQuery;
$headerScroller:angular.IAugmentedJQuery;
$headerContainer:angular.IAugmentedJQuery;
$headers:angular.IAugmentedJQuery;
$topPanel:angular.IAugmentedJQuery;
$root:angular.IAugmentedJQuery;
config:IGridOptions;
data:any;
elementDims:IElementDimension;
@@ -327,9 +327,9 @@ declare module ngGrid {
configureColumnWidths():void;
fixColumnIndexes():void;
fixGroupIndexes():void;
getTemplate(key:string):ng.IPromise<any>;
init():ng.IPromise<any>;
initTemplates():ng.IPromise<any>;
getTemplate(key:string):angular.IPromise<any>;
init():angular.IPromise<any>;
initTemplates():angular.IPromise<any>;
minRowsToRender():void;
refreshDomSizes():void;
resizeOnData(col:IColumn):void;
@@ -602,7 +602,7 @@ declare module ngGrid {
eventStorage:any;
numberOfGrids:number;
immediate:number;
AssignGridContainers($scope:IGridScope, rootel:ng.IAugmentedJQuery, grid:IGridInstance):void;
AssignGridContainers($scope:IGridScope, rootel:angular.IAugmentedJQuery, grid:IGridInstance):void;
getRealWidth(obj:IDimension):number;
UpdateGridLayout($scope:IGridScope, grid:IGridInstance):void;
setStyleText(grid:IGridInstance, css:string):void;
+2 -2
View File
@@ -832,8 +832,8 @@ declare module "azure" {
whereKeys(partitionKey: string, rowKey: string): TableQuery;
whereNextKeys(partitionKey: string, rowKey: string): TableQuery;
where(condition: string, ...values: string[]): TableQuery;
and(condition: string, ...arguments: string[]): TableQuery;
or(condition: string, ...arguments: string[]): TableQuery;
and(condition: string, ...args: string[]): TableQuery;
or(condition: string, ...args: string[]): TableQuery;
top(integer: number): TableQuery;
toQueryObject(): any;
toPath(): string;
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="sanitizer.d.ts" />
import sanitizer = require('sanitizer');
// example copied from the tests https://github.com/theSmaw/Caja-HTML-Sanitizer/blob/master/test/test-sanitizer.js#L346
var events:any[] = [];
var addTextEvent = function(type:string, text:string, param:any) {
var n = events.length;
if (events[n - 3] === type && events[n - 1] === param) {
events[n - 2] += text;
} else {
events.push(type, text, param);
}
};
sanitizer.makeSaxParser({
startTag: function(name, attribs, param) {
events.push('startTag', name + '[' + attribs.join(';') + ']', param);
},
endTag: function(name, param) {
events.push('endTag', name, param);
},
pcdata: function(text, param) {
addTextEvent('pcdata', text, param);
},
cdata: function(text, param) {
addTextEvent('cdata', text, param);
},
rcdata: function(text, param) {
addTextEvent('rcdata', text, param);
},
comment: function(text, param) {
events.push('comment', text, param);
},
startDoc: function(param) {
events.push('startDoc', '', param);
},
endDoc: function(param) {
events.push('endDoc', '', param);
}
});
sanitizer.escape('<script>alert("hi")</script>');
sanitizer.sanitize('<script>alert("hi")</script>');
sanitizer.normalizeRCData('<script>alert("hi")</script>');
sanitizer.unescapeEntities('<script>alert("hi")</script>');
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for Sanitizer
// Project: https://github.com/theSmaw/Caja-HTML-Sanitizer
// Definitions by: Dave Taylor <http://davetayls.me>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'sanitizer' {
export interface ISaxHandler {
startTag(name:string, attribs:string[], param:any):void;
endTag(name:string, param:any):void;
pcdata(text:string, param:any):void;
cdata(text:string, param:any):void;
rcdata(text:string, param:any):void;
comment(text:string, param:any):void;
startDoc(param:any):void;
endDoc(param:any):void;
}
export function escape(s:string):string;
export function makeSaxParser(yourHandler:ISaxHandler):(...any:any[])=>any;
export function normalizeRCData(s:string):string;
export function sanitize(s:string):string;
export function unescapeEntities(s:string):string;
}
+310
View File
@@ -0,0 +1,310 @@
/// <reference path="stripe-node.d.ts" />
import StripeNode = require('stripe');
var stripe = new StripeNode("sk_test_BF573NobVn98OiIsPAv7A04K");
stripe.setApiVersion('2015-02-18');
stripe.customers.list({ limit: 3 }, function (err, customers) {
// asynchronously called
});
stripe.charges.create({
amount: 400,
currency: "usd",
source: "tok_15V2YhEe31JkLCeQy9iUgsJX", // obtained with Stripe.js
description: "Charge for test@example.com"
}, function (err, charge) {
// asynchronously called
});
stripe.charges.retrieve(
"ch_15fvyXEe31JkLCeQOo0SwFk9",
function (err, charge) {
// asynchronously called
}
);
stripe.charges.update(
"ch_15fvyXEe31JkLCeQOo0SwFk9",
{
description: "Charge for test@example.com"
},
function (err, charge) {
// asynchronously called
}
);
stripe.charges.capture("ch_15fvyXEe31JkLCeQOo0SwFk9", function (err, charge) {
// asynchronously called
});
stripe.charges.list({ limit: 3 }, function (err, charges) {
// asynchronously called
});
stripe.charges.createRefund(
"ch_15fvyXEe31JkLCeQOo0SwFk9",
{},
function (err, refund) {
// asynchronously called
}
);
stripe.charges.retrieveRefund(
"ch_15fvyXEe31JkLCeQOo0SwFk9",
"re_15jzA4Ee31JkLCeQcxbTbjaL",
function (err, refund) {
// asynchronously called
}
);
stripe.charges.updateRefund(
"ch_15fvyXEe31JkLCeQOo0SwFk9",
"re_15jzA4Ee31JkLCeQcxbTbjaL",
{ metadata: { key: "value" } },
function (err, refund) {
// asynchronously called
}
);
stripe.charges.listRefunds('ch_15fvyXEe31JkLCeQOo0SwFk9', null, function (err, refunds) {
// asynchronously called
});
stripe.customers.create({
description: 'Customer for test@example.com',
source: "tok_15V2YhEe31JkLCeQy9iUgsJX" // obtained with Stripe.js
}, function (err, customer) {
// asynchronously called
});
stripe.customers.retrieve(
"cus_5rfJKDJkuxzh5Q",
function (err, customer) {
// asynchronously called
}
);
stripe.customers.update("cus_5rfJKDJkuxzh5Q", {
description: "Customer for test@example.com"
}, function (err, customer) {
// asynchronously called
});
stripe.customers.del(
"cus_5rfJKDJkuxzh5Q",
function (err, confirmation) {
// asynchronously called
}
);
stripe.customers.list({ limit: 3 }, function (err, customers) {
// asynchronously called
});
stripe.customers.createCard(
"cus_5rfJKDJkuxzh5Q",
{ card: "tok_15V2YhEe31JkLCeQy9iUgsJX" },
function (err, card) {
// asynchronously called
}
);
stripe.customers.retrieveCard(
"cus_5rfJKDJkuxzh5Q",
"card_15fvyXEe31JkLCeQ9KMktP5S",
function (err, card) {
// asynchronously called
}
);
stripe.customers.retrieveCard(
"cus_5rfJKDJkuxzh5Q",
"card_15fvyXEe31JkLCeQ9KMktP5S",
function (err, card) {
// asynchronously called
}
);
stripe.customers.updateCard(
"cus_5rfJKDJkuxzh5Q",
"card_15fvyXEe31JkLCeQ9KMktP5S",
{ name: "Jane Austen" },
function (err, card) {
// asynchronously called
}
);
stripe.customers.updateCard(
"cus_5rfJKDJkuxzh5Q",
"card_15fvyXEe31JkLCeQ9KMktP5S",
{ name: "Jane Austen" },
function (err, card) {
// asynchronously called
}
);
stripe.customers.deleteCard(
"cus_5rfJKDJkuxzh5Q",
"card_15fvyXEe31JkLCeQ9KMktP5S",
function (err, confirmation) {
// asynchronously called
}
);
stripe.customers.listCards('cu_15fvyVEe31JkLCeQvr155iqc', null, function (err, cards) {
// asynchronously called
});
stripe.customers.retrieveSubscription(
"cus_5rfJKDJkuxzh5Q",
"sub_5rfJxnBLGSwsYp",
function (err, subscription) {
// asynchronously called
}
);
stripe.customers.updateSubscription(
"cus_5rfJKDJkuxzh5Q",
"sub_5rfJxnBLGSwsYp",
{ plan: "platypi-dev" },
function (err, subscription) {
// asynchronously called
}
);
stripe.customers.cancelSubscription(
"cus_5rfJKDJkuxzh5Q",
"sub_5rfJxnBLGSwsYp",
null,
function (err, confirmation) {
// asynchronously called
}
);
stripe.customers.listSubscriptions('cu_15fvyVEe31JkLCeQvr155iqc', null, function (err, subscriptions) {
// asynchronously called
});
stripe.plans.create({
amount: 2000,
interval: "month",
name: "Amazing Gold Plan",
currency: "usd",
id: "gold"
}, function (err, plan) {
// asynchronously called
});
stripe.plans.retrieve(
"platypi-dev",
function (err, plan) {
// asynchronously called
}
);
stripe.plans.update("platypi-dev", {
name: "New plan name"
}, function (err, plan) {
// asynchronously called
});
stripe.plans.del(
"platypi-dev",
function (err, confirmation) {
// asynchronously called
}
);
stripe.plans.list(null, function (err, plans) {
// asynchronously called
});
stripe.coupons.create({
percent_off: 25,
duration: 'repeating',
duration_in_months: 3,
id: '25OFF'
}, function (err, coupon) {
// asynchronously called
});
stripe.coupons.retrieve(
"25OFF",
function (err, coupon) {
// asynchronously called
}
);
stripe.coupons.update("25OFF", {
metadata: { key: "value" }
}, function (err, coupon) {
// asynchronously called
});
stripe.coupons.del("25OFF", function (err, confirmation) {
});
stripe.coupons.list({ limit: 3 }, function (err, coupons) {
// asynchronously called
});
stripe.customers.deleteDiscount("cus_5rfJKDJkuxzh5Q", function (err, confirmation) {
// asynchronously called
});
stripe.customers.deleteSubscriptionDiscount("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", function (err, confirmation) {
// asynchronously called
});
stripe.invoices.create({
customer: "cus_5rfJKDJkuxzh5Q"
}, function (err, invoice) {
// asynchronously called
});
stripe.invoices.retrieve(
"in_15fvyXEe31JkLCeQH7QbgZZb",
function (err, invoice) {
// asynchronously called
}
);
stripe.invoices.retrieveLines(
"in_15fvyXEe31JkLCeQH7QbgZZb",
{ limit: 5 },
function (err, lines) {
// asynchronously called
}
);
stripe.invoices.retrieveUpcoming(
"cus_5rfJKDJkuxzh5Q",
null,
function (err, upcoming) {
// asynchronously called
}
);
stripe.invoices.update(
"in_15fvyXEe31JkLCeQH7QbgZZb",
{
closed: true
},
function (err, invoice) {
// asynchronously called
}
);
stripe.invoices.pay("in_15fvyXEe31JkLCeQH7QbgZZb", function (err, invoice) {
// asynchronously called
});
stripe.invoices.list(
{ customer: "cus_5rfJKDJkuxzh5Q", limit: 3 },
function (err, invoices) {
// asynchronously called
}
);
+3107
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -4,12 +4,12 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface StripeStatic {
setPublishableKey(key: string);
setPublishableKey(key: string): void;
validateCardNumber(cardNumber: string): boolean;
validateExpiry(month: string, year: string): boolean;
validateCVC(cardCVC: string): boolean;
cardType(cardNumber: string): string;
getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void);
getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
card: StripeCardData;
}
@@ -58,7 +58,7 @@ interface StripeCardData {
address_zip?: string;
address_country?: string;
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void);
createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void;
}
declare var Stripe: StripeStatic;
+93
View File
@@ -0,0 +1,93 @@
/// <reference path="sweetalert.d.ts" />
// A basic message
swal("Here's a message!");
// A title with a text under
swal("Here's a message!", "It's pretty, isn't it?");
// A success message!
swal("Good job!", "You clicked the button!", "success");
// A warning message, with a function attached to the "Confirm"-button...
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function () {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
// ... and by passing a parameter, you can execute something else for "Cancel".
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
},
function (isConfirm) {
if (isConfirm) {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
// A message with a custom icon
swal({
title: "Sweet!",
text: "Here's a custom image.",
imageUrl: "images/thumbs-up.jpg"
});
// An HTML message
swal({
title: "HTML <small>Title</small>!",
text: "A custom <span style=\"color: #F8BB86\">html<span> message.",
html: true
});
// A message with auto close timer
swal({
title: "Auto close alert!",
text: "I will close in 2 seconds.",
timer: 2000,
showConfirmButton: false
});
// A replacement for the "prompt" function
swal({
title: "An input!",
text: "Write something interesting:",
type: "input",
showCancelButton: true,
closeOnConfirm: false,
animation: "slide-from-top"
},
function (inputValue) {
if (inputValue === false) return false;
if (inputValue === "") {
swal.showInputError("You need to write something!");
return false;
}
swal("Nice!", "You wrote: " + inputValue, "success");
}
);
swal.setDefaults({ confirmButtonColor: "#000000" });
swal.close();
swal.showInputError("Invalid email!");
+181
View File
@@ -0,0 +1,181 @@
// Type definitions for SweetAlert 0.5.0
// Project: https://github.com/t4t5/sweetalert/
// Definitions by: Markus Peloso <https://github.com/ToastHawaii/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var sweetAlert: SweetAlert.SweetAlertStatic;
declare var swal: SweetAlert.SweetAlertStatic;
declare module "sweetalert" {
export = swal;
}
declare module SweetAlert {
interface SettingsBase {
/**
* A description for the modal.
* Default: null
*/
text?: string;
/**
* The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal.
* Default: null
*/
type?: string;
/**
* If set to true, the user can dismiss the modal by pressing the Escape key.
* Default: true
*/
allowEsxcapeKey?: boolean;
/**
* A custom CSS class for the modal.
* Default: null
*/
customClass?: string;
/**
* If set to true, the user can dismiss the modal by clicking outside it.
* Default: false
*/
allowOutsideClick?: boolean;
/**
* If set to true, a "Cancel"-button will be shown, which the user can click on to dismiss the modal.
* Default: false
*/
showCancelButton?: boolean;
/**
* If set to false, the "OK/Confirm"-button will be hidden. Make sure you set a timer or set allowOutsideClick to true when using this, in order not to annoy the user.
* Default: true
*/
showConfirmButton?: boolean;
/**
* Use this to change the text on the "Confirm"-button. If showCancelButton is set as true, the confirm button will automatically show "Confirm" instead of "OK".
* Default: "OK"
*/
confirmButtonText?: string;
/**
* Use this to change the background color of the "Confirm"-button (must be a HEX value).
* Default: "#AEDEF4"
*/
confirmButtonColor?: string;
/**
* Use this to change the text on the "Cancel"-button.
* Default: "Cancel"
*/
cancelButtonText?: string;
/**
* Set to false if you want the modal to stay open even if the user presses the "Confirm"-button. This is especially useful if the function attached to the "Confirm"-button is another SweetAlert.
* Default: true
*/
closeOnConfirm?: boolean;
/**
* Add a customized icon for the modal.Should contain a string with the path to the image.
* Default: null
*/
imageUrl?: string;
/**
* If imageUrl is set, you can specify imageSize to describes how big you want the icon to be in px. Pass in a string with two values separated by an "x". The first value is the width, the second is the height.
* Default: "80x80"
*/
imageSize?: string;
/**
* Auto close timer of the modal.Set in ms (milliseconds).
* Default: null
*/
timer?: number;
/**
* If set to true, will not escape title and text parameters. (Set to false if you're worried about XSS attacks.)
* Default: false
*/
html?: boolean;
/**
* If set to false, the modal's animation will be disabled. Possible animations: "slide-from-top", "slide-from-bottom", "pop" (use true instead) and "none" (use false instead).
* Default: true, "pop"
*/
animation?: boolean | string;
/**
* Change the type of the input field when using type: "input" (this can be useful if you want users to type in their password for example).
* Default: "text"
*/
inputType?: string;
}
interface Settings extends SettingsBase {
/**
* The title of the modal.
*/
title: string;
}
interface SetDefaultsSettings extends SettingsBase {
/**
* The title of the modal.
* Default: null
*/
title?: string;
}
/**
* Is true or false if the user confirms or cancels the alert. Except for the type "input", then when the user confirms the alert, this variable contains the value of the input element.
*/
type CallbackArgument = boolean | string;
interface SweetAlertStatic {
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param title The title of the modal.
*/
(title: string): void;
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param title The title of the modal.
* @param text A description for the modal.
*/
(title: string, text: string): void;
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param title The title of the modal.
* @param text A description for the modal.
* @param type The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal.
*/
(title: string, text: string, type: string): void;
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param callback The callback from the users action. The value is true or false if the user confirms or cancels the alert. Except for the type "input", then when the user confirms the alert, the argument contains the value of the input element.
*/
(settings: Settings, callback?: (isConfirmOrInputValue: CallbackArgument) => any): void;
/**
* If you end up using a lot of the same settings when calling SweetAlert, you can use setDefaults at the start of your program to set them once and for all!
*/
setDefaults(settings: SetDefaultsSettings): void;
/**
* Close the currently open SweetAlert programmatically.
*/
close(): void;
/**
* Show an error message after validating the input field, if the user's data is bad.
*/
showInputError(errorMessage: string): void;
}
}
+2 -2
View File
@@ -12203,8 +12203,8 @@ declare module Windows {
createWithId(tileId: string): Windows.UI.StartScreen.SecondaryTile;
}
export class SecondaryTile implements Windows.UI.StartScreen.ISecondaryTile {
constructor(tileId: string, shortName: string, displayName: string, arguments: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri);
constructor(tileId: string, shortName: string, displayName: string, arguments: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri, wideLogoReference: Windows.Foundation.Uri);
constructor(tileId: string, shortName: string, displayName: string, args: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri);
constructor(tileId: string, shortName: string, displayName: string, args: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri, wideLogoReference: Windows.Foundation.Uri);
constructor(tileId: string);
constructor();
arguments: string;
+37
View File
@@ -0,0 +1,37 @@
/// <reference path="./xss-filters.d.ts" />
import xssFilters = require('xss-filters');
var s = '<script>alert("hello")</script>';
xssFilters.inHTMLComment(s);
xssFilters.inHTMLData(s);
xssFilters.inDoubleQuotedAttr(s);
xssFilters.inSingleQuotedAttr(s);
xssFilters.inUnQuotedAttr(s);
xssFilters.uriInHTMLComment(s);
xssFilters.uriInHTMLData(s);
xssFilters.uriInDoubleQuotedAttr(s);
xssFilters.uriInSingleQuotedAttr(s);
xssFilters.uriInUnQuotedAttr(s);
xssFilters.uriPathInHTMLComment(s);
xssFilters.uriPathInHTMLData(s);
xssFilters.uriPathInDoubleQuotedAttr(s);
xssFilters.uriPathInSingleQuotedAttr(s);
xssFilters.uriPathInUnQuotedAttr(s);
xssFilters.uriQueryInHTMLComment(s);
xssFilters.uriQueryInHTMLData(s);
xssFilters.uriQueryInDoubleQuotedAttr(s);
xssFilters.uriQueryInSingleQuotedAttr(s);
xssFilters.uriQueryInUnQuotedAttr(s);
xssFilters.uriComponentInHTMLComment(s);
xssFilters.uriComponentInHTMLData(s);
xssFilters.uriComponentInDoubleQuotedAttr(s);
xssFilters.uriComponentInSingleQuotedAttr(s);
xssFilters.uriComponentInUnQuotedAttr(s);
xssFilters.uriFragmentInHTMLComment(s);
xssFilters.uriFragmentInHTMLData(s);
xssFilters.uriFragmentInDoubleQuotedAttr(s);
xssFilters.uriFragmentInSingleQuotedAttr(s);
xssFilters.uriFragmentInUnQuotedAttr(s);
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for Yahoo XSS Filters
// Project: https://github.com/yahoo/xss-filters
// Definitions by: Dave Taylor <http://davetayls.me>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface XSSFilters {
inHTMLComment(s:string):string;
inHTMLData(s:string):string;
inDoubleQuotedAttr(s:string):string;
inSingleQuotedAttr(s:string):string;
inUnQuotedAttr(s:string):string;
uriInHTMLComment(s:string):string;
uriInHTMLData(s:string):string;
uriInDoubleQuotedAttr(s:string):string;
uriInSingleQuotedAttr(s:string):string;
uriInUnQuotedAttr(s:string):string;
uriPathInHTMLComment(s:string):string;
uriPathInHTMLData(s:string):string;
uriPathInDoubleQuotedAttr(s:string):string;
uriPathInSingleQuotedAttr(s:string):string;
uriPathInUnQuotedAttr(s:string):string;
uriQueryInHTMLComment(s:string):string;
uriQueryInHTMLData(s:string):string;
uriQueryInDoubleQuotedAttr(s:string):string;
uriQueryInSingleQuotedAttr(s:string):string;
uriQueryInUnQuotedAttr(s:string):string;
uriComponentInHTMLComment(s:string):string;
uriComponentInHTMLData(s:string):string;
uriComponentInDoubleQuotedAttr(s:string):string;
uriComponentInSingleQuotedAttr(s:string):string;
uriComponentInUnQuotedAttr(s:string):string;
uriFragmentInHTMLComment(s:string):string;
uriFragmentInHTMLData(s:string):string;
uriFragmentInDoubleQuotedAttr(s:string):string;
uriFragmentInSingleQuotedAttr(s:string):string;
uriFragmentInUnQuotedAttr(s:string):string;
}
declare var xssFilters:XSSFilters;
declare module 'xss-filters' {
export = xssFilters;
}