From afe2b934def61a633f29ebaa140364c37fb5391d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Wed, 8 Mar 2017 10:36:08 -0300 Subject: [PATCH 01/14] test env requst http://localhost:8080 This test expect get 200 HTTP code on get request to http://localhost:8080 --- tests/e2e/env_spec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/e2e/env_spec.js b/tests/e2e/env_spec.js index 99a7f657..04bb5542 100644 --- a/tests/e2e/env_spec.js +++ b/tests/e2e/env_spec.js @@ -1,5 +1,8 @@ const globalSetup = require("./global-setup"); const app = globalSetup.app; +const request = require("request"); +const chai = require("chai"); +const expect = chai.expect; describe("Electron app environment", function () { this.timeout(20000); @@ -17,7 +20,6 @@ describe("Electron app environment", function () { app.stop().then(function() { done(); }); }); - it("is set to open new app window", function () { return app.client.waitUntilWindowLoaded() .getWindowCount().should.eventually.equal(1); @@ -28,4 +30,11 @@ describe("Electron app environment", function () { .getTitle().should.eventually.equal("Magic Mirror"); }); + it("get request from http://localhost:8080 should return 200", function (done) { + request.get("http://localhost:8080", function (err, res, body) { + expect(res.statusCode).to.equal(200); + done(); + }); + }); + }); From 5770b9dc0e07749c6e64596cb0673f4e37b1f970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Thu, 9 Mar 2017 17:10:32 -0300 Subject: [PATCH 02/14] Test env 404 not found request http://localhost:8080/nothing This test expect gets 404 HTTP code on get request to http://localhost:8080/nothing --- tests/e2e/env_spec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/e2e/env_spec.js b/tests/e2e/env_spec.js index 04bb5542..202bd5e4 100644 --- a/tests/e2e/env_spec.js +++ b/tests/e2e/env_spec.js @@ -37,4 +37,11 @@ describe("Electron app environment", function () { }); }); + it("get request from http://localhost:8080/nothing should return 404", function (done) { + request.get("http://localhost:8080/nothing", function (err, res, body) { + expect(res.statusCode).to.equal(404); + done(); + }); + }); + }); From 4fdd12bc48d95a562b92fa297c7a11cd41a0066d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Thu, 9 Mar 2017 21:12:19 -0300 Subject: [PATCH 03/14] Test change port configuration This test change to 8090 port on configuration and check if system response there. --- tests/configs/port_8090.js | 25 +++++++++++++++++++++++++ tests/e2e/port_config.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/configs/port_8090.js create mode 100644 tests/e2e/port_config.js diff --git a/tests/configs/port_8090.js b/tests/configs/port_8090.js new file mode 100644 index 00000000..6646dff7 --- /dev/null +++ b/tests/configs/port_8090.js @@ -0,0 +1,25 @@ +/* Magic Mirror Test config sample enviroment set por 8090 + * + * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com + * MIT Licensed. + */ + +var config = { + port: 8090, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 24, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true, + }, + }, + + modules: [ + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") {module.exports = config;} diff --git a/tests/e2e/port_config.js b/tests/e2e/port_config.js new file mode 100644 index 00000000..c0806e85 --- /dev/null +++ b/tests/e2e/port_config.js @@ -0,0 +1,32 @@ +const globalSetup = require("./global-setup"); +const app = globalSetup.app; +const request = require("request"); +const chai = require("chai"); +const expect = chai.expect; + + +describe("port directive configuration", function () { + + this.timeout(20000); + + beforeEach(function (done) { + app.start().then(function() { done(); } ); + }); + + afterEach(function (done) { + app.stop().then(function() { done(); }); + }); + + describe("Set port 8090", function () { + before(function() { + // Set config sample for use in this test + process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js"; + }); + it("should return 200", function (done) { + request.get("http://localhost:8090", function (err, res, body) { + expect(res.statusCode).to.equal(200); + done(); + }); + }); + }); +}); From 72d18fd7e1e52f237dbafba17358cd65170e2a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Fri, 10 Mar 2017 17:52:40 -0300 Subject: [PATCH 04/14] Add test module position using helloworld Also is using a configuration with "exotic content" --- tests/configs/modules/positions.js | 43 ++++++++++++++++++++++++++++++ tests/e2e/modules_position_spec.js | 42 +++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 tests/configs/modules/positions.js create mode 100644 tests/e2e/modules_position_spec.js diff --git a/tests/configs/modules/positions.js b/tests/configs/modules/positions.js new file mode 100644 index 00000000..7d0188c2 --- /dev/null +++ b/tests/configs/modules/positions.js @@ -0,0 +1,43 @@ +/* Magic Mirror Test config for position setters module + * + * For this case is using helloworld module + * + * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com + * MIT Licensed. + */ + + +var config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + ipWhitelist: [], + + language: "en", + timeFormat: 24, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true, + }, + }, + modules: + // Using exotic content. This is why dont accept go to JSON configuration file + (function() { + var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", + "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", + "bottom_bar", "fullscreen_above", "fullscreen_below"]; + var modules = Array(); + for (idx in positions) { + modules.push({ + module: "helloworld", + position: positions[idx], + config: { + text: "Text in " + positions[idx] + } + }); + } + return modules; + })(), +}; +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") {module.exports = config;} diff --git a/tests/e2e/modules_position_spec.js b/tests/e2e/modules_position_spec.js new file mode 100644 index 00000000..a781388a --- /dev/null +++ b/tests/e2e/modules_position_spec.js @@ -0,0 +1,42 @@ +const globalSetup = require("./global-setup"); +const app = globalSetup.app; +const chai = require("chai"); +const expect = chai.expect; + +describe("Position of modules", function () { + this.timeout(20000); + + + beforeEach(function (done) { + app.start().then(function() { done(); } ); + }); + + afterEach(function (done) { + app.stop().then(function() { done(); }); + }); + + + describe("Using helloworld", function() { + + before(function() { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js"; + }); + + var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", + "middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right", + "bottom_bar", "fullscreen_above", "fullscreen_below"]; + + var position; + var className; + for (idx in positions) { + position = positions[idx]; + className = position.replace("_", "."); + it("show text in " + position , function () { + return app.client.waitUntilWindowLoaded() + .getText("." + className).should.eventually.equal("Text in " + position); + }); + } + }); + +}); From b23e47464882290b43a4b3fb2e18d1095f13c8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Sat, 18 Mar 2017 09:36:50 -0300 Subject: [PATCH 05/14] Format changelog for 2.1.1 --- CHANGELOG.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe62971..f5d33af8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,13 +23,13 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Restructured Test Suite ### Added -- Added Docker support (Pull Request [#673](https://github.com/MichMich/MagicMirror/pull/673)) -- Calendar-specific support for `maximumEntries`, and ` maximumNumberOfDays` +- Added Docker support (Pull Request [#673](https://github.com/MichMich/MagicMirror/pull/673)). +- Calendar-specific support for `maximumEntries`, and ` maximumNumberOfDays`. - Add loaded function to modules, providing an async callback. - Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures) -- Add use pm2 for manager process into Installer RaspberryPi script -- Russian Translation -- Afrikaans Translation +- Add use pm2 for manager process into Installer RaspberryPi script. +- Russian Translation. +- Afrikaans Translation. - Add postinstall script to notify user that MagicMirror installed successfully despite warnings from NPM. - Init tests using mocha. - Option to use RegExp in Calendar's titleReplace. @@ -37,22 +37,22 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Icelandic Translation. - Add use a script to prevent when is run by SSH session set DISPLAY enviroment. - Enable ability to set configuration file by the enviroment variable called MM_CONFIG_FILE. -- Option to give each calendar a different color -- Option for colored min-temp and max-temp -- Add test e2e helloworld -- Add test e2e enviroment -- Add `chai-as-promised` npm module to devDependencies -- Basic set of tests for clock module -- Run e2e test in Travis +- Option to give each calendar a different color. +- Option for colored min-temp and max-temp. +- Add test e2e helloworld. +- Add test e2e enviroment. +- Add `chai-as-promised` npm module to devDependencies. +- Basic set of tests for clock module. +- Run e2e test in Travis. - Estonian Translation. -- Add test for compliments module for parts of day +- Add test for compliments module for parts of day. - Korean Translation. -- Added console warning on startup when deprecated config options are used -- Add option to display temperature unit label to the current weather module -- Added ability to disable wrapping of news items +- Added console warning on startup when deprecated config options are used. +- Add option to display temperature unit label to the current weather module. +- Added ability to disable wrapping of news items. - Added in the ability to hide events in the calendar module based on simple string filters. - Updated Norwegian translation. -- Added hideLoading option for News Feed module +- Added hideLoading option for News Feed module. - Added configurable dateFormat to clock module. - Added multiple calendar icon support. @@ -63,7 +63,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611)) - If units is set to imperial, the showRainAmount option of weatherforecast will show the correct unit. - Module currentWeather: check if temperature received from api is defined. -- Fix an issue with module hidden status changing to `true` although lock string prevented showing it +- Fix an issue with module hidden status changing to `true` although lock string prevented showing it. - Fix newsfeed module bug (removeStartTags) - Fixed missing animation on `this.show(speed)` when module is alone in a region. From 4fb86bd6996f819399fb9077074dd46df793f39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Sun, 19 Mar 2017 16:54:36 -0300 Subject: [PATCH 06/14] change description package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a1e7641..a190f12d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "magicmirror", "version": "2.1.1", - "description": "A modular interface for smart mirrors.", + "description": "The open source modular smart mirror platform.", "main": "js/electron.js", "scripts": { "start": "sh run-start.sh", From f0db135b1d5e17ed96550a2999792144bd5486af Mon Sep 17 00:00:00 2001 From: 42SK <42SK@github.com> Date: Tue, 21 Mar 2017 19:39:51 +0100 Subject: [PATCH 07/14] Added option to ignore old items in the news feed module Outdated news items can be omitted via the ignoreOldItems and the ignoreOlderThan option. --- CHANGELOG.md | 1 + modules/default/newsfeed/README.md | 2 ++ modules/default/newsfeed/newsfeed.js | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe62971..39ecfa6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added hideLoading option for News Feed module - Added configurable dateFormat to clock module. - Added multiple calendar icon support. +- Added `ignoreOldItems` and `ignoreOlderThan` options to the News Feed module ### Fixed - Update .gitignore to not ignore default modules folder. diff --git a/modules/default/newsfeed/README.md b/modules/default/newsfeed/README.md index 9f7b2e7d..7c4ad48d 100644 --- a/modules/default/newsfeed/README.md +++ b/modules/default/newsfeed/README.md @@ -70,6 +70,8 @@ The following properties can be configured: | `updateInterval` | How often do you want to display a new headline? (Milliseconds)

**Possible values:**`1000` - `60000`
**Default value:** `10000` (10 seconds) | `animationSpeed` | Speed of the update animation. (Milliseconds)

**Possible values:**`0` - `5000`
**Default value:** `2500` (2.5 seconds) | `maxNewsItems` | Total amount of news items to cycle through. (0 for unlimited)

**Possible values:**`0` - `...`
**Default value:** `0` +| `ignoreOldItems` | Ignore news items that are outdated.

**Possible values:**`true` or `false
**Default value:** `false` +| `ignoreOlderThan` | How old should news items be before they are considered outdated? (Milliseconds)

**Possible values:**`1` - `...`
**Default value:** `86400000` (1 day) | `removeStartTags` | Some newsfeeds feature tags at the **beginning** of their titles or descriptions, such as _[VIDEO]_. This setting allows for the removal of specified tags from the beginning of an item's description and/or title.

**Possible values:**`'title'`, `'description'`, `'both'` | `startTags` | List the tags you would like to have removed at the beginning of the feed item

**Possible values:** `['TAG']` or `['TAG1','TAG2',...]` | `removeEndTags` | Remove specified tags from the **end** of an item's description and/or title.

**Possible values:**`'title'`, `'description'`, `'both'` diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 5094355e..b7ec2f58 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -28,6 +28,8 @@ Module.register("newsfeed",{ updateInterval: 10 * 1000, animationSpeed: 2.5 * 1000, maxNewsItems: 0, // 0 for unlimited + ignoreOldItems: false, + ignoreOlderThan: 24 * 60 * 60 * 1000, // 1 day removeStartTags: "", removeEndTags: "", startTags: [], @@ -226,7 +228,9 @@ Module.register("newsfeed",{ for (var i in feedItems) { var item = feedItems[i]; item.sourceTitle = this.titleForFeed(feed); - newsItems.push(item); + if (!(this.config.ignoreOldItems && ((Date.now() - new Date(item.pubdate)) > this.config.ignoreOlderThan))) { + newsItems.push(item); + } } } } From 6a0e16885dc8cdea2b1455c0f5131c59134d743d Mon Sep 17 00:00:00 2001 From: Flo Date: Tue, 21 Mar 2017 20:56:11 +0100 Subject: [PATCH 08/14] Support full screen mode on iOS and enable "click to toggle fullscreen" in standard browsers --- css/main.css | 1 + index.html | 17 +++++- js/screenfull.js | 150 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 js/screenfull.js diff --git a/css/main.css b/css/main.css index 5e63e596..924ec4de 100644 --- a/css/main.css +++ b/css/main.css @@ -1,6 +1,7 @@ html { cursor: none; overflow: hidden; + background: #000; } ::-webkit-scrollbar { diff --git a/index.html b/index.html index 86a69a4a..edc63369 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,12 @@ Magic Mirror + + + + + + @@ -12,8 +18,17 @@ + + + - +
diff --git a/js/screenfull.js b/js/screenfull.js new file mode 100644 index 00000000..de20b55e --- /dev/null +++ b/js/screenfull.js @@ -0,0 +1,150 @@ +/*! +* screenfull +* v3.0.2 - 2017-03-13 +* (c) Sindre Sorhus; MIT License +*/ +(function () { + 'use strict'; + + var isCommonjs = typeof module !== 'undefined' && module.exports; + var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element; + + var fn = (function () { + var val; + + var fnMap = [ + [ + 'requestFullscreen', + 'exitFullscreen', + 'fullscreenElement', + 'fullscreenEnabled', + 'fullscreenchange', + 'fullscreenerror' + ], + // new WebKit + [ + 'webkitRequestFullscreen', + 'webkitExitFullscreen', + 'webkitFullscreenElement', + 'webkitFullscreenEnabled', + 'webkitfullscreenchange', + 'webkitfullscreenerror' + + ], + // old WebKit (Safari 5.1) + [ + 'webkitRequestFullScreen', + 'webkitCancelFullScreen', + 'webkitCurrentFullScreenElement', + 'webkitCancelFullScreen', + 'webkitfullscreenchange', + 'webkitfullscreenerror' + + ], + [ + 'mozRequestFullScreen', + 'mozCancelFullScreen', + 'mozFullScreenElement', + 'mozFullScreenEnabled', + 'mozfullscreenchange', + 'mozfullscreenerror' + ], + [ + 'msRequestFullscreen', + 'msExitFullscreen', + 'msFullscreenElement', + 'msFullscreenEnabled', + 'MSFullscreenChange', + 'MSFullscreenError' + ] + ]; + + var i = 0; + var l = fnMap.length; + var ret = {}; + + for (; i < l; i++) { + val = fnMap[i]; + if (val && val[1] in document) { + for (i = 0; i < val.length; i++) { + ret[fnMap[0][i]] = val[i]; + } + return ret; + } + } + + return false; + })(); + + var screenfull = { + request: function (elem) { + var request = fn.requestFullscreen; + + elem = elem || document.documentElement; + + // Work around Safari 5.1 bug: reports support for + // keyboard in fullscreen even though it doesn't. + // Browser sniffing, since the alternative with + // setTimeout is even worse. + if (/5\.1[.\d]* Safari/.test(navigator.userAgent)) { + elem[request](); + } else { + elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT); + } + }, + exit: function () { + document[fn.exitFullscreen](); + }, + toggle: function (elem) { + if (this.isFullscreen) { + this.exit(); + } else { + this.request(elem); + } + }, + onchange: function (callback) { + document.addEventListener(fn.fullscreenchange, callback, false); + }, + onerror: function (callback) { + document.addEventListener(fn.fullscreenerror, callback, false); + }, + raw: fn + }; + + if (!fn) { + if (isCommonjs) { + module.exports = false; + } else { + window.screenfull = false; + } + + return; + } + + Object.defineProperties(screenfull, { + isFullscreen: { + get: function () { + return Boolean(document[fn.fullscreenElement]); + } + }, + element: { + enumerable: true, + get: function () { + return document[fn.fullscreenElement]; + } + }, + enabled: { + enumerable: true, + get: function () { + // Coerce to boolean in case of old WebKit + return Boolean(document[fn.fullscreenEnabled]); + } + } + }); + + if (isCommonjs) { + module.exports = screenfull; + } else { + window.screenfull = screenfull; + } +})(); From 09c03e8ca7687aeea2d01b8cccd909b8cc5d6f32 Mon Sep 17 00:00:00 2001 From: Flo Date: Tue, 21 Mar 2017 20:56:11 +0100 Subject: [PATCH 09/14] Support full screen mode on iOS and enable "click to toggle fullscreen" in standard browsers --- css/main.css | 1 + index.html | 17 +++++- js/screenfull.js | 150 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 js/screenfull.js diff --git a/css/main.css b/css/main.css index 01d40aec..49bfe611 100644 --- a/css/main.css +++ b/css/main.css @@ -1,6 +1,7 @@ html { cursor: none; overflow: hidden; + background: #000; } ::-webkit-scrollbar { diff --git a/index.html b/index.html index 606f5aac..72326719 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,12 @@ Magic Mirror + + + + + + @@ -12,8 +18,17 @@ + + + - +
diff --git a/js/screenfull.js b/js/screenfull.js new file mode 100644 index 00000000..de20b55e --- /dev/null +++ b/js/screenfull.js @@ -0,0 +1,150 @@ +/*! +* screenfull +* v3.0.2 - 2017-03-13 +* (c) Sindre Sorhus; MIT License +*/ +(function () { + 'use strict'; + + var isCommonjs = typeof module !== 'undefined' && module.exports; + var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element; + + var fn = (function () { + var val; + + var fnMap = [ + [ + 'requestFullscreen', + 'exitFullscreen', + 'fullscreenElement', + 'fullscreenEnabled', + 'fullscreenchange', + 'fullscreenerror' + ], + // new WebKit + [ + 'webkitRequestFullscreen', + 'webkitExitFullscreen', + 'webkitFullscreenElement', + 'webkitFullscreenEnabled', + 'webkitfullscreenchange', + 'webkitfullscreenerror' + + ], + // old WebKit (Safari 5.1) + [ + 'webkitRequestFullScreen', + 'webkitCancelFullScreen', + 'webkitCurrentFullScreenElement', + 'webkitCancelFullScreen', + 'webkitfullscreenchange', + 'webkitfullscreenerror' + + ], + [ + 'mozRequestFullScreen', + 'mozCancelFullScreen', + 'mozFullScreenElement', + 'mozFullScreenEnabled', + 'mozfullscreenchange', + 'mozfullscreenerror' + ], + [ + 'msRequestFullscreen', + 'msExitFullscreen', + 'msFullscreenElement', + 'msFullscreenEnabled', + 'MSFullscreenChange', + 'MSFullscreenError' + ] + ]; + + var i = 0; + var l = fnMap.length; + var ret = {}; + + for (; i < l; i++) { + val = fnMap[i]; + if (val && val[1] in document) { + for (i = 0; i < val.length; i++) { + ret[fnMap[0][i]] = val[i]; + } + return ret; + } + } + + return false; + })(); + + var screenfull = { + request: function (elem) { + var request = fn.requestFullscreen; + + elem = elem || document.documentElement; + + // Work around Safari 5.1 bug: reports support for + // keyboard in fullscreen even though it doesn't. + // Browser sniffing, since the alternative with + // setTimeout is even worse. + if (/5\.1[.\d]* Safari/.test(navigator.userAgent)) { + elem[request](); + } else { + elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT); + } + }, + exit: function () { + document[fn.exitFullscreen](); + }, + toggle: function (elem) { + if (this.isFullscreen) { + this.exit(); + } else { + this.request(elem); + } + }, + onchange: function (callback) { + document.addEventListener(fn.fullscreenchange, callback, false); + }, + onerror: function (callback) { + document.addEventListener(fn.fullscreenerror, callback, false); + }, + raw: fn + }; + + if (!fn) { + if (isCommonjs) { + module.exports = false; + } else { + window.screenfull = false; + } + + return; + } + + Object.defineProperties(screenfull, { + isFullscreen: { + get: function () { + return Boolean(document[fn.fullscreenElement]); + } + }, + element: { + enumerable: true, + get: function () { + return document[fn.fullscreenElement]; + } + }, + enabled: { + enumerable: true, + get: function () { + // Coerce to boolean in case of old WebKit + return Boolean(document[fn.fullscreenEnabled]); + } + } + }); + + if (isCommonjs) { + module.exports = screenfull; + } else { + window.screenfull = screenfull; + } +})(); From 8b9c274fdd7ce18102b3b560deb244e15cae4b17 Mon Sep 17 00:00:00 2001 From: Flo Date: Wed, 22 Mar 2017 22:27:19 +0100 Subject: [PATCH 10/14] Moved scripts to bottom in index.html --- index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 72326719..e2ad7acb 100644 --- a/index.html +++ b/index.html @@ -18,15 +18,6 @@ - - -
@@ -59,5 +50,14 @@ + + + From becb9fc43e36c30e89a3a6c4ab307490b9d4fc4f Mon Sep 17 00:00:00 2001 From: Flo Date: Wed, 22 Mar 2017 22:27:47 +0100 Subject: [PATCH 11/14] Updated CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe62971..2f7d7974 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added hideLoading option for News Feed module - Added configurable dateFormat to clock module. - Added multiple calendar icon support. +- Added meta tags to support fullscreen mode on iOS (for server mode) +- Added fullscreen toggle: within browser, clicking on the page turns it into fullscreen ### Fixed - Update .gitignore to not ignore default modules folder. From af0f1939a3e1c9ed135217e7433bb9d383d20249 Mon Sep 17 00:00:00 2001 From: Flo Date: Wed, 22 Mar 2017 22:28:51 +0100 Subject: [PATCH 12/14] Fixed lint errors --- js/screenfull.js | 68 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/js/screenfull.js b/js/screenfull.js index de20b55e..f0818493 100644 --- a/js/screenfull.js +++ b/js/screenfull.js @@ -4,58 +4,58 @@ * (c) Sindre Sorhus; MIT License */ (function () { - 'use strict'; + "use strict"; - var isCommonjs = typeof module !== 'undefined' && module.exports; - var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element; + var isCommonjs = typeof module !== "undefined" && module.exports; + var keyboardAllowed = typeof Element !== "undefined" && "ALLOW_KEYBOARD_INPUT" in Element; var fn = (function () { var val; var fnMap = [ [ - 'requestFullscreen', - 'exitFullscreen', - 'fullscreenElement', - 'fullscreenEnabled', - 'fullscreenchange', - 'fullscreenerror' + "requestFullscreen", + "exitFullscreen", + "fullscreenElement", + "fullscreenEnabled", + "fullscreenchange", + "fullscreenerror" ], // new WebKit [ - 'webkitRequestFullscreen', - 'webkitExitFullscreen', - 'webkitFullscreenElement', - 'webkitFullscreenEnabled', - 'webkitfullscreenchange', - 'webkitfullscreenerror' + "webkitRequestFullscreen", + "webkitExitFullscreen", + "webkitFullscreenElement", + "webkitFullscreenEnabled", + "webkitfullscreenchange", + "webkitfullscreenerror" ], // old WebKit (Safari 5.1) [ - 'webkitRequestFullScreen', - 'webkitCancelFullScreen', - 'webkitCurrentFullScreenElement', - 'webkitCancelFullScreen', - 'webkitfullscreenchange', - 'webkitfullscreenerror' + "webkitRequestFullScreen", + "webkitCancelFullScreen", + "webkitCurrentFullScreenElement", + "webkitCancelFullScreen", + "webkitfullscreenchange", + "webkitfullscreenerror" ], [ - 'mozRequestFullScreen', - 'mozCancelFullScreen', - 'mozFullScreenElement', - 'mozFullScreenEnabled', - 'mozfullscreenchange', - 'mozfullscreenerror' + "mozRequestFullScreen", + "mozCancelFullScreen", + "mozFullScreenElement", + "mozFullScreenEnabled", + "mozfullscreenchange", + "mozfullscreenerror" ], [ - 'msRequestFullscreen', - 'msExitFullscreen', - 'msFullscreenElement', - 'msFullscreenEnabled', - 'MSFullscreenChange', - 'MSFullscreenError' + "msRequestFullscreen", + "msExitFullscreen", + "msFullscreenElement", + "msFullscreenEnabled", + "MSFullscreenChange", + "MSFullscreenError" ] ]; @@ -83,7 +83,7 @@ elem = elem || document.documentElement; // Work around Safari 5.1 bug: reports support for - // keyboard in fullscreen even though it doesn't. + // keyboard in fullscreen even though it doesn"t. // Browser sniffing, since the alternative with // setTimeout is even worse. if (/5\.1[.\d]* Safari/.test(navigator.userAgent)) { From b39113f0aefcb825b90305b98150f02d83ad89db Mon Sep 17 00:00:00 2001 From: Flo Date: Fri, 24 Mar 2017 23:10:05 +0100 Subject: [PATCH 13/14] Removed fullscreen toggle; is now own, configurable module --- index.html | 11 +--- js/screenfull.js | 150 ----------------------------------------------- 2 files changed, 1 insertion(+), 160 deletions(-) delete mode 100644 js/screenfull.js diff --git a/index.html b/index.html index e2ad7acb..85951a85 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ var version = "#VERSION#"; - +
@@ -50,14 +50,5 @@ - - - diff --git a/js/screenfull.js b/js/screenfull.js deleted file mode 100644 index f0818493..00000000 --- a/js/screenfull.js +++ /dev/null @@ -1,150 +0,0 @@ -/*! -* screenfull -* v3.0.2 - 2017-03-13 -* (c) Sindre Sorhus; MIT License -*/ -(function () { - "use strict"; - - var isCommonjs = typeof module !== "undefined" && module.exports; - var keyboardAllowed = typeof Element !== "undefined" && "ALLOW_KEYBOARD_INPUT" in Element; - - var fn = (function () { - var val; - - var fnMap = [ - [ - "requestFullscreen", - "exitFullscreen", - "fullscreenElement", - "fullscreenEnabled", - "fullscreenchange", - "fullscreenerror" - ], - // new WebKit - [ - "webkitRequestFullscreen", - "webkitExitFullscreen", - "webkitFullscreenElement", - "webkitFullscreenEnabled", - "webkitfullscreenchange", - "webkitfullscreenerror" - - ], - // old WebKit (Safari 5.1) - [ - "webkitRequestFullScreen", - "webkitCancelFullScreen", - "webkitCurrentFullScreenElement", - "webkitCancelFullScreen", - "webkitfullscreenchange", - "webkitfullscreenerror" - - ], - [ - "mozRequestFullScreen", - "mozCancelFullScreen", - "mozFullScreenElement", - "mozFullScreenEnabled", - "mozfullscreenchange", - "mozfullscreenerror" - ], - [ - "msRequestFullscreen", - "msExitFullscreen", - "msFullscreenElement", - "msFullscreenEnabled", - "MSFullscreenChange", - "MSFullscreenError" - ] - ]; - - var i = 0; - var l = fnMap.length; - var ret = {}; - - for (; i < l; i++) { - val = fnMap[i]; - if (val && val[1] in document) { - for (i = 0; i < val.length; i++) { - ret[fnMap[0][i]] = val[i]; - } - return ret; - } - } - - return false; - })(); - - var screenfull = { - request: function (elem) { - var request = fn.requestFullscreen; - - elem = elem || document.documentElement; - - // Work around Safari 5.1 bug: reports support for - // keyboard in fullscreen even though it doesn"t. - // Browser sniffing, since the alternative with - // setTimeout is even worse. - if (/5\.1[.\d]* Safari/.test(navigator.userAgent)) { - elem[request](); - } else { - elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT); - } - }, - exit: function () { - document[fn.exitFullscreen](); - }, - toggle: function (elem) { - if (this.isFullscreen) { - this.exit(); - } else { - this.request(elem); - } - }, - onchange: function (callback) { - document.addEventListener(fn.fullscreenchange, callback, false); - }, - onerror: function (callback) { - document.addEventListener(fn.fullscreenerror, callback, false); - }, - raw: fn - }; - - if (!fn) { - if (isCommonjs) { - module.exports = false; - } else { - window.screenfull = false; - } - - return; - } - - Object.defineProperties(screenfull, { - isFullscreen: { - get: function () { - return Boolean(document[fn.fullscreenElement]); - } - }, - element: { - enumerable: true, - get: function () { - return document[fn.fullscreenElement]; - } - }, - enabled: { - enumerable: true, - get: function () { - // Coerce to boolean in case of old WebKit - return Boolean(document[fn.fullscreenEnabled]); - } - } - }); - - if (isCommonjs) { - module.exports = screenfull; - } else { - window.screenfull = screenfull; - } -})(); From 455819566b78dc6cf7c4d1947a62dfb1c9b74f9f Mon Sep 17 00:00:00 2001 From: Flo Date: Fri, 24 Mar 2017 23:13:08 +0100 Subject: [PATCH 14/14] Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f7d7974..53b534f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,7 +56,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added configurable dateFormat to clock module. - Added multiple calendar icon support. - Added meta tags to support fullscreen mode on iOS (for server mode) -- Added fullscreen toggle: within browser, clicking on the page turns it into fullscreen ### Fixed - Update .gitignore to not ignore default modules folder.