linkify search results too

This commit is contained in:
Brad Fitzpatrick 2011-05-30 18:21:06 -07:00
parent ae221c0712
commit f698ee736b
3 changed files with 6 additions and 6 deletions

View File

@ -47,11 +47,6 @@ function blobInfoUpdate(bmap) {
}
}
function linkifyBlobRefs(schemaBlob) {
var re = /(\w{3,6}-[a-f0-9]{30,})/g;
return schemaBlob.replace(re, "<a href='./?b=$1'>$1</a>");
}
function blobInfoOnLoad() {
var blobref = getBlobParam();
if (!blobref) {

View File

@ -233,6 +233,11 @@ function isPlausibleBlobRef(blobRef) {
return /^\w+-[a-f0-9]+$/.test(blobRef);
}
function linkifyBlobRefs(schemaBlob) {
var re = /(\w{3,6}-[a-f0-9]{30,})/g;
return schemaBlob.replace(re, "<a href='./?b=$1'>$1</a>");
}
// Helper function for camliNewSetAttributeClaim() (and eventually, for
// similar functions to add or delete attributes).
function changeAttribute(permanode, claimType, attribute, value, opts) {

View File

@ -6,7 +6,7 @@ function search() {
console.log("no status 200; got " + xhr.status);
return;
}
document.getElementById("searchres").innerHTML = "<pre>" + xhr.responseText + "</pre>";
document.getElementById("searchres").innerHTML = "<pre>" + linkifyBlobRefs(xhr.responseText) + "</pre>";
};
xhr.open("GET", disco.searchRoot + "camli/search", true);
xhr.send();