Note that there are some explanatory texts on larger screens.

plurals
  1. POInteracting with DOM for AJAX webpages?
    primarykey
    data
    text
    <p>hey guys, I'm not experienced with developing extensions, but I'm doing it to learn. I'd like to make an extension that blocks only certain twitter icons. By looking through this <a href="http://code.google.com/edu/submissions/html-css-javascript/" rel="nofollow">tutorial</a> I have figured out a lot. I am able to the tweets from the DOM, check for the username, and disable the display of that image with JavaScript.</p> <p>I got this far by creating a fake page, let's call it twitter.html, that looks a little like this:</p> <pre><code>&lt;html&gt; &lt;div class="stream-item" data-item-type="tweet"&gt; &lt;div class="tweet-image"&gt; &lt;img src="abc.jpg" data-user-id="1234"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>.....</p> <pre><code>&lt;script src="utility.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var tweets = getElementsByClass("tweet"); for (var i = 0; i &lt; tweets.length; i++) { var tweet = tweets[i]; var name = tweet.getAttribute("data-screen-name"); if (name.toLowerCase() == 'some-username'.toLowerCase()) { var icon = tweet.getElementsByTagName("img")[0]; icon.style.display='none'; } } &lt;/script&gt; &lt;/html&gt; </code></pre> <p>So <em>hiding</em> the images isn't the problem, but getting the coe to run at the right time is. I'm using Safari extension builder allows me to supply a main page, as well as before-load and after-load js files. However, the page load is "finished" before any tweets get loaded due to the AJAX stuff the real twitter.com uses.</p> <p>How do I get my js code to run <em>after</em> tweets are loaded?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload