Commit Graph

45 Commits

Author SHA1 Message Date
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Anders Kaseorg 5f590d3500 js: Remove /* eslint indent: "off" */ comments.
The time has come to dedent these files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-25 13:21:43 -07:00
Yashashvi Dave d3e83483c8 static/js/common: Add `Ctrl` key mapping to `Cmd` for MacOS. 2019-07-08 20:07:49 -07:00
Yashashvi Dave fed64cc59d static/js/common: Extract function `adjust_mac_shortcuts`. 2019-06-24 14:04:42 -07:00
Yashashvi Dave 371343709b static/js/common: Extract function `has_mac_keyboard`. 2019-06-24 14:04:42 -07:00
YashRE42 5f1a32a9ee arrow-icons: Replace ⇽ , ⇾ with ← , → everywhere.
We were using these hollowed out arrows characters (⇽ , ⇾) in a few
places, these were inconsistent with the solid up and down arrow
characters (↑ , ↓) we use otherwise. This commit replaces them
everywhere in the codebase.
2019-05-30 16:18:54 -07:00
Anders Kaseorg d4b060a520 dependencies: Upgrade simplebar to 4.0.0-alpha.6.
Fixes #12038.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-28 21:32:55 -07:00
Adarsh Patel c886b53a3d help: Fix rendering correct OS-specific docs.
This fixes #11279, a bug where the OS-specific docs did not correctly
select the Uuser's OS tab as active when clicked from the left sidebar
of /help/.
2019-01-14 14:34:04 -08:00
Cynthia Lin 9593a8a7f5 help: Exclude anchor link hash to highlight main article in sidebar.
Currently, if you access an article link with an anchor link that isn't
featured in the sidebar, the main article won't be highlighted. Thus, we
exclude the anchor link hash from the article-searching selector if
the full article pathname wasn't found.
2018-07-24 09:01:42 -07:00
Cynthia Lin eaeec30590 help: Fix broken anchor link handling in documentation.
Fixes #10022.
2018-07-23 23:18:33 -07:00
Cynthia Lin 55d5089156 help: Use simplebar instead of container to calculate hash scrolling. 2018-07-23 10:10:02 -07:00
Cynthia Lin 960f83238b help: Replace perfect-scrollbar with simplebar in help pages.
The perfect-scrollbar library created one major problem, which is that
`ctrl-F` didn't work, and several smaller problems.

Fixes #9748 and fixes #8887.
2018-07-13 18:03:32 +05:30
Cynthia Lin 8ee034a41c help: Prevent scrolling when cursor is on body.
When you hover above the navbar, the cursor focuses on the page
body and scrolls the entire page, breaking the positioning of the
fixed sidebar and page content.

We disable scrolling on the body but allow the sidebar and Markdown
content page elements to be scrolled to fix this bug.
2018-07-13 18:03:32 +05:30
Aditya Bansal 69904e04d8 help: Remove dead css and js left over from the time of redesign.
This removes some left over dead code from the redesign which was
introduced in commit 1cf7ee.
2018-07-04 23:51:45 +05:30
Cynthia Lin dcfc2e10b8 help: Fix broken anchor link scrolling in documentation pages.
Whenever a link is clicked, the page link changes, and the content
of the `.markdown .content` node updates, preventing the old
listener to catch any future anchor link clicks. 

We attach the listener to the document instead and only activate
it when the target element is a proper anchor link heading.

Fixes #9767.
2018-06-19 14:19:23 -07:00
Akash Nimare 64c668b881 help: Update default article heading on help pages.
We should only open the default article heading which is "Guides",
if the user is on the index page i.e. /help/. For non index pages
we don't need to open this heading.
2018-06-07 11:21:12 -07:00
Akash Nimare 4b3309f3f0 help: Close other article headings on click.
This commit adds a minor improvment in clicking
the left sidebar behaviour. So if you click on
an article heading then other opened headings will
be closed automatically. This makes the toggle
experience better.
2018-06-07 11:20:10 -07:00
Akash Nimare 733b1a14bb help: Highlight article heading in left-sidebar.
This fixes a bug where we don't toggle the article heading
if you open it direclty.

Fixes: #9700.
2018-06-07 10:51:59 -07:00
Akash Nimare 84d3a4dbf3 help: Fix back button on help pages.
We should use update_page function for popstate
event so that we can fetch and update the help
articles correctly.

Fixes: #9617.
2018-06-06 03:18:58 +05:30
Akash Nimare 3a8a5a39bd help: Extract code for updating the page.
This commit extracts the code for updating
help page to update_page function.
2018-06-06 03:13:56 +05:30
Akash Nimare 5a2c19c67e help: Refactor code in help.js.
This commit organizes the code properly i.e.
declaring variable on top of the function and
moving window events in the bottom.

Fixes: #9617.
2018-06-06 03:01:52 +05:30
Shubham Dhama cc03f9fb8f eslint: Enable space-infix-ops rule.
More about rule at  https://eslint.org/docs/rules/space-infix-ops
2018-06-05 00:47:35 +05:30
Tim Abbott c3a81157de help: Fix ordering of code sections work and scrollbar update.
Conceptually, the scrollbar update should be after we've rendered the
code blocks.
2018-05-26 10:04:46 -07:00
Tim Abbott b7f9139ffc help: Render all HTML tables with the bootstrap striped theme. 2018-05-26 10:04:46 -07:00
Tim Abbott 7ab8a8e820 js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration.
90% of these changes are just fixes for indentation errors that have
snuck into the codebase over the years; the others are more
significant reformatting to make eslint happy (that are not otherwise
actually improvements).

The one area that we do not attempt to work on here is the
"switch/case" indentation.
2018-05-06 16:25:02 -07:00
Gooca 2363c9955a ui scrollbar: Update perfect-scrollbar to 1.3.0.
Update perfect-scrollbar to fix stutter space-scrolling in #8544. Also
reworked deprecated `element.perfectScrollbar` to `new
PerfectScrollbar(element)`.  Lastly, updated provision version and
changed node module path to new path.

This also refactors perfect-scrollbar in help.js to work with updated
version of perfect-scrollbar. Because the update also changed
perfect-scrollbar's css selectors for all scrollbars in zulip, we
update those too.

Fixes #8544.
2018-03-20 21:59:11 -07:00
Tim Abbott 8a53e83cf6 help: Use more consistent module name for perfectScrollbar.
The `Ps` alias that we were using previously was potentially confusing
and made this usage harder to grep for.
2018-03-16 12:50:33 -07:00
Tim Abbott dcda633b3a help: Fix scroll position when reloading browser window with hash.
This uses the same technique as the last commit, just with the final
case for how we navigate to/from these pages.
2018-02-14 09:26:42 -08:00
Aman Jain d48664fc5f help: Fix links with query selector from left sidebar.
This resolves the issue of scrolling to correct position when loaded
from left sidebar to a link with query selector.

Fixes #6714.
2018-02-14 09:25:26 -08:00
Cynthia Lin d449fcb309 user docs: Dynamically replace keyboard shortcuts for Mac OS. 2018-01-22 19:41:17 -05:00
Cynthia Lin 20a745390b user docs: Allow redirection of external URLs in documentation sidebars.
Fixes #7916.
2017-12-31 08:08:25 -05:00
Cynthia Lin 5df9011ae5 user docs: Apply highlights to documentation indexes. 2017-12-27 15:15:05 -05:00
Cynthia Lin fa92a35f17 user docs: Highlight currently selected user docs article.
Fixes #7053.
2017-12-27 15:15:05 -05:00
Cynthia Lin aa50fae4ba portico: Add anchor link support to API and user docs.
Fixes #7432.
2017-11-20 17:23:19 -08:00
Brock Whittaker 228b0c4290 /help/: Add a slide class for sidebars that should have slide mechanism.
This adds a slide class that specifies that the JS actions for sliding
up and down sections is the desired behavior, along with a bit of CSS
to help display correctly in the case of not being a sliding section.
2017-11-08 13:01:33 -08:00
Tim Abbott 3104d3ea3e api: Fix rendering of code blocks after clicking sidebar links.
We need to call `render_code_sections` to show the code block for the
current language whenever switching which code block we're looking at.
2017-10-30 22:53:41 -07:00
Tim Abbott f01f596138 help: Merge api.js and help.js bundles to fix code blocks.
In addition to decreasing the excessive number of bundles we had, this
will set us up to fix rendering of code blocks when clicking the
sidebar links in the /api-new site.
2017-10-30 22:53:17 -07:00
Brock Whittaker 7cb7158a42 /help/: Re-add perfectScrollbar for sidebar and markdown.
This adds back the perfectScrollbar for the sidebar and markdown
sections because we already lost CTRL-F functionality, so we may
as well bring back the pretty, non-obtrusive scrollbars.

This updates the scrollbar after a successful `slideToggle` of
one of the sidebar sections.

Fixes: #6999.
2017-10-17 17:14:36 -07:00
Brock Whittaker a7f602fed6 /help/: Fix sidebar target bug.
This tries to toggle the next item when clicking on an <h2>
in the sidebar, however we want to first check the next item is
an <ul> element, so that we are collapsing or showing a list,
instead of something like an <h2> which currently happens with
the "#guides" element.
2017-10-03 16:38:47 -07:00
Cynthia Lin 71af43601a user docs: Add collapsible sidebar sections. 2017-10-03 11:13:36 -07:00
Brock Whittaker 40dfef490d /help/: Remove perfectScrollbar.
This removes perfectScrollbar because it breaks CTRL-F.
2017-08-28 16:09:06 -07:00
Brock Whittaker 44636051e4 Make /help/ sidebar more discoverable on mobile/narrow.
This makes the /help/ sidebar more discoverable at windows less
than 1000px in width because it makes it stick out a bit when it
is closed with the hamburger menu at the top.

Fixes: #6038.
2017-08-24 13:38:22 -07:00
Vaida Plankyte d3f0d2cc9f help: Add perfectScrollbar to markdown container. 2017-08-15 21:10:14 -07:00
Brock Whittaker 5ee0725731 Remove unnecessary comment. 2017-08-01 18:33:11 -07:00
Brock Whittaker 1cf7ee966b help: Redesign /help/ pages to be a single page app.
This redesigns the /help/ page sets to be a single page app that uses
history.pushState to work the same as the old app.

The big new feature is that now we have the index in a nicely designed
left sidebar.
2017-07-13 15:43:44 -07:00