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.

46 lines
1.4 KiB

  1. function reload_syndications() {
  2. $.getJSON("/micropub/syndications", function(data){
  3. if(data.targets) {
  4. $("#syndication-container").html('<ul></ul>');
  5. for(var i in data.targets) {
  6. var target = data.targets[i].target;
  7. var uid = data.targets[i].uid;
  8. var favicon = data.targets[i].favicon;
  9. $("#syndication-container ul").append('<li><button data-syndicate-to="'+htmlspecialchars(uid ? uid : target)+'" class="btn btn-default btn-block">'+(favicon ? '<img src="'+htmlspecialchars(favicon)+'" width="16" height="16"> ':'')+htmlspecialchars(target)+'</button></li>');
  10. }
  11. bind_syndication_buttons();
  12. } else {
  13. }
  14. console.log(data);
  15. });
  16. }
  17. function bind_syndication_buttons() {
  18. $("#syndication-container button").unbind("click").click(function(){
  19. $(this).toggleClass('btn-info');
  20. if(window.saveNoteState) {
  21. saveNoteState();
  22. }
  23. return false;
  24. });
  25. }
  26. function reload_channels() {
  27. $.getJSON("/micropub/channels", function(data){
  28. console.log(data);
  29. if(data.channels) {
  30. $("#channel-container").html('<select class="form-control" name="channel"></select>');
  31. for(var i in data.channels) {
  32. var channel = data.channels[i];
  33. $("#channel-container select").append('<option value="'+htmlspecialchars(channel)+'">'+htmlspecialchars(channel)+'</option>');
  34. }
  35. } else {
  36. }
  37. console.log(data);
  38. });
  39. }