clarification for theme submissions
This commit is contained in:
BuildTools committed 2024-10-30 18:41:03 -04:00
1 parent 4c0448bd37
commit 6ef9aa6632
5 files changed
+84 -31

No files matched your search

+5 -3
View File
@@ -103,8 +103,9 @@ h2 {margin-top: 20px;font-weight:600}
#theme-sorts {display:flex;align-items:center;background:var(--inputbg);border-radius: 7px;padding:10px 16px;gap:10px;color: #fff;border:none;font-weight: 600;} #theme-sorts {display:flex;align-items:center;background:var(--inputbg);border-radius: 7px;padding:10px 16px;gap:10px;color: #fff;border:none;font-weight: 600;}
#theme-sort-selector {display: none; position: absolute; top: 5px; right: -10px; transform: translateX(100%); z-index: 1000;background: #0e0e0edb;backdrop-filter:blur(3px);border-radius: 7px;padding:5px 0;} #theme-sort-selector {display: none; position: absolute; top: 5px; right: -10px; transform: translateX(100%); z-index: 1000;background: #0e0e0edb;backdrop-filter:blur(3px);border-radius: 7px;padding:5px 0;}
#theme-sort-selector.open {display: block;} #theme-sort-selector.open {display: block;}
#submit-popup {display: none;position: fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background:#0e0e0eed;backdrop-filter:blur(3px)} #submit-popup,#browser-settings-popup {display: none;position: fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background:#0e0e0eed;backdrop-filter:blur(3px)}
#submit-popup.open {display: flex;align-items:center;justify-content: center;} #submit-popup.open,#browser-settings-popup.open {display: flex;align-items:center;justify-content: center;}
#browser-settings-btn {cursor: pointer;color:gray;}
#theme-sorts-container {position: relative;} #theme-sorts-container {position: relative;}
#themes-empty {grid-row: span 6; grid-column: span 4;display: flex;align-items:center;justify-content: center;} #themes-empty {grid-row: span 6; grid-column: span 4;display: flex;align-items:center;justify-content: center;}
.color-line {background:linear-gradient(115deg, rgb(255, 53, 88), rgb(255, 131, 73), rgb(255, 103, 187));width:100%;height:2px;border-radius:10px;} .color-line {background:linear-gradient(115deg, rgb(255, 53, 88), rgb(255, 131, 73), rgb(255, 103, 187));width:100%;height:2px;border-radius:10px;}
@@ -157,7 +158,7 @@ input[type="checkbox"]:checked {background: #8dd28d;}
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
} }
.theme-button-like:hover .theme-button-like-amount { .theme-button-like:hover .theme-button-like-amount, .theme-button-like-amount.showalways {
transform: translateX(-100%); transform: translateX(-100%);
opacity: 1; opacity: 1;
border-top-right-radius: 0px; border-top-right-radius: 0px;
@@ -172,6 +173,7 @@ input[type="checkbox"]:checked {background: #8dd28d;}
#theme-search-container {flex: 1;display:flex;gap:10px;box-sizing: border-box;width: 100%;margin:0;align-items:center;padding-left:10px;color:#818181;} #theme-search-container {flex: 1;display:flex;gap:10px;box-sizing: border-box;width: 100%;margin:0;align-items:center;padding-left:10px;color:#818181;}
#submit-theme-btn, #cancel-theme-btn {flex: 1;} #submit-theme-btn, #cancel-theme-btn {flex: 1;}
#submit-theme-btn-1 {width: 50%;margin-top: 10px;} #submit-theme-btn-1 {width: 50%;margin-top: 10px;}
#reset-optin {min-width:max-content;height:100%;}
::-webkit-scrollbar {width: 8px;} ::-webkit-scrollbar {width: 8px;}
::-webkit-scrollbar-track {background: #161616;} ::-webkit-scrollbar-track {background: #161616;}
+41 -18
View File
@@ -315,18 +315,33 @@
<div class="import-export tab" style="display: none"> <div class="import-export tab" style="display: none">
<div id="submit-popup"> <div id="submit-popup">
<div style="max-width: 75%;"> <div style="max-width: 75%;color:#a7a7a7">
<h3 class="header-small">Submission confirmation</h3> <h3 class="header-small" style="font-size:18px;color:#fff">Submission confirmation</h3>
<div class="color-line"></div> <p style="font-size:12px;margin-top: 10px;font-weight:600;">This is <span style="text-decoration: underline;">not</span> to request a theme. I don't create themes by request.</p>
<p style="margin-top: 10px;color: #a7a7a7">Make sure everything is correct before submitting! You won't be able to edit it later unless you contact me.</p> <p style="margin-top: 10px;">Your submission will include your current thematic settings, such as your card images, dark mode, and font.</p>
<p style="margin-top: 10px;color: #a7a7a7">Your submission will include your current thematic settings, such as your card images, dark mode, and font.</p> <p style="margin-top: 10px;">Make sure your theme follows these guidelines:</p>
<a style="color: #fff;display:block;margin-top:10px;" target="_blank" href="https://diditupe.dev/bettercanvas/questions/?highlight=2">Find theme guidelines here</a> <ul>
<div style="display: flex; gap: 5px;margin-top:10px;"> <li>Appropriate images/title</li>
<li>Does not heavily use components from other themes</li>
<li>Uses a custom dark mode (but not one of the presets from the menu)</li>
<li>Custom images cannot be from Discord or Gmail. These images are not public</li>
</ul>
<div style="display: flex; gap: 5px;margin-top:14px;">
<button id="submit-theme-btn" class="big-button" style="width: 50%;">Submit</button> <button id="submit-theme-btn" class="big-button" style="width: 50%;">Submit</button>
<button id="cancel-theme-btn" class="big-button" style="width: 50%;">Cancel</button> <button id="cancel-theme-btn" class="big-button" style="width: 50%;">Cancel</button>
</div> </div>
</div> </div>
</div> </div>
<div id="browser-settings-popup">
<div style="width: 50%;">
<h3 class="header-small" style="margin-bottom:14px;font-size:18px;">Theme browser settings</h3>
<div style="display:flex;gap:8px;align-items: center;color:#a7a7a7">
<input type="checkbox" id="browser_show_likes">
<span>Always show like count</span>
</div>
<button id="close-settings-btn" class="big-button" style="width: 50%;margin-top:14px;">Close</button>
</div>
</div>
<div class="tab-header"> <div class="tab-header">
<h2 style="margin-top: 0" data-i18n="themes">Themes</h2> <h2 style="margin-top: 0" data-i18n="themes">Themes</h2>
<button class="big-button back-btn" data-i18n="back">Back</button> <button class="big-button back-btn" data-i18n="back">Back</button>
@@ -345,20 +360,25 @@
<h3 class="header-small" style="margin:0">Submit your theme</h3> <h3 class="header-small" style="margin:0">Submit your theme</h3>
<div class="big-button" id="show-submit-form">Show</div> <div class="big-button" id="show-submit-form">Show</div>
</div> </div>
<div id="submit-form" style="display:none;justify-content: space-between;gap: 30px;margin-top:10px;"> <p style="color:#a7a7a7">Do you want to submit your theme for others to use?</p>
<div id="submit-form" style="display:none;justify-content: space-between;gap: 30px;margin-top:20px;">
<div> <div>
<div> <div>
<p style="font-weight:600;">Title</p> <p style="font-weight:600;">Title</p>
<p style="color:#a7a7a7;font-size:12px;margin-top:2px;">Try to keep this short and relevant so people can search for it.</p>
<input type="text" class="card-input" id="submit-title"> <input type="text" class="card-input" id="submit-title">
</div> </div>
<div style="margin-top:5px;"> <div style="margin-top:10px;">
<p style="font-weight:600;">Credits</p> <p style="font-weight:600;">Created by</p>
<p style="color:#a7a7a7;font-size:12px;margin-top:2px;">This can be anything including your name, social media handle, anonymous etc.</p>
<input type="text" class="card-input" id="submit-credits"> <input type="text" class="card-input" id="submit-credits">
</div> </div>
<button id="submit-theme-btn-1" class="big-button">Submit</button> <button id="submit-theme-btn-1" class="big-button">Submit</button>
</div> </div>
<div style="min-width: 25%;"> <div style="min-width: 25%;">
<p style="color:#a7a7a7;font-size:12px;margin-bottom:5px;">Preview</p>
<button id="theme-button-img" class="theme-button customization-button" <button id="theme-button-img" class="theme-button customization-button"
style="width: 100%;height:60px;background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6));"> style="width: 100%;height:60px;background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6));">
<p class="theme-button-title" id="theme-button-title-preview">Title</p> <p class="theme-button-title" id="theme-button-title-preview">Title</p>
@@ -369,7 +389,10 @@
</div> </div>
<div class="option-container"> <div class="option-container">
<div class="theme-header"> <div class="theme-header">
<h3 class="header-small" style="margin:0">User made themes</h3> <div style="display:flex;gap:6px;align-items:center">
<h3 class="header-small" style="margin:0">User made themes</h3>
<svg id="browser-settings-btn" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" class="icon icon-tabler icons-tabler-filled icon-tabler-settings"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z" /></svg>
</div>
<span id="premade-themes-pagenum"></span> <span id="premade-themes-pagenum"></span>
</div> </div>
<div class="theme-controls"> <div class="theme-controls">
@@ -448,7 +471,6 @@
<textarea class="card-input" id="export-output" placeholder="Output"></textarea> <textarea class="card-input" id="export-output" placeholder="Output"></textarea>
</div> </div>
</div> </div>
<p class="sub-text" style="margin-top:10px">Want to submit your theme? <a style="color:inherit" target="_blank" href="https://diditupe.dev/bettercanvas/questions/?highlight=2">Click here</a></p>
</div> </div>
<div class="import-export-details"> <div class="import-export-details">
<div class="import-details option-container"> <div class="import-details option-container">
@@ -460,12 +482,13 @@
</div> </div>
</div> </div>
<div class="option-container"> <div class="option-container">
<div class="theme-header" style="margin-bottom: 0"> <div class="theme-header">
<h3 class="header-small" style="margin:0;flex:100">Theme browser opt-in</h3> <h3 class="header-small" style="margin:0;flex:100">Theme browser opt-in reset</h3>
<div class="sub-option"> </div>
<input type="checkbox" id="new_browser" name="new_browser"> <div style="display:flex;gap:12px;">
</div> <button id="reset-optin" class="customization-button">Reset opt-in status</button>
</div> <p style="color:#a7a7a7">This will bring back the opt-in message so you can select an option.</p>
</div>
</div> </div>
</div> </div>
+1
View File
@@ -89,6 +89,7 @@ chrome.runtime.onInstalled.addListener(function () {
"new_browser": null, "new_browser": null,
"gpa_calc_cumulative": false, "gpa_calc_cumulative": false,
"gpa_calc_weighted": true, "gpa_calc_weighted": true,
"browser_show_likes": false,
} }
}; };
+36 -9
View File
@@ -155,7 +155,7 @@ function setupAutoDarkInput(initial, time) {
el.value = initial.hour + ":" + initial.minute; el.value = initial.hour + ":" + initial.minute;
el.addEventListener('change', function () { el.addEventListener('change', function () {
let timeinput = { "hour": this.value.split(':')[0], "minute": this.value.split(':')[1] }; let timeinput = { "hour": this.value.split(':')[0], "minute": this.value.split(':')[1] };
time === "autodark_start" ? chrome.storage.sync.set({ auto_dark_start: timeinput }) : chrome.storage.sync.set({ auto_dark_end: timeinput }); time === "auto_dark_start" ? chrome.storage.sync.set({ auto_dark_start: timeinput }) : chrome.storage.sync.set({ auto_dark_end: timeinput });
}); });
} }
@@ -184,7 +184,7 @@ function setup() {
const menu = { const menu = {
"switches": syncedSwitches, "switches": syncedSwitches,
"checkboxes": ['gpa_calc_weighted', 'gpa_calc_cumulative', 'new_browser', /*'card_method_date',*/ 'show_updates', 'todo_colors', 'device_dark', 'relative_dues', 'card_overdues', 'todo_overdues', 'gpa_calc_prepend', 'auto_dark', 'assignment_date_format', 'todo_hr24', 'grade_hover', 'hide_completed', 'hover_preview'], "checkboxes": ['browser_show_likes', 'gpa_calc_weighted', 'gpa_calc_cumulative', /*'card_method_date',*/ 'show_updates', 'todo_colors', 'device_dark', 'relative_dues', 'card_overdues', 'todo_overdues', 'gpa_calc_prepend', 'auto_dark', 'assignment_date_format', 'todo_hr24', 'grade_hover', 'hide_completed', 'hover_preview'],
"tabs": { "tabs": {
"advanced-settings": { "setup": displayAdvancedCards, "tab": ".advanced" }, "advanced-settings": { "setup": displayAdvancedCards, "tab": ".advanced" },
"gpa-bounds-btn": { "setup": displayGPABounds, "tab": ".gpa-bounds-container" }, "gpa-bounds-btn": { "setup": displayGPABounds, "tab": ".gpa-bounds-container" },
@@ -541,6 +541,21 @@ function setup() {
}); });
}); });
// browser settings buttons
document.getElementById("browser-settings-btn").addEventListener("click", () => {
document.getElementById("browser-settings-popup").classList.add("open");
});
document.getElementById("close-settings-btn").addEventListener("click", () => {
displayThemeList(0);
document.getElementById("browser-settings-popup").classList.remove("open");
});
document.getElementById("reset-optin").addEventListener("click", () => {
chrome.storage.sync.set({ "new_browser": null });
document.getElementById("opt-in").style.display = "block";
});
} }
async function getExport(storage, options) { async function getExport(storage, options) {
@@ -747,10 +762,19 @@ async function submitTheme() {
async function registerUser() { async function registerUser() {
try { try {
const res = await fetch(`${apiurl}/api/register`); let id;
const data = await res.json();
chrome.storage.sync.set({ "id": data.id }).then(async () => { const sync = await chrome.storage.sync.get("id");
if (sync["id"] && sync["id"] !== "") {
id = sync["id"]
} else {
const res = await fetch(`${apiurl}/api/register`);
const data = await res.json();
id = data.id;
}
chrome.storage.sync.set({ "id": id }).then(async () => {
// test to see if the id was set correctly // test to see if the id was set correctly
// don't know why this is happening ?? // don't know why this is happening ??
const test = await chrome.storage.sync.get("id"); const test = await chrome.storage.sync.get("id");
@@ -758,7 +782,7 @@ async function registerUser() {
// show the new browser // show the new browser
chrome.storage.sync.set({ "new_browser": true }).then(() => { chrome.storage.sync.set({ "new_browser": true }).then(() => {
document.getElementById("opt-in").remove(); document.getElementById("opt-in").style.display = "none";
current_page_num = 1; current_page_num = 1;
displayThemeList(0); displayThemeList(0);
displayAlert(false, "Success! You should be able to see the new themes browser now. Enjoy!"); displayAlert(false, "Success! You should be able to see the new themes browser now. Enjoy!");
@@ -769,6 +793,7 @@ async function registerUser() {
}); });
} catch (e) { } catch (e) {
console.log(e);
displayAlert(true, "There was an error opting in. Please contact ksucpea@gmail.com if this error persists!"); displayAlert(true, "There was an error opting in. Please contact ksucpea@gmail.com if this error persists!");
} }
} }
@@ -817,13 +842,14 @@ function createThemeButton(location, theme) {
return themeBtn; return themeBtn;
} }
function createThemeLikeBtn(location, initial, score) { function createThemeLikeBtn(location, initial, score, show) {
const likeBtn = makeElement("div", "theme-button-like", location); const likeBtn = makeElement("div", "theme-button-like", location);
if (initial === true) { if (initial === true) {
likeBtn.classList.add("theme-liked"); likeBtn.classList.add("theme-liked");
score += 1; score += 1;
} }
makeElement("span", "theme-button-like-amount", likeBtn, shortScore(score)); const amount = makeElement("span", "theme-button-like-amount", likeBtn, shortScore(score));
if (show === true) amount.classList.add("showalways");
likeBtn.innerHTML += `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6.979 3.074a6 6 0 0 1 4.988 1.425l.037 .033l.034 -.03a6 6 0 0 1 4.733 -1.44l.246 .036a6 6 0 0 1 3.364 10.008l-.18 .185l-.048 .041l-7.45 7.379a1 1 0 0 1 -1.313 .082l-.094 -.082l-7.493 -7.422a6 6 0 0 1 3.176 -10.215z" /></svg>`; likeBtn.innerHTML += `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6.979 3.074a6 6 0 0 1 4.988 1.425l.037 .033l.034 -.03a6 6 0 0 1 4.733 -1.44l.246 .036a6 6 0 0 1 3.364 10.008l-.18 .185l-.048 .041l-7.45 7.379a1 1 0 0 1 -1.313 .082l-.094 -.082l-7.493 -7.422a6 6 0 0 1 3.176 -10.215z" /></svg>`;
return likeBtn; return likeBtn;
} }
@@ -950,6 +976,7 @@ async function displayThemeListNew(direction) {
container.textContent = ""; container.textContent = "";
const local = await chrome.storage.local.get("liked_themes"); const local = await chrome.storage.local.get("liked_themes");
const sync = await chrome.storage.sync.get("browser_show_likes");
themes.forEach(theme => { themes.forEach(theme => {
@@ -960,7 +987,7 @@ async function displayThemeListNew(direction) {
}); });
const liked = local["liked_themes"].includes(theme.code); const liked = local["liked_themes"].includes(theme.code);
const likeBtn = createThemeLikeBtn(themeBtn, liked, theme.score); const likeBtn = createThemeLikeBtn(themeBtn, liked, theme.score, sync["browser_show_likes"]);
likeBtn.addEventListener("click" , (e) => likeTheme(likeBtn, theme.code, theme.score)); likeBtn.addEventListener("click" , (e) => likeTheme(likeBtn, theme.code, theme.score));
}); });
+1 -1
View File
@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "Better Canvas", "name": "Better Canvas",
"description": "Feature packed extension for Canvas.", "description": "Feature packed extension for Canvas.",
"version": "5.12.4", "version": "5.12.5",
"icons": { "icons": {
"16": "icon/icon-16.png", "16": "icon/icon-16.png",
"32": "icon/icon-32.png", "32": "icon/icon-32.png",