heartbeat.js 1021 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Created by logicp on 5/28/17.
  3. */
  4. (function($, Drupal, drupalSettings) {
  5. Drupal.behaviors.heartbeat = {
  6. attach: function (context, settings) {
  7. Drupal.AjaxCommands.prototype.selectFeed = function(ajax, response, status) {
  8. console.log(response.feed);
  9. console.dir(drupalSettings);
  10. console.dir(context);
  11. console.dir(settings);
  12. $.ajax({
  13. type:'POST',
  14. url:'/heartbeat/render_feed/' + response.feed,
  15. success: function(response) {
  16. // feedElement = document.getElementById('block-heartbeatblock');
  17. feedElement = document.querySelector('.heartbeat-stream');
  18. feedElement.innerHTML = response;
  19. console.dir(feedElement);
  20. console.dir(response);
  21. }
  22. });
  23. // #block-heartbeatblock
  24. }
  25. }
  26. }
  27. })(jQuery, Drupal, drupalSettings);