forked from rDrama/rDrama
use console.error instead of console.log in cases of error
parent
ab8ec6bfc5
commit
cb37d3273f
|
@ -139,7 +139,7 @@ function buy(mb) {
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = function() {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
||||||
showToast(success, getMessageFromJsonData(success, data), true);
|
showToast(success, getMessageFromJsonData(success, data), true);
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ function banModal(link, name, fullname, cls) {
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = function() {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
||||||
showToast(success, getMessageFromJsonData(success, data));
|
showToast(success, getMessageFromJsonData(success, data));
|
||||||
document.getElementById(`unban-${fullname}`).classList.toggle(cls);
|
document.getElementById(`unban-${fullname}`).classList.toggle(cls);
|
||||||
|
@ -31,7 +31,7 @@ function chudModal(link, name, fullname, cls) {
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = function() {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
||||||
showToast(success, getMessageFromJsonData(success, data));
|
showToast(success, getMessageFromJsonData(success, data));
|
||||||
document.getElementById(`unchud-${fullname}`).classList.toggle(cls);
|
document.getElementById(`unchud-${fullname}`).classList.toggle(cls);
|
||||||
|
|
|
@ -135,7 +135,7 @@ function post_reply(id){
|
||||||
|
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
if (data && data["comment"]) {
|
if (data && data["comment"]) {
|
||||||
const comments = document.getElementById('replies-of-c_' + id);
|
const comments = document.getElementById('replies-of-c_' + id);
|
||||||
const comment = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`);
|
const comment = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`);
|
||||||
|
@ -191,7 +191,7 @@ function comment_edit(id){
|
||||||
|
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr[0].response)}
|
try {data = JSON.parse(xhr[0].response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
if (data && data["comment"]) {
|
if (data && data["comment"]) {
|
||||||
commentForm=document.getElementById('comment-text-'+id);
|
commentForm=document.getElementById('comment-text-'+id);
|
||||||
commentForm.innerHTML = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)
|
commentForm.innerHTML = data["comment"].replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, '').replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)
|
||||||
|
@ -248,7 +248,7 @@ function post_comment(fullname, hide){
|
||||||
|
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
if (data && data["comment"]) {
|
if (data && data["comment"]) {
|
||||||
if (hide) document.getElementById(hide).classList.add('d-none');
|
if (hide) document.getElementById(hide).classList.add('d-none');
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ function handle_action(type, cid, thing) {
|
||||||
xhr.onload=function(){
|
xhr.onload=function(){
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
if (data && data["response"]) {
|
if (data && data["response"]) {
|
||||||
const element = document.getElementById(`${type}-${cid}`);
|
const element = document.getElementById(`${type}-${cid}`);
|
||||||
element.innerHTML = data["response"].replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)
|
element.innerHTML = data["response"].replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)
|
||||||
|
|
|
@ -38,7 +38,7 @@ function report_postModal(id) {
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
let data
|
let data
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
success = xhr.status >= 200 && xhr.status < 300;
|
success = xhr.status >= 200 && xhr.status < 300;
|
||||||
showToast(success, getMessageFromJsonData(success, data));
|
showToast(success, getMessageFromJsonData(success, data));
|
||||||
};
|
};
|
||||||
|
|
|
@ -129,7 +129,7 @@ function checkRepost() {
|
||||||
|
|
||||||
xhr.onload=function(){
|
xhr.onload=function(){
|
||||||
try {data = JSON.parse(xhr.response)}
|
try {data = JSON.parse(xhr.response)}
|
||||||
catch(e) {console.log(e)}
|
catch(e) {console.error(e)}
|
||||||
|
|
||||||
if (data && data["permalink"]) {
|
if (data && data["permalink"]) {
|
||||||
const permalinkText = escapeHTML(data["permalink"]);
|
const permalinkText = escapeHTML(data["permalink"]);
|
||||||
|
|
Loading…
Reference in New Issue