Capture Twitter Status History Updates / Infinite Scroll Updates

I use KRL to enter items in timeline statuses similar to Jesse Stay TwitterBooks. The problem is that these elements are only associated with the statuses that are currently visible when the bookmarklet starts. If a new status is added via a “new tweet”, updated through Ajaxor through status updates through an endless scroll, these new statuses are untouched.

Is there a way to poll for new statuses or feel the event of Twitter status update via KRL, to enter elements only in these newly added statuses?

+3
source share
1 answer

,

http://kynetxappaday.wordpress.com/2010/12/25/day-21-modifying-facebook-stream-with-kynetx/

Facebook,

  • setTimeout
  • ,

ruleset a60x512 {
  meta {
    name "MikeGrace-status-update-translator"
    description <<
      MikeGrace-status-update-translator
    >>
    author "Mike Grace"
    logging on
  }

  global {
    datasource insult:HTML <- "http://www.pangloss.com/seidel/Shaker/index.html?" cachable for 1 second;
  }
  rule find_status_updates_by_mike_grace {
    select when pageview ".*"
    {
      notify("Starting to look for status upates by Mike Grace","");
      emit <|

        // get app object to raise web events
        app = KOBJ.get_application("a60x512");

        // function that finds FB status updates by Mike Grace
        function findMikeGrace() {

          // loop through each stream item on the page that hasn't been processed already by the app
          $K("li[id^=stream_story]:not(li[kfbt])").each(function() {
            var currentStreamItem = this;
            // grab the current stream item posters name
            var name = $K(currentStreamItem).find(".actorName").text();

            // mark the stream item as being processed to reduce future processing times
            $K(currentStreamItem).attr("kfbt","y");

            // is the stream item by the perpetrator?
            if (name == "Michael Grace") {

              // strikethrough the original update
              $K(currentStreamItem).find(".messageBody").wrap("<strike />");

              // get selector to return translation of status update
              var returnSelector = $K(currentStreamItem).attr("id");
              returnSelector = "li#"+returnSelector+" .messageBody";

              // raise web event to get translation for non geeks
              app.raise_event("get_insult", {"returnSelector":returnSelector});

            } // end of checking name

          }); // end of looping through unprocessed stream items

          // call myself again later to process new items on the page
          setTimeout(function() {
            findMikeGrace();
          }, 9000);
        }

        // start the process of finding the perpetrator
        findMikeGrace();
      |>;
    }
  }

  rule get_insult {
    select when web get_insult
    pre {
      selector = event:param("returnSelector");
      insulter = datasource:insult("#{selector}");
      foundInsult = insulter.query("font");
      singleInsult = foundInsult[0];
    }
    {
      emit <|
        console.log(singleInsult);
        $K(selector).parent().after("<br/>"+singleInsult);
      |>;
    }
  }
}
+3

Source: https://habr.com/ru/post/1782479/


All Articles