1
1
export default {
2
- icon : " https://fireship.io/img/favicon.png" ,
2
+ icon : ' https://fireship.io/img/favicon.png' ,
3
3
name : {
4
- en : " Fireship - PRO unlocked" ,
5
- vi : " Fireship - Mở khoá PRO" ,
4
+ en : ' Fireship - PRO unlocked' ,
5
+ vi : ' Fireship - Mở khoá PRO' ,
6
6
} ,
7
7
description : {
8
- en : " Unlock all Fireship PRO courses/lessons (saved $399 USD)" ,
9
- vi : " Mở khoá tất cả khoá học/bài giảng PRO trên Fireship (tiết kiệm $399 USD)" ,
8
+ en : ' Unlock all Fireship PRO courses/lessons (saved $399 USD)' ,
9
+ vi : ' Mở khoá tất cả khoá học/bài giảng PRO trên Fireship (tiết kiệm $399 USD)' ,
10
10
} ,
11
- infoLink : " https://fireship.io/" ,
11
+ infoLink : ' https://fireship.io/' ,
12
12
13
- whiteList : [ " https://fireship.io/*" ] ,
13
+ whiteList : [ ' https://fireship.io/*' ] ,
14
14
15
- contentScript : {
15
+ pageScript : {
16
16
onDocumentIdle : ( ) => {
17
17
// ==UserScript==
18
18
// @name Freeship
19
19
// @namespace lemons
20
- // @version 1.7
20
+ // @version 1.8
21
21
// @description Unlock all Fireship PRO courses/lessons.
22
22
// @author lemons
23
23
// @match https://fireship.io/*
@@ -27,31 +27,54 @@ export default {
27
27
// @updateURL https://update.greasyfork.org/scripts/455330/Freeship.meta.js
28
28
// ==/UserScript==
29
29
30
- // prettier-ignore
31
- setInterval ( async ( ) => {
32
- document . querySelectorAll ( "[free=\"\"]" ) . forEach ( el => el . setAttribute ( "free" , true ) ) // set all elements with the attribute free set to "" to true
30
+ console . log ( 'use fireship_vip.js' ) ;
33
31
34
- if ( document . querySelector ( "if-access [slot=\"granted\"]" ) ) { // replace HOW TO ENROLL to YOU HAVE ACCESS
35
- document . querySelector ( "if-access [slot=\"denied\"]" ) . remove ( )
36
- document . querySelector ( "if-access [slot=\"granted\"]" ) . setAttribute ( "slot" , "denied" )
32
+ const unlock = async ( ) => {
33
+ // set all elements with the attribute free set to "" to true
34
+ document . querySelectorAll ( '[free=""]' ) . forEach ( ( el ) => el . setAttribute ( 'free' , true ) ) ;
35
+
36
+ if ( document . querySelector ( 'if-access [slot="granted"]' ) ) {
37
+ // replace HOW TO ENROLL to YOU HAVE ACCESS
38
+ document . querySelector ( 'if-access [slot="denied"]' ) . remove ( ) ;
39
+ document . querySelector ( 'if-access [slot="granted"]' ) . setAttribute ( 'slot' , 'denied' ) ;
37
40
}
38
41
39
- if ( document . querySelector ( "video-player" ) ?. shadowRoot ?. querySelector ( ".vid" ) ?. innerHTML ) return ; // return if no video player
40
- const vimeoId = Number ( atob ( document . querySelector ( "global-data" ) . vimeo ) ) ; // get id for vimeo video
41
- const youtubeId = atob ( document . querySelector ( "global-data" ) . youtube ) ; // get id for vimeo video
42
+ // return if no video player
43
+ if ( document . querySelector ( 'video-player' ) ?. shadowRoot ?. querySelector ( '.vid' ) ?. innerHTML ) return ;
44
+
45
+ // get id for vimeo video
46
+ const vimeoId = Number ( atob ( document . querySelector ( 'global-data' ) . vimeo || btoa ( '' ) ) ) ;
42
47
43
- if ( youtubeId ) { // if there is an id,
44
- document . querySelector ( "video-player" ) . setAttribute ( "free" , true ) // set free to true
45
- document . querySelector ( "video-player" ) . shadowRoot . querySelector ( ".vid" ) . innerHTML = `<iframe src="https://youtube.com/embed/${ youtubeId } " allow="autoplay; fullscreen; picture-in-picture" allowfullscreen="" title="${ location . pathname . split ( "/" ) [ 3 ] } " width="426" height="240" frameborder="0"></iframe>` // set video
46
- return ;
48
+ // get id for vimeo video
49
+ const youtubeId = atob ( document . querySelector ( 'global-data' ) . youtube || btoa ( '' ) ) ;
50
+
51
+ if ( youtubeId ) {
52
+ // if there is an id,
53
+ document . querySelector ( 'video-player' ) . setAttribute ( 'free' , true ) ; // set free to true
54
+ document
55
+ . querySelector ( 'video-player' )
56
+ . shadowRoot . querySelector (
57
+ '.vid'
58
+ ) . innerHTML = `<iframe src="https://youtube.com/embed/${ youtubeId } " allow="autoplay; fullscreen; picture-in-picture" allowfullscreen="" title="${
59
+ location . pathname . split ( '/' ) [ 3 ]
60
+ } " width="426" height="240" frameborder="0"></iframe>`; // set video
61
+ return ;
47
62
}
48
- if ( vimeoId ) { // if there is an id,
49
- document . querySelector ( "video-player" ) . setAttribute ( "free" , true ) // set free to true
50
- const html = ( await fetch ( `https://vimeo.com/api/oembed.json?url=https%3A%2F%2Fvimeo.com%2F${ vimeoId } &id=${ vimeoId } ` ) . then ( r => r . json ( ) ) ) . html
51
- document . querySelector ( "video-player" ) . shadowRoot . querySelector ( ".vid" ) . innerHTML = html // set video
52
- return ;
63
+ if ( vimeoId ) {
64
+ // if there is an id,
65
+ document . querySelector ( 'video-player' ) . setAttribute ( 'free' , true ) ; // set free to true
66
+ const html = (
67
+ await fetch (
68
+ `https://vimeo.com/api/oembed.json?url=https%3A%2F%2Fvimeo.com%2F${ vimeoId } &id=${ vimeoId } `
69
+ ) . then ( ( r ) => r . json ( ) )
70
+ ) . html ;
71
+ document . querySelector ( 'video-player' ) . shadowRoot . querySelector ( '.vid' ) . innerHTML = html ; // set video
72
+ return ;
53
73
}
54
- } , 500 )
74
+ } ;
75
+
76
+ window . onload = unlock ( ) ;
77
+ window . addEventListener ( 'flamethrower:router:end' , unlock ) ;
55
78
} ,
56
79
} ,
57
80
} ;
0 commit comments