diff --git a/setup/theme-bigblow-local.setup b/setup/theme-bigblow-local.setup index a38e86f..2488692 100755 --- a/setup/theme-bigblow-local.setup +++ b/setup/theme-bigblow-local.setup @@ -12,3 +12,4 @@ #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: +#+HTML_HEAD: diff --git a/setup/theme-bigblow.setup b/setup/theme-bigblow.setup index c61c079..fae5956 100755 --- a/setup/theme-bigblow.setup +++ b/setup/theme-bigblow.setup @@ -12,3 +12,4 @@ #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: +#+HTML_HEAD: diff --git a/setup/theme-readtheorg-local.setup b/setup/theme-readtheorg-local.setup index bffcf4d..9bcde25 100755 --- a/setup/theme-readtheorg-local.setup +++ b/setup/theme-readtheorg-local.setup @@ -5,4 +5,6 @@ #+HTML_HEAD: #+HTML_HEAD: +#+HTML_HEAD: + #+HTML_HEAD: diff --git a/setup/theme-readtheorg.setup b/setup/theme-readtheorg.setup index 01c6a2d..b201fae 100755 --- a/setup/theme-readtheorg.setup +++ b/setup/theme-readtheorg.setup @@ -5,4 +5,5 @@ #+HTML_HEAD: #+HTML_HEAD: +#+HTML_HEAD: #+HTML_HEAD: diff --git a/styles/bigblow/js/bigblow.js b/styles/bigblow/js/bigblow.js index 2cf302c..58f22d9 100755 --- a/styles/bigblow/js/bigblow.js +++ b/styles/bigblow/js/bigblow.js @@ -178,6 +178,9 @@ $(document).ready(function() { // Initialize hideShow hsInit(); + + // add sticky headers to tables + $('table').stickyTableHeaders(); }); function copyToClipboard(text) diff --git a/styles/lib/js/jquery.stickytableheaders.min.js b/styles/lib/js/jquery.stickytableheaders.min.js new file mode 100644 index 0000000..6c17ea4 --- /dev/null +++ b/styles/lib/js/jquery.stickytableheaders.min.js @@ -0,0 +1 @@ +!function(a,b){"use strict";function c(c,g){var h=this;h.$el=a(c),h.el=c,h.id=e++,h.$window=a(b),h.$document=a(document),h.$el.bind("destroyed",a.proxy(h.teardown,h)),h.$clonedHeader=null,h.$originalHeader=null,h.isSticky=!1,h.hasBeenSticky=!1,h.leftOffset=null,h.topOffset=null,h.init=function(){h.$el.each(function(){var b=a(this);b.css("padding",0),h.$originalHeader=a("thead:first",this),h.$clonedHeader=h.$originalHeader.clone(),b.trigger("clonedHeader."+d,[h.$clonedHeader]),h.$clonedHeader.addClass("tableFloatingHeader"),h.$clonedHeader.css("display","none"),h.$originalHeader.addClass("tableFloatingHeaderOriginal"),h.$originalHeader.after(h.$clonedHeader),h.$printStyle=a(''),a("head").append(h.$printStyle)}),h.setOptions(g),h.updateWidth(),h.toggleHeaders(),h.bind()},h.destroy=function(){h.$el.unbind("destroyed",h.teardown),h.teardown()},h.teardown=function(){h.isSticky&&h.$originalHeader.css("position","static"),a.removeData(h.el,"plugin_"+d),h.unbind(),h.$clonedHeader.remove(),h.$originalHeader.removeClass("tableFloatingHeaderOriginal"),h.$originalHeader.css("visibility","visible"),h.$printStyle.remove(),h.el=null,h.$el=null},h.bind=function(){h.$scrollableArea.on("scroll."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.on("scroll."+d+h.id,h.setPositionValues),h.$window.on("resize."+d+h.id,h.toggleHeaders)),h.$scrollableArea.on("resize."+d,h.toggleHeaders),h.$scrollableArea.on("resize."+d,h.updateWidth)},h.unbind=function(){h.$scrollableArea.off("."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.off("."+d+h.id,h.setPositionValues),h.$window.off("."+d+h.id,h.toggleHeaders)),h.$scrollableArea.off("."+d,h.updateWidth)},h.toggleHeaders=function(){h.$el&&h.$el.each(function(){var b,c=a(this),d=h.isWindowScrolling?isNaN(h.options.fixedOffset)?h.options.fixedOffset.outerHeight():h.options.fixedOffset:h.$scrollableArea.offset().top+(isNaN(h.options.fixedOffset)?0:h.options.fixedOffset),e=c.offset(),f=h.$scrollableArea.scrollTop()+d,g=h.$scrollableArea.scrollLeft(),i=h.isWindowScrolling?f>e.top:d>e.top,j=(h.isWindowScrolling?f:0)a||a+h.$window.height()>h.$document.height()||0>b||b+h.$window.width()>h.$document.width()||h.$originalHeader.css({top:h.topOffset-(h.isWindowScrolling?0:a),left:h.leftOffset-(h.isWindowScrolling?0:b)})},h.updateWidth=function(){if(h.isSticky){h.$originalHeaderCells||(h.$originalHeaderCells=a("th,td",h.$originalHeader)),h.$clonedHeaderCells||(h.$clonedHeaderCells=a("th,td",h.$clonedHeader));var b=h.getWidth(h.$clonedHeaderCells);h.setWidth(b,h.$clonedHeaderCells,h.$originalHeaderCells),h.$originalHeader.css("width",h.$clonedHeader.width())}},h.getWidth=function(c){var d=[];return c.each(function(c){var e,f=a(this);if("border-box"===f.css("box-sizing"))e=f[0].getBoundingClientRect().width;else{var g=a("th",h.$originalHeader);if("collapse"===g.css("border-collapse"))if(b.getComputedStyle)e=parseFloat(b.getComputedStyle(this,null).width);else{var i=parseFloat(f.css("padding-left")),j=parseFloat(f.css("padding-right")),k=parseFloat(f.css("border-width"));e=f.outerWidth()-i-j-k}else e=f.width()}d[c]=e}),d},h.setWidth=function(a,b,c){b.each(function(b){var d=a[b];c.eq(b).css({"min-width":d,"max-width":d})})},h.resetWidth=function(b,c){b.each(function(b){var d=a(this);c.eq(b).css({"min-width":d.css("min-width"),"max-width":d.css("max-width")})})},h.setOptions=function(c){h.options=a.extend({},f,c),h.$scrollableArea=a(h.options.scrollableArea),h.isWindowScrolling=h.$scrollableArea[0]===b},h.updateOptions=function(a){h.setOptions(a),h.unbind(),h.bind(),h.updateWidth(),h.toggleHeaders()},h.init()}var d="stickyTableHeaders",e=0,f={fixedOffset:0,leftOffset:0,marginTop:0,scrollableArea:b};a.fn[d]=function(b){return this.each(function(){var e=a.data(this,"plugin_"+d);e?"string"==typeof b?e[b].apply(e):e.updateOptions(b):"destroy"!==b&&a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window); \ No newline at end of file diff --git a/styles/lib/js/stickytableheaders-license.txt b/styles/lib/js/stickytableheaders-license.txt new file mode 100644 index 0000000..d3f756a --- /dev/null +++ b/styles/lib/js/stickytableheaders-license.txt @@ -0,0 +1,20 @@ +Copyright (c) 2011 Jonas Mosbech + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/styles/readtheorg/js/readtheorg.js b/styles/readtheorg/js/readtheorg.js index e3fbc58..ee8187d 100755 --- a/styles/readtheorg/js/readtheorg.js +++ b/styles/readtheorg/js/readtheorg.js @@ -35,6 +35,9 @@ $( document ).ready(function() { // ScrollSpy also requires that we use // a Bootstrap nav component. $('body').scrollspy({target: '#text-table-of-contents'}); + + // add sticky table headers + $('table').stickyTableHeaders(); }); window.SphinxRtdTheme = (function (jquery) {