Mercurial > code > home > repos > href
diff static/links.js @ 22:fa55f4439977
fix autocomplete. less console.log
Ignore-this: 302e2080d044221c430c4eb77ccd4221
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Thu, 11 Jul 2013 01:05:22 -0700 |
parents | 8008ec2fd763 |
children | ab9a6132529a |
line wrap: on
line diff
--- a/static/links.js Thu Jul 11 00:45:55 2013 -0700 +++ b/static/links.js Thu Jul 11 01:05:22 2013 -0700 @@ -50,7 +50,6 @@ ko.computed(function () { var tags = model.filterTags(); var newPath = window.location.pathname; - console.log("currently", newPath, toRoot); if (toRoot == ".") { newPath += "/"; toRoot = ".."; @@ -58,7 +57,6 @@ newPath = newPath.replace( /(.*\/)[^\/]*$/, "$1") } - console.log("user root", newPath); if (tags.length) { newPath += tags.join("+") } else { @@ -70,7 +68,6 @@ }); function changePage(newPath) { - console.log("changePage", newPath); if (window.location.pathname != newPath) { window.history.pushState({}, "", newPath); @@ -116,8 +113,13 @@ query: function (opts) { $.ajax({ url: toRoot + "/tags", - data: {user: user, have: opts.element.val()}, + data: {user: user, have: opts.element.val() + "," + opts.term}, success: function (data) { + // I don't want to do this, but select2 gets too slow + var maxRowsInAutocomplete = 300; + if (data.tags.length > maxRowsInAutocomplete) { + data.tags = data.tags.slice(0, maxRowsInAutocomplete); + } opts.callback({results: data.tags}); } });