Browse Source

🐛 Fix init mutation observer sometimes not executing

master
KaKi87 4 months ago
parent
commit
8f0fc20b3f
2 changed files with 7 additions and 4 deletions
  1. +2
    -1
      AlternativeToFreeFreemiumDifferentiator/README.md
  2. +5
    -3
      AlternativeToFreeFreemiumDifferentiator/index.js

+ 2
- 1
AlternativeToFreeFreemiumDifferentiator/README.md View File

@ -22,4 +22,5 @@ Note that it doesn't provide a `Freemium` only filter, as it would be counterpro
## Changelog
* `1.0.0` (2020-11-24) • [Initial release](https://greasyfork.org/fr/scripts/416718-alternativeto-net-free-freemium-differentiator?version=872746)
* `1.0.0` (2020-11-24) • [Initial release](https://greasyfork.org/fr/scripts/416718-alternativeto-net-free-freemium-differentiator?version=872746)
* `1.0.1` (2020-12-13) • [Fix init mutation observer sometimes not executing](https://greasyfork.org/fr/scripts/416718-alternativeto-net-free-freemium-differentiator?version=880142)

+ 5
- 3
AlternativeToFreeFreemiumDifferentiator/index.js View File

@ -3,7 +3,7 @@
// @name AlternativeTo.net free/freemium differentiator
// @description Differenciate free and freemium in alternative apps list
// @grant none
// @version 1.0.0
// @version 1.0.1
// @author KaKi87
// @license GPL-3.0-or-later
// @namespace https://git.kaki87.net/KaKi87/userscripts/src/branch/master/AlternativeToFreeFreemiumdifferentiator
@ -61,7 +61,7 @@ if(document.querySelector('#__next')){
.observe(document.querySelector('.filter-bar'), { childList: true });
}
else {
(new MutationObserver(() => {
const init = () => {
const
freeOrFreemiumLicenseFilter = document.querySelector('[data-filter="free"]').parentElement,
freeLicenseFilter = freeOrFreemiumLicenseFilter.cloneNode(true);
@ -74,7 +74,9 @@ else {
if(isExcludingFreemiumApps)
document.querySelectorAll('.jq_filterbarPanels .main-panel a')
.forEach(el => el.href += '&exclude-freemium-apps');
})).observe(document.querySelector('.jq_filterbarPanels'), { childList: true });
};
init();
(new MutationObserver(init)).observe(document.querySelector('.jq_filterbarPanels'), { childList: true });
const activeLicenseFilter = document.querySelector('.license-filter.has-filter');
if(activeLicenseFilter && activeLicenseFilter.childNodes[0].textContent === 'Free'){


Loading…
Cancel
Save