Recent activity
Subscribe to this feed
kevin1 replied on September 05, 2008 01:32 to the question "Where can I find the existing Ubiquity commands on my computer?" in Mozilla:
You can view your local copy of the javascript files directly in FireFox. Type into the address bar this line:
chrome://ubiquity/content/builtincmds.js
This doesn't allow you to browse the directory though. So you have to know the exact name of the file you want to view.
To find the actual files on your hard disk, if you're on windows, type into Windows Explorer something like this:
%AppData%\Mozilla\Firefox\Profiles\[your profile id]\extensions\ubiquity@labs.mozilla.com\chrome\content
kevin1 replied on September 05, 2008 00:51 to the question "create ubiquity command to search within a domain" in Mozilla:
kevin1 replied on September 05, 2008 00:29 to the question "create ubiquity command to search within a domain" in Mozilla:
Blipo,
Excuse me, perhaps I should have explained further. I'm using "amazon.com" as a placeholder for the domain name that Codexx wants to get working. He hasn't mentioned what the domain actually is yet, so I couldn't use it directly.
The code I wrote was specifically designed to work ONLY with the site that Codexx got the picture from. I wrote code that implemented the search the way the site's own search box does. I copied the way the search works directly from the picture that Codexx provided. This particular search function isn't guaranteed to work with ANY other site but that one. (I hope I did it right. As I said, I'm not an expert on "get" and "post" commands. Did you see any errors?)
I'm trying to help Codexx. He said he's new to programming. I'm trying to give a kind of a "tutorial" for how to do what he's asking. By the way, feel free to copy my examples and put them in whatever basic tutorial writeup you're doing for Ubiquity. The associative array aspect of javascript objects (and the JSON name-value pair syntax) is particularly confusing at first. I think a brief explanation is appropriate in the tutorial. It's very different from traditional C languages. I hope I explained it well.
kevin1 replied on September 04, 2008 20:23 to the question "create ubiquity command to search within a domain" in Mozilla:
So, moving on to the actual implementation:
Thanks, Codexx, for giving me the information about how the site uses its forms. I'll try and do what I can with it, But I'm out of my depth with get and post commands. I'm just guessing.
Speaking of which, looking at the picture provided by Codexx, I see that the site does a does a "get" and NOT a "post". (right?) I'm assuming that a "get" corresponds to a url request. So we don't need to use jQuery. (Or maybe I'm just confused?)
function doSearch(obj)
{
// To start with, I just want it to be very simple.
// So I'll store the name of the site manually.
// After I get it to work, then I can switch to use the more complicated way.
//var rootOfSite = context.focusedWindow.document.location.hostname;
var rootOfSite = "amazon.com";
var searchTerm = obj.text;
if (searchTerm == "") return; // if nothing to search for, exit the function.
// The line below is copied from the picture provided by Codexx.
// "trim" is a function that removes unnecessary spaces
// (and tabs, and line feeds) from the start and end of a string.
// If the user entered nothing but a bunch of spaces, then return.
if (trim(searchTerm) == "") return;
// The lines below are copied from the picture provided by Codexx.
// I'm not sure if we need to use the "name" of the text field, or the "id".
var text_field_name = "search";
var text_field_id = "kghjklvhj43v6";
// The url should look like "http://amazon.com?search=computers"
var url = "http://" + rootOfSite + "?" + text_field_name + "=" + searchTerm;
Utils.openUrlInBrowser(url);
}
var new_ubiquity_command2 = {
name: "search-amazon-for-stuff",
takes: {"Term": noun_arb_text},
execute: doSearch
};
CmdUtils.CreateCommand(new_ubiquity_command2};
To make it easier to look at, I took the function out of the command object and wrote it separately. As you can see, I then add the function to an object (as the value of the "execute" name) and submit the object to CmdUtils.CreateCommand.
The function assumes that we'll use a very simple, one word search term. In order to support more complicated terms, like "computers for dummies", or "author: Sir Conan Doyle" we'd have to add more code to deal with the spaces and other possible odd characters. (We'd have to url encode the searchTerm string, or something like that.)
I'm confused on one thing: the picture provided by Codexx says that the form has an "action" of "/". What does that mean?
A comment on the question "create ubiquity command to search within a domain" in Mozilla:
Oops. I omitted a closing bracket. It should have another "}" before the semicolon at end of command 2. I closed the execute function, now I need to close the object. – kevin1, on September 04, 2008 19:14
kevin1 replied on September 04, 2008 18:53 to the question "create ubiquity command to search within a domain" in Mozilla:
Codexx:
I'll try and help out too. I'm guessing that, like me, you haven't used javascript all that much. I had to educate myself on this recently, so maybe I can help.
What you're doing is creating a new javascript "object" that contains a bunch of name-value pairs, and then calling the CmdUtils.CreateCommand function with that object as an argument. The CreateCommand function looks for certain names and grabs their corresponding values. But you can add other names if you wish. Note that the entire "execute function" is the "value" part of the "execute" name.
Here's another way to look at it:
// start of command 1
var new_ubiquity_command1 = {
name: "my_new_command-name",
takes: {"Term": noun_arb_text}, // creates a name "takes" and gives it a value of a sub-object.
execute: function(obj) { do stuff here...; },
name3: "a string", // creates a name "name3" and gives it a string value
name4: function(str) { displayMessage(str); },
name5: false, // creates a name "name5" and gives it a boolean value
name6: "another string"
};
// end of command 1
// start of command 2
var new_ubiquity_command2 = {
name: "search-this-site",
takes: {"Term": noun_arb_text},
execute: function(obj)
{
var rootOfSite = context.focusedWindow.document.location.hostname;
var searchTerm = obj.text;
if (searchTerm == "") { }
else
{
var url = "http://www.google.com/search?q="+rootOfSite+":"+searchTerm;
Utils.openUrlInBrowser(url);
}
};
// end of command 2
CmdUtils.CreateCommand(new_ubiquity_command1};
CmdUtils.CreateCommand(new_ubiquity_command2};
Note that the "execute" function takes an "obj" argument, and this object contains the text string typed by the user. (access this field by using "obj.text".)
If the user typed in nothing, (if the text string he typed is equal to the null string "") then don't do anything. Otherwise, make a request to get a new document from google. Note: the "plus sign" + does string concatenation, so it assembles a long string and passes it to google.
I'm confused on one thing. Where did "context" come from? It wasn't passed in as an argument, is it a global variable?
kevin1 replied on September 04, 2008 06:33 to the question "create ubiquity command to search within a domain" in Mozilla:
Thanks Blipo, I wasn't sure how to send a POST command. I've never used jQuery before.
It's my intention to copy what the website does. I don't know how the website formats a POST to its server. Does it use the name of the form and/or the name of the submit button inside the POST command? Do I have to copy exactly what it does? I think it would depend.
I'm guessing that some sites might implement their internal search box in a couple of different ways. Some sites might have the box generate a POST command, some might have it generate a specific url. (In the case of a url we can use the code you wrote in the previous example to mimic the functionality.
Utils.openUrlInBrowser("http:// .... " + serchTerm);
kevin1 replied on September 04, 2008 02:50 to the question "create ubiquity command to search within a domain" in Mozilla:
Blipo, you're right. It does seem kind of strange that Google would allow Chrome to search sites using *the site's* search function. Yet, that's what it looks like. We know that 1) Chrome can't search sites (doesn't recognize them) until the first time you've visited there. (Not even Amazon or eBay, etc.) So autodetection certainly seems plausible.
Codexx: The good thing is, we don't need to do auto detection. At least not yet. There are two parts to this thing that Google Chrome does (supposedly) 1) autodetect the site's search box/function/submit form, and 2) execute a search by copying or using that submit form. It's my guess that #2 really isn't that hard. Certainly it should be a lot easier than #1, especially when you're only interested in searching one particular site. (That is what you said you wanted to do. right?)
It should be easy enough to manually go and look at the site's html code, to find out how they implemented their search box. Maybe we need to know what the names of the elements are, (the form and submit button, etc), maybe we need to look at the javascript to figure out how to write a search using their site. I don't know. But it sure would be interesting to find out how Chrome does it.
kevin1 replied on September 03, 2008 07:07 to the question "create ubiquity command to search within a domain" in Mozilla:
I looked at it a bit more. Some people are calling the new Chrome feature Tab-to-search. (Oh, and the proper name is the "omnibox", not omnibar as I previously stated.)
Google Chrome uses some form of auto discovery to recognize sites that have their own search box. It looks for a search field (a simple submit form) on the root page of the domain. Evidently, Chrome recognizes a search box better if the page uses a form with standard HTML submit rather than something done in javascript. Chrome also supports OpenSearch discovery.
See http://www.mattcutts.com/blog/common-...
kevin1 replied on September 03, 2008 02:41 to the question "create ubiquity command to search within a domain" in Mozilla:
The new Google Browser, Google Chrome, has this feature. It allows you to type into the search bar (the Omnibar) the site name (like "Amazon") then press tab, and type in what you want to search for. It will then use the *site's own search* feature to do a search.
I don't know how they make it do this. But if they can, then we can copy it.
kevin1 replied on September 02, 2008 08:48 to the idea "Teach Sandy to work with other websites" in I want Sandy:
Alysson, thanks for the referral to pageonce. Nice service.
It seems that pageonce is a service that aggregates data from all your online accounts. It's a type of "start page". It lets you monitor the goings on of your other accounts from one place. (You don't have to sign in and visit the homepage of each individual service where you have an account.)
I can see that pageonce can pull data into it, and then display it to you. It also offers some widgets on the web page that allow you to interact with your various accounts without logging in. But does it require your involvement? Do I have to sit at my computer and interact with pageonce, or can I set it up so that it does things automatically?
1) Can I set it up so that it will do something when a predefined events occurs? Can it at least notify me (by email, etc) when something happens? Can it monitor my plane flight status and email me if it's been delayed? Can it track a package and email me when it arrives? Can it send me an sms 5 minutes before by ebay auction is set to expire?
2) Can I issue commands to it by email? (or sms, twitter, Jott, etc) Can I tell it to email me a list of all my current ebay auctions, get a list of potential gifts at Amazon.com, check the price of a certain stock, get the status of that package that I'm expecting, etc. etc.
kevin1 replied on September 02, 2008 07:00 to the question "Multiple email addresses?" in I want Sandy:
Gmail forwarding to Sandy doesn't work.
Sorry. It looks like I made a mistake. I tried to help out and cleaned up and reposted what somebody else wrote. I've never actually used Gamil to forward email to Sandy. Just today I tried to help Shazzer out, so I actually tired to get Gmail forwarding to work, but I couldn't. Maybe it used to work, but Sandy was changed...
See my reply here http://getsatisfaction.com/iwantsandy...-
kevin1 started following the idea "Ability to add more than one secondary address" in I want Sandy.
kevin1 replied on September 02, 2008 06:55 to the idea "Ability to add more than one secondary address" in I want Sandy:
I got the same errors. Gmail forwarding to Sandy doesn't work. It seems that it might have worked at one point, but it doesn't now.
The "email relay" idea has two purposes. 1) send email to the relay from multiple accounts and then have the relay forward the emails to Sandy. And 2) have Sandy send all messages to the email relay and the relay will forward the messages to multiple accounts. It turns out that #1 won't work.
The problem seems to be that Sandy authenticates emails by matching the address in the "From:" field to one of the registered email addresses. If the address doesn't match, then Sandy rejects the email. She thinks it's spam.
In order to get email forwarding to Sandy to work, either Gmail would have to change the "From:" field of a forwarded email to be the Gmail account, or Sandy would have to accept email that has special properties. (e.g. if the "Reply-to:" field matched one of the registered email addresses, etc.)
It currently isn't possible to configure Gmail to change the "From:" address of automatically forwarded email. (e.g. as part of a filter or auto-forward.) It is possible to change the "From:" address to some other verified address, but only when you *manually* compose the email inside of Gmail. (see
http://mail.google.com/support/bin/an... )
The inability to change the "From:" address eliminates using Gmail to automatically forward email to Sandy. All emails automatically forwarded from Gmail (as part of a filter or as an auto-forward) will have the original address in the "From:" field. Sandy will use the original email address when attempting to authenticate the email.-
kevin1 started following the question "Widget for adding reminders/appoinements?" in I want Sandy.
kevin1 replied on August 25, 2008 15:55 to the idea "Ability to search for a reply, not a topic" in Get Satisfaction:
kevin1 replied on August 25, 2008 05:20 to the problem "Sandy not correctly interpreting mutliple tags on a reminder" in I want Sandy:
kevin1 replied on August 25, 2008 05:13 to the idea "Ability to search for a reply, not a topic" in Get Satisfaction:
Phillip makes a good point. The way I think of it, his idea is another way of allowing people to "tag" replies. Users would be able to mark individual replies as a "favorite" or somehow add it to a list ("favorites" or "saved for later").
This favorites list could be private, or it could be viewable by others. Either way, it would be linked to a particular person. Everybody would have their own list of favorites. I guess it would be possible for the reply to be visibly marked, something like (77 people have added this reply to their favorites).
Now that I think about it, the tagging system already works this way. All tags are linked to a particular person. That means that every user has a set of replies that they tagged as "answers the question". This set just isn't viewable as an individual list. The profile page has a list of "recent activity". This contains all kinds of things. Including events such as "You marked one of Philipp's replies as useful." How can I get a list of only tag events? Can I filter the "recent activity" list to only display tag events?
The idea of tagging replies is good, but I view it as an incomplete solution for my problem. It should be easier to implement than a full search, and it certainly is useful in it's own right, but it still wouldn't solve every problem I was thinking of. I still wouldn't be able to search through my list of favorites for replies containing specific keywords. Nor would I be able to search through all the replies made by a particular person.-
kevin1 started following the idea "Sandy eats calendars for breakfast" in I want Sandy.
kevin1 replied on August 23, 2008 17:02 to the idea "iPhone-ing Sandy" in I want Sandy:
I think the easiest thing is to just give the form to iwantsandy.com
Then they can add it to their website. it's be easier than asking everybody to trust you with their Sandy login and password.
I'm not sure if they're using PHP or not. Maybe you could attend the next Sandy townhall meeting and ask Rael about it.
Great idea. I'd love to see it in action. Is there s website where I can see it?
| next » « previous |
Loading Profile...


