Skip to content

Instantly share code, notes, and snippets.

@qnighy
Last active July 12, 2018 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qnighy/0c622848990004d0bcc894548a9d42ea to your computer and use it in GitHub Desktop.
Save qnighy/0c622848990004d0bcc894548a9d42ea to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name BigQuery auto validate
// @namespace https://qnighy.info/
// @version 0.1
// @description saikou
// @author Masaki Hara
// @match https://bigquery.cloud.google.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let status_box = null;
let button = null;
let sqlbutton = null;
let sqlbuttonlabel = null;
setInterval(() => {
if(status_box === null) {
status_box = document.querySelector(".validate-status-box");
}
if(button === null) {
button = document.querySelector(".validator-symbol");
}
if(sqlbutton === null) {
sqlbutton = document.querySelector("#use-legacy-sql");
}
if(sqlbuttonlabel === null && sqlbutton !== null) {
sqlbuttonlabel = sqlbutton.parentElement.querySelector("label");
}
if(status_box != null && button != null && status_box.classList.contains("ng-hide")) {
button.click();
}
if(sqlbutton != null && sqlbuttonlabel != null && sqlbutton.classList.contains("ng-not-empty")) {
sqlbuttonlabel.click();
}
}, 5000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment