Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. function checkIfNewContent()
  2. {
  3.  
  4. fetch(RssUrl).then((res) => {
  5. res.text().then((plainxml) => {
  6.  
  7. var domParser = new DOMParser();
  8. var xmlParsed = domParser.parseFromString(plainxml, 'text/xml');
  9.  
  10. var lastBuildDate = xmlParsed.querySelectorAll('lastBuildDate')[0].textContent;
  11.  
  12. chrome.storage.local.get('lastbuild', function (result) {
  13. if (result.lastbuild != lastBuildDate)
  14. {
  15. chrome.storage.local.set({ 'lastbuild': lastBuildDate }, function () {
  16. chrome.browserAction.setBadgeText({ text: 'News' });
  17. chrome.browserAction.setBadgeBackgroundColor({ color: [255, 0, 0, 255] });
  18. });
  19. }
  20.  
  21. });
  22.  
  23. })
  24. });
  25.  
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement