All tables sortable

Make all tables on any page sortable by converting them to dataTables

< Feedback on All tables sortable

Review: चांगली - स्क्रिप्ट चालते

Very useful. Thank you!

additional button for only converting table containing selected text: ( the modified full script that also works with CORS here )

function ConvertTableFromSelection() {
    const selection = window.getSelection();
    let node;
    if (selection?.anchorNode?.nodeType === 1) {
        node = selection?.anchorNode;
    } else {
        node = selection?.anchorNode?.parentElement;
    }

    const table = node?.closest("table");
    if (table) {
        addDatatablesCSS();
        try {
            ConvertTable_ToDataTable(table);
        } catch (e) {
            console.error("[All tables sortable] selected table error:", e, table);
        }
    } else {
        alert("No table found near selected text.");
    }
}

GM_registerMenuCommand("Convert table containing selected text", () => {
    ConvertTableFromSelection();
});

You can use my changes freely if you want to.

उत्तर पोस्ट करा

उत्तर पोस्ट करण्यासाठी साइन इन करा.