Skip to content

Commit abe650b

Browse files
authored
Update ddgweb.js
1 parent d83d596 commit abe650b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ddgweb.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ window.addEventListener("load", function() {
1111
})();
1212
});
1313

14-
ddg.rawAPI = function(query) {
14+
ddg.rawAPI = function(query, skip_disambig) {
15+
if(skip_disambig === undefined) {
16+
skip_disambig = 1;
17+
}
18+
1519
// Http or Https?
1620
var ssl = false;
1721
if(location.href.indexOf("https") == 0)
@@ -24,14 +28,14 @@ ddg.rawAPI = function(query) {
2428
var name = "ddg_rawApi_" + now + "" + Math.floor(Math.random() * 1000 + 1);
2529
window[name] = resolve;
2630
var script = document.createElement("script");
27-
script.src = "http" + (ssl ? "s": "") + "://api.duckduckgo.com/?q=" + encodeURI(query) + "&format=json&pretty=0&skip_disambig=1&callback=" + name +
31+
script.src = "http" + (ssl ? "s": "") + "://api.duckduckgo.com/?q=" + encodeURI(query) + "&format=json&pretty=0&skip_disambig=" + skip_disambig + "&callback=" + name +
2832
(ddg.appName ? "&t=" + encodeURI(ddg.appName) : "");
2933
document.getElementsByTagName("head")[0].appendChild(script);
3034
});
3135
}
3236

3337
ddg.result = function(query) {
34-
return ddg.rawAPI(query).then(function(json) {
38+
return ddg.rawAPI(query, 1).then(function(json) {
3539
var newResult = {};
3640
if(json.AbstractText) {
3741
newResult.text = (json.AbstractText);

0 commit comments

Comments
 (0)