MCPcopy Index your code
hub / github.com/refined-github/refined-github / batchToggle

Function batchToggle

source/features/batch-mark-files-as-viewed.tsx:42–61  ·  view source on GitHub ↗
(event: DelegateEvent<MouseEvent, HTMLElement>)

Source from the content-addressed store, hash-verified

40}
41
42function batchToggle(event: DelegateEvent<MouseEvent, HTMLElement>): void {
43 event.stopImmediatePropagation();
44
45 const files = $$(fileSelector);
46 const thisFile = closestElement(fileSelector, event.delegateTarget);
47 const isThisBeingFileChecked = isChecked(thisFile);
48
49 const selectedFiles = getItemsBetween(files, previousFile, thisFile);
50 for (const file of selectedFiles) {
51 if (
52 file !== thisFile
53 // `checkVisibility` excludes filtered-out files
54 // https://github.com/refined-github/refined-github/issues/7819
55 && file.checkVisibility()
56 && isChecked(file) !== isThisBeingFileChecked
57 ) {
58 $(viewedToggleSelector, file).click();
59 }
60 }
61}
62
63function markAsViewedSelector(file: HTMLElement): string {
64 const checkedState = isChecked(file) ? `:not(${checkedSelector})` : checkedSelector;

Callers 1

handleClickFunction · 0.85

Calls 2

isCheckedFunction · 0.85
getItemsBetweenFunction · 0.85

Tested by

no test coverage detected