Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
resolved some merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
moollaza committed Jun 10, 2012
2 parents 4b295e8 + d887d5d commit 06007eb
Showing 1 changed file with 47 additions and 21 deletions.
68 changes: 47 additions & 21 deletions share/spice/google_plus/spice.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
function ddg_spice_google_plus(google) {
// console.log(google);
var out = '';
var query = DDG.get_query(); //"google+ this is a test";
var re = /\s*(google\+|google\splus|g\+|gplus|google\+\suser|g\+\suser|google\splus\suser|google\+\sprofile|g\+\sprofile|gplus\sprofile|gplus\suser|g\splus\sprofile|g\splus\suser)\s*/;
var query = query.replace(re, "");

if(google.kind === "plus#peopleFeed" && google.items.length > 0) {
var tmp, div, div2, link, img, item, limit;

Expand Down Expand Up @@ -41,7 +44,7 @@ function ddg_spice_google_plus(google) {

YAHOO.util.Dom.addClass(div, 'inline highlight_zero_click1 highlight_zero_click_wrapper');
YAHOO.util.Dom.setStyle(div, "float", "left");
YAHOO.util.Dom.setStyle(div, "margin", "0px 20px 10px 0px");
YAHOO.util.Dom.setStyle(div, "margin", "10px 20px 10px 0px");
YAHOO.util.Dom.setStyle(div, "padding", "5px");
YAHOO.util.Dom.setStyle(div, "max-width", "80px");

Expand All @@ -52,7 +55,6 @@ function ddg_spice_google_plus(google) {

var items = new Array();
items[0] = new Array();
// items[0]['a'] = out += '<div style="clear:both;"></div>';
items[0]['a'] = out;
var query = DDG.get_query(); //"google+ this is a test";
var query = query.replace(/\s*(google\+|google\splus|g\+|gplus|\+)\s*/, "");
Expand All @@ -67,49 +69,73 @@ function ddg_spice_google_plus(google) {
if (google.tagline) {
out += '<div class="google_profile"><i>Introduction: </i> ' + google.tagline + '</div>';
} else if(google.aboutMe) {
out += '<div class="google_profile"><i>Introduction: </i> ' + google.aboutMe.substring(0, 200) + '...</div>';
out += '<div class="google_profile"><i>Introduction: </i> ' + google.aboutMe.substring(0, 200);
if(google.aboutMe.length > 200) {
out += '...' + '</div>';
} else {
out += '</div>';
}
}

//Check for organizations
if(google.organizations) {
var orgs = '';
for(var i=0;i < google.organizations.length && i < 2;i++) {
var orgs = '', length;
if(google.organizations.length > 2) {
length = 2;
} else {
length = google.organizations.length;
}
for(var i=0;i < length;i++) {
orgs += google.organizations[i].name +
(google.organizations[i].title ? ' (' + google.organizations[i].title + ')' : '');
if(i !== google.organizations.length-1) {
if(i !== length-1) {
orgs += ', ';
}
}
out += '<div class="google_orgs"><i>Organizations: </i>' + orgs + '</div>';
}

//Check if the person has lived in several places.
if(google.placesLived) {
var places = '';
for(var i=0;i < google.placesLived.length;i++) {
if(google.placesLived[i].primary) {
places += google.placesLived[i].value;
out += '<div class="google_places"><i>Lives in: </i>' + places + '</div>';
}
}
}
//Check if the person has links to show.
if(google.urls) {
var links = '';
var links = '', unique = [];
if(google.urls.length > 2) {
google.urls.length -= 2;
for(var i=0;i < google.urls.length;i++) {
var re = /(?:https?:\/\/)?(?:www\.)?([^\/]+).*/;
var string = google.urls[i].value.toLowerCase();
string = string.replace(re, "$1");
re = /\.com/;
string = string.replace(re, "");
if(string.search(/\./) === -1) {
string = string.charAt(0).toUpperCase() + string.slice(1)
}
links += '<a href="' + google.urls[i].value + '">' + string
+ '</a>';
if(i !== google.urls.length-1) {
if(unique.indexOf(google.urls[i].value) === -1) {
unique.push(google.urls[i].value);
var re = /(?:https?:\/\/)?(?:www\.)?([^\/]+)\/?([^\/]+)?.*/;
var string = google.urls[i].value.toLowerCase();
string = string.replace(re, "$1");
re = /\.com/;
string = string.replace(re, "");
if(string.search(/\./) === -1) {
string = string.charAt(0).toUpperCase() + string.slice(1)
}
links += '<a href="' + google.urls[i].value + '" title="' + google.urls[i].value + '">' +
string + '</a>';
links += ', ';
}
}
if(links.substring(links.length-2, links.length) === ', ') {
links = links.substring(0, links.length-3);
}
out += '<div class="google_links"><i>Links: </i>' + links + '</div>';
}
}
var items = new Array();
items[0] = new Array();
// items[0]['a'] = out += '<div style="clear:both;"></div>';
items[0]['a'] = out;
items[0]['h'] = google.displayName;
items[0]['h'] = google.displayName + ' (Google+)';
items[0]['s'] = 'Google+';
items[0]['u'] = google.url;
items[0]['f'] = 1;
Expand Down

0 comments on commit 06007eb

Please sign in to comment.