File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ window.addEventListener("load", function() {
11
11
} ) ( ) ;
12
12
} ) ;
13
13
14
- ddg . rawAPI = function ( query ) {
14
+ ddg . rawAPI = function ( query , skip_disambig ) {
15
+ if ( skip_disambig === undefined ) {
16
+ skip_disambig = 1 ;
17
+ }
18
+
15
19
// Http or Https?
16
20
var ssl = false ;
17
21
if ( location . href . indexOf ( "https" ) == 0 )
@@ -24,14 +28,14 @@ ddg.rawAPI = function(query) {
24
28
var name = "ddg_rawApi_" + now + "" + Math . floor ( Math . random ( ) * 1000 + 1 ) ;
25
29
window [ name ] = resolve ;
26
30
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 +
28
32
( ddg . appName ? "&t=" + encodeURI ( ddg . appName ) : "" ) ;
29
33
document . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( script ) ;
30
34
} ) ;
31
35
}
32
36
33
37
ddg . result = function ( query ) {
34
- return ddg . rawAPI ( query ) . then ( function ( json ) {
38
+ return ddg . rawAPI ( query , 1 ) . then ( function ( json ) {
35
39
var newResult = { } ;
36
40
if ( json . AbstractText ) {
37
41
newResult . text = ( json . AbstractText ) ;
You can’t perform that action at this time.
0 commit comments