mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added definitions for jQuery.qrcode. Closes #6292
This commit is contained in:
parent
3191f6e008
commit
d47706e0a6
73
jquery.qrcode/jquery.qrcode-tests.ts
Normal file
73
jquery.qrcode/jquery.qrcode-tests.ts
Normal file
@ -0,0 +1,73 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery.qrcode.d.ts"/>
|
||||
|
||||
// Examples from website (note: the examples use color instead of fill, which is not supported)
|
||||
$('.container').qrcode();
|
||||
|
||||
$('.container').qrcode({
|
||||
"size": 100,
|
||||
"fill": "#3a3",
|
||||
"text": "http://larsjung.de/qrcode"
|
||||
});
|
||||
|
||||
$('.container').qrcode({
|
||||
"render": "div",
|
||||
"size": 100,
|
||||
"fill": "#3a3",
|
||||
"text": "http://larsjung.de/qrcode"
|
||||
});
|
||||
|
||||
// defaults
|
||||
$('.container').qrcode({
|
||||
|
||||
// render method: `'canvas'`, `'image'` or `'div'`
|
||||
render: 'canvas',
|
||||
|
||||
// version range somewhere in 1 .. 40
|
||||
minVersion: 1,
|
||||
maxVersion: 40,
|
||||
|
||||
// error correction level: `'L'`, `'M'`, `'Q'` or `'H'`
|
||||
ecLevel: 'L',
|
||||
|
||||
// offset in pixel if drawn onto existing canvas
|
||||
left: 0,
|
||||
top: 0,
|
||||
|
||||
// size in pixel
|
||||
size: 200,
|
||||
|
||||
// code color or image element
|
||||
fill: '#000',
|
||||
|
||||
// background color or image element, `null` for transparent background
|
||||
background: null,
|
||||
|
||||
// content
|
||||
text: 'no text',
|
||||
|
||||
// corner radius relative to module width: 0.0 .. 0.5
|
||||
radius: 0,
|
||||
|
||||
// quiet zone in modules
|
||||
quiet: 0,
|
||||
|
||||
// modes
|
||||
// 0: normal
|
||||
// 1: label strip
|
||||
// 2: label box
|
||||
// 3: image strip
|
||||
// 4: image box
|
||||
mode: JQueryQRCode.Mode.NORMAL,
|
||||
|
||||
mSize: 0.1,
|
||||
mPosX: 0.5,
|
||||
mPosY: 0.5,
|
||||
|
||||
label: 'no label',
|
||||
fontname: 'sans',
|
||||
fontcolor: '#000',
|
||||
|
||||
image: null
|
||||
});
|
||||
|
||||
127
jquery.qrcode/jquery.qrcode.d.ts
vendored
Normal file
127
jquery.qrcode/jquery.qrcode.d.ts
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
// Type definitions for jQuery.qrcode v0.12.0
|
||||
// Project: https://github.com/lrsjng/jquery-qrcode
|
||||
// Definitions by: Dan Manastireanu <https://github.com/danmana>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module JQueryQRCode {
|
||||
/**
|
||||
* One of the possible mode types.
|
||||
*/
|
||||
export const enum Mode {
|
||||
NORMAL,
|
||||
LABEL_STRIP,
|
||||
LABEL_BOX,
|
||||
IMAGE_STRIP,
|
||||
IMAGE_BOX
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Render method: 'canvas', 'image' or 'div'
|
||||
* @default 'canvas'
|
||||
*/
|
||||
render?: string,
|
||||
|
||||
/**
|
||||
* Start of version range, somewhere in 1 .. 40
|
||||
* @default 1
|
||||
*/
|
||||
minVersion?: number,
|
||||
/**
|
||||
* End of version range, somewhere in 1 .. 40
|
||||
* @default 40
|
||||
*/
|
||||
maxVersion?: number,
|
||||
|
||||
/**
|
||||
* Error correction level: 'L', 'M', 'Q' or 'H'
|
||||
* @default 'L'
|
||||
*/
|
||||
ecLevel?: string,
|
||||
|
||||
/**
|
||||
* Left offset in pixels, if drawn onto existing canvas
|
||||
* @default 0
|
||||
*/
|
||||
left?: number,
|
||||
/**
|
||||
* Top offset in pixels, if drawn onto existing canvas
|
||||
* @default 0
|
||||
*/
|
||||
top?: number,
|
||||
|
||||
/**
|
||||
* Size in pixel
|
||||
* @default 200
|
||||
*/
|
||||
size?: number,
|
||||
|
||||
/**
|
||||
* Code color or image element
|
||||
* @default '#000'
|
||||
*/
|
||||
fill?: string,
|
||||
|
||||
/**
|
||||
* Background color or image element, null for transparent background
|
||||
* @default null
|
||||
*/
|
||||
background?: string,
|
||||
|
||||
/**
|
||||
* The text content of the QR code.
|
||||
* @default 'no text'
|
||||
*/
|
||||
text?: string,
|
||||
|
||||
/**
|
||||
* Corner radius relative to module width: 0.0 .. 0.5
|
||||
* @default 0
|
||||
*/
|
||||
radius?: number,
|
||||
|
||||
/**
|
||||
* Quiet zone in modules
|
||||
* @default 0
|
||||
*/
|
||||
quiet?: number,
|
||||
|
||||
/**
|
||||
* Mode
|
||||
* @default Mode.NORMAL
|
||||
*/
|
||||
mode?: Mode,
|
||||
|
||||
|
||||
/** @default 0.1 */
|
||||
mSize?: number,
|
||||
/** @default 0.5 */
|
||||
mPosX?: number,
|
||||
/** @default 0.5 */
|
||||
mPosY?: number,
|
||||
|
||||
/** @default 'no label' */
|
||||
label?: string,
|
||||
/** @default 'sans' */
|
||||
fontname?: string,
|
||||
/** @default '#000' */
|
||||
fontcolor?: string,
|
||||
|
||||
/** @default null */
|
||||
image?: string
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Create a QR Code inside the selected container.
|
||||
* @param options
|
||||
*/
|
||||
qrcode(options?: JQueryQRCode.Options): JQuery;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user