Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.

Commit ca4b834

Browse files
committed
Many replacements and changes!
1 parent 75c21af commit ca4b834

File tree

4 files changed

+160
-513
lines changed

4 files changed

+160
-513
lines changed

google-chrome/keysharky.html

Lines changed: 0 additions & 226 deletions
This file was deleted.

google-chrome/listener.js

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,82 @@
11
var keysharkyListener = {
2-
3-
Grooveshark: function(toggle)
2+
3+
CloudPlayer: function(toggle)
44
{
55
// Chrome ... WTF did you made me write?
66
var elem = document.createElement("script");
77
elem.type = "text/javascript";
8-
elem.innerHTML = "Grooveshark." + toggle + ";";
9-
8+
//elem.innerHTML = "CloudPlayer." + toggle + ";";
9+
1010
var append = document.head.appendChild(elem);
1111
document.head.removeChild(append);
1212
},
13-
13+
1414
// Init keysharkyListener object
1515
init: function(){
16-
17-
if (window.location.href.search(/^http\:\/\/(listen|preview|staging|retro)\.grooveshark\.com/) != -1){
18-
16+
17+
if (window.location.href.search(/^https\:\/\/www\.amazon\.com\/gp\/dmusic\/mp3\/player/) != -1){
18+
1919
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
2020
var allToggles = {
21-
"play" : function(){ keysharkyListener.Grooveshark("togglePlayPause()"); },
22-
"stop" : function(){ keysharkyListener.Grooveshark("pause()"); },
23-
"prev" : function(){ keysharkyListener.Grooveshark("previous()"); },
24-
"next" : function(){ keysharkyListener.Grooveshark("next()"); },
25-
26-
"favorite" : function(){ keysharkyListener.Grooveshark("favoriteCurrentSong()"); },
27-
"voteup" : function(){ keysharkyListener.Grooveshark("voteCurrentSong(1)"); },
28-
"votedown" : function(){ keysharkyListener.Grooveshark("voteCurrentSong(-1)"); },
29-
"voteclear" : function(){ keysharkyListener.Grooveshark("voteCurrentSong(0)"); },
30-
31-
"mute" : function(){ keysharkyListener.Grooveshark("setIsMuted(Grooveshark.getIsMuted() ? false : true)"); },
32-
"volup" : function(){ keysharkyListener.Grooveshark("setVolume(Grooveshark.getVolume() + 10)"); },
33-
"voldown" : function(){ keysharkyListener.Grooveshark("setVolume(Grooveshark.getVolume() - 10)"); },
21+
"play" : function(){ keysharkyListener.CloudPlayer("togglePlayPause()"); },
22+
"stop" : function(){ keysharkyListener.CloudPlayer("pause()"); },
23+
"prev" : function(){ keysharkyListener.CloudPlayer("previous()"); },
24+
"next" : function(){ keysharkyListener.CloudPlayer("next()"); },
25+
26+
"mute" : function(){ keysharkyListener.CloudPlayer("setIsMuted(CloudPlayer.getIsMuted() ? false : true)"); },
27+
"volup" : function(){ keysharkyListener.CloudPlayer("setVolume(CloudPlayer.getVolume() + 10)"); },
28+
"voldown" : function(){ keysharkyListener.CloudPlayer("setVolume(CloudPlayer.getVolume() - 10)"); },
3429
};
35-
36-
if (request.method == "Grooveshark" && allToggles[request.action] != undefined){
37-
30+
31+
if (request.method == "CloudPlayer" && allToggles[request.action] != undefined){
32+
3833
try{
3934
allToggles[request.action]();
4035
sendResponse({"result" : 200});
4136
}catch(e){
4237
sendResponse({"result" : 500});
4338
}
44-
39+
4540
}
4641
});
47-
42+
4843
}
49-
44+
5045
this.unAllowedKeys = [16, 17, 18, 91];
51-
46+
5247
// Inject in tab keyup listener, who will check for (maybe) valid keysharky combo
5348
window.addEventListener('keyup', function(event){
54-
49+
5550
var modifiers = new Array();
5651
var key = '';
5752
var keycode = '';
58-
53+
5954
// Get the modifiers
6055
if(event.metaKey) modifiers.push('meta');
6156
if(event.ctrlKey) modifiers.push('control');
6257
if(event.altKey) modifiers.push('alt');
6358
if(event.shiftKey) modifiers.push('shift');
64-
59+
6560
// Get keycode
6661
if(event.keyCode) {
6762
keycode = event.keyCode;
6863
}
6964

7065
if(modifiers.length > 0 && !keysharkyListener.inArray(keysharkyListener.unAllowedKeys, keycode)) {
71-
66+
7267
var request = {
7368
"method" : "keyup",
7469
"modifiers" : modifiers,
7570
"keycode" : keycode,
7671
};
7772
chrome.extension.sendRequest(request, function(response){});
78-
73+
7974
}
80-
75+
8176
}, false);
82-
77+
8378
},
84-
79+
8580
// Check if Object is Array
8681
inArray: function(arr, value){
8782
var i;
@@ -92,13 +87,13 @@ var keysharkyListener = {
9287
}
9388
return false;
9489
}
95-
90+
9691
}
9792

9893
try{
9994

10095
keysharkyListener.init();
101-
96+
10297
}catch(e){
10398
// Fail, but with dignity!
10499
}

google-chrome/manifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "keySharky",
3-
"version": "1.5.4",
4-
"description": "Add missing keyboard functionality to Grooveshark!",
5-
"background_page": "keysharky.html",
2+
"name": "keyMazony",
3+
"version": "0.1",
4+
"description": "Add missing keyboard functionality to Amazon Cloud Player!",
5+
"background_page": "keymazony.html",
66
"options_page": "options.html",
77
"permissions": ["tabs"],
88
"content_scripts": [

0 commit comments

Comments
 (0)