Script Summary: Adds markup buttons above the Body text area. Enables hotkeys for previewing/posting. Fixes the "space problem" in long URLs.
Version: 2011.05.07
Copyright: 2009-2012 Chicago_gangster (http://userscripts.org/users/67626)
License: Creative Commons BY-NC-ND 3.0, http://creativecommons.org/licenses/by-nc-nd/3.0/
Markup
Clicking the buttons or the drop-down list items will insert markup tags inside the Body text area. If no text was selected, the cursor will be placed between the opening & closing tags. If text was selected inside the Body text area, the tags will wrap the selection and the cursor will be placed after the closing tag.If text was selected outside the Body text area (in the recipient's post), clicking
[Quote] will carry the selection down and wrap it in quote tags, which means you don't have to copy & paste any sentences you're replying to.Using the
[URL] will automatically remove the useless parts of the URL (such as "http://www." or "index.html") and accidentally entered or selected line breaks and leading & trailing spaces. At that you don't necessarily have to paste the URL, then select it and click the button – you may paste the URL after clicking the button! Clicking it inserts an empty set of markup tags, like in the case of other buttons, but in this case it also activates a "trap" which awaits the pasted URL, then trims it and places the cursor after the closing tag, [/url]. This method is shorter (I've written it specifically for this button).URL lists are also handled properly! That is, if you want to post something like this, you don't have to make each URL clickable separately. Click the button and paste the whole list at once (or select the whole list, then click the button) – the script will do the job for you.
To make other people's URLs clickable install the Linkification extension. (It offers 2 choices: double-click the unlinked URL to visit it or automatically convert it to a clickable link.)
The
[List] functions process title/name lists: they make a list clickable (in the same way as URL lists) or search the whole list at once (in multiple new windows). The former is useful for sharing a list, the latter is useful for receiving one. Browse the Lists & Recommendations board and you'll get the idea.To make a list clickable, select it in your post and click
[List] => [L tt/nm] (generate title/name search links). To search someone else's list (or, again, make it clickable if needed), click "reply" on their post, select the list and click [List] => [S tt/nm] (search titles/names in new windows).Searching a single title/name is easier with the SearchIMDB extension.
Instant preview is available for the emoticons: when you hover the mouse over them in the
[Emoticons] drop-down list, the corresponding emoticon itself appears in the markup bar for previewing. (This doesn't work in Opera for some reason.)The
[Special] drop-down list consists of several special characters and a link to the full list. Whether any special characters can be posted or not depends on the IMDb and your browser. To check it, simply copy & paste a character into your message and click Preview (if it can't be posted, it will be converted into its numeric code). The ones included by default in the drop-down list (plus all characters on the "more" page) can be posted via Firefox but some of them can't be posted via Opera.The content of the drop-down lists (
[Colors], [Emoticons], [Special] ) can be modified by editing the script – I've placed them at the top of the code. See the inline comments for details.Changing the design to "IMDb" (the second screenshot) or back:
Firefox: Via the menu (when the script is active):
Tools => Greasemonkey =>=>
User Script Commands => IMDb Boards: markup bar designOther browsers: You need to manually edit the script, find this line (it's at the top of the code):
IMDb_design = false;and replace
false with true (or vice versa if you want to change it back).Hotkeys
If you are an advanced PC user and therefore like using the keyboard (hotkeys) instead of the mouse whenever possible, this script is for you. It saves your time when posting/editing messages and sending private messages.[Ctrl] + [Shift] = Set focus on the Body text area (1)[Ctrl] + [Enter] = Preview the message (2)[Ctrl] + [Shift] + [Enter] = Post the message or send the PM(1) if the cursor isn't inside the Subject line
(2) the cursor must be inside the Body text area or the Subject line
A hint for newbies: when the cursor is inside the Body text area, use Windows' built-in hotkeys.
[Ctrl] + [Home/End] moves the cursor to the beginning/end of the text; [Ctrl] + [←/→] moves the cursor left/right word by word (rather than character by character); as a result, [Ctrl] + [Shift] + [←/→] selects text word by word (rather than character by character when using just [Shift] + [←/→]) for deletion/replacement. (For this reason, I block switching focus from the Subject line to the Body text when pressing [Ctrl] + [Shift].)Other
Automatically sets focus on the Body text area when the page loads (but excludes message preview pages in order to prevent auto-scrolling down to the Body text area).Fixes IMDb's "space problem" in long URLs. If the length of a URL in your post is over 70 chars, clicking "edit" inserts a space in it. If you forget to remove it before applying the edit, the link breaks. This script will remove the space automatically.
IMDb's "(markup enabled)" link on New topic and New PM pages will open in a new window (to prevent loss of the composed message), just like on Reply and Edit pages.
Tested in Opera (see installation instructions) and Firefox.
Feedback


