<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<title>Ubiquity Swalif Google Search</title>
</head>
<body>
<p>This page contains a Ubiquity command for Googling Swalif Forum.</p>
<script src="fake-infrastructure.js"></script>
<div id="google-search" style="display: none;">
 {for result in results}
 <div class="gresult">
  <div> ${result.key}: <a href="${result.unescapedUrl}" accesskey="${result.key}">${result.title}</a>
   </div>
    <xul:description class="gresult-content">${result.content}</xul:description>
     <div class="gresult-url">${result.visibleUrl}
     </div> </div>
     {forelse}
     <b>عفواً، بحثك عن - ${searchTerm} - ليست له نتائج في الموقع </b>
      {/for}
      <small>Tip: You can go to any result in this preview by using its number as an access key. (Linux and Windows: alt-number, Mac: control-number)</small>
      </div>
<script class="commands"> <![CDATA[
    CmdUtils.makeSearchCommand( {
        name: "سوالف المنتدى",
        url: "http://www.google.com/search?q=site:swalif.net/softs+{QUERY}",
        icon: "http://www.swalif.net/softs/favicon.ico",
        description: "ابحث في منتدى سوالف سوفت",
        preview: function(pblock, directObject) { var searchTerm = "site:swalif.net "+directObject.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.
        if(searchTerm.length < 1) {
            pblock.innerHTML = "ابحث في منتدى سوالف سوفت";
             return;
             }
             
              var url = "http://ajax.googleapis.com/ajax/services/search/web";
              var params = { v: "1.0", q: searchTerm };
        
        CmdUtils.previewGet( pblock, url, params, function(data) {
            var numToDisplay = 3;
            var results = data.responseData.results.splice( 0, numToDisplay );
            
             //for access keys
             for(var i=0;i<results.length;i++){
                 var result = results[i];
                  result.key = i+1;
                   }
                   
             pblock.innerHTML = CmdUtils.renderTemplate(
             jQuery("#google-search", feed.dom).html(),
             
             {results:results, searchTerm:searchTerm}
             
              );
             
              }, "json");
              
               }
               
              });
              
              ]]></script>
    </body>
 </html>

