diff --git a/images/lock.svg b/images/lock.svg new file mode 100644 index 0000000..7d0e70b --- /dev/null +++ b/images/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/unlock.svg b/images/unlock.svg new file mode 100644 index 0000000..0b2258a --- /dev/null +++ b/images/unlock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/socket/public/css/styles.css b/socket/public/css/styles.css index c2a2744..93e485f 100644 --- a/socket/public/css/styles.css +++ b/socket/public/css/styles.css @@ -4213,8 +4213,26 @@ a:hover { transform: translateY(-50%); -webkit-transform: translateY(-50%); } +/* line 178, main.scss */ +.header .lock-toggle { + border: none; + padding: 0; + margin: 0; + background: none; + height: 40px; + width: 40px; + position: absolute; + right: 20px; + top: 50%; + transform: translateY(-50%); + -webkit-transform: translateY(-50%); +} +/* line 191, main.scss */ +.header .lock-toggle img { + width: 50%; +} -/* line 180, main.scss */ +/* line 198, main.scss */ .iframeGET { display: none; } diff --git a/socket/public/device.html b/socket/public/device.html index 02234d0..2ed1f1d 100644 --- a/socket/public/device.html +++ b/socket/public/device.html @@ -11,6 +11,7 @@
+
@@ -22,13 +23,8 @@ - - - + diff --git a/socket/public/device.js b/socket/public/device.js index bd5df2d..ebe84c7 100644 --- a/socket/public/device.js +++ b/socket/public/device.js @@ -172,6 +172,23 @@ $(document).ready( function(){ } + var noSleep = new NoSleep(); + var wakeLockEnabled = false; + + var toggleEl = document.querySelector(".lock-toggle"); + toggleEl.addEventListener('click', function() { + if (!wakeLockEnabled) { + noSleep.enable(); + wakeLockEnabled = true; + $(".lock-toggle img").attr('src', '/images/lock.svg'); + toggleEl + } else { + noSleep.disable(); + wakeLockEnabled = false; + $(".lock-toggle img").attr('src', '/images/unlock.svg'); + } + }, false); + }); diff --git a/socket/public/images/lock.svg b/socket/public/images/lock.svg new file mode 100644 index 0000000..d376904 --- /dev/null +++ b/socket/public/images/lock.svg @@ -0,0 +1,52 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/socket/public/images/unlock.svg b/socket/public/images/unlock.svg new file mode 100644 index 0000000..aea4657 --- /dev/null +++ b/socket/public/images/unlock.svg @@ -0,0 +1,52 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/socket/public/scss/main.scss b/socket/public/scss/main.scss index b2dca0b..7ed6aa0 100644 --- a/socket/public/scss/main.scss +++ b/socket/public/scss/main.scss @@ -174,6 +174,24 @@ a{ transform: translateY(-50%); -webkit-transform: translateY(-50%); } + + .lock-toggle{ + border: none; + padding: 0; + margin: 0; + background: none; + height: 40px; + width: 40px; + position: absolute; + right: 20px; + top: 50%; + transform: translateY(-50%); + -webkit-transform: translateY(-50%); + + img { + width: 50%; + } + } }