Skip to content

Commit

Permalink
0.1.2
Browse files Browse the repository at this point in the history
Closes #383
Closes #407
Closes #411
Add condition to disable Iridium mini player if Youtube's native mini player is present to prevent conflict
  • Loading branch information
ParticleCore committed Mar 31, 2018
1 parent 6a633c9 commit 491a8ff
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 34 deletions.
2 changes: 1 addition & 1 deletion bin/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"[email protected]" : {
"updates" : [
{
"version" : "0.1.1",
"version" : "0.1.2",
"update_link" : "https://github.com/ParticleCore/Iridium/raw/master/dist/Iridium.xpi",
"applications" : {
"gecko" : {
Expand Down
Binary file modified dist/Iridium.xpi
Binary file not shown.
39 changes: 27 additions & 12 deletions src/Userscript/Iridium.user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==UserScript==
// @version 0.1.1
// @version 0.1.2
// @name Iridium
// @namespace https://github.com/ParticleCore
// @description YouTube with more freedom
Expand Down Expand Up @@ -576,16 +576,18 @@
var temp;
var player_api;

if ((player_api = document.getElementById("movie_player"))) {
if ((temp = this.document.querySelector("video"))) {
if (window.location.pathname === "/watch") {
if ((player_api = document.getElementById("movie_player"))) {
if ((temp = this.document.querySelector("video"))) {

if (!isNaN(temp.duration) && temp.currentTime < temp.duration) {
if (!isNaN(temp.duration) && temp.currentTime < temp.duration) {

temp = temp.currentTime;
player_api.seekTo(temp);
temp = temp.currentTime;
player_api.seekTo(temp);

}
}

}
}
}

Expand Down Expand Up @@ -2632,8 +2634,19 @@

context.playerReady(api);

if (window["ytSignalsInstance"] && window["ytSignalsInstance"]["processSignal"]) {
window["ytSignalsInstance"]["processSignal"]("eocs");
var ytSignalInstance;

ytSignalInstance = window["ytSignalsInstance"];

if (!ytSignalInstance) {
if ((ytSignalInstance = window["ytSignals"])) {
ytSignalInstance = ytSignalInstance["getInstance"] && ytSignalInstance["getInstance"]();
}
}

if (ytSignalInstance && ytSignalInstance["processSignal"]) {
ytSignalInstance["processSignal"]("eocs");
// ytSignalInstance["processSignal"]("fwtr"); // first warm transition requested
}

if (original) {
Expand Down Expand Up @@ -3342,6 +3355,10 @@
var comments_loaded;
var comment_contents;

if (window.location.pathname !== "/watch") {
return original.apply(this, arguments);
}

if (user_settings.comments_visibility > 1) {
return function () {
};
Expand Down Expand Up @@ -3823,8 +3840,6 @@
url: iridium_api.getSingleObjectByKey(history.response.currentVideoEndpoint, ["url"])
};

console.log(history);

history_state = {
endpoint: history.response.currentVideoEndpoint,
entryTime: +keys[i],
Expand Down Expand Up @@ -3964,7 +3979,7 @@
var player_container;
var is_already_floating;

if (!user_settings.player_always_visible) {
if (!user_settings.player_always_visible || document.getElementById("miniplayer-bar")) {
return;
}

Expand Down
14 changes: 7 additions & 7 deletions src/Webextension/_locales/en/messages.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/Webextension/css/Iridium.css
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ yt-img-shadow:hover #iri-video-preview {
/* end | thumbnail preview */

/* ini | video always playing */
.iri-always-playing .ytp-chrome-top {
display : none;
}

html.iri-always-playing ytd-watch[hidden] {
display : block !important;
height : 0;
Expand Down Expand Up @@ -779,7 +783,7 @@ button:hover > .iri-quick-controls-tooltip {
}

html:not(.iri-full-browser) #iri-full-browser-info {
display: none;
display : none;
}

#iri-full-browser-info-message {
Expand Down
39 changes: 27 additions & 12 deletions src/Webextension/js/Iridium.user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==UserScript==
// @version 0.1.1
// @version 0.1.2
// @name Iridium
// @namespace https://github.com/ParticleCore
// @description YouTube with more freedom
Expand Down Expand Up @@ -576,16 +576,18 @@
var temp;
var player_api;

if ((player_api = document.getElementById("movie_player"))) {
if ((temp = this.document.querySelector("video"))) {
if (window.location.pathname === "/watch") {
if ((player_api = document.getElementById("movie_player"))) {
if ((temp = this.document.querySelector("video"))) {

if (!isNaN(temp.duration) && temp.currentTime < temp.duration) {
if (!isNaN(temp.duration) && temp.currentTime < temp.duration) {

temp = temp.currentTime;
player_api.seekTo(temp);
temp = temp.currentTime;
player_api.seekTo(temp);

}
}

}
}
}

Expand Down Expand Up @@ -2632,8 +2634,19 @@

context.playerReady(api);

if (window["ytSignalsInstance"] && window["ytSignalsInstance"]["processSignal"]) {
window["ytSignalsInstance"]["processSignal"]("eocs");
var ytSignalInstance;

ytSignalInstance = window["ytSignalsInstance"];

if (!ytSignalInstance) {
if ((ytSignalInstance = window["ytSignals"])) {
ytSignalInstance = ytSignalInstance["getInstance"] && ytSignalInstance["getInstance"]();
}
}

if (ytSignalInstance && ytSignalInstance["processSignal"]) {
ytSignalInstance["processSignal"]("eocs");
// ytSignalInstance["processSignal"]("fwtr"); // first warm transition requested
}

if (original) {
Expand Down Expand Up @@ -3342,6 +3355,10 @@
var comments_loaded;
var comment_contents;

if (window.location.pathname !== "/watch") {
return original.apply(this, arguments);
}

if (user_settings.comments_visibility > 1) {
return function () {
};
Expand Down Expand Up @@ -3823,8 +3840,6 @@
url: iridium_api.getSingleObjectByKey(history.response.currentVideoEndpoint, ["url"])
};

console.log(history);

history_state = {
endpoint: history.response.currentVideoEndpoint,
entryTime: +keys[i],
Expand Down Expand Up @@ -3964,7 +3979,7 @@
var player_container;
var is_already_floating;

if (!user_settings.player_always_visible) {
if (!user_settings.player_always_visible || document.getElementById("miniplayer-bar")) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Webextension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version" : 2,
"name" : "Iridium",
"version" : "0.1.1",
"version" : "0.1.2",
"description" : "YouTube with more freedom",
"default_locale" : "en",
"icons" : {
Expand Down

0 comments on commit 491a8ff

Please sign in to comment.