Skip to content

Instantly share code, notes, and snippets.

@kotet
Created February 8, 2021 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotet/c5771b1d350116702ec02abac8afcd12 to your computer and use it in GitHub Desktop.
Save kotet/c5771b1d350116702ec02abac8afcd12 to your computer and use it in GitHub Desktop.
AtCoderのコンテストトップページで発動するとGoogle Calenderの予定を作って開くブックマークレット
(function(){var a=function(c){return c.getUTCFullYear()+(""+(101+c.getUTCMonth())).slice(1,3)+(""+(100+c.getUTCDate())).slice(1,3)+"T"+(""+(100+c.getUTCHours())).slice(1,3)+(""+(100+c.getUTCMinutes())).slice(1,3)+"00Z"},b=encodeURI,d=document.querySelector("#contest-nav-tabs > div > small.contest-duration"),e=b(a(new Date(d.querySelector("a:nth-child(1) > time").innerText)));a=b(a(new Date(d.querySelector("a:nth-child(2) > time").innerText)));d=b(document.title);var f=b(location.href);b=b(document.querySelector("#main-container > div.row > div:nth-child(2) > p").innerText);window.open("https://www.google.com/calendar/render?action=TEMPLATE&text="+d+"&details="+b+"&location="+f+"&dates="+e+"%2F"+a,"_blank")})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment