mirror of https://github.com/apache/lucene.git
Fix javascript indentation now that i figured out my emacs configs were previously broken
This commit is contained in:
parent
e53ce592ba
commit
a371cab3b6
|
@ -4,56 +4,56 @@ $('#mysidebar').height($(".nav").height());
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
|
||||||
//this script says, if the height of the viewport is greater than 800px, then insert affix class, which makes the nav bar float in a fixed
|
//this script says, if the height of the viewport is greater than 800px, then insert affix class, which makes the nav bar float in a fixed
|
||||||
// position as your scroll. if you have a lot of nav items, this height may not work for you.
|
// position as your scroll. if you have a lot of nav items, this height may not work for you.
|
||||||
// commented out...to add back, uncomment the next line, then the 3 after the "console.log" comment
|
// commented out...to add back, uncomment the next line, then the 3 after the "console.log" comment
|
||||||
//var h = $(window).height();
|
//var h = $(window).height();
|
||||||
//console.log (h);
|
//console.log (h);
|
||||||
//if (h > 800) {
|
//if (h > 800) {
|
||||||
// $( "#mysidebar" ).attr("class", "nav affix");
|
// $( "#mysidebar" ).attr("class", "nav affix");
|
||||||
// }
|
// }
|
||||||
// activate tooltips. although this is a bootstrap js function, it must be activated this way in your theme.
|
// activate tooltips. although this is a bootstrap js function, it must be activated this way in your theme.
|
||||||
$('[data-toggle="tooltip"]').tooltip({
|
$('[data-toggle="tooltip"]').tooltip({
|
||||||
placement : 'top'
|
placement : 'top'
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AnchorJS
|
* AnchorJS
|
||||||
*/
|
*/
|
||||||
anchors.add('h2,h3,h4,h5');
|
anchors.add('h2,h3,h4,h5');
|
||||||
|
|
||||||
// "Bootstrap Bootstrap"
|
// "Bootstrap Bootstrap"
|
||||||
// NOTE: by default, we use "dynamic-tabs" in our wrapper instead of "tab-content"
|
// NOTE: by default, we use "dynamic-tabs" in our wrapper instead of "tab-content"
|
||||||
// so that if javascript is disabled, bootstrap's CSS doesn't hide all non-active "tab-pane" divs
|
// so that if javascript is disabled, bootstrap's CSS doesn't hide all non-active "tab-pane" divs
|
||||||
$(".dynamic-tabs").each(function(ignored) {
|
$(".dynamic-tabs").each(function(ignored) {
|
||||||
$(this).addClass("tab-content");
|
$(this).addClass("tab-content");
|
||||||
var nav_ul = $("<ul>", { "class": "nav nav-pills" });
|
var nav_ul = $("<ul>", { "class": "nav nav-pills" });
|
||||||
$(".tab-pane", this).each(function(tab_index) {
|
$(".tab-pane", this).each(function(tab_index) {
|
||||||
var pill_li = $("<li>");
|
var pill_li = $("<li>");
|
||||||
// force the first tab to always be the active tab
|
// force the first tab to always be the active tab
|
||||||
if (0 == tab_index) {
|
if (0 == tab_index) {
|
||||||
$(this).addClass("active");
|
$(this).addClass("active");
|
||||||
pill_li.addClass("active");
|
pill_li.addClass("active");
|
||||||
} else {
|
} else {
|
||||||
// our validator should have prevented this, but remove them just in case
|
// our validator should have prevented this, but remove them just in case
|
||||||
$(this).removeClass("active");
|
$(this).removeClass("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
var pill_a = $("<a>", { "data-toggle" : "pill" } );
|
var pill_a = $("<a>", { "data-toggle" : "pill" } );
|
||||||
if ($(this)[0].hasAttribute("id")) {
|
if ($(this)[0].hasAttribute("id")) {
|
||||||
pill_a.attr("href", "#" + $(this).attr("id"));
|
pill_a.attr("href", "#" + $(this).attr("id"));
|
||||||
} else {
|
} else {
|
||||||
// our validator will complain if a tab-pane has no id, but if the user
|
// our validator will complain if a tab-pane has no id, but if the user
|
||||||
// views the resultin HTML, draw attention to it...
|
// views the resultin HTML, draw attention to it...
|
||||||
pill_a.append( " BAD TAB-PANE HAS NO ID ");
|
pill_a.append( " BAD TAB-PANE HAS NO ID ");
|
||||||
}
|
}
|
||||||
|
|
||||||
var label = $(".tab-label", this);
|
var label = $(".tab-label", this);
|
||||||
if (0==label.length) {
|
if (0==label.length) {
|
||||||
// our validator will complain if a tab-pane has no tab-label, but if the user
|
// our validator will complain if a tab-pane has no tab-label, but if the user
|
||||||
// views the resultin HTML, draw attention to it...
|
// views the resultin HTML, draw attention to it...
|
||||||
pill_a.append( " BAD TAB-PANE HAS NO TAB-LABEL ");
|
pill_a.append( " BAD TAB-PANE HAS NO TAB-LABEL ");
|
||||||
} else {
|
} else {
|
||||||
// NOTE: using the "inner" HTML of the label...
|
// NOTE: using the "inner" HTML of the label...
|
||||||
// so by default we can use "bold" (or whatever) in our asciidoc and have that
|
// so by default we can use "bold" (or whatever) in our asciidoc and have that
|
||||||
// be what people see in the PDF or when javascript is disabled,
|
// be what people see in the PDF or when javascript is disabled,
|
||||||
|
@ -61,43 +61,43 @@ $( document ).ready(function() {
|
||||||
pill_a.append( label.html() );
|
pill_a.append( label.html() );
|
||||||
// NOTE: Removing the label isn't strictly neccessary, but makes the pills/tabs less redundent
|
// NOTE: Removing the label isn't strictly neccessary, but makes the pills/tabs less redundent
|
||||||
label.remove();
|
label.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
pill_li.append(pill_a);
|
pill_li.append(pill_a);
|
||||||
nav_ul.append(pill_li);
|
nav_ul.append(pill_li);
|
||||||
});
|
});
|
||||||
$(this).before(nav_ul);
|
$(this).before(nav_ul);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// needed for nav tabs on pages. See Formatting > Nav tabs for more details.
|
// needed for nav tabs on pages. See Formatting > Nav tabs for more details.
|
||||||
// script from http://stackoverflow.com/questions/10523433/how-do-i-keep-the-current-tab-active-with-twitter-bootstrap-after-a-page-reload
|
// script from http://stackoverflow.com/questions/10523433/how-do-i-keep-the-current-tab-active-with-twitter-bootstrap-after-a-page-reload
|
||||||
$(function() {
|
$(function() {
|
||||||
var json, tabsState;
|
var json, tabsState;
|
||||||
$('a[data-toggle="pill"], a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
|
$('a[data-toggle="pill"], a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
|
||||||
var href, json, parentId, tabsState;
|
var href, json, parentId, tabsState;
|
||||||
|
|
||||||
tabsState = localStorage.getItem("tabs-state");
|
|
||||||
json = JSON.parse(tabsState || "{}");
|
|
||||||
parentId = $(e.target).parents("ul.nav.nav-pills, ul.nav.nav-tabs").attr("id");
|
|
||||||
href = $(e.target).attr('href');
|
|
||||||
json[parentId] = href;
|
|
||||||
|
|
||||||
return localStorage.setItem("tabs-state", JSON.stringify(json));
|
|
||||||
});
|
|
||||||
|
|
||||||
tabsState = localStorage.getItem("tabs-state");
|
tabsState = localStorage.getItem("tabs-state");
|
||||||
json = JSON.parse(tabsState || "{}");
|
json = JSON.parse(tabsState || "{}");
|
||||||
|
parentId = $(e.target).parents("ul.nav.nav-pills, ul.nav.nav-tabs").attr("id");
|
||||||
|
href = $(e.target).attr('href');
|
||||||
|
json[parentId] = href;
|
||||||
|
|
||||||
$.each(json, function(containerId, href) {
|
return localStorage.setItem("tabs-state", JSON.stringify(json));
|
||||||
return $("#" + containerId + " a[href=" + href + "]").tab('show');
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$("ul.nav.nav-pills, ul.nav.nav-tabs").each(function() {
|
tabsState = localStorage.getItem("tabs-state");
|
||||||
var $this = $(this);
|
json = JSON.parse(tabsState || "{}");
|
||||||
if (!json[$this.attr("id")]) {
|
|
||||||
return $this.find("a[data-toggle=tab]:first, a[data-toggle=pill]:first").tab("show");
|
$.each(json, function(containerId, href) {
|
||||||
}
|
return $("#" + containerId + " a[href=" + href + "]").tab('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("ul.nav.nav-pills, ul.nav.nav-tabs").each(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
if (!json[$this.attr("id")]) {
|
||||||
|
return $this.find("a[data-toggle=tab]:first, a[data-toggle=pill]:first").tab("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue