mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-09 16:55:17 +00:00
expand marks read option. #103
This commit is contained in:
parent
77abd06a2c
commit
3cb8b19a4e
|
@ -1,11 +1,11 @@
|
||||||
function request(url, params, callback, errorcallback = function(){}) {
|
function request(url, params, callback, errorcallback = function(){}) {
|
||||||
var xmlHttp = new XMLHttpRequest();
|
var xmlHttp = new XMLHttpRequest();
|
||||||
xmlHttp.onreadystatechange = function() {
|
xmlHttp.onreadystatechange = function() {
|
||||||
if (xmlHttp.readyState != 4 ) { return }
|
if (xmlHttp.readyState != 4 || !callback ) { return }
|
||||||
if (xmlHttp.status == 200) {
|
if (xmlHttp.status == 200) {
|
||||||
return callback(xmlHttp.responseText);
|
return callback(xmlHttp.responseText);
|
||||||
}
|
}
|
||||||
errorcallback(xmlHttp.responseText);
|
if (errorcallback) errorcallback(xmlHttp.responseText);
|
||||||
}
|
}
|
||||||
var method = "GET"
|
var method = "GET"
|
||||||
if (params) method = "POST"
|
if (params) method = "POST"
|
||||||
|
@ -31,6 +31,10 @@ function postClick(e) {
|
||||||
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 (bdy.querySelector("img.image") && localStorage.getItem("markRead") == "true") {
|
||||||
|
bdy.parentNode.querySelector(".title").className = "title visited"
|
||||||
|
request(bdy.parentNode.querySelector('.buttons a').href, { op: "read_post", submit: "mark read"})
|
||||||
|
}
|
||||||
if (id = parseYoutube(url)) {
|
if (id = parseYoutube(url)) {
|
||||||
targ.getElementsByClassName("embed")[0].innerHTML = youtubeIframe(id)
|
targ.getElementsByClassName("embed")[0].innerHTML = youtubeIframe(id)
|
||||||
}
|
}
|
||||||
|
@ -378,7 +382,7 @@ function saveSettings(e) {
|
||||||
var data = new FormData(targ)
|
var data = new FormData(targ)
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
request(targ.target, data, function(res) {
|
request(targ.target, data, function(res) {
|
||||||
["endlessScrolling", "autoLoad"].map(function(x) {
|
["endlessScrolling", "autoLoad", "markRead"].map(function(x) {
|
||||||
localStorage.setItem(x, data.get(x)=="on")
|
localStorage.setItem(x, data.get(x)=="on")
|
||||||
})
|
})
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
|
|
|
@ -148,6 +148,14 @@
|
||||||
</label>
|
</label>
|
||||||
<input type="checkbox" name="linksInNewWindow" {{ if .LinksInNewWindow }}checked{{end}}>
|
<input type="checkbox" name="linksInNewWindow" {{ if .LinksInNewWindow }}checked{{end}}>
|
||||||
</div>
|
</div>
|
||||||
|
{{ if .Session }}
|
||||||
|
<div class="scripting">
|
||||||
|
<label>
|
||||||
|
expand marks read
|
||||||
|
</label>
|
||||||
|
<input type="checkbox" name="markRead">
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
<div>
|
<div>
|
||||||
<label>lemmy: {{ .Site.Version }}<br><a href="https://github.com/rystaf/mlmym">mlmym</a>: {{ .Version }}</label>
|
<label>lemmy: {{ .Site.Version }}<br><a href="https://github.com/rystaf/mlmym">mlmym</a>: {{ .Version }}</label>
|
||||||
<input type="submit" value="save">
|
<input type="submit" value="save">
|
||||||
|
|
Loading…
Reference in a new issue