fix quoting on ajax topic load
apply #back classes properly on ajax topic load
This commit is contained in:
parent
d43bffdec5
commit
d3336245d5
|
@ -620,7 +620,7 @@ function mainInit(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
bindTopic();
|
bindPage();
|
||||||
|
|
||||||
$(".edit_field").click(function(ev) {
|
$(".edit_field").click(function(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -711,23 +711,6 @@ function mainInit(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".quote_item").click(function(){
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
let source = this.closest(".post_item").getElementsByClassName("edit_source")[0];
|
|
||||||
let content = document.getElementById("input_content")
|
|
||||||
console.log("content.value", content.value);
|
|
||||||
|
|
||||||
let item;
|
|
||||||
if(content.value == "") item = "<blockquote>" + source.innerHTML + "</blockquote>"
|
|
||||||
else item = "\r\n<blockquote>" + source.innerHTML + "</blockquote>";
|
|
||||||
content.value = content.value + item;
|
|
||||||
console.log("content.value", content.value);
|
|
||||||
|
|
||||||
// For custom / third party text editors
|
|
||||||
quoteItemCallback(source.innerHTML,item);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(this).click(() => {
|
$(this).click(() => {
|
||||||
$(".selectedAlert").removeClass("selectedAlert");
|
$(".selectedAlert").removeClass("selectedAlert");
|
||||||
$("#back").removeClass("alertActive");
|
$("#back").removeClass("alertActive");
|
||||||
|
@ -772,9 +755,9 @@ function mainInit(){
|
||||||
error: ajaxError,
|
error: ajaxError,
|
||||||
success: function (data,status,xhr) {
|
success: function (data,status,xhr) {
|
||||||
console.log("Theme successfully switched");
|
console.log("Theme successfully switched");
|
||||||
console.log("data", data);
|
console.log("data",data);
|
||||||
console.log("status", status);
|
console.log("status",status);
|
||||||
console.log("xhr", xhr);
|
console.log("xhr",xhr);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -868,14 +851,10 @@ function mainInit(){
|
||||||
if(!resp.ok) throw(href+" failed to load");
|
if(!resp.ok) throw(href+" failed to load");
|
||||||
return resp.text();
|
return resp.text();
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
let el = document.createElement("div");
|
document.querySelector("#back").outerHTML = data;
|
||||||
el.innerHTML = data;
|
|
||||||
console.log("el",el);
|
|
||||||
document.querySelector("main").outerHTML = el.children[0].innerHTML;
|
|
||||||
//$(".sidebar").html(el.children[1]);
|
|
||||||
document.querySelector(".sidebar").outerHTML = el.children[1].outerHTML;
|
|
||||||
unbindTopic();
|
unbindTopic();
|
||||||
bindTopic();
|
bindTopic();
|
||||||
|
$(".elapsed").remove();
|
||||||
let obj = {Title: document.title, Url: base};
|
let obj = {Title: document.title, Url: base};
|
||||||
history.pushState(obj, obj.Title, obj.Url);
|
history.pushState(obj, obj.Title, obj.Url);
|
||||||
}).catch(ex => {
|
}).catch(ex => {
|
||||||
|
@ -892,6 +871,14 @@ function mainInit(){
|
||||||
runInitHook("end_init");
|
runInitHook("end_init");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bindPage() {
|
||||||
|
bindTopic();
|
||||||
|
}
|
||||||
|
|
||||||
|
function unbindPage() {
|
||||||
|
unbindTopic();
|
||||||
|
}
|
||||||
|
|
||||||
function bindTopic() {
|
function bindTopic() {
|
||||||
$(".open_edit").click(ev => {
|
$(".open_edit").click(ev => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
@ -997,6 +984,23 @@ function bindTopic() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".quote_item").click(function(ev){
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
let src = this.closest(".post_item").getElementsByClassName("edit_source")[0];
|
||||||
|
let content = document.getElementById("input_content")
|
||||||
|
console.log("content.value", content.value);
|
||||||
|
|
||||||
|
let item;
|
||||||
|
if(content.value == "") item = "<blockquote>" + src.innerHTML + "</blockquote>"
|
||||||
|
else item = "\r\n<blockquote>" + src.innerHTML + "</blockquote>";
|
||||||
|
content.value = content.value + item;
|
||||||
|
console.log("content.value", content.value);
|
||||||
|
|
||||||
|
// For custom / third party text editors
|
||||||
|
quoteItemCallback(src.innerHTML,item);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function unbindTopic() {
|
function unbindTopic() {
|
||||||
|
@ -1005,4 +1009,5 @@ function unbindTopic() {
|
||||||
$(".delete_item").unbind("click");
|
$(".delete_item").unbind("click");
|
||||||
$(".edit_item").unbind("click");
|
$(".edit_item").unbind("click");
|
||||||
$(".submit_edit").unbind("click");
|
$(".submit_edit").unbind("click");
|
||||||
|
$(".quote_item").unbind("click");
|
||||||
}
|
}
|
|
@ -14,15 +14,15 @@
|
||||||
{{range .Header.Scripts}}
|
{{range .Header.Scripts}}
|
||||||
<script src="/s/{{.}}"></script>{{end}}
|
<script src="/s/{{.}}"></script>{{end}}
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
||||||
{{if .Header.MetaDesc}}<meta name="description" content="{{.Header.MetaDesc}}"/>{{end}}
|
{{if .Header.MetaDesc}}<meta name="description"content="{{.Header.MetaDesc}}"/>{{end}}
|
||||||
{{/** TODO: Have page / forum / topic level tags and descriptions below as-well **/}}
|
{{/** TODO: Have page / forum / topic level tags and descriptions below as-well **/}}
|
||||||
<meta property="og:type" content="website"/>
|
<meta property="og:type"content="website"/>
|
||||||
<meta property="og:site_name" content="{{.Header.Site.Name}}">
|
<meta property="og:site_name"content="{{.Header.Site.Name}}">
|
||||||
<meta property="og:title" content="{{.Title}} | {{.Header.Site.Name}}">
|
<meta property="og:title"content="{{.Title}} | {{.Header.Site.Name}}">
|
||||||
<meta name="twitter:title" content="{{.Title}} | {{.Header.Site.Name}}"/>
|
<meta name="twitter:title"content="{{.Title}} | {{.Header.Site.Name}}"/>
|
||||||
{{if .OGDesc}}<meta property="og:description" content="{{.OGDesc}}"/>
|
{{if .OGDesc}}<meta property="og:description"content="{{.OGDesc}}"/>
|
||||||
<meta property="twitter:description" content="{{.OGDesc}}"/>{{end}}
|
<meta property="twitter:description"content="{{.OGDesc}}"/>{{end}}
|
||||||
{{if .GoogSiteVerify}}<meta name="google-site-verification" content="{{.GoogSiteVerify}}"/>{{end}}
|
{{if .GoogSiteVerify}}<meta name="google-site-verification"content="{{.GoogSiteVerify}}"/>{{end}}
|
||||||
<link rel="search" type="application/opensearchdescription+xml" title="{{.Header.Site.Name}}" href="/opensearch.xml">
|
<link rel="search" type="application/opensearchdescription+xml" title="{{.Header.Site.Name}}" href="/opensearch.xml">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
<div class="user_box">
|
<div class="user_box">
|
||||||
<img src="{{.CurrentUser.MicroAvatar}}"/>
|
<img src="{{.CurrentUser.MicroAvatar}}"/>
|
||||||
<div class="option_box">
|
<div class="option_box">
|
||||||
<a href="{{.CurrentUser.Link}}" class="username">{{.CurrentUser.Name}}</a>
|
<a href="{{.CurrentUser.Link}}"class="username">{{.CurrentUser.Name}}</a>
|
||||||
<span class="alerts">{{lang "alerts.no_alerts_short"}}</span>
|
<span class="alerts">{{lang "alerts.no_alerts_short"}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<li id="{{.HTMLID}}" class="menu_{{.Position}} {{.CSSClass}}{{.CSSActive}}"><a href="{{.Path}}" aria-label="{{.Aria}}" title="{{.Tooltip}}">{{.Name}}</a></li>
|
<li id="{{.HTMLID}}"class="menu_{{.Position}} {{.CSSClass}}{{.CSSActive}}"><a href="{{.Path}}"aria-label="{{.Aria}}"title="{{.Tooltip}}">{{.Name}}</a></li>
|
|
@ -1,2 +1,7 @@
|
||||||
|
<div id="back" class="zone_{{.Header.Zone}}{{if hasWidgets "rightSidebar" .Header }} shrink_main{{end}}">
|
||||||
|
<div id="main">
|
||||||
|
<div class="alertbox initial_alertbox">{{range .Header.NoticeList}}{{template "notice.html" . }}{{end}}</div>
|
||||||
{{template "topic_alt_inner.html" . }}
|
{{template "topic_alt_inner.html" . }}
|
||||||
<aside class="midRight sidebar">{{dock "rightSidebar" .Header}}</aside>
|
</div>
|
||||||
|
<aside class="midRight sidebar">{{dock "rightSidebar" .Header}}</aside>
|
||||||
|
</div>
|
|
@ -1,11 +1,11 @@
|
||||||
<main id="topicPage">
|
<main id="topicPage">
|
||||||
|
|
||||||
{{if gt .Page 1}}<link rel="prev" href="{{.Topic.Link}}?page={{subtract .Page 1}}"/>
|
{{if gt .Page 1}}<link rel="prev" href="{{.Topic.Link}}?page={{subtract .Page 1}}"/>
|
||||||
<div id="prevFloat" class="prev_button"><a class="prev_link" aria-label="{{lang "paginator.prev_page_aria"}}" rel="prev" href="{{.Topic.Link}}?page={{subtract .Page 1}}">{{lang "paginator.less_than"}}</a></div>{{end}}
|
<div id="prevFloat" class="prev_button"><a class="prev_link" aria-label="{{lang "paginator.prev_page_aria"}}" rel="prev"href="{{.Topic.Link}}?page={{subtract .Page 1}}">{{lang "paginator.less_than"}}</a></div>{{end}}
|
||||||
|
|
||||||
{{if ne .LastPage .Page}}<link rel="prerender next" href="{{.Topic.Link}}?page={{add .Page 1}}"/>
|
{{if ne .LastPage .Page}}<link rel="prerender next" href="{{.Topic.Link}}?page={{add .Page 1}}"/>
|
||||||
<div id="nextFloat" class="next_button">
|
<div id="nextFloat" class="next_button">
|
||||||
<a class="next_link" aria-label="{{lang "paginator.next_page_aria"}}" rel="next" href="{{.Topic.Link}}?page={{add .Page 1}}">{{lang "paginator.greater_than"}}</a>
|
<a class="next_link" aria-label="{{lang "paginator.next_page_aria"}}" rel="next"href="{{.Topic.Link}}?page={{add .Page 1}}">{{lang "paginator.greater_than"}}</a>
|
||||||
</div>{{end}}
|
</div>{{end}}
|
||||||
<link rel="canonical" href="//{{.Site.URL}}{{.Topic.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}"/>
|
<link rel="canonical" href="//{{.Site.URL}}{{.Topic.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}"/>
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
|
<div id="back" class="zone_{{.Header.Zone}}{{if hasWidgets "rightSidebar" .Header }} shrink_main{{end}}">
|
||||||
|
<div id="main">
|
||||||
|
<div class="alertbox initial_alertbox">{{range .Header.NoticeList}}{{template "notice.html" . }}{{end}}</div>
|
||||||
{{template "topic_inner.html" . }}
|
{{template "topic_inner.html" . }}
|
||||||
<aside class="midRight sidebar">{{dock "rightSidebar" .Header}}</aside>
|
</div>
|
||||||
|
<aside class="midRight sidebar">{{dock "rightSidebar" .Header}}</aside>
|
||||||
|
</div>
|
Loading…
Reference in New Issue