fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
one of many positioning fixes
[wolnelektury.git]
/
src
/
wolnelektury
/
static
/
js
/
book_text
/
references.js
diff --git
a/src/wolnelektury/static/js/book_text/references.js
b/src/wolnelektury/static/js/book_text/references.js
index
1460675
..
6abd103
100644
(file)
--- a/
src/wolnelektury/static/js/book_text/references.js
+++ b/
src/wolnelektury/static/js/book_text/references.js
@@
-139,10
+139,11
@@
leftoffset = x - margin;
} else {
right = '';
leftoffset = x - margin;
} else {
right = '';
-
- // default position.
- leftoffset = 40;
+
leftoffset = $elem.data('default-leftoffset');
leftoffset = $elem.data('default-leftoffset');
+ if (leftoffset === undefined) {
+ leftoffset = $elem.width() / 2;
+ }
nx = x - leftoffset;
nx = x - leftoffset;
@@
-157,12
+158,8
@@
// Do we need to move away from the right?
if (nx + boxwidth > maxx) {
// Do we need to move away from the right?
if (nx + boxwidth > maxx) {
- // ACTUALLY CALCULATE STUFF
- // if maxx - minx < 470 px -- daj z lewej do prawej i już!
-
right = '';
let d = nx + boxwidth - maxx;
right = '';
let d = nx + boxwidth - maxx;
- //if (leftoffset + d > $elem.width() - 10) d = $elem.width() - leftoffset - 10;
nx -= d;
leftoffset += d;
}
nx -= d;
leftoffset += d;
}
@@
-474,7
+471,7
@@
let text = window.location.protocol + '//' +
window.location.host +
window.location.pathname;
let text = window.location.protocol + '//' +
window.location.host +
window.location.pathname;
- if (anchor) text += anchor;
+ if (anchor) text +=
'#' +
anchor;
navigator.clipboard.writeText(text);
this.hideCopied();
navigator.clipboard.writeText(text);
this.hideCopied();