This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Improve main.js

  • Loading branch information...
qgustavor committed Jul 16, 2018
1 parent 6322635 commit 8897b53f2e547dd0948cb4923a7c1ed51ebaf3b6
Showing with 4 additions and 3 deletions.
  1. +4 −3 dist/main.js
View
@@ -1,4 +1,5 @@
;(function () {
var helpURL = 'https://github.com/qgustavor/direct-mega#direct-mega'
var header = document.createElement('h1')
header.textContent = 'Direct MEGA'
document.body.appendChild(header)
@@ -32,13 +33,13 @@
if (hasFile) {
location.href = location.pathname + '?' + identifier
} else {
location.href = 'https://github.com/qgustavor/direct-mega#direct-mega'
location.href = helpURL
}
}, fallback)
} else if (hasFile) {
fallback()
} else {
location.href = 'https://github.com/qgustavor/direct-mega#direct-mega'
location.href = helpURL
}
function fallback () {
var script = document.createElement('script')
@@ -48,7 +49,7 @@
}
function handleFallbackError () {
var errorMessage = document.createElement('p')
errorMessage.textContent = 'An error happened while loading. Check your network connection and try again.'
errorMessage.textContent = 'An error happened while loading. Check your network connection then try again.'
document.body.appendChild(errorMessage)
}
}())

0 comments on commit 8897b53

Please sign in to comment.