User talk:Kaniivel/IPLabeller

Storage?
Hi there. Thanks for sharing this script. Could you explain, for those of us less savvy, how storage works? If I regularly clear my browser cache/cookies, will I lose my labels, too? Thanks. &mdash;  Rhododendrites talk  \\ 14:31, 30 August 2015 (UTC)
 * Hi and thanks for using the script! Yes, its true that if you clear the cookies you will lose your labels. There is an option in Google Chrome to remove the check mark before "Cookies and other site and plugin data" in the "Clear browsing data" menu. That will save local storage data from being cleaned. Should you clear browsing data with cookies included then you'll lose all labels as well. I suppose things are more or less the same in other web browsers.
 * I googled a bit to find out if there are any options for saving local storage data but didn't come up with any. In Chrome, if you hit F12 key, a console comes up and under the Resources Tab you can see Local Storage on the left pane. You can see every saved label and edit it, but there is no way to save the data.
 * Maybe I will write additional functionality to the script that allows saving the labels. Have been thinking about this before. Cumbril (talk) 15:41, 30 August 2015 (UTC)
 * A thought. If you can find Local Storage file in the file system and make a copy of it, then delete cookies, then reinstall the file, it might work. In my case the Local Storage is located at Users\User.name\AppData\Local\Google\Chrome\User Data\Default\Local Storage. There are two Local Storage files for every domain. Cumbril (talk) 16:18, 30 August 2015 (UTC)
 * Thanks for the response/ideas. Finding, backing up, and restoring the file sounds like it would work, but it's pretty cumbersome (I tend to clean/clear my browser data regularly). Maybe there's a way to change permissions/properties of just those files to prevent them from being deleted... PS I posted a thread about this at Village pump (technical)/Archive 139. &mdash;  Rhododendrites talk  \\ 19:23, 30 August 2015 (UTC)

Cumbril, shouldn't you be using only one localStorage entry for all IPs, that way they can easily be copied with localStorage.getItem and loaded back with localStorage.setItem, and when people inspect their localStorage instead of a hundreds of lbl entries, they will see only one entry from your script, hopefully clearly named so that it is clear that it is from your script; I don't know if that would be bad performance-wise. Also, I see that you are modifying Storage.prototype, but you shouldn't modify object you don't own, especially on Wikipedia where so many different people work with these object. Thanks. --V111P (talk) 20:03, 30 August 2015 (UTC)
 * I think saving everything into one entry would hurt performance. But yes, for copying purposes it would be good.
 * I'm modifying the Storage.prototype because there is no way to save objects into local storage, I think you are allowed to save only simple keys and values. Its a workaround because jquery.jStorage that has functionality for saving objects, causes loss of all data on logout (https://phabricator.wikimedia.org/T92937). Maybe now it behaves differently. This is my first ever Javascript script, I have many things to learn. Thanks for the tip. Cumbril (talk) 20:21, 31 August 2015 (UTC)