accelerate other view topic entrypoints
This commit is contained in:
parent
5a9e0c72d3
commit
3d87ad8895
|
@ -6,8 +6,8 @@ var alertCount=0;
|
|||
var moreTopicCount=0;
|
||||
var conn=false;
|
||||
var selectedTopics=[];
|
||||
var attachItemCallback=function(){}
|
||||
var quoteItemCallback=function(){}
|
||||
var attachItemCallback=()=>{}
|
||||
var quoteItemCallback=()=>{}
|
||||
var baseTitle=document.title;
|
||||
var wsBackoff=0;
|
||||
var noAlerts=false;
|
||||
|
@ -872,15 +872,13 @@ function mainInit(){
|
|||
return name.split('?')[0];
|
||||
}
|
||||
|
||||
$(".rowtopic a,a.rowtopic").click(function(ev) {
|
||||
let base = this.getAttribute("href");
|
||||
let href = base + "?i=1";
|
||||
function loadArb(base,href) {
|
||||
fetch(href,{credentials:"same-origin"})
|
||||
.then(resp => {
|
||||
if(!resp.ok) throw(href+" failed to load");
|
||||
let xRes = resp.headers.get("x-res")
|
||||
if(xRes!=null) {
|
||||
for(let res of xRes.split(",")) {
|
||||
let xr = resp.headers.get("x-res")
|
||||
if(xr!=null) {
|
||||
for(let res of xr.split(",")) {
|
||||
let pro;
|
||||
if(stripQ(getExt(res))=="css") pro = asyncGetSheet("/s/"+res)
|
||||
else pro = asyncGetScript("/s/"+res)
|
||||
|
@ -893,8 +891,8 @@ function mainInit(){
|
|||
}
|
||||
}
|
||||
return resp.text();
|
||||
}).then(data => {
|
||||
document.querySelector("#back").outerHTML = data;
|
||||
}).then(dat => {
|
||||
document.querySelector("#back").outerHTML = dat;
|
||||
unbindTopic();
|
||||
bindTopic();
|
||||
$(".elapsed").remove();
|
||||
|
@ -905,7 +903,11 @@ function mainInit(){
|
|||
console.log("e",e);
|
||||
console.trace();
|
||||
});
|
||||
}
|
||||
|
||||
$(".rowtopic a,a.rowtopic,a.forum_poster").click(function(ev) {
|
||||
let base = this.getAttribute("href");
|
||||
loadArb(base,base+"?i=1");
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
})
|
||||
|
@ -1012,9 +1014,9 @@ function bindTopic() {
|
|||
$(bp).find('.hide_on_block_edit').removeClass("edit_opened");
|
||||
$(bp).find('.show_on_block_edit').removeClass("edit_opened");
|
||||
block.classList.remove("in_edit");
|
||||
let content = block.querySelector('textarea').value;
|
||||
block.innerHTML = quickParse(content);
|
||||
if(srcNode!=null) srcNode.innerText = content;
|
||||
let con = block.querySelector('textarea').value;
|
||||
block.innerHTML = quickParse(con);
|
||||
if(srcNode!=null) srcNode.innerText = con;
|
||||
|
||||
let formAction = this.closest('a').getAttribute("href");
|
||||
// TODO: Bounce the parsed post back and set innerHTML to it?
|
||||
|
@ -1022,7 +1024,7 @@ function bindTopic() {
|
|||
url: formAction,
|
||||
type:"POST",
|
||||
dataType:"json",
|
||||
data: { js: 1, edit_item: content },
|
||||
data: { js: 1, edit_item: con },
|
||||
error: ajaxError,
|
||||
success: (dat,status,xhr) => {
|
||||
if("Content" in dat) block.innerHTML = dat["Content"];
|
||||
|
@ -1035,14 +1037,14 @@ function bindTopic() {
|
|||
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 con = document.getElementById("input_content")
|
||||
console.log("con.value",con.value);
|
||||
|
||||
let item;
|
||||
if(content.value=="") item = "<blockquote>"+src.innerHTML+"</blockquote>"
|
||||
if(con.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);
|
||||
con.value = con.value+item;
|
||||
console.log("con.value",con.value);
|
||||
|
||||
// For custom / third party text editors
|
||||
quoteItemCallback(src.innerHTML,item);
|
||||
|
@ -1054,7 +1056,7 @@ function bindTopic() {
|
|||
$("#poll_results_"+pollID).removeClass("auto_hide");
|
||||
fetch("/poll/results/"+pollID, {
|
||||
credentials: 'same-origin'
|
||||
}).then(resp => resp.text()).catch(er => console.error("er",er)).then(rawData => {
|
||||
}).then(resp => resp.text()).catch(e => console.error("e",e)).then(rawData => {
|
||||
// TODO: Make sure the received data is actually a list of integers
|
||||
let data = JSON.parse(rawData);
|
||||
let allZero = true;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<span class="forum_right shift_right">
|
||||
{{if .LastReplyer.MicroAvatar}}<img class="extra_little_row_avatar"src="{{.LastReplyer.MicroAvatar}}"height=64 width=64 alt="Avatar"title="{{.LastReplyer.Name}}'s Avatar"aria-hidden="true">{{end}}
|
||||
<span>
|
||||
<a {{if .LastTopic.Link}}href="{{.LastTopic.Link}}"{{else}}class="forum_no_poster"{{end}}>{{if .LastTopic.Title}}{{.LastTopic.Title}}{{else}}{{lang "forums_none"}}{{end}}</a>
|
||||
<a {{if .LastTopic.Link}}class="forum_poster"href="{{.LastTopic.Link}}"{{else}}class="forum_no_poster"{{end}}>{{if .LastTopic.Title}}{{.LastTopic.Title}}{{else}}{{lang "forums_none"}}{{end}}</a>
|
||||
{{if .LastTopicTime}}<br><span class="rowsmall"title="{{abstime .LastTopic.LastReplyAt}}">{{.LastTopicTime}}</span>{{end}}
|
||||
</span>
|
||||
</span><div style="clear:both;"></div>
|
||||
|
|
Loading…
Reference in New Issue