Skip to content

Commit 4b6f006

Browse files
committed
Script_2.js diagrams test
1 parent d62af13 commit 4b6f006

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

web/script_2.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,18 @@ const DIAGRAM_6_B =
132132
// isFontAvailable:
133133
(function(d){function c(c){b.style.fontFamily=c;e.appendChild(b);f=b.clientWidth;e.removeChild(b);return f}var f,e=d.body,b=d.createElement("span");b.innerHTML=Array(100).join("wi");b.style.cssText=["position:absolute","width:auto","font-size:128px","left:-99999px"].join(" !important;");var g=c("monospace"),h=c("serif"),k=c("sans-serif");window.isFontAvailable=function(b){return g!==c(b+",monospace")||k!==c(b+",sans-serif")||h!==c(b+",serif")}})(document);
134134

135-
if (!isFontAvailable('Menlo')) {
136-
$(`code:contains(${DIAGRAM_1_B})`).html(DIAGRAM_1_A);
137-
$(`code:contains(${DIAGRAM_6_B})`).html(DIAGRAM_6_A);
138-
$(`code:contains(${DIAGRAM_2_B})`).html(DIAGRAM_2_A);
139-
$(`code:contains(${DIAGRAM_3_B})`).html(DIAGRAM_3_A);
140-
$(`code:contains(${DIAGRAM_4_B})`).html(DIAGRAM_4_A);
141-
$(`code:contains(${DIAGRAM_5_B})`).html(DIAGRAM_5_A);
142-
// var htmlString = $('code:contains(ᴺᴱᵂ)').html().replace(/ᴺᴱᵂ/g, '');
143-
// $('code:contains(ᴺᴱᵂ)').html(htmlString);
144-
}
135+
$(document).ready(function() {
136+
if (!isFontAvailable('Menlo')) {
137+
$(`code:contains(${DIAGRAM_1_B})`).html(DIAGRAM_1_A);
138+
$(`code:contains(${DIAGRAM_2_B})`).html(DIAGRAM_2_A);
139+
$(`code:contains(${DIAGRAM_3_B})`).html(DIAGRAM_3_A);
140+
$(`code:contains(${DIAGRAM_4_B})`).html(DIAGRAM_4_A);
141+
$(`code:contains(${DIAGRAM_5_B})`).html(DIAGRAM_5_A);
142+
$(`code:contains(${DIAGRAM_6_B})`).html(DIAGRAM_6_A);
143+
// var htmlString = $('code:contains(ᴺᴱᵂ)').html().replace(/ᴺᴱᵂ/g, '');
144+
// $('code:contains(ᴺᴱᵂ)').html(htmlString);
145+
}
146+
});
145147

146148
var isMobile = false;
147149
// Device detection:

0 commit comments

Comments
 (0)