Salesforce Workbench SOQL Query Maximiser

Increases the space available to perform queries with when the screen is wider than 1000px

Version vom 09.04.2024. Aktuellste Version

// ==UserScript==
// @name         Salesforce Workbench SOQL Query Maximiser
// @namespace    http://tampermonkey.net/
// @version      2024-04-08
// @description  Increases the space available to perform queries with when the screen is wider than 1000px
// @author       Wilsoff
// @match        https://workbench.developerforce.com/query.php
// @icon         https://www.google.com/s2/favicons?sz=64&domain=developerforce.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    
    'use strict';

    if (window.innerWidth >= 1000) {

        //Make whole page 100% width
        var main = document.getElementById('mainBlock');
        main.style.setProperty('width', '100%', 'important');

        //Make the field selector bigger
        var elem = document.getElementsByName('QB_field_sel[]');
        elem[0].size = 30;
        elem[0].style.width = '32em';

        //Make the elements on the right align to the left
        var options1 = document.querySelector("#query_form > table > tbody > tr:nth-child(1) > td:nth-child(2) > table:nth-child(1) > tbody > tr");
        options1.style.setProperty('display', 'flex', 'important');

        var options2 = document.getElementById('QB_right_sub_table');
        options2.style.setProperty('display', 'flex', 'important');

        //Add spacing to make it look more like the original:
        var tableDatas = document.getElementsByTagName('td');
        var i = 0;

        for(i=0;i<tableDatas.length;i++){
            if(tableDatas[i].innerHTML.startsWith("Deleted and archived records")) {
                tableDatas[i].style.setProperty('margin-left', '50px', 'important');
                break;
            }
        }

        for(i=0;i<tableDatas.length;i++){
            if(tableDatas[i].innerHTML.startsWith("<br>Max Records")) {
                tableDatas[i].style.setProperty('padding-left', '50px', 'important');
                break;
            }
        }

        document.getElementById('QB_limit_txt').style.setProperty('margin-left', '50px', 'important');

    }

})();