@@ -29,6 +29,7 @@ function versionCompare(v1, v2) {
29
29
}
30
30
31
31
var latest_libiio ;
32
+ var latest_scopy ;
32
33
var mac = false ;
33
34
34
35
function GetDriverurl ( ) {
@@ -52,9 +53,10 @@ function GetDriverurl() {
52
53
} else
53
54
document . getElementById ( 'hidedriver' ) . style . display = "none" ;
54
55
var linux = navigator . platform . indexOf ( 'Linux' ) > - 1 ? true : false ;
55
- if ( mac || win || linux )
56
+ if ( mac || win || linux ) {
56
57
document . getElementById ( 'hidelib' ) . style . display = "inline" ;
57
- else {
58
+ document . getElementById ( 'hidescopy' ) . style . display = "inline" ;
59
+ } else {
58
60
if ( navigator . platform . match ( / ( L i n u x | i P h o n e | i P o d | i P a d | A n d r o i d ) / i) ) {
59
61
document . getElementById ( 'libtest' ) . innerHTML = "Sorry, we don't support " + navigator . platform + " yet. Please ask." ;
60
62
jQuery ( '#libtest' ) . attr ( 'href' , "https://ez.analog.com/university-program" ) ;
@@ -68,32 +70,64 @@ function GetDriverurl() {
68
70
var req = jQuery . getJSON ( "https://api.github.com/repos/analogdevicesinc/libiio/releases/latest" ) ;
69
71
req . fail ( function ( ) {
70
72
document . getElementById ( 'hidelib' ) . style . display = "none" ;
73
+ document . getElementById ( 'hidescopy' ) . style . display = "none" ;
71
74
latest_libiio = null ;
72
75
} ) ;
73
76
req . done ( function ( response ) {
74
77
latest_libiio = response ;
75
- var select = document . getElementById ( "os-select" ) ;
78
+ var libiio_os = document . getElementById ( "libiio-os" ) ;
79
+ var scopy_os = document . getElementById ( "scopy-os" ) ;
76
80
var suffix = "" ;
77
81
for ( i = 0 ; i < latest_libiio . assets . length ; i ++ ) {
78
82
os = latest_libiio . assets [ i ] . name . split ( '-' ) [ 2 ] ;
79
83
suffix = os . slice ( - 4 ) ;
80
84
if ( suffix == ".zip" ) {
81
85
os = os . slice ( 0 , os . length - 4 ) ;
82
86
}
83
- for ( j = 0 ; j < select . length ; j ++ ) {
84
- if ( os . match ( select [ j ] . value ) )
87
+ for ( j = 0 ; j < libiio_os . length ; j ++ ) {
88
+ if ( os . match ( libiio_os [ j ] . value ) )
85
89
break ;
86
90
}
87
- if ( j == select . length ) {
88
- select . options [ select . options . length ] = new Option ( os ) ;
91
+ if ( j == libiio_os . length ) {
92
+ libiio_os . options [ libiio_os . options . length ] = new Option ( os ) ;
89
93
if ( ( win && os == "Windows" ) || ( mac && os == "darwin" ) || ( linux && os == "ubuntu" ) ) {
90
- select . value = os ;
94
+ libiio_os . value = os ;
91
95
libiio_type ( ) ;
92
96
}
93
97
}
94
98
}
95
99
if ( latest_libiio . hasOwnProperty ( 'tarball_url' ) || latest_libiio . hasOwnProperty ( 'zipball_url' ) )
96
- select . options [ select . options . length ] = new Option ( "source" ) ;
100
+ libiio_os . options [ libiio_os . options . length ] = new Option ( "source" ) ;
101
+ } ) ;
102
+
103
+ var req = jQuery . getJSON ( "https://api.github.com/repos/analogdevicesinc/scopy/releases/latest" ) ;
104
+ req . fail ( function ( ) {
105
+ document . getElementById ( 'hidescopy' ) . style . display = "none" ;
106
+ latest_scopy = null ;
107
+ } ) ;
108
+ req . done ( function ( response ) {
109
+ latest_scopy = response ;
110
+ var scopy_os = document . getElementById ( "scopy-os" ) ;
111
+ var suffix = "" ;
112
+ for ( i = 0 ; i < latest_scopy . assets . length ; i ++ ) {
113
+ var os = latest_scopy . assets [ i ] . name . split ( '-' ) [ 2 ] ;
114
+ if ( os . length == 0 )
115
+ os = latest_scopy . assets [ i ] . name . split ( ' ' ) [ 0 ] ;
116
+ os = os . split ( '_' ) [ 0 ] ;
117
+ for ( j = 0 ; j < scopy_os . length ; j ++ ) {
118
+ if ( os . match ( scopy_os [ j ] . value ) )
119
+ break ;
120
+ }
121
+ if ( j == scopy_os . length ) {
122
+ scopy_os . options [ scopy_os . options . length ] = new Option ( os ) ;
123
+ if ( ( win && os == "Windows" ) || ( mac && os == "osx" ) || ( linux && os == "Linux" ) ) {
124
+ scopy_os . value = os ;
125
+ scopy_type ( ) ;
126
+ }
127
+ }
128
+ }
129
+ if ( latest_scopy . hasOwnProperty ( 'tarball_url' ) || latest_scopy . hasOwnProperty ( 'zipball_url' ) )
130
+ scopy_os . options [ scopy_os . options . length ] = new Option ( "source" ) ;
97
131
} ) ;
98
132
if ( win ) {
99
133
req = jQuery . getJSON ( "https://api.github.com/repos/analogdevicesinc/plutosdr-m2k-drivers-win/releases/latest" ) ;
@@ -123,8 +157,8 @@ function GetDriverurl() {
123
157
}
124
158
125
159
function libiio_type ( ) {
126
- var select = document . getElementById ( "type-select " ) ;
127
- var os = document . getElementById ( "os-select " ) . value ;
160
+ var select = document . getElementById ( "libiio-type " ) ;
161
+ var os = document . getElementById ( "libiio-os " ) . value ;
128
162
select . onchange = null ;
129
163
var i ;
130
164
for ( i = select . options . length - 1 ; i >= 0 ; i -- ) {
@@ -159,10 +193,51 @@ function libiio_type() {
159
193
libiio_ver ( ) ;
160
194
}
161
195
196
+ function scopy_type ( ) {
197
+ var type = select = document . getElementById ( "scopy-type" ) ;
198
+ var os = document . getElementById ( "scopy-os" ) . value ;
199
+ select . onchange = null ;
200
+ var i ;
201
+ for ( i = select . options . length - 1 ; i >= 0 ; i -- ) {
202
+ type . remove ( i ) ;
203
+ }
204
+ var suffix = "" ;
205
+ for ( i = 0 ; i < latest_scopy . assets . length ; i ++ ) {
206
+ if ( latest_scopy . assets [ i ] . browser_download_url . match ( os ) ) {
207
+ suffix = latest_scopy . assets [ i ] . browser_download_url . slice ( - 4 ) ;
208
+ if ( suffix == "r.gz" ) {
209
+ suffix = ".tar.gz" ;
210
+ }
211
+ for ( j = 0 ; j < type . length ; j ++ ) {
212
+ if ( suffix . match ( select [ j ] . value ) )
213
+ break ;
214
+ }
215
+ if ( j == type . length ) {
216
+ type . options [ select . options . length ] = new Option ( suffix ) ;
217
+ }
218
+ }
219
+ }
220
+ if ( os . match ( 'source' ) ) {
221
+ if ( latest_scopy . hasOwnProperty ( 'tarball_url' ) )
222
+ type . options [ select . options . length ] = new Option ( '.tar' ) ;
223
+ if ( latest_scopy . hasOwnProperty ( 'zipball_url' ) )
224
+ type . options [ select . options . length ] = new Option ( '.zip' ) ;
225
+ }
226
+
227
+ if ( type . length == 1 )
228
+ document . getElementById ( 'hidescopytype' ) . style . display = "none" ;
229
+ else
230
+ document . getElementById ( 'hidescopytype' ) . style . display = "inline" ;
231
+
232
+ type . onchange = scopy_url ;
233
+ scopy_url ( ) ;
234
+ }
235
+
236
+
162
237
function libiio_ver ( ) {
163
238
var select = document . getElementById ( "ver-select" ) ;
164
- var os = document . getElementById ( "os-select " ) . value ;
165
- var suffix = document . getElementById ( "type-select " ) . value ;
239
+ var os = document . getElementById ( "libiio-os " ) . value ;
240
+ var suffix = document . getElementById ( "libiio-type " ) . value ;
166
241
select . onchange = null ;
167
242
var i ;
168
243
for ( i = select . options . length - 1 ; i >= 0 ; i -- ) {
@@ -188,8 +263,8 @@ function libiio_ver() {
188
263
}
189
264
190
265
function libiio_url ( ) {
191
- var os = document . getElementById ( "os-select " ) . value ;
192
- var suffix = document . getElementById ( "type-select " ) . value ;
266
+ var os = document . getElementById ( "libiio-os " ) . value ;
267
+ var suffix = document . getElementById ( "libiio-type " ) . value ;
193
268
var ver = document . getElementById ( "ver-select" ) . value ;
194
269
var i , url ;
195
270
for ( i = 0 ; i < latest_libiio . assets . length ; i ++ ) {
@@ -212,6 +287,29 @@ function libiio_url() {
212
287
}
213
288
}
214
289
290
+ function scopy_url ( ) {
291
+ var os = document . getElementById ( "scopy-os" ) . value ;
292
+ var suffix = document . getElementById ( "scopy-type" ) . value ;
293
+ var i , url ;
294
+ for ( i = 0 ; i < latest_scopy . assets . length ; i ++ ) {
295
+ url = latest_scopy . assets [ i ] . browser_download_url ;
296
+ if ( url . match ( os ) && url . match ( suffix ) ) {
297
+ jQuery ( '#scopytest' ) . attr ( 'href' , url ) ;
298
+ document . getElementById ( 'scopytest' ) . innerHTML = latest_scopy . assets [ i ] . name ;
299
+ }
300
+ }
301
+ if ( os . match ( 'source' ) ) {
302
+ if ( suffix . match ( '.tar' ) ) {
303
+ document . getElementById ( 'scopytest' ) . innerHTML = "Source code (tar)" ;
304
+ jQuery ( '#scopytest' ) . attr ( 'href' , latest_scopy . tarball_url ) ;
305
+ }
306
+ if ( suffix . match ( '.zip' ) ) {
307
+ document . getElementById ( 'scopytest' ) . innerHTML = "Source code (zip)" ;
308
+ jQuery ( '#scopytest' ) . attr ( 'href' , latest_scopy . zipball_url ) ;
309
+ }
310
+ }
311
+ }
312
+
215
313
function CheckFrmVersion ( ) {
216
314
GetDriverurl ( ) ;
217
315
var req = jQuery . getJSON ( "https://api.github.com/repos/analogdevicesinc/m2k-fw/releases/latest" ) ;
0 commit comments