mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-10-05 15:30:06 +01:00
Move to npm for several dependencies
mustache jQuery underscore backbone mocha chai intl-tel-input
This commit is contained in:
1 parent
a593a148e8
commit
cfe0bd0e79
32 files changed
+146
-35694
No files matched your search
@@ -22,7 +22,6 @@ libtextsecure/test/test.js
|
||||
test/test.js
|
||||
|
||||
# Third-party files
|
||||
js/jquery.js
|
||||
js/Mp3LameEncoder.min.js
|
||||
js/WebAudioRecorderMp3.js
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ stylesheets/manifest.css
|
||||
|
||||
# Third-party files
|
||||
components/**
|
||||
js/jquery.js
|
||||
js/Mp3LameEncoder.min.js
|
||||
js/WebAudioRecorderMp3.js
|
||||
libtextsecure/libsignal-protocol.js
|
||||
|
||||
+9
-15
@@ -7,15 +7,12 @@ module.exports = function(grunt) {
|
||||
var bower = grunt.file.readJSON('bower.json');
|
||||
var components = [];
|
||||
for (var i in bower.concat.app) {
|
||||
components.push('components/' + bower.concat.app[i] + '/**/*.js');
|
||||
components.push(bower.concat.app[i]);
|
||||
}
|
||||
components.push('components/' + 'webaudiorecorder/lib/WebAudioRecorder.js');
|
||||
|
||||
var libtextsecurecomponents = [];
|
||||
for (i in bower.concat.libtextsecure) {
|
||||
libtextsecurecomponents.push(
|
||||
'components/' + bower.concat.libtextsecure[i] + '/**/*.js'
|
||||
);
|
||||
libtextsecurecomponents.push(bower.concat.libtextsecure[i]);
|
||||
}
|
||||
|
||||
var importOnce = require('node-sass-import-once');
|
||||
@@ -34,8 +31,8 @@ module.exports = function(grunt) {
|
||||
},
|
||||
test: {
|
||||
src: [
|
||||
'components/mocha/mocha.js',
|
||||
'components/chai/chai.js',
|
||||
'node_modules/mocha/mocha.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'test/_test.js',
|
||||
],
|
||||
dest: 'test/test.js',
|
||||
@@ -75,10 +72,10 @@ module.exports = function(grunt) {
|
||||
},
|
||||
libtextsecuretest: {
|
||||
src: [
|
||||
'components/jquery/dist/jquery.js',
|
||||
'node_modules/jquery/dist/jquery.js',
|
||||
'components/mock-socket/dist/mock-socket.js',
|
||||
'components/mocha/mocha.js',
|
||||
'components/chai/chai.js',
|
||||
'node_modules/mocha/mocha.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'libtextsecure/test/_test.js',
|
||||
],
|
||||
dest: 'libtextsecure/test/test.js',
|
||||
@@ -103,7 +100,6 @@ module.exports = function(grunt) {
|
||||
'!js/backup.js',
|
||||
'!js/components.js',
|
||||
'!js/database.js',
|
||||
'!js/jquery.js',
|
||||
'!js/libsignal-protocol-worker.js',
|
||||
'!js/libtextsecure.js',
|
||||
'!js/logging.js',
|
||||
@@ -147,10 +143,6 @@ module.exports = function(grunt) {
|
||||
src: 'components/webaudiorecorder/lib/WebAudioRecorderMp3.js',
|
||||
dest: 'js/WebAudioRecorderMp3.js',
|
||||
},
|
||||
{
|
||||
src: 'components/jquery/dist/jquery.js',
|
||||
dest: 'js/jquery.js',
|
||||
},
|
||||
],
|
||||
},
|
||||
res: {
|
||||
@@ -326,6 +318,7 @@ module.exports = function(grunt) {
|
||||
env: {
|
||||
NODE_ENV: environment,
|
||||
},
|
||||
requireName: 'unused',
|
||||
});
|
||||
|
||||
function getMochaResults() {
|
||||
@@ -468,6 +461,7 @@ module.exports = function(grunt) {
|
||||
|
||||
var app = new Application({
|
||||
path: [dir, config.exe].join('/'),
|
||||
requireName: 'unused',
|
||||
});
|
||||
|
||||
app
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ a {
|
||||
<a href="https://signal.org">signal.org</a>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='js/jquery.js'></script>
|
||||
<script type='text/javascript' src='node_modules/jquery/dist/jquery.js'></script>
|
||||
<script>
|
||||
$(document).on('keyup', function(e) {
|
||||
if (e.keyCode === 27) {
|
||||
|
||||
+21
-60
@@ -5,28 +5,18 @@
|
||||
"license": "GPLV3",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"jquery": "liliakai/jquery#2.1.1-ajax-nativetransport",
|
||||
"underscore": "~1.7.0",
|
||||
"backbone": "~1.1.2",
|
||||
"protobuf": "~3.8.0",
|
||||
"mustache": "~0.8.2",
|
||||
"qrcode": "https://github.com/davidshimjs/qrcodejs.git#1c78ccd71",
|
||||
"indexeddb-backbonejs-adapter": "*",
|
||||
"intl-tel-input": "~4.0.1",
|
||||
"blueimp-load-image": "~1.13.0",
|
||||
"autosize": "~4.0.0",
|
||||
"webaudiorecorder": "https://github.com/higuma/web-audio-recorder-js.git",
|
||||
"mp3lameencoder": "https://github.com/higuma/mp3-lame-encoder-js.git"
|
||||
"blueimp-load-image": "~1.13.0",
|
||||
"indexeddb-backbonejs-adapter": "*",
|
||||
"mp3lameencoder": "https://github.com/higuma/mp3-lame-encoder-js.git",
|
||||
"protobuf": "~3.8.0",
|
||||
"qrcode": "https://github.com/davidshimjs/qrcodejs.git#1c78ccd71",
|
||||
"webaudiorecorder": "https://github.com/higuma/web-audio-recorder-js.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~2.0.1",
|
||||
"chai": "~3.5.0",
|
||||
"mock-socket": "~0.3.2"
|
||||
},
|
||||
"preen": {
|
||||
"jquery": [
|
||||
"dist/jquery.js"
|
||||
],
|
||||
"long": [
|
||||
"dist/Long.js"
|
||||
],
|
||||
@@ -36,40 +26,12 @@
|
||||
"protobuf": [
|
||||
"dist/ProtoBuf.js"
|
||||
],
|
||||
"mustache": [
|
||||
"mustache.js"
|
||||
],
|
||||
"underscore": [
|
||||
"underscore.js"
|
||||
],
|
||||
"backbone": [
|
||||
"backbone.js"
|
||||
],
|
||||
"qrcode": [
|
||||
"qrcode.js"
|
||||
],
|
||||
"mocha": [
|
||||
"mocha.js",
|
||||
"mocha.css"
|
||||
],
|
||||
"chai": [
|
||||
"chai.js"
|
||||
],
|
||||
"indexeddb-backbonejs-adapter": [
|
||||
"backbone-indexeddb.js"
|
||||
],
|
||||
"intl-tel-input": [
|
||||
"build/css/intlTelInput.css",
|
||||
"build/img/flags.png",
|
||||
"build/js/intlTelInput.js"
|
||||
],
|
||||
"emojijs": [
|
||||
"lib/emoji.js",
|
||||
"demo/emoji.css"
|
||||
],
|
||||
"emojidata": [
|
||||
"img-apple-64/*"
|
||||
],
|
||||
"mock-socket": [
|
||||
"dist/mock-socket.js"
|
||||
],
|
||||
@@ -86,24 +48,23 @@
|
||||
},
|
||||
"concat": {
|
||||
"app": [
|
||||
"jquery",
|
||||
"long",
|
||||
"bytebuffer",
|
||||
"protobuf",
|
||||
"mustache",
|
||||
"underscore",
|
||||
"backbone",
|
||||
"indexeddb-backbonejs-adapter",
|
||||
"qrcode",
|
||||
"moment",
|
||||
"intl-tel-input",
|
||||
"backbone.typeahead",
|
||||
"autosize"
|
||||
"node_modules/jquery/dist/jquery.js",
|
||||
"components/long/**/*.js",
|
||||
"components/bytebuffer/**/*.js",
|
||||
"components/protobuf/**/*.js",
|
||||
"node_modules/mustache/mustache.js",
|
||||
"node_modules/underscore/underscore.js",
|
||||
"node_modules/backbone/backbone.js",
|
||||
"components/indexeddb-backbonejs-adapter/**/*.js",
|
||||
"components/qrcode/**/*.js",
|
||||
"node_modules/intl-tel-input/build/js/intlTelInput.js",
|
||||
"components/autosize/**/*.js",
|
||||
"components/webaudiorecorder/lib/WebAudioRecorder.js"
|
||||
],
|
||||
"libtextsecure": [
|
||||
"long",
|
||||
"bytebuffer",
|
||||
"protobuf"
|
||||
"components/long/**/*.js",
|
||||
"components/bytebuffer/**/*.js",
|
||||
"components/protobuf/**/*.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1 +0,0 @@
|
||||
.iti-flag{width:16px;height:11px;background:url("../img/flags.png")}.iti-flag.ad{background-position:-16px 0}.iti-flag.ae{background-position:-32px 0}.iti-flag.af{background-position:-48px 0}.iti-flag.ag{background-position:-64px 0}.iti-flag.ai{background-position:-80px 0}.iti-flag.al{background-position:-96px 0}.iti-flag.am{background-position:-112px 0}.iti-flag.ao{background-position:-128px 0}.iti-flag.ar{background-position:-144px 0}.iti-flag.as{background-position:-160px 0}.iti-flag.at{background-position:-176px 0}.iti-flag.au{background-position:-192px 0}.iti-flag.aw{background-position:-208px 0}.iti-flag.az{background-position:-224px 0}.iti-flag.ba{background-position:-240px 0}.iti-flag.bb{background-position:0 -11px}.iti-flag.bd{background-position:-16px -11px}.iti-flag.be{background-position:-32px -11px}.iti-flag.bf{background-position:-48px -11px}.iti-flag.bg{background-position:-64px -11px}.iti-flag.bh{background-position:-80px -11px}.iti-flag.bi{background-position:-96px -11px}.iti-flag.bj{background-position:-112px -11px}.iti-flag.bm{background-position:-128px -11px}.iti-flag.bn{background-position:-144px -11px}.iti-flag.bo{background-position:-160px -11px}.iti-flag.br{background-position:-176px -11px}.iti-flag.bs{background-position:-192px -11px}.iti-flag.bt{background-position:-208px -11px}.iti-flag.bw{background-position:-224px -11px}.iti-flag.by{background-position:-240px -11px}.iti-flag.bz{background-position:0 -22px}.iti-flag.ca{background-position:-16px -22px}.iti-flag.cd{background-position:-32px -22px}.iti-flag.cf{background-position:-48px -22px}.iti-flag.cg{background-position:-64px -22px}.iti-flag.ch{background-position:-80px -22px}.iti-flag.ci{background-position:-96px -22px}.iti-flag.ck{background-position:-112px -22px}.iti-flag.cl{background-position:-128px -22px}.iti-flag.cm{background-position:-144px -22px}.iti-flag.cn{background-position:-160px -22px}.iti-flag.co{background-position:-176px -22px}.iti-flag.cr{background-position:-192px -22px}.iti-flag.cu{background-position:-208px -22px}.iti-flag.cv{background-position:-224px -22px}.iti-flag.cw{background-position:-240px -22px}.iti-flag.cy{background-position:0 -33px}.iti-flag.cz{background-position:-16px -33px}.iti-flag.de{background-position:-32px -33px}.iti-flag.dj{background-position:-48px -33px}.iti-flag.dk{background-position:-64px -33px}.iti-flag.dm{background-position:-80px -33px}.iti-flag.do{background-position:-96px -33px}.iti-flag.dz{background-position:-112px -33px}.iti-flag.ec{background-position:-128px -33px}.iti-flag.ee{background-position:-144px -33px}.iti-flag.eg{background-position:-160px -33px}.iti-flag.er{background-position:-176px -33px}.iti-flag.es{background-position:-192px -33px}.iti-flag.et{background-position:-208px -33px}.iti-flag.fi{background-position:-224px -33px}.iti-flag.fj{background-position:-240px -33px}.iti-flag.fk{background-position:0 -44px}.iti-flag.fm{background-position:-16px -44px}.iti-flag.fo{background-position:-32px -44px}.iti-flag.fr,.iti-flag.bl,.iti-flag.mf{background-position:-48px -44px}.iti-flag.ga{background-position:-64px -44px}.iti-flag.gb{background-position:-80px -44px}.iti-flag.gd{background-position:-96px -44px}.iti-flag.ge{background-position:-112px -44px}.iti-flag.gf{background-position:-128px -44px}.iti-flag.gh{background-position:-144px -44px}.iti-flag.gi{background-position:-160px -44px}.iti-flag.gl{background-position:-176px -44px}.iti-flag.gm{background-position:-192px -44px}.iti-flag.gn{background-position:-208px -44px}.iti-flag.gp{background-position:-224px -44px}.iti-flag.gq{background-position:-240px -44px}.iti-flag.gr{background-position:0 -55px}.iti-flag.gt{background-position:-16px -55px}.iti-flag.gu{background-position:-32px -55px}.iti-flag.gw{background-position:-48px -55px}.iti-flag.gy{background-position:-64px -55px}.iti-flag.hk{background-position:-80px -55px}.iti-flag.hn{background-position:-96px -55px}.iti-flag.hr{background-position:-112px -55px}.iti-flag.ht{background-position:-128px -55px}.iti-flag.hu{background-position:-144px -55px}.iti-flag.id{background-position:-160px -55px}.iti-flag.ie{background-position:-176px -55px}.iti-flag.il{background-position:-192px -55px}.iti-flag.in{background-position:-208px -55px}.iti-flag.io{background-position:-224px -55px}.iti-flag.iq{background-position:-240px -55px}.iti-flag.ir{background-position:0 -66px}.iti-flag.is{background-position:-16px -66px}.iti-flag.it{background-position:-32px -66px}.iti-flag.jm{background-position:-48px -66px}.iti-flag.jo{background-position:-64px -66px}.iti-flag.jp{background-position:-80px -66px}.iti-flag.ke{background-position:-96px -66px}.iti-flag.kg{background-position:-112px -66px}.iti-flag.kh{background-position:-128px -66px}.iti-flag.ki{background-position:-144px -66px}.iti-flag.km{background-position:-160px -66px}.iti-flag.kn{background-position:-176px -66px}.iti-flag.kp{background-position:-192px -66px}.iti-flag.kr{background-position:-208px -66px}.iti-flag.kw{backgroundLine truncated
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 69 KiB |
@@ -1,999 +0,0 @@
|
||||
/*
|
||||
International Telephone Input v4.0.2
|
||||
https://github.com/Bluefieldscom/intl-tel-input.git
|
||||
*/
|
||||
// wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
|
||||
(function(factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define([ "jquery" ], function($) {
|
||||
factory($, window, document);
|
||||
});
|
||||
} else {
|
||||
factory(jQuery, window, document);
|
||||
}
|
||||
})(function($, window, document, undefined) {
|
||||
"use strict";
|
||||
var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling
|
||||
defaults = {
|
||||
// automatically format the number according to the selected country
|
||||
autoFormat: true,
|
||||
// if there is just a dial code in the input: remove it on blur, and re-add it on focus
|
||||
autoHideDialCode: true,
|
||||
// default country
|
||||
defaultCountry: "",
|
||||
// token for ipinfo - required for https or over 1000 daily page views support
|
||||
ipinfoToken: "",
|
||||
// don't insert international dial codes
|
||||
nationalMode: true,
|
||||
// number type to use for placeholders
|
||||
numberType: "MOBILE",
|
||||
// display only these countries
|
||||
onlyCountries: [],
|
||||
// the countries at the top of the list. defaults to united states and united kingdom
|
||||
preferredCountries: [ "us", "gb" ],
|
||||
// stop the user from typing invalid numbers
|
||||
preventInvalidNumbers: false,
|
||||
// specify the path to the libphonenumber script to enable validation/formatting
|
||||
utilsScript: ""
|
||||
}, keys = {
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
ENTER: 13,
|
||||
ESC: 27,
|
||||
PLUS: 43,
|
||||
A: 65,
|
||||
Z: 90,
|
||||
ZERO: 48,
|
||||
NINE: 57,
|
||||
SPACE: 32,
|
||||
BSPACE: 8,
|
||||
DEL: 46,
|
||||
CTRL: 17,
|
||||
CMD1: 91,
|
||||
// Chrome
|
||||
CMD2: 224
|
||||
}, windowLoaded = false;
|
||||
// keep track of if the window.load event has fired as impossible to check after the fact
|
||||
$(window).load(function() {
|
||||
windowLoaded = true;
|
||||
});
|
||||
function Plugin(element, options) {
|
||||
this.element = element;
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
// event namespace
|
||||
this.ns = "." + pluginName + id++;
|
||||
// Chrome, FF, Safari, IE9+
|
||||
this.isGoodBrowser = Boolean(element.setSelectionRange);
|
||||
this.hadInitialPlaceholder = Boolean($(element).attr("placeholder"));
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
Plugin.prototype = {
|
||||
init: function() {
|
||||
var that = this;
|
||||
// if defaultCountry is set to "auto", we must do a lookup first
|
||||
if (this.options.defaultCountry == "auto") {
|
||||
// reset this in case lookup fails
|
||||
this.options.defaultCountry = "";
|
||||
var ipinfoURL = "//ipinfo.io";
|
||||
if (this.options.ipinfoToken) {
|
||||
ipinfoURL += "?token=" + this.options.ipinfoToken;
|
||||
}
|
||||
$.get(ipinfoURL, function(response) {
|
||||
if (response && response.country) {
|
||||
that.options.defaultCountry = response.country.toLowerCase();
|
||||
}
|
||||
}, "jsonp").always(function() {
|
||||
that._ready();
|
||||
});
|
||||
} else {
|
||||
this._ready();
|
||||
}
|
||||
},
|
||||
_ready: function() {
|
||||
// if in nationalMode, disable options relating to dial codes
|
||||
if (this.options.nationalMode) {
|
||||
this.options.autoHideDialCode = false;
|
||||
}
|
||||
// IE Mobile doesn't support the keypress event (see issue 68) which makes autoFormat impossible
|
||||
if (navigator.userAgent.match(/IEMobile/i)) {
|
||||
this.options.autoFormat = false;
|
||||
}
|
||||
// process all the data: onlyCountries, preferredCountries etc
|
||||
this._processCountryData();
|
||||
// generate the markup
|
||||
this._generateMarkup();
|
||||
// set the initial state of the input value and the selected flag
|
||||
this._setInitialState();
|
||||
// start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click
|
||||
this._initListeners();
|
||||
},
|
||||
/********************
|
||||
* PRIVATE METHODS
|
||||
********************/
|
||||
// prepare all of the country data, including onlyCountries and preferredCountries options
|
||||
_processCountryData: function() {
|
||||
// set the instances country data objects
|
||||
this._setInstanceCountryData();
|
||||
// set the preferredCountries property
|
||||
this._setPreferredCountries();
|
||||
},
|
||||
// add a country code to this.countryCodes
|
||||
_addCountryCode: function(iso2, dialCode, priority) {
|
||||
if (!(dialCode in this.countryCodes)) {
|
||||
this.countryCodes[dialCode] = [];
|
||||
}
|
||||
var index = priority || 0;
|
||||
this.countryCodes[dialCode][index] = iso2;
|
||||
},
|
||||
// process onlyCountries array if present, and generate the countryCodes map
|
||||
_setInstanceCountryData: function() {
|
||||
var i;
|
||||
// process onlyCountries option
|
||||
if (this.options.onlyCountries.length) {
|
||||
this.countries = [];
|
||||
for (i = 0; i < allCountries.length; i++) {
|
||||
if ($.inArray(allCountries[i].iso2, this.options.onlyCountries) != -1) {
|
||||
this.countries.push(allCountries[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.countries = allCountries;
|
||||
}
|
||||
// generate countryCodes map
|
||||
this.countryCodes = {};
|
||||
for (i = 0; i < this.countries.length; i++) {
|
||||
var c = this.countries[i];
|
||||
this._addCountryCode(c.iso2, c.dialCode, c.priority);
|
||||
// area codes
|
||||
if (c.areaCodes) {
|
||||
for (var j = 0; j < c.areaCodes.length; j++) {
|
||||
// full dial code is country code + dial code
|
||||
this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// process preferred countries - iterate through the preferences,
|
||||
// fetching the country data for each one
|
||||
_setPreferredCountries: function() {
|
||||
this.preferredCountries = [];
|
||||
for (var i = 0; i < this.options.preferredCountries.length; i++) {
|
||||
var countryCode = this.options.preferredCountries[i], countryData = this._getCountryData(countryCode, false, true);
|
||||
if (countryData) {
|
||||
this.preferredCountries.push(countryData);
|
||||
}
|
||||
}
|
||||
},
|
||||
// generate all of the markup for the plugin: the selected flag overlay, and the dropdown
|
||||
_generateMarkup: function() {
|
||||
// telephone input
|
||||
this.telInput = $(this.element);
|
||||
// prevent autocomplete as there's no safe, cross-browser event we can react to, so it can easily put the plugin in an inconsistent state e.g. the wrong flag selected for the autocompleted number, which on submit could mean the wrong number is saved (esp in nationalMode)
|
||||
this.telInput.attr("autocomplete", "off");
|
||||
// containers (mostly for positioning)
|
||||
this.telInput.wrap($("<div>", {
|
||||
"class": "intl-tel-input"
|
||||
}));
|
||||
var flagsContainer = $("<div>", {
|
||||
"class": "flag-dropdown"
|
||||
}).insertAfter(this.telInput);
|
||||
// currently selected flag (displayed to left of input)
|
||||
var selectedFlag = $("<div>", {
|
||||
"class": "selected-flag"
|
||||
}).appendTo(flagsContainer);
|
||||
this.selectedFlagInner = $("<div>", {
|
||||
"class": "iti-flag"
|
||||
}).appendTo(selectedFlag);
|
||||
// CSS triangle
|
||||
$("<div>", {
|
||||
"class": "arrow"
|
||||
}).appendTo(this.selectedFlagInner);
|
||||
// country list contains: preferred countries, then divider, then all countries
|
||||
this.countryList = $("<ul>", {
|
||||
"class": "country-list v-hide"
|
||||
}).appendTo(flagsContainer);
|
||||
if (this.preferredCountries.length) {
|
||||
this._appendListItems(this.preferredCountries, "preferred");
|
||||
$("<li>", {
|
||||
"class": "divider"
|
||||
}).appendTo(this.countryList);
|
||||
}
|
||||
this._appendListItems(this.countries, "");
|
||||
// now we can grab the dropdown height, and hide it properly
|
||||
this.dropdownHeight = this.countryList.outerHeight();
|
||||
this.countryList.removeClass("v-hide").addClass("hide");
|
||||
// on small screens make the dropdown the same width as the input
|
||||
if (window.innerWidth < 500) {
|
||||
this.countryList.outerWidth(this.telInput.outerWidth());
|
||||
}
|
||||
// this is useful in lots of places
|
||||
this.countryListItems = this.countryList.children(".country");
|
||||
},
|
||||
// add a country <li> to the countryList <ul> container
|
||||
_appendListItems: function(countries, className) {
|
||||
// we create so many DOM elements, I decided it was faster to build a temp string
|
||||
// and then add everything to the DOM in one go at the end
|
||||
var tmp = "";
|
||||
// for each country
|
||||
for (var i = 0; i < countries.length; i++) {
|
||||
var c = countries[i];
|
||||
// open the list item
|
||||
tmp += "<li class='country " + className + "' data-dial-code='" + c.dialCode + "' data-country-code='" + c.iso2 + "'>";
|
||||
// add the flag
|
||||
tmp += "<div class='iti-flag " + c.iso2 + "'></div>";
|
||||
// and the country name and dial code
|
||||
tmp += "<span class='country-name'>" + c.name + "</span>";
|
||||
tmp += "<span class='dial-code'>+" + c.dialCode + "</span>";
|
||||
// close the list item
|
||||
tmp += "</li>";
|
||||
}
|
||||
this.countryList.append(tmp);
|
||||
},
|
||||
// set the initial state of the input value and the selected flag
|
||||
_setInitialState: function() {
|
||||
var val = this.telInput.val();
|
||||
// if there is a number, and it's valid, we can go ahead and set the flag, else fall back to default
|
||||
if (this._getDialCode(val)) {
|
||||
this._updateFlagFromNumber(val);
|
||||
} else {
|
||||
var defaultCountry;
|
||||
// check the defaultCountry option, else fall back to the first in the list
|
||||
if (this.options.defaultCountry) {
|
||||
defaultCountry = this._getCountryData(this.options.defaultCountry, false, false);
|
||||
} else {
|
||||
defaultCountry = this.preferredCountries.length ? this.preferredCountries[0] : this.countries[0];
|
||||
}
|
||||
this._selectFlag(defaultCountry.iso2);
|
||||
// if empty, insert the default dial code (this function will check !nationalMode and !autoHideDialCode)
|
||||
if (!val) {
|
||||
this._updateDialCode(defaultCountry.dialCode, false);
|
||||
}
|
||||
}
|
||||
// format
|
||||
if (val) {
|
||||
// this wont be run after _updateDialCode as that's only called if no val
|
||||
this._updateVal(val, false);
|
||||
}
|
||||
},
|
||||
// initialise the main event listeners: input keyup, and click selected flag
|
||||
_initListeners: function() {
|
||||
var that = this;
|
||||
this._initKeyListeners();
|
||||
// autoFormat prevents the change event from firing, so we need to check for changes between focus and blur in order to manually trigger it
|
||||
if (this.options.autoHideDialCode || this.options.autoFormat) {
|
||||
this._initFocusListeners();
|
||||
}
|
||||
// hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again
|
||||
var label = this.telInput.closest("label");
|
||||
if (label.length) {
|
||||
label.on("click" + this.ns, function(e) {
|
||||
// if the dropdown is closed, then focus the input, else ignore the click
|
||||
if (that.countryList.hasClass("hide")) {
|
||||
that.telInput.focus();
|
||||
} else {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
// toggle country dropdown on click
|
||||
var selectedFlag = this.selectedFlagInner.parent();
|
||||
selectedFlag.on("click" + this.ns, function(e) {
|
||||
// only intercept this event if we're opening the dropdown
|
||||
// else let it bubble up to the top ("click-off-to-close" listener)
|
||||
// we cannot just stopPropagation as it may be needed to close another instance
|
||||
if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) {
|
||||
that._showDropdown();
|
||||
}
|
||||
});
|
||||
// if the user has specified the path to the utils script, fetch it on window.load
|
||||
if (this.options.utilsScript) {
|
||||
// if the plugin is being initialised after the window.load event has already been fired
|
||||
if (windowLoaded) {
|
||||
this.loadUtils();
|
||||
} else {
|
||||
// wait until the load event so we don't block any other requests e.g. the flags image
|
||||
$(window).load(function() {
|
||||
that.loadUtils();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
_initKeyListeners: function() {
|
||||
var that = this;
|
||||
if (this.options.autoFormat) {
|
||||
// format number and update flag on keypress
|
||||
// use keypress event as we want to ignore all input except for a select few keys,
|
||||
// but we dont want to ignore the navigation keys like the arrows etc.
|
||||
// NOTE: no point in refactoring this to only bind these listeners on focus/blur because then you would need to have those 2 listeners running the whole time anyway...
|
||||
this.telInput.on("keypress" + this.ns, function(e) {
|
||||
// 32 is space, and after that it's all chars (not meta/nav keys)
|
||||
// this fix is needed for Firefox, which triggers keypress event for some meta/nav keys
|
||||
// Update: also ignore if this is a metaKey e.g. FF and Safari trigger keypress on the v of Ctrl+v
|
||||
// Update: also check that we have utils before we do any autoFormat stuff
|
||||
if (e.which >= keys.SPACE && !e.metaKey && window.intlTelInputUtils && !that.telInput.prop("readonly")) {
|
||||
e.preventDefault();
|
||||
// allowed keys are just numeric keys and plus
|
||||
// we must allow plus for the case where the user does select-all and then hits plus to start typing a new number. we could refine this logic to first check that the selection contains a plus, but that wont work in old browsers, and I think it's overkill anyway
|
||||
var isAllowedKey = e.which >= keys.ZERO && e.which <= keys.NINE || e.which == keys.PLUS, input = that.telInput[0], noSelection = that.isGoodBrowser && input.selectionStart == input.selectionEnd, max = that.telInput.attr("maxlength"), val = that.telInput.val(), // assumes that if max exists, it is >0
|
||||
isBelowMax = max ? val.length < max : true;
|
||||
// first: ensure we dont go over maxlength. we must do this here to prevent adding digits in the middle of the number
|
||||
// still reformat even if not an allowed key as they could by typing a formatting char, but ignore if there's a selection as doesn't make sense to replace selection with illegal char and then immediately remove it
|
||||
if (isBelowMax && (isAllowedKey || noSelection)) {
|
||||
var newChar = isAllowedKey ? String.fromCharCode(e.which) : null;
|
||||
that._handleInputKey(newChar, true);
|
||||
// if something has changed, trigger the input event (which was otherwised squashed by the preventDefault)
|
||||
if (val != that.telInput.val()) {
|
||||
that.telInput.trigger("input");
|
||||
}
|
||||
}
|
||||
if (!isAllowedKey) {
|
||||
that.telInput.trigger("invalidkey");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// handle keyup event
|
||||
// for autoFormat: we use keyup to catch cut/paste events and also delete events (after the fact)
|
||||
this.telInput.on("keyup" + this.ns, function(e) {
|
||||
// the "enter" key event from selecting a dropdown item is triggered here on the input, because the document.keydown handler that initially handles that event triggers a focus on the input, and so the keyup for that same key event gets triggered here. weird, but just make sure we dont bother doing any re-formatting in this case (we've already done preventDefault in the keydown handler, so it wont actually submit the form or anything).
|
||||
// ALSO: ignore keyup if readonly
|
||||
if (e.which == keys.ENTER || that.telInput.prop("readonly")) {} else if (that.options.autoFormat && window.intlTelInputUtils) {
|
||||
var isCtrl = e.which == keys.CTRL || e.which == keys.CMD1 || e.which == keys.CMD2, input = that.telInput[0], // noSelection defaults to false for bad browsers, else would be reformatting on all ctrl keys e.g. select-all/copy
|
||||
noSelection = that.isGoodBrowser && input.selectionStart == input.selectionEnd, // cursorAtEnd defaults to false for bad browsers else they would never get a reformat on delete
|
||||
cursorAtEnd = that.isGoodBrowser && input.selectionStart == that.telInput.val().length;
|
||||
// if delete in the middle: reformat with no suffix (no need to reformat if delete at end)
|
||||
// if backspace: reformat with no suffix (need to reformat if at end to remove any lingering suffix - this is a feature)
|
||||
// if ctrl and no selection (i.e. could have just been a paste): reformat (if cursorAtEnd: add suffix)
|
||||
if (e.which == keys.DEL && !cursorAtEnd || e.which == keys.BSPACE || isCtrl && noSelection) {
|
||||
// important to remember never to add suffix on any delete key as can fuck up in ie8 so you can never delete a formatting char at the end
|
||||
that._handleInputKey(null, isCtrl && cursorAtEnd);
|
||||
}
|
||||
// prevent deleting the plus (if not in nationalMode)
|
||||
if (!that.options.nationalMode) {
|
||||
var val = that.telInput.val();
|
||||
if (val.substr(0, 1) != "+") {
|
||||
// newCursorPos is current pos + 1 to account for the plus we are about to add
|
||||
var newCursorPos = that.isGoodBrowser ? input.selectionStart + 1 : 0;
|
||||
that.telInput.val("+" + val);
|
||||
if (that.isGoodBrowser) {
|
||||
input.setSelectionRange(newCursorPos, newCursorPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if no autoFormat, just update flag
|
||||
that._updateFlagFromNumber(that.telInput.val());
|
||||
}
|
||||
});
|
||||
},
|
||||
// when autoFormat is enabled: handle various key events on the input: the 2 main situations are 1) adding a new number character, which will replace any selection, reformat, and preserve the cursor position. and 2) reformatting on backspace, or paste event (etc)
|
||||
_handleInputKey: function(newNumericChar, addSuffix) {
|
||||
var val = this.telInput.val(), numericBefore = this._getNumeric(val), originalLeftChar, // raw DOM element
|
||||
input = this.telInput[0], digitsOnRight = 0;
|
||||
if (this.isGoodBrowser) {
|
||||
// cursor strategy: maintain the number of digits on the right. we use the right instead of the left so that A) we dont have to account for the new digit (or digits if paste event), and B) we're always on the right side of formatting suffixes
|
||||
digitsOnRight = this._getDigitsOnRight(val, input.selectionEnd);
|
||||
// if handling a new number character: insert it in the right place
|
||||
if (newNumericChar) {
|
||||
// replace any selection they may have made with the new char
|
||||
val = val.substr(0, input.selectionStart) + newNumericChar + val.substring(input.selectionEnd, val.length);
|
||||
} else {
|
||||
// here we're not handling a new char, we're just doing a re-format (e.g. on delete/backspace/paste, after the fact), but we still need to maintain the cursor position. so make note of the char on the left, and then after the re-format, we'll count in the same number of digits from the right, and then keep going through any formatting chars until we hit the same left char that we had before.
|
||||
originalLeftChar = val.charAt(input.selectionStart - 1);
|
||||
}
|
||||
} else if (newNumericChar) {
|
||||
val += newNumericChar;
|
||||
}
|
||||
// update the number and flag
|
||||
this.setNumber(val, addSuffix);
|
||||
val = this.telInput.val();
|
||||
var numericAfter = this._getNumeric(val), numericIsSame = numericBefore == numericAfter;
|
||||
if (this.options.preventInvalidNumbers && newNumericChar) {
|
||||
if (numericIsSame) {
|
||||
// if we're trying to add a new numeric char and the numeric digits haven't changed, then trigger invalid
|
||||
this.telInput.trigger("invalidkey");
|
||||
} else if (numericBefore.length == numericAfter.length) {
|
||||
// preventInvalidNumbers edge case: adding digit in middle of full number, so a digit gets dropped from the end (numeric digits have changed but are same length)
|
||||
digitsOnRight--;
|
||||
}
|
||||
}
|
||||
// update the cursor position
|
||||
if (this.isGoodBrowser) {
|
||||
var newCursor;
|
||||
// if it was at the end, keep it there
|
||||
if (!digitsOnRight) {
|
||||
newCursor = val.length;
|
||||
} else {
|
||||
// else count in the same number of digits from the right
|
||||
newCursor = this._getCursorFromDigitsOnRight(val, digitsOnRight);
|
||||
// but if delete/paste etc, keep going left until hit the same left char as before
|
||||
if (!newNumericChar) {
|
||||
newCursor = this._getCursorFromLeftChar(val, newCursor, originalLeftChar);
|
||||
}
|
||||
}
|
||||
// set the new cursor
|
||||
input.setSelectionRange(newCursor, newCursor);
|
||||
}
|
||||
},
|
||||
// we start from the position in guessCursor, and work our way left until we hit the originalLeftChar or a number to make sure that after reformatting the cursor has the same char on the left in the case of a delete etc
|
||||
_getCursorFromLeftChar: function(val, guessCursor, originalLeftChar) {
|
||||
for (var i = guessCursor; i > 0; i--) {
|
||||
var leftChar = val.charAt(i - 1);
|
||||
if (leftChar == originalLeftChar || $.isNumeric(leftChar)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
// after a reformat we need to make sure there are still the same number of digits to the right of the cursor
|
||||
_getCursorFromDigitsOnRight: function(val, digitsOnRight) {
|
||||
for (var i = val.length - 1; i >= 0; i--) {
|
||||
if ($.isNumeric(val.charAt(i))) {
|
||||
if (--digitsOnRight === 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
// get the number of numeric digits to the right of the cursor so we can reposition the cursor correctly after the reformat has happened
|
||||
_getDigitsOnRight: function(val, selectionEnd) {
|
||||
var digitsOnRight = 0;
|
||||
for (var i = selectionEnd; i < val.length; i++) {
|
||||
if ($.isNumeric(val.charAt(i))) {
|
||||
digitsOnRight++;
|
||||
}
|
||||
}
|
||||
return digitsOnRight;
|
||||
},
|
||||
// listen for focus and blur
|
||||
_initFocusListeners: function() {
|
||||
var that = this;
|
||||
if (this.options.autoHideDialCode) {
|
||||
// mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click
|
||||
this.telInput.on("mousedown" + this.ns, function(e) {
|
||||
if (!that.telInput.is(":focus") && !that.telInput.val()) {
|
||||
e.preventDefault();
|
||||
// but this also cancels the focus, so we must trigger that manually
|
||||
that.telInput.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.telInput.on("focus" + this.ns, function(e) {
|
||||
var value = that.telInput.val();
|
||||
// save this to compare on blur
|
||||
that.telInput.data("focusVal", value);
|
||||
// on focus: if empty, insert the dial code for the currently selected flag
|
||||
if (that.options.autoHideDialCode && !value && !that.telInput.prop("readonly")) {
|
||||
that._updateVal("+" + that.selectedCountryData.dialCode, true);
|
||||
// after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one
|
||||
that.telInput.one("keypress.plus" + that.ns, function(e) {
|
||||
if (e.which == keys.PLUS) {
|
||||
// if autoFormat is enabled, this key event will have already have been handled by another keypress listener (hence we need to add the "+"). if disabled, it will be handled after this by a keyup listener (hence no need to add the "+").
|
||||
var newVal = that.options.autoFormat && window.intlTelInputUtils ? "+" : "";
|
||||
that.telInput.val(newVal);
|
||||
}
|
||||
});
|
||||
// after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that
|
||||
setTimeout(function() {
|
||||
var input = that.telInput[0];
|
||||
if (that.isGoodBrowser) {
|
||||
var len = that.telInput.val().length;
|
||||
input.setSelectionRange(len, len);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
this.telInput.on("blur" + this.ns, function() {
|
||||
if (that.options.autoHideDialCode) {
|
||||
// on blur: if just a dial code then remove it
|
||||
var value = that.telInput.val(), startsPlus = value.substr(0, 1) == "+";
|
||||
if (startsPlus) {
|
||||
var numeric = that._getNumeric(value);
|
||||
// if just a plus, or if just a dial code
|
||||
if (!numeric || that.selectedCountryData.dialCode == numeric) {
|
||||
that.telInput.val("");
|
||||
}
|
||||
}
|
||||
// remove the keypress listener we added on focus
|
||||
that.telInput.off("keypress.plus" + that.ns);
|
||||
}
|
||||
// if autoFormat, we must manually trigger change event if value has changed
|
||||
if (that.options.autoFormat && window.intlTelInputUtils && that.telInput.val() != that.telInput.data("focusVal")) {
|
||||
that.telInput.trigger("change");
|
||||
}
|
||||
});
|
||||
},
|
||||
// extract the numeric digits from the given string
|
||||
_getNumeric: function(s) {
|
||||
return s.replace(/\D/g, "");
|
||||
},
|
||||
// show the dropdown
|
||||
_showDropdown: function() {
|
||||
this._setDropdownPosition();
|
||||
// update highlighting and scroll to active list item
|
||||
var activeListItem = this.countryList.children(".active");
|
||||
this._highlightListItem(activeListItem);
|
||||
// show it
|
||||
this.countryList.removeClass("hide");
|
||||
this._scrollTo(activeListItem);
|
||||
// bind all the dropdown-related listeners: mouseover, click, click-off, keydown
|
||||
this._bindDropdownListeners();
|
||||
// update the arrow
|
||||
this.selectedFlagInner.children(".arrow").addClass("up");
|
||||
},
|
||||
// decide where to position dropdown (depends on position within viewport, and scroll)
|
||||
_setDropdownPosition: function() {
|
||||
var inputTop = this.telInput.offset().top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom)
|
||||
dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop;
|
||||
// dropdownHeight - 1 for border
|
||||
var cssTop = !dropdownFitsBelow && dropdownFitsAbove ? "-" + (this.dropdownHeight - 1) + "px" : "";
|
||||
this.countryList.css("top", cssTop);
|
||||
},
|
||||
// we only bind dropdown listeners when the dropdown is open
|
||||
_bindDropdownListeners: function() {
|
||||
var that = this;
|
||||
// when mouse over a list item, just highlight that one
|
||||
// we add the class "highlight", so if they hit "enter" we know which one to select
|
||||
this.countryList.on("mouseover" + this.ns, ".country", function(e) {
|
||||
that._highlightListItem($(this));
|
||||
});
|
||||
// listen for country selection
|
||||
this.countryList.on("click" + this.ns, ".country", function(e) {
|
||||
that._selectListItem($(this));
|
||||
});
|
||||
// click off to close
|
||||
// (except when this initial opening click is bubbling up)
|
||||
// we cannot just stopPropagation as it may be needed to close another instance
|
||||
var isOpening = true;
|
||||
$("html").on("click" + this.ns, function(e) {
|
||||
if (!isOpening) {
|
||||
that._closeDropdown();
|
||||
}
|
||||
isOpening = false;
|
||||
});
|
||||
// listen for up/down scrolling, enter to select, or letters to jump to country name.
|
||||
// use keydown as keypress doesn't fire for non-char keys and we want to catch if they
|
||||
// just hit down and hold it to scroll down (no keyup event).
|
||||
// listen on the document because that's where key events are triggered if no input has focus
|
||||
var query = "", queryTimer = null;
|
||||
$(document).on("keydown" + this.ns, function(e) {
|
||||
// prevent down key from scrolling the whole page,
|
||||
// and enter key from submitting a form etc
|
||||
e.preventDefault();
|
||||
if (e.which == keys.UP || e.which == keys.DOWN) {
|
||||
// up and down to navigate
|
||||
that._handleUpDownKey(e.which);
|
||||
} else if (e.which == keys.ENTER) {
|
||||
// enter to select
|
||||
that._handleEnterKey();
|
||||
} else if (e.which == keys.ESC) {
|
||||
// esc to close
|
||||
that._closeDropdown();
|
||||
} else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) {
|
||||
// upper case letters (note: keyup/keydown only return upper case letters)
|
||||
// jump to countries that start with the query string
|
||||
if (queryTimer) {
|
||||
clearTimeout(queryTimer);
|
||||
}
|
||||
query += String.fromCharCode(e.which);
|
||||
that._searchForCountry(query);
|
||||
// if the timer hits 1 second, reset the query
|
||||
queryTimer = setTimeout(function() {
|
||||
query = "";
|
||||
}, 1e3);
|
||||
}
|
||||
});
|
||||
},
|
||||
// highlight the next/prev item in the list (and ensure it is visible)
|
||||
_handleUpDownKey: function(key) {
|
||||
var current = this.countryList.children(".highlight").first();
|
||||
var next = key == keys.UP ? current.prev() : current.next();
|
||||
if (next.length) {
|
||||
// skip the divider
|
||||
if (next.hasClass("divider")) {
|
||||
next = key == keys.UP ? next.prev() : next.next();
|
||||
}
|
||||
this._highlightListItem(next);
|
||||
this._scrollTo(next);
|
||||
}
|
||||
},
|
||||
// select the currently highlighted item
|
||||
_handleEnterKey: function() {
|
||||
var currentCountry = this.countryList.children(".highlight").first();
|
||||
if (currentCountry.length) {
|
||||
this._selectListItem(currentCountry);
|
||||
}
|
||||
},
|
||||
// find the first list item whose name starts with the query string
|
||||
_searchForCountry: function(query) {
|
||||
for (var i = 0; i < this.countries.length; i++) {
|
||||
if (this._startsWith(this.countries[i].name, query)) {
|
||||
var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred");
|
||||
// update highlighting and scroll
|
||||
this._highlightListItem(listItem);
|
||||
this._scrollTo(listItem, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
// check if (uppercase) string a starts with string b
|
||||
_startsWith: function(a, b) {
|
||||
return a.substr(0, b.length).toUpperCase() == b;
|
||||
},
|
||||
// update the input's value to the given val
|
||||
// if autoFormat=true, format it first according to the country-specific formatting rules
|
||||
_updateVal: function(val, addSuffix) {
|
||||
var formatted;
|
||||
if (this.options.autoFormat && window.intlTelInputUtils) {
|
||||
formatted = intlTelInputUtils.formatNumber(val, this.selectedCountryData.iso2, addSuffix, this.options.preventInvalidNumbers);
|
||||
// ensure we dont go over maxlength. we must do this here to truncate any formatting suffix, and also handle paste events
|
||||
var max = this.telInput.attr("maxlength");
|
||||
if (max && formatted.length > max) {
|
||||
formatted = formatted.substr(0, max);
|
||||
}
|
||||
} else {
|
||||
// no autoFormat, so just insert the original value
|
||||
formatted = val;
|
||||
}
|
||||
this.telInput.val(formatted);
|
||||
},
|
||||
// check if need to select a new flag based on the given number
|
||||
_updateFlagFromNumber: function(number) {
|
||||
// if we're in nationalMode and we're on US/Canada, make sure the number starts with a +1 so _getDialCode will be able to extract the area code
|
||||
// update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit
|
||||
if (this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.substr(0, 1) != "+") {
|
||||
number = "+1" + number;
|
||||
}
|
||||
// try and extract valid dial code from input
|
||||
var dialCode = this._getDialCode(number);
|
||||
if (dialCode) {
|
||||
// check if one of the matching countries is already selected
|
||||
var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = this.selectedCountryData && $.inArray(this.selectedCountryData.iso2, countryCodes) != -1;
|
||||
// if a matching country is not already selected (or this is an unknown NANP area code): choose the first in the list
|
||||
if (!alreadySelected || this._isUnknownNanp(number, dialCode)) {
|
||||
// if using onlyCountries option, countryCodes[0] may be empty, so we must find the first non-empty index
|
||||
for (var j = 0; j < countryCodes.length; j++) {
|
||||
if (countryCodes[j]) {
|
||||
this._selectFlag(countryCodes[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// check if the given number contains an unknown area code from the North American Numbering Plan i.e. the only dialCode that could be extracted was +1 but the actual number's length is >=4
|
||||
_isUnknownNanp: function(number, dialCode) {
|
||||
return dialCode == "+1" && this._getNumeric(number).length >= 4;
|
||||
},
|
||||
// remove highlighting from other list items and highlight the given item
|
||||
_highlightListItem: function(listItem) {
|
||||
this.countryListItems.removeClass("highlight");
|
||||
listItem.addClass("highlight");
|
||||
},
|
||||
// find the country data for the given country code
|
||||
// the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
||||
_getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) {
|
||||
var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
|
||||
for (var i = 0; i < countryList.length; i++) {
|
||||
if (countryList[i].iso2 == countryCode) {
|
||||
return countryList[i];
|
||||
}
|
||||
}
|
||||
if (allowFail) {
|
||||
return null;
|
||||
} else {
|
||||
throw new Error("No country data for '" + countryCode + "'");
|
||||
}
|
||||
},
|
||||
// select the given flag, update the placeholder and the active list item
|
||||
_selectFlag: function(countryCode) {
|
||||
// do this first as it will throw an error and stop if countryCode is invalid
|
||||
this.selectedCountryData = this._getCountryData(countryCode, false, false);
|
||||
this.selectedFlagInner.attr("class", "iti-flag " + countryCode);
|
||||
// update the selected country's title attribute
|
||||
var title = this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode;
|
||||
this.selectedFlagInner.parent().attr("title", title);
|
||||
// and the input's placeholder
|
||||
this._updatePlaceholder();
|
||||
// update the active list item
|
||||
this.countryListItems.removeClass("active");
|
||||
this.countryListItems.children(".iti-flag." + countryCode).first().parent().addClass("active");
|
||||
},
|
||||
// update the input placeholder to an example number from the currently selected country
|
||||
_updatePlaceholder: function() {
|
||||
if (window.intlTelInputUtils && !this.hadInitialPlaceholder) {
|
||||
var iso2 = this.selectedCountryData.iso2, numberType = intlTelInputUtils.numberType[this.options.numberType || "FIXED_LINE"], placeholder = intlTelInputUtils.getExampleNumber(iso2, this.options.nationalMode, numberType);
|
||||
this.telInput.attr("placeholder", placeholder);
|
||||
}
|
||||
},
|
||||
// called when the user selects a list item from the dropdown
|
||||
_selectListItem: function(listItem) {
|
||||
// update selected flag and active list item
|
||||
var countryCode = listItem.attr("data-country-code");
|
||||
this._selectFlag(countryCode);
|
||||
this._closeDropdown();
|
||||
this._updateDialCode(listItem.attr("data-dial-code"), true);
|
||||
// always fire the change event as even if nationalMode=true (and we haven't updated the input val), the system as a whole has still changed - see country-sync example. think of it as making a selection from a select element.
|
||||
this.telInput.trigger("change");
|
||||
// focus the input
|
||||
this.telInput.focus();
|
||||
},
|
||||
// close the dropdown and unbind any listeners
|
||||
_closeDropdown: function() {
|
||||
this.countryList.addClass("hide");
|
||||
// update the arrow
|
||||
this.selectedFlagInner.children(".arrow").removeClass("up");
|
||||
// unbind key events
|
||||
$(document).off(this.ns);
|
||||
// unbind click-off-to-close
|
||||
$("html").off(this.ns);
|
||||
// unbind hover and click listeners
|
||||
this.countryList.off(this.ns);
|
||||
},
|
||||
// check if an element is visible within it's container, else scroll until it is
|
||||
_scrollTo: function(element, middle) {
|
||||
var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2;
|
||||
if (elementTop < containerTop) {
|
||||
// scroll up
|
||||
if (middle) {
|
||||
newScrollTop -= middleOffset;
|
||||
}
|
||||
container.scrollTop(newScrollTop);
|
||||
} else if (elementBottom > containerBottom) {
|
||||
// scroll down
|
||||
if (middle) {
|
||||
newScrollTop += middleOffset;
|
||||
}
|
||||
var heightDifference = containerHeight - elementHeight;
|
||||
container.scrollTop(newScrollTop - heightDifference);
|
||||
}
|
||||
},
|
||||
// replace any existing dial code with the new one (if not in nationalMode)
|
||||
// also we need to know if we're focusing for a couple of reasons e.g. if so, we want to add any formatting suffix, also if the input is empty and we're not in nationalMode, then we want to insert the dial code
|
||||
_updateDialCode: function(newDialCode, focusing) {
|
||||
var inputVal = this.telInput.val(), newNumber;
|
||||
// save having to pass this every time
|
||||
newDialCode = "+" + newDialCode;
|
||||
if (this.options.nationalMode && inputVal.substr(0, 1) != "+") {
|
||||
// if nationalMode, we just want to re-format
|
||||
newNumber = inputVal;
|
||||
} else if (inputVal) {
|
||||
// if the previous number contained a valid dial code, replace it
|
||||
// (if more than just a plus character)
|
||||
var prevDialCode = this._getDialCode(inputVal);
|
||||
if (prevDialCode.length > 1) {
|
||||
newNumber = inputVal.replace(prevDialCode, newDialCode);
|
||||
} else {
|
||||
// if the previous number didn't contain a dial code, we should persist it
|
||||
var existingNumber = inputVal.substr(0, 1) != "+" ? $.trim(inputVal) : "";
|
||||
newNumber = newDialCode + existingNumber;
|
||||
}
|
||||
} else {
|
||||
newNumber = !this.options.autoHideDialCode || focusing ? newDialCode : "";
|
||||
}
|
||||
this._updateVal(newNumber, focusing);
|
||||
},
|
||||
// try and extract a valid international dial code from a full telephone number
|
||||
// Note: returns the raw string inc plus character and any whitespace/dots etc
|
||||
_getDialCode: function(number) {
|
||||
var dialCode = "";
|
||||
// only interested in international numbers (starting with a plus)
|
||||
if (number.charAt(0) == "+") {
|
||||
var numericChars = "";
|
||||
// iterate over chars
|
||||
for (var i = 0; i < number.length; i++) {
|
||||
var c = number.charAt(i);
|
||||
// if char is number
|
||||
if ($.isNumeric(c)) {
|
||||
numericChars += c;
|
||||
// if current numericChars make a valid dial code
|
||||
if (this.countryCodes[numericChars]) {
|
||||
// store the actual raw string (useful for matching later)
|
||||
dialCode = number.substr(0, i + 1);
|
||||
}
|
||||
// longest dial code is 4 chars
|
||||
if (numericChars.length == 4) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dialCode;
|
||||
},
|
||||
/********************
|
||||
* PUBLIC METHODS
|
||||
********************/
|
||||
// remove plugin
|
||||
destroy: function() {
|
||||
// make sure the dropdown is closed (and unbind listeners)
|
||||
this._closeDropdown();
|
||||
// key events, and focus/blur events if autoHideDialCode=true
|
||||
this.telInput.off(this.ns);
|
||||
// click event to open dropdown
|
||||
this.selectedFlagInner.parent().off(this.ns);
|
||||
// label click hack
|
||||
this.telInput.closest("label").off(this.ns);
|
||||
// remove markup
|
||||
var container = this.telInput.parent();
|
||||
container.before(this.telInput).remove();
|
||||
},
|
||||
// format the number to the given type
|
||||
getNumber: function(type) {
|
||||
if (window.intlTelInputUtils) {
|
||||
return intlTelInputUtils.formatNumberByType(this.telInput.val(), this.selectedCountryData.iso2, type);
|
||||
}
|
||||
return "";
|
||||
},
|
||||
// get the type of the entered number e.g. landline/mobile
|
||||
getNumberType: function() {
|
||||
if (window.intlTelInputUtils) {
|
||||
return intlTelInputUtils.getNumberType(this.telInput.val(), this.selectedCountryData.iso2);
|
||||
}
|
||||
return -99;
|
||||
},
|
||||
// get the country data for the currently selected flag
|
||||
getSelectedCountryData: function() {
|
||||
// if this is undefined, the plugin will return it's instance instead, so in that case an empty object makes more sense
|
||||
return this.selectedCountryData || {};
|
||||
},
|
||||
// get the validation error
|
||||
getValidationError: function() {
|
||||
if (window.intlTelInputUtils) {
|
||||
return intlTelInputUtils.getValidationError(this.telInput.val(), this.selectedCountryData.iso2);
|
||||
}
|
||||
return -99;
|
||||
},
|
||||
// validate the input val - assumes the global function isValidNumber (from utilsScript)
|
||||
isValidNumber: function() {
|
||||
var val = $.trim(this.telInput.val()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "", // libphonenumber allows alpha chars, but in order to allow that, we'd need a method to retrieve the processed number, with letters replaced with numbers
|
||||
containsAlpha = /[a-zA-Z]/.test(val);
|
||||
if (!containsAlpha && window.intlTelInputUtils) {
|
||||
return intlTelInputUtils.isValidNumber(val, countryCode);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
// load the utils script
|
||||
loadUtils: function(path) {
|
||||
var utilsScript = path || this.options.utilsScript;
|
||||
if (!$.fn[pluginName].loadedUtilsScript && utilsScript) {
|
||||
// don't do this twice! (dont just check if the global intlTelInputUtils exists as if init plugin multiple times in quick succession, it may not have finished loading yet)
|
||||
$.fn[pluginName].loadedUtilsScript = true;
|
||||
// dont use $.getScript as it prevents caching
|
||||
$.ajax({
|
||||
url: utilsScript,
|
||||
success: function() {
|
||||
// tell all instances the utils are ready
|
||||
$(".intl-tel-input input").intlTelInput("utilsLoaded");
|
||||
},
|
||||
dataType: "script",
|
||||
cache: true
|
||||
});
|
||||
}
|
||||
},
|
||||
// update the selected flag, and update the input val accordingly
|
||||
selectCountry: function(countryCode) {
|
||||
// check if already selected
|
||||
if (!this.selectedFlagInner.hasClass(countryCode)) {
|
||||
this._selectFlag(countryCode);
|
||||
this._updateDialCode(this.selectedCountryData.dialCode, false);
|
||||
}
|
||||
},
|
||||
// set the input value and update the flag
|
||||
setNumber: function(number, addSuffix) {
|
||||
// ensure starts with plus
|
||||
if (!this.options.nationalMode && number.substr(0, 1) != "+") {
|
||||
number = "+" + number;
|
||||
}
|
||||
// we must update the flag first, which updates this.selectedCountryData, which is used later for formatting the number before displaying it
|
||||
this._updateFlagFromNumber(number);
|
||||
this._updateVal(number, addSuffix);
|
||||
},
|
||||
// this is called when the utils are ready
|
||||
utilsLoaded: function() {
|
||||
// if autoFormat is enabled and there's an initial value in the input, then format it
|
||||
if (this.options.autoFormat && this.telInput.val()) {
|
||||
this._updateVal(this.telInput.val());
|
||||
}
|
||||
this._updatePlaceholder();
|
||||
}
|
||||
};
|
||||
// adapted to allow public functions
|
||||
// using https://github.com/jquery-boilerplate/jquery-boilerplate/wiki/Extending-jQuery-Boilerplate
|
||||
$.fn[pluginName] = function(options) {
|
||||
var args = arguments;
|
||||
// Is the first parameter an object (options), or was omitted,
|
||||
// instantiate a new instance of the plugin.
|
||||
if (options === undefined || typeof options === "object") {
|
||||
return this.each(function() {
|
||||
if (!$.data(this, "plugin_" + pluginName)) {
|
||||
$.data(this, "plugin_" + pluginName, new Plugin(this, options));
|
||||
}
|
||||
});
|
||||
} else if (typeof options === "string" && options[0] !== "_" && options !== "init") {
|
||||
// If the first parameter is a string and it doesn't start
|
||||
// with an underscore or "contains" the `init`-function,
|
||||
// treat this as a call to a public method.
|
||||
// Cache the method call to make it possible to return a value
|
||||
var returns;
|
||||
this.each(function() {
|
||||
var instance = $.data(this, "plugin_" + pluginName);
|
||||
// Tests that there's already a plugin-instance
|
||||
// and checks that the requested public method exists
|
||||
if (instance instanceof Plugin && typeof instance[options] === "function") {
|
||||
// Call the method of our plugin instance,
|
||||
// and pass it the supplied arguments.
|
||||
returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
|
||||
}
|
||||
// Allow instances to be destroyed via the 'destroy' method
|
||||
if (options === "destroy") {
|
||||
$.data(this, "plugin_" + pluginName, null);
|
||||
}
|
||||
});
|
||||
// If the earlier cached method gives a value back return the value,
|
||||
// otherwise return this to preserve chainability.
|
||||
return returns !== undefined ? returns : this;
|
||||
}
|
||||
};
|
||||
/********************
|
||||
* STATIC METHODS
|
||||
********************/
|
||||
// get the country data object
|
||||
$.fn[pluginName].getCountryData = function() {
|
||||
return allCountries;
|
||||
};
|
||||
// Tell JSHint to ignore this warning: "character may get silently deleted by one or more browsers"
|
||||
// jshint -W100
|
||||
// Array of country objects for the flag dropdown.
|
||||
// Each contains a name, country code (ISO 3166-1 alpha-2) and dial code.
|
||||
// Originally from https://github.com/mledoze/countries
|
||||
// then modified using the following JavaScript (NOW OUT OF DATE):
|
||||
/*
|
||||
var result = [];
|
||||
_.each(countries, function(c) {
|
||||
// ignore countries without a dial code
|
||||
if (c.callingCode[0].length) {
|
||||
result.push({
|
||||
// var locals contains country names with localised versions in brackets
|
||||
n: _.findWhere(locals, {
|
||||
countryCode: c.cca2
|
||||
}).name,
|
||||
i: c.cca2.toLowerCase(),
|
||||
d: c.callingCode[0]
|
||||
});
|
||||
}
|
||||
});
|
||||
JSON.stringify(result);
|
||||
*/
|
||||
// then with a couple of manual re-arrangements to be alphabetical
|
||||
// then changed Kazakhstan from +76 to +7
|
||||
// and Vatican City from +379 to +39 (see issue 50)
|
||||
// and Caribean Netherlands from +5997 to +599
|
||||
// and Curacao from +5999 to +599
|
||||
// Removed: Åland Islands, Christmas Island, Cocos Islands, Guernsey, Isle of Man, Jersey, Kosovo, Mayotte, Pitcairn Islands, South Georgia, Svalbard, Western Sahara
|
||||
// Update: converted objects to arrays to save bytes!
|
||||
// Update: added "priority" for countries with the same dialCode as others
|
||||
// Update: added array of area codes for countries with the same dialCode as others
|
||||
// So each country array has the following information:
|
||||
// [
|
||||
// Country name,
|
||||
// iso2 code,
|
||||
// International dial code,
|
||||
// Order (if >1 country with same dial code),
|
||||
// Area codes (if >1 country with same dial code)
|
||||
// ]
|
||||
var allCountries = [ [ "Afghanistan (افغانستان)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (الجزائر)", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61" ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain (البحرين)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Colombia", "co", "57" ], [ "Comoros (جزر القمر)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (مصر)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358" ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (ایران)", "ir", "98" ], [ "Iraq (العراق)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Israel (ישראל)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan (日本)", "jp", "81" ], [ "Jordan (الأردن)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kuwait (الكويت)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (لبنان)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (ليبيا)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo",
Line truncated
|
||||
// loop over all of the countries above
|
||||
for (var i = 0; i < allCountries.length; i++) {
|
||||
var c = allCountries[i];
|
||||
allCountries[i] = {
|
||||
name: c[0],
|
||||
iso2: c[1],
|
||||
dialCode: c[2],
|
||||
priority: c[3] || 0,
|
||||
areaCodes: c[4] || null
|
||||
};
|
||||
}
|
||||
});
|
||||
Vendored
-9205
File diff suppressed because it is too large.
Load diff
@@ -1,270 +0,0 @@
|
||||
@charset "utf-8";
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#mocha {
|
||||
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
margin: 60px 50px;
|
||||
}
|
||||
|
||||
#mocha ul,
|
||||
#mocha li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mocha ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#mocha h1,
|
||||
#mocha h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mocha h1 {
|
||||
margin-top: 15px;
|
||||
font-size: 1em;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
#mocha h1 a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha h1 a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#mocha .suite .suite h1 {
|
||||
margin-top: 0;
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
#mocha .hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mocha .suite {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test {
|
||||
margin-left: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#mocha .test.pending:hover h2::after {
|
||||
content: '(pending)';
|
||||
font-family: arial, sans-serif;
|
||||
}
|
||||
|
||||
#mocha .test.pass.medium .duration {
|
||||
background: #c09853;
|
||||
}
|
||||
|
||||
#mocha .test.pass.slow .duration {
|
||||
background: #b94a48;
|
||||
}
|
||||
|
||||
#mocha .test.pass::before {
|
||||
content: '✓';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #00d6b2;
|
||||
}
|
||||
|
||||
#mocha .test.pass .duration {
|
||||
font-size: 9px;
|
||||
margin-left: 5px;
|
||||
padding: 2px 5px;
|
||||
color: #fff;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#mocha .test.pass.fast .duration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha .test.pending {
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.pending::before {
|
||||
content: '◦';
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.fail {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test.fail pre {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha .test.fail::before {
|
||||
content: '✖';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre.error {
|
||||
color: #c00;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* (1): approximate for browsers not supporting calc
|
||||
* (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
|
||||
* ^^ seriously
|
||||
*/
|
||||
#mocha .test pre {
|
||||
display: block;
|
||||
float: left;
|
||||
clear: left;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
max-width: 85%; /*(1)*/
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-border-radius: 3px;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#mocha .test h2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#mocha .test a.replay {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 0;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
background: #eee;
|
||||
font-size: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
-webkit-transition: opacity 200ms;
|
||||
-moz-transition: opacity 200ms;
|
||||
transition: opacity 200ms;
|
||||
opacity: 0.3;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#mocha .test:hover a.replay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#mocha-report.pass .test.fail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.fail .test.pass {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.pending .test.pass,
|
||||
#mocha-report.pending .test.fail {
|
||||
display: none;
|
||||
}
|
||||
#mocha-report.pending .test.pass.pending {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mocha-error {
|
||||
color: #c00;
|
||||
font-size: 1.5em;
|
||||
font-weight: 100;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
#mocha-stats {
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
color: #888;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#mocha-stats .progress {
|
||||
float: right;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#mocha-stats em {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha-stats a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha-stats a:hover {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
#mocha-stats li {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
list-style: none;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
#mocha-stats canvas {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#mocha code .comment { color: #ddd; }
|
||||
#mocha code .init { color: #2f6fad; }
|
||||
#mocha code .string { color: #5890ad; }
|
||||
#mocha code .keyword { color: #8a6343; }
|
||||
#mocha code .number { color: #2f6fad; }
|
||||
|
||||
@media screen and (max-device-width: 480px) {
|
||||
#mocha {
|
||||
margin: 60px 0px;
|
||||
}
|
||||
|
||||
#mocha #stats {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,570 +0,0 @@
|
||||
/*!
|
||||
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
||||
* http://github.com/janl/mustache.js
|
||||
*/
|
||||
|
||||
/*global define: false*/
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof exports === "object" && exports) {
|
||||
factory(exports); // CommonJS
|
||||
} else {
|
||||
var mustache = {};
|
||||
factory(mustache);
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(mustache); // AMD
|
||||
} else {
|
||||
root.Mustache = mustache; // <script>
|
||||
}
|
||||
}
|
||||
}(this, function (mustache) {
|
||||
|
||||
// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
|
||||
// See https://github.com/janl/mustache.js/issues/189
|
||||
var RegExp_test = RegExp.prototype.test;
|
||||
function testRegExp(re, string) {
|
||||
return RegExp_test.call(re, string);
|
||||
}
|
||||
|
||||
var nonSpaceRe = /\S/;
|
||||
function isWhitespace(string) {
|
||||
return !testRegExp(nonSpaceRe, string);
|
||||
}
|
||||
|
||||
var Object_toString = Object.prototype.toString;
|
||||
var isArray = Array.isArray || function (object) {
|
||||
return Object_toString.call(object) === '[object Array]';
|
||||
};
|
||||
|
||||
function isFunction(object) {
|
||||
return typeof object === 'function';
|
||||
}
|
||||
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
var entityMap = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
"/": '/'
|
||||
};
|
||||
|
||||
function escapeHtml(string) {
|
||||
return String(string).replace(/[&<>"'\/]/g, function (s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
}
|
||||
|
||||
function escapeTags(tags) {
|
||||
if (!isArray(tags) || tags.length !== 2) {
|
||||
throw new Error('Invalid tags: ' + tags);
|
||||
}
|
||||
|
||||
return [
|
||||
new RegExp(escapeRegExp(tags[0]) + "\\s*"),
|
||||
new RegExp("\\s*" + escapeRegExp(tags[1]))
|
||||
];
|
||||
}
|
||||
|
||||
var whiteRe = /\s*/;
|
||||
var spaceRe = /\s+/;
|
||||
var equalsRe = /\s*=/;
|
||||
var curlyRe = /\s*\}/;
|
||||
var tagRe = /#|\^|\/|>|\{|&|=|!/;
|
||||
|
||||
/**
|
||||
* Breaks up the given `template` string into a tree of tokens. If the `tags`
|
||||
* argument is given here it must be an array with two string values: the
|
||||
* opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of
|
||||
* course, the default is to use mustaches (i.e. mustache.tags).
|
||||
*
|
||||
* A token is an array with at least 4 elements. The first element is the
|
||||
* mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag
|
||||
* did not contain a symbol (i.e. {{myValue}}) this element is "name". For
|
||||
* all text that appears outside a symbol this element is "text".
|
||||
*
|
||||
* The second element of a token is its "value". For mustache tags this is
|
||||
* whatever else was inside the tag besides the opening symbol. For text tokens
|
||||
* this is the text itself.
|
||||
*
|
||||
* The third and fourth elements of the token are the start and end indices,
|
||||
* respectively, of the token in the original template.
|
||||
*
|
||||
* Tokens that are the root node of a subtree contain two more elements: 1) an
|
||||
* array of tokens in the subtree and 2) the index in the original template at
|
||||
* which the closing tag for that section begins.
|
||||
*/
|
||||
function parseTemplate(template, tags) {
|
||||
tags = tags || mustache.tags;
|
||||
template = template || '';
|
||||
|
||||
if (typeof tags === 'string') {
|
||||
tags = tags.split(spaceRe);
|
||||
}
|
||||
|
||||
var tagRes = escapeTags(tags);
|
||||
var scanner = new Scanner(template);
|
||||
|
||||
var sections = []; // Stack to hold section tokens
|
||||
var tokens = []; // Buffer to hold the tokens
|
||||
var spaces = []; // Indices of whitespace tokens on the current line
|
||||
var hasTag = false; // Is there a {{tag}} on the current line?
|
||||
var nonSpace = false; // Is there a non-space char on the current line?
|
||||
|
||||
// Strips all whitespace tokens array for the current line
|
||||
// if there was a {{#tag}} on it and otherwise only space.
|
||||
function stripSpace() {
|
||||
if (hasTag && !nonSpace) {
|
||||
while (spaces.length) {
|
||||
delete tokens[spaces.pop()];
|
||||
}
|
||||
} else {
|
||||
spaces = [];
|
||||
}
|
||||
|
||||
hasTag = false;
|
||||
nonSpace = false;
|
||||
}
|
||||
|
||||
var start, type, value, chr, token, openSection;
|
||||
while (!scanner.eos()) {
|
||||
start = scanner.pos;
|
||||
|
||||
// Match any text between tags.
|
||||
value = scanner.scanUntil(tagRes[0]);
|
||||
if (value) {
|
||||
for (var i = 0, len = value.length; i < len; ++i) {
|
||||
chr = value.charAt(i);
|
||||
|
||||
if (isWhitespace(chr)) {
|
||||
spaces.push(tokens.length);
|
||||
} else {
|
||||
nonSpace = true;
|
||||
}
|
||||
|
||||
tokens.push(['text', chr, start, start + 1]);
|
||||
start += 1;
|
||||
|
||||
// Check for whitespace on the current line.
|
||||
if (chr === '\n') {
|
||||
stripSpace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Match the opening tag.
|
||||
if (!scanner.scan(tagRes[0])) break;
|
||||
hasTag = true;
|
||||
|
||||
// Get the tag type.
|
||||
type = scanner.scan(tagRe) || 'name';
|
||||
scanner.scan(whiteRe);
|
||||
|
||||
// Get the tag value.
|
||||
if (type === '=') {
|
||||
value = scanner.scanUntil(equalsRe);
|
||||
scanner.scan(equalsRe);
|
||||
scanner.scanUntil(tagRes[1]);
|
||||
} else if (type === '{') {
|
||||
value = scanner.scanUntil(new RegExp('\\s*' + escapeRegExp('}' + tags[1])));
|
||||
scanner.scan(curlyRe);
|
||||
scanner.scanUntil(tagRes[1]);
|
||||
type = '&';
|
||||
} else {
|
||||
value = scanner.scanUntil(tagRes[1]);
|
||||
}
|
||||
|
||||
// Match the closing tag.
|
||||
if (!scanner.scan(tagRes[1])) {
|
||||
throw new Error('Unclosed tag at ' + scanner.pos);
|
||||
}
|
||||
|
||||
token = [ type, value, start, scanner.pos ];
|
||||
tokens.push(token);
|
||||
|
||||
if (type === '#' || type === '^') {
|
||||
sections.push(token);
|
||||
} else if (type === '/') {
|
||||
// Check section nesting.
|
||||
openSection = sections.pop();
|
||||
|
||||
if (!openSection) {
|
||||
throw new Error('Unopened section "' + value + '" at ' + start);
|
||||
}
|
||||
if (openSection[1] !== value) {
|
||||
throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
|
||||
}
|
||||
} else if (type === 'name' || type === '{' || type === '&') {
|
||||
nonSpace = true;
|
||||
} else if (type === '=') {
|
||||
// Set the tags for the next time around.
|
||||
tagRes = escapeTags(tags = value.split(spaceRe));
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure there are no open sections when we're done.
|
||||
openSection = sections.pop();
|
||||
if (openSection) {
|
||||
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
|
||||
}
|
||||
|
||||
return nestTokens(squashTokens(tokens));
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines the values of consecutive text tokens in the given `tokens` array
|
||||
* to a single token.
|
||||
*/
|
||||
function squashTokens(tokens) {
|
||||
var squashedTokens = [];
|
||||
|
||||
var token, lastToken;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
if (token) {
|
||||
if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
|
||||
lastToken[1] += token[1];
|
||||
lastToken[3] = token[3];
|
||||
} else {
|
||||
squashedTokens.push(token);
|
||||
lastToken = token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return squashedTokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forms the given array of `tokens` into a nested tree structure where
|
||||
* tokens that represent a section have two additional items: 1) an array of
|
||||
* all tokens that appear in that section and 2) the index in the original
|
||||
* template that represents the end of that section.
|
||||
*/
|
||||
function nestTokens(tokens) {
|
||||
var nestedTokens = [];
|
||||
var collector = nestedTokens;
|
||||
var sections = [];
|
||||
|
||||
var token, section;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case '#':
|
||||
case '^':
|
||||
collector.push(token);
|
||||
sections.push(token);
|
||||
collector = token[4] = [];
|
||||
break;
|
||||
case '/':
|
||||
section = sections.pop();
|
||||
section[5] = token[2];
|
||||
collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
|
||||
break;
|
||||
default:
|
||||
collector.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
return nestedTokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple string scanner that is used by the template parser to find
|
||||
* tokens in template strings.
|
||||
*/
|
||||
function Scanner(string) {
|
||||
this.string = string;
|
||||
this.tail = string;
|
||||
this.pos = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the tail is empty (end of string).
|
||||
*/
|
||||
Scanner.prototype.eos = function () {
|
||||
return this.tail === "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Tries to match the given regular expression at the current position.
|
||||
* Returns the matched text if it can match, the empty string otherwise.
|
||||
*/
|
||||
Scanner.prototype.scan = function (re) {
|
||||
var match = this.tail.match(re);
|
||||
|
||||
if (match && match.index === 0) {
|
||||
var string = match[0];
|
||||
this.tail = this.tail.substring(string.length);
|
||||
this.pos += string.length;
|
||||
return string;
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Skips all text until the given regular expression can be matched. Returns
|
||||
* the skipped string, which is the entire tail if no match can be made.
|
||||
*/
|
||||
Scanner.prototype.scanUntil = function (re) {
|
||||
var index = this.tail.search(re), match;
|
||||
|
||||
switch (index) {
|
||||
case -1:
|
||||
match = this.tail;
|
||||
this.tail = "";
|
||||
break;
|
||||
case 0:
|
||||
match = "";
|
||||
break;
|
||||
default:
|
||||
match = this.tail.substring(0, index);
|
||||
this.tail = this.tail.substring(index);
|
||||
}
|
||||
|
||||
this.pos += match.length;
|
||||
|
||||
return match;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a rendering context by wrapping a view object and
|
||||
* maintaining a reference to the parent context.
|
||||
*/
|
||||
function Context(view, parentContext) {
|
||||
this.view = view == null ? {} : view;
|
||||
this.cache = { '.': this.view };
|
||||
this.parent = parentContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new context using the given view with this context
|
||||
* as the parent.
|
||||
*/
|
||||
Context.prototype.push = function (view) {
|
||||
return new Context(view, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the given name in this context, traversing
|
||||
* up the context hierarchy if the value is absent in this context's view.
|
||||
*/
|
||||
Context.prototype.lookup = function (name) {
|
||||
var value;
|
||||
if (name in this.cache) {
|
||||
value = this.cache[name];
|
||||
} else {
|
||||
var context = this;
|
||||
|
||||
while (context) {
|
||||
if (name.indexOf('.') > 0) {
|
||||
value = context.view;
|
||||
|
||||
var names = name.split('.'), i = 0;
|
||||
while (value != null && i < names.length) {
|
||||
value = value[names[i++]];
|
||||
}
|
||||
} else {
|
||||
value = context.view[name];
|
||||
}
|
||||
|
||||
if (value != null) break;
|
||||
|
||||
context = context.parent;
|
||||
}
|
||||
|
||||
this.cache[name] = value;
|
||||
}
|
||||
|
||||
if (isFunction(value)) {
|
||||
value = value.call(this.view);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
/**
|
||||
* A Writer knows how to take a stream of tokens and render them to a
|
||||
* string, given a context. It also maintains a cache of templates to
|
||||
* avoid the need to parse the same template twice.
|
||||
*/
|
||||
function Writer() {
|
||||
this.cache = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all cached templates in this writer.
|
||||
*/
|
||||
Writer.prototype.clearCache = function () {
|
||||
this.cache = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses and caches the given `template` and returns the array of tokens
|
||||
* that is generated from the parse.
|
||||
*/
|
||||
Writer.prototype.parse = function (template, tags) {
|
||||
var cache = this.cache;
|
||||
var tokens = cache[template];
|
||||
|
||||
if (tokens == null) {
|
||||
tokens = cache[template] = parseTemplate(template, tags);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
};
|
||||
|
||||
/**
|
||||
* High-level method that is used to render the given `template` with
|
||||
* the given `view`.
|
||||
*
|
||||
* The optional `partials` argument may be an object that contains the
|
||||
* names and templates of partials that are used in the template. It may
|
||||
* also be a function that is used to load partial templates on the fly
|
||||
* that takes a single argument: the name of the partial.
|
||||
*/
|
||||
Writer.prototype.render = function (template, view, partials) {
|
||||
var tokens = this.parse(template);
|
||||
var context = (view instanceof Context) ? view : new Context(view);
|
||||
return this.renderTokens(tokens, context, partials, template);
|
||||
};
|
||||
|
||||
/**
|
||||
* Low-level method that renders the given array of `tokens` using
|
||||
* the given `context` and `partials`.
|
||||
*
|
||||
* Note: The `originalTemplate` is only ever used to extract the portion
|
||||
* of the original template that was contained in a higher-order section.
|
||||
* If the template doesn't use higher-order sections, this argument may
|
||||
* be omitted.
|
||||
*/
|
||||
Writer.prototype.renderTokens = function (tokens, context, partials, originalTemplate) {
|
||||
var buffer = '';
|
||||
|
||||
// This function is used to render an arbitrary template
|
||||
// in the current context by higher-order sections.
|
||||
var self = this;
|
||||
function subRender(template) {
|
||||
return self.render(template, context, partials);
|
||||
}
|
||||
|
||||
var token, value;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case '#':
|
||||
value = context.lookup(token[1]);
|
||||
if (!value) continue;
|
||||
|
||||
if (isArray(value)) {
|
||||
for (var j = 0, jlen = value.length; j < jlen; ++j) {
|
||||
buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);
|
||||
}
|
||||
} else if (typeof value === 'object' || typeof value === 'string') {
|
||||
buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);
|
||||
} else if (isFunction(value)) {
|
||||
if (typeof originalTemplate !== 'string') {
|
||||
throw new Error('Cannot use higher-order sections without the original template');
|
||||
}
|
||||
|
||||
// Extract the portion of the original template that the section contains.
|
||||
value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
|
||||
|
||||
if (value != null) buffer += value;
|
||||
} else {
|
||||
buffer += this.renderTokens(token[4], context, partials, originalTemplate);
|
||||
}
|
||||
|
||||
break;
|
||||
case '^':
|
||||
value = context.lookup(token[1]);
|
||||
|
||||
// Use JavaScript's definition of falsy. Include empty arrays.
|
||||
// See https://github.com/janl/mustache.js/issues/186
|
||||
if (!value || (isArray(value) && value.length === 0)) {
|
||||
buffer += this.renderTokens(token[4], context, partials, originalTemplate);
|
||||
}
|
||||
|
||||
break;
|
||||
case '>':
|
||||
if (!partials) continue;
|
||||
value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
|
||||
if (value != null) buffer += this.renderTokens(this.parse(value), context, partials, value);
|
||||
break;
|
||||
case '&':
|
||||
value = context.lookup(token[1]);
|
||||
if (value != null) buffer += value;
|
||||
break;
|
||||
case 'name':
|
||||
value = context.lookup(token[1]);
|
||||
if (value != null) buffer += mustache.escape(value);
|
||||
break;
|
||||
case 'text':
|
||||
buffer += token[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
};
|
||||
|
||||
mustache.name = "mustache.js";
|
||||
mustache.version = "0.8.1";
|
||||
mustache.tags = [ "{{", "}}" ];
|
||||
|
||||
// All high-level mustache.* functions use this writer.
|
||||
var defaultWriter = new Writer();
|
||||
|
||||
/**
|
||||
* Clears all cached templates in the default writer.
|
||||
*/
|
||||
mustache.clearCache = function () {
|
||||
return defaultWriter.clearCache();
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses and caches the given template in the default writer and returns the
|
||||
* array of tokens it contains. Doing this ahead of time avoids the need to
|
||||
* parse templates on the fly as they are rendered.
|
||||
*/
|
||||
mustache.parse = function (template, tags) {
|
||||
return defaultWriter.parse(template, tags);
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders the `template` with the given `view` and `partials` using the
|
||||
* default writer.
|
||||
*/
|
||||
mustache.render = function (template, view, partials) {
|
||||
return defaultWriter.render(template, view, partials);
|
||||
};
|
||||
|
||||
// This is here for backwards compatibility with 0.4.x.
|
||||
mustache.to_html = function (template, view, partials, send) {
|
||||
var result = mustache.render(template, view, partials);
|
||||
|
||||
if (isFunction(send)) {
|
||||
send(result);
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
// Export the escaping function so that the user may override it.
|
||||
// See https://github.com/janl/mustache.js/issues/244
|
||||
mustache.escape = escapeHtml;
|
||||
|
||||
// Export these mainly for testing, but also for advanced usage.
|
||||
mustache.Scanner = Scanner;
|
||||
mustache.Context = Context;
|
||||
mustache.Writer = Writer;
|
||||
|
||||
}));
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1 +0,0 @@
|
||||
../components/intl-tel-input/build/img/flags.png
|
||||
Vendored
-9205
File diff suppressed because it is too large.
Load diff
+10
-14
@@ -915,19 +915,15 @@
|
||||
);
|
||||
});
|
||||
},
|
||||
removeIdentityKey: function(number) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var identityRecord = new IdentityRecord({ id: number });
|
||||
identityRecord
|
||||
.fetch()
|
||||
.then(function() {
|
||||
identityRecord.destroy();
|
||||
})
|
||||
.fail(function() {
|
||||
reject(new Error('Tried to remove identity for unknown number'));
|
||||
});
|
||||
resolve(textsecure.storage.protocol.removeAllSessions(number));
|
||||
});
|
||||
removeIdentityKey: async function(number) {
|
||||
const identityRecord = new IdentityRecord({ id: number });
|
||||
try {
|
||||
await wrapDeferred(identityRecord.fetch());
|
||||
await wrapDeferred(identityRecord.destroy());
|
||||
return textsecure.storage.protocol.removeAllSessions(number);
|
||||
} catch (error) {
|
||||
throw new Error('Tried to remove identity for unknown number');
|
||||
}
|
||||
},
|
||||
|
||||
// Groups
|
||||
@@ -972,7 +968,7 @@
|
||||
return collection.fetch().then(resolve, reject);
|
||||
}).then(function() {
|
||||
// Return a plain array of plain objects
|
||||
return collection.map('attributes');
|
||||
return collection.map(model => model.attributes);
|
||||
});
|
||||
},
|
||||
addUnprocessed: function(data) {
|
||||
|
||||
@@ -14,23 +14,21 @@ describe('Key generation', function() {
|
||||
assert.strictEqual(keyPair.privKey.byteLength, 32);
|
||||
}
|
||||
function itStoresPreKey(keyId) {
|
||||
it('prekey ' + keyId + ' is valid', function(done) {
|
||||
it('prekey ' + keyId + ' is valid', function() {
|
||||
return textsecure.storage.protocol
|
||||
.loadPreKey(keyId)
|
||||
.then(function(keyPair) {
|
||||
validateStoredKeyPair(keyPair);
|
||||
})
|
||||
.then(done, done);
|
||||
});
|
||||
});
|
||||
}
|
||||
function itStoresSignedPreKey(keyId) {
|
||||
it('signed prekey ' + keyId + ' is valid', function(done) {
|
||||
it('signed prekey ' + keyId + ' is valid', function() {
|
||||
return textsecure.storage.protocol
|
||||
.loadSignedPreKey(keyId)
|
||||
.then(function(keyPair) {
|
||||
validateStoredKeyPair(keyPair);
|
||||
})
|
||||
.then(done, done);
|
||||
});
|
||||
});
|
||||
}
|
||||
function validateResultKey(resultKey) {
|
||||
@@ -48,13 +46,13 @@ describe('Key generation', function() {
|
||||
});
|
||||
}
|
||||
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
localStorage.clear();
|
||||
libsignal.KeyHelper.generateIdentityKeyPair()
|
||||
.then(function(keyPair) {
|
||||
return textsecure.storage.protocol.put('identityKey', keyPair);
|
||||
})
|
||||
.then(done, done);
|
||||
return libsignal.KeyHelper.generateIdentityKeyPair().then(function(
|
||||
keyPair
|
||||
) {
|
||||
return textsecure.storage.protocol.put('identityKey', keyPair);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the first time', function() {
|
||||
@@ -66,14 +64,11 @@ describe('Key generation', function() {
|
||||
* identityKey: <ArrayBuffer>
|
||||
* }
|
||||
*/
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
var accountManager = new textsecure.AccountManager('');
|
||||
accountManager
|
||||
.generateKeys(count)
|
||||
.then(function(res) {
|
||||
result = res;
|
||||
})
|
||||
.then(done, done);
|
||||
return accountManager.generateKeys(count).then(function(res) {
|
||||
result = res;
|
||||
});
|
||||
});
|
||||
for (var i = 1; i <= count; i++) {
|
||||
itStoresPreKey(i);
|
||||
@@ -92,29 +87,22 @@ describe('Key generation', function() {
|
||||
assert.strictEqual(result.preKeys[i].keyId, i + 1);
|
||||
}
|
||||
});
|
||||
it('result contains the correct public keys', function(done) {
|
||||
Promise.all(result.preKeys.map(validateResultKey))
|
||||
.then(function() {
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
it('result contains the correct public keys', function() {
|
||||
return Promise.all(result.preKeys.map(validateResultKey));
|
||||
});
|
||||
it('returns a signed prekey', function(done) {
|
||||
it('returns a signed prekey', function() {
|
||||
assert.strictEqual(result.signedPreKey.keyId, 1);
|
||||
assert.instanceOf(result.signedPreKey.signature, ArrayBuffer);
|
||||
validateResultSignedKey(result.signedPreKey).then(done, done);
|
||||
return validateResultSignedKey(result.signedPreKey);
|
||||
});
|
||||
});
|
||||
describe('the second time', function() {
|
||||
var result;
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
var accountManager = new textsecure.AccountManager('');
|
||||
accountManager
|
||||
.generateKeys(count)
|
||||
.then(function(res) {
|
||||
result = res;
|
||||
})
|
||||
.then(done, done);
|
||||
return accountManager.generateKeys(count).then(function(res) {
|
||||
result = res;
|
||||
});
|
||||
});
|
||||
for (var i = 1; i <= 2 * count; i++) {
|
||||
itStoresPreKey(i);
|
||||
@@ -133,29 +121,22 @@ describe('Key generation', function() {
|
||||
assert.strictEqual(result.preKeys[i - 1].keyId, i + count);
|
||||
}
|
||||
});
|
||||
it('result contains the correct public keys', function(done) {
|
||||
Promise.all(result.preKeys.map(validateResultKey))
|
||||
.then(function() {
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
it('result contains the correct public keys', function() {
|
||||
return Promise.all(result.preKeys.map(validateResultKey));
|
||||
});
|
||||
it('returns a signed prekey', function(done) {
|
||||
it('returns a signed prekey', function() {
|
||||
assert.strictEqual(result.signedPreKey.keyId, 2);
|
||||
assert.instanceOf(result.signedPreKey.signature, ArrayBuffer);
|
||||
validateResultSignedKey(result.signedPreKey).then(done, done);
|
||||
return validateResultSignedKey(result.signedPreKey);
|
||||
});
|
||||
});
|
||||
describe('the third time', function() {
|
||||
var result;
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
var accountManager = new textsecure.AccountManager('');
|
||||
accountManager
|
||||
.generateKeys(count)
|
||||
.then(function(res) {
|
||||
result = res;
|
||||
})
|
||||
.then(done, done);
|
||||
return accountManager.generateKeys(count).then(function(res) {
|
||||
result = res;
|
||||
});
|
||||
});
|
||||
for (var i = 1; i <= 3 * count; i++) {
|
||||
itStoresPreKey(i);
|
||||
@@ -174,17 +155,13 @@ describe('Key generation', function() {
|
||||
assert.strictEqual(result.preKeys[i - 1].keyId, i + 2 * count);
|
||||
}
|
||||
});
|
||||
it('result contains the correct public keys', function(done) {
|
||||
Promise.all(result.preKeys.map(validateResultKey))
|
||||
.then(function() {
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
it('result contains the correct public keys', function() {
|
||||
return Promise.all(result.preKeys.map(validateResultKey));
|
||||
});
|
||||
it('result contains a signed prekey', function(done) {
|
||||
it('result contains a signed prekey', function() {
|
||||
assert.strictEqual(result.signedPreKey.keyId, 3);
|
||||
assert.instanceOf(result.signedPreKey.signature, ArrayBuffer);
|
||||
validateResultSignedKey(result.signedPreKey).then(done, done);
|
||||
return validateResultSignedKey(result.signedPreKey);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>libtextsecure test runner</title>
|
||||
<link rel="stylesheet" href="../../components/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('Protocol Wrapper', function() {
|
||||
});
|
||||
});
|
||||
describe('processPreKey', function() {
|
||||
it('rejects if the identity key changes', function(done) {
|
||||
it('rejects if the identity key changes', function() {
|
||||
var address = new libsignal.SignalProtocolAddress(identifier, 1);
|
||||
var builder = new libsignal.SessionBuilder(store, address);
|
||||
return builder
|
||||
@@ -29,11 +29,10 @@ describe('Protocol Wrapper', function() {
|
||||
encodedNumber: address.toString(),
|
||||
})
|
||||
.then(function() {
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
throw new Error('Allowed to overwrite identity key');
|
||||
})
|
||||
.catch(function(e) {
|
||||
assert.strictEqual(e.message, 'Identity key changed');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -189,12 +189,9 @@ describe('SignalProtocolStore', function() {
|
||||
})
|
||||
.then(done, done);
|
||||
});
|
||||
it('returns empty array for a number with no device ids', function(done) {
|
||||
return store
|
||||
.getDeviceIds('foo')
|
||||
.then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
})
|
||||
.then(done, done);
|
||||
it('returns empty array for a number with no device ids', function() {
|
||||
return store.getDeviceIds('foo').then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -44,6 +44,7 @@
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^0.8.0",
|
||||
"archiver": "^2.1.1",
|
||||
"backbone": "^1.3.3",
|
||||
"blob-util": "^1.3.0",
|
||||
"blueimp-canvas-to-blob": "^3.14.0",
|
||||
"blueimp-load-image": "^2.18.0",
|
||||
@@ -66,10 +67,13 @@
|
||||
"fs-extra": "^5.0.0",
|
||||
"google-libphonenumber": "^3.0.7",
|
||||
"got": "^8.2.0",
|
||||
"intl-tel-input": "^12.1.15",
|
||||
"jquery": "^3.3.1",
|
||||
"linkify-it": "^2.0.3",
|
||||
"lodash": "^4.17.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.21.0",
|
||||
"mustache": "^2.3.0",
|
||||
"node-fetch": "https://github.com/scottnonnenberg-signal/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4",
|
||||
"os-locale": "^2.1.0",
|
||||
"pify": "^3.0.0",
|
||||
@@ -84,6 +88,7 @@
|
||||
"testcheck": "^1.0.0-rc.2",
|
||||
"tmp": "^0.0.33",
|
||||
"to-arraybuffer": "^1.0.1",
|
||||
"underscore": "^1.9.0",
|
||||
"websocket": "^1.0.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@import 'variables';
|
||||
@import '../components/intl-tel-input/build/css/intlTelInput.css';
|
||||
@import '../node_modules/intl-tel-input/build/css/intlTelInput.css';
|
||||
@import 'progress';
|
||||
.iti-flag {
|
||||
// override intlTelInput's flags image location
|
||||
background: url('../images/flags.png');
|
||||
background: url('../node_modules/intl-tel-input/build/img/flags.png');
|
||||
}
|
||||
|
||||
.intl-tel-input .country-list {
|
||||
|
||||
+5
-8
@@ -68,19 +68,16 @@ before(function(done) {
|
||||
};
|
||||
});
|
||||
|
||||
async function clearDatabase(done) {
|
||||
async function clearDatabase() {
|
||||
await Signal.Migrations.Migrations0DatabaseWithAttachmentData.run({
|
||||
Backbone,
|
||||
databaseName: Whisper.Database.id,
|
||||
});
|
||||
|
||||
const convos = new Whisper.ConversationCollection();
|
||||
await convos.fetch();
|
||||
await convos.destroyAll();
|
||||
await wrapDeferred(convos.fetch());
|
||||
await wrapDeferred(convos.destroyAll());
|
||||
const messages = new Whisper.MessageCollection();
|
||||
await messages.fetch();
|
||||
await messages.destroyAll();
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
await wrapDeferred(messages.fetch());
|
||||
await wrapDeferred(messages.destroyAll());
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>TextSecure test runner</title>
|
||||
<link rel="stylesheet" href="../components/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../stylesheets/manifest.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('KeyChangeListener', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
return store.saveIdentity(address.toString(), newKey);
|
||||
store.saveIdentity(address.toString(), newKey);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('KeyChangeListener', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
return store.saveIdentity(address.toString(), newKey);
|
||||
store.saveIdentity(address.toString(), newKey);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -268,15 +268,11 @@
|
||||
it('matches by name', function(done) {
|
||||
testSearch(['John', 'Doe', 'john', 'doe', 'John Doe', 'john doe'], done);
|
||||
});
|
||||
it('does not match +', function(done) {
|
||||
it('does not match +', function() {
|
||||
var collection = new Whisper.ConversationCollection();
|
||||
return collection
|
||||
.search('+')
|
||||
.then(function() {
|
||||
assert.isUndefined(collection.get(convo.id), 'got result for "+"');
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
return collection.search('+').then(function() {
|
||||
assert.isUndefined(collection.get(convo.id), 'got result for "+"');
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
+13
-17
@@ -81,16 +81,15 @@ describe('SignalProtocolStore', function() {
|
||||
});
|
||||
|
||||
describe('When there is no existing key (first use)', function() {
|
||||
before(function(done) {
|
||||
store.removeIdentityKey(identifier).then(function() {
|
||||
store
|
||||
.saveIdentity(address.toString(), testKey.pubKey)
|
||||
.then(function() {
|
||||
record.fetch().then(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
before(function() {
|
||||
return store
|
||||
.removeIdentityKey(identifier)
|
||||
.then(function() {
|
||||
return store.saveIdentity(address.toString(), testKey.pubKey);
|
||||
})
|
||||
.then(function() {
|
||||
return wrapDeferred(record.fetch());
|
||||
});
|
||||
});
|
||||
it('marks the key firstUse', function() {
|
||||
assert(record.get('firstUse'));
|
||||
@@ -1197,13 +1196,10 @@ describe('SignalProtocolStore', function() {
|
||||
})
|
||||
.then(done, done);
|
||||
});
|
||||
it('returns empty array for a number with no device ids', function(done) {
|
||||
return store
|
||||
.getDeviceIds('foo')
|
||||
.then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
})
|
||||
.then(done, done);
|
||||
it('returns empty array for a number with no device ids', function() {
|
||||
return store.getDeviceIds('foo').then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ describe('ConversationSearchView', function() {
|
||||
type: 'group',
|
||||
left: true,
|
||||
});
|
||||
before(function(done) {
|
||||
convo.save().then(done);
|
||||
before(() => {
|
||||
return wrapDeferred(convo.save());
|
||||
});
|
||||
describe('with no messages', function() {
|
||||
var input = $('<input>');
|
||||
@@ -82,13 +82,13 @@ describe('ConversationSearchView', function() {
|
||||
type: 'group',
|
||||
left: true,
|
||||
});
|
||||
before(function(done) {
|
||||
convo.save().then(done);
|
||||
before(() => {
|
||||
return wrapDeferred(convo.save());
|
||||
});
|
||||
describe('with no messages', function() {
|
||||
before(function(done) {
|
||||
view.resetTypeahead();
|
||||
view.typeahead_view.collection.on('reset', function() {
|
||||
view.typeahead_view.collection.once('reset', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -100,12 +100,12 @@ describe('ConversationSearchView', function() {
|
||||
});
|
||||
});
|
||||
describe('with messages', function() {
|
||||
before(function(done) {
|
||||
convo.save({ lastMessage: 'asdf' }).then(function() {
|
||||
view.typeahead_view.collection.on('reset', function() {
|
||||
before(done => {
|
||||
wrapDeferred(convo.save({ lastMessage: 'asdf' })).then(function() {
|
||||
view.resetTypeahead();
|
||||
view.typeahead_view.collection.once('reset', function() {
|
||||
done();
|
||||
});
|
||||
view.resetTypeahead();
|
||||
});
|
||||
});
|
||||
it('should surface left groups with messages', function() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
describe('MessageView', function() {
|
||||
var convo, message;
|
||||
|
||||
before(async done => {
|
||||
before(async () => {
|
||||
await clearDatabase();
|
||||
convo = new Whisper.Conversation({ id: 'foo' });
|
||||
message = convo.messageCollection.add({
|
||||
@@ -13,7 +13,6 @@ describe('MessageView', function() {
|
||||
});
|
||||
|
||||
await storage.put('number_id', '+18088888888.1');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should display the message text', function() {
|
||||
|
||||
@@ -736,6 +736,12 @@ babylon@^6.8.1:
|
||||
version "6.17.0"
|
||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932"
|
||||
|
||||
backbone@^1.3.3:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/backbone/-/backbone-1.3.3.tgz#4cc80ea7cb1631ac474889ce40f2f8bc683b2999"
|
||||
dependencies:
|
||||
underscore ">=1.8.3"
|
||||
|
||||
bail@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.2.tgz#f7d6c1731630a9f9f0d4d35ed1f962e2074a1764"
|
||||
@@ -4465,6 +4471,10 @@ internal-ip@1.2.0:
|
||||
dependencies:
|
||||
meow "^3.3.0"
|
||||
|
||||
intl-tel-input@^12.1.15:
|
||||
version "12.1.15"
|
||||
resolved "https://registry.yarnpkg.com/intl-tel-input/-/intl-tel-input-12.1.15.tgz#7393e6b77572731bbc65ca4585782e8ba3d74de4"
|
||||
|
||||
into-stream@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-3.1.0.tgz#96fb0a936c12babd6ff1752a17d05616abd094c6"
|
||||
@@ -4941,6 +4951,10 @@ jpeg-js@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.2.0.tgz#53e448ec9d263e683266467e9442d2c5a2ef5482"
|
||||
|
||||
jquery@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
|
||||
|
||||
js-base64@^2.1.8:
|
||||
version "2.1.9"
|
||||
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
|
||||
@@ -5839,6 +5853,10 @@ multicast-dns@^6.0.1:
|
||||
dns-packet "^1.3.1"
|
||||
thunky "^1.0.2"
|
||||
|
||||
mustache@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/mustache/-/mustache-2.3.0.tgz#4028f7778b17708a489930a6e52ac3bca0da41d0"
|
||||
|
||||
mute-stream@0.0.7, mute-stream@~0.0.4:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
||||
@@ -9141,6 +9159,10 @@ underscore.string@~3.2.3:
|
||||
version "3.2.3"
|
||||
resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-3.2.3.tgz#806992633665d5e5fcb4db1fb3a862eb68e9e6da"
|
||||
|
||||
underscore@>=1.8.3, underscore@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.0.tgz#31dbb314cfcc88f169cd3692d9149d81a00a73e4"
|
||||
|
||||
underscore@~1.6.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8"
|
||||
|
||||
Reference in new issue
Block a user