isUsingMouse: function () {
return this.usingMouse;
- }, isUsingKeyboard: function () {
+ },
+
+ isUsingKeyboard: function () {
return this.usingKeyboard;
},
this.usingKeyboard = this.usingMouse = false;
this.setTouchClasses();
}
- }, useMouse: function () {
+ },
+
+ useMouse: function () {
if (!this.usingMouse) {
this.hasMouse = this.usingMouse = true;
this.usingKeyboard = this.usingTouch = false;
this.setMouseClasses();
}
- }, useKeyboard: function () {
+ },
+
+ useKeyboard: function () {
if (!this.usingKeyboard) {
this.hasKeyboard = this.usingKeyboard = true;
this.usingMouse = this.usingTouch = false;
.addClass('using-touch')
.addClass('no-using-keyboard');
- }, setMouseClasses: function () {
+ },
+
+ setMouseClasses: function () {
$('html').addClass('using-mouse')
.addClass('no-using-touch')
.addClass('no-using-keyboard')
.removeClass('no-using-mouse')
.removeClass('using-touch')
.removeClass('using-keyboard');
- }, setKeyboardClasses: function () {
+ },
+
+ setKeyboardClasses: function () {
$('html').addClass('using-keyboard')
.addClass('no-using-touch')
.addClass('no-using-mouse')
if (window.FluidbookSlideshow) {
this.slideshow = new FluidbookSlideshow(this);
}
+ if (window.FluidbookScreensaver) {
+ this.screensaver = new FluidbookScreensaver(this);
+ }
this.printing = new FluidbookPrint(this);
this.posad = new FluidbookPOSAd(this);
this.notes = new FluidbookNotes(this);
--- /dev/null
+function FluidbookScreensaver(fluidbook) {
+ this.fluidbook = fluidbook;
+ this.timer = null;
+ this.sleepTime = 1000 * parseInt(this.fluidbook.settings.screensaver_sleep_time);
+ this.init();
+}
+
+FluidbookScreensaver.prototype = {
+ init: function () {
+ let $this = this;
+ $(document).on('touchmove keydown keyup click mousemove touchstart touchend mouseup mousedown', function () {
+ if ($("#screensaver").is(":visible")) {
+ $this.wakeup();
+ } else {
+ $this.resetTimer();
+ }
+ return true;
+ });
+
+ $("body").append('<div id="screensaver"><video src="data/screensaver/' + this.fluidbook.settings.screensaver + '" autoplay preload="auto" muted loop></video></div>');
+ this.resetTimer();
+ },
+
+ resetTimer: function () {
+ if ($("#screensaver").is(":visible")) {
+ return false;
+ }
+ let $this = this;
+ clearTimeout(this.timer);
+ this.timer = setTimeout(function () {
+ $this.sleep();
+ }, this.sleepTime);
+ },
+
+ wakeup: function () {
+ this.hide();
+
+ },
+
+ sleep: function () {
+ this.show();
+ if (this.fluidbook.settings.screensaver_wake_action === 'page') {
+ this.fluidbook.setCurrentPage(this.fluidbook.settings.screensaver_wake_action_page);
+ }
+ },
+
+ show: function () {
+ $("#screensaver").show();
+ },
+
+ hide: function () {
+ $("#screensaver").hide();
+ }
+}
\ No newline at end of file
@import "mmenu/mmenu";
@import "nav-horizontal";
@import "input-radio";
-@import "accessibility";
\ No newline at end of file
+@import "accessibility";
+@import "screensaver";
\ No newline at end of file
--- /dev/null
+#screensaver {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 10000;
+ cursor: default;
+
+ video {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ pointer-events: none;
+ }
+}
\ No newline at end of file