insert youtube embeds on loadmore

This commit is contained in:
Ryan Stafford 2023-07-08 22:30:22 -04:00
parent 34f349313f
commit 6685badaca
4 changed files with 23 additions and 20 deletions

View file

@ -86,10 +86,10 @@ summary {
visibility: hidden;
}
.score form.link-btn input {
display: block;
display: inline-block;
color: #b7b7b7;
font-size: 20px;
line-height: 16px;
line-height: 15px;
}
.dark .score form.link-btn input {
color: #646464;
@ -104,10 +104,6 @@ summary {
color: #eb445a;
}
.score form div {
position: relative;
top: 2px;
}
.title a {
font-size: medium;
text-decoration: none;
@ -174,7 +170,7 @@ summary {
margin: 0px 0px 5px 15px;
border: 1px solid #e6e6e6;
border-radius: 3px;
padding: 5px 10px 5px 5px;
padding: 5px 10px 5px 7px;
}
.dark .comment {
border-color: #333;
@ -395,8 +391,8 @@ form.nsfw div {
#loadmore.show {
display: block;
}
#loadmore[disabled] {
visibility: visible;
#end {
visibility: hidden;
}
.buttons li {
display: inline;
@ -505,6 +501,9 @@ form.nsfw div {
.expando.open{
display: block;
}
.expando .embed {
text-align: center;
}
.expando .image {
display: block;
overflow: hidden;

View file

@ -122,6 +122,7 @@ function loadMore(e) {
}
var loadmore = document.getElementById("loadmore")
if (loadmore) loadmore.className = "show"
insert_youtube()
}
else {
e.target.outerHTML = '<input id="end" type="submit" value="" disabled>'
@ -263,18 +264,21 @@ function toggle_images(open) {
}
}
var posts = document.getElementsByClassName("post")
for (var i = 0; i < posts.length; i++) {
var url = posts[i].getElementsByClassName("url")[0].href
if (id = parse_youtube(url)) {
var btn = posts[i].getElementsByClassName("expando-button")[0]
if (btn.className.indexOf("open") > -1) {
posts[i].getElementsByClassName("embed")[0].innerHTML = youtube_iframe(id)
} else {
btn.className = "expando-button"
function insert_youtube() {
var posts = document.getElementsByClassName("post")
for (var i = 0; i < posts.length; i++) {
var url = posts[i].getElementsByClassName("url")[0].href
if (id = parse_youtube(url)) {
var btn = posts[i].getElementsByClassName("expando-button")[0]
if (btn.className.indexOf("open") > -1) {
posts[i].getElementsByClassName("embed")[0].innerHTML = youtube_iframe(id)
} else {
btn.className = "expando-button"
}
}
}
}
insert_youtube()
if (localStorage.getItem("endlessScrolling") == "true") {
var pager = document.getElementsByClassName("pager")

View file

@ -2,7 +2,7 @@
<head>
<title>{{ if and .Community (ne .Community.CommunityView.Community.Title "")}}{{.Community.CommunityView.Community.Title}}{{else if ne .CommunityName ""}}/c/{{.CommunityName}}{{ else if .User}}overview for {{.User.PersonView.Person.Name}}{{else}}{{ host .Host }}{{end}}</title>
<link rel="shortcut icon" href="/{{.Host}}/icon.jpg">
<link rel="stylesheet" href="/_/static/style.css?v=15">
<link rel="stylesheet" href="/_/static/style.css?v=16">
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body {{ if .Dark }}class="dark"{{end}}>

View file

@ -3,7 +3,7 @@
<title>{{if and .Posts .PostID }}{{ (index .Posts 0).Post.Name}} : {{.CommunityName}}{{else if and .Community (ne .Community.CommunityView.Community.Title "")}}{{.Community.CommunityView.Community.Title}}{{else if ne .CommunityName ""}}/c/{{.CommunityName}}{{ else if .User}}overview for {{.User.PersonView.Person.Name}}{{else}}{{ host .Host }}{{end}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="/{{.Host}}/icon.jpg">
<link rel="stylesheet" href="/_/static/style.css?v=15">
<link rel="stylesheet" href="/_/static/style.css?v=16">
</head>
<body{{ if .Dark }} class="dark"{{end}}>
<noscript>