Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: d85e325d18
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (38 sloc) 1.37 kB
<?xml version="1.0" encoding="UTF-8" ?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<sampleQuery>select * from {table} where url="http://foo.bar.com/some/path" and path="images/pickles.jpg"</sampleQuery>
</meta>
<bindings>
<select itemPath="" produces="JSON">
<urls>
<url></url>
</urls>
<inputs>
<key id="url" type="xs:string" paramType="variable" required="true" />
<key id="path" type="xs:string" paramType="variable" required="true" />
</inputs>
<execute><![CDATA[
//include css to xpath convert function
url = url.split('?')[0];
var protocol = url.split('://')[0];
var host = url.split('//')[1].split('/')[0];
var urlPath = url.split(host)[1];
if (/^http/.test(path)) {
response.object = { url: path };
} else if ('/' == path[0]) {
// path is absolute
response.object = { url: protocol + '://' + host + path };
} else {
if (/\/$/.test(urlPath)) {
// url path has a slash on the end
response.object = { url: protocol + '://' + host + urlPath + path };
} else {
// no slash
response.object = { url: protocol + '://' + host + urlPath + '/' + path };
}
}
]]></execute>
</select>
</bindings>
</table>
Jump to Line
Something went wrong with that request. Please try again.