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

Commit

Permalink
Merge pull request #855 from duckduckgo/jd/leakdb
Browse files Browse the repository at this point in the history
leakdb: update to record template
  • Loading branch information
Jag Talon committed Jun 25, 2014
2 parents ffa1ff2 + c9b7b6b commit 988ee5b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 72 deletions.
35 changes: 20 additions & 15 deletions share/spice/leak_db/leak_db.css
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;
}

12 changes: 0 additions & 12 deletions share/spice/leak_db/leak_db.handlebars

This file was deleted.

76 changes: 31 additions & 45 deletions share/spice/leak_db/leak_db.js
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));

0 comments on commit 988ee5b

Please sign in to comment.