Skip to content

Commit

Permalink
Merge pull request #366 from Tanza3D/various-fixes
Browse files Browse the repository at this point in the history
Various fixus
  • Loading branch information
Tanza3D authored Nov 20, 2023
2 parents c69bdd5 + 2f584bd commit 6f00afd
Show file tree
Hide file tree
Showing 21 changed files with 145 additions and 128 deletions.
1 change: 1 addition & 0 deletions global/api/comment_system.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public function build(): CommentQuery {
Comments.PostText,
Comments.UserID,
Comments.PostDate,
Comments.Pinned,
Comments.ParentCommenter,
Coalesce(Comments.ParentComment, 0) AS Parent,
Comments.Username, Comments.AvatarURL,
Expand Down
10 changes: 0 additions & 10 deletions global/js/colourpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@ function newColourBar(id, changeCallback, col1 = null, col2 = null) {
function updateUI(changeInputs = false) {
var gradient_1_col_hex = rgbToHex(gradient_1_col[0], gradient_1_col[1], gradient_1_col[2]);
var gradient_2_col_hex = rgbToHex(gradient_2_col[0], gradient_2_col[1], gradient_2_col[2]);
console.log(gradient_1_col_hex);
console.log(gradient_2_col_hex);
bar_left.style.background = gradient_1_col_hex;
bar_right.style.background = gradient_2_col_hex;
if(changeInputs)
{
bar_left_input.value = gradient_1_col_hex;
bar_right_input.value = gradient_2_col_hex;
//picker1.enter();
//picker1.exit();
//picker2.enter();
//picker2.exit();
}
bar_bar.style.background = "linear-gradient(to right, " + gradient_1_col_hex + ", " + gradient_2_col_hex + ")";
}
Expand Down Expand Up @@ -134,7 +128,6 @@ function newColourPicker(id, changeCallback, col1 = null) {

function updateUI(changeInputs = false) {
var col_hex = rgbToHex(col[0], col[1], col[2]);
console.log(col_hex);
element.style.background = col_hex;
if(changeInputs)
{
Expand Down Expand Up @@ -167,7 +160,6 @@ function newColourPicker(id, changeCallback, col1 = null) {
return;
}
col = [r, g, b];
console.log("CP updating with colour " + col);
this.source.value = rgbToHex(r, g, b);
updateUI();
dirty = true;
Expand All @@ -180,7 +172,6 @@ function newColourPicker(id, changeCallback, col1 = null) {
input.addEventListener("change", function () {
var hex = this.value;
var rgb = hexToRgb(hex);
console.log("CP input changing with colour " + rgb);
if (rgb) {
col = [rgb.r, rgb.g, rgb.b];
picker1.exit();
Expand All @@ -194,7 +185,6 @@ function newColourPicker(id, changeCallback, col1 = null) {


if (col1 != null) {
console.log("loading CP with default of " + col1);
col = col1;
input.value = rgbToHex(col[0], col[1], col[2]);
updateUI();
Expand Down
26 changes: 16 additions & 10 deletions global/js/comment_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ var COMMENTS_col_hash = [];
var COMMENTS_boxes = [];
var COMMENTS_mode = 1;
var COMMENTS_type = 1;

var OPARENT = null;
var MEDALID = null;
window.addEventListener('click', function (e) {
if (!document.getElementById('filter__button').contains(e.target)) document.getElementById("filter__list").classList.add("osekai__dropdown-hidden");
});
Expand All @@ -22,6 +23,17 @@ window.addEventListener('DOMContentLoaded', (event) => {
<i class="fas fa-chevron-down" aria-hidden="true"></i>
</div>`;
}

document.getElementById("filter__votes").addEventListener("click", function() {
COMMENTS_mode = 1;
Comments_Sort(OPARENT, MEDALID);
Comments_Out(OPARENT, MEDALID);
})
document.getElementById("filter__date").addEventListener("click", function() {
COMMENTS_mode = 2;
Comments_Sort(OPARENT, MEDALID);
Comments_Out(OPARENT, MEDALID);
})
});

async function Comments_Require(MedalID, oParent, bReload = false, VersionId = -1, ProfileId = -1) {
Expand All @@ -43,17 +55,14 @@ async function Comments_Require(MedalID, oParent, bReload = false, VersionId = -
COMMENTS_boxes[MedalID] = [];
oParent.innerHTML = loader;

console.log("[Locale] loading comments locale");
await loadSource("comments");
console.log("[Locale] loaded comments locale");

var xhr = createXHR(API_URL_COMMENTS);
if (VersionId !== -1) {
xhr.send(REQUIRED_KEY_COMMENTS + "&nVersionId=" + VersionId);
} else if (ProfileId !== -1) {
xhr.send(REQUIRED_KEY_COMMENTS + "&nProfileId=" + ProfileId);
} else {
console.log(MedalID);
xhr.send(REQUIRED_KEY_COMMENTS + "&strMedalID=" + MedalID);
}
xhr.onreadystatechange = function () {
Expand All @@ -62,10 +71,11 @@ async function Comments_Require(MedalID, oParent, bReload = false, VersionId = -
oParent.innerHTML = "";
return;
}
console.log(oResponse);
Object.keys(oResponse).forEach(function (obj) {
if (oResponse[obj] !== null && oResponse[obj].MedalID == MedalID) COMMENTS_col_medals[MedalID].push(oResponse[obj]);
});
MEDALID = MedalID;
OPARENT = oParent;
Comments_Sort(oParent, MedalID);
tippy("[data-tippy-content-comment-date]", {
content: function (reference) {
Expand Down Expand Up @@ -113,7 +123,6 @@ function Comments_Sort(oParent, MedalID, VersionId = -1, ProfileID = -1) {
if (ProfileID !== -1) MedalID = ProfileID;
if (VersionId !== -1) MedalID = VersionId;
if (COMMENTS_col_medals[MedalID] == undefined) return;
console.log(MedalID);
COMMENTS_boxes[MedalID] = [];
COMMENTS_col_hash = [];

Expand All @@ -129,7 +138,6 @@ function Comments_Sort(oParent, MedalID, VersionId = -1, ProfileID = -1) {
}

function generateComment(commentdata) {
console.log(commentdata);
var comment = Object.assign(document.createElement("div"), { className: "comments__comment" });
if (commentdata.Pinned) {
comment.classList.add("comments__comment-pinned");
Expand All @@ -146,7 +154,6 @@ function generateComment(commentdata) {
comment_left_votes.classList.add("comments__comment-votes-voted");
}
comment_left_votes.addEventListener("click", function () {
console.log("clicked :D");
voteComment(commentdata.ID, comment_left_votes);
})
}
Expand Down Expand Up @@ -257,7 +264,6 @@ function generateComment(commentdata) {
}
}
comment_right_infobar_right.appendChild(createInfobarButton("fas fa-ellipsis-h", "small", function () {
console.log("opening dropdown");
eldropdown.classList.remove("osekai__dropdown-hidden");
}));
comment_right_infobar_right.appendChild(eldropdown);
Expand Down Expand Up @@ -401,7 +407,6 @@ function openReply(strCommentId, element) {
function replySend() {
Comments_CloseEmojiPopup();
let oReplyBox = document.getElementById("oReplyBox");
console.log(oReplyBox.previousSibling.outerHTML);
newReply(document.getElementById("reply__input").value, oReplyBox.previousSibling.getAttribute("CommentID"), oReplyBox.previousSibling.getAttribute("CommentCreator"));
document.getElementById("reply__input").value = "";
}
Expand Down Expand Up @@ -479,6 +484,7 @@ function RequireComments() {
}

function Comments_Out(oParent, MedalID) {
oParent.innerHTML = "";
COMMENTS_boxes[MedalID].forEach((oBox) => {
oParent.appendChild(oBox);
});
Expand Down
3 changes: 0 additions & 3 deletions global/js/graphics/particles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ particle=

create : function(x,y,speed,angle)
{
console.log(x,y,speed,angle)
var obj=Object.create(this);
obj.velocity=vector.create(0,0);

obj.velocity.setLength(speed);
obj.velocity.setAngle(angle);
obj.position=vector.create(x,y);
console.log("object")
console.log(obj);
return obj;
},

Expand Down
27 changes: 6 additions & 21 deletions global/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ theme = themes["colourful"];
loadThemes();

function setTheme(stheme) {
console.log("setting theme to " + stheme);
if (typeof stheme == "string") {
for (var i in themes) {
if (themes[i].internal == stheme) {
Expand All @@ -184,8 +183,6 @@ var customTheme = {
if (window.localStorage.getItem('accent_dark') != null) {
customTheme.accent_dark = window.localStorage.getItem('accent_dark').split(",");
customTheme.accent = window.localStorage.getItem('accent').split(",");
console.log(window.localStorage.getItem('accent_dark'));
console.log(customTheme.accent_dark);
}

var accentDark_picker = document.getElementById("custom_colpicker_accent-dark");
Expand All @@ -201,7 +198,6 @@ function generateCustomThemeVars(accent, accentDark, valueOffsetOffset = 0, valu
var accent_split = String(accent).split(",");
var accentDark_hsl = colours.RGBToHSL(accentDark_split[0], accentDark_split[1], accentDark_split[2]);
var accent_hsl = colours.RGBToHSL(accent_split[0], accent_split[1], accent_split[2]);
console.log("$(*(*" + accentDark);
return `--accentdark: ${accentDark} !important;
--accent: ${accent} !important;
Expand Down Expand Up @@ -358,8 +354,6 @@ window.openDialog = function (title, header, message, buttons = [], content = nu

modal_overlay.appendChild(modal_overlay_panel);

console.log("appending...?");

document.body.appendChild(modal_overlay);
setTimeout(function () {
// need this so it plays the animation... UGHHHH
Expand Down Expand Up @@ -457,7 +451,6 @@ if (christmas) {

function defaultSettings() {
if (window.localStorage.getItem('theme') == null) {
console.log("defaulting theme");
setTheme("colourful");
window.localStorage.setItem('theme', "colourful");
}
Expand Down Expand Up @@ -532,7 +525,6 @@ window.addEventListener('click', function (e) {
colItems.classList.add("osekai__dropdown-hidden");
});
}
console.log(e.target.classList);
if (e.target.closest(".osekai__group-dropdown-arrow") == null) {
document.querySelectorAll(".osekai__group-dropdown").forEach((colItems) => {
colItems.classList.add("osekai__group-dropdown-hidden");
Expand Down Expand Up @@ -649,7 +641,6 @@ var alertTypes = {
}

function closeAlert(alert, el) {
console.log("deleting " + alert['Id']);
el.remove();
positionNav();

Expand Down Expand Up @@ -677,7 +668,6 @@ function getAlerts() {
let xhr = createXHR("/api/alerts.php?app=" + nAppId);
xhr.send();
xhr.onload = function () {
console.log(xhr.responseText);
var oResponse = JSON.parse(xhr.responseText);
for (var x = 0; x < oResponse.length; x++) {
let alert = oResponse[x];
Expand Down Expand Up @@ -758,7 +748,6 @@ document.addEventListener("DOMContentLoaded", function () {
if (tab.getAttribute("otab-name") == tabName) {
tab.classList.remove("osekai__otab-hidden");
if (tab.getAttribute("otab-callback")) {
console.log(tab.getAttribute("otab-callback"));
window[tab.getAttribute("otab-callback")]();
}
} else {
Expand All @@ -777,14 +766,16 @@ document.addEventListener("DOMContentLoaded", function () {
last_tab = tabName;
}

for (let oTab of oTabs) {
if (oTab.getAttribute("otab-default") == "") {
switchTab(oTab.getAttribute("otab-name"));
if (getParam(oTabContainer.getAttribute("otab-container")) == null) {
for (let oTab of oTabs) {
if (oTab.getAttribute("otab-default") == "") {
switchTab(oTab.getAttribute("otab-name"));
}
}
}

for (let oTabButton of oTabButtons) {
if(oTabContainer.getAttribute("otab-no-replace") == null) {
if (oTabContainer.getAttribute("otab-no-replace") == null) {
oTabButton.innerHTML = oTabButton.getAttribute("otab-button");
}
oTabButton.addEventListener("click", function () {
Expand Down Expand Up @@ -824,13 +815,11 @@ var groupUtils = {
return array.sort((a, b) => a.Order - b.Order)
},
badgeHtmlFromArray: function (array, size = "small", limit = "none") {
console.log(array);
var orderedList = [];
for (var x = 0; x < array.length; x++) {
orderedList.push(this.getGroupFromId(array[x]));
}
orderedList = this.orderBadgeArray(orderedList);
console.log(orderedList);
var finalHtml = "";
let hiddenGroups = []
let createExtraDropdown = false;
Expand Down Expand Up @@ -938,10 +927,6 @@ if (gl) {
renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
}

console.log(debugInfo);
console.log(vendor);
console.log(renderer);

// !chrome
// no acccel:
// vendor: Google Inc. (Google)
Expand Down
1 change: 0 additions & 1 deletion global/js/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ function CreateNotifications(Notifications, UI) {
}

function CreateNotificationItem(List, Notification) {
console.log("Getting Notifications");
let Outer = document.createElement("div");
Outer.classList.add("osekai__nav-dropdown-v2-notification");

Expand Down
4 changes: 1 addition & 3 deletions global/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function search_initOverlay() {
_appel.classList.remove("active");
}
el.classList.add("active")
search_startSearch();
})
}
search_inner = Object.assign(document.createElement("div"), { "className": "osekai__navbar-search-overlay-inner" });
Expand All @@ -133,7 +134,6 @@ function search_startSearch() {
// timeout here, since apparently search_input.value does not have the brain power to update fast enough for us
setTimeout(function () {
if (search_input.value != "") {
console.log("searching with value " + search_input.value)
if (loaderopened == false) {
loaderopened = true;
search_inner.innerHTML = loader;
Expand All @@ -151,7 +151,6 @@ function search_startSearch() {
}

function search_doSearch() {
console.log("attempting search!");
loaderopened = false;
var search_query = search_input.value;
var data = new FormData();
Expand All @@ -162,7 +161,6 @@ function search_doSearch() {
xhr.open("POST", "/global/api/search.php", true);
xhr.onload = function () {
var response = JSON.parse(xhr.response);
console.log(response);
search_inner.innerHTML = "";
search_inner.appendChild(search_searchResult(response));
}
Expand Down
2 changes: 2 additions & 0 deletions global/lang/en_GB/rankings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"bar.mappers.loved.lovedMaps": "loved maps",
"bar.mappers.subscribers.subscribers": "subscribers",
"bar.badges.badges.badges": "badges",
"bar.mappers.kudosu.kudosu": "kudosu",
"pagination.previous": "prev",
"pagination.next": "next",
"search.username": "Username",
Expand All @@ -73,5 +74,6 @@
"tasks.task.updating": "Running Update",
"tasks.type.default": "Default",
"tasks.type.full": "Full",
"tasks.type.medals": "Medal Recheck",
"tasks.task.usersProcessed": "$1 users processed"
}
2 changes: 1 addition & 1 deletion global/php/osekaiLocalization.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
"name" => "čeština",
"code" => "cs_CZ",
"short" => "cs",
"flag" => "https://assets.ppy.sh/old-flags/CS.png"
"flag" => "https://assets.ppy.sh/old-flags/CZ.png"
]

];
Expand Down
Loading

0 comments on commit 6f00afd

Please sign in to comment.