Skip to content

Commit

Permalink
Make minor tweaks to #121
Browse files Browse the repository at this point in the history
  • Loading branch information
zorbash committed Feb 11, 2018
1 parent 57f97a9 commit 60f0235
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
13 changes: 0 additions & 13 deletions installer/templates/new/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,7 @@ import '../stylesheets/application.scss';

import $ from 'jquery';
import {Kitto} from 'kitto';
import fscreen from 'fscreen';

window.jQuery = window.$ = $;

Kitto.start();

var i = null;
$("body").mousemove(function() {
clearTimeout(i);
$(".fullscreen-button").addClass("active");
i = setTimeout('$(".fullscreen-button").removeClass("active");', 1000);
})

$(".fullscreen-button").click(function() {
var ele = document.getElementById("container");
fscreen.requestFullscreen(ele);
})
4 changes: 2 additions & 2 deletions installer/templates/new/dashboards/layout.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
</head>

<body>
<i class="fullscreen-button fa fa-arrows-alt"></i>

<div id="container">
<%= @template %>
</div>

<i class="fullscreen-button fa fa-arrows-alt"></i>

<script type="text/javascript" src="/assets/application.js"></script>
<script type="text/javascript" src="/assets/widgets.js"></script>
</body>
Expand Down
23 changes: 22 additions & 1 deletion priv/static/kitto.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import $ from 'jquery';
import Gridster from 'jquery.gridster';
import fscreen from 'fscreen';

window.jQuery = window.$ = $;

class Kitto {
static start() {
Kitto.initializeGridster().initializeRotator();
Kitto
.initializeGridster()
.initializeRotator()
.initializeFullScreenButton();
}

static config(config) {
Expand Down Expand Up @@ -78,6 +82,23 @@ class Kitto {

return this;
}

static initializeFullScreenButton() {
var timer;
var $button = $('.fullscreen-button');

$('body').on('mousemove', function() {
clearTimeout(timer);
if (!$button.hasClass('active')) { $button.addClass('active') }
timer = setTimeout(function() { $button.removeClass('active') }, 1000);
})

$button.on('click', function() {
fscreen.requestFullscreen(document.getElementById('container'));
})

return this;
}
}

let Widget = require('./widget').default;
Expand Down

0 comments on commit 60f0235

Please sign in to comment.