Created
May 20, 2016 04:48
-
-
Save jimbol/7a210c5e2292436bcc943435be91bbf3 to your computer and use it in GitHub Desktop.
show-schedule.bookmarklet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%7Bvar%20table%20%3D%20document.getElementsByTagName('table')%5B2%5D%3Bvar%20rows%20%3D%20table.getElementsByTagName('tr')%3Bvar%20parseTime%20%3D%20function(rawDateTime%2C%20offset)%7Bvar%20tomorrow%20%3D%20new%20Date()%3Btomorrow.setDate(tomorrow.getDate()%20%2B%20offset)%3Bvar%20splitDateTime%20%3D%20rawDateTime.split('%5Cn%20%20')%3Bvar%20isPM%20%3D%20splitDateTime%5B1%5D.indexOf('pm')%20%3E%20-1%3Bvar%20date%20%3D%20splitDateTime%5B0%5D.split('%2F')%3Bvar%20month%20%3D%20parseInt(date%5B0%5D)%20-%201%3Bvar%20day%20%3D%20parseInt(date%5B1%5D)%3Bvar%20year%20%3D%20parseInt(date%5B2%5D)%3Bvar%20time%20%3D%20splitDateTime%5B1%5D.split('.')%3Bvar%20hour%20%3D%20parseInt(time%5B0%5D)%3Bif(isPM%20%26%26%20hour%20%3C%2012)%7Bhour%20%2B%3D%2012%3B%7Dvar%20min%20%3D%20parseInt(time%5B1%5D)%3Bif(tomorrow.getMonth()%20%3D%3D%3D%20month%20%26%26%20tomorrow.getDate()%20%3D%3D%3D%20day)%20%7Breturn%20new%20Date(year%2C%20month%2C%20day%2C%20hour%2C%20min)%3B%7D%7D%3Bvar%20s%20%3D%20%7Bcontainer%3A%20function()%7Breturn%20%5B%20'%22'%2C'position%3A%20absolute%3B'%2C'margin%3A%2050px%209%25%3B'%2C'padding%3A%2020px%3B'%2C'height%3A%20auto%3B'%2C'width%3A%20calc(80%25%20-%2040px)%3B'%2C'background-color%3A%20%23fff%3B'%2C'border%3A%201px%20solid%20%23999%3B'%2C'font-family%3A%20Helvetica%2C%20Arial%3B'%2C'%22'%5D.join('%20')%3B%7D%2Cheader%3A%20function()%7Breturn%20%5B'%22'%2C'padding%3A%207px%3B'%2C'margin%3A%2010px%200%2015px%3B'%2C'border-bottom%3A%201px%20solid%20%23efefef%3B'%2C'%22'%5D.join('%20')%3B%7D%2Ccol%3A%20function()%7Breturn%20%5B'%22'%2C'display%3A%20inline-block%3B'%2C'width%3A%20150px%3B'%2C'padding-right%3A%207px%3B'%2C'margin%3A%207px%3B'%2C'height%3A%2055px%3B'%2C'border-bottom%3A%201px%20solid%20%23efefef%3B'%2C'vertical-align%3A%20top%3B'%2C'%22'%5D.join('%20')%3B%7D%2Cbutton%3A%20function()%7Breturn%20%5B'%22'%2C'padding%3A%2010px%2020px%3B'%2C'margin%3A%207px%3B'%2C'background-color%3A%20%23efefef%3B'%2C'border%3A%201px%20solid%20%23999%3B'%2C'box-shadow%3A%202px%202px%201px%20%23efefef%3B'%2C'vertical-align%3A%20top%3B'%2C'%22'%5D.join('%20')%3B%7D%7D%3Bfunction%20render()%7Bvar%20markup%20%3D%20%5B'%3Cdiv%20style%3D%22height%3A%20100%25%3Bwidth%3A%20100%25%3Bposition%3A%20absolute%3Bbackground-color%3A%20rgba(100%2C100%2C100%2C.7)%3B%22%3E%3C%2Fdiv%3E'%2C'%3Cdiv%20id%3D%22contents%22%20style%3D'%20%2B%20s.container()%20%2B%20'%3E'%2C'%3Ch2%20style%3D'%20%2B%20s.header()%20%2B%20'%3EHere%5C's%20what%20you%20have%20for%20today.%3C%2Fh2%3E'%2CrenderRows(0)%2C'%3Ch2%20style%3D'%20%2B%20s.header()%20%2B%20'%3EAnd%20for%20tomorrow...%3C%2Fh2%3E'%2CrenderRows(1)%2C'%3C%2Fdiv%3E'%5D.join('')%3Bvar%20body%20%3D%20document.getElementsByTagName('body')%5B0%5D%3Bbody.innerHTML%20%3D%20markup%20%2B%20body.innerHTML%3B%7D%3Bfunction%20renderRows(offset)%7Bvar%20lastAddress%20%3D%20%5B'3019'%2C%20'w'%2C%20'logan'%2C%20'blvd'%2C%20'chicago'%2C%20'60647'%5D%3Bvar%20markup%20%3D%20%5B%5D%3Bfor(var%20i%20%3D%201%3B%20i%20%3C%20rows.length%3B%20i%2B%2B)%20%7Bvar%20row%20%3D%20rows%5Bi%5D%3Bvar%20address%20%3D%20row.getElementsByTagName('td')%5B2%5D.innerHTML.trim().split('%5Cn').join('').split('%20')%3Bvar%20rawDateTime%20%3D%20row.getElementsByTagName('td')%5B6%5D.innerHTML%3Bvar%20dateObj%20%3D%20parseTime(rawDateTime%2C%20offset)%3Bif(dateObj)%7Bvar%20mapAddress%20%3D%20'https%3A%2F%2Fwww.google.com%2Fmaps%2Fdir%2F'%20%2B%20lastAddress.join('%2B')%20%2B%20'%2F'%20%2B%20address.join('%2B')%3BlastAddress%20%3D%20address%3Bmarkup%20%3D%20markup.concat(%5B'%3Cdiv%3E'%2C'%3Cdiv%20style%3D'%20%2B%20s.col()%20%2B%20'%3E'%20%2B%20address.join('%20')%20%2B%20'%3A%20%3C%2Fdiv%3E'%2C'%3Cdiv%20style%3D'%20%2B%20s.col()%20%2B%20'%3E%3Ca%20target%3D%22_blank%22%20href%3D%22'%20%2B%20mapAddress%20%2B%20'%22%3EMap%3C%2Fa%3E%3C%2Fdiv%3E'%2C'%3C%2Fdiv%3E'%5D)%3B%7D%7Dreturn%20markup.join('')%3B%7Drender()%7D)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment