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/
SITES = 'sites'
for key, value of @contentCurrentModifiedTimes
uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1"
uniqueIdentifier = key.replace /^(.*?\/.*?)\/.*$/, "$1"
uniqueIdentifierSubcategory = key.replace /^.*?\/(.*?)\/.*$/, "$1"
# Added?
if (@contentPreviousModifiedTimes[key] == undefined)
rulesAdded.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1
trackersAdded.add uniqueIdentifier
trackersAdded.add uniqueIdentifierSubcategory
if (key.indexOf SITES) > -1
sitesAdded.add uniqueIdentifier
sitesAdded.add uniqueIdentifierSubcategory
# Updated?
else if (@contentPreviousModifiedTimes[key] != value)
rulesUpdated.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1
trackersUpdated.add uniqueIdentifier
trackersUpdated.add uniqueIdentifierSubcategory
if (key.indexOf SITES) > -1
sitesUpdated.add uniqueIdentifier
sitesUpdated.add uniqueIdentifierSubcategory
for key, value of @contentPreviousModifiedTimes
uniqueIdentifier = key.replace /(.*\/*.)\/.*/, "$1"
......@@ -861,40 +862,40 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
if (@contentCurrentModifiedTimes[key] == undefined)
rulesDeleted.add uniqueIdentifier
if (key.indexOf TRACKERS) > -1
trackersDeleted.add uniqueIdentifier
trackersDeleted.add uniqueIdentifierSubcategory
if (key.indexOf SITES) > -1
trackersDeleted.add uniqueIdentifier
trackersDeleted.add uniqueIdentifierSubcategory
rulesChanged = rulesAdded.size + rulesUpdated.size + rulesDeleted.size
trackersChanged = trackersAdded.size + trackersUpdated.size + trackersDeleted.size
sitesChanged = sitesAdded.size + sitesUpdated.size + sitesDeleted.size
console.log("")
console.log("Rules changed : #{rulesChanged}")
console.log("Trackers changed : #{trackersChanged}")
console.log("Sites changed : #{sitesChanged}")
console.log("")
console.log("Rules added (#{rulesAdded.size}):")
console.log(rulesAdded)
console.log("Ruled updated (#{rulesUpdated.size}):")
console.log(rulesUpdated)
console.log("Rules deleted (#{rulesDeleted.size}):")
console.log(rulesDeleted)
console.log("")
console.log("Trackers added (#{trackersAdded.size}):")
console.log(trackersAdded)
console.log("Trackers updated (#{trackersUpdated.size}):")
console.log(trackersUpdated)
console.log("Trackers deleted (#{trackersDeleted.size}):")
console.log(trackersDeleted)
console.log("")
console.log("Sites added (#{sitesAdded.size}):")
console.log(sitesAdded)
console.log("Sites updated (#{sitesUpdated.size}):")
console.log(sitesUpdated)
console.log("Sites deleted (#{sitesDeleted.size}):")
console.log(sitesDeleted)
console.log("")
# console.log("")
# console.log("Rules changed : #{rulesChanged}")
# console.log("Trackers changed : #{trackersChanged}")
# console.log("Sites changed : #{sitesChanged}")
# console.log("")
# console.log("Rules added (#{rulesAdded.size}):")
# console.log(rulesAdded)
# console.log("Ruled updated (#{rulesUpdated.size}):")
# console.log(rulesUpdated)
# console.log("Rules deleted (#{rulesDeleted.size}):")
# console.log(rulesDeleted)
# console.log("")
# console.log("Trackers added (#{trackersAdded.size}):")
# console.log(trackersAdded)
# console.log("Trackers updated (#{trackersUpdated.size}):")
# console.log(trackersUpdated)
# console.log("Trackers deleted (#{trackersDeleted.size}):")
# console.log(trackersDeleted)
# console.log("")
# console.log("Sites added (#{sitesAdded.size}):")
# console.log(sitesAdded)
# console.log("Sites updated (#{sitesUpdated.size}):")
# console.log(sitesUpdated)
# console.log("Sites deleted (#{sitesDeleted.size}):")
# console.log(sitesDeleted)
# console.log("")
# Calculate the last update time based on the content cache.
# 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