-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#major
- Loading branch information
Showing
6 changed files
with
446 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
let observer = new MutationObserver(mutationCallback); | ||
|
||
let options = { | ||
attributes: true, | ||
attributeOldValue: true, | ||
attributeFilter: ['class'], | ||
subtree: true | ||
}; | ||
|
||
function mutationCallback(mutations) { | ||
for (let mutation of mutations) { | ||
if (mutation.type === "attributes") { | ||
let target = mutation.target; | ||
|
||
if (target.nodeName === "a") { | ||
if (util.checkUrl(target.href) === true) { | ||
if (target.className.includes("selected")) { | ||
util.setDefaults(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
let observer = new MutationObserver(mutationCallback); | ||
|
||
let options = { | ||
attributes: true, | ||
attributeOldValue: true, | ||
attributeFilter: ['class'], | ||
subtree: true | ||
}; | ||
|
||
function mutationCallback(mutations) { | ||
for (let mutation of mutations) { | ||
if (mutation.type === "attributes") { | ||
let target = mutation.target; | ||
|
||
if (target.nodeName === "a") { | ||
if (util.checkUrl(target.href) === true) { | ||
if (target.className.includes("selected")) { | ||
util.setDefaults(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
observer.observe(document, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,87 @@ | ||
let page = document.getElementById('buttonDiv'); | ||
|
||
let sliderMap = []; | ||
sliderMap.push({ key: "autoExpand", value: "Auto Expand" }); | ||
//sliderMap.push({ key: "autoHideResolved", value: "Auto Hide Resolved" }); | ||
//sliderMap.push({ key: "autoHideCommits", value: "Auto Hide Commits" }); | ||
|
||
function constructSliders() | ||
{ | ||
let body = document.querySelector("body > div.allContainer"); | ||
for (let item of sliderMap) | ||
{ | ||
let container = document.createElement("div"); | ||
container.className = "container"; | ||
let label = document.createElement("label"); | ||
label.setAttribute("for", item.key); | ||
label.innerText = item.value; | ||
|
||
let slider = document.createElement("label"); | ||
slider.id = item.key; | ||
slider.className = "switch"; | ||
|
||
let checkbox = document.createElement("input"); | ||
checkbox.type = "checkbox"; | ||
|
||
let span = document.createElement("span"); | ||
span.className = "slider round"; | ||
|
||
slider.appendChild(checkbox); | ||
slider.appendChild(span); | ||
slider.addEventListener("click", save); | ||
|
||
container.appendChild(label); | ||
container.appendChild(slider); | ||
body.appendChild(container); | ||
getAndAssignValue(item.key); | ||
} | ||
} | ||
|
||
function save() | ||
{ | ||
let saveObject = getSaveObject(); | ||
|
||
chrome.storage.sync.set(saveObject, function () { | ||
console.log("Saved."); | ||
}); | ||
} | ||
|
||
function getSaveObject() | ||
{ | ||
let autoExpandCheckbox = document.querySelector("#autoExpand > input[type='checkbox']"); | ||
let autoHideResolvedCheckbox = document.querySelector("#autoHideResolved > input[type='checkbox']"); | ||
let autoHideCommitsCheckbox = document.querySelector("#autoHideCommits > input[type='checkbox']"); | ||
|
||
let retValue = { | ||
autoExpand: autoExpandCheckbox.checked, | ||
autoHideResolved: autoHideResolvedCheckbox.checked, | ||
autoHideCommits: autoHideCommitsCheckbox.checked | ||
}; | ||
|
||
return retValue; | ||
} | ||
|
||
function getAndAssignValue(key) | ||
{ | ||
console.log("Getting: " + key); | ||
chrome.storage.sync.get(key, function (val) | ||
{ | ||
console.log(val); | ||
let checkbox = document.querySelector("#" + key + " > input[type='checkbox']"); | ||
|
||
switch (key) | ||
{ | ||
case "autoExpand": | ||
checkbox.checked = val.autoExpand; | ||
break; | ||
case "autoHideResolved": | ||
checkbox.checked = val.autoHideResolved; | ||
break; | ||
case "autoHideCommits": | ||
checkbox.checked = val.autoHideCommits; | ||
break; | ||
} | ||
}); | ||
} | ||
|
||
constructSliders(); | ||
let page = document.getElementById('buttonDiv'); | ||
|
||
let sliderMap = []; | ||
sliderMap.push({ key: "autoExpand", value: "Auto Expand" }); | ||
//sliderMap.push({ key: "autoHideResolved", value: "Auto Hide Resolved" }); | ||
//sliderMap.push({ key: "autoHideCommits", value: "Auto Hide Commits" }); | ||
|
||
function constructSliders() | ||
{ | ||
let body = document.querySelector("body > div.allContainer"); | ||
for (let item of sliderMap) | ||
{ | ||
let container = document.createElement("div"); | ||
container.className = "container"; | ||
let label = document.createElement("label"); | ||
label.setAttribute("for", item.key); | ||
label.innerText = item.value; | ||
|
||
let slider = document.createElement("label"); | ||
slider.id = item.key; | ||
slider.className = "switch"; | ||
|
||
let checkbox = document.createElement("input"); | ||
checkbox.type = "checkbox"; | ||
|
||
let span = document.createElement("span"); | ||
span.className = "slider round"; | ||
|
||
slider.appendChild(checkbox); | ||
slider.appendChild(span); | ||
slider.addEventListener("click", save); | ||
|
||
container.appendChild(label); | ||
container.appendChild(slider); | ||
body.appendChild(container); | ||
getAndAssignValue(item.key); | ||
} | ||
} | ||
|
||
function save() | ||
{ | ||
let saveObject = getSaveObject(); | ||
|
||
chrome.storage.sync.set(saveObject, function () { | ||
console.log("Saved."); | ||
}); | ||
} | ||
|
||
function getSaveObject() | ||
{ | ||
let autoExpandCheckbox = document.querySelector("#autoExpand > input[type='checkbox']"); | ||
let autoHideResolvedCheckbox = document.querySelector("#autoHideResolved > input[type='checkbox']"); | ||
let autoHideCommitsCheckbox = document.querySelector("#autoHideCommits > input[type='checkbox']"); | ||
|
||
let retValue = { | ||
autoExpand: autoExpandCheckbox.checked, | ||
autoHideResolved: autoHideResolvedCheckbox.checked, | ||
autoHideCommits: autoHideCommitsCheckbox.checked | ||
}; | ||
|
||
return retValue; | ||
} | ||
|
||
function getAndAssignValue(key) | ||
{ | ||
console.log("Getting: " + key); | ||
chrome.storage.sync.get(key, function (val) | ||
{ | ||
console.log(val); | ||
let checkbox = document.querySelector("#" + key + " > input[type='checkbox']"); | ||
|
||
switch (key) | ||
{ | ||
case "autoExpand": | ||
checkbox.checked = val.autoExpand; | ||
break; | ||
case "autoHideResolved": | ||
checkbox.checked = val.autoHideResolved; | ||
break; | ||
case "autoHideCommits": | ||
checkbox.checked = val.autoHideCommits; | ||
break; | ||
} | ||
}); | ||
} | ||
|
||
constructSliders(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
let expandButton = document.getElementById("expandButton"); | ||
let hideResolvedButton = document.getElementById("hideResolvedButton"); | ||
let showResolvedButton = document.getElementById("showResolvedButton"); | ||
let hideCommitsButton = document.getElementById("hideCommitsButton"); | ||
let showCommitsButton = document.getElementById("showCommitsButton"); | ||
let hideStatusesButton = document.getElementById("hideStatusesButton"); | ||
let showStatusesButton = document.getElementById("showStatusesButton"); | ||
let hideCommentsButton = document.getElementById("hideCommentsButton"); | ||
let showCommentsButton = document.getElementById("showCommentsButton"); | ||
|
||
let refreshButton = document.getElementById('refreshButton'); | ||
|
||
expandButton.onclick = function(element) | ||
{ | ||
util.expandAll(); | ||
}; | ||
|
||
hideResolvedButton.onclick = function(element) | ||
{ | ||
util.hideResolved(); | ||
}; | ||
|
||
showResolvedButton.onclick = function (event) | ||
{ | ||
util.showResolved(); | ||
}; | ||
|
||
hideCommitsButton.onclick = function (event) | ||
{ | ||
util.hideCommits(); | ||
}; | ||
|
||
showCommitsButton.onclick = function (event) | ||
{ | ||
util.showCommits(); | ||
}; | ||
|
||
hideStatusesButton.onclick = function (event) | ||
{ | ||
util.hideStatuses(); | ||
}; | ||
|
||
showStatusesButton.onclick = function (event) | ||
{ | ||
util.showStatuses(); | ||
}; | ||
|
||
hideCommentsButton.onclick = function (event) | ||
{ | ||
util.hideComments(); | ||
}; | ||
|
||
showCommentsButton.onclick = function (event) | ||
{ | ||
util.showComments(); | ||
}; | ||
|
||
refreshButton.onclick = function (event) | ||
{ | ||
refresh(event); | ||
}; | ||
|
||
async function refresh(event) | ||
{ | ||
chrome.tabs.query({ active: true, lastFocusedWindow: true }, tabs => { | ||
let url = tabs[0].url; | ||
util.autoApplyItems(url); | ||
}); | ||
|
||
event.target.className += " spin"; | ||
await sleep(500); | ||
chrome.extension.getBackgroundPage().window.location.reload(); | ||
window.location.reload(); | ||
} | ||
|
||
let expandButton = document.getElementById("expandButton"); | ||
let hideResolvedButton = document.getElementById("hideResolvedButton"); | ||
let showResolvedButton = document.getElementById("showResolvedButton"); | ||
let hideCommitsButton = document.getElementById("hideCommitsButton"); | ||
let showCommitsButton = document.getElementById("showCommitsButton"); | ||
let hideStatusesButton = document.getElementById("hideStatusesButton"); | ||
let showStatusesButton = document.getElementById("showStatusesButton"); | ||
let hideCommentsButton = document.getElementById("hideCommentsButton"); | ||
let showCommentsButton = document.getElementById("showCommentsButton"); | ||
|
||
let refreshButton = document.getElementById('refreshButton'); | ||
|
||
expandButton.onclick = function(element) | ||
{ | ||
util.expandAll(); | ||
}; | ||
|
||
hideResolvedButton.onclick = function(element) | ||
{ | ||
util.hideResolved(); | ||
}; | ||
|
||
showResolvedButton.onclick = function (event) | ||
{ | ||
util.showResolved(); | ||
}; | ||
|
||
hideCommitsButton.onclick = function (event) | ||
{ | ||
util.hideCommits(); | ||
}; | ||
|
||
showCommitsButton.onclick = function (event) | ||
{ | ||
util.showCommits(); | ||
}; | ||
|
||
hideStatusesButton.onclick = function (event) | ||
{ | ||
util.hideStatuses(); | ||
}; | ||
|
||
showStatusesButton.onclick = function (event) | ||
{ | ||
util.showStatuses(); | ||
}; | ||
|
||
hideCommentsButton.onclick = function (event) | ||
{ | ||
util.hideComments(); | ||
}; | ||
|
||
showCommentsButton.onclick = function (event) | ||
{ | ||
util.showComments(); | ||
}; | ||
|
||
refreshButton.onclick = function (event) | ||
{ | ||
refresh(event); | ||
}; | ||
|
||
async function refresh(event) | ||
{ | ||
chrome.tabs.query({ active: true, lastFocusedWindow: true }, tabs => { | ||
let url = tabs[0].url; | ||
util.autoApplyItems(url); | ||
}); | ||
|
||
event.target.className += " spin"; | ||
await sleep(500); | ||
chrome.extension.getBackgroundPage().window.location.reload(); | ||
window.location.reload(); | ||
} | ||
|
||
document.onload |
Oops, something went wrong.