Closed
Bug 507822
Opened 15 years ago
Closed 15 years ago
Plain Text files do not word wrap in the browser
Categories
(Firefox :: General, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 253564
People
(Reporter: danweiss, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729)
Whenever you view a Plain Text file with long lines in the browser, you need to horizontally scroll to read the rest of the lines. This is not acceptable.
Currently, the only way to get word wrap for plain text files is to View Source, but that requires creating a new window.
Reproducible: Always
Comment 1•15 years ago
|
||
confirmed - practically all versions forever.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Workaround bookmarklet (right-click Bookmarks Toolbar -> New Bookmark... name it Wrap, and paste the following line into the Location box in that dialog):
javascript:{var x, c; x = document.body.innerHTML; if (x.substr(0, 5) + x.substr(x.length - 6, 6) == '<pre></pre>') {document.write('<HTML><BODY>\n'); x = x.substr(5, x.length - 11); var textline = x.split('\n'); for (c = 0; c < textline.length; c++) {document.write(textline[c] + '<br>\n')}; document.write('</BODY></HTML>'); document.close();}}
Then you can just click the "Wrap" bookmarklet in the toolbar when you are on a plain text page.
This is just copied from http://returnofthesasquatch.blogspot.com/2007/03/word-wrap-for-firefox-bookmarklet_17.html so if anyone can make the code more elegant, feel free to add it here.
Here's a shorter version:
javascript:void(document.getElementsByTagName('pre')[0].style.whiteSpace='pre-wrap')
An even shorter version:
javascript:void(document.body.firstChild.style.whiteSpace='pre-wrap')
It occurred to me you might want to reverse this without reloading, for that create another bookmarklet and name it 'refresh' and for the location put:
javascript:history.go(0)
Updated•15 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•