Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions src/js/lib/pages/github/all.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import $ from 'jquery';
import Base from './_base';
import k2Button from '../../../template/button.github.k2.html';

/**
* This class manages the things that happen on *every* GitHub page. All it's doing is adding links to the
Expand All @@ -19,31 +17,6 @@ export default function () {
* Add buttons to the page and setup the event handler
*/
AllPages.setup = function () {
// Hardcode because it doesn't change, and depending on GitHub markup means
// it breaks every so often
const currentUrl = '/Expensify/Expensify';

// Insert K2 button after the Pull requests tab, retrying if the nav hasn't rendered yet
if (!$('li.k2-extension').length) {
const pullsTab = $('nav[aria-label="Repository"] a[href*="/pulls"]').closest('li');
if (pullsTab.length) {
pullsTab.after(k2Button({url: currentUrl}));
} else {
let retries = 0;
const interval = setInterval(() => {
if ($('li.k2-extension').length || ++retries >= 10) {
clearInterval(interval);
return;
}
const tab = $('nav[aria-label="Repository"] a[href*="/pulls"]').closest('li');
if (tab.length) {
tab.after(k2Button({url: currentUrl}));
clearInterval(interval);
}
}, 100);
}
}

// Set up timestamp format conversion
setTimeout(() => AllPages.applyTimestampFormat(), 500);
setInterval(() => AllPages.applyTimestampFormat(), 5000);
Expand Down
Loading