|
With this patch LongURL Mobile Expander will handle AJAXA Loaded Content like the new posts you get when you click "more" on twitter.
--- 32115.user.js 2009-05-13 13:25:25.015625000 +0200
+++ longurl_mobile_expander.user.js 2009-05-13 13:30:08.843750000 +0200
@@ -45,6 +45,7 @@
onload: function(response) {
saveSupportedServices(response);
modifyShortLinks();
+ document.addEventListener("DOMNodeInserted", function(e) {modifyShortLinks(e.relatedNode);}, false);
}
});
};
@@ -78,8 +79,12 @@
setValue('longurl_expire_services', date.toUTCString());
};
- modifyShortLinks = function() {
- var links = document.evaluate("//a[@href]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
+ modifyShortLinks = function(context) {
+ if (typeof context == 'undefined') {
+ context = document
+ }
+
+ var links = document.evaluate("//a[@href]", context, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var x = 0; x < links.snapshotLength; x++) {
var a = links.snapshotItem(x);
@@ -275,6 +280,7 @@
if (serialized_services && services_expire > now.getTime()) {
this.known_services = eval('(' + serialized_services + ')');
modifyShortLinks();
+ document.addEventListener("DOMNodeInserted", function(e) {modifyShortLinks(e.relatedNode);}, false);
} else {
getServicesFromAPI();
}
|