Browse Source

Uninline forum post text saving JS

spaghetti 8 years ago
parent
commit
3ec74b811f
2 changed files with 10 additions and 13 deletions
  1. 1
    8
      design/views/generic/reply/quickreply.php
  2. 9
    5
      static/functions/comments.js

+ 1
- 8
design/views/generic/reply/quickreply.php View File

96
               </td>
96
               </td>
97
             </tr>
97
             </tr>
98
           </table>
98
           </table>
99
-          <form class="send_form center" name="reply" id="quickpostform" <?=isset($Action)?'action="'.$Action.'"':''?> method="post"<? if (!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled = true;"<? } ?>>
99
+          <form class="send_form center" name="reply" id="quickpostform" <?=isset($Action)?'action="'.$Action.'"':''?> method="post"<? if (!check_perms('users_mod')) { ?> onsubmit="quickpostform.submit_button.disabled = true;"<? } ?> <? if (!G::$LoggedUser['DisableAutoSave']) { ?>data-autosave-text="quickpost"<? } ?>>
100
             <input type="hidden" name="action" value="<?=$InputAction?>" />
100
             <input type="hidden" name="action" value="<?=$InputAction?>" />
101
             <input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
101
             <input type="hidden" name="auth" value="<?=G::$LoggedUser['AuthKey']?>" />
102
             <input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" />
102
             <input type="hidden" name="<?=$InputName?>" value="<?=$InputID?>" />
130
 ?>
130
 ?>
131
               <input id="mergebox" type="checkbox" name="merge" tabindex="2" />
131
               <input id="mergebox" type="checkbox" name="merge" tabindex="2" />
132
               <label for="mergebox">Merge</label>
132
               <label for="mergebox">Merge</label>
133
-<?
134
-    }
135
-    if (!G::$LoggedUser['DisableAutoSave']) {
136
-?>
137
-              <script type="application/javascript">
138
-                var storedTempTextarea = new StoreText('quickpost', 'quickpostform', <?=$InputID?>);
139
-              </script>
140
 <?
133
 <?
141
     }
134
     }
142
   }
135
   }

+ 9
- 5
static/functions/comments.js View File

421
     }
421
     }
422
 
422
 
423
   })
423
   })
424
-
425
-  document.querySelectorAll('[quote-jump]').forEach(function(el) {
426
-    el.addEventListener('click', function(event) {
427
-      QuoteJump(event, el.attributes['quote-jump'].value)
428
-    })
424
+})
425
+document.querySelectorAll('[quote-jump]').forEach(function(el) {
426
+  el.addEventListener('click', function(event) {
427
+    QuoteJump(event, el.attributes['quote-jump'].value)
429
   })
428
   })
430
 })
429
 })
430
+
431
+if ($('[data-autosave-text]').raw()) {
432
+  var el = $('[data-autosave-text]').raw()
433
+  var storedTempTextarea = new StoreText(el.attributes['data-autosave-text'].value, el.id, $('[data-autosave-text] > [name="thread"]').raw().attributes['value'].value);
434
+}

Loading…
Cancel
Save