Skip to content

Commit

Permalink
Added option to scroll using keyboard
Browse files Browse the repository at this point in the history
-You can scroll up and down trough posts using Shift+Up/Down
-Some dark theme additions
  • Loading branch information
VoOoLoX committed Sep 11, 2016
1 parent 52faf4f commit d0e8435
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
18 changes: 18 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const elementReady = require('element-ready');
const ipcRenderer = electron.ipcRenderer;
const $ = document.querySelector.bind(document);

var post = 0;

const selectors = {
root: '#react-root ._onabe',
loginButton: '#react-root ._fcn8k'
Expand Down Expand Up @@ -50,6 +52,22 @@ ipcRenderer.on('navigate-profile', () => {
}
});

ipcRenderer.on('navigate-up', () => {
if (post > 1 ){
post -= 1;
var title = $('#react-root > section > main > section > div > div:nth-child(1) > article:nth-child('+post+') > header');
var rect = title.getBoundingClientRect();
window.scrollBy(0,rect.top);
}
});

ipcRenderer.on('navigate-down', () => {
post += 1;
var title = $('#react-root > section > main > section > div > div:nth-child(1) > article:nth-child('+post+') > header');
var rect = title.getBoundingClientRect();
window.scrollBy(0,rect.top);
});


function backButton() {
const body = $('body');
Expand Down
33 changes: 32 additions & 1 deletion dark-browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,16 @@ html.dark-mode #react-root ._3sst1 {
color: #bcc0c4;
}

/*add profile photo popup*/
html.dark-mode #react-root ._82fo9._29u55 {
background-color: #202c3a;
border-bottom: 1px solid rgba(255, 255, 255, .08);
}


/*comment input text color*/
html.dark-mode #react-root ._7uiwk._qy55y {
color: #fafafa;
}

/**
* Search
Expand Down Expand Up @@ -230,6 +238,29 @@ html.dark-mode #react-root ._76rrx p {
color: #bcc0c4;
}

/*Suggested*/
html.dark-mode #react-root ._3p78u._28ejm._go7te._pn9fv::before {
background-color: #202c3a;
border-left: 1px solid rgba(80,80,80,.2);
border-top: 1px solid rgba(80,80,80,.2);
}
html.dark-mode #react-root ._3p78u._28ejm._go7te._pn9fv {
background-color: #202c3a;
border-top: 1px solid rgba(80,80,80,.2);
border-bottom: 1px solid rgba(80,80,80,.2);
}

/*Profile card*/
html.dark-mode #react-root ._owacc._1po6t {
background-color: #29384A;
border: 1px solid rgba(0,0,0,.08);
}

/*http://i.imgur.com/1t7aeKW.png*/
html.dark-mode #react-root ._azlhu{
background-color: #192633;
}

/**
* Photo view
*/
Expand Down
17 changes: 17 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ const template = [
},
{
role: 'zoomout'
},
{
type: 'separator'
},
{
label: 'Scroll a post up',
accelerator: 'Shift+Up',
click() {
sendAction('navigate-up');
}
},
{
label: 'Scroll a post down',
accelerator: 'Shift+Down',
click() {
sendAction('navigate-down');
}
}
]
},
Expand Down

0 comments on commit d0e8435

Please sign in to comment.