Guest User

Untitled

a guest
Mar 19th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // To be ran in chrome://settings/siteData
  2.  
  3. (await cr.sendWithPromise('localData.getDisplayList', ''))
  4. .items
  5. .filter(
  6. r => r.site &&
  7. !r.site.match(/wikipedia|twitch|youtube|amazon|google|spotify|github\.com/) &&
  8. r.localData.match(/(Cache|Local|Database) storage/ig)
  9. )
  10. .forEach(async row => {
  11. (await cr.sendWithPromise('localData.getCookieDetails', row.site))
  12. .children
  13. .filter(r =>
  14. r.idPath && r.idPath.match(/^\d+,\d+,\d+$/) &&
  15. r.size && !r.size.endsWith(' B') &&
  16. ['local_storage', 'indexed_db', 'cache_storage'].includes(r.type)
  17. )
  18. .forEach(_storage => {
  19. let { origin, type, modified, size, idPath } = _storage
  20.  
  21. size = (size.endsWith('MB') ? 1 : 0.001) * +size.replace(/[BKM ,]/g, '')
  22.  
  23. modified = (modified || (new Date()).toLocaleString()).replace(/at (.*)$/, '')
  24.  
  25. let days_ago = Math.floor((Date.now() - new Date(modified)) / (864e5))
  26.  
  27. if (size > 0.2 || days_ago > 30) {
  28. console.log({ size: Intl.NumberFormat().format(size) + ' MB', type, days_ago, modified, origin })
  29. chrome.send("localData.removeCookie", [idPath])
  30. }
  31. })
  32. })
Add Comment
Please, Sign In to add comment