diff --git a/alternative_to/spice.html b/alternative_to/spice.html new file mode 100644 index 0000000000..f03f0ce68b --- /dev/null +++ b/alternative_to/spice.html @@ -0,0 +1,19 @@ + + + + + Alternative.to test + + + + +
+ + + + + diff --git a/alternative_to/spice.js b/alternative_to/spice.js new file mode 100644 index 0000000000..f227748998 --- /dev/null +++ b/alternative_to/spice.js @@ -0,0 +1,49 @@ +d = document; +function nrat(alts) +{ + // console.log(alts); + var out, tmp; + out = ""; + + // validity check + if (alts['Items']) { + + for (i in alts['Items']) { + var item = alts['Items'][i]; + + wrapper = d.createElement("div"); + box = d.createElement("div"); + + link = d.createElement("a"); + link.href = item['Url']; + link.innerHTML = item['Name']; + + img = d.createElement("img"); + img.src = item['IconUrl']; + + box.appendChild(img); + box.appendChild(d.createElement("br")); + box.appendChild(link); + + YAHOO.util.Dom.setStyle(box, "text-align", "center"); + + YAHOO.util.Dom.setStyle(box, "float", "left"); + YAHOO.util.Dom.setStyle(box, "margin", "10px"); + YAHOO.util.Dom.setStyle(box, "width", "60px"); + + wrapper.appendChild(box); + + out += wrapper.innerHTML; + + } + + items = new Array(); + items[0] = new Array(); + items[0]['a'] = out; + items[0]['h'] = ''; + items[0]['s'] = 'AlternativeTo'; + items[0]['u'] = alts['Url']; + nra(items); + } +} + diff --git a/alternative_to/spice.namespace b/alternative_to/spice.namespace new file mode 100644 index 0000000000..48b483f295 --- /dev/null +++ b/alternative_to/spice.namespace @@ -0,0 +1 @@ +at diff --git a/alternative_to/spice.pl b/alternative_to/spice.pl new file mode 100644 index 0000000000..a91ebefc04 --- /dev/null +++ b/alternative_to/spice.pl @@ -0,0 +1,26 @@ +if ($q_check_lc =~ /^(?:(free|opensource|commercial))?\s*(?:alternatives?\s*to\s*)?([\w\-]+)(?:\sfor\s(.*))?$/i) { + #$call_extf = qq(/js/nrat.js); + if ($1 and $4) { + # license and platform specified - queries like: + # -> free alternative to firefox for mac + # -> opensource matlab for linux + $call_ext = qq(/iat/software/$3/?platform=$4&license=$1); + } elsif ($1) { + # lincense secified only: + # -> free nod32 + # -> opensource alternative to omnigraffle + $call_ext = qq(/iat/software/$3/?license=$1); + } elsif ($4) { + # platform specified: + # -> TextMate for windows + # -> alternative to vim for linux + $call_ext = qq(/iat/software/$3/?platform=$4); + } elsif($2) { + # license and platform not specified + # in this case we need to match 'alternative(s) to': + # -> alternative to firefox + $call_ext = qq(/iat/software/$3); + } + $is_kill_pre_results = 1; +} +