Opera 12 style source editor
I miss the simple source editor from Opera 12 so I made a bookmarklet that gives me the most important bit of the feature. Can't post the link as is on this forum so made my own page for it:
ability to activate with a keyboard shortcut
ability to save directly back to a local file
Is any of that possible?
Great job, that's a really handy tool. I like it.
Can you implement this for syntax highlighting?
I couldn't get that exact syntax highlighter to work but I've managed to botch something together. The script now overlays an almost transparent text area on top of a styled <pre> element that is updated as you type.
The code uses regexp to highlight various parts of the code as follows, this matches what O12 picks up, including mirroring O12's bugs!:
@Orinoco You can assign a shortcut in Settings, Keyboard, Window, to View page source.
Yep, but that only allows you to activate Chromium's read only source viewer. What I'd need is a way to bind a keyboard shortcut to a bookmarklet.
@Orinoco Do not use Regex to parse HTML!
It will not catch all valid HTML.
That Regex will sometimes fail.
Normally I'd agree with you, but this is a source editor. Running html found in the wild through an html parser then reading back the result is very highly likely to produce html that doesn't match the original source.
Also while Chromium has a much higher limit some browsers are limited to urls 2083 characters in length (this bookmarklet is currently 1655 characters). Implementing a js based html parser is going to add a lot more code.