Template:SUSTC-Shenzhen/themeJs

From 2014.igem.org

(Difference between revisions)
 
(21 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
<footer>
<footer>
-
     <script src="https://cdn.rawgit.com/HubSpot/pace/master/pace.min.js"></script>
+
     <script src="https://2014.igem.org/Team:SUSTC-Shenzhen/js/pace.min.js?action=raw&ctype=text/javascript"></script>
-
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
+
     <script src="//2014.igem.org/Team:SUSTC-Shenzhen/static/js/jquery.pjax.js?action=raw&ctype=text/javascript"></script>
     <script src="//2014.igem.org/Team:SUSTC-Shenzhen/static/js/jquery.pjax.js?action=raw&ctype=text/javascript"></script>
-
     <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
+
     <script src="https://2014.igem.org/Team:SUSTC-Shenzhen/js/bootstrap.min.js?action=raw&ctype=text/javascript"></script>
<script>
<script>
     $.pjax({
     $.pjax({
Line 19: Line 18:
         $("#nav-login-status")
         $("#nav-login-status")
           .text(wgUserName)
           .text(wgUserName)
-
           .attr("href","/User:" + wgUserName);
+
           .attr("href","https://igem.org/User_Information");
       } else {
       } else {
         $("#nav-login-status")
         $("#nav-login-status")
Line 46: Line 45:
    
    
   window.ga('create', 'UA-42690126-5', 'auto');
   window.ga('create', 'UA-42690126-5', 'auto');
 +
  window.ga('require', 'linkid', 'linkid.js');
 +
  window.ga('require', 'displayfeatures');
   window.ga('send', 'pageview');
   window.ga('send', 'pageview');
} else {
} else {
Line 53: Line 54:
   </script>
   </script>
   <script>
   <script>
-
   $('a[href*=#]:not([href=#])').not(".carousel-control").click(function() {
+
   $('#page-contents a').click(function() {
     console.log(this.hash);
     console.log(this.hash);
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')  
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')  
         || location.hostname == this.hostname) {
         || location.hostname == this.hostname) {
-
         var target = $(this.hash.replace(".","\\."));
+
         var target = $('[id="'+this.hash.substring(1)+'"]');
         target = target.length ? target : $('[name="' + this.hash.slice(1) +'"]');
         target = target.length ? target : $('[name="' + this.hash.slice(1) +'"]');
           if (target.length) {
           if (target.length) {
Line 68: Line 69:
     }
     }
   });
   });
-
   </script>
+
   $(document.body).scrollspy({
-
  <script>
+
      target: '.bs-docs-sidebar',
-
var toc_tbl = $("#toc")
+
      offset: 71
-
    .prop("id","table-contents")
+
    });
-
    .addClass("panel panel-primary")
+
  setTimeout(function () {
-
    .removeClass("toc")
+
      var $sideBar = $('.bs-docs-sidebar')
-
    .children()
+
-
      .clone();
+
-
       
+
-
+
-
$("#document-sidebar")
+
-
.children()
+
-
.remove()
+
-
.end()
+
-
.html(
+
-
'<div class="panel panel-default">' +
+
-
  '<div class="panel-heading">' +
+
-
    '<h3 class="panel-title">Contents</h3>' +
+
-
  '</div>' +
+
-
  '<div class="panel-body" id="toc-body">' +
+
-
    '' +
+
-
  '</div>' +
+
-
'</div>');
+
-
toc_tbl.appendTo("#toc-body");
+
      $sideBar.affix({
-
        $("#toctitle").remove();
+
        offset: {
 +
          top: function () {
 +
            var offsetTop      = $sideBar.offset().top
 +
            var sideBarMargin  = parseInt($sideBar.children(0).css('margin-top'), 10)
 +
            var navOuterHeight = $('#index-nav-main').height()
 +
 
 +
            return (this.top = offsetTop - navOuterHeight - sideBarMargin)
 +
          },
 +
          bottom: function () {
 +
            return (this.bottom = $('.bs-docs-footer').outerHeight(true))
 +
          }
 +
        }
 +
      })
 +
    }, 100)
   </script>
   </script>
 +
</footer>
</footer>
</html>
</html>

Latest revision as of 09:49, 17 October 2014