|
1 | 1 | // ==UserScript== |
2 | | -// @version 1.8.4 |
| 2 | +// @version 1.8.5 |
3 | 3 | // @name YouTube + |
4 | 4 | // @namespace https://github.com/ParticleCore |
5 | 5 | // @description YouTube with more freedom |
6 | | -// @compatible chrome |
7 | 6 | // @compatible firefox |
| 7 | +// @compatible opera |
8 | 8 | // @icon https://raw.githubusercontent.com/ParticleCore/Particle/gh-pages/images/YT%2Bicon.png |
9 | 9 | // @match *://www.youtube.com/* |
10 | 10 | // @exclude *://www.youtube.com/tv* |
|
1223 | 1223 | temp = modThumbs.thumbs[list[i]]; |
1224 | 1224 | j = temp.length; |
1225 | 1225 | while (j--) { |
1226 | | - thumb = temp[j].querySelector(".yt-lockup-thumbnail, .thumb-wrapper"); |
| 1226 | + thumb = temp[j].querySelector(".yt-lockup .yt-lockup-thumbnail, .thumb-wrapper"); |
1227 | 1227 | if (thumb) { |
1228 | 1228 | if (user_settings.GEN_PPOT_ON && !thumb.querySelector(".popoutmode") && !/channel/.test(temp[j].firstChild.className)) { |
1229 | 1229 | button = document.createElement("template"); |
|
1307 | 1307 | } |
1308 | 1308 | } |
1309 | 1309 | function getVideos() { |
1310 | | - var i, list, temp, channel_id; |
| 1310 | + var i, list, temp, video_list, channel_id; |
1311 | 1311 | modThumbs.thumbs = {}; |
| 1312 | + video_list = Array.from(document.querySelectorAll(` |
| 1313 | + .yt-shelf-grid-item, |
| 1314 | + .video-list-item, |
| 1315 | + .item-section > li |
| 1316 | + `)); |
1312 | 1317 | list = document.querySelectorAll(` |
1313 | 1318 | .yt-lockup-byline > a, |
1314 | 1319 | .yt-lockup-content .g-hovercard, |
|
1320 | 1325 | temp = list[i]; |
1321 | 1326 | channel_id = temp.dataset.ytid; |
1322 | 1327 | while (temp) { |
1323 | | - if (temp.tagName && temp.tagName === "LI") { |
| 1328 | + if (temp.tagName && temp.tagName === "LI" && video_list.indexOf(temp) > -1) { |
1324 | 1329 | temp.username = list[i].textContent; |
1325 | 1330 | if (!modThumbs.thumbs[channel_id]) { |
1326 | 1331 | modThumbs.thumbs[channel_id] = [temp]; |
|
1747 | 1752 | document.documentElement.classList[user_settings[clss] ? "add" : "remove"](customStyles.custom_styles[clss]); |
1748 | 1753 | } |
1749 | 1754 | function customStyles() { |
1750 | | - var child, parent, comments, sidebar, ytGrid, adverts, ads_list; |
| 1755 | + var child, width, height, parent, comments, sidebar, ytGrid, adverts, ads_list; |
1751 | 1756 | comments = document.getElementById("watch-discussion"); |
1752 | 1757 | ytGrid = document.querySelector(".yt-uix-menu-top-level-flow-button:last-child a"); |
1753 | 1758 | customStyles.custom_styles = { |
|
1771 | 1776 | } |
1772 | 1777 | if (window.name === "popOut") { |
1773 | 1778 | document.documentElement.classList.add("part_popout"); |
| 1779 | + width = parseInt(user_settings.VID_PPOT_SZ) || 533; |
| 1780 | + height = Math.round(width / (16 / 9)); |
| 1781 | + window.resizeTo( |
| 1782 | + width + (window.outerWidth - window.innerWidth), |
| 1783 | + height + (window.outerHeight - window.innerHeight) |
| 1784 | + ); |
1774 | 1785 | } |
1775 | 1786 | if (ytGrid && user_settings.GEN_GRID_SUBS) { |
1776 | 1787 | ytGrid.click(); |
|
2120 | 2131 | `<div id='material-notice' style='border-radius:2px;color:#FFF;padding:10px;background-color:#09F;box-shadow:0 0 3px rgba(0,0,0,.5);font-size:12px;position:fixed;bottom:20px;right:50px;z-index:99999'> |
2121 | 2132 | YouTube Plus is not compatible with the YouTube beta Material Layout<br> |
2122 | 2133 | <a href='https://github.com/ParticleCore/Particle/wiki/Restore-classic-YouTube' target='_blank' style='color:#FFF;font-weight:bold;'>Click here</a> for instructions to restore classic YouTube and continue using YT+<br> |
2123 | | - The development of YT+ might end when this layout is launched permanently,<br> |
2124 | | - <a href='https://github.com/ParticleCore/Particle/issues/448' target='_blank' style='color:#FFF;font-weight:bold;'>click here</a> to read the announcement<br> |
| 2134 | + When an alpha version is ready for public testing it will be announced <a href='https://github.com/ParticleCore/Particle/issues/448' target='_blank' style='color:#FFF;font-weight:bold;'>here</a><br> |
2125 | 2135 | To keep using the current layout without this message please disable YT+ |
2126 | 2136 | </div>`; |
2127 | 2137 | document.documentElement.appendChild(temp.content.firstChild); |
|
2365 | 2375 | holder = document.createElement("link"); |
2366 | 2376 | holder.rel = "stylesheet"; |
2367 | 2377 | holder.type = "text/css"; |
2368 | | - holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.8.4"; |
| 2378 | + holder.href = "https://particlecore.github.io/Particle/stylesheets/YouTubePlus.css?v=1.8.5"; |
2369 | 2379 | document.documentElement.appendChild(holder); |
2370 | 2380 | } |
2371 | 2381 | holder = document.createElement("script"); |
|
0 commit comments