Created
October 10, 2019 07:50
-
-
Save hexagit/3275c705acc7fec8e72d8a8bf9624910 to your computer and use it in GitHub Desktop.
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
| $(document).ready(function () { | |
| var isFound = false; | |
| // ブログの新着記事の親を検索 | |
| var newBlogLists = document.getElementsByClassName('blogList clear heightAdjust heightLineParent'); | |
| if (newBlogLists.length > 0) { | |
| // ブログの新着記事のリストを回す | |
| var newBlogList = newBlogLists[0].children; | |
| for (var i = 0; i < newBlogList.length; i++) { | |
| var newBlog = newBlogList[i]; | |
| // 日付を検索 | |
| var dateList = newBlog.getElementsByClassName('abel'); | |
| if (dateList.length > 0) { | |
| // 指定した日付と一緒だったら | |
| if (dateList[0].textContent == values.date) { | |
| // 発見通知をリクエスト | |
| chrome.runtime.sendMessage(CreateValues("FindNotification", values)); | |
| isFound = true; | |
| break; | |
| } | |
| } | |
| } | |
| if (!isFound) { | |
| // 未発見通知をリクエスト | |
| chrome.runtime.sendMessage(CreateValues("NotFindNotification", values)); | |
| } | |
| } | |
| }); | |
| // リクエスト時の値を作る | |
| function CreateValues(type, values) { | |
| return { | |
| type: type, | |
| date: values.date, | |
| tabId: values.tabId, | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment