File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ export default {
1414 vi : "Tải bất kỳ video facebook nào mà bạn đang xem (watch / story / comment / reel / chat / bình luận / tin nhắn)" ,
1515 } ,
1616 badges : [ BADGES . hot ] ,
17+ changeLogs : {
18+ "2024-06-26" : "fix logic" ,
19+ } ,
20+
1721 whiteList : [ "https://*.facebook.com/*" ] ,
1822 infoLink :
1923 "https://greasyfork.org/en/scripts/477748-facebook-video-downloader" ,
@@ -66,13 +70,27 @@ export const shared = {
6670 result . push ( {
6771 overlapScore : UfsGlobal . DOM . getOverlapScore ( video ) ,
6872 videoId : video . parentElement [ key ] . children . props . videoFBID ,
73+
74+ // https://stackoverflow.com/a/31196707/23648002
75+ playing : ! ! (
76+ video . currentTime > 0 &&
77+ ! video . paused &&
78+ ! video . ended &&
79+ video . readyState > 2
80+ ) ,
6981 } ) ;
7082 } catch ( e ) {
7183 console . log ( "ERROR on get videoFBID: " , e ) ;
7284 }
7385 }
7486
87+ // if there is playing video => return that
88+ let playingVideo = result . find ( ( _ ) => _ . playing ) ;
89+ if ( playingVideo ) return [ playingVideo . videoId ] ;
90+
91+ // else return all videos in-viewport
7592 return result
93+ . filter ( ( _ ) => _ . videoId && ( _ . overlapScore > 0 || _ . playing ) )
7694 . sort ( ( a , b ) => b . overlapScore - a . overlapScore )
7795 . map ( ( _ ) => _ . videoId ) ;
7896 } ) ;
You can’t perform that action at this time.
0 commit comments