Github Repository Name as Tab Title

change tab title to : Repository Name / blabla

  1. // ==UserScript==
  2. // @name Github Repository Name as Tab Title
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description change tab title to : Repository Name / blabla
  6. // @author You
  7. // @match https://github.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. setTimeout(()=>{
  16. var loca = location.href, name = loca, d=document, t=d.title;
  17. // https://github.com/user/repository-name
  18. var name = name.slice(name.indexOf('/', 20)+1);
  19. if(name.includes('/'))
  20. name = name.slice(0, name.indexOf('/'));
  21. debug(t, name);
  22. if(!t.includes(name) || loca.includes('/issues/'))
  23. t = name+' / '+t;
  24. else
  25. t = t.slice(t.indexOf(name))
  26.  
  27. t = t[0].toUpperCase() + t.slice(1)
  28. d.title = t;
  29.  
  30. }, 800)
  31.  
  32.  
  33. // Your code here...
  34. })();