Skip to content
Sign up
Sign in
This repository
Explore
Features
Enterprise
Blog
Watch
2
Star
6
Fork
2
bakkot
/
SlateStarComments
Code
Issues
Pull requests
Pulse
Graphs
HTTPS
clone URL
Subversion
checkout URL
You can clone with
HTTPS
or
Subversion
.
Clone in Desktop
Download ZIP
Permalink
Browse files
boustrophedon
Loading branch information
...
commit
f29c3f4f00a8fd462e07fb40cca8070596322db4
1 parent
edf7dae
bakkot
authored
Mar 4, 2015
Unified
Split
Showing
1 changed file
with
49 additions
and
0 deletions
.
+49
−0
ssc.js
Show notes
View
49
ssc.js
@@ -251,9 +251,58 @@ function makeNewText() {
}
+
+
// ??
+
function
boustrophedon
(
justChars
) {
+
function
mangle
(
ele
) {
+ ele.
style
.
textAlign
=
'
justify
'
;
+ ele.
style
.position
=
'
relative
'
;
+
var
compStyle
=
getComputedStyle(ele);
+
var
lineHeight
=
compStyle.
lineHeight
;
+ lineHeight
=
parseInt
(lineHeight.
substring
(
0
, lineHeight.
length
-
2
));
+
var
height
=
compStyle.
height
;
+ height
=
parseInt
(height.
substring
(
0
, height.
length
-
2
));
+
+
var
lines
=
height / lineHeight;
+
+
var
backbase
=
ele.
cloneNode
(
true
);
+ backbase.
style
.position
=
'
absolute
'
;
+ backbase.
style
.
top
=
'
0px
'
;
+ backbase.
style
.
left
=
'
0px
'
;
+
if
(justChars) {
+ backbase.
style
.unicodeBidi
=
'
bidi-override
'
;
+ backbase.
style
.direction
=
'
rtl
'
;
+ }
+
else
{
+ backbase.
style
.transform
=
'
scale(-1, 1)
'
;
+ backbase.
style
[
'
-webkit-transform
'
]
=
'
scale(-1, 1)
'
;
+ }
+ backbase.
style
.
background
=
'
white
'
;
+
+
+
for
(
var
i
=
1
; i
<
lines; i
+=
2
) {
+
var
copy
=
backbase.
cloneNode
(
true
);
+ copy.
style
.
clip
=
'
rect(
'
+
i
*
lineHeight
+
'
px, auto,
'
+
(i
+
1
)
*
lineHeight
+
'
px, auto)
'
;
+
console
.log
(copy);
+ ele.
appendChild
(copy);
+ }
+ }
+
+
+
var
ps
=
document
.querySelectorAll(
'
div.pjgm-postcontent > p
'
);
+
for
(
var
i
=
0
; i
<
ps.
length
;
++
i) {
+ mangle(ps[i]);
+ }
+}
+
+
+
+
// Run iff we're on a page which looks like a post
if
(location.
pathname
.
substring
(
0
,
3
)
==
'
/20
'
) {
makeHighlight();
makeShowHide();
makeNewText();
}
+
if
(location.search
==
'
?boustrophedon
'
) boustrophedon(
false
);
+
if
(location.search
==
'
?boustrophedon2
'
) boustrophedon(
true
);
Toggle all file notes
Please
sign in
to comment.
Something went wrong with that request. Please try again.