-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Redesigned history page comparison #12775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Saad259
wants to merge
17
commits into
internetarchive:master
Choose a base branch
from
Saad259:redesign-history-page-comparison
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+547
−52
Open
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
576d85c
added quick-link and A/B comparison UI to history page
Saad259 9bdc089
Merge remote-tracking branch 'upstream/master' into redesign-history-…
Saad259 a7e6739
fixed some buggy behaviour
Saad259 e6065d1
Merge remote-tracking branch 'upstream/master' into redesign-history-…
Saad259 9410e16
Modified history.html further, fixed minor issue with template and ad…
Saad259 1cf36b7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9f2e042
Removed logging message
Saad259 2426aa5
Made some more Copilot suggested changes
Saad259 b835c64
Merge remote-tracking branch 'upstream/master' into redesign-history-…
lokesh 56eb3ad
Address review: use const and i18n the compare link label
lokesh 3631d5b
Redesign history page table and mobile layout
lokesh e63dcb9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7c69084
Refine history page mobile styles
lokesh 15afb87
Move history comparison to URL-backed sticky bar
lokesh a4968f3
history: remove dead form markup, add A/B i18n translator notes
lokesh 2829b12
bundlesize: bump page-plain.css cap to 27KB
lokesh 55a3f5f
bundlesize: bump page-edit/page-form.css caps to 27KB
lokesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /** | ||
| * Handles arbitrary A/B comparison on the history page. | ||
| * When both an A and B radio are selected, injects a comparison link | ||
| * into the Pick cell of the lower-numbered revision's row. | ||
| * @param {HTMLElement} pageHistoryElement | ||
| */ | ||
| export function initHistory(pageHistoryElement){ | ||
| console.log('initHistory called', pageHistoryElement); | ||
| console.log('pre-checked a:', pageHistoryElement.querySelector('input[name="a"]:checked')); | ||
| console.log('pre-checked b:', pageHistoryElement.querySelector('input[name="b"]:checked')); | ||
|
|
||
| const radios = pageHistoryElement.querySelectorAll('input[name="a"], input[name="b"]'); | ||
|
|
||
| function updateCompareButton() { | ||
| const checkedRadioA = pageHistoryElement.querySelector('input[name="a"]:checked'); | ||
| const checkedRadioB = pageHistoryElement.querySelector('input[name="b"]:checked'); | ||
|
|
||
|
|
||
| var compareBtns = pageHistoryElement.querySelectorAll('.compare-arbitrary-btn'); | ||
|
lokesh marked this conversation as resolved.
Outdated
|
||
| compareBtns.forEach(btn => btn.remove()); | ||
|
|
||
| if (checkedRadioA && checkedRadioB){ | ||
| const valA = parseInt(checkedRadioA.value, 10); | ||
| const valB = parseInt(checkedRadioB.value, 10); | ||
|
|
||
| const higherRev = Math.max(valA, valB); | ||
| const lowerRev = Math.min(valA, valB); | ||
|
|
||
| const href = `?m=diff&a=${lowerRev}&b=${higherRev}`; | ||
|
|
||
| const link = document.createElement('a'); | ||
| link.href = href; | ||
| link.textContent = `Compare ${lowerRev} with ${higherRev}`; | ||
| link.className = 'compare-arbitrary-btn'; | ||
|
|
||
|
|
||
| const lowerRadio = pageHistoryElement.querySelector(`input[name="a"][value="${lowerRev}"]`); | ||
| const pickCell = lowerRadio.closest('tr').querySelector('.pick-ab'); | ||
| pickCell.appendChild(link); | ||
| } | ||
| } | ||
|
|
||
| radios.forEach(radio => radio.addEventListener('change', updateCompareButton)); | ||
| updateCompareButton(); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.