Dear anyone,
Your duolingo forum registration isn't automaticaly transferred to duome forum so in order to join duome forums you need to register with your existing or any other username and email; in any case it's advised that you choose a new password for the forum.
~ Duome Team

My custom extensions, snippets, BBCodes, and other customizations

Ask, and we'll consider your request. Provide an accurate description of what you would like to do/have, and we'll consider implementing it, if this is technically possible.


User avatar
luo-ning

Re: Dark-mode fix 1: full-opacity images

Post by luo-ning »

duome wrote: Wed Apr 06, 2022 1:46 pm

I did.

Gotcha — wasn't able to check properly before as I was on mobile.

duome wrote: Wed Apr 06, 2022 5:28 am

Something in the code is still applying the filters to the body on page reaload, even though I think I replaced every occurence of "page" with "html"

Is this is fixed now then? Everything looks fine as far as I can see 👍

🦀 Pensando en la inmortalidad del cangrejo 🏴‍☠️ Flags Are Not Languages

User avatar
duome

Re: Dark-mode fix 1: full-opacity images

Post by duome »

luo-ning wrote: Wed Apr 06, 2022 2:05 pm

Is this is fixed now then? Everything looks fine as far as I can see 👍

I think it was fixed in v 1.0.3 - it worked like a charm after the update, I didn't have to fix anything to make it work.

User avatar
luo-ning

Re: Dark-mode fix 1: full-opacity images

Post by luo-ning »

Just realized the image opacity fix needs to be changed to this to work along with the other darkmode fix:

Code: Select all

:root.darkmode img:not(:hover) {
	opacity: unset;
}

🦀 Pensando en la inmortalidad del cangrejo 🏴‍☠️ Flags Are Not Languages

User avatar
LICA98
Finland

Re: Calculate "Thanks" ratings on a curve

Post by LICA98 »

luo-ning wrote: Mon Mar 28, 2022 2:42 pm

Calculate "Thanks" ratings on a curve

  • Type: Userscript (proof-of-concept); pull request up on the "Thanks for posts" extension repo
  • Maturity: Proof-of-concept
  • Status: Not installed

Support thread on phpBB

One major problem in how ratings are calculated is that they tend to obey Benford's Law, giving exponentially-skewed distribution.

For example, in a typical forum, there might be just one post with 100 thanks, with a few hovering around the 80-90 mark, and the vast majority having just a few. In this hypothetical forum, almost all posts would have ratings close to zero, implying they're bad (or at least not particularly valuable). If less than 2% of posts gained more than 5 thanks, a post with 5 thanks would already be in the 98th percentile of outstanding posts, yet its rating would show only 5%, due to being ranked against that 100-thank post instead of the vast majority of its peers!

The most accurate way of fixing this problem would be to rate posts by their percentile; however, this would massively complicate the calculation logic and probably impact performance a lot, as every single new post would affect the rating of every single other post.

A much simpler solution would be simply applying an exponential easing function to the current ratings to adjust them. This would counteract the exponential effect from Benford's Law and give a much more even distribution.

To better illustrate the effect, I've written a userscript that rewrites the percentages on the front-end:

Code: Select all

const DECIMAL_PLACES = 2;

// modified from https://easings.net/#easeOutExpo
const easeOutExpo = (num) => {
	return num === 1 ? 1 : 1 - Math.pow(2, -10 * num);
};

for (const $el of document.querySelectorAll('[id^=div_post_reput], .section-app\\/toplist .lastpost')) {
	const oldPct = parseFloat($el.textContent.match(/[\d.]+%/));

if (!Number.isNaN(oldPct)) {
	const newPct = parseFloat((easeOutExpo(oldPct / 100) * 100).toFixed(DECIMAL_PLACES));

	$el.innerHTML = $el.innerHTML.replaceAll(String(oldPct), String(newPct));
}
}

Taking forum.duome.eu as a real-world example, here's the toplist page before (the 5th best post of all time on the forum is only rated ~40%!)

toplist-before.PNG
 
And after (now it's ~94% — much better)

toplist-after.PNG
 
Meanwhile, here's a random sample from a popular topic — before (2.7% for a thank? Pffft, you might as well not even try)

ratings-before.PNG
 
And after (now my thanks seem so much more valuable! 😊)

ratings-after.PNG

btw how are you supposed to use this? I tried downloading it but don't know how to proceed further :?

Post Reply

Return to “Requests new Duome features”