SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mainWindow.webContents.executeJavaScript(`
  2.         window.doWindowControls = function () {
  3.           let window_controls = document.createElement("div");
  4.           let styles = document.createElement("style");
  5.           styles.innerHTML = ".window_controls{height:2rem;display:flex;grid-area:right;justify-self:right}li{list-style:none}.nav-bar{-webkit-app-region:no-drag;grid-template-columns:max-content auto max-content;grid-template-areas:'left center right'}i.window-controls{height:-webkit-fill-available;padding:0;float:right}i:hover.window-controls{background:rgba(88,88,88,.63)}i.exit-btn.window-controls{padding-top:.33rem;font-size:1.2rem}i.exit-btn:hover.window-controls{background:rgba(255,0,0,.65);opacity:.65}i.exit-btn:hover.window-controls i::before{opacity:1}i.max-btn.window-controls{padding-top:.34rem;font-size:.75rem}i.min-btn.window-controls{padding-right:1rem;padding-left:1rem;padding-top:.23rem;font-size:1.2rem;user-select:none;font-family:Cambria}";
  6.           window_controls.setAttribute("class", "window_controls");
  7.           const remote = require("electron").remote;
  8.           window.minimize = function () {
  9.             remote.BrowserWindow.getFocusedWindow().minimize();
  10.           }
  11.           window.maximize = function() {
  12.             remote.BrowserWindow.getFocusedWindow().isMaximized() ? remote.BrowserWindow.getFocusedWindow().unmaximize() : remote.BrowserWindow.getFocusedWindow().maximize();
  13.           }
  14.           window_controls.innerHTML = '<li class="window-controls not-mac" onclick="window.minimize();"><i class="min-btn window-controls">─</i></li><li class="window-controls not-mac" onclick="window.maximize();"><i class="max-btn window-controls"><svg width="45" height="20" viewBox="0 0 45 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M17 5H27V15H17V5ZM18 14V6H26V14H18Z" fill="currentColor" /></svg></i></li><li class="window-controls not-mac" onclick="window.close();"><i class="exit-btn window-controls"><svg width="45" height="20" viewBox="0 0 45 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M17 5V6H18V5H17ZM20 7H19V8H20V7ZM23 9H21V11H20V12H19V13H18V14H17V15H18V14H19V13H20V12H21V11H23V12H24V13H25V14H26V15H27V14H26V13H25V12H24V11H23V9ZM24 8H23V9H24V8ZM25 7H24V8H25V7ZM26 6H25V7H26V6ZM26 6H27V5H26V6Z" fill="currentColor" /><path d="M21 8H20V9H21V8Z" fill="currentColor" /><path d="M19 6H18V7H19V6Z" fill="currentColor" /><path fill-rule="evenodd" clip-rule="evenodd" d="M18 5V6H17V7H18V8H19V9H20V11H19V12H18V13H17V14H18V15H19V14H20V13H21V12H23V13H24V14H25V15H26V14H27V13H26V12H25V11H24V9H25V8H26V7H27V6H26V5H25V6H24V7H23V8H21V7H20V6H19V5H18ZM19 7V8H20V9H21V11H20V12H19V13H18V14H19V13H20V12H21V11H23V12H24V13H25V14H26V13H25V12H24V11H23V9H24V8H25V7H26V6H25V7H24V8H23V9H21V8H20V7H19ZM19 7V6H18V7H19Z" fill="currentColor" fill-opacity="0.4" /></svg></i></li>';
  15.           window_controls.appendChild(styles);
  16.           document.body.getElementsByClassName("nav-bar")[0].appendChild(window_controls);
  17.         }
  18.       `)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top