提交 448423a5 编写于 作者: V verteAzur 提交者: Mr.doob

view source support (#9225)

Revive  "view-source" support and add a catch and try statement if "view-source" is not available. Note: the relative path on view-source is not working, it has to be a full url for it to work...
上级 7f0e131d
......@@ -284,9 +284,14 @@
button.id = 'button';
button.textContent = 'View source';
button.addEventListener( 'click', function ( event ) {
window.open( 'https://github.com/mrdoob/three.js/blob/master/examples/' + selected + '.html' );
try{
var array = location.href.split('/');
array.pop();
window.open( 'view-source:'+ array.join('/')+ '/' + selected + '.html' );
}catch(err){
window.open( 'https://github.com/mrdoob/three.js/blob/master/examples/' + selected + '.html' );
console.log(err);
}
}, false );
button.style.display = 'none';
document.body.appendChild( button );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册