Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nileshtrivedi/71056 to your computer and use it in GitHub Desktop.
Save nileshtrivedi/71056 to your computer and use it in GitHub Desktop.
ubiquity-command-for-geobeats.com.js
jQuery.ajax({
type: "GET",
url: "http://www.geobeats.com/js/selectDropDown.js",
data: "cachePreventor=1918606547",
async: false,
dataType: "text",
success: function(data){
var i = "new_cities_array = []; _gbstr = ''; \n";
var f1 = "function addListGroup(a,b){}\n";
var f2 = "function addList(a,b,c,d){ if(a == 'country-place' && b != 'Destination') {var splits = b.split(' - '); new_cities_array.push(splits[1] + ' - ' + splits[0]); _gbstr += (\"<br/>\" + b);} }\n";
eval(i + f1 + f2 + data);
}
});
noun_type_city = new CmdUtils.NounType( "City",
new_cities_array
);
CmdUtils.CreateCommand({
name: "geobeats",
homepage: "http://nileshtrivedi.in",
author: { name: "Nilesh Trivedi", email: "nilesh.tr@gmail.com"},
license: "GPL",
description: "search for travel videos on geobeats.com",
takes: {"city": noun_type_city},
preview: function( pblock, city ) {
var splits = city.text.toLowerCase().split(' - ');
if(splits.length == 2){
var country = splits[1].replace(/ /g,'-');
var city = splits[0].replace(/ /g,'-');
var url = "http://www.geobeats.com/videoclips/alldestinations/" + country + "/" + city + "/";
jQuery.ajax({
url: url,
type: "GET",
async: false,
dataType: "html",
success: function(resp){
previewresponse = resp;
}
});
var f = jQuery(previewresponse).find("#destinations");
var divclass = {
'background-color' : "#dfdfdf",
"width" : "226px",
"float" : "left",
"color" : "#434343",
'font-size' : "0.65em",
"height" : "82px",
"line-height" : "1.2",
"margin" : "1px 2px 1px 0",
"padding" : "8px 6px 8px 8px",
"text-align" : "left",
"display" : "inline"};
var thumbclass = {
'background-color' : "#ffffff",
'border' : '0 solid #cececc',
'float' : 'left',
'height' : '52px',
'margin-right' : '8px',
'padding' : '5px',
'width' : '72px'
};
var h3class = { 'margin-top' : '0px', 'padding' : '0px 0px 0px 0px'};
var pclass = {'margin' : '0', 'z-index' : 10};
pblock.innerHTML = f.html();
jQuery(pblock).find(".clipblock1").css(divclass).each(function(i){
if(i > 7) { this.style.display = 'none'; }
});
jQuery(pblock).find(".clipblock1 h3").css(h3class);
jQuery(pblock).find("a").each(function(i){
this.setAttribute("href", "http://www.geobeats.com" + this.getAttribute("href"));
});
jQuery(pblock).find(".thumb").css(thumbclass).show().each(function(i){
this.setAttribute("src","http://www.geobeats.com" + this.getAttribute("src"));
});
jQuery(pblock).find(".clipblock1 p").css(pclass);
jQuery(pblock).append("<a href='" + url + "'>See all videos from " + city + " - " + country + "</a>");
}
},
execute: function(city) {
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment