Skip to content

Commit

Permalink
Add left-card name of site.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Nov 17, 2019
1 parent 3227173 commit 35c696a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
13 changes: 7 additions & 6 deletions scripts/script.js
Expand Up @@ -3553,17 +3553,18 @@ return function (id, name) {
if (pslcard === undefined) {
pslcard = $(".pslcard")[0];
}
if (observer === undefined) {
if (window.IntersectionObserver) {
observer = new IntersectionObserver(observer_fn, {threshold: 0.125});
} else {
observer = null;
}
}
if (!pslcard) {
} else if (name === false) {
observer && observer.unobserve($$(id));
$(pslcard).find("a[href='#" + id + "']").remove();
} else {
if (!pslcard.firstChild) {
$(pslcard).append('<div class="pslitem ui js-click-child" style="margin-bottom:6px"><a href="#top" class="x hover-child">Top</a></div>');
if (window.IntersectionObserver) {
observer = new IntersectionObserver(observer_fn, {threshold: 0.125});
}
}
$(pslcard).append('<div class="pslitem ui js-click-child"><a href="#' + id + '" class="x hover-child">' + name + '</a></div>');
observer && observer.observe($$(id));
}
Expand Down
10 changes: 7 additions & 3 deletions src/papertable.php
Expand Up @@ -1407,8 +1407,9 @@ function echo_editable_anonymity($option) {

private function _papstripBegin($foldid = null, $folded = null, $extra = null) {
if (!$this->npapstrip) {
echo '<div class="pcontainer"><div class="pcard-left">',
'<div class="pspcard"><div class="pspcard-fold">',
echo '<div class="pcontainer"><div class="pcard-left',
(strlen($this->conf->short_name) > 30 ? " pcard-longname" : ""),
'"><div class="pspcard"><div class="pspcard-fold">',
'<div style="float:right;margin-left:1em;cursor:pointer"><span class="psfn">More ', expander(true), '</span></div>';

if (($viewable = $this->prow->viewable_tags($this->user))) {
Expand Down Expand Up @@ -2373,7 +2374,10 @@ function paptabBegin() {
$this->_papstrip();
}
if ($this->npapstrip) {
echo '</div></div><div class="pslcard"></div></div>';
echo '</div></div><div class="pslcard"><div class="pslcard-home">',
'<a href="#top" class="qq"><span class="header-site-name">',
htmlspecialchars($this->conf->short_name), '</span> #',
$this->prow->paperId, '</a></div></div></div>';
} else {
echo '<div class="pcontainer pcontainer-nostrip">';
}
Expand Down
16 changes: 14 additions & 2 deletions stylesheets/style.css
Expand Up @@ -2564,16 +2564,18 @@ a.badge:active {
/* paper strip */
.pcard-left {
position: absolute;
z-index: 4;
top: 0;
bottom: 0;
left: -24px;
z-index: 4;
width: 248px;
width: 15.5rem;
font-size: 13px;
font-size: 0.8125rem;
}
.pspcard {
position: relative;
z-index: 1;
background: #edf3f5;
color: #2b2b2b;
padding: 16px 16px 20px 24px;
Expand All @@ -2584,9 +2586,19 @@ a.badge:active {
.pslcard {
-webkit-position: sticky;
position: sticky;
top: 16px;
top: 84px;
padding: 20px 16px 20px 24px;
}
.pslcard-home {
position: absolute;
z-index: -1;
bottom: 100%;
left: 0px;
right: 0px;
padding: 3rem 16px 2px 24px;
overflow-wrap: break-word;
color: #d41743;
}
.pslitem-intersecting {
font-weight: bold;
}
Expand Down

0 comments on commit 35c696a

Please sign in to comment.