Skip to content

Instantly share code, notes, and snippets.

@hippietrail
Created October 18, 2012 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hippietrail/3913440 to your computer and use it in GitHub Desktop.
Save hippietrail/3913440 to your computer and use it in GitHub Desktop.
Add a new entry to Stack Exchange search results
$('<div>', {
class: 'question-summary',
id: 'question-summary-QID',
html: $('<div>', {
class: 'statscontainer',
html: $('<div>', {
class: 'statsarrow'
})
}).append($('<div>', {
class: 'stats',
html: $('<div>', {
class: 'vote',
html: $('<div>', {
class: 'votes',
html: '<span class="vote-count-post"><strong>NN</strong></span><div class="viewcount">votes</div>'
})
}).append($('<div>', {
class: 'status answered-accepted',
html: '<strong>N</strong>answers'
}))
})).append($('<div>', {
class: 'views',
title: 'NNN views',
text: 'NNN views'
}))
}).append($('<div>', {
class: 'summary',
html: $('<h3>', {
html: '<a>This is the <span class="search-highlight">question</span> title.</a>'
})
}).append($('<div>', {
class: 'excerpt',
html: 'blah <span class="search-highlight">blah</span> blah'
})).append($('<div>', {
class: 'tags',
html: '<a href="/questions/tagged/tag1" class="post-tag" rel="tag">tag1</a>',
title: "show questions tagged 'tag1'"
})).append($('<div>', {
class: 'started fr',
html: $('<div>', {
class: 'user-info',
html: '<div class="user-action-time"> asked <span title="YYYY-MM-DD HH:MM:SSZ" class="relativetime">Mmm DD at HH:MM</span></div>'
}).append($('<div>', {
class: 'user-gravatar32',
html: '<a><div><img></div></a>'
})).append($('<div>', {
class: 'user-details',
html: '<a href="/users/1195996/user1195996">user1195996</a><br><span class="reputation-score" title="reputation score" dir="ltr">330</span><span title="7 bronze badges"><span class="badge3"></span><span class="badgecount">7</span></span>'
}))
}))
).insertBefore('.question-summary:first')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment