Thread Post Drafts

Save drafts of posts

  1. // ==UserScript==
  2. // @name Thread Post Drafts
  3. // @namespace pxgamer
  4. // @version 0.2
  5. // @description Save drafts of posts
  6. // @author pxgamer
  7. // @include *kat.cr/community/update/*/
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var threadId = window.location.href.split('/')[5];
  16. var fieldArea = $('#bbcode');
  17. var dataPreview = $('span.ka.ka-preview.bbedit-preview');
  18.  
  19. $('.bbedit-toolbar').css('width', '500px');
  20.  
  21. dataPreview.after(' <span title="Save Draft" class="ka saveDraftPX"><img src="https://pximg.xyz/images/b0d12ae13df1b376ac6557c488fb50f4.png" style="padding: 0 0 0px 2px; height: 18px; width: 18px;" /></span> <span title="Open Draft" class="ka openDraftPX"><img src="https://pximg.xyz/images/cd7c008c14979811583db3afc7b83fed.png" style="padding: 0 0 0px 2px; height: 18px; width: 18px;" /></span>');
  22.  
  23. $('.saveDraftPX').on('click', function() {
  24. GM_setValue('thread_' + threadId, fieldArea.val());
  25. });
  26.  
  27. $('.openDraftPX').on('click', function() {
  28. var saved = GM_getValue('thread_' + threadId, '');
  29. if (saved === '') {
  30. alert('No Drafts Saved for this Thread');
  31. }
  32. else {
  33. fieldArea.val(saved);
  34. }
  35. });
  36. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址