Confirmed users
595
edits
| Line 108: | Line 108: | ||
/* The query can be so configured: | /* The query can be so configured: | ||
* | * | ||
* _QueryConf_ = { | |||
* phrase: string. | * phrase: string. | ||
* | * Containing this string in either title, uri or tags. Case | ||
* | * insensitive. Can use ^ and $ to match at beginning or end. | ||
* host: string. | * host: string. | ||
* | * Containing this string in the host. Case insensitive. | ||
* | * Can use ^ and $ to match at beginning or end. | ||
* uri: string. | * uri: string. | ||
* | * Containing this string in the uri. Case insensitive. | ||
* | * Can use ^ and $ to match beginning or end. | ||
* annotated: array of strings. | * annotated: array of strings. | ||
* | * With these annotations (Either page or item). | ||
* bookmarked: object { | * bookmarked: object | ||
* | * { | ||
* | * tags: array of strings. | ||
* | * Tagged with these tags. | ||
* | * at: object | ||
* id: number. | * { | ||
* | * folder: number. | ||
* | * Inside this folder. (non-recursive) | ||
* | * position: number. | ||
* | * At this position. (relative to folder). | ||
* | * If undefined or null matches all children. | ||
* | * } | ||
* | * id: number. | ||
* | * Bookmarked with this id. | ||
* | * when: object | ||
* | * { | ||
* | * begin: optional Date object | ||
* | * Bookmarks created after this time (included). | ||
* | * Defaults to epoch. | ||
* | * end: optional Date object | ||
* | * Bookmarks created before this time (included). | ||
* | * Defaults to now. | ||
* visited: object { | * } | ||
* | * modified: object | ||
* | * { | ||
* | * begin: optional Date object | ||
* | * Bookmarks modified after this time (included). | ||
* | * Defaults to epoch. | ||
* | * end: optional Date object | ||
* | * Bookmarks modified before this time (included). | ||
* | * Defaults to now. | ||
* | * } | ||
* | * onlyContainers: boolean. | ||
* | * Removes any non-container from results. | ||
* | * Default is false. | ||
* | * excludeReadOnlyContainers: boolean. | ||
* | * Removes read only containers from results. | ||
* | * Default is false. | ||
* | * } | ||
* | * visited: object | ||
* | * { | ||
* count: object | |||
* This is lazily based on visit_count, thus is not going to work | |||
* for not counted transitions: embed, download, framed_link. | |||
* { | |||
* min: optional number. | |||
* With more than this many visits. | |||
* Defaults to 0. | |||
* max: optional number. | |||
* With less than this many visits. | |||
* Defaults to inf. | |||
* } | |||
* transitions: array of transition types. | |||
* With at least one visit for each of these transitions. | |||
* when: object | |||
* { | |||
* begin: optional Date object | |||
* With visits after this time (included). | |||
* Defaults to epoch. | |||
* end: optional Date object | |||
* With visits before this time (included). | |||
* Defaults to now. | |||
* } | |||
* excludeRedirectSources: boolean. | |||
* Removes redirects sources from results. | |||
* Default is false. | |||
* excludeRedirectTargets: boolean. | |||
* Removes redirects targets from results. | |||
* Default is false. | * Default is false. | ||
* | * includeHidden: boolean. | ||
* | * Includes also pages marked as hidden. | ||
* | * Default is false. | ||
* allVisits: boolean. | |||
* | * Returns all visits ungrouped. | ||
* sort: object { | * Default is false, that means visits are grouped by uri. | ||
* | * } | ||
* | * sort: object | ||
* { | |||
* | * by: string. | ||
* | * Either "none", "title", "time", "uri", "accessCount", "lastModified", | ||
* | * "frecency". Defaults to "none". | ||
* dir: string. | |||
* Either "asc" or "desc". Defaults to "asc". | |||
* } | |||
* group: string. | * group: string. | ||
* Either " | * Either "tags", "containers", "days", "months", "years" or "domains". | ||
* Defaults to "none". | * Defaults to "none". | ||
* NOTE: Not yet implemented. | |||
* limit: number. | * limit: number. | ||
* Maximum | * Maximum number of results to return. Defaults to all results. | ||
* merge: string. | * merge: string. | ||
* How to merge this query's results with others in the same request. | * How to merge this query's results with others in the same request. | ||
* | * Valid values: | ||
* - "union": merge results from the 2 queries. | |||
* - "except": exclude current results from the previous ones. | |||
* - "intersect": only current results that are also in previous ones. | |||
* } | * } | ||
* | |||
* NOTE: In case of multiple queries, sort, group and limit of the first query | |||
* will be used for the global result. | |||
* | * | ||
* | * | ||
| Line 197: | Line 234: | ||
* sessionId: visit session or null if not available | * sessionId: visit session or null if not available | ||
* itemId: bookmark id or null if not bookmarked (see isBookmarked) | * itemId: bookmark id or null if not bookmarked (see isBookmarked) | ||
* isBookmarked: whether this is bookmarked or not | |||
* dateAdded: bookmark creation Date() or null if not bookmarked | * dateAdded: bookmark creation Date() or null if not bookmarked | ||
* lastModified bookmark modification Date() or null if not bookmarked | * lastModified bookmark modification Date() or null if not bookmarked | ||
| Line 206: | Line 244: | ||
* visitId: id of the visit or null | * visitId: id of the visit or null | ||
* referringVisitId: id of the originating visit or null | * referringVisitId: id of the originating visit or null | ||
* referringUri: uri of the originating visit or null | |||
* transitionType: transition of this visit or null | * transitionType: transition of this visit or null | ||
* type: old container implementation type | * type: old container implementation type | ||
* readableType: "bookmark", "container", "separator", "visit", "page" | * readableType: "bookmark", "container", "separator", "visit", "page" | ||
* query: if this is a container will return a new PlacesQuery for contents | * query: if this is a container will return a new PlacesQuery for contents | ||
* } | * } | ||
| Line 238: | Line 276: | ||
// Folder picker. | // Folder picker. | ||
new PlacesQuery({ bookmarked: { | new PlacesQuery({ bookmarked: { | ||
at: { folder: PlacesUIUtils.allBookmarksFolderId } | |||
onlyContainers: true, | |||
excludeReadOnlyContainers: true | excludeReadOnlyContainers: true | ||
}, | }, | ||
| Line 253: | Line 291: | ||
// Most recent tags. | // Most recent tags. | ||
new PlacesQuery({ bookmarked: {}, | new PlacesQuery({ bookmarked: {}, | ||
group: " | group: "tags", | ||
limit: 5 | limit: 5 | ||
}); | }); | ||
| Line 259: | Line 297: | ||
// Left pane query. | // Left pane query. | ||
new PlacesQuery({ bookmarked: { folders: [PlacesUIUtils.leftPaneFolderId] }, | new PlacesQuery({ bookmarked: { folders: [PlacesUIUtils.leftPaneFolderId] }, | ||
annotated: "Places/OrganizerQuery" | annotated: ["Places/OrganizerQuery"] | ||
group: " | group: "containers" | ||
}); | }); | ||
| Line 267: | Line 305: | ||
transitions: [PlacesUtils.history.TRANSITION_DOWNLOAD], | transitions: [PlacesUtils.history.TRANSITION_DOWNLOAD], | ||
includeHidden: true, | includeHidden: true, | ||
allVisits: true | |||
}, | }, | ||
sort: { by: "time", dir: "desc" } | sort: { by: "time", dir: "desc" } | ||
| Line 298: | Line 336: | ||
); | ); | ||
// Visited bookmarks containing "foo" | // Visited bookmarks containing "foo" and "bar". | ||
new PlacesQuery([ | new PlacesQuery([ | ||
{ phrase: "foo", | { phrase: "foo", | ||
| Line 307: | Line 345: | ||
bookmarked: {}, | bookmarked: {}, | ||
visited: {}, | visited: {}, | ||
merge: " | merge: "intersect" | ||
}, | }, | ||
); | ); | ||
</pre> | </pre> | ||