BigQuery Platform Modifier

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

当前为 2020-10-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name BigQuery Platform Modifier
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  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. // @require https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var $ = window.jQuery;
  16.  
  17. function waitForElementToDisplay(selector, time) {
  18. if(document.querySelector(selector)!=null) {
  19. modifyBqPlatform();
  20. return;
  21. }
  22. else {
  23. setTimeout(function() {
  24. waitForElementToDisplay(selector, time);
  25. }, time);
  26. }
  27. }
  28.  
  29. $(document).ready(function () {
  30. $("head").append ('<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" rel="stylesheet" type="text/css">');
  31.  
  32. waitForElementToDisplay('.p6n-panel-container-inner.p6n-panel-offset-parent.p6n-panel-container-horizontal', 2000);
  33.  
  34. });
  35.  
  36. function modifyBqPlatform() {
  37. console.log("BigQuery Platform Modifier: modifying BQ...");
  38.  
  39.  
  40.  
  41. var content = $('.p6n-panel-container-inner.p6n-panel-offset-parent.p6n-panel-container-horizontal');
  42. content.css("flex-direction", "row");
  43.  
  44. content.prepend( '<div class="left-pannel"></div>' );
  45. var leftPanel = $('.left-pannel').css("display", "flex").css("flex-direction", "column").css("width", "860px").css('flex', '0 0 auto').css('border-right', '2px solid #999').css('padding-right', '2px');
  46.  
  47. //content.append( '<div class="splitter"></div>' );
  48. //var splitter = $('.splitter').css("flex", "0 0 auto").css("width", "2px").css("cursor", "col-resize").css("background-color", "#999")
  49.  
  50. content.append( '<div class="right-pannel"></div>' );
  51. var rightPanel = $('.right-pannel');
  52.  
  53. $(rightPanel).css("flex-grow", "1").css("flex", "1 1 auto");
  54.  
  55. var title = content.find('.p6n-bq-query-editor-title-container')[0];
  56. var editor = content.find('.p6n-vulcan-panel.bq-query-editor-panel.p6n-panel')[0];
  57.  
  58. $(title).appendTo(leftPanel);
  59. $(editor).appendTo(leftPanel);
  60. $(editor).css("height", "100%");
  61.  
  62. var results = content.find('.p6n-vulcan-panel-primary.bq-main-panel.p6n-panel.p6n-panel-center')[0];
  63.  
  64. var toRemove = content.find('.p6n-panel-splitter.p6n-panel-splitter-horizontal.p6n-panel-splitter-resizable')[0];
  65. toRemove.remove();
  66.  
  67. $(results).appendTo(rightPanel);
  68. $(results).css("height", "100%");
  69.  
  70. $('.left-pannel').resizable({
  71. resizeHeight: false,
  72. minWidth: 100
  73. });
  74.  
  75. console.log("BigQuery Platform Modifier: done modifying BQ...");
  76. }
  77. })();

QingJ © 2025

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