The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,797 other followers

Chrome “Developer Tools” to the rescue. Literally: to salvage a pending forum post.

Posted by jpluimers on 2016/06/02

Lessons learned

  1. Don’t trust online text entry.
  2. Always compose answers in an external text editor, preferably one that understands the markup used (Atom often is a good choice).
  3. Post when ready.
  4. Wonder why every forum software seems to have invented their own markup.

The story

A few weeks ago, while composing an extensive answer on the Scooter Software: Home of Beyond Compare (a tool which – like any development tool – I really love, but sometimes hate): Keyboard handling driving me nuts: how to make it work like BC for Windows, I pressed the “Image” button which:

  1. Made all the edited text to dim and non-selectable
  2. Failed an image selection to show

It was more than an hour of work, so I was determined to try obtaining at least the post text.

The salvage process

I started the Chrome “Developer Tools” drilling down the elements to see where the HTML was containing the edited text. It took a while to drill through layers, nested divs, spans and tables but I finally found they use vBulletin Quick Reply editor having these nested elements:

Often a textarea does not have content text and this case proved no exception. The QuickReply editor had to store the content somewhere and my first guess was in the Chrome DOM. Luckily I found out the Developer Tools give can access the value property through the DOM using the console. And textarea has a DOM counterpart HTMLTextAreaElement with a value property containing the ext.

With the console.dir method, you can dump the whole element (you can also use console.log but it can behave differently).

Anyway: this was the salvage code:

console.dir(document.getElementById("cke_contents_vB_Editor_QR_editor").firstChild.value);

To BBcode or almost BBcode

Since vBulletin uses a markup similar to  BBcode as markup (boy why did about every forum software invent their own markup…), and there is a bbcode language plugin for Atom (use the .bb or .bbcode file extensions to activate it; be prepared for some quoting deficiencies) I finished the post in Atom, then tried to submitted it.

Big mistake: vBulletin BBcode is too far from “real” BBcode, so I finally posted on gist, then put the URL on the forum.

So I did ask around how to install bbcode-preview, but didn’t install it.

If you need it, here is how to install it (thanks @xenoveritas):

‏@jpluimers: @xenoveritas how can I install https://github.com/Xenoveritas/bbcode-preview in atom?

@xenoveritas: @jpluimers Assuming it still works, check it out into the “packages” directory of your Atom config folder

‏@xenoveritas: @jpluimers Oh, that won’t work. You can use the “apm” command line program to do it but… be warned you need a compiler.

‏@xenoveritas: @jpluimers Should be “apm install Xenoveritas/bbcode-preview”

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: