`
+ let html_clone = html.cloneNode(true);
+ html_clone.title = `加速源:${clone_url[i][1]} (点击可直接复制)`
+ html_clone.setAttribute('value', url)
+ _html += html_parent + html_clone.outerHTML + ''
}
- html.insertAdjacentHTML('afterend', _html);
+ html.parentElement.insertAdjacentHTML('afterend', _html);
}
// Git Clone SSH
- function addGitCloneSSH() {
- if (document.querySelector('.XIU2-GCS')) return
- let html = document.querySelector('[role="tabpanel"]:nth-child(3) div.input-group');if (!html) return
- let href_split = html.firstElementChild.value.split(':'),
- _html = '', _gitClone = '';
-
- if (href_split[0] != 'git@github.com') return
-
- if (GM_getValue('menu_gitClone')) {_gitClone='git clone '; html.firstElementChild.value = html.querySelector('clipboard-copy').value = _gitClone + html.firstElementChild.value;}
+ function addGitCloneSSH(target) {
+ let html = target.querySelector('input[value^="git@"]');if (!html) return
+ let href_split = html.value.split(':')[1],
+ html_parent = '`
+ url = _gitClone + clone_ssh_url[i][0] + href_split
+ let html_clone = html.cloneNode(true);
+ html_clone.title = `加速源:${clone_ssh_url[i][1]} (点击可直接复制)`
+ html_clone.setAttribute('value', url)
+ _html += html_parent + html_clone.outerHTML + ''
}
- html.insertAdjacentHTML('afterend', _html);
+ html.parentElement.insertAdjacentHTML('afterend', _html);
}
// Raw
function addRawFile() {
- if (document.querySelector('.XIU2-RF')) document.querySelectorAll('.XIU2-RF').forEach((e)=>{e.remove()})
- let html = document.querySelector('#raw-url, a[data-testid="raw-button"]');if (!html) return
+ let html = document.querySelector('a[data-testid="raw-button"]');if (!html) return
let href = location.href.replace(`https://${location.host}`,''),
href2 = href.replace('/blob/','/'),
url = '', _html = '';
@@ -270,6 +294,7 @@
}
_html += `