class NZBUnityNzbgeek { public replace : boolean = false ; constructor ( ) { Util . storage . get ( [ 'Providers' , 'ReplaceLinks' ] ) . then ( ( opts ) => { this . replace = opts . ReplaceLinks ; let provider = opts . Providers && opts . Providers . nzbgeek ; let enabled = provider ? provider . Enabled : true ; if ( enabled ) { console . info ( `[NZB Unity] Initializing 1-click functionality...` ) ; this . initializeLinks ( ) ; } else { console . info ( `[NZB Unity] 1-click functionality disabled for this site` ) ; } } ) ; } initializeLinks ( ) { $ ( 'a[href*="/api?t=get&id="]' ) . each ( ( i , el ) => { let a = $ ( el ) ; let row = a . closest ( 'tr.releases' ) ; let category = '' ; let catSrc = 'default' ; let pathSearch = window . location . pathname + window . location . search ; if ( row . find ( 'a.releases_category_text' ) . length ) { category = row . find ( 'a.releases_category_text' ) . text ( ) . split ( /\s*>\s*/ ) [ 0 ] ; catSrc = 'row' ; } else if ( /^\/geekseek.php\?movieid=/ . test ( pathSearch ) ) { $ ( 'tr.details' ) . each ( ( i , el ) => { const text = $ ( el ) . text ( ) . replace ( /\s/g , '' ) ; const match = text . match ( /Category:(.*)/i ) ; if ( match ) { category = match [ 1 ] . split ( '>' ) [ 0 ] ; catSrc = 'detail' ; } } ) ; } let opts = { url : a . attr ( 'href' ) , category } ; if ( this . replace ) { PageUtil . bindAddUrl ( opts , a , true ) ; } else { let link = PageUtil . createAddUrlButton ( opts ) . on ( 'nzb.success' , ( e ) => { link . closest ( 'tr' ) . find ( 'a[href*="details"]' ) . first ( ) . prepend ( '<img src="pics/downloaded.png" class="hastip" title="" style="width:13px;margin-right:.25em;" border="0">' ) ; } ) . insertAfter ( a ) ; } } ) ; } } $ ( ( $ ) => { let nzbIntegration = new NZBUnityNzbgeek ( ) ; } ) ;