Browse Source

ridiculous monkeying around Timeline's own jquery loading so that links to FAQ entries go to them

pull/672/merge
Joe Germuska 10 years ago
parent
commit
e121e47dd1
  1. 27
      website/static/js/main.js
  2. 1
      website/templates/base.html

27
website/static/js/main.js

@ -1,14 +1,21 @@
$(document).ready(function() { // overcome Timeline's stupid jQuery loading
var $blueline = $.noConflict();
$blueline(document).ready(function() {
var $ = $blueline;
function navSmartScroll($destination) {
var offset = $(".navbar").height() || 0,
scrollTop = $destination.offset().top - 30;
$("body,html").animate({scrollTop: scrollTop}, 350);
}
// Navbar scrollTo // Navbar scrollTo
$(".navbar .nav a, [data-scroll='true']").click(function (e) { $(".navbar .nav a, [data-scroll='true']").click(function (e) {
var $target = $(this) var $target = $(this)
, href = $target.attr("href") , href = $target.attr("href")
, hash = href.substring(href.lastIndexOf('/') + 1) , hash = href.substring(href.lastIndexOf('/') + 1)
, $destination = $(hash) , $destination = $(hash);
, offset = $(".navbar").height() || 0
, scrollTop = $destination.offset().top - 30;
$("body,html").animate({scrollTop: scrollTop}, 350); navSmartScroll($destination);
return false; return false;
}); });
@ -50,4 +57,14 @@ $(document).ready(function() {
$('#embed-startatslide').change(function(evt) { updateEmbedCode(evt); }); $('#embed-startatslide').change(function(evt) { updateEmbedCode(evt); });
$('#embed-startzoomadjust').change(function(evt) { updateEmbedCode(evt); }); $('#embed-startzoomadjust').change(function(evt) { updateEmbedCode(evt); });
$('#embed-debug').change(function(evt) { updateEmbedCode(evt); }); $('#embed-debug').change(function(evt) { updateEmbedCode(evt); });
$('.collapse').on('show',function(e) {
window.location.hash = "show-" + $(this).attr('id');
})
if (window.location.hash.match(/#show-/)) {
var $target = $("#" + window.location.hash.substr(6));
$target.collapse('show');
navSmartScroll($target.prev());
}
}); });

1
website/templates/base.html

@ -139,6 +139,7 @@
{% block scripts %} {% block scripts %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://cdn.knightlab.com/libs/blueline/latest/js/blueline.min.js"></script> <script src="http://cdn.knightlab.com/libs/blueline/latest/js/blueline.min.js"></script>
<!-- Override --> <!-- Override -->
<script type="text/javascript"> <script type="text/javascript">
var generator_embed_path = "http://cdn.knightlab.com/libs/timeline/latest/embed/index.html"; var generator_embed_path = "http://cdn.knightlab.com/libs/timeline/latest/embed/index.html";

Loading…
Cancel
Save