Skip to content

Commit

Permalink
make project with with server side rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoJusticia committed Mar 4, 2021
1 parent 2ecad08 commit f35f549
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ GLightbox is a pure javascript lightbox. It can display images, iframes, inline

## Live Demo

You can check the live demo [right here](https://biati-digital.github.io/glightbox/)
You can check the live demo [right here](https://nachojusticia.github.io/glightbox-ssr/)

## Usage

Expand Down Expand Up @@ -671,7 +671,7 @@ We only provide support for bugs and feature requests, so please only post issue

## Changelog

#### Latest version v3.0.7
#### Latest version v3.0.8

See the [CHANGELOG.md](CHANGELOG.md) file for details

Expand Down
13 changes: 9 additions & 4 deletions dist/js/glightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,14 @@
document.body.appendChild(script);
return;
}
function isBrowser() {
return typeof window !== 'undefined';
}
function isMobile() {
return 'navigator' in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i);
return isBrowser() && 'navigator' in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i);
}
function isTouch() {
return isMobile() !== null || document.createTouch !== undefined || 'ontouchstart' in window || 'onmsgesturechange' in window || navigator.msMaxTouchPoints;
return isBrowser() && (isMobile() !== null || document.createTouch !== undefined || 'ontouchstart' in window || 'onmsgesturechange' in window || navigator.msMaxTouchPoints);
}
function isFunction(f) {
return typeof f === 'function';
Expand Down Expand Up @@ -2368,13 +2371,15 @@
return Slide;
}();

var _version = '3.0.7';
var _version = '3.0.8';

var isMobile$1 = isMobile();

var isTouch$1 = isTouch();

var html = document.getElementsByTagName('html')[0];
var isBrowser$1 = isBrowser();

var html = isBrowser$1 && document.getElementsByTagName('html')[0];
var defaults = {
selector: '.glightbox',
elements: null,
Expand Down
2 changes: 1 addition & 1 deletion dist/js/glightbox.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<li><a href="#examples">EXAMPLES</a></li>
<li><a href="#specifications">INFO</a></li>
<li><a href="#license">LICENSE</a></li>
<li><a href="https://github.com/biati-digital/glightbox/releases/download/3.0.7/glightbox-master.zip">DOWNLOAD</a></li>
<li><a href="https://github.com/nachojusticia/glightbox-ssr/releases/download/3.0.8/glightbox-master.zip">DOWNLOAD</a></li>
</ul>
</div>
</div>
Expand All @@ -53,11 +53,11 @@ <h1 style="font-family: 'Lobster', cursive">GLightbox.</h1>
</p>

<div class="download">
<a class="mcbutton primary" href="https://github.com/biati-digital/glightbox/releases/download/3.0.7/glightbox-master.zip">
<a class="mcbutton primary" href="https://github.com/nachojusticia/glightbox-ssr/releases/download/3.0.8/glightbox-master.zip">
<i class="fa fa-download" aria-hidden="true"></i>
<span>Download</span>
</a>
<a class="mcbutton black" href="https://github.com/biati-digital/glightbox" target="_blank">
<a class="mcbutton black" href="https://github.com/nachojusticia/glightbox-ssr" target="_blank">
<i class="fa fa-github" aria-hidden="true"></i>
<span>View Source</span>
</a>
Expand Down Expand Up @@ -357,7 +357,7 @@ <h4>Supported browsers and devices</h4>
<h4>Documentation</h4>
<p>
The documentation can be found in the github page.
<a href="https://github.com/biati-digital/glightbox/blob/master/README.md" class="font-weight-bold" target="_blank">View Documentation</a>
<a href="https://github.com/nachojusticia/glightbox-ssr/blob/master/README.md" class="font-weight-bold" target="_blank">View Documentation</a>
</p>

<div id="license">
Expand All @@ -370,7 +370,7 @@ <h4>License</h4>
</div>

<p class="text-center footer-btns">
<a class="mcbutton primary" href="https://github.com/mcstudios/glightbox/releases/download/3.0.7/glightbox-master.zip">
<a class="mcbutton primary" href="https://github.com/mcstudios/glightbox/releases/download/3.0.8/glightbox-master.zip">
<i class="fa fa-download"></i>
Download
</a>
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "glightbox",
"version": "3.0.7",
"name": "glightbox-ssr",
"version": "3.0.8",
"description": "Pure Javascript lightbox",
"main": "dist/js/glightbox.min.js",
"scripts": {
"watch": "node development/watcher.js"
},
"author": "Biati Digital",
"author": "NachoJusticia",
"keywords": [
"lightbox",
"javascript",
"gallery",
"popup"
],
"license": "MIT",
"homepage": "https://biati-digital.github.io/glightbox/",
"homepage": "https://nachojusticia.github.io/glightbox-ssr/",
"repository": {
"url": "https://github.com/biati-digital/glightbox",
"url": "https://nachojusticia.github.io/glightbox-ssr/",
"type": "git"
},
"bugs": "https://github.com/biati-digital/glightbox/issues",
"bugs": "https://github.com/NachoJusticia/glightbox-ssr/issues",
"devDependencies": {
"@babel/cli": "^7.10.3",
"@babel/core": "^7.10.3",
Expand Down
5 changes: 3 additions & 2 deletions src/js/glightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import touchNavigation from './core/touch-navigation.js';
import Slide from './core/slide.js';
import * as _ from './utils/helpers.js';

const version = '3.0.7';
const version = '3.0.8';
const isMobile = _.isMobile();
const isTouch = _.isTouch();
const html = document.getElementsByTagName('html')[0];
const isBrowser = _.isBrowser();
const html = isBrowser && document.getElementsByTagName('html')[0];

const defaults = {
selector: '.glightbox',
Expand Down
8 changes: 6 additions & 2 deletions src/js/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,16 @@ export function injectAssets(url, waitFor, callback) {
return;
}

export function isBrowser() {
return typeof window !== 'undefined';
}

export function isMobile() {
return ('navigator' in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i));
return isBrowser() && ('navigator' in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i));
}

export function isTouch() {
return isMobile() !== null || document.createTouch !== undefined || ('ontouchstart' in window) || ('onmsgesturechange' in window) || navigator.msMaxTouchPoints;
return isBrowser() && (isMobile() !== null || document.createTouch !== undefined || ('ontouchstart' in window) || ('onmsgesturechange' in window) || navigator.msMaxTouchPoints);
}

export function isFunction(f) {
Expand Down

0 comments on commit f35f549

Please sign in to comment.