@xiee/utils 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/toggle-notes.js +4 -2
- package/package.json +1 -1
package/js/toggle-notes.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
if (!d.body.classList.contains('has-notes')) return;
|
|
3
3
|
const h = d.querySelector('.title > hr');
|
|
4
4
|
if (!h) return;
|
|
5
|
+
const s = sessionStorage.getItem('hide-notes');
|
|
5
6
|
h.classList.add('toggle-notes');
|
|
6
7
|
h.onclick = function(e) {
|
|
7
|
-
|
|
8
|
+
s === null && !/^(localhost|[0-9.]+)$/.test(location.hostname) &&
|
|
9
|
+
alert('你好像发现了个什么不得了的机关……请勿公开,自行享用即可,谢谢!');
|
|
10
|
+
s = d.body.classList.toggle('hide-notes');
|
|
8
11
|
try { sessionStorage.setItem('hide-notes', s); } catch (e) {};
|
|
9
12
|
};
|
|
10
|
-
const s = sessionStorage.getItem('hide-notes');
|
|
11
13
|
if (s !== null) d.body.classList.toggle('hide-notes', s === 'true');
|
|
12
14
|
})(document);
|