Skip to content

Commit

Permalink
[FIX] Firefox compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
NirmalScaria committed Aug 6, 2024
1 parent 29427ca commit 0ab6d69
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 27 deletions.
3 changes: 2 additions & 1 deletion js/fetchFilteredCommits.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ async function fetchFilteredCommits(selectedBranchNames, selectedBranches, allBr
if (await fetchCommitsPageFiltered(repoOwner, repoName, "NONE")) {
console.log("--FETCHED BRANCHES--");
console.log("--COST : '" + APIcost + "'--");
branches = branches.map(branch => {
branches = branches.map(branchOriginal => {
var branch = JSON.parse(JSON.stringify(branchOriginal));
heads.push({
name: branch.name,
oid: branch.history.edges[0].node.oid,
Expand Down
3 changes: 2 additions & 1 deletion js/fetchFurther.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ async function fetchFurther(commits, allCommits, heads, pageNo, branchNames, all
for (var newCommitId in newlyFetchedCommits) {
var newCommit = newlyFetchedCommits[newCommitId];
var thisCommits = newCommit.history.edges;
for (var thisCommit of thisCommits) {
for (var thisCommitOriginal of thisCommits) {
var thisCommit = JSON.parse(JSON.stringify(thisCommitOriginal));
thisCommit = thisCommit.node;
thisCommit.committedDate = parseDate(thisCommit.committedDate);
allCommits.push(thisCommit);
Expand Down
20 changes: 1 addition & 19 deletions js/loadBranchesButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,7 @@ async function loadBranchesButton() {
var newContent = tempDiv.firstChild;
contentView.innerHTML = "";
contentView.appendChild(newContent);
var token = getLocalToken();
var userName = getLocalUserName();
var url = "https://us-central1-github-tree-graph.cloudfunctions.net/prompt?userName=" + userName;
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
var resp = JSON.parse(xhr.responseText);
var showPrompt = resp.showPrompt;
console.log("showPrompt: " + showPrompt);
if (showPrompt) {
document.getElementById("promptImage").style.display = "inline-block";
document.getElementById("promptImage").addEventListener("click", function () {
window.open("https://scaria.dev/redirection.html", "_blank");
});
}
}
}
xhr.send();

});
return;
}
4 changes: 2 additions & 2 deletions js/showCommits.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ async function showCommits(commits, branchNames, allCommits, heads, pageNo, allB
// Like "1 day ago", "2 weeks ago", "3 months ago"
function relativeTime(date) {
var now = new Date().getTime();
const difference = (now - date.getTime()) / 1000;
const difference = (now - (new Date(date)).getTime()) / 1000;
let output = ``;
if (difference < 10) {
output = `just now`;
Expand All @@ -255,7 +255,7 @@ function relativeTime(date) {
} else if (difference < 2620800) {
output = `${Math.floor(difference / 86400) > 1 ? (Math.floor(difference / 86400) + ' days ago') : 'yesterday'}`;
} else {
output = 'on ' + date.toLocaleDateString();
output = 'on ' + (new Date(date)).toLocaleDateString();
}
return (output);
}
Expand Down
4 changes: 2 additions & 2 deletions js/sortCommits.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ async function sortCommits(branches, heads, allBranches) {
var branchname = branch.name;
var thisCommits = branch.target.history.edges;
for (var thisCommit in thisCommits) {
var commit = thisCommits[thisCommit].node;
var commit = JSON.parse(JSON.stringify(thisCommits[thisCommit].node));
if (commit.oid in commitsObject && commitsObject[commit.oid].branches != null) {
commitsObject[commit.oid].branches.push(branchname);
}
else {
commitsObject[commit.oid] = commit
commit.branches = [branchname];
commit.branches = [branchname]
commit.committedDate = parseDate(commit.committedDate);
}
}
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
{
"matches": [
"*://*.scaria.dev/github-tree-graph/authorize/*"
"*://*.scaria.dev/github-tree-graph/authorize*"
],
"js": [
"js/authProcess.js"
Expand Down Expand Up @@ -67,7 +67,7 @@
"128": "/images/le_git_graph128.png"
},
"background": {
"service_worker": "js/serviceWorker.js"
"scripts": ["js/serviceWorker.js"]
},
"web_accessible_resources": [
{
Expand Down

0 comments on commit 0ab6d69

Please sign in to comment.