Граф коммитов

108 Коммитов

Автор SHA1 Сообщение Дата
Jamal Carvalho 28ae1d368e content/static: rewrite worker.js with typescript
For golang/go#43359

Change-Id: I3322816e860f7107dee9ab49f85c891af920242a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/300070
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Jamal Carvalho <jamal@golang.org>
2021-03-09 18:24:25 +00:00
Jamal Carvalho c9a527b474 content/static: rewrite sidenav.js with typescript
For golang/go#43359

Change-Id: Icd5d9bdf06694e823b898d7972ba2fb697454896
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/300069
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-09 17:42:56 +00:00
Jamal Carvalho 5b10f690a0 content,third_party: remove unused JS files
For golang/go#43359

Change-Id: Ib2aed959229e630fc779534859121ced469054a9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299261
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:41 +00:00
Jamal Carvalho 9a9d5ef0fc content/static: rewrite unit.js with typescript
For golang/go#43359

Change-Id: I4256144908205463a70a6bd1b6c8b5b751ec2cc6
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299260
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-08 15:59:37 +00:00
Jamal Carvalho c8014eb244 content/static: rewrite unit_fixed_header.js with typescript
For golang/go#43359

Change-Id: Iae32a7872f207abd7b2667097ac1d3e57f4bbd92
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299259
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:33 +00:00
Jamal Carvalho 9826220f9b content/static: rewrite toggle-tip.js with typescript
For golang/go#43359

Change-Id: Ifca0779ae6a949c06c765b20d7a3e0f1c591f60a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299258
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:29 +00:00
Jamal Carvalho bc3f77d9ae content/static: fix unit page type error
Makes expandAll toggle for ExpandableRowsTableController
optional to fix a type error in unit.ts

For golang/go#43359

Change-Id: I5680283ea71d0aabde3511c76ac8ee39ab288905
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299257
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:24 +00:00
Jamal Carvalho d8cbc4f9d7 content/static: rewrite keyboard.js with typescript
For golang/go#43359

Change-Id: I5d5331c5aa072650bb97d4bf70c6a1df00a3602f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299256
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-08 15:59:20 +00:00
Jamal Carvalho b56d986367 content,internal: rewrite jump.js with typescript
For golang/go#43359

Change-Id: I4ceef713fac50cf69ca4f79954a0a9bdb932f1d8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299255
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:16 +00:00
Jamal Carvalho 4155e54eb9 content,internal: rewrite fetch.js with typescript
For golang/go#43359

Change-Id: Id668a6e7c307233b55388235bbc5011a339e5680
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299254
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:12 +00:00
Jamal Carvalho 60231949ce content,internal: rewrite badge.js with typescript
For golang/go#43359

Change-Id: I48e21ddecb5a26e28d112f0ede5779ec599b8b4f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299253
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-03-08 15:59:07 +00:00
Jamal Carvalho fda88804ce content,internal: consolidate smaller JS scripts into sitewide entry file
Moves analytics, utm_source and base site code to a new file called
site.ts. This file contains all initialization scripts for pkg.go.dev
that should be run before other scripts are added to the page.

For golang/go#43359

Change-Id: I49dbf7afdaffa9c0638266ae58e1059802936fc1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299251
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-08 15:58:55 +00:00
Jamal Carvalho 277cf832bf content/static: print message on playground error
Error messages were being overwritten with an
empty string. This change ensures error messages
print to the playground console.

Change-Id: Ia47626fd675e2347bbbe8040a62babec28d600b4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/299250
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-05 21:40:29 +00:00
Jamal Carvalho cc2e324ca4 content/static: make playground share links update with edited text
Fixes golang/go#44719

Change-Id: Iedfa4d677b5512f9e140fc647ef6144517e697c1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/297874
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-03-03 16:44:35 +00:00
Jamal Carvalho 41ca6b309e content/static: fix null reference error in jump.js
Change-Id: I2acdf9ac7f0ba697f3de7fb0b8f5568ec0f852f5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295969
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-25 16:04:19 +00:00
Jamal Carvalho f5b8213723 tsconfig,content/static: change TS build target to ES2019
ES2020 adds support for optional chaining to the JavaScript
language and has been adopted in all major browsers. However,
support for optional chaining is not universal so we are seeing
some JavaScript errors related to the syntax. Downgrading our
build target to ES2019 to prevent these errors in older browsers.

Change-Id: I7bb08d26ab6fe54a4341db5a517356573bce6e1d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295932
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-24 18:46:28 +00:00
Jamal Carvalho 60c442b37e content/static: example playground output fixes
The example playgrounds now clear the existing output before
printing new output when the Run button is pressed. Ensures
the loading message is cleared when example code produces no
output. Additionally, the output box will now display for all
examples because they are editable. Examples that don't
initially have output can be changed to produce output.

Change-Id: Ie70f98ab505a28705e2ea65869bddb84ef6927ec
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295192
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-02-23 16:41:44 +00:00
Jamal Carvalho f27d2df993 content/static: interactive example playgrounds
Example playgrounds on documentation pages are
editable and interactive. Below each example code
snippet on the documentation page we’ll display
buttons to run, format, and share the snippet.
Pressing run displays the result output below the
code snippet, format will reformat the code inline
and share will display a share link below the code
snippet and open the playground in a new window.

For golang/go#44090

Change-Id: I56d635e60a89a382974ef7100eb4348dbbb4b893
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293833
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-22 15:54:52 +00:00
Jamal Carvalho 19ae0765f7 content/static: fix null reference errors in unit.js
Fixes golang/go#43434

Change-Id: I0af7549c9acdb16202d6d77ca2993eea6cb35f7f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293841
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-19 17:20:26 +00:00
Jamal Carvalho 12cbd43747 content/static,devtools: migrate playground.js to typescript
Migrates playground.js code to TypeScript in preparation
of enhancements to the example playgrounds.

Change-Id: I185e9fe05c0e7bf3deb683f1583f9a26b4960237
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288991
Trust: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-02-08 18:08:24 +00:00
Jamal Carvalho 54d798018a content/static: directory tree fixes
- Reduces padding inside of directories rows.
- Directories expand when entering text search.

Change-Id: Idba574f0b6ca71d6bb940553f2a3e727b07218ef
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290070
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-08 17:54:13 +00:00
Julie Qiu 4da3fcf7c7 content/static: strip known utm sources on page load
Requests originating from gopls and redirected from godoc.org have a
"utm_source=gopls" and "utm_source=godoc" query param in the URL,
respectively.

If we see this, we will strip the query param on page load, so that so
that it doesn’t remain in all our URLs coming from these sites.

This is done to page load so that requests are still sent to GA with
these utm_sources intact.

For golang/go#42602

Change-Id: I63defcb50ba54b1e476de0f0db63c23494000046
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/270800
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-01-26 15:48:54 +00:00
Jamal Carvalho d97e5ef760 content/static: fix nav tree bug in sidebar
Theres a bug in the navtree where if the README
headings are expanded and the jump to identifier
tool is used, both the README headings and the
documentation headings will be visible. This change
closes the inactive top level nav when a new item
is selected.

Change-Id: I3c88f0654039bb3b7ca1725f0c02918a3780061d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/283956
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-01-15 16:36:08 +00:00
Jamal Carvalho fb38b64431 content/static: run prettier on table.js
Change-Id: I1e5e7b72280e621b57778968488b06e170613f29
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/283953
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-14 21:36:45 +00:00
Jamal Carvalho fad54382f9 content/static: unit directories tree layout
Updates unit directories section to nest subdirectories
in a two level tree structure.

For golang/go#43694

Change-Id: I374c042234aeb426b24ae44c861bfb61e6511db1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/283715
Trust: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-14 17:08:53 +00:00
Jamal Carvalho 2b20326fa5 content: simplify content directory structure
Removes separate directory for TypeScript files and
updates frontend tools to match updated directory
structure. TypeScript files will be co-located with
the JavaScript files making easier to identify files
that have already been migrated to TypeScript.

Change-Id: I4deb5b22c550fc34c98529bbe19bec6d28759a02
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/282377
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-08 18:30:54 +00:00
Jamal Carvalho 2ba3da7947 content,internal: remove goldmark and readme-outline experiments
Now that goldmark and readme-outline experiments are fully
rolled out we can remove related legacy code.

Change-Id: Ibb1a653726a4a58d5a26b2db308778a0c5ddcffc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281674
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-06 17:24:24 +00:00
Jamal Carvalho 79b22c6944 content,internal: badges form improvements
Updates badges form to mirror behavior of search input.
If a module url is entered with an http(s):// prefix
the prefix will be stripped and the resulting path is
used in the badge URL. Removes the interactive update
in lieu of an update button after the badge has been
created. Live updates with our scheme removal logic
lead to a strange experience when changing urls after
a badge was already created.

Fixes golang/go#43458

Change-Id: I1732a3eeb54f475c90f0b6f5f2976fb25cbfe039
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281712
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-06 17:22:14 +00:00
Jamal Carvalho 47d0537e4d content: move clipboard.js code to content/ts
Migrates CopyToClipboardController to TypeScript
and adds a unit test.

For golang/go#43359
For golang/go#43361

Change-Id: I2e1179aa7cecb0e280a57d420ee2f885c4d6db3c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/280893
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
2021-01-05 15:59:00 +00:00
Julie Qiu f5ca8b02c5 content,internal: delete autocomplete code
Autocomplete no longer works in dev, and the experiment is not active
in any other environment.

Change-Id: I8865539862a4d1b84bf91641e7662d4926d30488
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/279133
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Julie Qiu <julie@golang.org>
2020-12-22 14:54:15 +00:00
Alex Hays 957d9d02d1 internal/frontend: make links on 404 => Request page clickable
If the user arrives at the 404 page and clicks the
Request <package-name> button, there are two possible
responses from fetch.go that contain links. This
makes those links clickable.

These URLs show these two locations upon clicking Request:
https://pkg.go.dev/github.com/google/go-cloud@v0.20.0
https://pkg.go.dev/github.com/hashicorp/vault/@master/api

Fixes golang/go#40306

Change-Id: I1dacc8ad3a7337a3c02079381ab454a1678cc681
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277117
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
2020-12-15 21:16:03 +00:00
Jamal Carvalho 69dd2296af content/static: additional metadata in the right sidebar
Adds a section to the right sidenav highlighting
metadata about modules to help reinforce best practices
for maintaining modules on the pkgsite. This feature is
implemented behind the "unit-meta-details" experiment.

For golang/go#43129

Change-Id: I2755756b10f5cb1b1d1a2f9caf42c90fc715ff3b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/277854
Trust: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-14 17:56:01 +00:00
Julie Qiu 7f241d37d8 internal/frontend: add .svg suffix to badge URL
A .svg suffix is added to the end of the badge image URL path, to
indicate that the link is an SVG image.

Test for "?tab=imports" in TestBadgeHandler_ServeBadgeTool are now
deleted, since that use case is no longer supported.

Change-Id: I1f159dad37abe94c5e3ce6f9b65f3b36cec977bf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/275435
Trust: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-12-04 21:49:12 +00:00
Julie Qiu bf87d50d50 content: update badge snippet alt text
The alt text is changed from PkgGoDev to "Go Reference" to match the
alt text with the badge text and improve accessibility.

Change-Id: I53edeb706fa802a5a347004345fea60987f306ff
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/275304
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-12-04 21:48:48 +00:00
Jonathan Amsterdam 557ca0dd34 content/static/js: remove collectJumpListItemsFallback
All our doc has data-kind attributes.

Fixes golang/go#42956

Change-Id: I2bb85d741873bba524a13ab8f6b2e50d9615570d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274954
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-03 10:58:56 +00:00
Jonathan Amsterdam adf682b32f content/static/js: remove guessKind
Fixes golang/go#42957

Change-Id: I273ed33ae2c9a57632a9870864bc962e2e0d4b8c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274953
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-03 10:49:50 +00:00
Jonathan Amsterdam 97be6d027a content/static/js: change internal bug references to external
Fixes golang/go#39621

Change-Id: If88a53f0b22d45baf68fb7666280b0bb6722759b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274952
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-02 22:50:47 +00:00
Jamal Carvalho 5e78b63826 content,internal: remove legacy static content
Removes static content used in the legacy package, directory, and module pages.
Moves sidenav and readme styles requests into details page so they are not
loaded on all page requests.

Change-Id: Ief93cb1ec21939dadf0f9f6a0c47abaf4284b2a9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272827
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-24 21:11:40 +00:00
Jamal Carvalho 3304502adf content/static: expand readme when browser text search is activated
The browser find text feature will search through text
even when it is hidden. This change will expand the readme
when the text search feature is activated on the unit page.

Fixes golang/go#42653

Change-Id: I15a97724c21a975ee04f409a26e409e3ed7efd76
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272608
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-11-24 21:11:08 +00:00
Jamal Carvalho 819cd13d95 internal/frontend: extend goldmark parser with custom id generator
The default id generator in goldmark is limited to ascii characters
and keeps the text content from inlined images. This change removes
the images from heading ids and preserves all unicode alphanumeric
characters.

Change-Id: I8657dc4aa3f2b8d5b4f5a519992ed85f67d0b7a4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272447
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-11-23 22:34:06 +00:00
Jamal Carvalho 4d2f0315fa content/static: add readme headings to the sidenav
This change adds the readme headings to the outline
in the sidenav and unifies the navigation tree into
a single accessible structure.

Styles within the tree are based on the accessiblity
tree structure. This will make it easier to see when
updates to the tree are inserted incorrectly because
they'll be matched by visual breakages on the page.

Sidenav and readme click handlers are updated to
ensure that when an outline item is clicked the
corresponding content is visible.

Change-Id: Ie6062c24f37bec9fffe242aa1398ec815606c613
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271319
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-20 17:37:33 +00:00
Jamal Carvalho 6d25f509ee content/static: copy unit outline code into legacy files
Code in motion. Outline code will be updated to support
a new outline layout that contains the readme headings.

Change-Id: I58d4778f01dd9e1347197f1a8d2d5cd16b35d7a8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271318
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-19 14:15:55 +00:00
Julie Qiu d6a42ad786 content/static/js: remove used .js-filesOption reference
At the moment, this error appears in the console on pages without a
Source Files section:

Uncaught TypeError: Cannot read property 'setAttribute' of null
    at unit.js:54

It doesn't seem like js-filesOption is being used anywhere, so this
reference is deleted in unit.js.

Change-Id: I8db74ae996d99b1ffef143e5b8ffdc78ba1d9cbe
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/270801
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
2020-11-17 18:23:53 +00:00
Eli Bendersky fdee0046e9 x/pkgsite: more accurate identifier filtering for "jump to" in-page search
Currently, "jump to" filters ids by a simple substring match, ordering them alphabetically. This change makes the filtering more powerful by prioritizing exact matches over prefix matches and then substring matches.

E.g. if a package has a symbol named `Foo`, when the Jump dialog is searched for `Foo` it should now come before ids like `BarFoo` (which would previous come on top because of alphabetical order).

This change also removes the use of regexps in the list, using simpler string matching.

Fixes golang/go#42489

Change-Id: I2f564d28767a27c68ef01ab246aaf4b8755bb902
GitHub-Last-Rev: cd6ca249ce
GitHub-Pull-Request: golang/pkgsite#16
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/269278
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Trust: Julie Qiu <julie@golang.org>
2020-11-12 16:49:24 +00:00
Jamal Carvalho 56763a69f3 content/static: limit performance tracking to core web vitals
Time to First Byte and First Contentful Paint can be useful as proxy
or supplemental metrics when diagnosing specific issues. For now we'll
focus on the Core Web Vitals to reduce the number of events sent to
Google Analytics. This will be important as traffic to the site grows
so that we do not hit any event caps.

Change-Id: I3c7514d630b65b66d2884efb9f0c1b9ace71630d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/268118
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-11-09 15:13:57 +00:00
Jamal Carvalho 244535af9d Revert "content,internal: disable jump to identifier if documentation only has overview"
This reverts commit a5040c6e9b.

Reason for revert: breaks jump to identifier on package pages.

Change-Id: I33f9d99aa1ef671d28af1de51c88493a6d0ca2db
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264919
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-26 13:45:29 +00:00
Jamal Carvalho aaaf1af534 content/static: readme expands when given tab focus
Fixes readme expand logic so that it will open
when an element within it is given focus through
keyboard events.

Change-Id: I66cd406137b6162b3bd8415b5c186f87f0886ee2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264627
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-26 12:36:41 +00:00
Jamal Carvalho 7fe9dace48 internal,static: add missing items to mobile nav
Adds options for readme, sourcefiles, and documentation to
mobile navigation dropdown.

Change-Id: I29952b10412b92766aa82d3a3b4a22a2c3a19d1b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264624
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-26 12:36:17 +00:00
Jamal Carvalho a5040c6e9b content,internal: disable jump to identifier if documentation only has overview
When the doc for a package does not contain an index
we disable the jump to identifier dialog. This change
prevents both the button in the sidebar and the k key
from opening the modal.

Change-Id: I48e17a4f57f066bf80fdc5452e900f9803ecf933
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264199
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
2020-10-21 18:37:10 +00:00
Jamal Carvalho 1e6101ed17 content/static: disable jump to modal when documentation is empty
Disables the jump to modal from opening when documentation
does not exist for the current page.

Change-Id: Ic67019003ae4adc9482a67a72f2f077eadb0363d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260720
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-08 17:28:12 +00:00