Skip to content

Instantly share code, notes, and snippets.

@mold
Last active December 14, 2021 10:55
Show Gist options
  • Save mold/d30f5650273e43718530 to your computer and use it in GitHub Desktop.
Save mold/d30f5650273e43718530 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Drive Number of Files
// @namespace dkdscripts
// @version 1.0
// @description Shows how many items are displayed currently in drive (updates 1/s)
// @author dkd
// @downloadURL https://gist.github.com/mold/d30f5650273e43718530/raw/9dbb8d3949945e278563b01d40a277a72506f58f/drive-num-files.user.js
// @match https://drive.google.com/*
// @grant none
// ==/UserScript==
(function() {
var displayText = document.getElementsByClassName("a-pa-ob-yd-aa-J a-pa-ob-yd-aa-J-em a-Ra-Bd a-pa-Ra-Zi");
window.setInterval(function() {
var number = document.querySelectorAll("[role=main]:not([style='display: none;']) [data-target=layout]:not([style='display: none;']) .k-ta-P-x").length;
for (var i = 0; i < displayText.length; i++) {
displayText[i].previousSibling.innerHTML = "Showing " + number + " items"
};
}, 1000);
})();
@mold
Copy link
Author

mold commented Dec 14, 2021

Hi @Korb, thanks for taking an interest in this! I haven't touched it since I made it in 2015, so the class names in drive have definitely changed, breaking my selectors. I might have a look if I get the time, otherwise feel free to post a fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment