Fixed issue 62: It'd be nice if URIs were hyperlinked in the data cells
git-svn-id: http://google-refine.googlecode.com/svn/trunk@865 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
b721401261
commit
b026c90399
@ -21,6 +21,7 @@ Fixes:
|
||||
We load whatever rows that are filtered through, not particularly starred rows.
|
||||
- Issue 49: "Add Edit Cells / Set Null"
|
||||
- Issue 30: "Transform dialog should remember preferred language."
|
||||
- Issue 62: "It'd be nice if URIs were hyperlinked in the data cells"
|
||||
|
||||
Features:
|
||||
- Row/record sorting (Issue 32)
|
||||
|
@ -1,4 +1,45 @@
|
||||
URL = {};
|
||||
URL = {
|
||||
schemes: { // 1 means followed by ://, 0 means followed by just :
|
||||
"callto":0,
|
||||
"chrome":1,
|
||||
"file":1,
|
||||
"ftp":1,
|
||||
"http":1,
|
||||
"https":1,
|
||||
"imap":1,
|
||||
"info":0,
|
||||
"irc":1,
|
||||
"jar":0,
|
||||
"javascript":0,
|
||||
"lastfm":1,
|
||||
"ldap":1,
|
||||
"ldaps":1,
|
||||
"mailto":0,
|
||||
"news":0,
|
||||
"nntp":1,
|
||||
"pop":1,
|
||||
"sftp":1,
|
||||
"skype":0,
|
||||
"smb":1,
|
||||
"ssh":1,
|
||||
"svn":1,
|
||||
"svn+ssh":1,
|
||||
"telnet":1,
|
||||
"view-source":0
|
||||
}
|
||||
};
|
||||
(function() {
|
||||
var minLength = 100;
|
||||
var maxLength = 0;
|
||||
|
||||
for (var n in URL.schemes) {
|
||||
minLength = Math.min(minLength, n.length);
|
||||
maxLength = Math.max(maxLength, n.length);
|
||||
}
|
||||
|
||||
URL.minSchemeLength = minLength;
|
||||
URL.maxSchemeLength = maxLength;
|
||||
})();
|
||||
|
||||
URL.getParameters = function() {
|
||||
var r = {};
|
||||
@ -14,3 +55,17 @@ URL.getParameters = function() {
|
||||
|
||||
return r;
|
||||
};
|
||||
|
||||
URL.looksLikeUrl = function(s) {
|
||||
if (s.length > URL.minSchemeLength + 1) {
|
||||
var sep = s.substring(0, URL.maxSchemeLength + 3).indexOf(":");
|
||||
if (sep >= URL.minSchemeLength) {
|
||||
var scheme = s.substring(0, sep).toLowerCase();
|
||||
if (scheme in URL.schemes) {
|
||||
return URL.schemes[scheme] == 0 ||
|
||||
s.substring(sep + 1, sep + 3) == "//";
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
@ -31,9 +31,21 @@ DataTableCellUI.prototype._render = function() {
|
||||
} else if ("e" in cell) {
|
||||
$('<span>').addClass("data-table-error").text(cell.e).appendTo(divContent);
|
||||
} else if (!("r" in cell) || !cell.r) {
|
||||
var span = $('<span>').text(cell.v).appendTo(divContent);
|
||||
if (typeof cell.v !== "string") {
|
||||
span.addClass("data-table-value-nonstring");
|
||||
$('<span>')
|
||||
.addClass("data-table-value-nonstring")
|
||||
.text(cell.v)
|
||||
.appendTo(divContent);
|
||||
} else if (URL.looksLikeUrl(cell.v)) {
|
||||
$('<a>')
|
||||
.text(cell.v)
|
||||
.attr("href", cell.v)
|
||||
.attr("target", "_blank")
|
||||
.appendTo(divContent);
|
||||
} else {
|
||||
$('<span>')
|
||||
.text(cell.v)
|
||||
.appendTo(divContent);
|
||||
}
|
||||
} else {
|
||||
var r = cell.r;
|
||||
|
Loading…
Reference in New Issue
Block a user