XLR

megidochan scripts

XLR
Aug 7th, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // paste image from clipboard into reply
  2. document.body.addEventListener('paste', (e) => {
  3.     if (e.target.id === 'qrbody' || e.target.id === 'fieldMessage') {
  4.         for (let i = 0; i < e.clipboardData.files.length; i++) {
  5.             const file = e.clipboardData.files[i];
  6.             if (file.type.startsWith('image')) {
  7.                 postCommon.addSelectedFile(file);
  8.             }
  9.         }
  10.     }
  11. });
  12.  
  13. // restore flag on new posts
  14. const flagCombobox = document.getElementById('flagCombobox');
  15. flagCombobox.value = JSON.parse(localStorage.savedFlags)['homosuck'];
  16. flagCombobox.dispatchEvent(new Event('change'));
  17.  
  18. // qr and regular reply forms act like real forms
  19. document.getElementById('formButton').type = 'submit';
  20. const qrForm = document.createElement('form');
  21. qrForm.appendChild(document.getElementById('post-form-inner'));
  22. document.getElementById('quick-reply').appendChild(qrForm);
  23. const qrButton = document.getElementById('qrbutton');
  24. qrButton.type = 'submit';
  25. qrButton.onclick = null;
  26. qrForm.addEventListener('submit', (e) => {
  27.     qrButton.disabled = true;
  28.     e.preventDefault();
  29.     thread.postReply();
  30. });
Advertisement
Add Comment
Please, Sign In to add comment