BigQuery Platform Modifier

BigQuery Platform Modifier modifies BigQuery Platform to display panels side by side.

נכון ליום 30-09-2020. ראה הגרסה האחרונה.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         BigQuery Platform Modifier
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  BigQuery Platform Modifier modifies BigQuery Platform to display panels side by side.
// @author       Hubertokf
// @match        *://console.cloud.google.com/bigquery*
// @grant        none
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==

(function() {
    'use strict';
    var $ = window.jQuery;

    function waitForElementToDisplay(selector, time) {
        if(document.querySelector(selector)!=null) {
            modifyBqPlatform();
            return;
        }
        else {
            setTimeout(function() {
                waitForElementToDisplay(selector, time);
            }, time);
        }
    }

    $(document).ready(function () {

        waitForElementToDisplay('.p6n-panel-container-inner.p6n-panel-offset-parent.p6n-panel-container-horizontal', 2000);

    });

    function modifyBqPlatform() {
        console.log("BigQuery Platform Modifier: modifying BQ...");



        var content = $('.p6n-panel-container-inner.p6n-panel-offset-parent.p6n-panel-container-horizontal');
        content.css("flex-direction", "row");

        content.prepend( '<div class="left-pannel"></div>' );
        var leftPanel = $('.left-pannel').css("display", "flex").css("flex-direction", "column").css("width", "860px").css("border-right", "2px solid #999");

        content.append( '<div class="right-pannel"></div>' );
        var rightPanel = $('.right-pannel');

        $(rightPanel).css("flex-grow", "1");

        var title = content.find('.p6n-bq-query-editor-title-container')[0];
        var editor = content.find('.p6n-vulcan-panel.bq-query-editor-panel.p6n-panel')[0];

        $(title).appendTo(leftPanel);
        $(editor).appendTo(leftPanel);
        $(editor).css("height", "100%");

        var results = content.find('.p6n-vulcan-panel-primary.bq-main-panel.p6n-panel.p6n-panel-center')[0];

        var toRemove = content.find('.p6n-panel-splitter.p6n-panel-splitter-horizontal.p6n-panel-splitter-resizable')[0];
        toRemove.remove();

        $(results).appendTo(rightPanel);
        $(results).css("height", "100%");

        console.log("BigQuery Platform Modifier: done modifying BQ...");
    }
})();