SharePointUsage

Sharepoint 页面做下加显示剩余空间

2021-05-04 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        SharePointUsage
// @name-zh     SharePoint剩余空间
// @namespace   benzbrake-sharepoint-usate
// @match       https://*.sharepoint.com/personal/*/_layouts/15/onedrive.aspx*
// @grant       GM_xmlhttpRequest
// @version     1.0
// @author      Ryan
// @run-at      document-end
// @description Sharepoint 页面做下加显示剩余空间
// ==/UserScript==
let stormanLink = location.href.split('?')[0].replace('onedrive.aspx', 'storman.aspx'),
    stormanHTML = '',
    cl;

function addLink() {
  let section = document.querySelector('.LeftNav-notifications-section');
  let div = document.createElement('div');
  if (section && stormanHTML.length > 0) {
    clearInterval(cl);
    let div = document.createElement('div');
    div.style.textAlign = 'center';
    div.innerHTML = stormanHTML;
    let progressBar = div.querySelectorAll('.ms-storman-quotabarnormalcol')[0];
    progressBar.style.border = '1px solid #649b61';
    progressBar.style.margin = '5px';
    section.insertBefore(div, section.querySelectorAll('a')[0]);
  }
}

GM_xmlhttpRequest({
    method: "GET",
    url: stormanLink,
    headers: {  
         "Content-Type": "text/html"
    },
    onload: function(response) {
      let div = document.createElement('div');
      div.innerHTML = response.responseText;
      let usage = div.querySelectorAll('.ms-dnd-progressInfoTb');
      if (usage.length > 0) {
        stormanHTML = usage[0].innerHTML;
        cl = setInterval(addLink, 200);
      }
    }
});