Skip to content

Commit

Permalink
making sure #2272 #2282 & undo sidepanel for vivaldi
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube committed May 21, 2024
1 parent 386e4b0 commit 6efd6e4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 26 deletions.
6 changes: 3 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// Periodic "keep-alive" message every 29.5 seconds
// const keepAliveInterval = setInterval(() => chrome.runtime.sendMessage({ status: 'keep-alive' }), 29.5 * 1000);

/* Sidepanel Option */
/* Sidepanel Option
chrome.storage.local.get('improvedTubeSidePanel', function (result) {
if ( result.improvedTubeSidePanel && result.improvedTubeSidePanel === true) {
chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true })
} else {chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: false }) }
});

*/
/*---------------------------
# IMPORTING OLD SETTINGS
-----------------------------*/
Expand Down Expand Up @@ -50,7 +50,7 @@ chrome.runtime.onInstalled.addListener(function (installed) {
}
});
}
});
});
chrome.storage.local.get('hideSubscribe', function (result) {
if (result.hideSubscribe === true) {
chrome.storage.local.set({subscribe: 'hidden'});
Expand Down
11 changes: 2 additions & 9 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,6 @@ ImprovedTube.videoPageUpdate = function () {
ImprovedTube.playerOnPlay = function () {
HTMLMediaElement.prototype.play = (function (original) {
return function () {
const returnValue = original.apply(this, arguments);
try { ImprovedTube.autoplayDisable(this)}
catch (error){console.error("Couldn't disable autoplay immediately:", error);
const self=this; setTimeout(function() {
try { ImprovedTube.autoplayDisable(self); }
catch (error) { console.error('failed to disable autoplay:', error);
} }, 0); }

this.removeEventListener('loadedmetadata', ImprovedTube.playerOnLoadedMetadata);
this.addEventListener('loadedmetadata', ImprovedTube.playerOnLoadedMetadata);

Expand All @@ -345,10 +337,11 @@ ImprovedTube.playerOnPlay = function () {
this.removeEventListener('ended', ImprovedTube.playerOnEnded, true);
this.addEventListener('ended', ImprovedTube.playerOnEnded, true);

ImprovedTube.autoplayDisable(this);
ImprovedTube.playerLoudnessNormalization();
ImprovedTube.playerCinemaModeEnable();

return returnValue;
return original.apply(this, arguments);
}
})(HTMLMediaElement.prototype.play);
};
Expand Down
6 changes: 3 additions & 3 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ ImprovedTube.autoplayDisable = function (videoElement) {
// channel homepage & !channel_trailer_autoplay
|| (this.storage.channel_trailer_autoplay === false && this.regex.channel.test(location.href)))) {

videoElement.pause();
player.pauseVideo();
console.log("autoplayDisable: Pausing");
setTimeout(function() { try { player.pauseVideo(); }
catch (error) { console.log("autoplayDisable: Pausing"); videoElement.pause(); }
});
}
}
};
Expand Down
9 changes: 2 additions & 7 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"default_popup": "menu/index.html",
"default_area": "navbar"
},
"side_panel": {
"default_path": "menu/sidepanel.html"
},
"options_page": "menu/index.html",
"options_ui": {
"page": "menu/index.html"
Expand All @@ -36,8 +33,7 @@
"js&css/extension/www.youtube.com/appearance/player/player.css",
"js&css/extension/www.youtube.com/appearance/details/details.css",
"js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css",
"js&css/extension/www.youtube.com/appearance/comments/comments.css",
"js&css/extension/www.youtube.com/appearance/footer/footer.css"
"js&css/extension/www.youtube.com/appearance/comments/comments.css"
],
"exclude_matches": [
"https://www.youtube.com/audiolibrary/*",
Expand Down Expand Up @@ -65,8 +61,7 @@
"permissions": [
"contextMenus",
"storage",
"sidePanel",
"battery"
"sidePanel"
],
"web_accessible_resources": [
{
Expand Down
3 changes: 1 addition & 2 deletions manifest2.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"js&css/extension/www.youtube.com/appearance/player/player.css",
"js&css/extension/www.youtube.com/appearance/details/details.css",
"js&css/extension/www.youtube.com/appearance/sidebar/sidebar.css",
"js&css/extension/www.youtube.com/appearance/comments/comments.css",
"js&css/extension/www.youtube.com/appearance/footer/footer.css"
"js&css/extension/www.youtube.com/appearance/comments/comments.css"
],
"exclude_matches": [
"https://www.youtube.com/audiolibrary/*",
Expand Down
4 changes: 2 additions & 2 deletions menu/skeleton-parts/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ extension.skeleton.main.layers.section.general = {
value: 'below_player'
}]
},
improvedTubeSidePanel: {
/* improvedTubeSidePanel: {
component: 'switch',
text: 'improvedTubeSidePanel'
},
default_content_country: {
*/ default_content_country: {
component: 'select',
text: 'defaultContentCountry',
options:[{text:"default",value:"default"},{text:"Afghanistan",value:"AF"},{text:"Albania",value:"AL"},{text:"Algeria",value:"DZ"},{text:"AmericanSamoa",value:"AS"},{text:"Andorra",value:"AD"},{text:"Angola",value:"AO"},{text:"Anguilla",value:"AI"},{text:"Antarctica",value:"AQ"},{text:"AntiguaandBarbuda",value:"AG"},{text:"Argentina",value:"AR"},{text:"Armenia",value:"AM"},{text:"Aruba",value:"AW"},{text:"Australia",value:"AU"},{text:"Austria",value:"AT"},{text:"Azerbaijan",value:"AZ"},{text:"Bahrain",value:"BH"},{text:"BailiwickofGuernsey",value:"GG"},{text:"Bangladesh",value:"BD"},{text:"Barbados",value:"BB"},{text:"Belarus",value:"BY"},{text:"Belgium",value:"BE"},{text:"Belize",value:"BZ"},{text:"Benin",value:"BJ"},{text:"Bermuda",value:"BM"},{text:"Bhutan",value:"BT"},{text:"Bolivia",value:"BO"},{text:"Bonaire",value:"BQ"},{text:"BosniaandHerzegovina",value:"BA"},{text:"Botswana",value:"BW"},{text:"BouvetIsland",value:"BV"},{text:"Brazil",value:"BR"},{text:"BritishIndianOceanTerritory",value:"IO"},{text:"BritishVirginIslands",value:"VG"},{text:"Brunei",value:"BN"},{text:"Bulgaria",value:"BG"},{text:"BurkinaFaso",value:"BF"},{text:"Burundi",value:"BI"},{text:"Cambodia",value:"KH"},{text:"Cameroon",value:"CM"},{text:"Canada",value:"CA"},{text:"CapeVerde",value:"CV"},{text:"CaymanIslands",value:"KY"},{text:"CentralAfricanRepublic",value:"CF"},{text:"Chad",value:"TD"},{text:"Chile",value:"CL"},{text:"China",value:"CN"},{text:"ChristmasIsland",value:"CX"},{text:"Cocos(Keeling)Islands",value:"CC"},{text:"CollectivityofSaintMartin",value:"MF"},{text:"Colombia",value:"CO"},{text:"Comoros",value:"KM"},{text:"CookIslands",value:"CK"},{text:"CostaRica",value:"CR"},{text:"Croatia",value:"HR"},{text:"Cuba",value:"CU"},{text:"Curaçao",value:"CW"},{text:"Cyprus",value:"CY"},{text:"CzechRepublic",value:"CZ"},{text:"DemocraticRepublicoftheCongo",value:"CD"},{text:"Denmark",value:"DK"},{text:"Djibouti",value:"DJ"},{text:"Dominica",value:"DM"},{text:"DominicanRepublic",value:"DO"},{text:"EastTimor",value:"TL"},{text:"Ecuador",value:"EC"},{text:"Egypt",value:"EG"},{text:"ElSalvador",value:"SV"},{text:"EquatorialGuinea",value:"GQ"},{text:"Eritrea",value:"ER"},{text:"Estonia",value:"EE"},{text:"Eswatini",value:"SZ"},{text:"Ethiopia",value:"ET"},{text:"FalklandIslands",value:"FK"},{text:"FaroeIslands",value:"FO"},{text:"FederatedStatesofMicronesia",value:"FM"},{text:"Fiji",value:"FJ"},{text:"Finland",value:"FI"},{text:"France",value:"FR"},{text:"FrenchGuiana",value:"GF"},{text:"FrenchPolynesia",value:"PF"},{text:"FrenchSouthernandAntarcticLands",value:"TF"},{text:"Gabon",value:"GA"},{text:"Georgia(country)",value:"GE"},{text:"Germany",value:"DE"},{text:"Ghana",value:"GH"},{text:"Gibraltar",value:"GI"},{text:"Greece",value:"GR"},{text:"Greenland",value:"GL"},{text:"Grenada",value:"GD"},{text:"Guadeloupe",value:"GP"},{text:"Guam",value:"GU"},{text:"Guatemala",value:"GT"},{text:"Guinea",value:"GN"},{text:"Guinea-Bissau",value:"GW"},{text:"Guyana",value:"GY"},{text:"Haiti",value:"HT"},{text:"HeardIslandandMcDonaldIslands",value:"HM"},{text:"HolySee",value:"VA"},{text:"Honduras",value:"HN"},{text:"HongKong",value:"HK"},{text:"Hungary",value:"HU"},{text:"Iceland",value:"IS"},{text:"India",value:"IN"},{text:"Indonesia",value:"ID"},{text:"Iran",value:"IR"},{text:"Iraq",value:"IQ"},{text:"IsleofMan",value:"IM"},{text:"Israel",value:"IL"},{text:"Italy",value:"IT"},{text:"IvoryCoast",value:"CI"},{text:"Jamaica",value:"JM"},{text:"Japan",value:"JP"},{text:"Jersey",value:"JE"},{text:"Jordan",value:"JO"},{text:"Kazakhstan",value:"KZ"},{text:"Kenya",value:"KE"},{text:"Kiribati",value:"KI"},{text:"Kuwait",value:"KW"},{text:"Kyrgyzstan",value:"KG"},{text:"Laos",value:"LA"},{text:"Latvia",value:"LV"},{text:"Lebanon",value:"LB"},{text:"Lesotho",value:"LS"},{text:"Liberia",value:"LR"},{text:"Libya",value:"LY"},{text:"Liechtenstein",value:"LI"},{text:"Lithuania",value:"LT"},{text:"Luxembourg",value:"LU"},{text:"Macau",value:"MO"},{text:"Madagascar",value:"MG"},{text:"Malawi",value:"MW"},{text:"Malaysia",value:"MY"},{text:"Maldives",value:"MV"},{text:"Mali",value:"ML"},{text:"Malta",value:"MT"},{text:"MarshallIslands",value:"MH"},{text:"Martinique",value:"MQ"},{text:"Mauritania",value:"MR"},{text:"Mauritius",value:"MU"},{text:"Mayotte",value:"YT"},{text:"Mexico",value:"MX"},{text:"Moldova",value:"MD"},{text:"Monaco",value:"MC"},{text:"Mongolia",value:"MN"},{text:"Montenegro",value:"ME"},{text:"Montserrat",value:"MS"},{text:"Morocco",value:"MA"},{text:"Mozambique",value:"MZ"},{text:"Myanmar",value:"MM"},{text:"Namibia",value:"NA"},{text:"Nauru",value:"NR"},{text:"Nepal",value:"NP"},{text:"Netherlands",value:"NL"},{text:"NewCaledonia",value:"NC"},{text:"NewZealand",value:"NZ"},{text:"Nicaragua",value:"NI"},{text:"Niger",value:"NE"},{text:"Nigeria",value:"NG"},{text:"Niue",value:"NU"},{text:"NorfolkIsland",value:"NF"},{text:"NorthKorea",value:"KP"},{text:"NorthMacedonia",value:"MK"},{text:"NorthernMarianaIslands",value:"MP"},{text:"Norway",value:"NO"},{text:"Oman",value:"OM"},{text:"Pakistan",value:"PK"},{text:"Palau",value:"PW"},{text:"Panama",value:"PA"},{text:"PapuaNewGuinea",value:"PG"},{text:"Paraguay",value:"PY"},{text:"Peru",value:"PE"},{text:"Philippines",value:"PH"},{text:"PitcairnIslands",value:"PN"},{text:"Poland",value:"PL"},{text:"Portugal",value:"PT"},{text:"PuertoRico",value:"PR"},{text:"Qatar",value:"QA"},{text:"RepublicofIreland",value:"IE"},{text:"RepublicoftheCongo",value:"CG"},{text:"Romania",value:"RO"},{text:"Russia",value:"RU"},{text:"Rwanda",value:"RW"},{text:"Réunion",value:"RE"},{text:"SaintBarthélemy",value:"BL"},{text:"SaintHelena",value:"SH"},{text:"SaintKittsandNevis",value:"KN"},{text:"SaintLucia",value:"LC"},{text:"SaintPierreandMiquelon",value:"PM"},{text:"SaintVincentandtheGrenadines",value:"VC"},{text:"Samoa",value:"WS"},{text:"SanMarino",value:"SM"},{text:"SaudiArabia",value:"SA"},{text:"Senegal",value:"SN"},{text:"Serbia",value:"RS"},{text:"Seychelles",value:"SC"},{text:"SierraLeone",value:"SL"},{text:"Singapore",value:"SG"},{text:"SintMaarten",value:"SX"},{text:"Slovakia",value:"SK"},{text:"Slovenia",value:"SI"},{text:"SolomonIslands",value:"SB"},{text:"Somalia",value:"SO"},{text:"SouthAfrica",value:"ZA"},{text:"SouthGeorgiaandtheSouthSandwichIslands",value:"GS"},{text:"SouthKorea",value:"KR"},{text:"SouthSudan",value:"SS"},{text:"Spain",value:"ES"},{text:"SriLanka",value:"LK"},{text:"StateofPalestine",value:"PS"},{text:"Sudan",value:"SD"},{text:"Suriname",value:"SR"},{text:"Svalbard",value:"SJ"},{text:"Sweden",value:"SE"},{text:"Switzerland",value:"CH"},{text:"Syria",value:"SY"},{text:"SãoToméandPríncipe",value:"ST"},{text:"Taiwan",value:"TW"},{text:"Tajikistan",value:"TJ"},{text:"Tanzania",value:"TZ"},{text:"Thailand",value:"TH"},{text:"TheBahamas",value:"BS"},{text:"TheGambia",value:"GM"},{text:"Togo",value:"TG"},{text:"Tokelau",value:"TK"},{text:"Tonga",value:"TO"},{text:"TrinidadandTobago",value:"TT"},{text:"Tunisia",value:"TN"},{text:"Turkey",value:"TR"},{text:"Turkmenistan",value:"TM"},{text:"TurksandCaicosIslands",value:"TC"},{text:"Tuvalu",value:"TV"},{text:"Uganda",value:"UG"},{text:"Ukraine",value:"UA"},{text:"UnitedArabEmirates",value:"AE"},{text:"UnitedKingdom",value:"GB"},{text:"UnitedStatesVirginIslands",value:"VI"},{text:"UnitedStates",value:"UM"},{text:"UnitedStates",value:"US"},{text:"Uruguay",value:"UY"},{text:"Uzbekistan",value:"UZ"},{text:"Vanuatu",value:"VU"},{text:"Venezuela",value:"VE"},{text:"Vietnam",value:"VN"},{text:"WallisandFutuna",value:"WF"},{text:"WesternSahara",value:"EH"},{text:"Yemen",value:"YE"},{text:"Zambia",value:"ZM"},{text:"Zimbabwe",value:"ZW"},{text:"ÅlandIslands",value:"AX"}]
Expand Down

0 comments on commit 6efd6e4

Please sign in to comment.