Team:Warsaw/JSTest

From 2008.igem.org

(Difference between revisions)
 
(139 intermediate revisions not shown)
Line 1: Line 1:
{{WarHead}}
{{WarHead}}
<html>
<html>
-
<style>
 
-
#lightbox{ position: absolute; left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
 
-
#lightbox img{ width: auto; height: auto;}
 
-
#lightbox a img{ border: none; }
 
-
#outerImageContainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; }
+
<h1 id="title"></h1>
-
#imageContainer{ padding: 10px; }
+
<div id="merg"></div>
-
#loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
 
-
#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
 
-
#imageContainer>#hoverNav{ left: 0;}
 
-
#hoverNav a{ outline: none;}
 
-
#prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
 
-
#prevLink { left: 0; float: left;}
 
-
#nextLink { right: 0; float: right;}
 
-
#prevLink:hover, #prevLink:visited:hover { background: url('https://static.igem.org/mediawiki/2008/4/4d/Prevlabel.gif') left 15% no-repeat; }
 
-
#nextLink:hover, #nextLink:visited:hover { background: url('https://static.igem.org/mediawiki/2008/8/82/Nextlabel.gif') right 15% no-repeat; }
 
-
#imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }
+
<script type="text/javascript">
-
#imageData{ padding:0 10px; color: #666; }
 
-
#imageData #imageDetails{ width: 70%; float: left; text-align: left; }
 
-
#imageData #caption{ font-weight: bold; }
 
-
#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
 
-
#imageData #bottomNavClose{ width: 66px; float: right;  padding-bottom: 0.7em; outline: none;}
 
-
#overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
+
/* <![CDATA[ */
 +
/* Client-side access to querystring name=value pairs
 +
Version 1.3
 +
28 May 2008
 +
 +
License (Simplified BSD):
 +
http://adamv.com/dev/javascript/qslicense.txt
 +
*/
 +
function Querystring(qs) { // optionally pass a querystring to parse
 +
this.params = {};
 +
 +
if (qs == null) qs = location.search.substring(1, location.search.length);
 +
if (qs.length == 0) return;
-
</style>
+
// Turn <plus> back to <space>
 +
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
 +
qs = qs.replace(/\+/g, ' ');
 +
var args = qs.split(String.fromCharCode(38)); // parse out name/value pairs separated via &
 +
 +
// split out each name=value pair
 +
for (var i = 0; i < args.length; i++) {
 +
var pair = args[i].split('=');
 +
var name = decodeURIComponent(pair[0]);
 +
 +
var value = (pair.length==2)
 +
? decodeURIComponent(pair[1])
 +
: name;
 +
 +
this.params[name] = value;
 +
}
 +
}
 +
 
 +
Querystring.prototype.get = function(key, default_) {
 +
var value = this.params[key];
 +
return (value != null) ? value : default_;
 +
}
 +
 
 +
Querystring.prototype.contains = function(key) {
 +
var value = this.params[key];
 +
return (value != null);
 +
}
 +
 
 +
 
 +
 
 +
Array.prototype.indexOf = function( v, b, s ) {
 +
for( var i = +b || 0, l = this.length; i < l; i++ ) {
 +
  if( this[i]===v || s ) if ( this[i]==v ) { return i; }
 +
}
 +
return -1;
 +
};
 +
 
 +
function and(cond1,cond2)
 +
{
 +
if (cond1==true) if (cond2==true) return true;
 +
return false;
 +
}
 +
 
 +
function removeHTMLTags(strInputCode2 ){
 +
                var strInputCode=new String();
 +
                strInputCode=strInputCode2;
 +
                //if (strInputCode==undefined) return;
 +
/*
 +
                strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
 +
return (p1 == "lt")? "<" : ">";
 +
});
 +
                */
 +
                strInputCode = strInputCode.replace(/&(lt);/g,"<");
 +
                strInputCode = strInputCode.replace(/&(gt);/g,">");
 +
var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
 +
return strTagStrippedText;
 +
 +
}
 +
 
 +
var months=['January','February','March','April','May','June','July','August','September','October','November','December'];
 +
 
 +
var adresbase='https://2008.igem.org/Team:Warsaw/Calendar-Main/';
 +
 
 +
function merge(days)
 +
{
 +
document.getElementById("title").innerHTML=removeHTMLTags(title);
 +
 
 +
 
 +
for (var i=0;i<days.length;i++)
 +
{
 +
var div=document.createElement("div");
 +
var h=document.createElement("h3");
 +
h.innerHTML='<a href="'+adresbase+days[i]+'">'+days[i]+'</a>&nbsp;<div align="right"><a href="https://2008.igem.org/wiki/index.php?title=Team:Warsaw/Calendar-Main/'+days[i]+String.fromCharCode(38)+'action=edit">'+"[Edit]"+'</a></div>';
 +
div.setAttribute("id",days[i]);
 +
document.getElementById("merg").appendChild(h);
 +
document.getElementById("merg").appendChild(div);
 +
fill(days[i]);
 +
 
 +
}
 +
}
 +
 
 +
function fill(day)
 +
{
 +
if (window.XMLHttpRequest) { // Mozilla, Safari, Opera ...
 +
  var req = new XMLHttpRequest();
 +
} else if (window.ActiveXObject) { // IE
 +
  var req = new ActiveXObject("Microsoft.XMLHTTP");
 +
}
 +
var ans;
 +
if (window.overrideMimeType) req.overrideMimeType('text/xml');
 +
req.onreadystatechange = function() { //początek wewnętrznej funkcji
 +
if (req.readyState == 4) {
 +
            if (req.status == 200) {
 +
                ans=req.responseText;
 +
                ans=ans.substr(ans.search("<start>"),ans.search("<end>")-ans.search("<start>"));
 +
                document.getElementById(day).innerHTML=trimStr(trimContents(ans,title));
 +
            }
 +
}
 +
 
 +
}; //koniec wewnętrznej funkcji
 +
 
 +
req.open('GET', adresbase+day, true);
 +
req.send(null);
 +
}
 +
 
 +
function trimStr(str)
 +
{
 +
return str.replace(/^\s+|\s+$/g, '');
 +
}
 +
 
 +
function trimContents(ans, title)
 +
{
 +
ans=ans.replace(/<h3><\/h3>/ig,"");
 +
h3=new RegExp(/<h3.*>(.*)<\/h3>/ig);
 +
title=removeHTMLTags(trimStr(title));
 +
 
 +
var titles=ans.match(h3);
 +
for (var i=0;i<titles.length;i++)
 +
{
 +
if (titles[i].search("h3")>0)
 +
{
 +
//alert(titles[i].split(/(<h3>)|(<\/h3>)/i));
 +
var notags=titles[i].split(/(<h3>)|(<\/h3>)/i);
 +
if (notags[3]==undefined) var currtitle=removeHTMLTags(notags[0]);  //dirty IE hack
 +
else var currtitle=removeHTMLTags(notags[3]);
 +
currtitle=trimStr(currtitle.replace(/\+/g,' '));
 +
//alert ("C: "+currtitle+"\nT: "+title);
 +
if (currtitle==title)
 +
{
 +
if (i+1<titles.length) return ans.substring(ans.indexOf(titles[i])+titles[i].length,ans.indexOf(titles[i+1]));
 +
else return ans.substring(ans.indexOf(titles[i])+titles[i].length);
 +
}
 +
}
 +
}
 +
 
 +
 
 +
return "Search Error";
 +
 
 +
}
 +
 
 +
var qs=new Querystring();
 +
 
 +
var title=qs.get("name");
 +
var num=parseInt(qs.get("num", "0"));
 +
var tgt=new Array(num);
 +
for (var i=0;i<num;i++)
 +
{
 +
tgt[i]=qs.get("arg"+i);
 +
}
 +
 
 +
 
 +
 
 +
if (tgt.length>0) merge(tgt);
 +
 
 +
 
 +
/* ]]> */</script>
-
<script language="JavaScript" src="http://www.lokeshdhakar.com/projects/lightbox2/js/prototype.js"></script>
 
-
<script type="text/javascript" src="http://www.huddletogether.com/projects/lightbox2/js/scriptaculous.js?load=effects,builder"></script>
 
-
<script type="text/javascript" src="http://www.huddletogether.com/projects/lightbox2/js/lightbox.js"></script>
 
-
 
-
<script language="JavaScript">
 
-
LightboxOptions.fileLoadingImage="https://static.igem.org/mediawiki/2008/4/42/Loading.gif";
 
-
LightboxOptions.fileBottomNavCloseImage="https://static.igem.org/mediawiki/2008/8/8e/Closelabel.gif";
 
-
</script>
 
-
<a href="https://static.igem.org/mediawiki/2008/a/a0/Egipt2.jpg" rel="lightbox[roadtrip]" title="Egipt">image #1</a>
 
-
<a href="https://static.igem.org/mediawiki/2008/7/75/Wir.jpg" rel="lightbox[roadtrip]" title="What Microbiologists do?">image #1</a>
 
-
<a href="https://static.igem.org/mediawiki/2008/b/b2/Chemotransformacja.jpg" rel="lightbox[roadtrip]" title="Chemotransformation">image #1</a>
 
</html>
</html>
{{WarNotebookEnd}}
{{WarNotebookEnd}}

Latest revision as of 18:40, 28 October 2008

Gallery Bricks Notebook Team Project Home