Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Commit

Permalink
fixed javascript not loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
DM164 committed Oct 21, 2019
1 parent 005cb35 commit b5179f6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
46 changes: 24 additions & 22 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,30 @@ function createWindow () {
mainWindow.webContents.send('volume-down')
})

mainWindow.webContents.executeJavaScript(`
const topBarJS = document.createElement('script');
topBarJS.setAttribute('src', 'https://dl.dropbox.com/s/dhoar8i0zkhhhd4/topBar.js?dl=0')
topBarJS.setAttribute('defer', '')
document.querySelector('body').prepend(topBarJS);
const retrieveServerData = document.createElement('script');
retrieveServerData.setAttribute('src', 'https://dl.dropbox.com/s/q45u3wo8zaqthnv/serverData.js?dl=0')
retrieveServerData.setAttribute('defer', '')
document.querySelector('body').prepend(retrieveServerData);
const javascript = document.createElement('script');
javascript.setAttribute('src', 'https://dl.dropbox.com/s/uaa8zh8b3zjogon/customscript.js?dl=0')
javascript.setAttribute('defer', '')
document.querySelector('body').prepend(javascript);
const stylesheet = document.createElement('link');
stylesheet.setAttribute("rel", "stylesheet");
stylesheet.setAttribute("href", "https://dl.dropbox.com/s/sgb2h7emq0uk8y4/style.css?dl=0");
document.querySelector('head').appendChild(stylesheet);
`)
mainWindow.webContents.on('dom-ready', function(){
mainWindow.webContents.executeJavaScript(`
const topBarJS = document.createElement('script');
topBarJS.setAttribute('src', 'https://dl.dropbox.com/s/dhoar8i0zkhhhd4/topBar.js?dl=0')
topBarJS.setAttribute('defer', '')
document.querySelector('body').prepend(topBarJS);
const retrieveServerData = document.createElement('script');
retrieveServerData.setAttribute('src', 'https://dl.dropbox.com/s/q45u3wo8zaqthnv/serverData.js?dl=0')
retrieveServerData.setAttribute('defer', '')
document.querySelector('body').prepend(retrieveServerData);
const javascript = document.createElement('script');
javascript.setAttribute('src', 'https://dl.dropbox.com/s/uaa8zh8b3zjogon/customscript.js?dl=0')
javascript.setAttribute('defer', '')
document.querySelector('body').prepend(javascript);
const stylesheet = document.createElement('link');
stylesheet.setAttribute("rel", "stylesheet");
stylesheet.setAttribute("href", "https://dl.dropbox.com/s/sgb2h7emq0uk8y4/style.css?dl=0");
document.querySelector('head').appendChild(stylesheet);
`)
})

//Opens the Github page to download the latest version of the client
ipcMain.on('openReleases', function(){
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
"package-win": "electron-packager . \"YouTube Music by DM\" --overwrite --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=\"Grandpa Mining\" --version-string.FileDescription=\"Desktop app built with electron for the YT Music service.\" --version-string.ProductName=\"YouTube Music App\"",
"package-linux": "electron-packager . \"YouTube Music by DM\" --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds",

"setup": "electron-installer-windows --src \"release-builds/YouTube Music by DM-win32-ia32/\" --dest installers/win/ --options.exe \"YouTube Music by DM.exe\" --options.icon assets/icons/win/icon.ico",
"setup-mac": "electron-installer-dmg \"release-builds/YouTube Music by DM-win32-ia32/\" \"YouTube Music by DM\"",
"setup-debian": "electron-installer-debian --src \"release-builds/YouTube Music by DM-linux-x64/\" --dest installers/linux/ --options.icon assets/icons/png/icon.png --arch amd64"
Expand Down

0 comments on commit b5179f6

Please sign in to comment.