Template:Amplino

From 2012e.igem.org

(Difference between revisions)
 
(44 intermediate revisions not shown)
Line 12: Line 12:
<!-- Scripting - START /-->
<!-- Scripting - START /-->
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js"></script>
-
<script type="text/javascript" src="http://github.com/cowboy/jquery-hashchange/raw/v1.3/jquery.ba-hashchange.js"></script>
+
<script type="text/javascript" src="http://github.com/cowboy/jquery-hashchange/raw/v1.3/jquery.ba-hashchange.js">
 +
</script>
 +
<script src="http://tweet.seaofclouds.com/jquery.tweet.js"></script>
 +
<link href='http://fonts.googleapis.com/css?family=Days+One' rel='stylesheet' type='text/css'>
<script>
<script>
 +
//Global Vars
 +
var currentPage;
 +
var in_frame_test = 1;
 +
var ampersandStr = String.fromCharCode(38);
 +
var loading_home = false;
 +
 +
function dbgout(msg) {
 +
  var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
 +
  if(is_chrome) console.log(msg);
 +
}
 +
$(document).ready(function() {
$(document).ready(function() {
 +
 +
//Move iGEM default content blocks
$('#search-controls').appendTo('#search-form');
$('#search-controls').appendTo('#search-form');
$('#menubar').appendTo('#user-menu');
$('#menubar').appendTo('#user-menu');
 +
$('.right-menu').appendTo('#igem-links');
 +
$("#igem-links .right-menu").attr("id","account-links");
 +
$("#account-links").attr("class","no-class");
 +
 +
// Initialize history plugin.
 +
$(window).hashchange(historyCallback);
 +
//rewriteLinks($("#navlist"));
 +
 +
historyCallback();
 +
});
});
 +
 +
function isDefined(variable)
 +
{
 +
    return typeof(window[variable]) != "undefined";
 +
}
 +
 +
function splitHash(hash) {
 +
var kvpairs = hash.split(ampersandStr);
 +
var i;
 +
var kvmap = {};
 +
for(i=0;i<kvpairs.length;i++) {
 +
var s = kvpairs[i].split('=');
 +
kvmap[s[0]] = s[1];
 +
}
 +
return kvmap;
 +
}
 +
 +
function makeHash(page, kvmap) {
 +
var str = '#page=' + page;
 +
var i;
 +
if (kvmap) {
 +
for(i in kvmap) {
 +
str += ampersandStr + i + '=' + kvmap[i];
 +
}
 +
}
 +
return str; 
 +
}
 +
 +
function setHash(page, kvmap) {
 +
location.hash = makeHash(page,kvmap);
 +
}
 +
 +
 +
function include_js(file, cb) {
 +
var html_doc = document.getElementsByTagName('head')[0];
 +
var js = document.createElement('script');
 +
js.setAttribute('type', 'text/javascript');
 +
js.setAttribute('src', file);
 +
html_doc.appendChild(js);
 +
 +
js.onreadystatechange = function () {
 +
if (js.readyState == 'complete')
 +
cb();
 +
}
 +
 +
js.onload = cb;
 +
}
 +
 +
function loadScript(src, callback)
 +
{
 +
  include_js(src, callback);
 +
}
 +
 +
function moveToAnchor(anchor) {
 +
try {
 +
var pos = $('#Amplino-container > a[name='+anchor+']').offset();
 +
dbgout('anchor: '+anchor+';  pos=' + pos.left + ','+pos.top );
 +
window.scroll(pos.left, pos.top);
 +
} catch (err) {
 +
dbgout('moveToAnchor error: ' + err);
 +
}
 +
}
 +
 +
function updateContentEditLink() {
 +
if (!wgUserName) {
 +
return;
 +
}
 +
 +
var page = currentPage ? currentPage : 'Home';
 +
var url = location.pathname + '/' + page + '?action=edit';
 +
$("#menubar ul li:nth-child(3) a").attr('href', url);
 +
 +
 +
var url = location.pathname + '/' + page;
 +
$("#menubar ul li:nth-child(1) a").attr('href', url);
 +
var url = location.pathname + '/' + page + '?action=history';
 +
$("#menubar ul li:nth-child(4) a").attr('href', url);
 +
var url = location.pathname + '/' + page + '?action=watch';
 +
$("#menubar ul li:nth-child(6) a").attr('href', url);
 +
$("#menubar ul li:nth-child(2)").css('display','none');
 +
$("#menubar ul li:nth-child(5)").css('display','none');
 +
}
 +
 +
function loadPage(page, anchor)
 +
{
 +
var showLoadAnim = !!currentPage;
 +
currentPage = page;
 +
var url = wgServer + "/Team:Amplino/" + page + "?action=render";
 +
if(page.substring(0, 5) == "User:") {
 +
url = wgServer + "/" + page + "?action=render";
 +
}
 +
$(window).trigger('page_close');
 +
 +
if(showLoadAnim) {
 +
$("#Amplino-loader").show();
 +
$("#Amplino-container").fadeTo(200,0.25);
 +
$('html, body').animate({scrollTop:0}, 'slow');
 +
}
 +
loading_home = false;
 +
 +
var processPage = function(next) {
 +
dbgout('processPage: ' + page);
 +
$(window).trigger('page_init');
 +
rewriteLinks($("#Amplino-container"));
 +
updateContentEditLink();
 +
$("#Amplino-container").fadeTo(200,1).delay(200).queue(function(n) {
 +
if(anchor) moveToAnchor(anchor); n();
 +
});
 +
next();
 +
}
 +
 +
$.get(url, function(data) {
 +
$("#Amplino-container").html(data).queue(processPage);
 +
//buildBreadCrumbTrail(page);
 +
//Cufon.replace('h2'); // Works without a selector engine
 +
//Cufon.replace('h3'); // Works without a selector engine
 +
//Cufon.replace('#sub1'); // Requires a selector engine for IE 6-7, see above
 +
//$("tr:nth-child(odd)").addClass("odd");
 +
 +
$("#Amplino-loader").hide();
 +
//$("#loading-overlay").hide();
 +
});
 +
}
 +
 +
function historyCallback() {
 +
var hash = location.hash;
 +
if(hash) {
 +
hash = hash.substring(1);
 +
if(hash.split('=').length > 1) {
 +
var kvmap = splitHash(hash);
 +
var changepage;
 +
 +
// looks a little clumsy, but js AND operator conflicts with mediawiki markup
 +
if (kvmap.page) if(kvmap.page != currentPage) changepage = kvmap.page;
 +
 +
if (changepage) {
 +
loadPage(changepage, kvmap.anchor);
 +
} else {
 +
if(kvmap.anchor) moveToAnchor(kvmap.anchor);
 +
$(window).trigger('hashupdate');
 +
}
 +
}
 +
} else {
 +
setHash('Home');
 +
}
 +
}
 +
 +
function rewriteLinks(elem) {
 +
$("a",elem).each(function() {
 +
var txt = $(this).text();
 +
var url = this.href;
 +
 +
if(this.hash) {
 +
var anchor = this.hash.substring(1);
 +
 +
if (anchor.substring(0,5)!='page=')
 +
this.href = '#page=' + currentPage + ampersandStr + 'anchor=' + anchor;
 +
} else if(txt != "edit") {
 +
this.href = this.href.replace("https://2012e.igem.org/wiki/index.php/Team:Amplino/", "#page=");
 +
}
 +
 +
// dbgout('rewriting ' + url + ' to ' + this.href);
 +
});
 +
}
 +
</script>
</script>
Line 49: Line 240:
/* Amplino Styles */
/* Amplino Styles */
 +
 +
h2, h3, h4 {
 +
font-family: 'Days One', sans-serif;
 +
}
#floatingbar {
#floatingbar {
Line 141: Line 336:
height: 40px;
height: 40px;
background-color: transparent;
background-color: transparent;
-
text-align: center;
+
text-align: right;
z-index: 3;
z-index: 3;
-
margin-height: 10px;
+
margin-top: 10px;
}
}
 +
 +
#searchGoButton, #mw-searchButton {
 +
color: #DDD;
 +
}
 +
 +
#Amplino-loader {
 +
z-index: 100;
 +
position: absolute;
 +
left: 0px;
 +
top: 0px;
 +
width: 100%;
 +
height: 100%;
 +
display:none;
 +
}
 +
 +
#Amplino-loading-panel-logo {
 +
margin: 0 auto;
 +
margin-top: 250px;
 +
}
 +
 +
#Amplino-container {
 +
min-height: 400px;
 +
}
 +
 +
#igem-links {
 +
position: fixed;
 +
top: 0;
 +
right: 5px;
 +
z-index: 1000;
 +
font-size: 10px;
 +
}
 +
 +
#account-links ul {
 +
list-style: none;
 +
}
 +
 +
#account-links li {
 +
display: block;
 +
clear: both;
 +
float: right;
 +
}
 +
 +
#account-links li a.new, #account-links li a {
 +
color: #fff;
 +
}
 +
 +
#account-links li a.new:visited, #account-links li a:visited {
 +
color: #fff;
 +
}
 +
</style>
</style>
 +
 +
<div id="igem-links">
 +
 +
</div>
<div id="floatingbar">
<div id="floatingbar">
<div id="floatingbar-content">
<div id="floatingbar-content">
-
<h1><a href="https://2012e.igem.org/Team:Amplino"><img src="https://static.igem.org/mediawiki/2012e/7/7c/AMPLINO-logo-igem-small.png" alt="Amplino iGEM Entrepreneurship Team Wiki" /></a></h1>
+
<h1><a href="https://2012e.igem.org/Team:Amplino#page=Home"><img src="https://static.igem.org/mediawiki/2012e/7/7c/AMPLINO-logo-igem-small.png" alt="Amplino iGEM Entrepreneurship Team Wiki" /></a></h1>
<div id="menu">
<div id="menu">
<ul>
<ul>
-
<li><a href="#">Team</a></li>
+
<li><a href="#page=Team">Team</a></li>
-
<li><a href="#">Summary</a></li>
+
<li><a href="#page=Summary">Summary</a></li>
-
<li><a href="#">Problem</a></li>
+
<li><a href="#page=Problem">Problem</a></li>
-
<li><a href="#">Opportunity</a></li>
+
<!-- <li><a href="#page=Opportunity">Opportunity</a></li> -->
-
<li><a href="#">Solution</a></li>
+
<li><a href="#page=Solution">Solution</a></li>
-
<li><a href="#">Source Data</a></li>
+
<li><a href="#page=Source_Data">Source Data</a></li>
-
<li><a href="#">Attributions</a></li>
+
<li><a href="#page=Attributions">Attributions</a></li>
 +
<li><a href="#page=Safety">Safety</a></li>
</ul>
</ul>
</div>
</div>
Line 170: Line 420:
</div>
</div>
</div>
</div>
 +
 +
<div id="Amplino-loader">
 +
<div id="Amplino-loading-panel-logo">
 +
<!-- yes im using center -->
 +
<center> <h2>Loading...</h2></center>
 +
</div>
 +
</div>
 +
 +
<div id="Amplino-container">
 +
</div>
 +
</html>
</html>

Latest revision as of 11:14, 21 October 2012