-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SteakOverCooked
authored and
SteakOverCooked
committed
Jan 30, 2018
1 parent
deb7598
commit 8431c8f
Showing
5 changed files
with
84 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { | ||
switch(message.type) { | ||
case "console.log": | ||
console.log(message.obj); | ||
break; | ||
} | ||
return true; | ||
}); | ||
|
||
chrome.runtime.onInstalled.addListener(function(details){ | ||
if(details.reason == "install"){ | ||
//call a function to handle a first install | ||
console.log("onInstalled: Thank you!"); | ||
}else if(details.reason == "update"){ | ||
//call a function to handle an update | ||
console.log("new version available."); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
$(function() { | ||
let id; | ||
let website; | ||
|
||
chrome.storage.sync.get('utopian_settings', function(data) { | ||
if (data && data.utopian_settings) { | ||
let utopian = data.utopian_settings; | ||
if (utopian["steemit_id"]) { | ||
id = utopian["steemit_id"].trim(); | ||
} | ||
if (utopian["steemit_website"]) { | ||
website = utopian["steemit_website"].trim(); | ||
} | ||
} | ||
}); | ||
website = website || "steemit.com"; | ||
|
||
// short cut Alt + S to switch between utopian and steemit | ||
$(document).keydown(function(e) { | ||
if(e.key.toLowerCase() == "s" && e.altKey) { | ||
var url = document.location.href; | ||
if (url.includes("utopian.io")) { | ||
document.location.href = url.replace("utopian.io", website); | ||
} else if (url.includes("steemit.com")) { | ||
document.location.href = url.replace("steemit.com", "utopian.io"); | ||
} else if (url.includes("busy.org")) { | ||
document.location.href = url.replace("busy.org", "utopian.io"); | ||
} | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters