Skip to content

Commit

Permalink
Add support for inbox wowowow ‼️, fixes #33
Browse files Browse the repository at this point in the history
  • Loading branch information
muan committed Mar 8, 2015
1 parent 9256297 commit 5e7c4fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@
"content_scripts": [
{
"matches": [
"https://mail.google.com/*"
"https://mail.google.com/*",
"https://inbox.google.com/*"
],
"css": [
"src/inject/inject.css"
]
},
{
"matches": [
"https://mail.google.com/*"
"https://mail.google.com/*",
"https://inbox.google.com/*"
],
"js": [
"js/jquery.js",
Expand Down
16 changes: 12 additions & 4 deletions chrome/src/inject/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ chrome.extension.sendMessage({}, function(settings) {
initOnHashChangeAction(settings['Domains'])
initShortcuts(settings['Shortcut'], settings['BackgroundShortcut'])
initListViewShortcut(settings['RegExp'])
initForInbox()

This comment has been minimized.

Copy link
@nitaria

nitaria Dec 6, 2016

Nitnot

})

This comment has been minimized.

Copy link
@nitaria

nitaria Dec 6, 2016

Nitno


function initForInbox() {
window.idled = true
}

function initOnHashChangeAction(domains) {
allDomains = "//github.com,"
if(domains) allDomains += domains
Expand Down Expand Up @@ -65,6 +70,8 @@ function initOnHashChangeAction(domains) {
function initShortcuts(shortcut, backgroundShortcut) {
$(document).on("keydown", function(event) {
// Shortcut: bind user's combination, if a button exist and event not in a textarea
$('.gE').removeClass('github-link')
$('.scroll-list-item-open .gE, .scroll-list-item-highlighted .gE').addClass('github-link')
if( processRightCombinationBasedOnShortcut(shortcut, event) && window.idled && getVisible(document.getElementsByClassName('github-link')) && notAnInput(event.target)) {
triggerGitHubLink(false)
}
Expand Down Expand Up @@ -170,11 +177,12 @@ function linkWithUrl (url) {
function getVisible (nodeList) {
if(nodeList.length) {
var node
$(nodeList).map(function() {
if(typeof node == 'undefined' && (this.clientWidth > 0 || this.clientHeight > 0)) {
node = this
for(var i=0; i < nodeList.length; i++) {
if(typeof node === 'undefined' && (nodeList[i].offsetHeight > 0 || nodeList[i].clientWidth > 0 || nodeList[i].clientHeight > 0)) {
node = nodeList[i]
break
}
})
}
return node
}
}
Expand Down

0 comments on commit 5e7c4fa

Please sign in to comment.