On Tue, Mar 31, 2009 at 4:22 PM, Henrik Marstrander <[email protected]> wrote: > > Made this preview based command for news from "volvo ocean race" > When I move the mouse over "read full story" I see there is a link, > but it when you press it it doesn work (you get this url > file:///news/article/2009/March/30-RIO-PUMA-JOB-LIST/index.aspx) > Any idea how this may be fixed. I have the same problem in all my > preview-commands
That's because the links/images have relative paths. You have to fix them manually (for now) like this: const URL = "http://www.volvooceanrace.org/"; function abspath() { var attr = this.hasAttribute("src") ? "src" : "href"; var path = this.getAttribute(attr); if(/^[a-z]+:/.test(path)) return; this[attr] = URL + (path[0] === "/" ? path.slice(1) : path); } CmdUtils.CreateCommand({ name: "volvo-news", preview: function(pblock) { jQuery.get(URL, function(html) { pblock.innerHTML = ""; jQuery(".hometeaser:nth(0)", html).find("a,img").each(abspath).end() .appendTo(pblock); }); pblock.innerHTML = "First thumbnail from wists"; }, execute: function() { Utils.openUrlInBrowser(URL); } }); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ubiquity-firefox" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ubiquity-firefox?hl=en -~----------~----~----~----~------~----~------~--~---
