Template:UCSF/Header

From 2010.igem.org

(Difference between revisions)
 
(16 intermediate revisions not shown)
Line 1: Line 1:
-
{{Template:UCSF/subnav}}
 
<html>
<html>
<style>
<style>
Line 7: Line 6:
}
}
#TOCC{
#TOCC{
-
//background-image:url(https://static.igem.org/mediawiki/2010/6/6b/Green-floral-long.png);
 
-
//background-repeat:no-repeat;
 
background-color:white;
background-color:white;
}
}
Line 14: Line 11:
margin-top:8px;
margin-top:8px;
}
}
-
 
#contentheader{
#contentheader{
color:grey;
color:grey;
Line 23: Line 19:
#innertoc{
#innertoc{
}
}
-
 
.indent{
.indent{
text-indent:8px;
text-indent:8px;
Line 34: Line 29:
margin-left:16px;
margin-left:16px;
}
}
-
 
.extraextraindent{
.extraextraindent{
text-indent:24px;
text-indent:24px;
Line 40: Line 34:
margin-left:24px;
margin-left:24px;
}
}
-
 
</style>
</style>
 +
<script>
<script>
<script>
function getElementsByTagNames(list,obj) {
function getElementsByTagNames(list,obj) {
Line 72: Line 66:
function createTOC() {
function createTOC() {
var y = document.createElement('div');
var y = document.createElement('div');
-
        IE = /*@cc_on!@*/false;
 
-
        if(IE==true){return y;}
 
y.id = 'innertoc';
y.id = 'innertoc';
         var a = document.createElement('a');
         var a = document.createElement('a');
Line 83: Line 75:
         z.id='tocDIV';
         z.id='tocDIV';
         var bodycon = document.getElementById('Main');
         var bodycon = document.getElementById('Main');
-
var toBeTOCced = getElementsByTagNames('h2,h3,h4,h5',bodycon);
+
var toBeTOCced = getElementsByTagNames('h3,h4,h5',bodycon);
if (toBeTOCced.length < 2) return false;
if (toBeTOCced.length < 2) return false;
for (var i=0;i<toBeTOCced.length;i++) {
for (var i=0;i<toBeTOCced.length;i++) {
var tmp = document.createElement('a');
var tmp = document.createElement('a');
-
                 var temp = toBeTOCced[i];
+
                 var reg = /<b>([^<]+)<\/b>/;
-
                var MW = temp.getElementsByClassName('mw-headline');
+
                 var str = toBeTOCced[i].innerHTML;
-
                if(!MW){MW = temp.getElementsByTagName('span');}
+
                 var result = reg.exec(str);
-
                var B = MW[0].getElementsByTagName('b');
+
tmp.innerHTML = result[1];
-
                 var result;
+
-
                if(B.length==0){
+
-
                result = MW[0].innerHTML;              
+
-
                 }
+
-
                else{result = B[0].innerHTML;}
+
-
                //alert(result);
+
-
tmp.innerHTML = result;
+
tmp.className = 'page';
tmp.className = 'page';
z.appendChild(tmp);
z.appendChild(tmp);
                 z.appendChild(document.createElement('br'));
                 z.appendChild(document.createElement('br'));
-
if (toBeTOCced[i].nodeName == 'H2'){
+
if (toBeTOCced[i].nodeName == 'H4')
-
                        tmp.style.color="black";
+
tmp.className += ' indent';
-
                        tmp.innerHTML="<b>"+tmp.innerHTML+"<\/b>"
+
if (toBeTOCced[i].nodeName == 'H5')
-
                }
+
-
                if (toBeTOCced[i].nodeName == 'H3'){
+
-
tmp.className += ' indent';  
+
-
                        tmp.style.color="black";
+
-
                }
+
-
if (toBeTOCced[i].nodeName == 'H4'){
+
tmp.className += ' extraindent';
tmp.className += ' extraindent';
-
                        tmp.style.color="grey";
+
var headerId = result[1];
-
                }
+
-
if (toBeTOCced[i].nodeName == 'H5'){
+
-
tmp.className += ' extraextraindent';
+
-
                }
+
-
var headerId = result;
+
tmp.href = '#' + headerId;
tmp.href = '#' + headerId;
toBeTOCced[i].id = headerId;
toBeTOCced[i].id = headerId;
 +
if (toBeTOCced[i].nodeName == 'H2') {
 +
tmp.innerHTML = 'Top';
 +
tmp.href = '#top';
 +
toBeTOCced[i].id = 'top';
 +
}
}
}
return y;
return y;
Line 134: Line 113:
</script>
</script>
-
 
-
 
<style>
<style>
body{
body{
background-color:#494d51;
background-color:#494d51;
-
//background-image:url(https://static.igem.org/mediawiki/2010/4/4c/Green-floral-big.png);
 
-
//background-repeat:no-repeat;
 
}
}
-
 
#content{
#content{
padding-right:10px;
padding-right:10px;
padding-left:10px;
padding-left:10px;
-
background-color:#AAAAAA;
+
background: #ECF4EA;
-
//background-image:url(https://static.igem.org/mediawiki/2010/4/4c/Green-floral-big.png);
+
-
//background-repeat:no-repeat;
+
}
}
-
 
h1{
h1{
font-weight:normal;
font-weight:normal;
Line 156: Line 127:
float:right;
float:right;
}
}
-
 
h2{
h2{
font-weight:normal;
font-weight:normal;
Line 162: Line 132:
text-indent: 10px;
text-indent: 10px;
}
}
-
 
p, pre{
p, pre{
margin-left:35px;
margin-left:35px;

Latest revision as of 09:47, 23 October 2010