1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 17:28:51 +02:00
Commit graph

75 commits

Author SHA1 Message Date
epriestley
1602858b26 Possible fix for JX.History spookiness?
Summary: Ref T7573. I only got this reproducing like 10% of the time in Firefox but I can't reproduce it anymore after this change.

Test Plan:
  - Added some logging.
  - Saw Firefox handing us nonsense state values (?)
  - Read the Firefox documentation?
  - Maybe state is expected to be an object? This shouldn't matter?
  - I don't really know?

iiam

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7573

Differential Revision: https://secure.phabricator.com/D12485
2015-04-20 16:41:19 -07:00
Bob Trahan
4d5badeec0 Quicksand - provide some plumbing for fancier updates
Summary: Ref D12448. Ref T7573. This changes quicksand up a bit so rather than caching just rendered HTML we also cache the initial response from the server. We also fire off a quicksand-redraw event which will let things like the page objects for notifications update correctly while using Quicksand (see D12448).

Test Plan: loaded up /p/btrahan/  Clicked the UI elements to navigate to various profile views up to maniphest. clicked back until back at /p/btrahan/ and it worked. clicked forward until all the way back to maniphest and it worked. clicked back 2x, then clicked new links, then back and it worked

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7573

Differential Revision: https://secure.phabricator.com/D12449
2015-04-20 15:44:14 -07:00
Chad Little
ca388d95fd Make the browse button on the tokenizer, be on the tokenizer
Summary: Moves the Browse... button into a Search Icon on the actual tokenizer. I played with a number of icon treatments, and Search seems to convey the right attribute, other things like lists and menus didn't quite feel right to me, but feel free to push back if you hate search.

Test Plan:
Tested lots of tokens, little tokens, small screens, etc.

{F375467}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12452
2015-04-18 10:58:50 -07:00
epriestley
76448a75de Make token UI stronger and more consistent
Summary:
Ref T4100. Overall:

  - Use token background color to communicate token type (blue = object, yellow = function, grey = disabled/closed, red = invalid).
  - Use token icon color to make color choices consistent (specifically, use project icon colors in project tokens).
  - For functions, use token icon to communicate function result type (e.g., viewer() has a user icon; members(...) has a group icon), since we don't need the icon to indicate "this is a function" anymore.

Test Plan:
{F374615}
{F374616}
{F374617}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12446
2015-04-17 11:06:58 -07:00
epriestley
845466b49b Implement viewer() and members(project) typeahead functions
Summary:
Ref T4100. This is still a bit rough around the edges, but mostly does what we're after.

  - Implements viewer() and members(...) functions.
  - The new browse workflow makes these discoverable.

Test Plan: {F374201}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: chad, epriestley

Maniphest Tasks: T4100

Differential Revision: https://secure.phabricator.com/D12444
2015-04-17 11:06:58 -07:00
epriestley
a4261f41c2 Make browse action available for dynamic/JS-driven tokenizers
Summary: Ref T5750. This makes browse work for all of the dynamic tokenizers in Herald, Policies, batch editor, etc.

Test Plan: Used tokenizers in Herald, Policies, Batch editor.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5750

Differential Revision: https://secure.phabricator.com/D12442
2015-04-17 11:06:58 -07:00
epriestley
a641601407 Implement a rough browse view for tokenizers
Summary: Ref T5750. This adds a basic browse view. Design is a bit rough, see T7841 for some screenshots.

Test Plan: Used browse view to add tokens to tokenizers.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5750

Differential Revision: https://secure.phabricator.com/D12441
2015-04-17 11:06:58 -07:00
epriestley
b40a84c92f Clean up some Conpherence beahviors with a mouse
Summary:
Fixes T7825. If JX.Scrollbar activates, we sometimes target the wrong node.

(We don't have this issue in the column because it rebuilds a new JX.Scrollbar every time.)

Test Plan:
  - Sent messages, no spooky text.
  - Loaded page, got scroll to bottom.
  - Unplugged all USB devices, restarted browser, repeated.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7825

Differential Revision: https://secure.phabricator.com/D12413
2015-04-14 13:04:22 -07:00
epriestley
d9d0daecd7 Scroll the chat column to the bottom when images load
Summary:
Fixes T7558. This might not be 100% perfect but should solve most of the issue.

I briefly looked at things like `MutationObserver` (some fancy next-gen browser junk) but couldn't immediately get it working.

Other methods for handling this kind of thing involve polling, complicated polyfills, etc. We could give `MutationObserver` a more serious effort if this is too leaky.

Test Plan:
  - In a thread with some images, reloaded the page and saw the scrollbar stay at the bottom.
  - Tested with and without USB devices attached.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7558

Differential Revision: https://secure.phabricator.com/D12191
2015-03-28 08:35:12 -07:00
epriestley
ad1bed136c Fix an issue with returning to a the initial page in Quicksand
Summary: Fixes T7058. We weren't propagating `state` properly so some other code ended up doing the wrong thing.

Test Plan:
  - Clicked from Home -> Anything -> Home under Quicksand, saw reloads with no double requests.
  - Used "back", saw back button work properly.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7058

Differential Revision: https://secure.phabricator.com/D12190
2015-03-28 07:38:14 -07:00
epriestley
e5580d038d Improve Conpherence column textarea JS behaviors
Summary:
  - Don't show a loading state on the whole column while sending chat. We could show some kind of minor loading state, but standard JX.Busy stuff will kick in after a couple seconds anyway.
  - Blank the textarea immediately on submit so you can start typing more text.
  - Don't disable the form while submiting; disabling it prevents you from typing more text.
  - Hide the placeholder while the textarea is focused. If we don't do this, the placeholder reappearing after submitting text feels weird to me.

Test Plan:
  - Sent a lot of text.
  - Real fast.
  - Focused and unfocused the area.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12086
2015-03-14 12:00:17 -07:00
epriestley
6fa507987d Generalize URI pattern blacklist for Quicksand
Summary:
Fixes T7060. Removes some hard-coding.

This assumes that "pages with no durable column" and "pages with no Quicksand" are the same, but that's correct today and I can't come up with a use case where they'd be different offhand.

Test Plan:
  - Clicked a revision with column open, got Quicksand navigation.
  - Clicked into Conpherence with column open, got real navigation.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7060

Differential Revision: https://secure.phabricator.com/D12036
2015-03-10 15:32:15 -07:00
epriestley
5afa2c3b62 Add support for playing sounds
Summary:
Ref T5369. New HTML5 version without flash dependencies.

This doesn't play any sounds.

Test Plan: Did not play any sounds.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T5369

Differential Revision: https://secure.phabricator.com/D9535
2015-03-10 14:20:00 -07:00
Bob Trahan
10f1692b1b Conpherence - more threadManager stuff and get scrolling working
Summary: Ref T7014. The main conpherence view is kind of broken without this in subtle ways because of /conpherence/ versus /conpherence/x/ init'ing things differently; this fixes that. Moves more normal view conpherence logic into threadManager. Makes all the display code happen outside of threadManager, setting us up for some display manager later maybe.

Test Plan: sent messages, updated title, etc and the messages pane auto scrolled correctly!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7014

Differential Revision: https://secure.phabricator.com/D12035
2015-03-10 13:53:30 -07:00
epriestley
b8ed980d3d Fix scrollbar being cut off at end of gutter
Summary:
The "mlb" on the left nav creates a phantom bottom margin which gives the content measurable height but not scrollable height. Replace it with "plb" (padding) instead.

The 2px-spacer calculation was also not quite correct.

Test Plan:
  - Viewed pages with navs; padding vs margin didn't seem to make any other differences.
  - Scrollbar now stops in the right place in Safari, Chrome, Firefox.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D12007
2015-03-07 09:53:58 -08:00
epriestley
ebcab8edb6 Namespace Aphlict clients by request path, plus other fixes
Summary:
Fixes T7130. Fixes T7041. Fixes T7012.

Major change here is partitioning clients. In the Phacility cluster, being able to get a huge pile of instances on a single server -- without needing to run a process per instance -- is desirable.

To accomplish this, just bucket clients by the path they connect with. This will let us set client URIs to `/instancename/` and then route connections to a small set of servers. This degrades cleanly in the common case and has no effect on installs which don't do instancing.

Also fix two unrelated issues:

  - Fix the timeouts, which were incorrectly initializing in `open()` (which is called during reconnect, causing them to reset every time). Instead, initialize in the constructor. Cap timeout at 5 minutes.
  - Probably fix subscriptions, which were using a property with an object definition. Since this is by-ref, all concrete instances of the object share the same property, so all users would be subscribed to everything. Probably.

Test Plan:
  - Hit notification status page, saw version bump and instance/path name.
  - Saw instance/path name in client and server logs.
  - Stopped server, saw reconnects after 2, 4, 16, ... seconds.
  - Sent test notification; received test notification.
  - Didn't explicitly test the subscription thing but it should be obvious by looking at `/notification/status/` shortly after a push.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7041, T7012, T7130

Differential Revision: https://secure.phabricator.com/D11769
2015-02-16 11:31:15 -08:00
epriestley
08045efb30 Fix mouse access to Workboard scrollbars
Summary: Fixes T7075. The invisible "fancy" scrollbar was covering these; hide it more aggressively.

Test Plan:
  - Scrollbars on Workboards can now be interacted with directly.
  - Normal scrollable and unscrollable pages work as expected.
  - Resized some windows.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7075

Differential Revision: https://secure.phabricator.com/D11560
2015-01-29 07:10:35 -08:00
epriestley
31c64b6772 Fix dialog z-index issue
Summary:
Fixes T7081. History here:

  - JX.Scrollbar made the page scroll weird when a dialog came up because it was half-frame and half-document.
  - I made it fully frame-level.
  - But this wasn't really right; a better fix is to make it fully document-level.

Test Plan:
  - Weird scroll on opening dialog is still fixed.
  - iOS Safari no longer puts the mask over the dialog.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7081

Differential Revision: https://secure.phabricator.com/D11559
2015-01-29 07:10:14 -08:00
epriestley
eaa883cf37 Fix anchor-clicking scroll positions
Summary:
Fixes T7069. When jumping to a comment anchor, we get the scroll positions wrong.

Partly this is fixing some calcaulations; partly, the "show older comments" and "scroll anchor" stuff were fighting over the scroll position. Since the anchor can take care of things on its own, just let it handle stuff.

Test Plan:
  - Clicked comment anchors.
  - Loaded pages with anchors in the URI.
  - Loaded pages with anchors hidden behind "show older comments".

In all cases, got the right scroll position.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7069

Differential Revision: https://secure.phabricator.com/D11540
2015-01-28 08:26:10 -08:00
epriestley
5c71da8cdb Quicksand, an ignoble successor to Quickling
Summary:
Ref T2086. Ref T7014. With the persistent column, there is significant value in retaining chrome state through navigation events, because the user may have a lot of state in the chat window (scroll position, text selection, room juggling, partially entered text, etc). We can do this by capturing navigation events and faking them with Javascript.

(This can also improve performance, albeit slightly, and I believe there are better approaches to tackle performance any problems which exist with the chrome in many cases).

At Facebook, this system was "Photostream" in photos and then "Quickling" in general, and the technical cost of the system was //staggering//. I am loathe to pursue it again. However:

  - Browsers are less junky now, and we target a smaller set of browsers. A large part of the technical cost of Quickling was the high complexity of emulating nagivation events in IE, where we needed to navigate a hidden iframe to make history entries. All desktop browsers which we might want to use this system on support the History API (although this prototype does not yet implement it).
  - Javelin and Phabricator's architecture are much cleaner than Facebook's was. A large part of the technical cost of Quickling was inconsistency, inlined `onclick` handlers, and general lack of coordination and abstraction. We will have //some// of this, but "correctly written" behaviors are mostly immune to it by design, and many of Javelin's architectural decisions were influenced by desire to avoid issues we encountered building this stuff for Facebook.
  - Some of the primitives which Quickling required (like loading resources over Ajax) have existed in a stable state in our codebase for a year or more, and adoption of these primitives was trivial and uneventful (vs a huge production at Facebook).
  - My hubris is bolstered by recent success with WebSockets and JX.Scrollbar, both of which I would have assessed as infeasibly complex to develop in this project a few years ago.

To these points, the developer cost to prototype Photostream was several weeks; the developer cost to prototype this was a bit less than an hour. It is plausible to me that implementing and maintaining this system really will be hundreds of times less complex than it was at Facebook.

Test Plan:
My plan for this and D11497 is:

  - Get them in master.
  - Some secret key / relatively-hidden preference activates the column.
  - Quicksand activates //only// when the column is open.
  - We can use column + quicksand for a long period of time (i.e., over the course of Conpherence v2 development) and hammer out the long tail of issues.
  - When it derps up, you just hide the column and you're good to go.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T2086, T7014

Differential Revision: https://secure.phabricator.com/D11507
2015-01-27 14:52:09 -08:00
epriestley
41dcd7420b Fix inline reticles and dialogs for new scrollbars
Summary:
Fixes T7054. Fixes T7049.

  - Stop scrolling Differential reticles when the page scrolls.
  - Make dialogs aware of multi-panel UI.

Test Plan:
  - Dialogs pop up in the right place.
  - Inline + scroll now longer leaves the inline in a fixed position.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7049, T7054

Differential Revision: https://secure.phabricator.com/D11523
2015-01-27 07:11:20 -08:00
epriestley
c3913f5995 Make scroll keys active immediately upon page load
Summary:
When JX.Scrollbar activates, the page needs to be clicked before scrolling keys work.

Instead, set focus into the content after we set the page frame (if something else isn't already focused).

Also fixes T7042.

Test Plan: In Safari, Chrome and Firefox, scrolling with key commands is now immediately active.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7042

Differential Revision: https://secure.phabricator.com/D11508
2015-01-26 09:34:57 -08:00
epriestley
62cb898408 Fix call to scrollToPosition()
Summary: See rPea67a8ab8e58. This was typed wrong and all the things I tested called scrollToPosition() directly.

Test Plan: Quoted a comment.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley, krzysztof.ciebiera

Differential Revision: https://secure.phabricator.com/D11505
2015-01-26 09:34:41 -08:00
epriestley
ea67a8ab8e Make scrolling happen relative to the main content frame
Summary: Fixes T7033. When we've reframed the main page content we need to scroll relative to the containing frame, not relative to the window.

Test Plan:
In Safari, Chrome and Firefox, used j/k/J/K keys to navigate diff content.

Tried some other scroll-based beahviors, like jump-to-anchors.

(It looks like the highlighting reticle got slightly derped a while ago, but it's still functional, so I didn't mess with it.)

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7033

Differential Revision: https://secure.phabricator.com/D11490
2015-01-25 08:42:40 -08:00
epriestley
e0289070db Fix window-exiting drags and drag-and-hold behaviors in JX.Scrollbar
Summary:
Fixes two issues:

  - In Firefox, dragging outside the window and releasing the mouse button would miss the `mouseup` event. This would leave the bar dragging, even though the user had released the mouse button.
  - In all browsers, dragging the handle and then holding your cursor in one place for more than a second would hide the handle. Instead, never hide the handle during a drag.

Test Plan:
  - In Firefox, dragged handle right (outside of window) and released mouse button. Waved cursor over window; no more "sticky" scroll.
  - In FF/Chrome/Safari, dragged handle and held cursor in same position for several seconds. No more handle hide.
  - Waved cursor over window and made sure normal hiding still works.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11487
2015-01-24 16:42:21 -08:00
epriestley
6288d8a7d4 Support scrollbar snapback on Windows
Summary: See D11472. I eyeballed the "140" number by screenshotting / measuring in Paint.

Test Plan: Made the snapback thing return `true` and got snapback on OSX.

Reviewers: chad

Reviewed By: chad

Subscribers: avivey, epriestley

Differential Revision: https://secure.phabricator.com/D11485
2015-01-24 14:57:12 -08:00
epriestley
4ceaaf5ea1 Allow scrollbars to be dragged outside the window on supporting browsers
Summary: In Safari, Firefox and Chrome drags outside the window will work if we do this. Safari didn't work before, not sure about the other two.

Test Plan: Clicked the scroll handle, then dragged my mouse to the right (outside the window) and down. Page scrolled in Safari, Firefox, and Chrome.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11484
2015-01-24 14:18:33 -08:00
epriestley
25fc168c95 Fix an issue with dragging the scrollbar handle from a noninitial position
Summary:
See <rPc40bc0c8bf75#4050>. Repro steps:

  - Scroll partway down the page.
  - Click and drag the scroll handle.

Prior to this diff, the handle incorrectly jumps back to the top of the page. This is because we didn't store the handle's original position. (In testing, I always dragged from near the top of the page, and I don't normally drag scrollbars, so I didn't notice this.)

Test Plan: Clicking and dragging a partially scrolled handle now works correctly.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11483
2015-01-24 14:00:41 -08:00
epriestley
512b173618 Don't activate JX.Scrollbar if we don't need to
Summary:
See discussion on rPc40bc0c8bf75. Fixes a couple of glitchy things:

  - Things were generally not nice on iOS.
  - On OSX, with no mouse, the OS scrollbar and our fake scrollbar would both draw.
  - Bar z-index was not set quite correctly.

Specifically, check if we need these bars. If we don't, just exit immediately and use the OS bars.

Test Plan:
  - Tested Safari, Firefox, Chrome with and without a mouse.
  - Tested iOS Simualtor.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11480
2015-01-23 18:22:47 -08:00
epriestley
c40bc0c8bf Replace the primary scrollbar with a fake one to prepare for a persistent chat column
Summary:
Ref T7014. With a mouse plugged in, multi-panel UIs are pretty hideous on OSX. This is somewhat offputting for me in Conpherence, and really jumps out at me with the new column mocks in T7014.

Sites like Twitch and Facebook approach this by emulating the touchpad scrollbar to achieve a more aesthetic UI. Use a similar approach.

This:

  - Replaces the main scrollbar with a prettier fake one.
  - This prepares the standard page frame for a persistent chat column.

Test Plan:
  - Seems to work properly on OSX, Chrome and Firefox. Haven't tested on IE; my Windows setup is pretty iffy at the moment.
  - Tried Conpherence.
  - Tried Workboards.

Reviewers: btrahan, chad

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7014

Differential Revision: https://secure.phabricator.com/D11472
2015-01-23 13:29:15 -08:00
Joshua Spence
d6ed9c2f68 Fix an undefined variable
Summary: Identifed by linting with JSHint.

Test Plan: `arc lint`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11433
2015-01-23 07:22:39 +11:00
Joshua Spence
e6d6d8e961 Remove an unused variable
Summary: This variable is unused.

Test Plan: `arc lint`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11440
2015-01-20 21:25:40 +11:00
Joshua Spence
a15852c112 Fix another undefined variable
Summary: This variable is used before it is defined.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11434
2015-01-20 08:55:04 +11:00
Joshua Spence
27422ffe8e Use single quotes in JavaScript files
Summary: Use single quotes to keep JSHint happy.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11431
2015-01-20 08:53:47 +11:00
Joshua Spence
e768a633b7 Fix various lint issues in rJX
Summary: Ref T6953.

Test Plan: `arc lint`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T6953

Differential Revision: https://secure.phabricator.com/D11376
2015-01-14 07:59:56 +11:00
Joshua Spence
551823ecc4 Fix variable reference
Summary: What do you think this is, PHP?

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11361
2015-01-14 07:04:36 +11:00
Bob Trahan
59770443b6 Projects - tokenize [ProjectX] so "projectX" is a match
Summary:
Fixes T4656. Helps users with this naming convention, which is probably not super duper rare.

Users will need to make an edit to a project -or- run bin/search index "#project-tag" to make this actually work.

Test Plan: made a project "[T4656test]". Typed "t4" and project showed up!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T4656

Differential Revision: https://secure.phabricator.com/D11302
2015-01-09 14:09:13 -08:00
epriestley
e0087a9f7a Add JX.Leader: synchronization over localStorage
Summary:
Ref T6559. Adds a "JX.Leader" primitive to replace the synchronization over Flash. This does a couple of things:

  - Offers an "onBecomeLeader" event, which we can use to open the WebSocket.
  - Offers an "onReceiveMessage" event, which we can use to dispatch notifications and handle requests to play sounds and send desktop notifications.
  - Offers a "broadcast()" method, which we can use to send desktop notification and sound requests.

Test Plan:
Added some code like this:

```
  if (!statics.leader) {
    statics.leader = true;

    JX.Leader.listen('onBecomeLeader', function() {
      JX.log("This tab is now the leader.");
    });

    JX.Leader.listen('onReceiveBroadcast', function(message, is_leader) {
      JX.log('[' + (is_leader ? 'As Leader' : 'Not Leader') + '] ' + message);
    });

    JX.Leader.start();
  }
```

Then:

  - Saw first tab open become leader reliably in Safari, Chrome, Firefox.
  - Saw new tab become leader reliably when the first tab was closed.
  - Saw broadcast() work as documented and deliver messages with correct leadership-flag and uniqueness.

Reviewers: joshuaspence, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6559

Differential Revision: https://secure.phabricator.com/D11235
2015-01-06 17:50:40 -08:00
epriestley
8c21ef2c0b Implement JX.WebSocket
Summary: Ref T6559. Wraps WebSocket in a reasonable driver class which does event dispatch, some state management, and handles automatic reconnect.

Test Plan: In Safari, Firefox and Chrome, connected to a websocket server and sent messages back and forth. Terminated and restarted server, saw automatic reconnects successfully reestablish a connection on all browsers.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T6559

Differential Revision: https://secure.phabricator.com/D11252
2015-01-06 17:48:05 -08:00
epriestley
c180832f84 Resize tokenizer text input after pasting
Summary:
Fixes T5251. We don't recompute tokenizer metrics accurately after a paste event.

Listen for paste events and redraw the input.

Test Plan: Pasted long text into a tokenizer in Safari, Firefox and Chrome.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5251

Differential Revision: https://secure.phabricator.com/D10442
2014-09-08 10:17:09 -07:00
Bob Trahan
0b7bae29c8 Projects - tokenize projects more aggressively with respect to '-'
Summary:
Fixes T5727. Updates the regexes to split on '-'. Also changes the editor such that tokens are updated by the larger search process. (Note this means we update this data more often then we need to - for every project transaction.)

Users will need to make an edit to a project -or- run `bin/search index "#project-tag"` to make this actually work.

Test Plan: Made "Frontend-Engineering", "Engineering", and "Backend-Enginering". They all showed up in the typeahead!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5727

Differential Revision: https://secure.phabricator.com/D10247
2014-08-14 12:28:11 -07:00
epriestley
0e98e33b33 When dragging stuff around, compensate for changes in scroll position
Summary:
Ref T5240. This fixes dragging stuff and using the mousewheel or keyboard to scroll the window during the drag.

(It does not fix "dragging near the edge of the container should scroll it" yet.)

Test Plan: Dragged stuff around on task list and workboards in Safari, Firefox and Chrome. Used mousewheel and shift + mousewheel to scroll the document and containers during drag. Object remained under the cursor.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5240

Differential Revision: https://secure.phabricator.com/D10186
2014-08-09 08:49:01 -07:00
epriestley
962e60c561 Retain focused node when redrawing tokenizer/typeahead results
Summary:
Ref T4420. Fixes T5473. Currently, when typeahead results get redrawn, you can lose your cursor position. A simple way to reproduce this is type "dif", select "Differential" using the arrow keys, then type "f". The selection will be lost.

Instead: store the old selection, then look for an item with the same name in the new set and select it. In effect, this preserves any focus selection.

Test Plan:
  - Typed "dif".
  - Typed "down arrow key" to select "Differential".
  - Typed "f".
  - "Differential" remained selected.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5473, T4420

Differential Revision: https://secure.phabricator.com/D9900
2014-07-17 15:53:28 -07:00
Joshua Spence
e495ce496b Fix various spelling mistakes
Summary: Minor change, self-explanatory.

Test Plan: Eye-ball it

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9911
2014-07-13 00:45:33 +10:00
Joshua Spence
8756d82cf6 Remove @group annotations
Summary: I'm pretty sure that `@group` annotations are useless now... see D9855. Also fixed various other minor issues.

Test Plan: Eye-ball it.

Reviewers: #blessed_reviewers, epriestley, chad

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Differential Revision: https://secure.phabricator.com/D9859
2014-07-10 08:12:48 +10:00
epriestley
d06679a021 Fix countdown embeds and endless loops on resource loads in Javelin
Summary:
Fixes T5273. Two issues:

  - If a JX.Resource callback throws, we keep running it. Instead, make sure it gets cleaned up before raising an exception.
  - The countdown timer script doesn't recover gracefully if the node has been removed from the document by the time it runs. Instead, just bail if we can't find the countdown.

Test Plan: Dumped `{Cxyz}` into a preview and got a countdown.

Reviewers: yungsters

Reviewed By: yungsters

Subscribers: epriestley

Maniphest Tasks: T5273

Differential Revision: https://secure.phabricator.com/D9399
2014-06-05 17:16:36 -07:00
Bob Trahan
7ab26aef66 Internet Explorer compatibility fixes
Summary:
A few fixes for IE that makes this work in IE9+ and at least you can drag things and have it fail horribly in IE8 now. Ref T5023.

 - try / catch around getBoundingClientRect because IE throws if the object is not attached to the DOM. The correct value can be inferred in these cases as 0,0
 - turns out IE has different values for button here (1,2,4) than other browsers. special case this by using the other IE fact that 'which' will be null

Test Plan: dragged and dropped tasks successfully in IE9, IE10, and IE11 on Windows 7. dragged and dropped tasks unsuccessfully in IE8 on Windows 7 - they always "drop" to the 2nd position or so as I think the ondrag code isn't firing properly or something

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5023

Differential Revision: https://secure.phabricator.com/D9118
2014-05-14 08:53:11 -07:00
epriestley
436f0563e8 Add a SublimeText-style repository typeahead
Summary:
Allows you to quickly search for files within a repository. Roughly:

  - We build a big tree of everything and ship it to the client.
  - The client implements a bunch of Sublime-ish magic to find paths.

Test Plan: {F154007}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley, zeeg

Differential Revision: https://secure.phabricator.com/D9087
2014-05-13 14:08:21 -07:00
epriestley
2b4c551b0e Provide a global router for Ajax requests
Summary:
Fixes T430. Fixes T4834. Obsoletes D7641. Currently, we do some things less-well than we could:

  - We just let the browser queue and prioritize requests, so if you load a revision with 50 changes and then click "Award Token", the action blocks until the changes load in most/all browsers. It would be better to prioritize this action and queue it immediately.
  - Similarly, changes tend to load in order, even if the user has clicked to a specific file. When the user expresses a preference for a specific file, we should prioritize it.
  - We show a spinning GIF when waiting on requests. This is appropriate for some types of reuqests, but distracting for others.

To fix this:

  - Queue all (or, at least, most) requests into a new queue in JX.Router.
  - JX.Router handles prioritizing the requests. Principally:
    - You can submit a request with a specific priority (500 = general content loading, 1000 = default, 2000 = explicit user action) and JX.Router will get the higher stuff fired off sooner.
    - You can name requests and then adjust their prorities later, if the user expresses an interest in specific results.
  - Only use the spinner gif for "workflow" requests, which is bascially when the user clicked something and we're waiting on the server. I think it's useful and not-annoying in this case.
  - Don't show any status for draft requests.
  - For content requests, show a subtle hipster-style top loading bar.

Test Plan:
  - Viewed a diff with 93 changes, and clicked award token.
    - Prior to this patch, the action took many many seconds to resolve.
    - After this patch, it resolves quickly.
  - Viewed a diff with 93 changes and saw a pleasant subtle hipster-style loading bar.
  - Viewed a diff with 93 changes and typed some draft text. Previews populated fairly quickly and there was no spinner.
  - Viewed a diff with 93 changes and clicked something with workflow, saw a spinner after a moment.
  - Viewed a diff with 93 changes and clicked a file in the table of contents near the end of the list.
    - Prior to this patch, it took a long time to show up.
    - After this patch, it loads directly.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T430, T4834

Differential Revision: https://secure.phabricator.com/D8979
2014-05-05 10:57:42 -07:00
epriestley
56aa508f43 Begin rebuilding dropdown menus on ActionList
Summary:
Dropdown menus are entirely dynamic right now and use custom CSS. Begin rebuilding them to use ActionList CSS.

This introduces PHUIX components which are basically JS copy/pastes of the PHP PHUI components, just implemented in JS.

We have two other dropdowns: policy controls and one in Conpherence. I'll convert those, then implement D8966.

Test Plan: {F150418}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8973
2014-05-05 10:56:14 -07:00