-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make suggest questions mode persistent (issue #88) #89
Conversation
I added a couple more commits: |
One thing that needs to be fixed with my code is I am using unscoped keys for localStorage. I had not realized it was shared with page for content scripts. It probably needs to be prefixed. |
Yes, all stored data should be properties on localStorage.okcp. I also use, On Tue, Jun 17, 2014 at 5:46 PM, David Rees notifications@github.com
Ben Jaffe • Developer, Instructor, GeekSpeak, KUSP LinkedIn https://www.linkedin.com/in/benjaffe |
@studgeek , for adding keys, check out the util I wrote for it -- https://github.com/benjaffe/chrome-okc-plugin/blob/master/plugin/storage.js _OKCP.storage('messages') // getter
_OKCP.storage('messages', myVar) // setter |
Agreed on everything, good suggestions (and consistency is always important). Will also move it to using its own on/off flag rather than devMode as you suggested elsewhere. I will post comment once I have applied the suggested changes. |
Sweet, thanks David -- you rock! On Fri, Jun 20, 2014 at 7:05 PM, David Rees notifications@github.com
Ben Jaffe • Developer, Instructor, GeekSpeak, KUSP LinkedIn https://www.linkedin.com/in/benjaffe |
…e. Enable/disable by setting to "true" in console using localStorage.setItem("okcpDevMode","true")
…ds cleanup, but shows the idea. It makes the following changes: - Suggestions are stored in localStorage. So they persist across refreshes and sessions. - Persisted suggestions can be cleared with Clear Suggestions button. - Suggest Question is shown for all questions (when enabled) to make it easy to suggest questions for new categories. - The list of existing categories for each question is shown. - Gets rid of all the dialogs, including the verification dialogs and the category dialogs. The user is expected to read wiki and know what they are doing. - Categories are no longer shown in the suggested text. Instead the user is asked to group by them in their email. With an update in the wiki page I think this will work better. The grouping by category is very simple now in the new style. - Includes a link back to wiki to explain how to use it. Work still to do: - Suggest questions is not shown when moving to a new page. This is because the extension currently doesn't catch page transitions (it only loads on a new page). The workaround is to simply refresh the page. Since the state is persisted they are all there after refreshing. - Style cleanup (including introducing constants and some refactoring)
…ake the JSOB object Uses JSON. stringify space argument as suggested by @benjaffe
… no their answer). Fixes answerText, score, weight.
…tMode to enable/disable by setting to "true" in console using localStorage.setItem("okcpSuggestMode","true") Instead of using new-feature CSS, just don't run the suggest question logic at all when not in suggest mode (saves cycles).
Ok, I think I have all the suggested changes in there. Plus a few more tweaks. FYI, I rebased it to clean up commit history a bit. |
Make suggest questions mode persistent (issue #88)
@studgeek , Can you update the wiki to describe how users suggest questions? I already have a page you can modify. Also, I'm having trouble getting the buttons to show up, even though; localStorage.okcpDevMode === "true" //true I should see the buttons on the questions pages right? I'm not seeing them either on other users' questions pages, or my own. Any ideas? |
Sorry I didn't see your comment until now. I have updated the wiki with the updated instructions. And suggest mode is working for me in the master branch. Once I run |
Actually, I found a small bug. The Clear Questions button was not visible. |
Pull request #104 makes the Clear Questions button visible. I updated the wiki with that info. |
Cool! Yeah, I was just missing localStorage.okcpSuggestQuestions . Awesome, thank you! It'll be published within an hour. |
The original suggestQuestions code generates a "weight" array, but I don't see it used in the questions files. Is weight no longer used and should I take it out of suggestQuestions? |
It's definitely used for some questions. I didn't integrate it fully in Sent from my phone, so excuse the brevity.
|
First rough draft at making suggestions persistent (suggestion #88). Its rough and needs cleanup, but shows the idea.
It makes the following changes:
Work still to do: