File tree 1 file changed +16
-4
lines changed
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 25
25
</ noscript >
26
26
< script type ="text/javascript ">
27
27
$ ( document ) . ready ( function ( ) {
28
+ /* work-around for https://github.com/readthedocs/readthedocs.org/issues/6152
29
+ * via https://www.npmjs.com/package/cors-anywhere */
30
+ $ . ajaxPrefilter ( function ( options ) {
31
+ if ( options . crossDomain && jQuery . support . cors ) {
32
+ options . url = 'https://cors-anywhere.herokuapp.com/' + options . url ;
33
+ }
34
+ } ) ;
35
+
28
36
/* curl https://readthedocs.org/api/v2/project/?slug=warpx | jq '.results[0].id' */
29
37
var warpx_rtd_id = 496616 ;
30
38
/* see https://docs.readthedocs.io/en/stable/api/v2.html#project-versions */
31
39
$ . ajax ( {
32
40
crossDomain : true ,
33
41
url : "https://readthedocs.org/api/v2/project/" + warpx_rtd_id . toString ( ) + "/active_versions/" ,
34
- method : 'GET'
35
- } ) . then ( function ( data ) {
36
- $ . each ( data . versions , function ( index , value ) {
42
+ //dataType: "jsonp",
43
+ success : function ( data ) {
44
+ $ . each ( data . versions , function ( index , value ) {
37
45
var version_name = value . slug ;
38
46
if ( version_name != "latest" ) {
39
47
$ ( 'ul#earlier' ) . append (
44
52
'</a></li>'
45
53
) ;
46
54
}
47
- } ) ;
55
+ } ) ;
56
+ } ,
57
+ error : function ( ) {
58
+ console . error ( 'Error loading the RTD API endpoint' ) ;
59
+ } ,
48
60
} ) ;
49
61
} ) ;
50
62
</ script >
You can’t perform that action at this time.
0 commit comments