Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a couple of things I had to do in order to get this to work. First, when dynamically generating the HTML, I assigned a unique class to all of the elements I wanted to make clickable (and simulate the onclick behavior). After the display had been generated, I pulled all spans on the page as such:</p> <p><code>var span = document.getElementsByTagName('span');</code></p> <p>and then iterated through them, adding an event listener to the ones where I needed a clickable action:</p> <pre><code>for(var i=0; i&lt;span.length; i++){ if (span[i].className == "firstUniqueClass") { span[i].addEventListener("click", firstUniqueFunction, false); } else if (span[i].className == "secondUniqueClass") { span[i].addEventListener("click", secondUniqueFunction, false); } } </code></pre> <p>In short, what this gives me is the ability to assign a function whenever there's a click event on one of those spans. Unfortunately, I also wanted to pass variables to my functions. I ended up having to encode those in the element, in pseudo-RDF, and then decoding it in the function. For instance, if I added 'data:url="http://www.google.com/"', I'd regenerate it as such:</p> <pre><code>function copyLink(event) { var startPos = event.currentTarget.outerHTML.indexOf('data:url="') + 10; var endPos = event.currentTarget.outerHTML.indexOf('"', startPos + 2); var link = event.currentTarget.outerHTML.slice(startPos, endPos); } </code></pre> <p>Tada. A hackish way to reenable the onclick event in Adobe AIR.</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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