Skip to content

Instantly share code, notes, and snippets.

@knbknb
Last active August 3, 2025 16:29
Show Gist options
  • Select an option

  • Save knbknb/fe6a6403abf4b9e7c1960dd14d20a69a to your computer and use it in GitHub Desktop.

Select an option

Save knbknb/fe6a6403abf4b9e7c1960dd14d20a69a to your computer and use it in GitHub Desktop.

Revisions

  1. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions run-in-browser-console.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    // this works in the browser console,
    // when the modal dialog is visible
    // after clicking on the "i" button for a frontendusergroup

    function filterTableRows(tableDiv) {
    if (!tableDiv) { console.error(`selector 'div.table-fit' not found!`); return; }
    const table = tableDiv.querySelector('table');
  2. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion run-in-browser-console.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // this works in the browser console,
    // when the modal dialog is visible
    //
    // after clicking on the "i" button for a frontendusergroup
    function filterTableRows(tableDiv) {
    if (!tableDiv) { console.error(`selector 'div.table-fit' not found!`); return; }
    const table = tableDiv.querySelector('table');
  3. knbknb revised this gist Jan 16, 2025. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion run-in-browser-console.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@

    // this works in the browser console,
    // when the modal dialog is visible
    //
    function filterTableRows(tableDiv) {
    if (!tableDiv) { console.error(`selector 'div.table-fit' not found!`); return; }
    const table = tableDiv.querySelector('table');
  4. knbknb revised this gist Jan 16, 2025. 1 changed file with 43 additions and 1 deletion.
    44 changes: 43 additions & 1 deletion run-in-browser-console.js
    Original file line number Diff line number Diff line change
    @@ -1 +1,43 @@
    ‎‎

    function filterTableRows(tableDiv) {
    if (!tableDiv) { console.error(`selector 'div.table-fit' not found!`); return; }
    const table = tableDiv.querySelector('table');
    if (!table) { console.error(`table contains no data`); return; }

    const headers = table.querySelectorAll('thead th');
    let fieldColIndex = -1;
    if (!headers) { console.error(`table contains no headers`); return; }
    headers.forEach((th, index) => {
    if (th.textContent.trim() === 'Field') {
    fieldColIndex = index;
    }
    });
    if (fieldColIndex === -1) { console.error(`table contains no 'Field' column`); return; }

    const rows = table.querySelectorAll('tbody tr');
    rows.forEach(row => {
    const cells = row.querySelectorAll('td');
    if (cells.length > fieldColIndex) {
    const fieldValue = cells[fieldColIndex].textContent.trim();
    if (fieldValue !== 'Groups') {
    row.remove();
    }
    }
    });
    }

    function selectIFrame(sel) {
    // Access the iframe and apply the function
    const iframe = document.querySelector(sel);
    if (iframe) {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    const tableDivs = iframeDocument.querySelectorAll('div.table-fit');

    if (tableDivs && tableDivs.length > 0) {
    filterTableRows(tableDivs[1]);
    }
    }
    }


    selectIFrame('iframe[name="modal_frame"]');
  5. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions run-in-browser-console.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ‎‎
  6. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ function filterTableRows(selector = 'div.table-fit table.table-striped') {
    //const table = tableDiv.querySelector('table.table-striped');
    //if (!table) { console.error(`table contains no data`); return; }

    const headers = table.querySelectorAll('thead th');
    const headers = tableDiv.querySelectorAll('thead th');
    let fieldColIndex = -1;
    if (!headers) { console.error(`table contains no headers`); return; }
    headers.forEach((th, index) => {
  7. knbknb revised this gist Jan 16, 2025. 1 changed file with 3 additions and 3 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    // Define the filterTableRows function
    function filterTableRows(selector = 'div.table-fit') {
    function filterTableRows(selector = 'div.table-fit table.table-striped') {
    const tableDiv = document.querySelector(selector);
    if (!tableDiv) { console.error(`selector '${selector}' not found!`); return; }
    const table = tableDiv.querySelector('table.table-striped');
    if (!table) { console.error(`table contains no data`); return; }
    //const table = tableDiv.querySelector('table.table-striped');
    //if (!table) { console.error(`table contains no data`); return; }

    const headers = table.querySelectorAll('thead th');
    let fieldColIndex = -1;
  8. knbknb revised this gist Jan 16, 2025. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    function filterTableRows(selector = 'div.table-fit') {
    const tableDiv = document.querySelector(selector);
    if (!tableDiv) { console.error(`selector '${selector}' not found!`); return; }
    const table = tableDiv.querySelector('table');
    const table = tableDiv.querySelector('table.table-striped');
    if (!table) { console.error(`table contains no data`); return; }

    const headers = table.querySelectorAll('thead th');
    @@ -33,7 +33,7 @@ function selectIFrame(){
    if (iframe) {
    //iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-striped.table-fit');
    filterTableRows.call(iframeDocument, 'div.table-fit');
    //};
    } else {
    console.error('Iframe not found!');
  9. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ function selectIFrame(){
    if (iframe) {
    //iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-stripedtable-fit');
    filterTableRows.call(iframeDocument, 'div.table-striped.table-fit');
    //};
    } else {
    console.error('Iframe not found!');
  10. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ function selectIFrame(){
    if (iframe) {
    //iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-fit');
    filterTableRows.call(iframeDocument, 'div.table-stripedtable-fit');
    //};
    } else {
    console.error('Iframe not found!');
  11. knbknb revised this gist Jan 16, 2025. No changes.
  12. knbknb revised this gist Jan 16, 2025. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -31,10 +31,10 @@ function selectIFrame(){
    // Access the iframe and apply the function
    const iframe = document.querySelector('iframe[name="modal_frame"]');
    if (iframe) {
    iframe.onload = function() {
    //iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-fit');
    };
    //};
    } else {
    console.error('Iframe not found!');
    }
  13. knbknb revised this gist Jan 16, 2025. 1 changed file with 14 additions and 10 deletions.
    24 changes: 14 additions & 10 deletions typo3-filter-modal-dialogbox-backend-feusergroup-onInfoIconClick.js
    Original file line number Diff line number Diff line change
    @@ -27,13 +27,17 @@ function filterTableRows(selector = 'div.table-fit') {
    });
    }

    // Access the iframe and apply the function
    let iframe = document.querySelector('iframe[name="modal_frame"]');
    if (iframe) {
    iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-fit');
    };
    } else {
    console.error('Iframe not found!');
    }
    function selectIFrame(){
    // Access the iframe and apply the function
    const iframe = document.querySelector('iframe[name="modal_frame"]');
    if (iframe) {
    iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-fit');
    };
    } else {
    console.error('Iframe not found!');
    }
    }

    selectIFrame();
  14. knbknb revised this gist Jan 16, 2025. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ function filterTableRows(selector = 'div.table-fit') {
    }

    // Access the iframe and apply the function
    const iframe = document.querySelector('iframe[name="modal_frame"]');
    let iframe = document.querySelector('iframe[name="modal_frame"]');
    if (iframe) {
    iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
  15. knbknb revised this gist Jan 16, 2025. 1 changed file with 39 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1 +1,39 @@
    ‎‎
    // Define the filterTableRows function
    function filterTableRows(selector = 'div.table-fit') {
    const tableDiv = document.querySelector(selector);
    if (!tableDiv) { console.error(`selector '${selector}' not found!`); return; }
    const table = tableDiv.querySelector('table');
    if (!table) { console.error(`table contains no data`); return; }

    const headers = table.querySelectorAll('thead th');
    let fieldColIndex = -1;
    if (!headers) { console.error(`table contains no headers`); return; }
    headers.forEach((th, index) => {
    if (th.textContent.trim() === 'Field') {
    fieldColIndex = index;
    }
    });
    if (fieldColIndex === -1) { console.error(`table contains no 'Field' column`); return; }

    const rows = table.querySelectorAll('tbody tr');
    rows.forEach(row => {
    const cells = row.querySelectorAll('td');
    if (cells.length > fieldColIndex) {
    const fieldValue = cells[fieldColIndex].textContent.trim();
    if (fieldValue !== 'Groups') {
    row.remove();
    }
    }
    });
    }

    // Access the iframe and apply the function
    const iframe = document.querySelector('iframe[name="modal_frame"]');
    if (iframe) {
    iframe.onload = function() {
    const iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
    filterTableRows.call(iframeDocument, 'div.table-fit');
    };
    } else {
    console.error('Iframe not found!');
    }
  16. knbknb created this gist Jan 16, 2025.
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ‎‎