BigQuery Platform Modifier

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

当前为 2020-09-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name BigQuery Platform Modifier
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description BigQuery Platform Modifier modifies BigQuery Platform to display panels side by side.
  6. // @author Hubertokf
  7. // @match *://console.cloud.google.com/bigquery*
  8. // @grant none
  9. // @require http://code.jquery.com/jquery-3.4.1.min.js
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. var $ = window.jQuery;
  15.  
  16. function waitForElementToDisplay(selector, time) {
  17. if(document.querySelector(selector)!=null) {
  18. modifyBqPlatform();
  19. return;
  20. }
  21. else {
  22. setTimeout(function() {
  23. waitForElementToDisplay(selector, time);
  24. }, time);
  25. }
  26. }
  27.  
  28. $(document).ready(function () {
  29.  
  30. waitForElementToDisplay('.p6n-panel-container-inner.p6n-panel-offset-parent.p6n-panel-container-horizontal', 2000);
  31.  
  32. });
  33.  
  34. function modifyBqPlatform() {
  35. console.log("BigQuery Platform Modifier: modifying BQ...");
  36.  
  37.  
  38.  
  39. var content = $('.p6n-panel-container-inner.p6n-panel-offset-parent.p6n-panel-container-horizontal');
  40. content.css("flex-direction", "row");
  41.  
  42. content.prepend( '<div class="left-pannel"></div>' );
  43. var leftPanel = $('.left-pannel').css("display", "flex").css("flex-direction", "column").css("width", "860px").css("border-right", "2px solid #999");
  44.  
  45. content.append( '<div class="right-pannel"></div>' );
  46. var rightPanel = $('.right-pannel');
  47.  
  48. $(rightPanel).css("flex-grow", "1");
  49.  
  50. var title = content.find('.p6n-bq-query-editor-title-container')[0];
  51. var editor = content.find('.p6n-vulcan-panel.bq-query-editor-panel.p6n-panel')[0];
  52.  
  53. $(title).appendTo(leftPanel);
  54. $(editor).appendTo(leftPanel);
  55. $(editor).css("height", "100%");
  56.  
  57. var results = content.find('.p6n-vulcan-panel-primary.bq-main-panel.p6n-panel.p6n-panel-center')[0];
  58.  
  59. var toRemove = content.find('.p6n-panel-splitter.p6n-panel-splitter-horizontal.p6n-panel-splitter-resizable')[0];
  60. toRemove.remove();
  61.  
  62. $(results).appendTo(rightPanel);
  63. $(results).css("height", "100%");
  64.  
  65. console.log("BigQuery Platform Modifier: done modifying BQ...");
  66. }
  67. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址