73
edits
m (→type) |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 140: | Line 140: | ||
Specifies the type of remote data to retrieve. (same as <code>[http://api.jquery.com/jQuery.ajax/ jQuery.ajax()]</code>'s <code>dataType</code> option). If <code>"json"</code> is passed, the parser switches to JSON mode. | Specifies the type of remote data to retrieve. (same as <code>[http://api.jquery.com/jQuery.ajax/ jQuery.ajax()]</code>'s <code>dataType</code> option). If <code>"json"</code> is passed, the parser switches to JSON mode. | ||
==== url ==== | ==== url / postData ==== | ||
Alternative | Alternative URL and/or POST Data used in case the preview uses a different service or API than the execute function. i.e.: "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={QUERY}" | ||
==== container ==== | ==== container ==== | ||
| Line 171: | Line 171: | ||
==== baseUrl ==== | ==== baseUrl ==== | ||
String used as base URL if [[#href]] and/or [[#thumbnail]]'s src is found to be relative. If not provided, [[#url]] will be used instead. | String used as base URL if [[#href]] and/or [[#thumbnail]]'s src is found to be relative. If not provided, [[#url]] will be used instead. | ||
==== plain ==== | |||
Array of strings naming selector properties (<code>"title", "body", "href", "thumbnail"</code>) that should be treated as plain text. | |||
==== log ==== | |||
Function to which the command logs the reponse data and parsed results. | |||
=== Other === | === Other === | ||
| Line 180: | Line 186: | ||
<pre>CmdUtils.makeSearchCommand({url:"http://google.com/search?q=%s"})</pre> | <pre>CmdUtils.makeSearchCommand({url:"http://google.com/search?q=%s"})</pre> | ||
=== Adding | === Adding preview === | ||
<pre> | <pre> | ||
CmdUtils.makeSearchCommand({ | CmdUtils.makeSearchCommand({ | ||
| Line 211: | Line 217: | ||
</pre> | </pre> | ||
=== Using functions in the parser === | === Parsing XML / Using functions in the parser === | ||
<pre> | <pre> | ||
CmdUtils.makeSearchCommand({ | CmdUtils.makeSearchCommand({ | ||
url: "http://wunderground.com/cgi-bin/findweather/getForecast?query=%s", | |||
url: "http:// | |||
parser: { | parser: { | ||
container: " | type: "xml", | ||
title: " | url: "http://api.wunderground.com/auto/wui/geo/ForecastXML?query=%s", | ||
container: "simpleforecast > forecastday", | |||
title: "pretty", | |||
thumbnail: "img. | body: function() $("<div>").append( | ||
$("conditions", this), "<br/>", | |||
$("<b>", { | |||
text: $("low > celsius", this).text() + "\u2103", | |||
style: "color:#66f", | |||
}), | |||
" \uFF5E ", | |||
$("<b>", { | |||
text: $("high > celsius", this).text() + "\u2103", | |||
style: "color:#f66", | |||
})), | |||
thumbnail: function() $("<img>", { | |||
src: "http://icons-pe.wxug.com/i/c/a/" + $("icon", this).text() + ".gif", | |||
}), | |||
}, | }, | ||
}); | }); | ||
edits