This repository has been archived by the owner on Oct 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 941
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #855 from duckduckgo/jd/leakdb
leakdb: update to record template
- Loading branch information
Showing
3 changed files
with
51 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
.zci--leak_db table { | ||
/* border:1px solid #d0d0d0; */ | ||
width:100%; | ||
margin:5px; | ||
.zci--leak_db .zci__body .zci__more-at{ | ||
padding-top: 1em; | ||
} | ||
.zci--leak_db .record .record__cell__value { | ||
max-width: 500px; | ||
word-wrap: break-word; | ||
padding: 0.4em; | ||
} | ||
|
||
.zci--leak_db .record .record__cell__key { | ||
padding: 0.4em; | ||
} | ||
|
||
.zci--leak_db tr { | ||
border-bottom:1px solid #efefef; | ||
.is-mobile .zci--leak_db .record .record__cell__value { | ||
max-width: 150px; | ||
} | ||
|
||
.zci--leak_db th { | ||
vertical-align:bottom; | ||
text-align:left; | ||
font-size:83.3%; | ||
font-style:italic; | ||
padding-left:3px; | ||
.zci--leak_db .record .record__body{ | ||
width: 100%; | ||
} | ||
|
||
.zci--leak_db td { | ||
padding:2px; | ||
max-width:250px; | ||
.is-mobile .zci--leak_db .record .record__cell__key { | ||
max-width: 50px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,36 @@ | ||
function ddg_spice_leak_db(api_result){ | ||
(function(env){ | ||
"use strict"; | ||
env.ddg_spice_leak_db = function(api_result){ | ||
|
||
if (!api_result | ||
|| !api_result.found | ||
|| !api_result.hashes) { | ||
return; | ||
} | ||
|
||
var query = DDG.get_query() | ||
.replace(/^(leakdb|hashme)\s+|\s+(leakdb|hashme)$/i, ''); | ||
var type = api_result.type == 'plaintext' ? | ||
query : api_result.type + ' hash'; | ||
if (!api_result || !api_result.found || !api_result.hashes) { | ||
return Spice.failed('leak_db'); | ||
} | ||
|
||
api_result.hashes = api_result.hashes[0]; | ||
var query = DDG.get_query() | ||
.replace(/^(leakdb|hashme)\s+|\s+(leakdb|hashme)$/i, ''); | ||
var type = api_result.type == 'plaintext' ? | ||
query : api_result.type + ' hash'; | ||
|
||
Spice.add({ | ||
data : api_result, | ||
header1 : type + " (LeakDB)", | ||
sourceUrl : 'http://leakdb.abusix.com/?q=' | ||
+ encodeURIComponent(query), | ||
sourceName : 'leakdb.abusix.com', | ||
templates: { | ||
item: Spice.leak_db.leak_db, | ||
detail: Spice.leak_db.leak_db | ||
}, | ||
api_result.hashes = api_result.hashes[0]; | ||
|
||
|
||
}); | ||
|
||
$("#zero_click_abstract").css({ | ||
"margin" : "4px 12px 0px 2px !important" | ||
}); | ||
} | ||
|
||
Handlebars.registerHelper('LeakDB_list', function(hash, skip, options) { | ||
"use strict"; | ||
|
||
delete hash[skip]; | ||
return Object.keys(hash) | ||
.sort(function(a, b) { | ||
return a == 'plaintext' ? -1 : 1 | ||
}) | ||
.reduce(function(accumulator, key) { | ||
return accumulator + options.fn({ | ||
'type' : key, | ||
'value' : hash[key] | ||
}) | ||
}, ''); | ||
}); | ||
Spice.add({ | ||
id: 'leak_db', | ||
name: 'Leaks', | ||
data: { | ||
record_data: api_result.hashes | ||
}, | ||
meta: { | ||
sourceUrl: 'http://leakdb.abusix.com/?q='+ encodeURIComponent(query), | ||
sourceName: 'leakdb.abusix.com' | ||
}, | ||
templates: { | ||
group: 'base', | ||
options:{ | ||
content: 'record', | ||
moreAt: true, | ||
rowHighlight: true | ||
} | ||
} | ||
}); | ||
} | ||
}(this)); |