Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Commit

Permalink
Added new version popup
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyswilliamsza committed May 22, 2019
1 parent 3716a2f commit f44a8f1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "googlekeepdesktop",
"productName": "Google Keep Desktop Edition",
"version": "1.0.1",
"description": "A desktop version of Google's Keep Notekeeping service",
"version": "1.0.2",
"description": "A Desktop edition of Google Keep",
"main": "src/main.js",
"scripts": {
"start": "electron .",
Expand All @@ -12,7 +12,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"electron-window-state": "^5.0.3"
"electron-window-state": "^5.0.3",
"jquery": "^3.4.1"
},
"build": {
"appId": "rhyswilliamsza.googlekeepdesktop",
Expand Down
19 changes: 16 additions & 3 deletions src/js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* Do actions on window load
*/

var $ = require('jquery');
var pjson = require('../package.json');

window.onload = function () {
const webview = document.querySelector('webview');
const loading = document.querySelector('#loading');
Expand All @@ -15,14 +18,24 @@ window.onload = function () {
const loadstop = () => {
//Shift Down Top Bar
webview.insertCSS("#gb > div:nth-child(2) { padding-top: 20px })");
webview.executeJavaScript('//Add Version\nvar original = document.getElementsByClassName("hSRGPd-haAclf")[0].innerHTML;\nif (!original.includes("Google Keep Desktop")) {\n document.getElementsByClassName("hSRGPd-haAclf")[0].innerHTML = "<p style=\\"color: #999; font-size: 12px; padding: 0px 5px; text-decoration: none; white-space: nowrap;\\">Google Keep Desktop V1.0.1</p>" + original;\n}\n\n//Remove Apps Drawer\ndocument.querySelector("[aria-label=\'Google apps\']").style.display = "none";');

webview.executeJavaScript('//Add Version\nvar original = document.getElementsByClassName("hSRGPd-haAclf")[0].innerHTML;\nif (!original.includes("Google Keep Desktop")) {\n document.getElementsByClassName("hSRGPd-haAclf")[0].innerHTML = "<p style=\\"color: #999; font-size: 12px; padding: 0px 5px; text-decoration: none; white-space: nowrap;\\">Google Keep Desktop V' + pjson.version + '</p>" + original;\n}\n\n//Remove Apps Drawer\ndocument.querySelector("[aria-label=\'Google apps\']").style.display = "none";');

//Loadout
loading.style.animation = "loadFadeOut 0.7s forwards";
loading.style.animation = "loadFadeOut 0.4s forwards";
setTimeout(function () {
loading.style.display = "none";
}, 1000);
}, 500);
};

$.getJSON("https://api.github.com/repos/rhyswilliamsza/GoogleKeepDesktop/releases/latest", function(data) {
var currentversion = pjson.version.replace(/\D/g,'');
var latestversion = data.name.replace(/\D/g,'');

if (latestversion > currentversion) {
alert("There is a new version available!")
}
})

webview.addEventListener('did-stop-loading', loadstop);
};

0 comments on commit f44a8f1

Please sign in to comment.