Commit | Line | Data |
---|---|---|
c2614688 MW |
1 | From 2e8618d22568b6e00892a17303d437dd700eca98 Mon Sep 17 00:00:00 2001 |
2 | From: Mark H Weaver <mhw@netris.org> | |
3 | Date: Tue, 5 May 2020 21:27:41 -0400 | |
4 | Subject: [PATCH] Revert "Update Reveal hidden HTML." | |
5 | ||
6 | I prefer the user interface of the old version. | |
7 | ||
8 | This reverts commit f6e3adb6b2344ee2c7bb453a305fd2d6fb4c194c. | |
9 | --- | |
10 | .../passive_improve_css.js | 23 ++++++++++++++----- | |
11 | 1 file changed, 17 insertions(+), 6 deletions(-) | |
12 | ||
13 | diff --git a/data/extensions/SubmitMe@0xbeef.coffee/passive_improve_css.js b/data/extensions/SubmitMe@0xbeef.coffee/passive_improve_css.js | |
14 | index 7692990..ca57982 100644 | |
15 | --- a/data/extensions/SubmitMe@0xbeef.coffee/passive_improve_css.js | |
16 | +++ b/data/extensions/SubmitMe@0xbeef.coffee/passive_improve_css.js | |
17 | @@ -10,6 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI | |
18 | */ | |
19 | ||
20 | ||
21 | +var bad = []; | |
22 | + | |
23 | function escapeHTML (unsafe_str) { | |
24 | return unsafe_str | |
25 | .replace(/&/g, '&') | |
26 | @@ -20,9 +22,14 @@ function escapeHTML (unsafe_str) { | |
27 | .replace(/\//g, '/') | |
28 | } | |
29 | ||
30 | +function dounhide(){ | |
31 | + for(var i = 0; i < bad.length; i++){ | |
32 | + bad[i].remove(); | |
33 | + } | |
34 | +} | |
35 | + | |
36 | console.log("passive_improve_css.js"); | |
37 | function reveal_css(){ | |
38 | - var bad = []; | |
39 | ||
40 | var elements = document.getElementsByTagName("style"); | |
41 | for(var i = 0; i < elements.length; i++){ | |
42 | @@ -41,16 +48,20 @@ function reveal_css(){ | |
43 | ||
44 | } | |
45 | } | |
46 | - if(bad.length > 0 && window.confirm("Hidden HTML detected, would you like to reveal it?")){ | |
47 | - for(var i = 0; i < bad.length; i++){ | |
48 | - bad[i].remove(); | |
49 | - } | |
50 | + if(bad.length > 0){ | |
51 | + const insertedDiv = document.createElement('div'); | |
52 | + insertedDiv.innerHTML= '<p id="unhide" class="button white" style="text-decoration:none!important; color:#000!important; font-size:1em !important; font-family:\'sans-serif\'!important; font-weight:normal !important; background-color:transparent!important; margin:0!important; padding:0!important; font-size:10px!important; line-height:1!important"' + | |
53 | + 'alt="Click to reveal hidden elements in this page">' + | |
54 | + '<span>Reveal hidden elements</span>' + | |
55 | + '</a>'; | |
56 | + insertedDiv.style="position:fixed; bottom:1em; right:1em; opacity:0.8; z-index: 2147483647 !important; border-radius: 3px !important; background-color: #fff !important; padding: 0.5em !important; box-shadow: 0 0 3px grey !important; font-color:#bbb!important; cursor: pointer!important;"; | |
57 | + insertedDiv.addEventListener("click", dounhide, false); | |
58 | + document.body.insertBefore(insertedDiv, document.body.firstChild); | |
59 | } | |
60 | } | |
61 | ||
62 | reveal_css(); | |
63 | ||
64 | - | |
65 | /* | |
66 | var a = document.getElementsByTagName("style")[2]; | |
67 | var btn = document.createElement("style"); // Create a <button> element | |
68 | -- | |
69 | 2.26.2 | |
70 |