Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kerenon committed Mar 18, 2024
1 parent fe6d9ed commit eb9d75b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
5 changes: 5 additions & 0 deletions content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Dynamically load an external script
let script = document.createElement('script');
script.src = chrome.runtime.getURL('script.js'); // For Chrome Extensions
// script.src = 'script.js'; // For web applications
document.head.appendChild(script);
Binary file added images/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"manifest_version": 3,
"name": "iBroadcast Better",
"description": "Forces the default streaming bitrate to 320kbps if \"Original Bitrate Streaming\" is not selected. Requires premium account to work. The player still shows 128kbps but you can actually hear the difference (or inspect the page source and see there).",
"version": "0.37",
"permissions": [],
"icons": {
"16": "images/icon16.png",
"32": "images/icon32.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
},
"content_scripts": [
{
"matches": [ "*://*.ibroadcast.com/*" ],
"js": ["content.js"],
"run_at": "document_idle"
}
],
"web_accessible_resources": [
{
"resources": ["script.js"],
"matches": [ "*://*.ibroadcast.com/*" ]
}
],
"action": {
"default_icon": "images/icon32.png"
}
}
24 changes: 24 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const originalSetup = iBroadcastPlay.prototype.setup;

iBroadcastPlay.prototype.setup = function() {
originalSetup.call(this);

// Redefine `ongettrackurl` within setup to change the replacement
this.ongettrackurl = (trackId)=>{
if (trackId == undefined || trackId == null) {
return null;
}
let playurl = ib.hosts.streaming;
playurl += music.library.tracks[trackId][music.library.tracks.map.file];
if (cookies.origbitrate && music.user.premium) {
playurl = playurl.replace(/128/, 'orig');
}
if (! cookies.origbitrate && music.user.premium) {
playurl = playurl.replace(/128/, 320);
document.getElementsByClassName('mgr-player-bitrate').innerHTML = ' • 320Kbps"'
}
playurl += "?Expires=" + music.library.expires + "&Signature=" + music.user.token + "&platform=" + ib.client + "&version=1.1&user_id=" + music.user.id + "&file_id=" + trackId;
ib.log("- play url: " + playurl, this);
return (playurl);
};
};

0 comments on commit eb9d75b

Please sign in to comment.