Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ubiquity: Google-bookmarks-tool
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="" xml:lang="en" lang="en"
<title>Ubiquity Google bookmarks tool</title>
<div id="google-bookmarks-search" style="display: none;">
{for result in results}
<div class="gresult">
${result.key}: <a href="${jQuery('url',result).get(0).innerHTML}" accesskey="${result.key}">${jQuery('title',result).get(0).innerHTML}</a>
<div class="gresult-url">
{for label in result.labels}
<script class="commands"><![CDATA[
//Google bookmark
names: "gbk",
url: "{QUERY}",
icon: "chrome://ubiquity/skin/icons/google.ico",
description: "Searches Google bookmarks for your words.",
help: "You can use the keyboard shortcut ctrl /+ alt + number to open one " +
"of the Google bookmarks' results shown in the preview.",
preview: function(pblock, {object}) {
var searchTerm = object.text;
// Don't even display any text before fetching search results,
// since the results come back nearly instantaneously. In the
// future, we can display a throbber.
var params = {output: "xml"};
if(searchTerm.length > 0) {
params = {q:searchTerm, output: "xml",btnSMH: "Search+Bookmarks" };
var url = "";
CmdUtils.previewGet( pblock, url, params, function(data) {
data = data.replace(/<\?[^>]*>/, '');
var results = jQuery("bookmark",data).get();
var nums = "123456789abcdefghijklmnopqrstuvwxyz";
var numToDisplay = nums.length;
results = results.splice(0,numToDisplay);
for(var i=0;i<results.length;i++){
var result = results[i];
result.labels = jQuery('label',result).get();
results = {};
var noResultsMessage = _("Your search - ${searchTerm} - did not match any bookmarks.",{searchTerm:searchTerm});
var tipsMessage = _("Tip: You can go to any result in this preview by pressing control, alt, and the result number at the same time.");
pblock.innerHTML = CmdUtils.renderTemplate(
jQuery("#google-bookmarks-search", feed.dom).html(),
{ results:results,
}, "text");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.