Skip to content

Instantly share code, notes, and snippets.

@emlyn
Last active August 10, 2022 13:19
Show Gist options
  • Select an option

  • Save emlyn/169af82a09c2af8d79494f8d7e7d90b1 to your computer and use it in GitHub Desktop.

Select an option

Save emlyn/169af82a09c2af8d79494f8d7e7d90b1 to your computer and use it in GitHub Desktop.
Tampermonkey: Display workspace name at top of Databricks page
// ==UserScript==
// @name Databricks Workspace
// @description Display workspace name at top of Databricks page
// @downloadURL https://gist.github.com/emlyn/169af82a09c2af8d79494f8d7e7d90b1/raw/dbws.js
// @updateURL https://gist.github.com/emlyn/169af82a09c2af8d79494f8d7e7d90b1/raw/dbws.js
// @namespace https://gist.github.com/emlyn
// @version 0.4
// @author Emlyn Corrin
// @match https://*.azuredatabricks.net/*
// @icon https://databricks.com/favicon.ico
// @grant none
// @noframes
// ==/UserScript==
(function() {
'use strict';
var doit = function() {
var el = document.querySelector('#sidebar nav button[aria-controls="account-menu"] span.persona-nav-expanded-text > span:nth-child(1)')
|| document.querySelector('.application-layout-side-menu nav button[aria-controls="account-menu"] span.persona-nav-expanded-text > span:nth-child(1)');
if (!el) {
console.log("DBWS: Can't determine workspace, waiting");
setTimeout(doit, 250);
return;
}
console.log("DBWS: Found workspace element", el);
var ul = document.querySelector("#azure-toolbar ul");
var li = document.createElement("li");
li.innerText = el.innerText;
ul.appendChild(li);
}
setTimeout(doit, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment