Skip to content

Instantly share code, notes, and snippets.

@ftherese ftherese/x
Created Jan 28, 2009

What would you like to do?
name: "newadvent",
synonyms: ["catholic","search"],
modifiers: {in: noun_arb_text},
url: "{QUERY}&",
icon: "",
description: "Searches <a href=\"\">NewAdvent</a> for articles matching your words.",
help: "Try issuing &quot;newadvent gnostics in cathen&quot; to get results from the Catholic Encyclopedia. Works with &quot;cathen,&quot; &quot;fathers,&quot; &quot;bible,&quot; &quot;summa,&quot; and &quot;library.&quot;",
preview: function( pblock, thing, mods ) {
if (thing.text < 1) {pblock.innerHTML = "Search <b></b>";return;}
jQuery.get(this.url.replace("{QUERY}", thing.text) + "%2F" +,
function (doc)
{var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("", "ol");
tempElement.innerHTML = doc;
var resource = "";
if ({
switch ({
case "cathen": resource = " in the <b>Catholic Encyclopedia</b>"; break;
case "summa": resource = " in the <b>Summa Theologica</b>"; break;
case "bible": resource = " in the <b>Holy Bible</b>"; break;
case "fathers": resource = " in the <b>Fathers of the Church</b>"; break;
case "library": resource = " in the <b>Catholic Library</b>"; break;
// I know there must be a better way of accomplishing the following, but I am an absolute newbie when it comes to jQuery. Help would be appreciated.
pblock.innerHTML = "Found on <b>NewAdvent</b>" + resource ;
for (i=0; i<=7; i++ ) {
pblock.innerHTML += "<div style='clear: both;'><b><a href='" + jQuery("ol h3 a",tempElement).eq(i).attr("href") + "' >" + jQuery("ol h3 a",tempElement).eq(i).html() + "</a></b><br/><div style='margin-left: 20px; font-size: 80%;'>" + jQuery("ol div.s",tempElement).eq(i).html() + "</div></div>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.