-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add SBS in edit mode, add on/off toggling #2
Conversation
Add the ability to edit existing questions/answers in side-by-side mode. Also, add the ability to toggle side-by-side editing on an off for each individual question/answer on the page.
I've tested this on all the pages I could think of and it seems to be working well. I'm not that familiar with javascript/jQuery though and I would definitely appreciate another pair of eyes on it. |
@szego firstly: thanks a lot! You must have spent some time doing that! :) Secondly: I will look at this over the weekend, looking at the code and result. It will probably work, but just to be safe! :) Thanks again! :) |
The "previewLength" variable in the sideBySideEditing() function was mistakenly declared as a global variable. It is now declared as local.
Add a require for version 1.7.1 of the minified jQuery. This is the version of jQuery used on SE pages. This script worked on Chrome prior to adding this require, but not on Firefox. Now it works on Firefox too. Also made a small change to the description to indicate that the script is meant to be used on sites on the Stack Exchange network.
Shift the "Toggle Side-By-Side Editing" 6px to the right. This fixes overlap with the "Redo" buttons on various sites on the SE network.
The jQuery object returned by $('[id=' + jNode[0].id + ']') will just be jNode. This fix makes that section of code more readable, at least.
1. Reduces the number of DOM searches that are done on each SBS toggle. 2. Tweak a few element locations to make the UI cleaner. 3. Introduce consistency with quotation marks in the code. Now, single quotes are used outside, and double quotes are used inside. This is the new format: 'this is a string with a "double quote part inside" of it' 4. This is pretty much a final update unless there are any unforeseen bugs that need to be squashed.
Use jQuery's toggleClass() function to toggle the various CSS changes for side-by-side mode. This allows all of the CSS changes to be organized nicely near the top of the script for easy changing. Previously the script used a boolean dictionary to keep track of which questions/answers were in side-by-side mode. This is no longer necessary. TODO: Fix "draft saved" bumping the side-by-side preview down on the Ask Question page.
Fixes the behavior of the preview pane on the Ask Question page. Before, the "draft saved" message would temporarily bump the preview pane down while it was visible. Now we swap the order of these messages and the preview pane to prevent this. Some extra css is added to help. Also, changes the name of the script from "Side By Side Editing" to "SE Side By Side Editing" to help with identification in the list of scripts in greasemonkey/tampermonkey.
Adds descriptive comments for the two functions in the code.
Minor fixes to the CSS specific to the "Ask Question" page.
refactor / major / Use toggleClass() to control SBS toggling
A few tweaks which were lost somehow. I don't really know how to use GitHub Desktop yet.
Thanks for that update @szego. I've merged it! :) |
Add SBS in edit mode, add on/off toggling
BTW I also use this feature in my https://github.com/shu8/SE_OptionalFeatures userscript. I'll update that with this version as well! :) I've done so on my local copy, but I'm ironing out a few other bugs I've got with that before I push it to the develop branch :) |
Great :). Would you mind if I add an answer to your post in StackApps to describe the new behavior? |
Sure! It's your code ;) (Just mention that it starts in v1.7 please!) |
Sorry -- I thought you were talking about the SE Optional Features one, but yeah -- you can post it on http://stackapps.com/questions/6461/side-by-side-editing, which I think you were actually talking about! |
@szego I've updated my SE Additional Optional Features userscript! It's now in v1.7 (DEV) :) Thanks again! |
Add the ability to edit existing questions/answers in side-by-side mode.
Also, add the ability to toggle side-by-side editing on an off for each
individual question/answer on the page.