Pitchfork Score Reveal

    @@ -1,3 +1,11 @@ +/* + * @title Pitchfork Score Reveal + * @description サブスクで隠されている Pitchfork のスコアを表示する + * @include https://pitchfork.com/reviews/albums/* + * @license MIT License + * @require + */ + // ==UserScript== // @name Pitchfork Score Reveal // @namespace https://github.com/dlwr/pitchfork-score
  • /*
     * @title Pitchfork Score Reveal
     * @description サブスクで隠されている Pitchfork のスコアを表示する
     * @include https://pitchfork.com/reviews/albums/*
     * @license MIT License
     * @require 
     */
    
    // ==UserScript==
    // @name         Pitchfork Score Reveal
    // @namespace    https://github.com/dlwr/pitchfork-score
    // @version      1.0.0
    // @description  サブスクで隠されている Pitchfork のスコアを表示する
    // @match        https://pitchfork.com/reviews/albums/*
    // @run-at       document-end
    // @grant        none
    // ==/UserScript==
    
    (() => {
      const reveal = () => {
        const s =
          window.__PRELOADED_STATE__?.transformed?.review?.headerProps?.musicRating
            ?.score;
        if (s === undefined || s === null || s === "") {
          alert("Pitchfork のレビューページじゃないか、データ構造が変わってるじゃん");
          return;
        }
        const p = document.querySelector(
          '[class*="SplitScreenContentHeaderScoreBox"] p',
        );
        if (!p) {
          alert(
            "スコア: " + s + "(DOM に挿入できんかった。セレクタを更新する必要あり)",
          );
          return;
        }
        p.textContent = String(s);
        let el = p;
        while (el) {
          const f = getComputedStyle(el).filter;
          if (f && f.includes("blur")) {
            el.style.filter = "none";
          }
          el = el.parentElement;
        }
      };
    
      if (document.readyState === "loading") {
        document.addEventListener("DOMContentLoaded", reveal);
      } else {
        reveal();
      }
    })();
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。