`;
}else{
let taskId = taskMetadata;
content.style.width = "400px";
content.style.fontSize = "15px";
content.innerHTML = `
Your account ID is ${taskId}.
`;
checkUpdates(latestVersion => {
chrome.storage.local.get(["currentVersion"], v => {
chrome.storage.local.get(["configDeveloperMode"], dm => {
let developerMode = dm.configDeveloperMode;
let currentVersion = v.currentVersion;
if(currentVersion != latestVersion || developerMode == true){
let updateButton = document.createElement("BUTTON");
updateButton.innerHTML = "Update";
updateButton.classList.add("btns");
updateButton.onclick = evt => {
fetchUpdate(done => {
chrome.storage.local.set({currentVersion: latestVersion, disabled: false}, a => {
updateButton.style.display = "none";
console.log("UPDATE COMPLETE");
});
});
};
content.appendChild(updateButton);
}
});
});
});
let optionSettings = [{
name: "Hide / Blur finished tasks automatically",
systemName: "HideTasks",
type: "toggle",
hint: "In the dashboard, finished tasks will be automatically hidden",
},
{
name: "Make blur tasks default",
systemName: "BlurTasks",
type: "toggle",
hint: "In the dashboard, finished tasks will be automatically blured if hidden",
},
{
name: "Hide notes automatically",
systemName: "HideNotes",
type: "toggle",
hint: "Hides notes by default.",
},
{
name: "Fun mode",
systemName: "FunMode",
type: "toggle",
hint: "Sprinkly some memes here and there...",
},
{
name: "Developer mode",
systemName: "DeveloperMode",
type: "toggle",
hint: "Allows for complex developing. Don't use if you aren't a developer",
},
];
optionSettings.forEach(set => {
let toggle = document.createElement("DIV");
toggle.classList.add("switchContainer");
toggle.innerHTML = `
${set.name}
`;
chrome.storage.local.get([`config${set.systemName}`], v => {
let value = v[`config${set.systemName}`];
if(value === true){
toggle.children[0].children[0].checked = "checked";
}
});
console.log(toggle.children);
toggle.children[0].onchange = evt => {
console.log(evt.target.checked);
let obj = {};
obj[`config${set.systemName}`] = evt.target.checked;
chrome.storage.local.set(obj, done => {
console.log(set.systemName);
});
}
content.appendChild(toggle);
});
let themeSelect = document.createElement("SELECT");
content.appendChild(themeSelect);
chrome.storage.local.get(["theme"], res => {
let theme = res.theme;
let options = {
default: "Default",
darkthemePlain: "Plain darktheme",
darkthemeColor: "Color darktheme",
modernTheme: "Modern theme",
rainbowTheme: "Rainbow theme",
};
if(theme == null) theme = "default";
Object.keys(options).forEach(option => {
optionName = options[option];
let optionHtml = document.createElement("OPTION");
optionHtml.innerHTML = optionName;
optionHtml.value = option;
if(option == theme){
optionHtml.selected = "selected";
}
themeSelect.appendChild(optionHtml);
});
});
themeSelect.onchange = () => {
let newValue = themeSelect.value;
chrome.storage.local.set({theme: newValue}, res => {
});
};
let configButton = document.createElement("BUTTON");
configButton.innerHTML = "Addons";
configButton.classList.add("btns");
configButton.style.display = "block";
configButton.style.marginTop = "25px";
configButton.onclick = () => {
chrome.runtime.openOptionsPage(() => {});
};
// content.appendChild(configButton);
}
//retrieve the cookie that would be the "metadata task" cookie WRONG FAKE NEWS
//if it exists, then display it, change it, or merge it with another metadata task id
//if it doesn't then give an option to make one. This is also aveilable just be going on managebac
});
let style = document.createElement("style");
style.innerHTML = `
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
.switchText{
line-height: 34px;
margin-left: 15px;
font-size: 18px;
display: inline-block;
transform: translateY(7px);
}
.switchContainer{
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
.btns{
padding: 10px;
border-radius: 5px;
color: white;
font-size: 19px;
background-color: green;
border: none;
width: auto;
height: auto;
cursor: pointer;
margin-top: 15px;
}
select{
display: block;
padding: 10px;
border-radius: 5px;
color: white;
font-size: 19px;
background-color: green;
border: none;
width: auto;
height: auto;
cursor: pointer;
margin-top: 15px;
}
`;
document.head.append(style);