Skip to content

Commit

Permalink
fix: calculation and set version to 1.5.7
Browse files Browse the repository at this point in the history
Signed-off-by: joerivanveen <[email protected]>
  • Loading branch information
joerivanveen committed Jan 29, 2024
1 parent 0773924 commit 9437a35
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
24 changes: 12 additions & 12 deletions javascript-source/wp-reading-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ function ruigehond006() {
}
ruigehond006_a.insertAdjacentElement('beforeend', wrap); // always attach as a child to ensure smooth operation
}
// make sure it’s always snug against the element using top margin
const aCssStyle = window.getComputedStyle(ruigehond006_a);
const borderTop = parseFloat(aCssStyle.borderTopWidth);
const attachTop = ('fixed' === aCssStyle.position) ?
ruigehond006_a.offsetTop - borderTop : boundingClientTop(ruigehond006_a) + fromTop;
const top = ruigehond006_a.offsetHeight + attachTop;
const cor = top - boundingClientTop(inner);
if (cor !== y_correction) {
//console.warn('set cor from ' + y_correction.toString() + ' to ' + cor.toString() + ' (' + top + '/' + boundingClientTop(inner) + ')');
inner.style.transform = 'translateY(' + cor.toString() + 'px)';
y_correction = cor;
// make sure it’s always snug against the element
const attachTop = ('fixed' === (ruigehond006_a.style.position
|| window.getComputedStyle(ruigehond006_a).position).toLowerCase()) ?
ruigehond006_a.offsetTop : boundingClientTop(ruigehond006_a) + fromTop;
const barTop = ruigehond006_a.offsetHeight + attachTop;
//console.log(wrap.getBoundingClientRect().top, boundingClientTop(wrap)); <- sometimes these are different... :-(
const topCor = barTop - wrap.getBoundingClientRect().top;
if (topCor !== y_correction) {
//console.warn('set cor from ' + y_correction.toString() + ' to ' + topCor.toString());
inner.style.transform = 'translateY(' + topCor.toString() + 'px)';
y_correction = topCor;
}
//console.warn(top + ' vs ' + boundingClient Top(inner) + ' vs ' + inner.getBoundingClientRect().top);
//console.warn(top + ' vs ' + boundingClientTop(inner) + ' vs ' + inner.getBoundingClientRect().top);
});
} else { // bar_attach must be top
barToTop(wrap, inner);
Expand Down
4 changes: 3 additions & 1 deletion wp-reading-progress/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hallo
Requires at least: 4.9
Tested up to: 6.4
Requires PHP: 5.6
Stable tag: 1.5.6
Stable tag: 1.5.7
License: GPLv3

Light weight fully customizable reading progress bar. Sticks to top, bottom or sticky menu, with fallback for small screens
Expand Down Expand Up @@ -54,6 +54,8 @@ Upon uninstall WP Reading Progress removes its own options and `post_meta` data

== Changelog ==

1.5.7: fix save settings and calculation correction (again)

1.5.6: adapt calculation to safari and chrome alike

1.5.5: bar top position calculation improved and allowing fractional pixels
Expand Down
12 changes: 6 additions & 6 deletions wp-reading-progress/wp-reading-progress.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions wp-reading-progress/wp-reading-progress.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: WP Reading Progress
Plugin URI: https://github.com/joerivanveen/wp-reading-progress
Description: Light weight customizable reading progress bar. Great UX on longreads.
Version: 1.5.6
Version: 1.5.7
Author: Joeri van Veen
Author URI: https://wp-developer.eu
License: GPLv3
Expand All @@ -12,7 +12,7 @@
*/
defined( 'ABSPATH' ) || die();
// This is plugin nr. 6 by Ruige hond. It identifies as: ruigehond006.
const RUIGEHOND006_VERSION = '1.5.6';
const RUIGEHOND006_VERSION = '1.5.7';
// Register hooks for plugin management, functions are at the bottom of this file.
register_activation_hook( __FILE__, 'ruigehond006_install' );
register_uninstall_hook( __FILE__, 'ruigehond006_uninstall' );
Expand Down

0 comments on commit 9437a35

Please sign in to comment.