diff --git a/demo/css/style.css b/demo/css/style.css index b7401c2..067244e 100644 --- a/demo/css/style.css +++ b/demo/css/style.css @@ -29,7 +29,11 @@ h1 { padding: 0 5px; } -.nav a, .nav a:link, .nav a:visited, .nav a:active, .nav a:hover { +.nav-links a, +.nav-links a:link, +.nav-links a:visited, +.nav-links a:active, +.nav-links a:hover { color: #aaa; text-decoration: none; border-bottom: 1px solid #555; @@ -111,6 +115,13 @@ canvas:active { color: #000; } +.demo-view-source { + display: inline-block; + margin: 0 0 0 22px; + font-size: 13px; + opacity: 0.5; +} + .dg.a { margin-right: 0; } diff --git a/demo/dev.html b/demo/dev.html index fb66f7e..3adc99d 100644 --- a/demo/dev.html +++ b/demo/dev.html @@ -31,7 +31,7 @@

Matter.js Demo (Dev. Build)

- +
+
diff --git a/demo/js/Demo.js b/demo/js/Demo.js index 73337ad..bc3206c 100644 --- a/demo/js/Demo.js +++ b/demo/js/Demo.js @@ -150,6 +150,7 @@ // initialise demo selector demoSelect.value = demo.sceneName; + Demo.setUpdateSourceLink(demo.sceneName); demoSelect.addEventListener('change', function(e) { Demo.reset(demo); @@ -159,15 +160,23 @@ var scrollY = window.scrollY; window.location.hash = demo.sceneName; window.scrollY = scrollY; + Demo.setUpdateSourceLink(demo.sceneName); }); demoReset.addEventListener('click', function(e) { Demo.reset(demo); Example[demo.sceneName](demo); Gui.update(demo.gui); + Demo.setUpdateSourceLink(demo.sceneName); }); }; + Demo.setUpdateSourceLink = function(sceneName) { + var demoViewSource = document.getElementById('demo-view-source'), + sourceUrl = 'https://github.com/liabru/matter-js/blob/master/examples'; + demoViewSource.setAttribute('href', sourceUrl + '/' + sceneName + '.js'); + }; + Demo.fullscreen = function(demo) { var _fullscreenElement = demo.engine.render.canvas;