Skip to content

Commit

Permalink
completely remove floatthead
Browse files Browse the repository at this point in the history
Removed all code that initializes the plugin (doing this under the assumption that timbunce#194 removes the js file from this project).
Also removed `show_fragment_target()` because it would no longer work without floatthead present. 

This fixes timbunce#192 , or at least fixes the fix that was made in it.

The proper way to fix timbunce#192 would be to take a look at the `show_fragment_target()` function and figure out why its setting the incorrect scrollTop there when you click on links. I cannot do this without seeing the generated code. 

Either way, someone needs to test this change before merging it, because I have not done so.
  • Loading branch information
mkoryak authored Oct 20, 2021
1 parent fc3ef58 commit c30342d
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions bin/nytprofhtml
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,8 @@ sub subroutine_table {
4: { sorter: 'fmt_time' }
}
});
$(".floatHeaders").each( function(){ $(this).floatThead(); } );
show_fragment_target();
$(window).on('hashchange', function(e){
show_fragment_target();
});
> if @subs_to_show == @subs;

Expand Down Expand Up @@ -1507,13 +1503,6 @@ sub output_file_table {
2: { sorter: false }
}
});
$(".floatHeaders").each( function(){ $(this).floatThead(); } );
show_fragment_target();
$(window).on('hashchange', function(e){
show_fragment_target();
});
};

return "";
Expand Down Expand Up @@ -1659,7 +1648,6 @@ EOD
$html .= <<'EOD' unless $opts->{skip_jquery};
<script type="text/javascript" src="js/jquery-min.js"></script>
<script type="text/javascript" src="js/jquery.floatThead.min.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/style-tablesorter.css" />
<script type="text/javascript">
Expand Down Expand Up @@ -1690,23 +1678,6 @@ EOD
type: 'numeric' // set type, either numeric or text
});
function show_fragment_target() {
var tgt = $(':target');
var table = tgt.closest('table.floatHeaders');
if( tgt.is('a') && table.is('table.floatHeaders') )
{
var cury = $(window).scrollTop();
var fhYPos = table.prev('.floatThead-container').offset().top;
var thHeight = table.find('thead').first().height();
var tYPos = parseInt($(':target').closest('tr').position().top);
if( tYPos < (fhYPos + thHeight) )
{
$(window).scrollTop(
tYPos - (thHeight)
);
}
}
}
</script>
EOD
$html .= $opts->{head_epilogue} if $opts->{head_epilogue};
Expand Down

0 comments on commit c30342d

Please sign in to comment.