Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Google.de Suche */
- makeSearchCommand({
- name: "gg",
- url: "http://www.google.de/search?q={QUERY}",
- icon: "http://www.google.com/favicon.ico",
- author: {name: "Mario Priebe", email: "mp@biggle.de"},
- description: "Suchen auf Google.de",
- preview: function(pblock, directObject) {
- var searchTerm = directObject.text;
- var pTemplate = "Suchen auf Google.de nach: <strong>${query}</strong>";
- 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: searchTerm };
- jQuery.get( url, params, function(data) {
- var numToDisplay = 4;
- var results = data.responseData.results.splice( 0, numToDisplay );
- pblock.innerHTML = CmdUtils.renderTemplate( {file:"google-search.html"},
- {results:results}
- );
- }, "json");
- }
- });/* This is a template command. */
- CmdUtils.CreateCommand({
- name: "example",
- icon: "http://example.com/example.png",
- homepage: "http://example.com/",
- author: {name: "Your Name", email: "you@example.com"},
- license: "GPL",
- description: "A short description of your command",
- help: "How to use your command",
- takes: {"input": /.*/},
- preview: function(pblock, input) {
- pblock.innerHTML = "Your input is <b>" + input.text + "</b>.";
- },
- execute: function(input) {
- displayMessage("You selected: " + input.text);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement