File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ function add_custom_version_dropdown ( json_loc , target_loc , text ) {
2+
3+ var dropdown = document . createElement ( "div" ) ;
4+ dropdown . className = "md-flex__cell md-flex__cell--shrink dropdown" ;
5+ var button = document . createElement ( "button" ) ;
6+ button . className = "dropdownbutton" ;
7+ var content = document . createElement ( "div" ) ;
8+ content . className = "dropdown-content md-hero" ;
9+ dropdown . appendChild ( button ) ;
10+ dropdown . appendChild ( content ) ;
11+ console . log ( '*********' ) ;
12+ $ . getJSON ( json_loc , function ( versions ) {
13+ for ( var key in versions ) {
14+ if ( versions . hasOwnProperty ( key ) ) {
15+ console . log ( key , versions [ key ] ) ;
16+ var a = document . createElement ( "a" ) ;
17+ a . innerHTML = key ;
18+ a . title = key ;
19+ a . href = target_loc + versions [ key ] + "/{{ pagename }}.html" ;
20+ console . log ( '----' , a . href ) ;
21+ content . appendChild ( a ) ;
22+ }
23+ }
24+ } ) . done ( function ( ) {
25+ button . innerHTML = text ;
26+ } ) . fail ( function ( ) {
27+ button . innerHTML = "Other Versions Not Found" ;
28+ } ) . always ( function ( ) {
29+ $ ( ".navheader" ) . append ( dropdown ) ;
30+ } ) ;
31+ } ;
You can’t perform that action at this time.
0 commit comments