@@ -3,45 +3,10 @@ import throttle from 'lodash/throttle';
33import 'whatwg-fetch' ;
44
55import Player from './Player' ;
6+ import * as clientUtils from './client' ;
67
78const Modernizr = window . suggestv . Modernizr ;
8-
9- /**
10- * Retrieve the current client based on the current URL we are in
11- * @returns {* }
12- */
13- function getClient ( ) {
14- const href = window . location . href ;
15-
16- if ( urlMatch ( 'localhost' ) ) return 'localhost' ;
17- if ( urlMatch ( [ 'delta.sugges.tv/test/index' , 'build.suggestv.io/test/index' , 'build.suggestv.io/test/cjallen' ] ) ) return 'test' ;
18- if ( urlMatch ( [ 'delta.sugges.tv/test' , 'build.suggestv.io/test' ] ) ) return 'client-test' ;
19- if ( urlMatch ( 'telegraph.co.uk' ) ) return 'telegraph' ;
20- if ( urlMatch ( 'londontheinside.com' ) ) return 'londontheinside' ;
21- if ( urlMatch ( 'beautyandthedirt.com' ) ) return 'beautyandthedirt' ;
22- if ( urlMatch ( 'bristol-sport.co.uk' ) ) return 'bristolsport' ;
23- if ( urlMatch ( 'proactiveinvestors.co.uk' ) ) return 'proactiveinvestors' ;
24- if ( urlMatch ( 'advfn.com' ) ) return 'advfn' ;
25- if ( urlMatch ( 'hospitalitytrends.net' ) ) return 'hospitalitytrends' ;
26- if ( urlMatch ( 'prospectmagazine.co.uk' ) ) return 'prospectmagazine' ;
27- if ( urlMatch ( 'spectator.co.uk' ) ) return 'spectator' ;
28- if ( urlMatch ( 'cityam.com' ) ) return 'cityam' ;
29- if ( urlMatch ( 'hitc.com' ) ) return 'hitc' ;
30- if ( urlMatch ( 'zmescience.com' ) ) return 'sovrnus' ;
31- if ( urlMatch ( [ 'livingly.com' , 'independent.ie' ] ) ) return 'sovrnuk' ;
32- if ( urlMatch ( 'clickon.co' ) ) return 'clickon' ;
33- if ( urlMatch ( [ 'lbc.co.uk' , 'classicfm.com' , 'capitalfm.com' , 'heart.co.uk' ] ) ) return 'global-radio' ;
34-
35- function urlMatch ( url ) {
36- return Array . isArray ( url )
37- ? url . some ( u => href . indexOf ( u ) !== - 1 )
38- : href . indexOf ( url ) !== - 1 ;
39- }
40-
41- return 'unknown' ;
42- }
43-
44- const CLIENT = getClient ( ) ;
9+ const CLIENT = clientUtils . getClient ( ) ;
4510
4611class App extends React . Component {
4712 static getVideos ( url , client ) {
@@ -166,26 +131,23 @@ class App extends React.Component {
166131
167132 setVideos ( data ) {
168133 const videos = [ ] ;
169- const SCORE_LIMIT = 15 ;
170134 this . setState ( { query : data . keywords } ) ;
171135
172136 if ( data !== null && data . results && data . results . length > 0 ) {
173137
174138 data . results . forEach ( ( video ) => {
175139 const fields = video . fields ;
176140
177- if ( Number ( fields . _score [ 0 ] ) > SCORE_LIMIT ) {
178- videos . push ( {
179- sources : [ {
180- src : fields . sources [ 0 ] ,
181- type : 'video/mp4' ,
182- } ] ,
183- poster : fields . poster [ 0 ] ,
184- title : fields . title [ 0 ] ,
185- description : fields . description [ 0 ] ,
186- videoId : video . id ,
187- } ) ;
188- }
141+ videos . push ( {
142+ sources : [ {
143+ src : fields . sources [ 0 ] ,
144+ type : 'video/mp4' ,
145+ } ] ,
146+ poster : fields . poster [ 0 ] ,
147+ title : fields . title [ 0 ] ,
148+ description : fields . description [ 0 ] ,
149+ videoId : video . id ,
150+ } ) ;
189151 } ) ;
190152
191153 if ( videos . length !== 0 ) {
0 commit comments