Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recommitted #1813 (lost in git history) #1834

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

MAZ01001
Copy link
Contributor

@MAZ01001 MAZ01001 commented Nov 15, 2023

As mentioned here, commit #1813 ↓ was somehow lost, and this commit is bringing it back (with some refactoring and a comment).

onclick: function () {
var player = ImprovedTube.elements.player;
player.pauseVideo();
const videoID = location.search.match(ImprovedTube.regex.video_id)[1];
let urlPopup = `${location.protocol}//www.youtube.com/embed/${videoID}?start=${parseInt(player.getCurrentTime())}&autoplay=${(ImprovedTube.storage.player_autoplay ?? true) ? '1' : '0'}`;
const listMatch = location.search.match(ImprovedTube.regex.playlist_id);
if (listMatch) urlPopup += `&list=${listMatch[1]}`;
const popup = window.open(urlPopup, '_blank', `directories=no,toolbar=no,location=no,menubar=no,status=no,titlebar=no,scrollbars=no,resizable=no,width=${player.offsetWidth},height=${player.offsetHeight}`);
if(popup && listMatch){
popup.addEventListener('load', function () {
const videoLink = popup.document.querySelector('div#player div.ytp-title-text>a[href]');
if (videoLink && videoLink.href.match(ImprovedTube.regex.video_id)[1] !== videoID) popup.location.search = popup.location.search.replace(/(\?)list=[^&]+&|&list=[^&]+/, '$1');
}, {passive: true, once: true});
}
},

recommitted code-charity#1813 (with some minor changes)
- added strict-mode
- changed `popup` to `this` (same value in this context)
- changed wording in comment
@ImprovedTube
Copy link
Member

ImprovedTube commented Nov 15, 2023

crazy, how this possible? 🐱 @github @torvalds

(

  • i checked the history just to make sure )

@ImprovedTube ImprovedTube merged commit 918dc2f into code-charity:master Nov 15, 2023
@MAZ01001 MAZ01001 deleted the feature-1 branch November 15, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants