-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
46 lines (42 loc) · 2.58 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<svg version="1.1" width="300" height="200" xmlns="http://www.w3.org/2000/svg"><g>Circle<circle cx="150" cy="115" r="80" fill="#b83058"/><text x="150" y="130" text-anchor="middle" font-size="40" fill="#7076e0">L+D</text></g></svg>
<svg version="1.1" width="300" height="200" xmlns="http://www.w3.org/2000/svg"><g>Square<rect x="73" y="40" width="160" height="160" fill="#3069E3"/><text x="150" y="130" text-anchor="middle" font-size="40" fill="#E3306B ">L+D</text></g></svg>
<svg version="1.1" width="300" height="200" xmlns="http://www.w3.org/2000/svg"><g>Triangle<polygon points="150, 18 244, 182 56, 182" fill="#E3306B "/><text x="150" y="130" text-anchor="middle" font-size="40" fill="#3069E3">L+D</text></g></svg>
<svg version="1.1" width="300" height="200" xmlns="http://www.w3.org/2000/svg"><g>Circle<circle cx="150" cy="115" r="80" fill="#b83058"/><text x="150" y="130" text-anchor="middle" font-size="40" fill="#7076e0">L+D</text></g>
<svg version="1.1" width="300" height="200" xmlns="http://www.w3.org/2000/svg"><g>Triangle<polygon points="150, 18 244, 182 56, 182" fill="#3069E3"/><text x="150" y="130" text-anchor="middle" font-size="40" fill="#b83058">D+L</text></g></svg>
<script>
// <![CDATA[ <-- For SVG support
if ('WebSocket' in window) {
(function () {
function refreshCSS() {
var sheets = [].slice.call(document.getElementsByTagName("link"));
var head = document.getElementsByTagName("head")[0];
for (var i = 0; i < sheets.length; ++i) {
var elem = sheets[i];
var parent = elem.parentElement || head;
parent.removeChild(elem);
var rel = elem.rel;
if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") {
var url = elem.href.replace(/(&|\?)_cacheOverride=\d+/, '');
elem.href = url + (url.indexOf('?') >= 0 ? '&' : '?') + '_cacheOverride=' + (new Date().valueOf());
}
parent.appendChild(elem);
}
}
var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://';
var address = protocol + window.location.host + window.location.pathname + '/ws';
var socket = new WebSocket(address);
socket.onmessage = function (msg) {
if (msg.data == 'reload') window.location.reload();
else if (msg.data == 'refreshcss') refreshCSS();
};
if (sessionStorage && !sessionStorage.getItem('IsThisFirstTime_Log_From_LiveServer')) {
console.log('Live reload enabled.');
sessionStorage.setItem('IsThisFirstTime_Log_From_LiveServer', true);
}
})();
}
else {
console.error('Upgrade your browser. This Browser is NOT supported WebSocket for Live-Reloading.');
}
// ]]>
</script>