|
1 | 1 | // ==UserScript== |
2 | | -// @version 1.8.6 |
| 2 | +// @version 1.8.7 |
3 | 3 | // @name YouTube + |
4 | 4 | // @namespace https://github.com/ParticleCore |
5 | 5 | // @description YouTube with more freedom |
|
385 | 385 | if (target.classList.contains("P-impexp") || target.classList.contains("P-implang")) { |
386 | 386 | expCont = document.getElementById("exp-cont"); |
387 | 387 | if (expCont) { |
388 | | - expCont.outerHTML = ""; |
| 388 | + expCont.remove(); |
389 | 389 | return; |
390 | 390 | } |
391 | 391 | expCont = document.createElement("template"); |
|
426 | 426 | function delBlackList(event) { |
427 | 427 | var newKey = user_settings.blacklist; |
428 | 428 | delete newKey[event.target.nextSibling.href.split("/channel/")[1]]; |
429 | | - event.target.parentNode.outerHTML = ""; |
| 429 | + event.target.parentNode.remove(); |
430 | 430 | set("blacklist", newKey); |
431 | 431 | } |
432 | 432 | function delNotification() { |
|
451 | 451 | if (!salt) { |
452 | 452 | notification = document.getElementById("appbar-main-guide-notification-container"); |
453 | 453 | if (notification.childNodes.length < 1) { |
454 | | - notification.outerHTML = ""; |
| 454 | + notification.remove(); |
455 | 455 | notification = document.createElement("template"); |
456 | 456 | notification.innerHTML = // |
457 | 457 | `<div id='appbar-main-guide-notification-container'> |
|
485 | 485 | setBlackList(event.target); |
486 | 486 | } else if (event.target.id === "P-container" || event.target.id === "P-settings") { |
487 | 487 | event = (event.target.id === "P-settings") ? event.target : event.target.parentNode; |
488 | | - event.outerHTML = ""; |
| 488 | + event.remove(); |
489 | 489 | document[(window.chrome && "body") || "documentElement"].scrollTop = 0; |
490 | 490 | window.dispatchEvent(new Event("resize")); |
491 | 491 | } else if (event.target.id !== "DNT" && event.target.tagName !== "A" && event.target.parentNode.id === "P-sidebar-list") { |
492 | 492 | saveSettings("no-notification"); |
493 | | - document.getElementById("P-content").outerHTML = ""; |
| 493 | + document.getElementById("P-content").remove(); |
494 | 494 | document.getElementById("P-container").appendChild(getMenu(event.target.id)); |
495 | 495 | event.target.parentNode.querySelector(".selected").removeAttribute("class"); |
496 | 496 | event.target.className = "selected"; |
|
501 | 501 | if (event.target.id === "P" && event.target.tagName !== "INPUT") { |
502 | 502 | pWrapper = document.getElementById("P-settings"); |
503 | 503 | if (pWrapper) { |
504 | | - pWrapper.outerHTML = ""; |
| 504 | + pWrapper.remove(); |
505 | 505 | } else { |
506 | 506 | if (document.documentElement.classList.contains("floater")) { |
507 | 507 | document.documentElement.classList.remove("floater"); |
|
950 | 950 | } |
951 | 951 | } |
952 | 952 | function getThumb() { |
953 | | - if (getThumb.thumbnail_url) { |
954 | | - window.open(getThumb.thumbnail_url); |
| 953 | + var thumbnail_url; |
| 954 | + thumbnail_url = document.querySelector("[href*='maxresdefault']"); |
| 955 | + thumbnail_url = thumbnail_url && thumbnail_url.getAttribute("href"); |
| 956 | + if (thumbnail_url) { |
| 957 | + window.open(thumbnail_url); |
955 | 958 | } else if (window.ytplayer && window.ytplayer.config && window.ytplayer.config.args && window.ytplayer.config.args.thumbnail_url) { |
956 | 959 | window.open(window.ytplayer.config.args.thumbnail_url); |
957 | 960 | } |
958 | 961 | } |
959 | 962 | function hideScreenshot(event) { |
960 | 963 | if (event.target.id === "close-screenshot") { |
961 | | - event.target.parentNode.outerHTML = ""; |
| 964 | + event.target.parentNode.remove(); |
962 | 965 | document.removeEventListener("click", hideScreenshot); |
963 | 966 | } |
964 | 967 | } |
|
1129 | 1132 | } |
1130 | 1133 | } |
1131 | 1134 | function advancedOptions() { |
1132 | | - var header, cnslBtn, cnslCont, thumbnail_url; |
| 1135 | + var header, cnslBtn, cnslCont; |
1133 | 1136 | header = document.getElementById("watch-header"); |
1134 | 1137 | cnslBtn = document.getElementById("console-button"); |
1135 | 1138 | advancedOptions.controls = document.getElementById("player-console"); |
|
1154 | 1157 | cnslCont.appendChild(cnslBtn); |
1155 | 1158 | header.appendChild(cnslCont); |
1156 | 1159 | if (advancedOptions.controls) { |
1157 | | - advancedOptions.controls.outerHTML = ""; |
| 1160 | + advancedOptions.controls.remove(); |
1158 | 1161 | } |
1159 | 1162 | advancedOptions.controls = document.createElement("template"); |
1160 | 1163 | advancedOptions.controls.innerHTML = // |
|
1172 | 1175 | if (user_settings.VID_PLR_ATPL) { |
1173 | 1176 | advancedOptions.controls.content.querySelector("#autoplay-button").classList.add("active"); |
1174 | 1177 | } |
1175 | | - thumbnail_url = document.querySelector("link[itemprop='thumbnailUrl'], span[itemprop='thumbnail'] link[itemprop='url']"); |
1176 | | - thumbnail_url = thumbnail_url && thumbnail_url.getAttribute("href"); |
1177 | | - if (thumbnail_url) { |
1178 | | - getThumb.thumbnail_url = thumbnail_url; |
1179 | | - } |
1180 | 1178 | advancedOptions.controls = setLocale(advancedOptions.controls.content).firstChild; |
1181 | 1179 | cnslCont.appendChild(advancedOptions.controls); |
1182 | 1180 | hookButtons(); |
|
1264 | 1262 | j = temp.length; |
1265 | 1263 | while (j--) { |
1266 | 1264 | if (has_upnext && has_upnext.contains(temp[j])) { |
1267 | | - has_upnext.parentNode.outerHTML = ""; |
| 1265 | + has_upnext.parentNode.remove(); |
1268 | 1266 | has_upnext = document.querySelector(".watch-sidebar-separation-line"); |
1269 | 1267 | if (has_upnext) { |
1270 | | - has_upnext.outerHTML = ""; |
| 1268 | + has_upnext.remove(); |
1271 | 1269 | } |
1272 | 1270 | has_upnext = false; |
1273 | 1271 | parent = false; |
1274 | 1272 | } else { |
1275 | 1273 | parent = temp[j].parentNode; |
1276 | | - temp[j].outerHTML = ""; |
| 1274 | + temp[j].remove(); |
1277 | 1275 | } |
1278 | 1276 | temp.splice(j, 1); |
1279 | 1277 | while (parent) { |
1280 | 1278 | if (parent.childElementCount) { |
1281 | 1279 | break; |
1282 | 1280 | } |
1283 | 1281 | parent = parent.parentNode; |
1284 | | - parent.firstChild.outerHTML = ""; |
| 1282 | + parent.firstChild.remove(); |
1285 | 1283 | } |
1286 | 1284 | } |
1287 | 1285 | if (!temp.length) { |
|
1295 | 1293 | while (i--) { |
1296 | 1294 | if (temp[i].querySelectorAll("ul").length < 2) { |
1297 | 1295 | parent = temp[i].parentNode; |
1298 | | - temp[i].outerHTML = ""; |
| 1296 | + temp[i].remove(); |
1299 | 1297 | while (parent) { |
1300 | 1298 | if (parent.childElementCount) { |
1301 | 1299 | break; |
1302 | 1300 | } |
1303 | 1301 | parent = parent.parentNode; |
1304 | | - parent.firstChild.outerHTML = ""; |
| 1302 | + parent.firstChild.remove(); |
1305 | 1303 | } |
1306 | 1304 | } |
1307 | 1305 | } |
|
1802 | 1800 | while (child) { |
1803 | 1801 | parent = child.parentNode; |
1804 | 1802 | if (parent.childElementCount > 1) { |
1805 | | - child.outerHTML = ""; |
| 1803 | + child.remove(); |
1806 | 1804 | break; |
1807 | 1805 | } |
1808 | 1806 | child = parent; |
|
1825 | 1823 | ) |
1826 | 1824 | ) |
1827 | 1825 | ) { |
1828 | | - sidebar.outerHTML = ""; |
| 1826 | + sidebar.remove(); |
1829 | 1827 | } |
1830 | 1828 | if (!window.location.search.match(/&?(lc|google_comment_id)=/) && window.location.pathname === "/watch" && user_settings.VID_HIDE_COMS > 1 && comments) { |
1831 | | - comments.outerHTML = ""; |
| 1829 | + comments.remove(); |
1832 | 1830 | } |
1833 | 1831 | if (user_settings.VID_HIDE_COMS === "1") { |
1834 | 1832 | document.documentElement.classList.add("part_hide_comments"); |
|
1990 | 1988 | if (user_settings.GEN_REM_APUN && window.location.pathname === "/watch" && autoplaybar) { |
1991 | 1989 | checkbox = document.querySelector(".checkbox-on-off"); |
1992 | 1990 | if (checkbox) { |
1993 | | - checkbox.outerHTML = ""; |
| 1991 | + checkbox.remove(); |
1994 | 1992 | } |
1995 | 1993 | } |
1996 | 1994 | if (user_settings.VID_LAYT_AUTO_PNL && window.location.pathname === "/watch" && description) { |
|
2376 | 2374 | holder = document.createElement("link"); |
2377 | 2375 | holder.rel = "stylesheet"; |
2378 | 2376 | holder.type = "text/css"; |
2379 | | - holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.8.6"; |
| 2377 | + holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.8.7"; |
2380 | 2378 | document.documentElement.appendChild(holder); |
2381 | 2379 | } |
2382 | 2380 | holder = document.createElement("script"); |
|
0 commit comments