Difference between revisions of "Team:Czech Republic/Template:Scripts"

 
(9 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
   ga('send', 'pageview');
 
   ga('send', 'pageview');
  
</script>
 
 
<script>
 
window.onload = function favicon()
 
{
 
var link = document.createElement('link');
 
    link.type = 'image/x-icon';
 
    link.rel = 'shortcut icon';
 
    link.href = 'https://static.igem.org/mediawiki/2015/3/34/Czech_Republic_favicon.png';
 
    document.getElementsByTagName('head')[0].appendChild(link);
 
}
 
 
</script>
 
</script>
  
Line 35: Line 24:
 
<script>
 
<script>
 
window.onload = function(){
 
window.onload = function(){
        window.document.body.onload = doThis; // note removed parentheses
+
    var link = document.createElement('link');
};
+
    link.type = 'image/x-icon';
 
+
    link.rel = 'shortcut icon';
function doThis()
+
    link.href = 'https://static.igem.org/mediawiki/2015/3/34/Czech_Republic_favicon.png';
{
+
    document.getElementsByTagName('head')[0].appendChild(link);
var paragraphs = document.getElementsByTagName("p");  
+
    var paragraphs = document.getElementsByTagName("p");  
for (var i = 0, len = paragraphs.length; i < len; i++) {
+
    var len = paragraphs.length;
     var elem = paragraphs[i];
+
    for (var i = 0; i < len; i++)  
    if (elem.innerHTML == '<br>') {
+
     {
 +
        var elem = paragraphs[i];
 +
        if (elem.innerHTML.trim() == '<br>')
 +
        {
 +
            elem.parentNode.removeChild(elem);
 +
            i--;
 +
            len--;
 +
            continue;
 +
        }
 +
        if (elem.innerHTML.trim() == '')
 +
        {
 +
            elem.parentNode.removeChild(elem);
 +
            i--;
 +
            len--;
 +
            continue;
 +
        }
 +
    }
 +
    var brs = document.getElementById("main-div").getElementsByTagName("br");
 +
    var len = brs.length;
 +
    for (var i = 0; i < len; i++)
 +
    {
 +
        var elem = brs[i];
 
         elem.parentNode.removeChild(elem);
 
         elem.parentNode.removeChild(elem);
 
         i--;
 
         i--;
 
         len--;
 
         len--;
 +
        continue;
 
     }
 
     }
}
+
    paragraphs[paragraphs.length - 1].parentNode.removeChild(paragraphs[paragraphs.length - 1]);
 
}
 
}
 
</script>
 
</script>

Latest revision as of 16:24, 15 September 2015