Korbs revised this gist 9 months ago. Go to revision
1 file changed, 16 insertions
os.js(file created)
| @@ -0,0 +1,16 @@ | |||
| 1 | + | var htmlElement = document.documentElement; | |
| 2 | + | if (navigator.platform.match(/(Mac)/i)) { | |
| 3 | + | htmlElement.className = 'Mac' | |
| 4 | + | } | |
| 5 | + | if (navigator.platform.match(/(Linux)/i)) { | |
| 6 | + | htmlElement.className = 'Linux' | |
| 7 | + | } else { | |
| 8 | + | htmlElement.className = 'Windows' | |
| 9 | + | } | |
| 10 | + | document.addEventListener('click', function(event) { | |
| 11 | + | var target = event.target; | |
| 12 | + | if (target.getAttribute && target.getAttribute('data-action') === 'switch-os') { | |
| 13 | + | event.preventDefault(); | |
| 14 | + | htmlElement.className = target.getAttribute('data-os') | |
| 15 | + | } | |
| 16 | + | }) | |
Newer
Older