RezaKJoi's profile

666 Messages

 • 

8.9K Points

Sunday, February 22nd, 2026

No Status

0

Fast Text Correction and Sorting for Polls

In post Sheet file for creating a poll, the changes were not applied quickly. However, I have now found a much faster method and wanted to share it with you. I’ll keep this explanation short and to the point. I hope you read it and let me know your thoughts.

A — Text Correction

  1. Open the edit page of the desired list in Google Chrome (it must be in Edit mode).

  2. Use the following shortcuts to open the console:

    • Windows: Ctrl + Shift + J

    • Mac: ⌥ Option + ⌘ Command + J

  3. Paste the code below into the console and press Enter. That’s it.

// ==UserScript==

// @name         IMDb Notes Hidden Space Fixer (Leading & Trailing)

// @namespace    http://tampermonkey.net/

// @version      1.7

// @description  Remove leading/trailing spaces and non-Western chars from notes + replace non-standard dashes + final report

// @match        https://www.imdb.com/list/*/edit/*

// @grant        none

// ==/UserScript==

 

(function () {

    'use strict';

 

    const noteSelector = 'div.ipc-html-content-inner-div[role="presentation"]';

    const notes = document.querySelectorAll(noteSelector);

    const issues = [];

 

    if (notes.length === 0) {

        console.log("%cNo notes found!", "color:#888;font-weight:bold;");

        return;

    }

 

    console.log(`%cStarting to process ${notes.length} notes...`, "color:#0066cc;font-weight:bold;");

 

    let index = 0;

 

    function processNextNote() {

        if (index >= notes.length) {

            // Final report

            console.log("%c┌───────────────────────────────────────────────┐", "color:#444");

            console.log("%c│              Final Fix Report                 │", "color:#444;font-weight:bold;");

            console.log("%c└───────────────────────────────────────────────┘", "color:#444");

 

            if (issues.length === 0) {

                console.log("%c All notes were clean!", "color:#28a745;font-size:1.1em;font-weight:bold;");

            } else {

                issues.forEach((item, i) => {

                    console.log(`%c${(i+1).toString().padStart(2,'0')}) Fixed note #${item.index}`, "color:#dc3545;font-weight:bold;");

                    console.log(`%c   Original: "${item.original}"`, "color:#dc3545;");

                    console.log(`%c   Fixed:    "${item.fixed}"`, "color:#28a745;font-weight:bold;");

                    console.log("─".repeat(50));

                });

                console.log(`%c${issues.length} notes fixed`, "color:#dc3545;font-weight:bold;");

            }

 

            console.log("%cAll notes processed ", "color:#28a745;font-weight:bold;");

            return;

        }

 

        const note = notes[index];

        const currentIndex = ++index;

 

        // Simulate click to make editable

        note.click();

 

        setTimeout(() => {

            let originalText = note.innerText || '';

 

            // Replace non-standard dashes with standard hyphen '-'

            let text = originalText.replace(/[\u2010-\u2015]/g, '-');

 

            // Check for leading/trailing spaces

            const hasLeadingSpace = text.length > 0 && text[0] === ' ';

            const hasTrailingSpace = text.length > 0 && text[text.length - 1] === ' ';

 

            // Normalize to Western chars only + allow more standard punctuation like :, ;, /

            const normalized = text.replace(/[^A-Za-z0-9 .,!?'"():;\-\/\u00C0-\u00FF]/g, '');

 

            const hasNonStandardDash = text !== originalText;

            const needsFix = hasLeadingSpace || hasTrailingSpace || normalized !== text || hasNonStandardDash;

 

            if (needsFix) {

                const fixed = normalized.trim();

 

                note.innerText = fixed;

 

                issues.push({

                    index: currentIndex,

                    original: originalText,

                    fixed: fixed

                });

 

                note.style.backgroundColor = 'rgba(255, 0, 0, 0.3)';

                note.title = ' Problematic note fixed';

            }

 

            // Click again to close

            note.click();

 

            setTimeout(processNextNote, 200);

        }, 200);

    }

 

    processNextNote();

})();

In the image below, you can see the four issues: non‑standard symbols, leading spaces, trailing spaces, and non‑Western characters.

B — Sort by Year

Follow the steps in section A, but enter the code below to sort the titles by year.

(() => {

  // گرفتن همه آیتم‌ها

  const items = [...document.querySelectorAll('div[data-rbd-draggable-id]')];

 

  // آرایه شامل عنوان، سال و شماره فعلی در صفحه

  const list = items.map((el, idx) => {

    const titleEl = el.querySelector('h3.ipc-title__text');

    const yearEl = el.querySelector('div[data-testid="eli-metadata"] span');

    const title = titleEl ? titleEl.textContent.trim() : "Unknown Title";

    const year = yearEl ? parseInt(yearEl.textContent.trim()) : 9999;

    return { currentIndex: idx + 1, title, year };

  });

 

  // مرتب‌سازی از قدیمی به جدید

  const sorted = [...list].sort((a, b) => a.year - b.year);

 

  // اضافه کردن شماره پیشنهادی بر اساس مرتب‌سازی

  sorted.forEach((item, idx) => {

    item.suggestedIndex = idx + 1;

  });

 

  console.log("🎬 Sorted list with suggested positions:");

  console.table(sorted.map(item => ({

    "Current #": item.currentIndex,

    "Title": item.title,

    "Year": item.year,

    "Suggested #": item.suggestedIndex

  })));

 

  return sorted;

})();

C — Sort Titles Alphabetically

Follow the steps in section A, but enter the code below to sort the titles alphabetically.

(() => {

  const items = [...document.querySelectorAll('div[data-rbd-draggable-id]')];

 

  const list = items.map((el, idx) => {

    const titleEl = el.querySelector('h3.ipc-title__text');

    const yearEl = el.querySelector('div[data-testid="eli-metadata"] span');

    let title = titleEl ? titleEl.textContent.trim() : "Unknown Title";

 

    // حذف شماره ابتدای تیتر (مثلاً "1. ")

    title = title.replace(/^\d+\.\s*/, '');

 

    const year = yearEl ? parseInt(yearEl.textContent.trim()) : 9999;

 

    return { currentIndex: idx + 1, title, year };

  });

 

  // مرتب‌سازی بر اساس عنوان A-Z

  const sorted = [...list].sort((a, b) => a.title.localeCompare(b.title));

 

  // اضافه کردن شماره پیشنهادی

  sorted.forEach((item, idx) => item.suggestedIndex = idx + 1);

 

  console.log("🎬 Sorted list alphabetically (number removed) with suggested positions:");

  console.table(sorted.map(item => ({

    "Current #": item.currentIndex,

    "Title": item.title,

    "Year": item.year,

    "Suggested #": item.suggestedIndex

  })));

 

  return sorted;

})();

D — Sort Notes Alphabetically

Follow the steps in section A, but enter the code below to sort the notes alphabetically.

(() => {

  // گرفتن همه آیتم‌های فیلم و افراد

  const filmItems = [...document.querySelectorAll('div[data-rbd-draggable-id]')];

 

  const list = filmItems.map((el, idx) => {

    // عنوان فیلم یا اسم فرد

    const titleEl = el.querySelector('h3.ipc-title__text') || el.querySelector('span.some-person-selector'); // اگر افراد selector متفاوت داشت باید جایگزین شود

    const noteEl = el.querySelector('div[data-testid="editable-trigger"] .ipc-html-content-inner-div');

   

    let title = titleEl ? titleEl.textContent.trim() : "Unknown";

    let note = noteEl ? noteEl.textContent.trim() : "";

 

    // حذف شماره ابتدای عنوان فیلم

    title = title.replace(/^\d+\.\s*/, '');

 

    // تشخیص نوع

    const type = el.querySelector('h3.ipc-title__text') ? "Film" : "Person";

 

    return { currentIndex: idx + 1, type, title, note };

  });

 

  // مرتب‌سازی بر اساس متن نوت A→Z

  const sorted = [...list].sort((a, b) => a.note.localeCompare(b.note));

 

  // اضافه کردن ستون Suggested # بر اساس ترتیب حروف الفبا

  sorted.forEach((item, idx) => item.suggestedIndex = idx + 1);

 

  console.log("📝 Sorted Notes alphabetically with Suggested #:");

  console.table(sorted.map(item => ({

    "Current #": item.currentIndex,

    "Type": item.type,

    "Title/Name": item.title,

    "Note": item.note,

    "Suggested #": item.suggestedIndex

  })));

 

  return sorted;

})();

If you still notice any non‑standard characters in the texts (although I tried to cover everything), please let me know.

I can also write a script that, once you open the page, immediately gives you a CSV file. That way, you might be able to apply your edits much faster using BonaFideBOSS’s method. IMDb List Bulk Uploader - A Tool To Add Hundreds of Titles Into IMDb List in One Go

Oldest First
Selected Oldest First
No Responses!