diff --git a/src/pages/common/Post.js b/src/pages/common/Post.js index 459bed5..c3e2fda 100644 --- a/src/pages/common/Post.js +++ b/src/pages/common/Post.js @@ -4,27 +4,25 @@ import { prettyScore, prettyDate, prettyTimeDiff, exactDateTime, parse, redditTh export default (props) => { if (!props.title) { - if (props.removed) { - const permalink = `/r/${props.subreddit}/comments/${props.id}/` - return ( -
-
-
-
?
-
-
- -
- [removed too quickly to be archived] -
- reddit  - reveddit -
-
+ const permalink = `/r/${props.subreddit}/comments/${props.id}/` + return
+
+
+
?
+
+
+ +
+ + {props.removed ? '[removed too quickly to be archived]' : '...'} + +
 
+ - ) - } else - return
+
+
} let url = new URL(props.url, 'https://www.reddit.com') @@ -33,9 +31,9 @@ export default (props) => { url.protocol = document.location.protocol url.host = document.location.host } - const isSameUrl = url.origin == document.location.origin && + const isUrlThisPost = url.origin == document.location.origin && (new RegExp(`/(?:r|user)/[^/]+/comments/${props.id}\\b`)).test(url.pathname) - if (isSameUrl) + if (isUrlThisPost) url = url.href.substring(url.origin.length) const userLink = isDeleted(props.author) ? undefined : `https://www.reddit.com/user/${props.author}` @@ -45,15 +43,15 @@ export default (props) => { const thumbnailHeight = props.thumbnail_height ? props.thumbnail_height * 0.5 : 70 if (redditThumbnails.includes(props.thumbnail)) { - thumbnail = React.createElement(isSameUrl ? Link : 'a', { - [isSameUrl ? 'to' : 'href']: url, - replace: isSameUrl ? true : undefined, + thumbnail = React.createElement(isUrlThisPost ? Link : 'a', { + [isUrlThisPost ? 'to' : 'href']: url, + replace: isUrlThisPost ? props.isLocFullPost : undefined, className: `thumbnail thumbnail-${props.thumbnail}` }) } else if (props.thumbnail !== '') { - thumbnail = React.createElement(isSameUrl ? Link : 'a', { - [isSameUrl ? 'to' : 'href']: url, - replace: isSameUrl ? true : undefined + thumbnail = React.createElement(isUrlThisPost ? Link : 'a', { + [isUrlThisPost ? 'to' : 'href']: url, + replace: isUrlThisPost ? props.isLocFullPost : undefined }, Thumbnail) } @@ -74,9 +72,7 @@ export default (props) => { const [showEdited, setShowEdited] = useState(false) const totalComments =
- {props.reloadingComments ? - {props.num_comments} comments : - {props.num_comments} comments}  + {props.num_comments} comments  reddit  reveddit {props.hasOwnProperty('edited_selftext') && @@ -98,9 +94,9 @@ export default (props) => {
{thumbnail}
- { React.createElement(isSameUrl ? Link : 'a', { - [isSameUrl ? 'to' : 'href']: url, - replace: isSameUrl ? true : undefined, + { React.createElement(isUrlThisPost ? Link : 'a', { + [isUrlThisPost ? 'to' : 'href']: url, + replace: isUrlThisPost ? props.isLocFullPost : undefined, className:'thread-title' }, props.title) } {props.link_flair_text && diff --git a/src/pages/thread/index.js b/src/pages/thread/index.js index 794b980..c55a88d 100644 --- a/src/pages/thread/index.js +++ b/src/pages/thread/index.js @@ -521,7 +521,7 @@ class Thread extends React.Component { return ( <> - +