Skip to content

Commit 31812d3

Browse files
committed
f
1 parent 9cee224 commit 31812d3

File tree

4 files changed

+79
-12
lines changed

4 files changed

+79
-12
lines changed

theme/ai.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
(() => {
77
try {
88
const host = window.location.hostname;
9-
if (host === "localhost" || host === "127.0.0.1") return;
9+
const port = window.location.port;
10+
if (
11+
host === "localhost" ||
12+
host === "127.0.0.1" ||
13+
port === "3377"
14+
) return;
1015
} catch (e) {}
1116
const KEY = 'htSummerDiscountsDismissed';
1217
const IMG = '/ima * HackTricks AI Chat Widget v1.17 – enhanced resizable sidebar

theme/index.hbs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{{/if}}
3333

3434
<!-- Fonts -->
35-
<link rel="stylesheet" href="{{ path_to_root }}FontAwesome/css/font-awesome.css">
35+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
3636
{{#if copy_fonts}}
3737
<link rel="stylesheet" href="{{ path_to_root }}fonts/fonts.css">
3838
{{/if}}
@@ -60,15 +60,6 @@
6060
</script>
6161
<!-- Start loading toc.js asap -->
6262
<script src="{{ path_to_root }}toc.js"></script>
63-
<script type="text/javascript">
64-
(function () {
65-
var bsa_optimize = document.createElement('script');
66-
bsa_optimize.type = 'text/javascript';
67-
bsa_optimize.async = true;
68-
bsa_optimize.src = 'https://cdn4.buysellads.net/pub/hacktricks.js?' + (new Date() - new Date() % 600000);
69-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(bsa_optimize);
70-
})();
71-
</script>
7263
</head>
7364
<body>
7465
<div id="body-container">
@@ -324,6 +315,12 @@
324315
<div class="bsa-crawler-slot" aria-hidden="true">
325316
<div id="bsa-zone_1773065859037-5_123456"></div>
326317
</div>
318+
<div class="bsa-pageviews-slot" aria-hidden="true">
319+
<div id="bsa-zone_1770368463-7_123456"></div>
320+
</div>
321+
<div class="bsa-fixedfooter-slot" aria-hidden="true">
322+
<div id="bsa-zone_1770367111944-8_123456"></div>
323+
</div>
327324
</main>
328325

329326
<nav class="nav-wrapper" aria-label="Page navigation">

theme/pagetoc.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,24 @@
345345
pointer-events: none;
346346
}
347347

348+
.bsa-pageviews-slot {
349+
position: absolute;
350+
width: 1px;
351+
height: 1px;
352+
overflow: hidden;
353+
opacity: 0;
354+
pointer-events: none;
355+
}
356+
357+
.bsa-fixedfooter-slot {
358+
position: absolute;
359+
width: 1px;
360+
height: 1px;
361+
overflow: hidden;
362+
opacity: 0;
363+
pointer-events: none;
364+
}
365+
348366
@media only screen and (min-width: 0px) and (min-height: 0px) {
349367
#bsa-zone_1773736844679-9_123456 {
350368
min-height: 100px;
@@ -358,6 +376,14 @@
358376
min-height: 1px;
359377
}
360378

379+
#bsa-zone_1770368463-7_123456 {
380+
min-height: 1px;
381+
}
382+
383+
#bsa-zone_1770367111944-8_123456 {
384+
min-height: 1px;
385+
}
386+
361387
#bsa-zone_1773737041447-5_123456 {
362388
min-height: 0px;
363389
}
@@ -375,6 +401,14 @@
375401
#bsa-zone_1773065859037-5_123456 {
376402
min-height: 1px;
377403
}
404+
405+
#bsa-zone_1770368463-7_123456 {
406+
min-height: 1px;
407+
}
408+
409+
#bsa-zone_1770367111944-8_123456 {
410+
min-height: 1px;
411+
}
378412
}
379413

380414
@media only screen and (min-width: 880px) and (min-height: 0px) {

theme/sponsor.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
var sponsorCTA = sponsorSide && sponsorSide.querySelector(".sponsor-cta")
88
var sponsorSideBsa = document.querySelector(".sidesponsor-bsa")
99
var topSponsorBsa = document.querySelector(".topsponsor-bsa")
10+
var crawlerSlot = document.querySelector(".bsa-crawler-slot")
11+
var pageviewsSlot = document.querySelector(".bsa-pageviews-slot")
1012

1113
var bottomSponsor = document.querySelector(".bottomsponsor")
1214
var bottomSponsorImg = bottomSponsor && bottomSponsor.querySelector("img")
@@ -23,12 +25,18 @@
2325
!bottomSponsor ||
2426
!sponsorSideBsa ||
2527
!topSponsorBsa ||
28+
!crawlerSlot ||
29+
!pageviewsSlot ||
2630
!bottomSponsorBsa
2731
) {
2832
return
2933
}
3034

3135
var BSA_SCRIPT_BASE = "https://cdn4.buysellads.net/pub/hacktricks.js"
36+
var BSA_FIXED_LEADERBOARD_FALLBACK = {
37+
brokenId: "bsa-zone_1773065859037-5_123456",
38+
actualId: "bsa-zone_1770367111944-8_123456",
39+
}
3240
var bsaScriptPromise
3341

3442
function getBsaScriptSrc() {
@@ -49,14 +57,35 @@
4957
}
5058

5159
bsaScriptPromise = new Promise(function(resolve, reject) {
60+
var originalMapGet = Map.prototype.get
61+
var restoreMapGet = function() {
62+
Map.prototype.get = originalMapGet
63+
}
64+
65+
Map.prototype.get = function(key) {
66+
if (
67+
key === BSA_FIXED_LEADERBOARD_FALLBACK.brokenId &&
68+
!this.has(key) &&
69+
this.has(BSA_FIXED_LEADERBOARD_FALLBACK.actualId)
70+
) {
71+
return originalMapGet.call(this, BSA_FIXED_LEADERBOARD_FALLBACK.actualId)
72+
}
73+
74+
return originalMapGet.call(this, key)
75+
}
76+
5277
var bsaOptimize = document.createElement("script")
5378
bsaOptimize.type = "text/javascript"
5479
bsaOptimize.async = true
5580
bsaOptimize.src = getBsaScriptSrc()
5681
bsaOptimize.onload = function() {
82+
restoreMapGet()
5783
resolve(bsaOptimize)
5884
}
59-
bsaOptimize.onerror = reject
85+
bsaOptimize.onerror = function(error) {
86+
restoreMapGet()
87+
reject(error)
88+
}
6089
;(
6190
document.getElementsByTagName("head")[0] ||
6291
document.getElementsByTagName("body")[0]
@@ -146,13 +175,15 @@
146175

147176
async function loadBsaSponsor() {
148177
bottomSponsorBsa.style.display = "block"
178+
149179
if (window.matchMedia("(min-width: 880px)").matches) {
150180
sponsorSideBsa.style.display = "block"
151181
topSponsorBsa.style.display = "none"
152182
} else {
153183
sponsorSideBsa.style.display = "none"
154184
topSponsorBsa.style.display = "block"
155185
}
186+
156187
await ensureBsaScript()
157188
}
158189

0 commit comments

Comments
 (0)