Commit graph

8 commits

Author SHA1 Message Date
Ed Sanders d6cc861de7 Allow line ranges to be selected using shift+click
Change-Id: I224de2d2d72525b61608d7b6d0f13ce84a699ef7
2024-03-06 22:30:51 +00:00
Ed Sanders e350f10a7e Don't let native scroll happen when clicking on line links
Update the page hash with history.replaceState instead.

Change-Id: I9d7bc25876aaae929646cd7e5960a8f76ede94f3
2024-02-06 16:33:46 +00:00
Ed Sanders f2613d589c Line number highlight: Use getTargetFromFragment
Bug: T315872
Depends-On: I605a24c708e60ccffde9dce524485f61fd5c7b06
Change-Id: I48c1aaf56ccea232dca7cb52f24a29a421b94d86
2022-08-31 13:10:18 +00:00
Timo Tijhof 7d9c268ffd pygments.linenumbers: Avoid deep jQuery loops on unrelated interactions
Follows-up 42c97fa (I82ed4ade), 63c5943a9 (Ic71346196).

This commit makes no functional changes, but it reduces overhead
from the SyntaxHighlight code when interacting with other features,
such as elaborate modals or other hashchange-heavy code paths that
a gadget might produce.

It uses vanilla DOM instead of jQuery where possible, and adds an
early return rather than fairly deep continuation no-ops.

Change-Id: I2264f6f398193802f05c738bad4c294da007fb27
2021-02-19 03:43:24 +00:00
Ed Sanders 42c97fa448 Avoid console warning when hash is empty
Bug: T272844
Change-Id: I82ed4ade24ed9e61e654cc7ea1ce19c7607086e1
2021-01-25 22:30:48 +00:00
Ed Sanders 63c5943a9f Don't try to highlight elements not in a code block
The 'hll' CSS only targets the .linenos selector, but it doesn't
hurt to avoid unnecessary DOM changes.

Change-Id: Ic7134619606c6e4abc2480ddc9650d0352fc33da
2021-01-13 20:47:41 +00:00
Ed Sanders 8f09ace86b Don't throw an error when location.hash in unparseable
Bug: T271572
Change-Id: I50e5593272c0039c32019e5fdcb2c79465229cf0
2021-01-13 20:39:10 +00:00
Ed Sanders 583e3b3db8 Add support for line anchors on code pages
Bug: T29531
Change-Id: Ic09086c19d37bdff8bb7e68bbb0f676ef87896fe
2021-01-03 00:19:13 +00:00