Moved 400+ lines out of search.js into search_suggestion.js. This
leaves search.js primarily responsible for lots of little DOM
interactions, whereas search_suggestion is more about data.
(imported from commit 53d08b29367c0172e483064f213538d45098279e)
1. Change code comment in search.get_suggestion.
2. Remove side effects from search.get_suggestions.
The function get_suggestions() was updating a module-scoped variable
called search_object, but now it returns a dictionary to its caller.
3. Greatly reduce the scope of the search_object var in search.js.
I also clarified the comment around it a bit. We could squeeze
the scope of search_object even further by using a function wrapper, but
this is a big enough win for now.
(imported from commit 4b633dd30ab45d24b85ea1d10df27df5aaa0c959)
For legacy reasons this function used to have convert item to
search_string via the search_object hash, because we used to
have an overly convoluted data model. The mid-July-2013
refactoring on search.js made the data model simple, and this
little bit of cleanup follows up on that.
(imported from commit aeea629862e4307897f24eaa5fc364f2b12a7c52)
This is a bit wasteful on most systems, but will result in their
looking pretty sharp on Retina displays.
(I also go and actually fix up the size we request for a bunch of
these so that they actually match the size of the gravatar in the
document -- previously we were requesting a size 30 gravatar when we
were displaying it in a size 25 space, which leads to unnecessary
ugliness upon resize.)
(imported from commit 9152e6e128e0ac38d97d893cb8243e3b9185351b)
This reverts a prior commit, but the earlier commit is fine
functionally; the earlier commit was a temporary measure.
Revert "Use POST, not PATCH, for patching bots."
This reverts commit c3146b23d5d7d134c2b80507eb87033ca375a4db.
(imported from commit ebfcb2bae72c11767f9750412440d40b7a2a4995)
* Only pop up on mouseover if you haven't completed the step previously,
and only on the first mouseover.
* Dismiss the popover if you click anywhere but the link
Trac #1471
(imported from commit 08904be59c15526f88a2633ebd6f2a046ec62197)
Now the @ has to follow a space, newline or certain punctuation, or be
at the beginning of the message. This addresses the frequent complaint
that typing an email address e.g. scott@zulip.com is hard, because after
the @, it would try to autocomplete.
(imported from commit 043953be3928b0acf2a4ab2b4dd1a80e1a1aa882)
Mark messages as read when with the pointer, but mark all messages
read if the last message is visible.
(imported from commit 4c1a928bd6966111f0f34c5207723656b5f193b9)
In the future, this could come from the server to enable individual
experiments on a per-realm basis.
(imported from commit 8fd1ba1910b3cfd131f58bab8efbd11a42053bc3)
The close() method will let you release handlers, as well as
doing everything clear() does.
(imported from commit 3a67c3f2226918cee10cf43598e0408fb186408a)
The set_up_file_input() function now returns an object to the user
with a clear field. This object will grow soon.
(imported from commit 7b3761eafddb392bd2c84a1685aa8d1811028a0f)
This is a temporary expedient measure to work around our
PATCH not supporting file uploads in our current Django setup.
(imported from commit c3146b23d5d7d134c2b80507eb87033ca375a4db)
Code prior to this commit was functionally working, but semantically
flawed — returning false does not short-circuit _.each like it does with
$.each. It now uses _.every, as suggested by Steve.
In addition I renamed the function to be more descriptive, added a
comment, and eliminated needless double negation.
(imported from commit b0666dfa01b2677b4eaf577fe9ced90ed0db2438)
They are synonyms, and Zukeeper consensus is that _.any makes it clearer
what the function does.
(imported from commit 847383e27ccefeaff1ecff15f4cb4177c9e40c25)
The previous regex didn't escape the period in '.d' and was doing a
case-sensitive match to find the base stream name.
(imported from commit 43ef13733987e50dcead06b7bd3e768cb4395998)
In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.
Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.
Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).
One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.
(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
Extract some local variables to set up the next refactoring, where
we can parameterize the function.
(imported from commit 1c2801131c19a54713a0d5c2cc26c419412339b0)
The option caused some race conditions on Firefox, and it is
really made moot by the naturalSearch option anyway.
(imported from commit dc7080c905ced9b2f4ad4275d82549acf09a59f7)
This covers most of the module's functionality, with special
emphasis on lines that use underscore.js (_.each and _.filter).
(imported from commit 074181a0273286a258504be634bdd1cead2eecd5)