Skip to content

Commit 3e444da

Browse files
committed
remove hide0 functionality (please use details/summary tags and set/clear open attribute)
1 parent 2a42610 commit 3e444da

File tree

2 files changed

+4
-36
lines changed

2 files changed

+4
-36
lines changed

README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,12 @@ Therefore I generally write English text in ASCII, and use this Javascript code
1818
to assess the level of browser support before making substitutions.
1919
If Javascript is not available then my site should still be readable in ASCII.
2020

21-
Other things this script does
22-
-----------------------------
23-
24-
While the main point of this script is typography, it also provides:
25-
26-
* an `onclick` function for every `abbr` tag (helps in touchscreen situations
27-
with no mouse if you're using `<abbr title="...">`)
28-
29-
* a function to 'collapse' parts of the page and replace it with
30-
a "Show details" link (this is deprecated because we should be
31-
using modern HTML's `<details>` and `<summary>` instead)
32-
21+
While the main point of this script is typography, it also provides
22+
an `onclick` function for every `abbr` tag (helps in touchscreen situations
23+
with no mouse if you're using `<abbr title="...">`).
3324
Again if Javascript is not available then this is simply not done; the page
3425
should still be readable.
3526

36-
Deprecated collapse function: call `hide0(id)` after loading
37-
`typography.js` (see below), where `id` is the `id=` attribute of your
38-
collapsible.
39-
4027
Usage
4128
-----
4229

typography.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @license magnet:?xt=urn:btih:8e4f440f4c65981c5bf93c76d35135ba5064d8b7&dn=apache-2.0.txt Apache-2.0
22
// (the above comment is for LibreJS)
33

4-
// Web page typography helper v1.57 (c) 2011-2014,2016,2019-2024 Silas S. Brown.
4+
// Web page typography helper v1.58 (c) 2011-2014,2016,2019-2024 Silas S. Brown.
55

66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -109,25 +109,6 @@ if(document.getElementsByTagName && navigator.userAgent.indexOf("Googlebot/")==-
109109
}
110110
} fix_typography();
111111

112-
function hide0(id) {} // no-op unless we can do:
113-
if(document.getElementsByClassName && navigator.userAgent.slice(-6)!='Gecko/') { // 'Gecko/' at the end is presented to JS by UC Browser's transcoder, which lets you set v.OIH but then forgets it by the time show0 is called, so don't do it
114-
function _h(v) {
115-
if(location.hash) {
116-
if(location.hash=="#"+v.id) return; // don't collapse if using id from an off-page link
117-
var p=v.previousSibling; if(p && p.nodeType==1 && p.nodeName.toLowerCase()=='a' && location.hash=="#"+p.getAttribute("name")) return; // or if using <a name=".."></a> immediately before (for backward compatibility with browsers that can't jump to an id) and we jumped to that
118-
}
119-
if(v.innerHTML) { v.OIH=v.innerHTML; if(v.OIH==v.innerHTML) {
120-
// looks like we have the browser support we need to collapse
121-
var txt=v.getAttribute("data-txt"),opt=v.getAttribute("data-opt"),c1="",c2="";
122-
if(opt=="centre") { c1="<center>"; c2="<"+"/center>"; }
123-
var inline = (opt=="inline" || opt=="inline-ftn");
124-
if(!txt) txt="Show details";
125-
v.innerHTML=c1+"<a href=\"#"+v.id+"\" onClick=\"javascript:var v=document.getElementById('"+v.id+"'); v.innerHTML=v.OIH; v.style=v.OS; "+(opt=="inline-ftn"?"window.scrollTo(0,document.body.scrollHeight);v.scrollIntoView();v.parentElement.style='font-size:1em';":"")+"if(v.getElementsByTagName){var abbrs=v.getElementsByTagName('abbr');for(var i=0;i<abbrs.length;i++)abbrs[i].onclick=Function('alert(this.title)')}return false;\">"+typefix(txt)+"<"+"/a>"+c2;
126-
v.OS=v.style; if(!inline)v.style="display:block!important"
127-
} }
128-
} hide0=function(id){_h(document.getElementById(id));}
129-
}
130-
131112
if(document.getElementsByTagName){var abbrs=document.getElementsByTagName('abbr');for(var i=0;i<abbrs.length;i++)abbrs[i].onclick=Function("alert(this.title)")}
132113

133114
// @license-end

0 commit comments

Comments
 (0)