How to change total counter

Everything about using Adblock Plus on Google Chrome
Merano
Posts: 5
Joined: Thu Oct 09, 2014 8:38 pm

How to change total counter

Post by Merano »

Hello everyone, I am new here.
Due to the problems that appear on my MS Vista, I must reinstall Google Chrome from time to time. I don't want to have my AdblockPlus total counter reseted to zero after each reinstalling, so I'd like to manually enter previous number of blocaded ads. Where can I find a file that stores such information?
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: How to change total counter

Post by greiner »

That data is not stored within a file but you can still store it using this method:

1. Go to the Adblock Plus options page
2. Press CTRL+SHIFT+J to open the JavaScript console
3. Enter

Code: Select all

copy(localStorage.stats_total)
and press "Enter"
4. Paste the copied data into a text file and save it

To restore it follow these steps:

1. Copy the data from the text file where you saved it previously
2. Go to the Adblock Plus options page
3. Press CTRL+SHIFT+J to open the JavaScript console
4. Enter

Code: Select all

localStorage.stats_total = JSON.stringify(###)
(replace "###" with the data from the text file) and press "Enter"
5. Restart Chrome
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: How to change total counter

Post by mapx »

Can you achieve the same result saving and restoring the file(s)
chrome-extension_cfhdojbkjhnklbpkdaibdccddilifddb_0.localstorage

?

or simply modifying the value in that file using something like:
http://sourceforge.net/projects/sqlitebrowser/
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: How to change total counter

Post by greiner »

Yes, those are also valid options. Copying the whole file is probably the simplest solution, indeed. Thanks for mentioning them.

My intention here was to outline an approach that will work independently of any browser internals which tend to change every now and then.
Merano
Posts: 5
Joined: Thu Oct 09, 2014 8:38 pm

Re: How to change total counter

Post by Merano »

Many thanks for both of You. The value of counter is really hidden deeply, so indeed I had no possibility to find it without Your help. The way of saving the file of course works fine. After reinstalling Adblock with old file, the previous counter's value is preserved. But when I tried to use version given by greiner, the error occured. No data is returned after ctrl-shift-j, etc.:
got unexpected message: clickhide-deactivate options.js:94
got unexpected message: get-selectors options.js:94
copy(localStorage.stats_total)
undefined
got unexpected message: should-collapse
and pasting remembered value (using second part of hint) doesn't work either, because counter is still reseted to zero.
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: How to change total counter

Post by greiner »

Great to hear that mapx' solution worked for you.
Merano wrote:But when I tried to use version given by greiner, the error occured. No data is returned after ctrl-shift-j, etc.:

Code: Select all

got unexpected message: clickhide-deactivate options.js:94
got unexpected message: get-selectors options.js:94
copy(localStorage.stats_total)
undefined
got unexpected message: should-collapse 
The "copy(…)" command already puts the data into your clipboard so you don't need to copy the data manually. Pasting the data into a text file is enough.
Merano
Posts: 5
Joined: Thu Oct 09, 2014 8:38 pm

Re: How to change total counter

Post by Merano »

OK, I understand now. Thank You for explanation.
Merano
Posts: 5
Joined: Thu Oct 09, 2014 8:38 pm

Re: How to change total counter

Post by Merano »

Has something been changed in AdblockPlus? Yesterday after reinstaling I found that chrome-extension_cfhdojbkjhnklbpkdaibdccddilifddb_0.localstorage does not exist on my disk, neither works

Code: Select all

copy(localStorage.stats_total)
giving only undefined reply :(
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: How to change total counter

Post by greiner »

Merano wrote:Has something been changed in AdblockPlus? Yesterday after reinstaling I found that chrome-extension_cfhdojbkjhnklbpkdaibdccddilifddb_0.localstorage does not exist on my disk, neither works

Code: Select all

copy(localStorage.stats_total)
giving only undefined reply :(
We've switched from "localStorage" to "chrome.storage" and renamed it to "blocked_total". Therefore the best way to retrieve it is using

Code: Select all

Prefs.blocked_total
.
Merano
Posts: 5
Joined: Thu Oct 09, 2014 8:38 pm

Re: How to change total counter

Post by Merano »

Yes, now it works fine. Thanks!
AdblockPlusUser
Posts: 5
Joined: Thu Feb 04, 2016 1:17 am

Re: How to change total counter

Post by AdblockPlusUser »

Hello,

I like being able to reset the stats counter from time to time for a variety of reasons, but after the latest update, none of the methods described in this thread work anymore. Is there any way to do so with this latest version?

Also, is there a way to toggle the stats counter on and off?

Thanks. I hope to hear a response soon.
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: How to change total counter

Post by mapx »

click ABP icon
right click that panel
inspect
console
to see the total of ads type in + enter:

Code: Select all

Prefs.blocked_total
to change the total to 123 type + enter

Code: Select all

Prefs.blocked_total=123
AdblockPlusUser
Posts: 5
Joined: Thu Feb 04, 2016 1:17 am

Re: How to change total counter

Post by AdblockPlusUser »

Thanks! Keep up the good work.
AdblockPlusUser
Posts: 5
Joined: Thu Feb 04, 2016 1:17 am

Re: How to change total counter

Post by AdblockPlusUser »

Hello,

After the latest Chrome update, none of the methods described in this thread work anymore. Is there another way to reset the total counter?
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: How to change total counter

Post by mapx »

still working well.
open the inspect window right-clicking on the ABP icon.
Post Reply