lolimoska

Untitled

Apr 22nd, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. function check_active_watching() {
  2. if (!obj.channelData.activeWatching) return;
  3. if (obj.activeWatching.style.display == 'inherit') return;
  4. obj.activeWatching.onclick = function() {
  5. let videoId = null,
  6. channelId = null;
  7. Array.from(document.getElementsByTagName('meta'))
  8. .forEach((el) => {
  9. if (el.getAttribute("itemprop") == "channelId") channelId = el.getAttribute("content");
  10. if (el.getAttribute("itemprop") == "videoId") videoId = el.getAttribute("content");
  11. });
  12. let subscription = (!(document.getElementById("notification-preference-button") ? .hasAttribute("hidden") ? ? true));
  13. let YouTubeName = document.getElementById("account-name") ? .innerHTML;
  14. let YouTubeId = undefined;
  15. if (document.getElementById("endpoint") ? .href) YouTubeId = document.getElementById("endpoint")
  16. .href.substr(document.getElementById("endpoint")
  17. .href.lastIndexOf("/") + 1);
  18. chrome.runtime.sendMessage({
  19. "type": "sendRequest",
  20. "endpoint": "collect_activity_points",
  21. "data": {
  22. subscription,
  23. YouTubeId,
  24. YouTubeName,
  25. videoId,
  26. channelId
  27. }
  28. });
  29.  
  30.  
Add Comment
Please, Sign In to add comment