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.

73 lines
2.4 KiB

  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><br>Your post should be on your website now!<br><a href="" id="post_href">View your post</a></div>
  5. <div class="alert alert-danger hidden" id="test_error"><strong>Your endpoint did not return a Location header.</strong><br>See <a href="/creating-a-micropub-endpoint">Creating a Micropub Endpoint</a> for more information.</div>
  6. </div>
  7. <form role="form" style="margin-top: 20px;" id="note_form">
  8. <div class="form-group">
  9. <label for="like_of">URL to Favorite (<code>like-of</code>)</label>
  10. <input type="text" id="like_of" value="<?= $this->like_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. <hr>
  19. <div style="text-align: right;" id="bookmarklet">
  20. Bookmarklet: <a href="javascript:<?= js_bookmarklet('partials/favorite-bookmarklet', $this) ?>" class="btn btn-default btn-xs">favorite</a>
  21. </div>
  22. </div>
  23. <script>
  24. $(function(){
  25. $("#btn_post").click(function(){
  26. $("#btn_post").addClass("loading disabled").text("Working...");
  27. var syndications = [];
  28. $("#syndication-container button.btn-info").each(function(i,btn){
  29. syndications.push($(btn).data('syndication'));
  30. });
  31. $.post("/favorite", {
  32. like_of: $("#like_of").val(),
  33. edit: $("#edit_url").val()
  34. }, function(response){
  35. if(response.location != false) {
  36. $("#test_success").removeClass('hidden');
  37. $("#test_error").addClass('hidden');
  38. $("#post_href").attr("href", response.location);
  39. window.location = response.location;
  40. } else {
  41. $("#test_success").addClass('hidden');
  42. $("#test_error").removeClass('hidden');
  43. $("#btn_post").removeClass("loading disabled").text("Post");
  44. }
  45. });
  46. return false;
  47. });
  48. <? if($this->autosubmit): ?>
  49. $(".footer, #bookmarklet").hide();
  50. $("#btn_post").click();
  51. <? endif ?>
  52. bind_syndication_buttons();
  53. });
  54. <?= partial('partials/syndication-js') ?>
  55. </script>