Guest User

Untitled

a guest
Aug 12th, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.15 KB | None | 0 0
  1. --- "a/src/Dollchan_Extension_Tools.es6.user.js"
  2. +++ "b/src/Dollchan_Extension_Tools.es6.user.js"
  3. @@ -10470,8 +10470,8 @@ class AbstractPost {
  4.                     const num = +temp.id.match(/\d+/);
  5.                     $ajax(`/api/${ task }?board=${ aib.b }&num=${ num }`).then(xhr => {
  6.                         const obj = JSON.parse(xhr.responseText);
  7. -                       if(obj.Status !== 'OK') {
  8. -                           $popup('err-2chlike', obj.Reason);
  9. +                       if(obj.result !== 1) {
  10. +                           $popup('err-2chlike', Lng.error[lang] + ': ' + obj.error.message);
  11.                             return;
  12.                         }
  13.                         temp.classList.add(`${ task }-div-checked`, `post__rate_${ task }d`);
  14. @@ -16393,21 +16393,25 @@ function getImageBoard(checkDomains, checkEngines) {
  15.                     inpEl.classList.add('de-input-error');
  16.                     return;
  17.                 }
  18. -               const formData = new FormData();
  19. -               formData.append('task', 'report');
  20. -               formData.append('board', this.b);
  21. -               formData.append('thread', tNum);
  22. -               formData.append('posts', pNum);
  23. -               formData.append('comment', inpEl.value);
  24. +               var formData = new FormData();
  25. +               var data = {'board': this.b, 'thread': tNum, 'post': pNum, 'comment': inpEl.value};
  26. +               for (var key in data) {
  27. +                   formData.append(key, data[key]);
  28. +               }
  29.                 closePopup('edit-report');
  30.                 $popup('report', Lng.sending[lang], true);
  31. -               $ajax('/makaba/makaba.fcgi?json=1', { method: 'POST', data: formData }).then(xhr => {
  32. +               $ajax('/user/report', {
  33. +                   method: 'POST',
  34. +                   data: formData,
  35. +                   success() {},
  36. +                   contentType: false,
  37. +                   processData: false
  38. +               }).then(xhr => {
  39.                     let obj;
  40.                     try {
  41.                         obj = JSON.parse(xhr.responseText);
  42.                     } catch(err) {}
  43. -                   $popup('report', !obj ? Lng.error[lang] + ': ' + xhr.responseText :
  44. -                       (obj.message || Lng.succReported[lang]) + ': ' + obj.message_title);
  45. +                   $popup('report', obj.result === 1 ? Lng.succReported[lang] : Lng.error[lang] + ': ' + obj.error.message);
  46.                 });
  47.             });
  48.             Object.defineProperty(this, 'reportForm', { value });
  49. @@ -16495,7 +16499,7 @@ function getImageBoard(checkDomains, checkEngines) {
  50.         }
  51.         fixFileInputs(el) {
  52.             el.innerHTML = Array.from({ length: 8 }, (val, i) =>
  53. -               `<div${ i ? ' style="display: none;"' : '' }><input type="file" name="formimages[]"></div>`
  54. +               `<div${ i ? ' style="display: none;"' : '' }><input type="file" name="file[]"></div>`
  55.             ).join('');
  56.         }
  57.         getBanId(postEl) {
  58. @@ -16520,15 +16524,27 @@ function getImageBoard(checkDomains, checkEngines) {
  59.             };
  60.             return this.getSage(post);
  61.         }
  62. +       fixHTMLHelper(str) {
  63. +           str = str.replace(/<a href="https?:\/\/[^>]+>https?:\/\/[^<]+<\/a>[^<$\s\n]+/ig, function (match) {
  64. +               try {
  65. +                   match = match.replace(/<\/a>/ig, "") + "</a>"
  66. +                   var newUrl = '"' + match.match( /(?:>)https?:\/\/[^<]+/ig )[ 0 ].substring(1);
  67. +                   match = match.replace( /"https?:\/\/[^"]+/ig, newUrl );
  68. +               } catch (err) {}
  69. +               return match;
  70. +           });
  71. +           return str;
  72. +       }
  73.         getSubmitData(json) {
  74.             let error = null;
  75.             let postNum = null;
  76. -           if(json.Status === 'OK') {
  77. -               postNum = +json.Num;
  78. -           } else if(json.Status === 'Redirect') {
  79. -               postNum = +json.Target;
  80. +           if(json.result === 1) {
  81. +               postNum = +json.num;
  82. +               if(json.thread > 0) {
  83. +                   postNum = +json.thread;
  84. +               }
  85.             } else {
  86. -               error = Lng.error[lang] + ': ' + json.Reason;
  87. +               error = Lng.error[lang] + ': ' + json.error.message;
  88.             }
  89.             return { error, postNum };
  90.         }
  91. @@ -18595,7 +18611,7 @@ function updateCSS() {
  92.     ${ Cfg.ajaxPosting ? '' : '.de-file-btn-rar, .de-file-btn-txt, ' }
  93.     ${ Cfg.fileInputs ? '' : '.de-file-txt-wrap, .de-file-btn-txt, ' }
  94.     ${ !aib.formHeaders && (aib.multiFile || Cfg.fileInputs !== 2) ?
  95. -       '#de-pform form > table > tbody > tr > td:not([colspan]):first-child, #de-pform form > table > tbody > tr > th:first-child, ' : '' }body > hr, .postarea, .theader { display: none !important; }\r\n`;
  96. +       '#de-pform form > table > tbody > tr > td:not([colspan]):first-child, #de-pform form > table > tbody > tr > th:first-child, ' : '' }body > hr, .theader { display: none !important; }\r\n`;
  97.     $id('de-css-dynamic').textContent = (x + aib.css).replace(/[\r\n\t]+/g, '\r\n\t');
  98.     $id('de-css-user').textContent = Cfg.userCSS ? Cfg.userCSSTxt : '';
  99.  }
  100.  
Add Comment
Please, Sign In to add comment