Welcome to the ICM Forum. If you have an account but have trouble logging in, or have other questions, see THIS THREAD.
NOTE: Board emails should be working again. Information on forum upgrade and style issues.
Podcast: Talking Images (Episode 22 released November 17th * EXCLUSIVE * We Are Mentioned in a Book!!! Interview with Mary Guillermin on Rapture, JG & More)
Polls: TV-series (Results), Directors (Jan 2nd), 1980 (Jan 24th), <50 checks (Jan 31st)
Challenges: 1000<400, Sci-Fi/Fantasy, Central American/Andean
Film of the Week: Samâ taimu mashin burûsu, February nominations (Jan 29th)

iCheckMovies Enhanced

Post Reply
User avatar
Onderhond
Posts: 5752
Joined: December 23rd, 2012, 7:00 am
Contact:

#241

Post by Onderhond »

Okay, so not sure what's in the official ICM Enhanced script or if it still being maintained, but I wanted to tamper a bit more with TamperMonkey and wrote myself something extra that gives me additional personalized stats on the list pages. Stuff that often comes up in the forum lists and that gives a quick, broader overview of how I relate to a certain list.

So now I have this:
Image

Here's the script, for people who want it. Also if this is not part of the ICM Enhanced script yet and someone wants to add it, by all means do so! Code isn't very clean, but should be functional and tested against at least some edge cases.

Code: Select all

// ==UserScript==
// @name         ICM enhancements
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://*.icheckmovies.com/lists/*
// @grant        none
// ==/UserScript==
let filmList = document.getElementById('itemListMovies');
let filmListItems = filmList.querySelectorAll('.listItem');
let filmListTotal = filmListItems.length;
let checkedTotal = filmList.querySelectorAll('.listItem.checked').length;

// extra list info
let uncheckedCount = filmList.querySelectorAll('.listItem.unchecked').length;
let highestUnchecked = '';
let highestUncheckedRank = '';
if (uncheckedCount > 0) {
    highestUnchecked = filmList.querySelector('.listItem.unchecked h2 a').innerHTML;
    highestUncheckedRank = '#' + filmList.querySelector('.listItem.unchecked .rank').childNodes[0].nodeValue.trim();
} else {
    highestUnchecked = 'All checked!';
    highestUncheckedRank = 'n/a';
}
let favoriteCount = filmList.querySelectorAll('.listItem.favorite').length;
let highestFavorite = '';
let highestFavoriteRank = '';
if (favoriteCount > 0) {
    highestFavorite = filmList.querySelector('.listItem.favorite h2 a').innerHTML;
    highestFavoriteRank = '#' + filmList.querySelector('.listItem.favorite .rank').childNodes[0].nodeValue.trim();
} else {
    highestFavorite = 'None found';
    highestFavoriteRank = 'n/a';
}
let hateCount = filmList.querySelectorAll('.listItem.hated').length;
let highestHate = '';
let highestHateRank = '';
if (hateCount > 0) {
    highestHate = filmList.querySelector('.listItem.hated h2 a').innerHTML;
    highestHateRank = '#' + filmList.querySelector('.listItem.hated .rank').childNodes[0].nodeValue.trim();
} else {
    highestHate = 'None found';
    highestHateRank = 'n/a';
}

let unofficialCount = 0;
let isOfficial = (document.getElementById('topList').querySelector('h4.compact').innerHTML.trim().includes('An official iCheckMovies list')) ? true : false;
let officialLabel = (isOfficial) ? 'Unique officials' : 'Unofficial films';
for (let k=0; k < filmListItems.length; ++k) {
    let info = filmListItems[k].querySelector('.info');
    let officialListCounter = info.querySelectorAll('a')[1];

    if (isOfficial && officialListCounter !== undefined) {
        if (officialListCounter.innerHTML.charAt(0) == '1' && officialListCounter.innerHTML.charAt(1) == ' ') {
            unofficialCount += 1;
        }
    } else {
        if (officialListCounter.innerHTML.charAt(0) == '0') {
            unofficialCount += 1;
        }
    }
}


let extraInfo = '<div class="ohExtraInfo">';
extraInfo += '<div class="spec"><div class="label">Highest unchecked</div><div class="value">' + highestUnchecked + ' (' + highestUncheckedRank + ')</div></div>';
extraInfo += '<div class="spec"><div class="label">Number of favorites</div><div class="value">' + favoriteCount + '/' + checkedTotal + ' (' + Math.round((favoriteCount/checkedTotal)*100) + '%)</div></div>';
extraInfo += '<div class="spec"><div class="label">Highest favorite</div><div class="value">' + highestFavorite + ' (' + highestFavoriteRank + ')</div></div>';
extraInfo += '<div class="spec"><div class="label">Number of dislikes</div><div class="value">' + hateCount + '/' + checkedTotal + ' (' + Math.round((hateCount/checkedTotal)*100) + '%)</div></div>';
extraInfo += '<div class="spec"><div class="label">Highest dislike</div><div class="value">' + highestHate + ' (' + highestHateRank + ')</div></div>';
extraInfo += '<div class="spec"><div class="label">' + officialLabel + '</div><div class="value">' + unofficialCount + '/' + filmListTotal + ' (' + Math.round((unofficialCount/filmListTotal)*100) + '%)</div></div>';
extraInfo += '</div>';
extraInfo += '<style>.ohExtraInfo {margin-bottom:20px;} .spec {display:flex; margin:4px 0;}.spec .label {font-weight:700; flex-basis:160px;}';
let printExtraLocation = document.getElementById('itemContainer');
printExtraLocation.insertAdjacentHTML('beforebegin', extraInfo);
User avatar
xianjiro
Donator
Posts: 8713
Joined: June 17th, 2015, 6:00 am
Location: Kakistani Left Coast
Contact:

#242

Post by xianjiro »

nice! :thumbsup: :cheers:
User avatar
mightysparks
Site Admin
Posts: 31256
Joined: May 5th, 2011, 6:00 am
Location: Perth, WA, Australia
Contact:

#243

Post by mightysparks »

Onderhond, I noticed it doesn't work on this list: https://www.icheckmovies.com/lists/thri ... flavo5000/

Idk if it's clashing with another script or some other issue but it's worked fine on all other lists so far.
"I do not always know what I want, but I do know what I don't want." - Stanley Kubrick

iCM | IMDb | LastFM | TSZDT

Image
User avatar
Onderhond
Posts: 5752
Joined: December 23rd, 2012, 7:00 am
Contact:

#244

Post by Onderhond »

mightysparks wrote: April 22nd, 2020, 2:44 am Onderhond, I noticed it doesn't work on this list: https://www.icheckmovies.com/lists/thri ... flavo5000/

Idk if it's clashing with another script or some other issue but it's worked fine on all other lists so far.
Hmmm, it works for me, but could be some edge case I haven't covered yet related to your personal checks/likes. Anything special about your stats of that list (no favorites, none/all checked, ...) Stuff like that? :)

Weird list btw, 80-90% of that seems to be TV series? :)
User avatar
mightysparks
Site Admin
Posts: 31256
Joined: May 5th, 2011, 6:00 am
Location: Perth, WA, Australia
Contact:

#245

Post by mightysparks »

Onderhond wrote: April 22nd, 2020, 5:41 am
mightysparks wrote: April 22nd, 2020, 2:44 am Onderhond, I noticed it doesn't work on this list: https://www.icheckmovies.com/lists/thri ... flavo5000/

Idk if it's clashing with another script or some other issue but it's worked fine on all other lists so far.
Hmmm, it works for me, but could be some edge case I haven't covered yet related to your personal checks/likes. Anything special about your stats of that list (no favorites, none/all checked, ...) Stuff like that? :)

Weird list btw, 80-90% of that seems to be TV series? :)
It's working now :/ I refreshed it and reopened it a couple times before and it didn't load, but now it's fine :shrug: But nothing special about this list. It was working ok on lists with 0 of everything etc.
"I do not always know what I want, but I do know what I don't want." - Stanley Kubrick

iCM | IMDb | LastFM | TSZDT

Image
User avatar
Onderhond
Posts: 5752
Joined: December 23rd, 2012, 7:00 am
Contact:

#246

Post by Onderhond »

Might be some conflict with other scripts then. Not sure what browser you're using, but if you press F12 on the page where it fails a technical inspector window should pop up. There is a tab "console" where the errors will be logged :)
User avatar
Fergenaprido
Donator
Posts: 4895
Joined: June 3rd, 2014, 6:00 am
Location: Canada
Contact:

#247

Post by Fergenaprido »

Onderhond wrote: April 21st, 2020, 1:53 pm Okay, so not sure what's in the official ICM Enhanced script or if it still being maintained, but I wanted to tamper a bit more with TamperMonkey and wrote myself something extra that gives me additional personalized stats on the list pages. Stuff that often comes up in the forum lists and that gives a quick, broader overview of how I relate to a certain list.


Here's the script, for people who want it. Also if this is not part of the ICM Enhanced script yet and someone wants to add it, by all means do so! Code isn't very clean, but should be functional and tested against at least some edge cases.
This is really cool. Thanks for putting this together Onderhond. :)
Post Reply