Permalink
Browse files

overlay change background

  • Loading branch information...
Manuel-777 committed Jan 22, 2019
1 parent 09a4a9f commit b49db8480ed9d1ee932a5b7878e655f40e00d0a5
Showing with 24 additions and 2 deletions.
  1. +24 −2 window_overlay/overlay.js
@@ -15,8 +15,8 @@ global
*/
const electron = require('electron');
const {webFrame, remote} = require('electron');

const ipc = electron.ipcRenderer;
const fs = require("fs");
const ipc = electron.ipcRenderer;

let matchBeginTime = Date.now();
let priorityTimers = [];
@@ -236,6 +236,7 @@ ipc.on('set_settings', function (event, settings) {
*/
overlayAlpha = settings.overlay_alpha;
overlayAlphaBack = settings.overlay_alpha_back;
change_background(settings.back_url);

console.log(settings.overlay_scale);
webFrame.setZoomFactor(settings.overlay_scale/100);
@@ -582,6 +583,27 @@ function hoverCard(grpId) {
}
}

function change_background(arg) {
if (arg == "default" || arg == "") {
$('.overlay_bg_image').css("background-image", "");
}
else if (fs.existsSync(arg)) {
$('.overlay_bg_image').css("background-image", "url("+arg+")");
}
else {
$.ajax({
url: arg,
type: 'HEAD',
error: function() {
$('.overlay_bg_image').css("background-image", "");
},
success: function() {
$('.overlay_bg_image').css("background-image", "url("+arg+")");
}
});
}
}


$(document).ready(function() {
recreateClock();

0 comments on commit b49db84

Please sign in to comment.