MCPcopy
hub / github.com/refined-github/refined-github / update

Function update

source/features/close-as-unplanned.tsx:13–36  ·  view source on GitHub ↗
(dropdown: HTMLElement)

Source from the content-addressed store, hash-verified

11const unplannedCheckbox = 'input[name="state_reason"][value="not_planned"]';
12
13function update(dropdown: HTMLElement): void {
14 const form = closestElement('form', dropdown);
15 const radio = $(unplannedCheckbox, dropdown);
16 const mainButton = $('[name="comment_and_close"]', form);
17 const icon = $('.octicon-skip', dropdown);
18
19 const checkbox = radio.cloneNode();
20 checkbox.hidden = true;
21 checkbox.type = 'checkbox';
22
23 mainButton.classList.add('tooltipped', 'tooltipped-nw');
24 mainButton.setAttribute('aria-label', 'Done, closed, fixed, resolved');
25
26 const unplannedButton = mainButton.cloneNode();
27 unplannedButton.append(icon);
28 unplannedButton.id = id;
29 unplannedButton.classList.add('btn', 'tooltipped', 'tooltipped-nw', 'mr-0');
30 // Prevent content from being changed #7024
31 unplannedButton.classList.remove('js-comment-and-button');
32 unplannedButton.setAttribute('aria-label', 'Close as not planned.\nWon’t fix, can’t repro, duplicate, stale');
33
34 dropdown.replaceWith(unplannedButton);
35 form.append(checkbox);
36}
37
38function updateCheckbox({delegateTarget: button}: DelegateEvent<MouseEvent, HTMLInputElement>): void {
39 $(unplannedCheckbox, button.form!).checked = button.id === id;

Callers

nothing calls this directly

Calls 3

cloneNodeMethod · 0.80
removeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected