Verified Commit 5ba1e35a authored by Aral Balkan's avatar Aral Balkan
Browse files

Save statistics in metadata

parent b97d4383
...@@ -836,23 +836,24 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/ ...@@ -836,23 +836,24 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
SITES = 'sites' SITES = 'sites'
for key, value of @contentCurrentModifiedTimes for key, value of @contentCurrentModifiedTimes
uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1" uniqueIdentifier = key.replace /^(.*?\/.*?)\/.*$/, "$1"
uniqueIdentifierSubcategory = key.replace /^.*?\/(.*?)\/.*$/, "$1"
# Added? # Added?
if (@contentPreviousModifiedTimes[key] == undefined) if (@contentPreviousModifiedTimes[key] == undefined)
rulesAdded.add uniqueIdentifier rulesAdded.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1 if (key.indexOf TRACKERS) > -1
trackersAdded.add uniqueIdentifier trackersAdded.add uniqueIdentifierSubcategory
if (key.indexOf SITES) > -1 if (key.indexOf SITES) > -1
sitesAdded.add uniqueIdentifier sitesAdded.add uniqueIdentifierSubcategory
# Updated? # Updated?
else if (@contentPreviousModifiedTimes[key] != value) else if (@contentPreviousModifiedTimes[key] != value)
rulesUpdated.add uniqueIdentifier rulesUpdated.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1 if (key.indexOf TRACKERS) > -1
trackersUpdated.add uniqueIdentifier trackersUpdated.add uniqueIdentifierSubcategory
if (key.indexOf SITES) > -1 if (key.indexOf SITES) > -1
sitesUpdated.add uniqueIdentifier sitesUpdated.add uniqueIdentifierSubcategory
for key, value of @contentPreviousModifiedTimes for key, value of @contentPreviousModifiedTimes
uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1" uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1"
...@@ -861,40 +862,40 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/ ...@@ -861,40 +862,40 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
if (@contentCurrentModifiedTimes[key] == undefined) if (@contentCurrentModifiedTimes[key] == undefined)
rulesDeleted.add uniqueIdentifier rulesDeleted.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1 if (key.indexOf TRACKERS) > -1
trackersDeleted.add uniqueIdentifier trackersDeleted.add uniqueIdentifierSubcategory
if (key.indexOf SITES) > -1 if (key.indexOf SITES) > -1
trackersDeleted.add uniqueIdentifier trackersDeleted.add uniqueIdentifierSubcategory
rulesChanged = rulesAdded.size + rulesUpdated.size + rulesDeleted.size rulesChanged = rulesAdded.size + rulesUpdated.size + rulesDeleted.size
trackersChanged = trackersAdded.size + trackersUpdated.size + trackersDeleted.size trackersChanged = trackersAdded.size + trackersUpdated.size + trackersDeleted.size
sitesChanged = sitesAdded.size + sitesUpdated.size + sitesDeleted.size sitesChanged = sitesAdded.size + sitesUpdated.size + sitesDeleted.size
console.log("") # console.log("")
console.log("Rules changed : #{rulesChanged}") # console.log("Rules changed : #{rulesChanged}")
console.log("Trackers changed : #{trackersChanged}") # console.log("Trackers changed : #{trackersChanged}")
console.log("Sites changed : #{sitesChanged}") # console.log("Sites changed : #{sitesChanged}")
console.log("") # console.log("")
console.log("Rules added (#{rulesAdded.size}):") # console.log("Rules added (#{rulesAdded.size}):")
console.log(rulesAdded) # console.log(rulesAdded)
console.log("Ruled updated (#{rulesUpdated.size}):") # console.log("Ruled updated (#{rulesUpdated.size}):")
console.log(rulesUpdated) # console.log(rulesUpdated)
console.log("Rules deleted (#{rulesDeleted.size}):") # console.log("Rules deleted (#{rulesDeleted.size}):")
console.log(rulesDeleted) # console.log(rulesDeleted)
console.log("") # console.log("")
console.log("Trackers added (#{trackersAdded.size}):") # console.log("Trackers added (#{trackersAdded.size}):")
console.log(trackersAdded) # console.log(trackersAdded)
console.log("Trackers updated (#{trackersUpdated.size}):") # console.log("Trackers updated (#{trackersUpdated.size}):")
console.log(trackersUpdated) # console.log(trackersUpdated)
console.log("Trackers deleted (#{trackersDeleted.size}):") # console.log("Trackers deleted (#{trackersDeleted.size}):")
console.log(trackersDeleted) # console.log(trackersDeleted)
console.log("") # console.log("")
console.log("Sites added (#{sitesAdded.size}):") # console.log("Sites added (#{sitesAdded.size}):")
console.log(sitesAdded) # console.log(sitesAdded)
console.log("Sites updated (#{sitesUpdated.size}):") # console.log("Sites updated (#{sitesUpdated.size}):")
console.log(sitesUpdated) # console.log(sitesUpdated)
console.log("Sites deleted (#{sitesDeleted.size}):") # console.log("Sites deleted (#{sitesDeleted.size}):")
console.log(sitesDeleted) # console.log(sitesDeleted)
console.log("") # console.log("")
# Calculate the last update time based on the content cache. # Calculate the last update time based on the content cache.
# Since timestamps have lexographical order, we can use a reduce # Since timestamps have lexographical order, we can use a reduce
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment