-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from scaryuncledevin/master
Cleaned up script injections and added an options page.
- Loading branch information
Showing
8 changed files
with
401 additions
and
41 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
this is terrible | ||
---------------- | ||
but it got me a Nexus 6 after awhile | ||
|
||
PLEASE OPEN THE OPTIONS PAGE TO SET YOUR PUSHBULLET API KEY AND SELECT DEVICES |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
{ | ||
"name": "I want nexus", | ||
"description": "I want nexus", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"content_scripts": [ | ||
{ | ||
"matches": ["https://play.google.com/store/devices/*"], | ||
"js": ["insertion.js"] | ||
"js": ["jquery.min.js","pushbullet.js","iwantnexus.js"] | ||
} | ||
], | ||
"web_accessible_resources": [ | ||
"iwantnexus.js" | ||
], | ||
"options_page": "options.html", | ||
"permissions": ["storage"], | ||
"manifest_version": 2 | ||
} |
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,45 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>I Want A Nexus 6 Options</title> | ||
</head> | ||
<link href="reset.css" type="text/css" rel="stylesheet"> | ||
<style> | ||
body { | ||
font-family:Arial, Helvetica, sans-serif; | ||
font-size:14px; | ||
color:#000000; | ||
background-color:#FFFFFF; | ||
padding:5px; | ||
} | ||
|
||
strong { | ||
font-weight:bold; | ||
} | ||
</style> | ||
<body> | ||
|
||
<div> | ||
<label for="refresh_interval"><strong>Refresh Interval (ms):</strong></label> | ||
<input type="text" id="refresh_interval"> | ||
</div> | ||
<br> | ||
<div> | ||
<label for="api_key"><strong>Pushbullet Access Token:</strong></label> | ||
<a href="https://www.pushbullet.com/account" target="_blank">?</a> | ||
<input type="text" id="api_key" size="50"> | ||
</div> | ||
<br> | ||
<div id="devices"> | ||
Enter your Pushbullet Access Token above and click save to view available devices for notifications to be pushed to. | ||
</div> | ||
<br> | ||
<button id="save">Save</button> | ||
<button id="test">Test</button> | ||
|
||
</body> | ||
</html> | ||
|
||
<script src="jquery.min.js"></script> | ||
<script src="pushbullet.js"></script> | ||
<script src="options.js"></script> |
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,58 @@ | ||
var devices = []; | ||
|
||
$("#save").click(function(e) { | ||
devices = []; | ||
$(".devices").filter(':checked').each(function(index, element) { | ||
devices.push($(element).val()); | ||
}); | ||
|
||
chrome.storage.sync.set({ | ||
refresh_interval: $("#refresh_interval").val(), | ||
api_key: $("#api_key").val(), | ||
devices: devices | ||
}); | ||
|
||
PushBullet.APIKey = $("#api_key").val(); | ||
load_devices(devices); | ||
}); | ||
|
||
chrome.storage.sync.get({ | ||
api_key: '', | ||
devices:[], | ||
refresh_interval:1000 | ||
}, function(items) { | ||
$("#api_key").val(items.api_key); | ||
$("#refresh_interval").val(items.refresh_interval); | ||
PushBullet.APIKey = items.api_key; | ||
devices = items.devices; | ||
load_devices(); | ||
}); | ||
|
||
function load_devices() | ||
{ | ||
$("#devices").empty().append( | ||
$("<div>").append("DO NOT SELECT CHROME DEVICES OR YOU MAY END UP IN A NEVERENDING LOOP") | ||
); | ||
PushBullet.devices(function(err, res) { | ||
if(err) { | ||
throw err; | ||
} else { | ||
$.each(res.devices, function(index, device) | ||
{ | ||
$("#devices").append( | ||
$("<div>").append( | ||
$("<input>").attr("type", "checkbox").addClass("devices").attr("id",device.iden).val(device.iden).prop('checked', devices.indexOf(device.iden) !== -1) | ||
).append( | ||
$("<label>").attr("for",device.iden).append(device.nickname) | ||
) | ||
); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
$("#test").click(function(e){ | ||
$.each(devices, function(index, device_iden){ | ||
PushBullet.push("link", device_iden, null, {title: "I got you a Nexus 6", url: "https://www.google.com/"}); | ||
}); | ||
}); |
Oops, something went wrong.