tempfix csp topic transition bug

This commit is contained in:
Azareal 2020-07-15 08:01:11 +10:00
parent b1af963916
commit eeb932bd4b
1 changed files with 13 additions and 15 deletions

View File

@ -264,8 +264,8 @@ function runWebSockets(resume=false) {
let data = ""; let data = "";
try { try {
data = JSON.parse(event.data); data = JSON.parse(event.data);
} catch(err) { } catch(e) {
console.log(err); console.log(e);
return; return;
} }
@ -595,8 +595,7 @@ function mainInit(){
that.classList.add("filter_selected"); that.classList.add("filter_selected");
$(".topic_list_title h1").text(that.innerText); $(".topic_list_title h1").text(that.innerText);
}).catch(e => { }).catch(e => {
console.log("Unable to get script '"+url+"&js=1"+"'"); console.log("Unable to get script '"+url+"&js=1"+"'",e);
console.log("e",e);
console.trace(); console.trace();
}); });
}); });
@ -641,8 +640,7 @@ function mainInit(){
rebuildPaginator(data.LastPage); rebuildPaginator(data.LastPage);
rebindPaginator(); rebindPaginator();
}).catch(e => { }).catch(e => {
console.log("Unable to get script '"+url+q+"&js=1"+"'"); console.log("Unable to get script '"+url+q+"&js=1"+"'",e);
console.log("e",e);
console.trace(); console.trace();
}); });
}); });
@ -658,13 +656,13 @@ function mainInit(){
$(".submit_edit").click(function(ev) { $(".submit_edit").click(function(ev) {
ev.preventDefault(); ev.preventDefault();
let bp = $(this).closest('.editable_parent'); let bp = $(this).closest('.editable_parent');
let block = bp.find('.editable_block').eq(0); let bl = bp.find('.editable_block').eq(0);
let content = block.find('input').eq(0).val(); let content = bl.find('input').eq(0).val();
block.html(content); bl.html(content);
let formAction = $(this).closest('a').attr("href"); let formAction = $(this).closest('a').attr("href");
$.ajax({ $.ajax({
url: formAction + "?s=" + me.User.S, url: formAction+"?s="+me.User.S,
type:"POST", type:"POST",
dataType:"json", dataType:"json",
error: ajaxError, error: ajaxError,
@ -717,7 +715,7 @@ function mainInit(){
var fieldType = this.getAttribute("data-type"); var fieldType = this.getAttribute("data-type");
if(fieldType=="list") { if(fieldType=="list") {
var newContent = $(this).find('select :selected').text(); var newContent = $(this).find('select :selected').text();
this.classList.add(fieldName + '_' + newContent); this.classList.add(fieldName+'_'+newContent);
this.innerHTML = ""; this.innerHTML = "";
} else if(fieldType=="hidden") { } else if(fieldType=="hidden") {
var newContent = $(this).val(); var newContent = $(this).val();
@ -732,7 +730,7 @@ function mainInit(){
let href = $(this).closest('a').attr("href"); let href = $(this).closest('a').attr("href");
//console.log("href",href); //console.log("href",href);
//console.log(outData); //console.log(outData);
$.ajax({ url: href + "?s=" + me.User.S, type:"POST", dataType:"json", data: outData, error: ajaxError }); $.ajax({ url: href+"?s="+me.User.S, type:"POST", dataType:"json", data: outData, error: ajaxError });
bp.find('.hide_on_edit').removeClass("edit_opened"); bp.find('.hide_on_edit').removeClass("edit_opened");
bp.find('.show_on_edit').removeClass("edit_opened"); bp.find('.show_on_edit').removeClass("edit_opened");
}); });
@ -864,7 +862,7 @@ function mainInit(){
return name.split('?')[0]; return name.split('?')[0];
} }
function loadArb(base,href,h = null) { function loadArb(base,href,h=null) {
fetch(href,{credentials:"same-origin"}) fetch(href,{credentials:"same-origin"})
.then(resp => { .then(resp => {
if(!resp.ok) throw(href+" failed to load"); if(!resp.ok) throw(href+" failed to load");
@ -894,7 +892,7 @@ function mainInit(){
}); });
} }
$(".rowtopic a,a.rowtopic,a.forum_poster").click(function(ev) { /*$(".rowtopic a,a.rowtopic,a.forum_poster").click(function(ev) {
let base = this.getAttribute("href"); let base = this.getAttribute("href");
loadArb(base,base+"?i=1", () => { loadArb(base,base+"?i=1", () => {
unbindTopic(); unbindTopic();
@ -902,7 +900,7 @@ function mainInit(){
}); });
ev.stopPropagation(); ev.stopPropagation();
ev.preventDefault(); ev.preventDefault();
}) })*/
$("a").click(function(ev) { $("a").click(function(ev) {
let base = this.getAttribute("href"); let base = this.getAttribute("href");
if(base!="/topics/") return; if(base!="/topics/") return;