Skip to content

Instantly share code, notes, and snippets.

@mrVanDalo
Created June 14, 2024 14:30
Show Gist options
  • Save mrVanDalo/fe1578e21be306d4f39b45f1cfa22750 to your computer and use it in GitHub Desktop.
Save mrVanDalo/fe1578e21be306d4f39b45f1cfa22750 to your computer and use it in GitHub Desktop.
violentmonkey script: nixpkgs track on github.com
// ==UserScript==
// @name New script github.com
// @namespace Violentmonkey Scripts
// @match https://github.com/NixOS/nixpkgs/pull/*
// @grant none
// @version 1.0
// @author -
// @description 6/14/2024, 3:48:46 PM
// @require https://cdn.jsdelivr.net/npm/@violentmonkey/dom@2
// @require https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
// ==/UserScript==
VM.observe(document.body, () => {
// Find the target node
var $node = $('header > div.AppHeader-localBar > nav > ul');
var url = window.location.href;
//console.log(url);
var url = new URL(url);
var pull_request = url.pathname.split('/').filter(Boolean).pop();
//console.log(pull_request);
// console.log($node)
if ($node.length) {
// append button to search bar.
$node.append( `
<li>
<li data-view-component="true" class="d-inline-flex">
<a href="https://nixpk.gs/pr-tracker.html?pr=${pull_request}" target="_blank" class="UnderlineNav-item no-wrap js-responsive-underlinenav-item js-selected-navigation-item">
<span >Nixpkgs Pull Request Tracker</span>
</a>
</li>
</li>` );
// disconnect observer
return true;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment