mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Merge pull request #2200 from snematoda/patch-2
Minor fix for SponsorBlock
This commit is contained in:
		
						commit
						c4bf2fec6e
					
				
					 1 changed files with 14 additions and 14 deletions
				
			
		| 
						 | 
					@ -214,6 +214,8 @@ export default {
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
        async loadVideo() {
 | 
					        async loadVideo() {
 | 
				
			||||||
 | 
					            this.updateSponsors();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const component = this;
 | 
					            const component = this;
 | 
				
			||||||
            const videoEl = this.$refs.videoEl;
 | 
					            const videoEl = this.$refs.videoEl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -688,6 +690,18 @@ export default {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (markers) markers.style.background = `linear-gradient(${array.join(",")})`;
 | 
					            if (markers) markers.style.background = `linear-gradient(${array.join(",")})`;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        updateSponsors() {
 | 
				
			||||||
 | 
					            const skipOptions = this.getPreferenceJSON("skipOptions", {});
 | 
				
			||||||
 | 
					            this.sponsors?.segments?.forEach(segment => {
 | 
				
			||||||
 | 
					                const option = skipOptions[segment.category];
 | 
				
			||||||
 | 
					                segment.autoskip = option === undefined || option === "auto";
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            if (this.getPreferenceBoolean("showMarkers", true)) {
 | 
				
			||||||
 | 
					                this.shakaPromise.then(() => {
 | 
				
			||||||
 | 
					                    this.updateMarkers();
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        destroy(hotkeys) {
 | 
					        destroy(hotkeys) {
 | 
				
			||||||
            if (this.$ui && !document.pictureInPictureElement) {
 | 
					            if (this.$ui && !document.pictureInPictureElement) {
 | 
				
			||||||
                this.$ui.destroy();
 | 
					                this.$ui.destroy();
 | 
				
			||||||
| 
						 | 
					@ -702,20 +716,6 @@ export default {
 | 
				
			||||||
            this.$refs.container?.querySelectorAll("div").forEach(node => node.remove());
 | 
					            this.$refs.container?.querySelectorAll("div").forEach(node => node.remove());
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    watch: {
 | 
					 | 
				
			||||||
        sponsors() {
 | 
					 | 
				
			||||||
            const skipOptions = this.getPreferenceJSON("skipOptions", {});
 | 
					 | 
				
			||||||
            this.sponsors?.segments?.forEach(segment => {
 | 
					 | 
				
			||||||
                const option = skipOptions[segment.category];
 | 
					 | 
				
			||||||
                segment.autoskip = option === undefined || option === "auto";
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
            if (this.getPreferenceBoolean("showMarkers", true)) {
 | 
					 | 
				
			||||||
                this.shakaPromise.then(() => {
 | 
					 | 
				
			||||||
                    this.updateMarkers();
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue