Skip to content

Commit

Permalink
Version 1.1.4
Browse files Browse the repository at this point in the history
Fixes a bug where Chrome can't access a local stylesheet.
  • Loading branch information
Martinomagnifico committed Oct 10, 2022
1 parent cb7324b commit 3c901c1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog


## [1.1.4] - 2022-10-09

### Fixed
- Insert CSS rule as a style tag for filesystem presentations on Chrome.


## [1.1.3] - 2022-10-07

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reveal.js-fsfx",
"version": "1.1.3",
"version": "1.1.4",
"description": "A plugin for Reveal.js 4, that enters or exits fullscreen, and toggles classes on certain elements",
"keywords": "reveal, reveal.js, reveal-plugin, plugin, fullscreen, screenfull",
"homepage": "https://github.com/Martinomagnifico/reveal.js-fsfx",
Expand Down
8 changes: 5 additions & 3 deletions plugin/fsfx/fsfx.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* https://github.com/Martinomagnifico
*
* FsFx.js for Reveal.js
* Version 1.1.3
* Version 1.1.4
*
* @license
* MIT licensed
Expand Down Expand Up @@ -297,9 +297,11 @@ var Plugin = function Plugin() {
var viewport = deck.getRevealElement().tagName == "BODY" ? document : deck.getRevealElement();
var fsButtons = selectionArray(viewport, ".".concat(options.baseclass));
var toggleThese = selectionArray(document, "[data-fs-toggle]");
var sheet = document.styleSheets[0];
var prefix = /mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit/.test(navigator.userAgent.toLowerCase()) ? '-moz-' : /webkit/.test(navigator.userAgent.toLowerCase()) ? '-webkit-' : /msie/.test(navigator.userAgent.toLowerCase()) ? '-ms-' : /opera/.test(navigator.userAgent.toLowerCase()) ? '-o-' : '';
sheet.insertRule(":".concat(prefix, "full-screen {background: var(--r-background-color)}"));
var fsStyleSheet = document.createElement("style");
fsStyleSheet.type = "text/css";
fsStyleSheet.innerText = ":".concat(prefix, "full-screen {background: var(--r-background-color)}");
document.head.appendChild(fsStyleSheet);

var hideIfNoFS = function hideIfNoFS(fsButton) {
if (options.hideifnofs == true && !fsButton.hasAttribute("data-fs-gonext")) ; else {
Expand Down
8 changes: 5 additions & 3 deletions plugin/fsfx/fsfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* https://github.com/Martinomagnifico
*
* FsFx.js for Reveal.js
* Version 1.1.3
* Version 1.1.4
*
* @license
* MIT licensed
Expand Down Expand Up @@ -303,9 +303,11 @@
var viewport = deck.getRevealElement().tagName == "BODY" ? document : deck.getRevealElement();
var fsButtons = selectionArray(viewport, ".".concat(options.baseclass));
var toggleThese = selectionArray(document, "[data-fs-toggle]");
var sheet = document.styleSheets[0];
var prefix = /mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit/.test(navigator.userAgent.toLowerCase()) ? '-moz-' : /webkit/.test(navigator.userAgent.toLowerCase()) ? '-webkit-' : /msie/.test(navigator.userAgent.toLowerCase()) ? '-ms-' : /opera/.test(navigator.userAgent.toLowerCase()) ? '-o-' : '';
sheet.insertRule(":".concat(prefix, "full-screen {background: var(--r-background-color)}"));
var fsStyleSheet = document.createElement("style");
fsStyleSheet.type = "text/css";
fsStyleSheet.innerText = ":".concat(prefix, "full-screen {background: var(--r-background-color)}");
document.head.appendChild(fsStyleSheet);

var hideIfNoFS = function hideIfNoFS(fsButton) {
if (options.hideifnofs == true && !fsButton.hasAttribute("data-fs-gonext")) ; else {
Expand Down
6 changes: 4 additions & 2 deletions plugin/fsfx/plugin-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ const Plugin = () => {

let toggleThese = selectionArray(document, "[data-fs-toggle]");

let sheet = document.styleSheets[0];
let prefix = (/mozilla/.test(navigator.userAgent.toLowerCase()) &&
!/webkit/.test(navigator.userAgent.toLowerCase())) ? '-moz-' :
(/webkit/.test(navigator.userAgent.toLowerCase())) ? '-webkit-' :
(/msie/.test(navigator.userAgent.toLowerCase())) ? '-ms-' :
(/opera/.test(navigator.userAgent.toLowerCase())) ? '-o-' : '';
sheet.insertRule(`:${prefix}full-screen {background: var(--r-background-color)}`);
const fsStyleSheet = document.createElement("style");
fsStyleSheet.type="text/css";
fsStyleSheet.innerText = `:${prefix}full-screen {background: var(--r-background-color)}`;
document.head.appendChild(fsStyleSheet);

const hideIfNoFS = function (fsButton) {
if (options.hideifnofs == true && !fsButton.hasAttribute("data-fs-gonext")) {} else {
Expand Down

0 comments on commit 3c901c1

Please sign in to comment.