mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-21 21:27:15 +00:00
expando image fixes, multi instance root fix
This commit is contained in:
parent
c874a3291b
commit
8821b5d73b
|
@ -545,11 +545,14 @@ form.blockpost {
|
||||||
#settingspopup.open, #mycommunities.open {
|
#settingspopup.open, #mycommunities.open {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
.expando {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
.expando.open{
|
.expando.open{
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.expando .image {
|
.expando .image {
|
||||||
max-width: 578px;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
.expando .md {
|
.expando .md {
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
|
@ -615,6 +618,12 @@ main {
|
||||||
margin: 0px 10px;
|
margin: 0px 10px;
|
||||||
}
|
}
|
||||||
@media (min-width: 900px) {
|
@media (min-width: 900px) {
|
||||||
|
.expando {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.expando .image {
|
||||||
|
max-width: 578px;
|
||||||
|
}
|
||||||
.side {
|
.side {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -12,6 +12,9 @@ function request(url, params, callback, errorcallback = function(){}) {
|
||||||
xmlHttp.open(method, url, true);
|
xmlHttp.open(method, url, true);
|
||||||
xmlHttp.send(params);
|
xmlHttp.send(params);
|
||||||
}
|
}
|
||||||
|
var resizeTarget
|
||||||
|
var startCoordinates = [0,0]
|
||||||
|
var startSize = [0,0]
|
||||||
function postClick(e) {
|
function postClick(e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
if (e.target.className.indexOf("expando-button") == -1) { return }
|
if (e.target.className.indexOf("expando-button") == -1) { return }
|
||||||
|
@ -24,28 +27,15 @@ function postClick(e) {
|
||||||
btn.className = "expando-button"
|
btn.className = "expando-button"
|
||||||
targ.getElementsByClassName("embed")[0].innerHTML = ""
|
targ.getElementsByClassName("embed")[0].innerHTML = ""
|
||||||
} else {
|
} else {
|
||||||
|
if (window.innerWidth <= 800) targ.appendChild(bdy);
|
||||||
bdy.className = 'expando open';
|
bdy.className = 'expando open';
|
||||||
btn.className = "expando-button open"
|
btn.className = "expando-button open"
|
||||||
var url = targ.getElementsByClassName("url")[0].href
|
var url = targ.getElementsByClassName("url")[0].href
|
||||||
if (id = parseYoutube(url)) {
|
if (id = parseYoutube(url)) {
|
||||||
targ.getElementsByClassName("embed")[0].innerHTML = youtubeIframe(id)
|
targ.getElementsByClassName("embed")[0].innerHTML = youtubeIframe(id)
|
||||||
}
|
}
|
||||||
// TODO set image handler
|
|
||||||
var images = bdy.getElementsByTagName('img')
|
|
||||||
for (var i = 0; i < images.length; i++) {
|
|
||||||
images[i].onmousedown = function(e) {
|
|
||||||
e.preventDefault()
|
|
||||||
startCoordinates = [e.clientX, e.clientY]
|
|
||||||
startSize = [e.target.height, e.target.width]
|
|
||||||
resizeTarget = e.target
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var resizeTarget
|
|
||||||
var startCoordinates = [0,0]
|
|
||||||
var startSize = [0,0]
|
|
||||||
document.onmousemove = function(e) {
|
document.onmousemove = function(e) {
|
||||||
if (resizeTarget) {
|
if (resizeTarget) {
|
||||||
resizeTarget.style.maxWidth = 'unset';
|
resizeTarget.style.maxWidth = 'unset';
|
||||||
|
@ -58,9 +48,9 @@ document.onmousemove = function(e) {
|
||||||
resizeTarget.width = newX > 30 ? newX : 30
|
resizeTarget.width = newX > 30 ? newX : 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.onmouseup = function(e){
|
window.addEventListener('mouseup', function(e){
|
||||||
resizeTarget = false;
|
resizeTarget = false;
|
||||||
}
|
})
|
||||||
function uptil (el, f) {
|
function uptil (el, f) {
|
||||||
if (el) return f(el) ? el : uptil(el.parentNode, f)
|
if (el) return f(el) ? el : uptil(el.parentNode, f)
|
||||||
}
|
}
|
||||||
|
@ -492,6 +482,16 @@ function setup() {
|
||||||
btn.className = "expando-button"
|
btn.className = "expando-button"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let images = posts[i].getElementsByTagName('img')
|
||||||
|
for (let i = 0; i < images.length; i++) {
|
||||||
|
images[i].onmousedown = function(e) {
|
||||||
|
e.preventDefault()
|
||||||
|
startCoordinates = [e.clientX, e.clientY]
|
||||||
|
startSize = [e.target.height, e.target.width]
|
||||||
|
resizeTarget = e.target
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var comments = document.getElementsByClassName("comment")
|
var comments = document.getElementsByClassName("comment")
|
||||||
for (var i = 0; i < comments.length; i++) {
|
for (var i = 0; i < comments.length; i++) {
|
||||||
|
|
|
@ -357,8 +357,8 @@ func GetRoot(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
data["Title"] = r.Host
|
data["Title"] = r.Host
|
||||||
if dark := getCookie(r, "Dark"); dark != "" {
|
if dark := getCookie(r, "Dark"); dark != "" {
|
||||||
data["Dark"] = dark != "0"
|
data["Dark"] = dark != "0"
|
||||||
} else {
|
} else if dark := os.Getenv("DARK"); dark != "" {
|
||||||
data["Dark"] = os.Getenv("DARK") != ""
|
data["Dark"] = true
|
||||||
}
|
}
|
||||||
tmpl, err := GetTemplate("root.html")
|
tmpl, err := GetTemplate("root.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
</head>
|
</head>
|
||||||
<body{{ if is .Dark }} class="dark"{{end}}>
|
<body{{ if is .Dark }} class="dark" {{end}}>
|
||||||
<nav>
|
<nav>
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<span class="title">{{ .Title }}</span>
|
<span class="title">{{ .Title }}</span>
|
||||||
|
|
Loading…
Reference in a new issue