Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6889c9f

Browse files
committed
Move code functions to separate file, to prevent corruption by respec
1 parent 4f15d22 commit 6889c9f

3 files changed

Lines changed: 51 additions & 57 deletions

File tree

code.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
function addExamples (styleName, lang, dir, type) {
2+
// draws the "Output in your browser" boxes.
3+
// type is one of 'vshort' (stops after 22), or short (stops after 44)
4+
if (typeof type === 'undefined') type = 'full'
5+
6+
var out = ''
7+
out += `<p class="browser_output_title">Output in your browser:<a style="float:right" href="https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type#browser_compatibility" target="_blank"><img src="compat.svg" alt="Check for built-in browser support." title="Check for built-in browser support."></a></p>`
8+
out += `<div class="template_container" style="display:flex; flex-direction:row; justify-content:space-between;"`
9+
if (dir === 'rtl') out += ` dir="rtl">`
10+
else out += `>`
11+
12+
out += `
13+
<ol lang="${ lang }" style="list-style-type: ${ styleName }; display:block;"><li>one</li><li>two</li><li>three</li><li>four</li><li>five</li></ol>
14+
<ol start="6" lang="${ lang }" style="list-style-type: ${ styleName }; display:block;"><li>six</li><li>seven</li><li>eight</li><li>nine</li><li>ten</li></ol>
15+
<div>
16+
<ol start="11" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>11</li></ol>
17+
<ol start="22" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>22</li></ol>`
18+
if (type !== 'vshort') out += `
19+
<ol start="33" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>33</li></ol>
20+
<ol start="44" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>44</li></ol>`
21+
out += `</div>`
22+
23+
if (type === 'full') {
24+
out += `<div>
25+
<ol start="111" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>111</li></ol>
26+
<ol start="222" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>222</li></ol>
27+
<ol start="333" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>333</li></ol>
28+
<ol start="444" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>444</li></ol>`
29+
}
30+
31+
out += `</div>
32+
`
33+
out += `</div>`
34+
35+
document.getElementById('out_'+styleName).innerHTML = out
36+
}
37+
38+
39+
40+
41+
42+
43+
44+
function copyTemplate (id) {
45+
navigator.clipboard.writeText(document.getElementById(id).parentNode.querySelector('.counterstyle').textContent)
46+
document.getElementById('copyNotice').style.display = 'block'
47+
setTimeout(() => { document.getElementById('copyNotice').style.display = 'none' }, '500')
48+
}

echidna

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ index.html?specStatus=NOTE&shortName=predefined-counter-styles respec
33
local.css
44
compat.svg
55
copy.svg
6+
code.js

index.html

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,8 @@
12671267

12681268

12691269
</style>
1270+
1271+
<script src="code.js"></script>
12701272
</head>
12711273

12721274

@@ -1397,63 +1399,6 @@ <h3>Show built-in style tests</h3>
13971399
<dialog id="copyNotice">Copied !</dialog>
13981400

13991401

1400-
<!--style>
1401-
@counter-style counter {
1402-
system: extends decimal;
1403-
suffix: " ";
1404-
}
1405-
</style-->
1406-
1407-
1408-
1409-
<script>
1410-
1411-
function addExamples (styleName, lang, dir, type) {
1412-
// draws the "Output in your browser" boxes.
1413-
// type is one of 'vshort' (stops after 22), or short (stops after 44)
1414-
if (typeof type === 'undefined') type = 'full'
1415-
1416-
var out = ''
1417-
out += `<p class="browser_output_title">Output in your browser:<a style="float:right" href="https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type#browser_compatibility" target="_blank"><img src="compat.svg" alt="Check for built-in browser support." title="Check for built-in browser support."></a></p>`
1418-
out += `<div class="template_container" style="display:flex; flex-direction:row; justify-content:space-between;"`
1419-
if (dir === 'rtl') out += ` dir="rtl">`
1420-
else out += `>`
1421-
1422-
out += `
1423-
<ol lang="${ lang }" style="list-style-type: ${ styleName }; display:block;"><li>one</li><li>two</li><li>three</li><li>four</li><li>five</li></ol>
1424-
<ol start="6" lang="${ lang }" style="list-style-type: ${ styleName }; display:block;"><li>six</li><li>seven</li><li>eight</li><li>nine</li><li>ten</li></ol>
1425-
<div>
1426-
<ol start="11" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>11</li></ol>
1427-
<ol start="22" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>22</li></ol>`
1428-
if (type !== 'vshort') out += `
1429-
<ol start="33" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>33</li></ol>
1430-
<ol start="44" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>44</li></ol>`
1431-
out += `</div>`
1432-
1433-
if (type === 'full') {
1434-
out += `<div>
1435-
<ol start="111" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>111</li></ol>
1436-
<ol start="222" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>222</li></ol>
1437-
<ol start="333" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>333</li></ol>
1438-
<ol start="444" class='high' lang="${ lang }" style="list-style-type: ${ styleName };"><li>444</li></ol>`
1439-
}
1440-
1441-
out += `</div>
1442-
`
1443-
out += `</div>`
1444-
1445-
document.getElementById('out_'+styleName).innerHTML = out
1446-
}
1447-
1448-
function copyTemplate (id) {
1449-
navigator.clipboard.writeText(document.getElementById(id).parentNode.querySelector('.counterstyle').textContent)
1450-
document.getElementById('copyNotice').style.display = 'block'
1451-
setTimeout(() => { document.getElementById('copyNotice').style.display = 'none' }, '500')
1452-
}
1453-
</script>
1454-
1455-
1456-
14571402

14581403

14591404

0 commit comments

Comments
 (0)