Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# YouTube-HD
YouTube HD is a very lightweight extension that forces the YouTube HTML5 and Flash players to play videos in full-HD or highest available quality.
62 changes: 62 additions & 0 deletions v3/data/inject/isolated.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< Updated upstream
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down Expand Up @@ -57,3 +58,64 @@ port.addEventListener('quality', e => {
quality
});
});
=======
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict';

const prefs = {
hd: true,
once: false,
higher: true,
quality: -1,
log: false,
nextHighest: true,
highFramerate: true
};

let port;
try {
port = document.getElementById('yh-ghbhw5s');
port.remove();
}
catch (e) {
port = document.createElement('span');
port.id = 'yh-ghbhw5s';
document.documentElement.append(port);
}

chrome.storage.local.get(prefs, prefs => {
Object.assign(port.dataset, prefs);
});
chrome.storage.onChanged.addListener(prefs => {
Object.entries(prefs).forEach(([key, value]) => port.dataset[key] = value.newValue);
});

port.addEventListener('quality', e => {
let quality = e.detail;
switch (quality) {
case 'tiny':
quality = '144';
break;
case 'small':
quality = '240';
break;
case 'medium':
quality = '360';
break;
case 'large':
quality = '480';
break;
}

if (isNaN(quality)) {
return;
}
chrome.runtime.sendMessage({
method: 'quality',
quality
});
});
>>>>>>> Stashed changes