mirror of
https://github.com/torproject/webwml.git
synced 2024-11-27 03:30:40 +00:00
Bug 22357: Move download lang drop-down code to external .js file
This commit is contained in:
parent
ffea450359
commit
6c43614ff6
@ -26,6 +26,7 @@ body {
|
||||
.toptwenty { margin-top: 20px; }
|
||||
.topforty { margin-top: 40px; }
|
||||
|
||||
.hidden { display: none; }
|
||||
|
||||
/* HEADER ------------*/
|
||||
|
||||
|
@ -54,44 +54,15 @@
|
||||
Source: http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/
|
||||
License: Public Domain (http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/#comment-32882) */
|
||||
</script>
|
||||
<script async type="text/javascript">
|
||||
# /* switches package links depending on selection */
|
||||
function updateLang() {
|
||||
var caller = $( this );
|
||||
var pkg = caller.attr('id');
|
||||
var lang = caller.val();
|
||||
var wintbb = '../dist/torbrowser/<version-torbrowserbundledir>/torbrowser-install-<version-torbrowserbundle>_'+lang+'.exe';
|
||||
var osxtbb = '../dist/torbrowser/<version-torbrowserbundledir>/TorBrowser-<version-torbrowserbundleosx64>-osx64_'+lang+'.dmg';
|
||||
var osxtbb64 = '../dist/torbrowser/<version-torbrowserbundledir>/TorBrowser-<version-torbrowserbundleosx64>-osx64_'+lang+'.dmg';
|
||||
var lintbb32 = '../dist/torbrowser/<version-torbrowserbundledir>/tor-browser-linux32-<version-torbrowserbundlelinux32>_'+lang+'.tar.xz';
|
||||
var lintbb64 = '../dist/torbrowser/<version-torbrowserbundledir>/tor-browser-linux64-<version-torbrowserbundlelinux64>_'+lang+'.tar.xz';
|
||||
if(pkg == 'win-tbb'){
|
||||
$('.'+pkg).replaceWith('<a class="button win-tbb" href="'+wintbb+'"><span class="strong">Download</span><span class="normal"><button-win-tbb32></span></a>');
|
||||
$('.'+pkg+'-sig').replaceWith('<a class="win-tbb-sig" href="'+wintbb+'.asc">sig</a>');
|
||||
}else if(pkg == 'osx-tbb'){
|
||||
$('.'+pkg).replaceWith('<a class="button osx-tbb" href="'+osxtbb+'"><span class="strong">Download</span><span class="normal"><button-osx-tbb32></span></a>');
|
||||
$('.'+pkg+'-sig').replaceWith('<a class="osx-tbb-sig" href="'+osxtbb+'.asc">sig</a>');
|
||||
}else if(pkg == 'osx-tbb64'){
|
||||
$('.'+pkg).replaceWith('<a class="button osx-tbb64" href="'+osxtbb64+'"><span class="strong">Download</span><span class="normal"><button-osx-tbb64></span></a>');
|
||||
$('.'+pkg+'-sig').replaceWith('<a class="osx-tbb64-sig" href="'+osxtbb64+'.asc">sig</a>');
|
||||
}else if(pkg == 'lin-tbb32'){
|
||||
$('.'+pkg).replaceWith('<a class="button lin-tbb32" href="'+lintbb32+'"><span class="strong">Download</span><span class="normal"><button-lin-tbb32></span></a>');
|
||||
$('.'+pkg+'-sig').replaceWith('<a class="lin-tbb32-sig" href="'+lintbb32+'.asc">sig</a>');
|
||||
}else if(pkg == 'lin-tbb64'){
|
||||
$('.'+pkg).replaceWith('<a class="button lin-tbb64" href="'+lintbb64+'"><span class="strong">Download</span><span class="normal"><button-lin-tbb64></span></a>');
|
||||
$('.'+pkg+'-sig').replaceWith('<a class="lin-tbb64-sig" href="'+lintbb64+'.asc">sig</a>');
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('.lang').ready(updateLang);
|
||||
$('.lang').change(updateLang);
|
||||
/* Only show language selector if javascript is enabled */
|
||||
$('.lang').css('display', 'block');
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body onload="resetAll()" onunload="">
|
||||
<span class="hidden" id="version-data">
|
||||
{ "torbrowserbundledir" : "<version-torbrowserbundledir>",
|
||||
"torbrowserbundle" : "<version-torbrowserbundle>",
|
||||
"torbrowserbundleosx64" : "<version-torbrowserbundleosx64>",
|
||||
"torbrowserbundlelinux32" : "<version-torbrowserbundlelinux32>",
|
||||
"torbrowserbundlelinux64" : "<version-torbrowserbundlelinux64>" }
|
||||
</span>
|
||||
<div id="wrap">
|
||||
<div id="header">
|
||||
<h1 id="logo"><a href="<page index>">Tor</a></h1>
|
||||
|
@ -36,6 +36,32 @@ function resetAll() {
|
||||
}
|
||||
}
|
||||
|
||||
/* switches package links depending on selection */
|
||||
function updateLang() {
|
||||
var caller = $( this );
|
||||
var pkg = caller.attr('id');
|
||||
var lang = caller.val();
|
||||
var versions = JSON.parse($("#version-data").text());
|
||||
var rootDir = '../dist/torbrowser/' + versions.torbrowserbundledir + '/';
|
||||
var bundles = {
|
||||
'win-tbb' : rootDir + 'torbrowser-install-' + versions.torbrowserbundle + '_' + lang + '.exe',
|
||||
'osx-tbb' : rootDir + 'TorBrowser-' + versions.torbrowserbundleosx64 + '-osx64_' + lang +'.dmg',
|
||||
'osx-tbb64' : rootDir + 'TorBrowser-' + versions.torbrowserbundleosx64 + '-osx64_' + lang + '.dmg',
|
||||
'lin-tbb32' : rootDir + 'tor-browser-linux32-' + versions.torbrowserbundlelinux32 + '_' + lang + '.tar.xz',
|
||||
'lin-tbb64' : rootDir + 'tor-browser-linux64-' + versions.torbrowserbundlelinux64 + '_' + lang + '.tar.xz'
|
||||
};
|
||||
|
||||
$('.'+pkg).attr("href", bundles[pkg]);
|
||||
$('.'+pkg+'-sig').attr("href", bundles[pkg] + '.asc');
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('.lang').ready(updateLang);
|
||||
$('.lang').change(updateLang);
|
||||
/* Only show language selector if javascript is enabled */
|
||||
$('.lang').css('display', 'block');
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('.jump').click(function(event){
|
||||
|
Loading…
Reference in New Issue
Block a user