Last active
July 17, 2019 19:21
-
-
Save s-hiiragi/4cbb7ff362060cf1a81207e703e79f37 to your computer and use it in GitHub Desktop.
Settings of 'Shortkeys' google chrome extension for DOVA-SYNDROME (dova-s.jp)
This file contains 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
[{"action":"javascript","blacklist":"whitelist","code":"iframe = document.querySelector('#YouTube > iframe')\nid = iframe.src.match(/([0-9a-zA-Z]+)?$/)[0]\nhistory.go(id?-1:-2)","customName":"Go back","exported":true,"key":"a","open":false,"sites":"https://dova-s.jp/bgm/play*","sitesArray":["https://dova-s.jp/bgm/play*"]},{"action":"javascript","blacklist":"whitelist","code":"console.log('-- Play youtube movie')\niframe = document.querySelector('#YouTube > iframe')\nid = iframe.src.match(/([0-9a-zA-Z]+)?$/)[0]\nif (id) {\n\tiframe.src += `?autoplay=1&playlist=${id}&muted=1&`\n playedBgms = JSON.parse(localStorage.getItem('playedBgms')) || {}\n \ttitle = document.querySelector('#titleYouTube > h2').firstChild.textContent.trim()\n playedBgms[location.pathname] = title\n localStorage.setItem('playedBgms', JSON.stringify(playedBgms))\n console.log(playedBgms)\n} else {\n \thistory.go(-2)\n}","customName":"Play bgm","exported":true,"key":"space","open":false,"sites":"https://dova-s.jp/bgm/play*","sitesArray":["https://dova-s.jp/bgm/play*"]},{"action":"javascript","blacklist":"whitelist","code":"playedBgms = JSON.parse(localStorage.getItem('playedBgms')) || {}\nitems = Array.from(document.querySelectorAll('#itemList > .item'))\nhit = items.some((e, i) => {\n\tlet a = e.querySelector('a[href^=\"/bgm/play\"]')\n\tif (!playedBgms[a.getAttribute('href')]) {\n\t\ta.click()\n\t\treturn true\n\t}\n\treturn false\n})\nif (!hit) document.querySelector('#pageNavigation > .pager > a:last-of-type').click()","customName":"Go next bgm","exported":true,"key":"space","open":false,"sites":"https://dova-s.jp/bgm/index.html*\nhttps://dova-s.jp/bgm/","sitesArray":["https://dova-s.jp/bgm/index.html*","https://dova-s.jp/bgm/"]},{"key":"c","action":"javascript","blacklist":false,"sites":"*mail.google.com*","open":false,"customName":"Show checkboxs","code":"if (typeof checkBoxsShown === 'undefined') {\n\tcheckBoxsShown = true\n\tplayedBgms = JSON.parse(localStorage.getItem('playedBgms')) || {}\n\titems = Array.from(document.querySelectorAll('#itemList > .item'))\n\titems.forEach((e) => {\n\t\tlet a = e.querySelector('a[href^=\"/bgm/play\"]')\n\t\tlet checkBox = document.createElement('input')\n\t\tcheckBox.type = 'checkbox'\n\t\tcheckBox.checked = !!playedBgms[a.getAttribute('href')]\n\t\tcheckBox.onchange = (ev) => {\n\t\t\tif (checkBox.checked) {\n\t\t\t\ttitle = e.querySelector('dt a[href^=\"/bgm/play\"]').textContent.trim()\n\t\t\t\tplayedBgms[a.getAttribute('href')] = title\n\t\t\t} else {\n\t\t\t\tdelete playedBgms[a.getAttribute('href')]\n\t\t\t}\n\t\t\tlocalStorage.setItem('playedBgms', JSON.stringify(playedBgms))\n\t\t}\n\t\tlet p = e.querySelector('dt > p')\n\t\tp.insertBefore(checkBox, p.firstChild)\n\t})\n}","exported":true,"sitesArray":["*mail.google.com*"]}] |
add an action (press 'c' key on a result page)
- showing checkboxs to add/remove an entry that means whether a bgm played or not
The entry is recorded into the localStorage on the site.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
actions of 'space' key
url patterns of result pages
an url pattern of bgm pages