Move scripts to their own js file

This commit is contained in:
hiromipaw 2017-06-16 11:16:38 +02:00
parent bfd7aef36e
commit 17643b0196
6 changed files with 98 additions and 108 deletions

View File

@ -8,81 +8,14 @@
<a href="<page index>">Home &raquo; </a>
<a href="<page docs/torbutton/index>">Torbutton</a>
</div>
<div id="maincol">
<div id="maincol">
<!-- PUT CONTENT AFTER THIS TAG -->
<link rel="search" type="application/opensearchdescription+xml" title="Google Canada" href="search/google-ca.xml"/>
<link rel="search" type="application/opensearchdescription+xml" title="Google UK" href="search/google-uk.xml"/>
<link rel="search" type="application/opensearchdescription+xml" title="Google USA" href="search/google-us.xml"/>
<script type="text/javascript">
function addSearchProvider(prov) {
try {
window.external.AddSearchProvider(prov);
}
catch (e) {
alert("Search plugins require Firefox 2");
return;
}
}
function addEngine(name,ext,cat,pid)
{
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
window.sidebar.addSearchEngine(
"http://mycroft.mozdev.org/install.php/" + pid + "/" + name + ".src",
"http://mycroft.mozdev.org/install.php/" + pid + "/" + name + "."+ ext, name, cat );
} else {
alert("You will need a browser which supports Sherlock to install this plugin.");
}
}
function addOpenSearch(name,ext,cat,pid,meth)
{
if ((typeof window.external == "object") && ((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function"))) {
if ((typeof window.external.AddSearchProvider == "unknown") && meth == "p") {
alert("This plugin uses POST which is not currently supported by Internet Explorer's implementation of OpenSearch.");
} else {
window.external.AddSearchProvider(
"http://mycroft.mozdev.org/installos.php/" + pid + "/" + name + ".xml");
}
} else {
alert("You will need a browser which supports OpenSearch to install this plugin.");
}
}
function addOpenSearch2(name,ext,cat,pid,meth)
{
if ((typeof window.external == "object") && ((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function"))) {
if ((typeof window.external.AddSearchProvider == "unknown") && meth == "p") {
alert("This plugin uses POST which is not currently supported by Internet Explorer's implementation of OpenSearch.");
} else {
window.external.AddSearchProvider(
"http://torbutton.torproject.org/dev/search/" + name + ".xml");
}
} else {
alert("You will need a browser which supports OpenSearch to install this plugin.");
}
}
function install (aEvent)
{
var params = {
"Torbutton": { URL: aEvent.target.href,
Hash: aEvent.target.getAttribute("hash"),
toString: function () { return this.URL; }
}
};
InstallTrigger.install(params);
return false;
}
</script>
<script type="text/javascript" src="$(DOCROOT)/js/functions.js" charset="utf-8"></script>
<h2>Torbutton</h2>
<hr>
@ -110,12 +43,12 @@
repository</a> or simply unzip the xpi.
<br/>
<strong>Bug Reports:</strong> <a href="https://trac.torproject.org/projects/tor/report/14">Torproject Bug Tracker</a><br/>
<strong>Documents:</strong>
<b>[</b>
<strong>Documents:</strong>
<b>[</b>
<a href="https://gitweb.torproject.org/torbutton.git/tree/src/CHANGELOG">changelog</a> <b>|</b>
<a href="https://gitweb.torproject.org/torbutton.git/tree/src/LICENSE">license</a> <b>|</b>
<a href="https://gitweb.torproject.org/torbutton.git/tree/src/CREDITS">credits</a> <b>]</b>
</div>
<!-- END MAINCOL -->
<div id = "sidecol">
@ -126,4 +59,3 @@
</div>
<!-- END CONTENT -->
#include <foot.wmi>

View File

@ -65,10 +65,7 @@
browse the Internet.</p>
</div>
</td>
<td>
<div class="project">
<a href="https://guardianproject.info/apps/orbot/"><img
src="$(IMGROOT)/icon-Orbot.jpg" alt="Orbot Icon"></a>
<td><meta name="description" content="The Tor Project's free software protects your privacy online. Site blocked? Email [mailto:gettor@torproject.org] for help downloading Tor Browser.">
<h3><a href="https://guardianproject.info/apps/orbot/">Orbot</a></h3>
<p>Tor for Google Android devices.</p>
</div>

View File

@ -14,7 +14,7 @@
<ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
<ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
# begin WML to generate css/js paths
# begin WML to generate css/js paths
<ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)">">
<ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.css">">
@ -29,17 +29,14 @@
<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.css">
<![endif]-->
# <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
# end WML to generate css/js paths
# end WML to generate css/js paths
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="The Tor Project, Inc.">
<meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
<script type="text/javascript" src="$(DOCROOT)/js/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="$(DOCROOT)/js/jquery.infieldlabel.min.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
/* email placeholder function */
$(function(){ $("label").replaceWith('<label class="active" for="email">Enter your email address</label>'); $("label").inFieldLabels(); });
</script>
<script type="text/javascript" src="$(DOCROOT)/js/functions.js" charset="utf-8"></script>
</head>
<body>
<div id="wrap">
@ -63,9 +60,9 @@
my $lang = "$(LANG)";
for my $key (@keys) {
my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
# in directory of active link, set class active
# in directory of active link, set class active
my $class;
if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
$class = 'class="active"';
@ -74,12 +71,12 @@
}
$dir = '.' unless defined $dir;
# translated version
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
}
}
# english version
elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
@ -108,14 +105,14 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml),
my $val = shift @calltoaction;
push @keys, $key;
$calltoaction{$key} = $val;
}
}
my $page = $WML_SRC_BASENAME;
my $lang = "$(LANG)";
for my $key (@keys) {
my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;
# in directory, set active
# in directory, set active
my $class;
if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
#if ($WML_SRC_BASENAME eq $base) {
@ -129,7 +126,7 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml),
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
}
}
# default to english version
elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
@ -137,7 +134,7 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml),
} else {
warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
}
}
}
}:>
</ul>
</div>

8
js/animate.js Normal file
View File

@ -0,0 +1,8 @@
document.addEventListener("DOMContentLoaded", function(event) {
var animate = document.getElementById("animate");
animate.classList.add("not-loaded");
window.setTimeout(function () {
animate.classList.remove("not-loaded");
animate.classList.add("loaded");
}, 0);
});

65
js/functions.js Normal file
View File

@ -0,0 +1,65 @@
$(function(){ $("label").replaceWith('<label class="active" for="email">Enter your email address</label>'); $("label").inFieldLabels(); });
function addSearchProvider(prov) {
try {
window.external.AddSearchProvider(prov);
}
catch (e) {
alert("Search plugins require Firefox 2");
return;
}
}
function addEngine(name,ext,cat,pid)
{
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
window.sidebar.addSearchEngine(
"http://mycroft.mozdev.org/install.php/" + pid + "/" + name + ".src",
"http://mycroft.mozdev.org/install.php/" + pid + "/" + name + "."+ ext, name, cat );
} else {
alert("You will need a browser which supports Sherlock to install this plugin.");
}
}
function addOpenSearch(name,ext,cat,pid,meth)
{
if ((typeof window.external == "object") && ((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function"))) {
if ((typeof window.external.AddSearchProvider == "unknown") && meth == "p") {
alert("This plugin uses POST which is not currently supported by Internet Explorer's implementation of OpenSearch.");
} else {
window.external.AddSearchProvider(
"http://mycroft.mozdev.org/installos.php/" + pid + "/" + name + ".xml");
}
} else {
alert("You will need a browser which supports OpenSearch to install this plugin.");
}
}
function addOpenSearch2(name,ext,cat,pid,meth)
{
if ((typeof window.external == "object") && ((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function"))) {
if ((typeof window.external.AddSearchProvider == "unknown") && meth == "p") {
alert("This plugin uses POST which is not currently supported by Internet Explorer's implementation of OpenSearch.");
} else {
window.external.AddSearchProvider(
"http://torbutton.torproject.org/dev/search/" + name + ".xml");
}
} else {
alert("You will need a browser which supports OpenSearch to install this plugin.");
}
}
function install (aEvent)
{
var params = {
"Torbutton": { URL: aEvent.target.href,
Hash: aEvent.target.getAttribute("hash"),
toString: function () { return this.URL; }
}
};
InstallTrigger.install(params);
return false;
}

View File

@ -12,18 +12,9 @@
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/easyXDM.min.js"></script>
<script type='text/javascript' src="js/modernizr.min.js"></script>
<script type='text/javascript' src="js/css3-mediaqueries.js"></script>
<script type="text/javascript">
<script type='text/javascript' src="js/css3-mediaqueries.js"></script>
<script type="text/javascript" src="js/animate.js"></script>
document.addEventListener("DOMContentLoaded", function(event) {
var animate = document.getElementById("animate");
animate.classList.add("not-loaded");
window.setTimeout(function () {
animate.classList.remove("not-loaded");
animate.classList.add("loaded");
}, 0);
});
</script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script type='text/javascript' src="js/html5.js"></script>
@ -71,8 +62,8 @@
<div class="mobile-banner visible-xs abs-centered">
<a href="https://NoGlobalWarrants.org" target="_blank"><img src="imgs/mobile_txt.png" class="img-responsive abs-centered" /></a>
</div>
<script type='text/javascript' src="js/main.js"></script>
<script type='text/javascript' src="js/main.js"></script>
</body>
</html>
</html>