diff options
author | Nick White <git@njw.me.uk> | 2011-12-13 18:21:53 +0000 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2011-12-13 18:21:53 +0000 |
commit | 4d80602fe180c574a83a38a98ccbc8b656bfc2dc (patch) | |
tree | 7549f86ed69b046e98d3ea994e81a3a00e572e00 | |
parent | 22ee53465925b743bcd27778fdd67d36b8d4f4ae (diff) |
Only show <title> if no leading <h1> (thanks cls)
-rw-r--r-- | TODO | 6 | ||||
-rwxr-xr-x | simplyread.js | 6 |
2 files changed, 7 insertions, 5 deletions
@@ -1,10 +1,10 @@ -before 0.8 - firefox xul options as on chromium - before 1.0! consider license change to isc consider renaming to PlanedText +web: + websummary should show git clone - bug + core: disable all other scripts - lots of tracking horrors around now, e.g. h-online and nytimes have things which report back every time you click the mouse. diff --git a/simplyread.js b/simplyread.js index 15baf2b..3a00527 100755 --- a/simplyread.js +++ b/simplyread.js @@ -48,6 +48,9 @@ function simplyread(nostyle, nolinks) if (biggest_num == 0) return 1; + if (biggest_tag.childNodes[1].tagName != "H1") + biggest_tag.innerHTML = "<h1>"+doc.title+"</h1>"+biggest_tag.innerHTML; + /* save and sanitise content of chosen tag */ var fresh = doc.createElement("div"); fresh.innerHTML = biggest_tag.innerHTML; @@ -74,7 +77,6 @@ function simplyread(nostyle, nolinks) doc.body.innerHTML = "<style type=\"text/css\">" + (nostyle ? "" : srstyle) + "</style>" + - "<div id=\"sr\">" + "<h1>"+doc.title+"</h1>" + fresh.innerHTML + "</div>"; - + "<div id=\"sr\">" + fresh.innerHTML + "</div>"; return 0; } |