diff --git a/css/fontawesome.css b/css/fontawesome.css
index 5ac63a9..10b173d 100644
--- a/css/fontawesome.css
+++ b/css/fontawesome.css
@@ -4299,8 +4299,7 @@ readers do not read off random characters that represent icons */
font-style: normal;
font-weight: normal;
font-display: auto;
- src: url("../font/fa-brands-400.eot");
- src: url("../font/fa-brands-400.eot?#iefix") format("embedded-opentype"), url("../font/fa-brands-400.woff2") format("woff2"), url("../font/fa-brands-400.woff") format("woff"), url("../font/fa-brands-400.ttf") format("truetype"), url("../font/fa-brands-400.svg#fontawesome") format("svg"); }
+ src: url("../font/fa-brands-400.woff2") format("woff2")}
.fa {
font-family: 'Font Awesome 5 Free';
@@ -4313,8 +4312,7 @@ readers do not read off random characters that represent icons */
font-style: normal;
font-weight: 400;
font-display: auto;
- src: url("../font/fa-regular-400.eot");
- src: url("../font/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../font/fa-regular-400.woff2") format("woff2"), url("../font/fa-regular-400.woff") format("woff"), url("../font/fa-regular-400.ttf") format("truetype"), url("../font/fa-regular-400.svg#fontawesome") format("svg"); }
+ src: url("../font/fa-regular-400.woff2") format("woff2")}
.far {
font-family: 'Font Awesome 5 Free';
@@ -4324,8 +4322,7 @@ readers do not read off random characters that represent icons */
font-style: normal;
font-weight: 900;
font-display: auto;
- src: url("../font/fa-solid-900.eot");
- src: url("../font/fa-solid-900.eot?#iefix") format("embedded-opentype"), url("../font/fa-solid-900.woff2") format("woff2"), url("../font/fa-solid-900.woff") format("woff"), url("../font/fa-solid-900.ttf") format("truetype"), url("../font/fa-solid-900.svg#fontawesome") format("svg"); }
+ src: url("../font/fa-solid-900.woff2") format("woff2")}
.fas {
font-family: 'Font Awesome 5 Free';
diff --git a/css/setup.css b/css/setup.css
index 8fb105a..177fa13 100644
--- a/css/setup.css
+++ b/css/setup.css
@@ -124,17 +124,12 @@
@font-face {
font-family: 'montserrat';
font-style: normal;
- src: local('Material Icons'),
- local('Montserrat'),
+ src: local('Montserrat'),
url(../font/Montserrat-Regular.ttf) format('truetype');
}
@font-face {
font-family: 'icomoon';
- src: url('../font/icomoon.eot?t564px');
- src: url('../font/icomoon.eot?t564px#iefix') format('embedded-opentype'),
- url('../font/icomoon.ttf?t564px') format('truetype'),
- url('../font/icomoon.woff?t564px') format('woff'),
- url('../font/icomoon.svg?t564px#icomoon') format('svg');
+ src: url('../font/icomoon.woff?t564px') format('woff');
font-weight: normal;
font-style: normal;
}
diff --git a/font/fa-brands-400.eot b/font/fa-brands-400.eot
deleted file mode 100644
index 02a5ecb..0000000
Binary files a/font/fa-brands-400.eot and /dev/null differ
diff --git a/font/fa-brands-400.svg b/font/fa-brands-400.svg
deleted file mode 100644
index 1b168ee..0000000
--- a/font/fa-brands-400.svg
+++ /dev/null
@@ -1,3459 +0,0 @@
-
-
-
-
diff --git a/font/fa-brands-400.ttf b/font/fa-brands-400.ttf
deleted file mode 100644
index 3926cb1..0000000
Binary files a/font/fa-brands-400.ttf and /dev/null differ
diff --git a/font/fa-brands-400.woff b/font/fa-brands-400.woff
deleted file mode 100644
index 7bcc97e..0000000
Binary files a/font/fa-brands-400.woff and /dev/null differ
diff --git a/font/fa-regular-400.eot b/font/fa-regular-400.eot
deleted file mode 100644
index 7b7a1d7..0000000
Binary files a/font/fa-regular-400.eot and /dev/null differ
diff --git a/font/fa-regular-400.svg b/font/fa-regular-400.svg
deleted file mode 100644
index 80cf2b2..0000000
--- a/font/fa-regular-400.svg
+++ /dev/null
@@ -1,803 +0,0 @@
-
-
-
-
diff --git a/font/fa-regular-400.ttf b/font/fa-regular-400.ttf
deleted file mode 100644
index 17b86c2..0000000
Binary files a/font/fa-regular-400.ttf and /dev/null differ
diff --git a/font/fa-regular-400.woff b/font/fa-regular-400.woff
deleted file mode 100644
index 822243e..0000000
Binary files a/font/fa-regular-400.woff and /dev/null differ
diff --git a/font/fa-solid-900.eot b/font/fa-solid-900.eot
deleted file mode 100644
index dfc8921..0000000
Binary files a/font/fa-solid-900.eot and /dev/null differ
diff --git a/font/fa-solid-900.svg b/font/fa-solid-900.svg
deleted file mode 100644
index 132373b..0000000
--- a/font/fa-solid-900.svg
+++ /dev/null
@@ -1,4527 +0,0 @@
-
-
-
-
diff --git a/font/fa-solid-900.ttf b/font/fa-solid-900.ttf
deleted file mode 100644
index 97ae69b..0000000
Binary files a/font/fa-solid-900.ttf and /dev/null differ
diff --git a/font/fa-solid-900.woff b/font/fa-solid-900.woff
deleted file mode 100644
index 86d9b32..0000000
Binary files a/font/fa-solid-900.woff and /dev/null differ
diff --git a/font/icomoon.eot b/font/icomoon.eot
deleted file mode 100644
index 53ad8da..0000000
Binary files a/font/icomoon.eot and /dev/null differ
diff --git a/font/icomoon.svg b/font/icomoon.svg
deleted file mode 100644
index ba47839..0000000
--- a/font/icomoon.svg
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/js/api.js b/js/api.js
index d4d003b..203741e 100644
--- a/js/api.js
+++ b/js/api.js
@@ -4,7 +4,9 @@ const Blockbench = {
isWeb: !isApp,
isMobile: !isApp && window.innerWidth <= 640,
isTouch: 'ontouchend' in document,
- isPWA: navigator.standalone || window.matchMedia('(display-mode: standalone)').matches,
+ get isPWA() {
+ return navigator.standalone || window.matchMedia('(display-mode: standalone)').matches;
+ },
version: appVersion,
platform: 'web',
flags: [],
diff --git a/js/boot_loader.js b/js/boot_loader.js
index 9f9af62..24a871e 100644
--- a/js/boot_loader.js
+++ b/js/boot_loader.js
@@ -44,7 +44,7 @@ translateUI()
console.log(`Three.js r${THREE.REVISION}`)
console.log('%cBlockbench ' + appVersion + (isApp
? (' Desktop (' + Blockbench.operating_system +')')
- : (' Web ('+capitalizeFirstLetter(Blockbench.browser)+')')),
+ : (' Web ('+capitalizeFirstLetter(Blockbench.browser) + (Blockbench.isPWA ? ', PWA)' : ')'))),
'background-color: #3e90ff; color: black; padding: 4px;'
)
var startups = parseInt(localStorage.getItem('startups')||0);
diff --git a/js/file_system.js b/js/file_system.js
index 07af3fe..56533a4 100644
--- a/js/file_system.js
+++ b/js/file_system.js
@@ -250,21 +250,27 @@ Object.assign(Blockbench, {
if (options.custom_writer) {
options.custom_writer(options.content, file_name)
- } else if (options.savetype === 'image') {
-
- var download = document.createElement('a');
- download.href = options.content
- download.download = file_name;
- if (Blockbench.browser === 'firefox') document.body.appendChild(download);
- download.click();
- if (Blockbench.browser === 'firefox') document.body.removeChild(download);
-
- } else if (options.savetype === 'zip' || options.savetype === 'buffer' || options.savetype === 'binary') {
- saveAs(options.content, file_name)
-
} else {
- var blob = new Blob([options.content], {type: "text/plain;charset=utf-8"});
- saveAs(blob, file_name, {autoBOM: true})
+
+ let a = document.createElement('a');
+
+ if (options.savetype === 'image') {
+ a.href = options.content;
+
+ } else if (options.savetype === 'zip' || options.savetype === 'buffer' || options.savetype === 'binary') {
+ let blob = new Blob(data, {type: "octet/stream"});
+ a.href = window.URL.createObjectURL(blob);
+
+ } else {
+ a.href = 'data:text/plain;charset=utf-8,' + encodeURIComponent(options.content);
+ }
+
+ a.download = file_name;
+
+ if (Blockbench.browser === 'firefox') document.body.appendChild(a);
+ a.click();
+ if (Blockbench.browser === 'firefox') document.body.removeChild(a);
+
}
if (typeof cb === 'function') {
cb(file_name)
diff --git a/js/web.js b/js/web.js
index c9e8334..f3a75ab 100644
--- a/js/web.js
+++ b/js/web.js
@@ -1,17 +1,10 @@
-(function() {
- $.getScript("lib/file_saver.js");
- $.getScript('https://rawgit.com/nodeca/pako/master/dist/pako.min.js', function() {
- window.zlib = pako
- })
-})()
-
function initializeWebApp() {
$(document.body).on('click', 'a[href]', (event) => {
event.preventDefault();
window.open(event.target.href, '_blank');
});
- if (!Blockbench.isMobile && !Blockbench.isPWA) {
+ if (!Blockbench.isTouch && !Blockbench.isPWA) {
$('#web_download_button').show()
}
@@ -19,6 +12,9 @@ function initializeWebApp() {
document.body.style.imageRendering = 'crisp-edges'
}
}
+window.matchMedia('(display-mode: standalone)').addEventListener('change', (evt) => {
+ if (!Blockbench.isMobile) $('#web_download_button').toggle(!evt.matches);
+});
function loadInfoFromURL() {
if (location.hash.substr(1, 8) == 'session=') {
diff --git a/lib/file_saver.js b/lib/file_saver.js
deleted file mode 100644
index 58b2666..0000000
--- a/lib/file_saver.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-* FileSaver.js
-* A saveAs() FileSaver implementation.
-*
-* By Eli Grey, http://eligrey.com
-*
-* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)
-* source : http://purl.eligrey.com/github/FileSaver.js
-*/
-
-
-// The one and only way of getting global scope in all enviorment
-// https://stackoverflow.com/q/3277182/1008999
-var _global = (function () {
-// some use content security policy to disable eval
- try {
- return Function('return this')() || (42, eval)('this')
- } catch (e) {
- // every global should have circular reference
- // used for checking if someone writes var window = {}; var self = {}
- return typeof window === 'object' && window.window === window ? window
- : typeof self === 'object' && self.self === self ? self
- : typeof global === 'object' && global.global === global ? global : this
- }
-})()
-
-function bom (blob, opts) {
- if (typeof opts === 'undefined') opts = { autoBom: false }
- else if (typeof opts !== 'object') {
- console.warn('Depricated: Expected third argument to be a object')
- opts = { autoBom: !opts }
- }
-
- // prepend BOM for UTF-8 XML and text/* types (including HTML)
- // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF
- if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
- return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type })
- }
- return blob
-}
-
-function download (url, name, opts) {
- var xhr = new XMLHttpRequest()
- xhr.open('GET', url)
- xhr.responseType = 'blob'
- xhr.onload = function () {
- saveAs(xhr.response, name, opts)
- }
- xhr.onerror = function () {
- console.error('could not download file')
- }
- xhr.send()
-}
-
-function corsEnabled (url) {
- var xhr = new XMLHttpRequest()
- // use sync to avoid popup blocker
- xhr.open('HEAD', url, false)
- xhr.send()
- return xhr.status >= 200 && xhr.status <= 299
-}
-
-// `a.click()` don't work for all browsers (#465)
-function click(node) {
- try {
- node.dispatchEvent(new MouseEvent('click'))
- } catch (e) {
- var evt = document.createEvent('MouseEvents')
- evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,
- 20, false, false, false, false, 0, null)
- node.dispatchEvent(evt)
- }
-}
-
-var saveAs = _global.saveAs ||
-// probably in some web worker
-(typeof window !== 'object' || window !== _global)
- ? function saveAs () { /* noop */ }
-
-// Use download attribute first if possible (#193 Lumia mobile)
-: 'download' in HTMLAnchorElement.prototype
-? function saveAs (blob, name, opts) {
- var URL = _global.URL || _global.webkitURL
- var a = document.createElement('a')
- name = name || blob.name || 'download'
-
- a.download = name
- a.rel = 'noopener' // tabnabbing
-
- // TODO: detect chrome extensions & packaged apps
- // a.target = '_blank'
-
- if (typeof blob === 'string') {
- // Support regular links
- a.href = blob
- if (a.origin !== location.origin) {
- corsEnabled(a.href)
- ? download(blob, name, opts)
- : click(a, a.target = '_blank')
- } else {
- click(a)
- }
- } else {
- // Support blobs
- a.href = URL.createObjectURL(blob)
- setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s
- setTimeout(function () { click(a) }, 0)
- }
-}
-
-// Use msSaveOrOpenBlob as a second approch
-: 'msSaveOrOpenBlob' in navigator
-? function saveAs (blob, name, opts) {
- name = name || blob.name || 'download'
-
- if (typeof blob === 'string') {
- if (corsEnabled(blob)) {
- download(blob, name, opts)
- } else {
- var a = document.createElement('a')
- a.href = blob
- a.target = '_blank'
- setTimeout(function () { click(a) })
- }
- } else {
- navigator.msSaveOrOpenBlob(bom(blob, opts), name)
- }
-}
-
-// Fallback to using FileReader and a popup
-: function saveAs (blob, name, opts, popup) {
- // Open a popup immediately do go around popup blocker
- // Mostly only avalible on user interaction and the fileReader is async so...
- popup = popup || open('', '_blank')
- if (popup) {
- popup.document.title =
- popup.document.body.innerText = 'downloading...'
- }
-
- if (typeof blob === 'string') return download(blob, name, opts)
-
- var force = blob.type === 'application/octet-stream'
- var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari
- var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent)
-
- if ((isChromeIOS || (force && isSafari)) && typeof FileReader === 'object') {
- // Safari doesn't allow downloading of blob urls
- var reader = new FileReader()
- reader.onloadend = function () {
- var url = reader.result
- url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')
- if (popup) popup.location.href = url
- else location = url
- popup = null // reverse-tabnabbing #460
- }
- reader.readAsDataURL(blob)
- } else {
- var URL = _global.URL || _global.webkitURL
- var url = URL.createObjectURL(blob)
- if (popup) popup.location = url
- else location.href = url
- popup = null // reverse-tabnabbing #460
- setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s
- }
-}
-
-//module.exports = _global.saveAs = saveAs.saveAs = saveAs
\ No newline at end of file
diff --git a/service_worker.js b/service_worker.js
index 76c14d6..b16b967 100644
--- a/service_worker.js
+++ b/service_worker.js
@@ -13,7 +13,7 @@ const staticAssets = [
'./assets/player_skin.png',
'./assets/zombie.png',
'./favicon.png',
- './manifest.json',
+ './manifest.webmanifest',
];
self.addEventListener('install', async (event) => {