Labs/Ubiquity/Writing A Search Command: Difference between revisions

Line 206: Line 206:
</pre>
</pre>


=== Using functions in the parser ===
// ToDo: Not a good example any more
CmdUtils.makeSearchCommand({
CmdUtils.makeSearchCommand({
  name: "MovieZoo",
  name: "MovieZoo",
  url: "http://www.moviezoo.dk/alle-produkter/soeg/{QUERY}",
  url: "http://www.moviezoo.dk/alle-produkter/soeg/{QUERY}",
  parser: {
  parser: {
    container: "table.nyhedsbrev_tabel2",
    container: "table.nyhedsbrev_tabel2",
    title: "tr:nth-child(2) tr tr:first-child b",
    title: "tr:nth-child(2) tr tr:first-child b",
    href: function(c) {return jQuery("a.nyhedsbrev",c).attr("href");},
    href: function () $("a.nyhedsbrev", this),
    preview: function(c) {var p = ""; jQuery("table table tr:not(:first)",c).each(function(){p += jQuery(this).text()+"<br>";});return p;},
    body: function () $("table table tr:not(:first)", this),
    thumbnail: "img.lister_img",
    thumbnail: "img.lister_img",
    maxResults: 3
    maxResults: 3,
  }
  },
});
});


=== Searching with a different charset ===
=== Searching with a different charset ===
73

edits