Skip to content
This repository has been archived by the owner on Mar 23, 2018. It is now read-only.

Commit

Permalink
1.7.7
Browse files Browse the repository at this point in the history
- Removed webextension migration notice
- Fixed control check for a page element
  • Loading branch information
ParticleCore committed Jan 29, 2017
1 parent b234b66 commit cfcf24c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 80 deletions.
2 changes: 1 addition & 1 deletion bin/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"addons": {
"[email protected]": {
"updates": [{
"version": "1.7.6",
"version": "1.7.7",
"update_link": "https://github.com/ParticleCore/Particle/raw/master/dist/YouTubePlus.xpi",
"applications": {
"gecko": {
Expand Down
Binary file modified dist/YouTubePlus.xpi
Binary file not shown.
57 changes: 18 additions & 39 deletions src/Userscript/YouTubePlus.user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==UserScript==
// @version 1.7.6
// @version 1.7.7
// @name YouTube +
// @namespace https://github.com/ParticleCore
// @description YouTube with more freedom
Expand Down Expand Up @@ -1556,9 +1556,9 @@
};
} else if (
event.type === "mousemove" && (
window.hasMoved ||
Math.abs(event.clientX - window.oldPos.orgX) > 10 ||
Math.abs(event.clientY - window.oldPos.orgY) > 10)
window.hasMoved ||
Math.abs(event.clientX - window.oldPos.orgX) > 10 ||
Math.abs(event.clientY - window.oldPos.orgY) > 10)
) {
window.moveBy(event.clientX - window.oldPos.X, event.clientY - window.oldPos.Y);
window.hasMoved = true;
Expand Down Expand Up @@ -1789,19 +1789,19 @@
if (
sidebar &&
sidebar.parentNode && (
window.location.pathname === "/results" &&
sidebar &&
sidebar.querySelectorAll("*").length < 10) || (
sidebar && (
user_settings.GEN_HDE_RECM_SDBR &&
window.location.href.split("/feed/subscriptions").length > 1 ||
user_settings.GEN_HDE_SRCH_SDBR &&
window.location.pathname === "/results" ||
user_settings.GEN_HDE_CHN_SDBR &&
window.location.href.split(/\/(channel|user|c)\//).length > 1
)
window.location.pathname === "/results" &&
sidebar &&
sidebar.querySelectorAll("*").length < 10) || (
sidebar && (
user_settings.GEN_HDE_RECM_SDBR &&
window.location.href.split("/feed/subscriptions").length > 1 ||
user_settings.GEN_HDE_SRCH_SDBR &&
window.location.pathname === "/results" ||
user_settings.GEN_HDE_CHN_SDBR &&
window.location.href.split(/\/(channel|user|c)\//).length > 1
)
) {
)
) {
sidebar.outerHTML = "";
}
if (window.location.pathname === "/watch" && user_settings.VID_HIDE_COMS > 1 && comments) {
Expand Down Expand Up @@ -1978,7 +1978,7 @@
if (window.ytpsetwide) {
window.ytpsetwide("wide", (user_settings.theaterMode ? "1" : "0"), -1);
}
if (playerElement && window.location.pathname === "/watch") {
if (pageElement && playerElement && window.location.pathname === "/watch") {
pageElement.classList[user_settings.theaterMode ? "add" : "remove"]("watch-wide");
pageElement.className = pageElement.className.replace(user_settings.theaterMode ? "non-" : "watch-stage", user_settings.theaterMode ? "" : "watch-non-stage");
playerElement.className = user_settings.theaterMode ? playerElement.className.replace("small", "large") : playerElement.className.replace("large", "small").replace("medium", "small");
Expand Down Expand Up @@ -2098,24 +2098,6 @@
return true;
}
}
function closeMigrationInstructions(event) {
if (event && event.target && event.target.id === "close_migration_instructions") {
document.removeEventListener("click", closeMigrationInstructions);
event.target.parentNode.outerHTML = "";
set("migration_instructions", true);
}
}
function migrationInstructions() {
var temp = document.createElement("template");
temp.innerHTML = //
`<div style='border-radius: 2px; color: #FFF; font: 12px Roboto,arial,sans-serif; padding: 10px; background-color: rgb(0, 153, 255); box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); position: fixed; z-index: 99999; top: 50%; left: 50%; transform: translate(-50%, -50%);'>
YouTube Plus has been updated and is now a Webextension. Unfortunately this means that your previous settings need to be imported manually.<br>
<a href='https://github.com/ParticleCore/Particle/wiki/Restore-settings' target='_blank' style='color:#FFF;font-weight:bold;'>Click here</a> if you wish to import the previous settings or know more about this change.<br>
<button id='close_migration_instructions' style='background-color: rgba(255, 255, 255, 0.3); color: #FFF; cursor: pointer; margin-top: 10px; border-radius: 2px; padding: 4px; float: right;'>CLOSE</button>
</div>`;
document.documentElement.appendChild(temp.content.firstChild);
document.addEventListener("click", closeMigrationInstructions);
}
var api, cid, language, user_settings, player_instance, default_settings;
if (isMaterial()) {
return;
Expand Down Expand Up @@ -2298,9 +2280,6 @@
} else {
document.addEventListener("afterscriptexecute", scriptExit);
}
if (!is_userscript && !window.chrome && !user_settings.migration_instructions) {
migrationInstructions();
}
document.addEventListener("spfdone", main);
document.addEventListener("spfrequest", request);
document.addEventListener("readystatechange", main, true);
Expand Down Expand Up @@ -2354,7 +2333,7 @@
holder = document.createElement("link");
holder.rel = "stylesheet";
holder.type = "text/css";
holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.7.6";
holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.7.7";
document.documentElement.appendChild(holder);
}
holder = document.createElement("script");
Expand Down
57 changes: 18 additions & 39 deletions src/Webextension/JS/YouTubePlus.user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==UserScript==
// @version 1.7.6
// @version 1.7.7
// @name YouTube +
// @namespace https://github.com/ParticleCore
// @description YouTube with more freedom
Expand Down Expand Up @@ -1556,9 +1556,9 @@
};
} else if (
event.type === "mousemove" && (
window.hasMoved ||
Math.abs(event.clientX - window.oldPos.orgX) > 10 ||
Math.abs(event.clientY - window.oldPos.orgY) > 10)
window.hasMoved ||
Math.abs(event.clientX - window.oldPos.orgX) > 10 ||
Math.abs(event.clientY - window.oldPos.orgY) > 10)
) {
window.moveBy(event.clientX - window.oldPos.X, event.clientY - window.oldPos.Y);
window.hasMoved = true;
Expand Down Expand Up @@ -1789,19 +1789,19 @@
if (
sidebar &&
sidebar.parentNode && (
window.location.pathname === "/results" &&
sidebar &&
sidebar.querySelectorAll("*").length < 10) || (
sidebar && (
user_settings.GEN_HDE_RECM_SDBR &&
window.location.href.split("/feed/subscriptions").length > 1 ||
user_settings.GEN_HDE_SRCH_SDBR &&
window.location.pathname === "/results" ||
user_settings.GEN_HDE_CHN_SDBR &&
window.location.href.split(/\/(channel|user|c)\//).length > 1
)
window.location.pathname === "/results" &&
sidebar &&
sidebar.querySelectorAll("*").length < 10) || (
sidebar && (
user_settings.GEN_HDE_RECM_SDBR &&
window.location.href.split("/feed/subscriptions").length > 1 ||
user_settings.GEN_HDE_SRCH_SDBR &&
window.location.pathname === "/results" ||
user_settings.GEN_HDE_CHN_SDBR &&
window.location.href.split(/\/(channel|user|c)\//).length > 1
)
) {
)
) {
sidebar.outerHTML = "";
}
if (window.location.pathname === "/watch" && user_settings.VID_HIDE_COMS > 1 && comments) {
Expand Down Expand Up @@ -1978,7 +1978,7 @@
if (window.ytpsetwide) {
window.ytpsetwide("wide", (user_settings.theaterMode ? "1" : "0"), -1);
}
if (playerElement && window.location.pathname === "/watch") {
if (pageElement && playerElement && window.location.pathname === "/watch") {
pageElement.classList[user_settings.theaterMode ? "add" : "remove"]("watch-wide");
pageElement.className = pageElement.className.replace(user_settings.theaterMode ? "non-" : "watch-stage", user_settings.theaterMode ? "" : "watch-non-stage");
playerElement.className = user_settings.theaterMode ? playerElement.className.replace("small", "large") : playerElement.className.replace("large", "small").replace("medium", "small");
Expand Down Expand Up @@ -2098,24 +2098,6 @@
return true;
}
}
function closeMigrationInstructions(event) {
if (event && event.target && event.target.id === "close_migration_instructions") {
document.removeEventListener("click", closeMigrationInstructions);
event.target.parentNode.outerHTML = "";
set("migration_instructions", true);
}
}
function migrationInstructions() {
var temp = document.createElement("template");
temp.innerHTML = //
`<div style='border-radius: 2px; color: #FFF; font: 12px Roboto,arial,sans-serif; padding: 10px; background-color: rgb(0, 153, 255); box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); position: fixed; z-index: 99999; top: 50%; left: 50%; transform: translate(-50%, -50%);'>
YouTube Plus has been updated and is now a Webextension. Unfortunately this means that your previous settings need to be imported manually.<br>
<a href='https://github.com/ParticleCore/Particle/wiki/Restore-settings' target='_blank' style='color:#FFF;font-weight:bold;'>Click here</a> if you wish to import the previous settings or know more about this change.<br>
<button id='close_migration_instructions' style='background-color: rgba(255, 255, 255, 0.3); color: #FFF; cursor: pointer; margin-top: 10px; border-radius: 2px; padding: 4px; float: right;'>CLOSE</button>
</div>`;
document.documentElement.appendChild(temp.content.firstChild);
document.addEventListener("click", closeMigrationInstructions);
}
var api, cid, language, user_settings, player_instance, default_settings;
if (isMaterial()) {
return;
Expand Down Expand Up @@ -2298,9 +2280,6 @@
} else {
document.addEventListener("afterscriptexecute", scriptExit);
}
if (!is_userscript && !window.chrome && !user_settings.migration_instructions) {
migrationInstructions();
}
document.addEventListener("spfdone", main);
document.addEventListener("spfrequest", request);
document.addEventListener("readystatechange", main, true);
Expand Down Expand Up @@ -2354,7 +2333,7 @@
holder = document.createElement("link");
holder.rel = "stylesheet";
holder.type = "text/css";
holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.7.6";
holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.7.7";
document.documentElement.appendChild(holder);
}
holder = document.createElement("script");
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": "YouTube Plus",
"version": "1.7.6",
"version": "1.7.7",
"description": "YouTube with more freedom",
"default_locale": "en",
"icons": {
Expand Down

0 comments on commit cfcf24c

Please sign in to comment.