src/vendors/typeahead.js
File typeahead.js
has 1130 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
* typeahead.js 0.9.3
* https://github.com/twitter/typeahead
* Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
*/
Function TypeaheadView
has 215 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var TypeaheadView = function() {
var html = {
wrapper: '<span class="twitter-typeahead"></span>',
hint: '<input class="tt-hint" type="text" autocomplete="off" spellcheck="off" disabled>',
dropdown: '<span class="tt-dropdown-menu"></span>'
Function Dataset
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Dataset = function() {
var keys = {
thumbprint: "thumbprint",
protocol: "protocol",
itemHash: "itemHash",
Function DropdownView
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var DropdownView = function() {
var html = {
suggestionsList: '<span class="tt-suggestions"></span>'
}, css = {
suggestionsList: {
Function InputView
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var InputView = function() {
function InputView(o) {
var that = this;
utils.bindAll(this);
this.specialKeyCodeMap = {
Function PersistentStorage
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var PersistentStorage = function() {
var ls, methods;
try {
ls = window.localStorage;
ls.setItem("~~~", "!");
Function Transport
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Transport = function() {
var pendingRequestsCount = 0, pendingRequests = {}, maxPendingRequests, requestCache;
function Transport(o) {
utils.bindAll(this);
o = utils.isString(o) ? {
Function EventTarget
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var EventTarget = function() {
var eventSplitter = /\s+/;
return {
on: function(events, callback) {
var event;
Function initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialize: function(datasetDefs) {
var datasets;
datasetDefs = utils.isArray(datasetDefs) ? datasetDefs : [ datasetDefs ];
if (datasetDefs.length === 0) {
$.error("no datasets provided");
Function _loadPrefetchData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_loadPrefetchData: function(o) {
var that = this, thumbprint = VERSION + (o.thumbprint || ""), storedThumbprint, storedProtocol, storedItemHash, storedAdjacencyList, isExpired, deferred;
if (this.storage) {
storedThumbprint = this.storage.get(keys.thumbprint);
storedProtocol = this.storage.get(keys.protocol);
Function _getLocalSuggestions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_getLocalSuggestions: function(terms) {
var that = this, firstChars = [], lists = [], shortestList, suggestions = [];
utils.each(terms, function(i, term) {
var firstChar = term.charAt(0);
!~utils.indexOf(firstChars, firstChar) && firstChars.push(firstChar);
Function buildDomStructure
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildDomStructure(input) {
var $wrapper = $(html.wrapper), $dropdown = $(html.dropdown), $input = $(input), $hint = $(html.hint);
$wrapper = $wrapper.css(css.wrapper);
$dropdown = $dropdown.css(css.dropdown);
$hint.css(css.hint).css({