Load .gsheet link from local file

Discover Google Docs link in .gsheet file and navigate to it. 2020-03-02.

目前为 2020-03-02 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Load .gsheet link from local file
  3. // @version 0.1
  4. // @description Discover Google Docs link in .gsheet file and navigate to it. 2020-03-02.
  5. // @author Jefferson "jscher2000" Scher
  6. // @namespace JeffersonScher
  7. // @copyright Copyright 2020 Jefferson Scher
  8. // @license BSD-3-Clause
  9. // @match file:///*/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // Detect documents whose paths end with .gsheet
  14. if (location.pathname.indexOf('.gsheet') > -1 && location.pathname.slice(-7) == '.gsheet'){
  15. // Parse document text as JSON
  16. var oSheetInfo = JSON.parse(document.body.textContent);
  17. // Replace current page with linked page
  18. location.replace(oSheetInfo.url);
  19. }