Skip to content
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 a bb-code "editor" toolbar next to the textareas on the bbs thread and prod pages #13

Merged
merged 7 commits into from Sep 24, 2013

Conversation

AMcBain
Copy link
Contributor

@AMcBain AMcBain commented Sep 2, 2013

Added some code to the end of script.js, and styles necessary for it to look good to style.css, for displaying a list of 'editor' buttons for bb-code to the right of the textarea on BBS and prod pages. This code is based on the 'Pouet bb-codeizer for winnars!' user script but refactored for slightly cleaner code, and formatting that better matches what already exists in script.js. It does not include the automatic 'by line' insertion code and other non-editor-essential code from the user script.

Requires images from http://asmcbain.net/projects/pouet.net/bb_editor.zip to be placed in a directory called bb_editor inside the gfx directory on the Pouet content subdomain.

@AMcBain
Copy link
Contributor Author

AMcBain commented Sep 2, 2013

Oh yeah ... the images in the zip are from the Fugue icon set ( http://p.yusukekamiyamane.com/ ) under the CC-BY 3.0 license, so a link should go somewhere. If you do use the icons in that zip, putting an attribution in the CSS file or something would probably be a good idea.

@Gargaj
Copy link
Member

Gargaj commented Sep 2, 2013

I'll take a look soon - I'd prefer if it was imageless, etc.

@AMcBain
Copy link
Contributor Author

AMcBain commented Sep 2, 2013

Could you please enlighten me as to why you would prefer that? :) It would be relatively obtuse to represent the items in the toolbar as one or two characters of text, and it would be rather wide if I used the full names. The user script used data-uris so that it could be portable without being tied to a location like my own server. I don't like that solution because it increases the size of the script by a non-insignificant amount and using real images makes it easier to update them at a future date without needing to go base64-encode them then dig through code for the actual replacement.

@AMcBain
Copy link
Contributor Author

AMcBain commented Sep 2, 2013

or if it was about having to go update something else, this would also have been easier if the images were in a repo so the pull request could do it all in one go. ;)

@AMcBain
Copy link
Contributor Author

AMcBain commented Sep 7, 2013

Added support for the URL-fixing stuff from the user script and also pulled in all the updates from the original repository since I had originally created this pull request. Should look like now(pouet2.0) + 3 commits.

…to look good to style.css, for displaying a list of 'editor' buttons for bb-code to the right of the textarea on BBS and prod pages. This code is based on the 'Pouet bb-codeizer for winnars!' user script but refactored for slightly cleaner code, and formatting that better matches what already exists in script.js. It does not include the automatic 'by line' insertion code and other non-editor-essential code from the user script.
…ssured to only activate for the bbs new post and prod new post forms as not all textareas may be for things accepting bb-code. The code could do a dynamic check for the 'BB Code is allowed here' note, but that would be potentially fragile.
…be a URL when using the regular link button but are missing a protocol are 'upgraded' to a link-with-text so the fixed URL ('http://' + text) becomes the argument, and the originally written text is the text content. When using the link-with-text button, since the original text is only used for the URL argument it just prepends 'http://'. Otherwise it works the same as before.
…o it can be used when creating a new thread.
…ut (ignoring leading spaces) so text with embedded URLs don't qualify. This prevents some ugly output and makes it a bit more friendly to doing things like selecting an [img] bb-code then clicking the 'link with text' button to wrap it with a link.
… the 'BB-Code is supported here' note. All items are text and appear as links. No icons. They still have the same auto-magic behavior as the user script it was based on. The e-mail item is also removed, for lack of support in Pouet (it just displays as [email]foobar[/email] regardless of the contents) and items can now be tagged with 'more' to indicate they should appear in the menu at the end.
@AMcBain
Copy link
Contributor Author

AMcBain commented Sep 24, 2013

Commit 0891eaf 's commit message didn't cover everything that set of changes does and it really probably should have been separate commits ... so it also:

  • fixed a bug due to incomplete removal of the "newl" feature which would cause some buttons to behave oddly
  • removed the e-mail button

(I did a rebase after I committed that and pushed it so I'm not sure if I can do a --amend, plus not really good idea to push -f such a thing now that it's visible here.)

@AMcBain
Copy link
Contributor Author

AMcBain commented Sep 24, 2013

Oh yeah, also, with the conversion to text links the linked zip in the top message of this pull request (which contains images) is no longer needed. (The images in that zip are also out of date; with the removal of the white background behind the items the images are too dark.)

…th a margin-left. The prod pages can have a wider main content area than that used by the bbs input comment/thread textarea box due to comments with long parapgrahs and the end of the editor list would appear relatively far away from the textarea. Now it should always be almost completely under the textarea and still not wrap, with the current set of visible links. If those change it should probably be updated, so that for the new thread and new post in a thread (not prod) the set of text is lined up to the right of the default textarea size and further away from the 'BB Code is allowed here' message.
@Gargaj
Copy link
Member

Gargaj commented Sep 24, 2013

Yeah this'll do.

Gargaj added a commit that referenced this pull request Sep 24, 2013
Add a bb-code "editor" toolbar next to the textareas on the bbs thread and prod pages
@Gargaj Gargaj merged commit 1742cba into pouetnet:master Sep 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants