Mirror of Quill
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.9 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. <div class="narrow">
  2. <?= partial('partials/header') ?>
  3. <div style="clear: both;" class="notice-pad">
  4. <div class="alert alert-success hidden" id="test_success"><strong>Success! </strong><a href="" id="post_href">View your post</a></div>
  5. <div class="alert alert-danger hidden" id="test_error"><strong>Something went wrong!</strong><br>Your Micropub endpoint indicated that something went wrong creating the post.</div>
  6. </div>
  7. <form role="form" style="margin-top: 20px;" id="note_form">
  8. <div class="form-group">
  9. <label for="repost_of">URL to Repost (<code>repost-of</code>)</label>
  10. <input type="text" id="repost_of" value="<?= $this->repost_of ?>" class="form-control">
  11. </div>
  12. <div style="float: right; margin-top: 6px;">
  13. <button class="btn btn-success" id="btn_post"><?= $this->url ? 'Save' : 'Post' ?></button>
  14. </div>
  15. <input type="hidden" id="edit_url" value="<?= $this->url ?>">
  16. </form>
  17. <div style="clear: both;"></div>
  18. </div>
  19. <script>
  20. $(function(){
  21. $("#btn_post").click(function(){
  22. $("#btn_post").addClass("loading disabled");
  23. $.post("/repost", {
  24. repost_of: $("#repost_of").val(),
  25. edit: $("#edit_url").val()
  26. }, function(response){
  27. if(response.location != false) {
  28. $("#test_success").removeClass('hidden');
  29. $("#test_error").addClass('hidden');
  30. $("#post_href").attr("href", response.location);
  31. $("#note_form").addClass('hidden');
  32. window.location = response.location;
  33. } else {
  34. $("#test_success").addClass('hidden');
  35. $("#test_error").removeClass('hidden');
  36. if(response.error_details) {
  37. $("#test_error").text(response.error_details);
  38. }
  39. $("#btn_post").removeClass("loading disabled");
  40. }
  41. });
  42. return false;
  43. });
  44. });
  45. </script>