BigQuery Platform Modifier

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

目前為 2020-09-30 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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...");
    }
})();