phpBB

Development Wiki

User:BarryCarlyon/Ubiquity

From phpBB Development Wiki

Search phpBB.com Using Ubiquity


Ubiquity is a Experimental Firefox Extension: Ubiquity on Mozilla Labs, its adds Mac Quicksilver functionality to Firefox.

Add Searching phpBB.com Forums to Ubiquity, Powered by Google, When using Ubiquity it previews the search results too!

1) Visit chrome://ubiquity/content/editor.html - Ubiquity User Command Editor, in Your Browser

2) Copy and Paste the Following into the TextArea

makeSearchCommand({
  name: "phpBB",
  url: "http://www.phpbb.com/search/?q={QUERY}",
  icon: "http://www.phpBB.com/favicon.ico",
  description: 'Searches <a href="http://phpbb.com/">phpBB</a> for your words.',
  help: 'Found Here: <a href="http://wiki.phpbb.com/User:BarryCarlyon/Ubiquity">phpBB Wiki</a>',
  preview: function(pblock, directObject) {
    var searchTerm = directObject.text;
    var pTemplate = "Searches phpBB for <b>${query}</b>";
    var pData = {query: searchTerm};
    pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);

    var url = "http://ajax.googleapis.com/ajax/services/search/web";
    var params = { v: "1.0", q: "site:phpbb.com " + searchTerm };

    jQuery.get( url, params, function(data) {
      var numToDisplay = 3;
      var results = data.responseData.results.splice( 0, numToDisplay );

      pblock.innerHTML = CmdUtils.renderTemplate( {file:"google-search.html"},
						  {results:results}
						);
      }, "json");
  }
});

3) Test it, The Editor Saves Automagically! Command for ubiquity is phpbb Words

Search the Wiki

Use this code instead, command for ubiquity is phpbb-wiki Words

makeSearchCommand({
  name: "phpBB-Wiki",
  url: "http://wiki.phpbb.com/Special:Search?search={QUERY}&fulltext=Search",
  icon: "http://www.phpBB.com/favicon.ico",
  description: 'Searches the <a href="http://wikiphpbb.com/">phpBB wiki</a> for your words.',
  help: 'Found Here: <a href="http://wiki.phpbb.com/User:BarryCarlyon/Ubiquity">phpBB Wiki</a>',
  preview: function(pblock, directObject) {
    var searchTerm = directObject.text;
    var pTemplate = "Searches phpBB wiki for <b>${query}</b>";
    var pData = {query: searchTerm};
    pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);

    var url = "http://ajax.googleapis.com/ajax/services/search/web";
    var params = { v: "1.0", q: "site:wiki.phpbb.com " + searchTerm };

    jQuery.get( url, params, function(data) {
      var numToDisplay = 3;
      var results = data.responseData.results.splice( 0, numToDisplay );

      pblock.innerHTML = CmdUtils.renderTemplate( {file:"google-search.html"},
						  {results:results}
						);
      }, "json");
  }
});

BarryCarlyon 01:42, 31 August 2008 (UTC)