Greasy Fork

Letterboxd Short Review Culler

Hides reviews on Letterboxd that are less than a minimum number of characters (with the default being 150)

当前为 2022-01-23 提交的版本,查看 最新版本

// ==UserScript==
// @name 		Letterboxd Short Review Culler
// @version		1.0.1
// @author		@stalkerhumanoid
// @license     MIT
// @description Hides reviews on Letterboxd that are less than a minimum number of characters (with the default being 150)
// @match		*://letterboxd.com/*
// @namespace   https://github.com/stalkerhumanoid
// @run-at		document-idle
// ==/UserScript==

const CHARACTER_MINIMUM = 150;

function cullReviews() {
  console.log('culling...');
  try {
    const reviews =  document.getElementsByClassName('film-detail');
    for (const review of reviews) {
      const reviewBody = review.getElementsByClassName('film-detail-content')[0].getElementsByClassName('body-text')[0].textContent;
      if (reviewBody.length < CHARACTER_MINIMUM) {
        console.log('Removing: ' + reviewBody);
        review.style.display = 'none';
      }
    }
  } catch (error) {
    console.log(error);
  }
  console.log('done');
}

console.log('"Letterboxd Short Review Culler" starting!');
cullReviews();
setTimeout(cullReviews, 1000);