Browse Source

server player

master
zeus 4 years ago
parent
commit
f6f2f0f705
  1. 22
      aplayer.html

22
aplayer.html

@ -3,20 +3,40 @@
<link rel="stylesheet" type="text/css" href="/player/asciinema-player.css" /> <link rel="stylesheet" type="text/css" href="/player/asciinema-player.css" />
</head> </head>
<body> <body>
<!--
<asciinema-player title="Linux" author="swarmlab.io" author-url="http://www.swarmlab.io" font-size="small" speed="2" theme="monokai" src="/player/demo.cast"></asciinema-player> <asciinema-player title="Linux" author="swarmlab.io" author-url="http://www.swarmlab.io" font-size="small" speed="2" theme="monokai" src="/player/demo.cast"></asciinema-player>
-->
<script src="/player/asciinema-player.js"></script> <script src="/player/asciinema-player.js"></script>
<script> <script>
var url_string = window.location.href var url_string = window.location.href
var url = new URL(url_string); var url = new URL(url_string);
var item = url.searchParams.get("item"); var item = url.searchParams.get("item");
var llo = url.searchParams.get("llo"); var llo = url.searchParams.get("llo");
var src = '/'+llo+'/'+item+'.cast' var src = '/player/'+llo+'/'+item+'.cast'
var div = document.createElement('asciinema-player'); var div = document.createElement('asciinema-player');
document.body.appendChild(div); //appending the element document.body.appendChild(div); //appending the element
var att = document.createAttribute( "src" ); var att = document.createAttribute( "src" );
att.value = src ; att.value = src ;
div.setAttributeNode(att); div.setAttributeNode(att);
var speed = document.createAttribute( "speed" );
att.value = 2 ;
div.setAttributeNode(speed);
var author = document.createAttribute( "author" );
att.value = 'swarmlab.io' ;
div.setAttributeNode(author);
var authorurl = document.createAttribute( "author-url" );
att.value = 'http://www.swarmlab.io' ;
div.setAttributeNode(authorurl);
var theme = document.createAttribute( "theme" );
att.value = 'monokai' ;
div.setAttributeNode(theme);
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save