SharePoint剩余空间

Sharepoint 页面左下角显示剩余空间

  1. // ==UserScript==
  2. // @name SharePointUsage
  3. // @name:zh-cn SharePoint剩余空间
  4. // @namespace benzbrake-sharepoint-usate
  5. // @match https://*.sharepoint.com/personal/*/_layouts/15/onedrive.aspx*
  6. // @grant GM_xmlhttpRequest
  7. // @version 1.0
  8. // @author Ryan
  9. // @run-at document-end
  10. // @description Show sharepoint usage at the left bottom on the sharepoint web page.
  11. // @description:zh-cn Sharepoint 页面左下角显示剩余空间
  12. // ==/UserScript==
  13. let stormanLink = location.href.split('?')[0].replace('onedrive.aspx', 'storman.aspx'),
  14. stormanHTML = '',
  15. cl;
  16.  
  17. function addLink() {
  18. let section = document.querySelector('.LeftNav-notifications-section');
  19. let div = document.createElement('div');
  20. if (section && stormanHTML.length > 0) {
  21. clearInterval(cl);
  22. let div = document.createElement('div');
  23. div.style.textAlign = 'center';
  24. div.innerHTML = stormanHTML;
  25. let progressBar = div.querySelectorAll('.ms-storman-quotabarnormalcol')[0];
  26. progressBar.style.border = '1px solid #649b61';
  27. progressBar.style.margin = '5px';
  28. section.insertBefore(div, section.querySelectorAll('a')[0]);
  29. }
  30. }
  31.  
  32. GM_xmlhttpRequest({
  33. method: "GET",
  34. url: stormanLink,
  35. headers: {
  36. "Content-Type": "text/html"
  37. },
  38. onload: function(response) {
  39. let div = document.createElement('div');
  40. div.innerHTML = response.responseText;
  41. let usage = div.querySelectorAll('.ms-dnd-progressInfoTb');
  42. if (usage.length > 0) {
  43. stormanHTML = usage[0].innerHTML;
  44. cl = setInterval(addLink, 200);
  45. }
  46. }
  47. });

QingJ © 2025

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