@@ -112,24 +112,63 @@ <h2>Disclaimer</h2>
112112 var osName = result . os . name . toLowerCase ( ) ;
113113 if ( osName == "windows" ) {
114114 document . writeln ( '<div class="button"><a href="https://github.com/Tribler/tribler/releases/download/v6.5.2/Tribler_6.5.2.exe">Download Tribler</a></div>' ) ;
115- document . writeln ( '<p>For Windows 8/7/Vista/XP' ) ;
115+ document . writeln ( '<p><b> For Windows 8/7/Vista/XP</b> ' ) ;
116116 document . writeln ( '<br>Or go to the <a href="download.html">download page</a></p>' ) ;
117117 }
118118 else if ( osName == "mac os x" ) {
119119 document . writeln ( '<div class="button"><a href="https://github.com/Tribler/tribler/releases/download/v6.5.2/Tribler-6.5.2.dmg">Download Tribler</a></div>' ) ;
120- document . writeln ( '<p>For Snow Leopard or newer' ) ;
120+ document . writeln ( '<p><b> For Snow Leopard or newer</b> ' ) ;
121121 document . writeln ( '<br>Or go to the <a href="download.html">download page</a></p>' ) ;
122122 }
123123 else if ( jQuery . inArray ( osName , new Array ( 'kubuntu' , 'xubuntu' , 'lubuntu' , 'ubuntu' , 'gentoo' , 'fedora' , 'mandriva' , 'redhat' , 'suse' , 'debian' , 'slackware' , 'arch' , 'linux' ) ) !== - 1 ) {
124124 document . writeln ( '<div class="button"><a href="https://github.com/Tribler/tribler/releases/download/v6.5.2/tribler_6.5.2_all.deb">Download Tribler</a></div>' ) ;
125- document . writeln ( '<p>For Linux</p>' ) ;
125+ document . writeln ( '<p><b> For Linux</b> </p>' ) ;
126126 }
127127 else {
128128 document . writeln ( '<div class="button"><a href="download.html">Download Tribler</a></div>' ) ;
129- document . writeln ( '<p>Unknown OS</p>' ) ;
129+ document . writeln ( '<p><b> Unknown OS</b> </p>' ) ;
130130 }
131131 </ script >
132132 < noscript > < div class ="button "> < a href ="download.html "> Download</ a > </ div > </ noscript >
133+ < p id ="release_dlcount "> Total downloads: ?</ p >
134+
135+ < script >
136+ function httpGet ( theUrl , callback )
137+ {
138+ if ( window . XMLHttpRequest )
139+ { // code for IE7+, Firefox, Chrome, Opera, Safari
140+ xmlhttp = new XMLHttpRequest ( ) ;
141+ }
142+ else
143+ { // code for IE6, IE5
144+ xmlhttp = new ActiveXObject ( "Microsoft.XMLHTTP" ) ;
145+ }
146+ xmlhttp . onreadystatechange = function ( )
147+ {
148+ if ( xmlhttp . readyState == 4 && xmlhttp . status == 200 )
149+ {
150+ callback ( xmlhttp . responseText ) ;
151+ }
152+ }
153+ xmlhttp . open ( "GET" , theUrl , true ) ;
154+ xmlhttp . send ( ) ;
155+ }
156+
157+ function add_dls ( a , b ) {
158+ if ( ! ( b [ "name" ] . endsWith ( ".txt" ) || b [ "name" ] . endsWith ( ".txt.asc" ) || b [ "name" ] . endsWith ( ".tar.xz" ) ) ) {
159+ return a + b [ "download_count" ] ;
160+ } else {
161+ return a ;
162+ }
163+ }
164+
165+ function get_downloads ( raw_json ) {
166+ dlcount = JSON . parse ( raw_json ) [ "assets" ] . reduce ( add_dls , 0 ) ;
167+ document . getElementById ( 'release_dlcount' ) . innerHTML = "Total downloads: " + dlcount ;
168+ }
169+
170+ httpGet ( "https://api.github.com/repos/Tribler/tribler/releases/latest" , get_downloads ) ;
171+ </ script >
133172 </ div >
134173 < div class ="wow fadeInUp ">
135174 < a href ="img/image0.png " data-lightbox ="screenshots " title ="Channel contents | View the torrents within a channel. "> < img width =500px height =350px src ="img/image0.png " title ="Screenshot of the Tribler GUI " alt ="" /> </ a >
0 commit comments