From 39899b9eebe0bca8d5e45631b54190d2fd4dc5a9 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Tue, 9 Feb 2010 20:36:47 +0000 Subject: [PATCH] Added topic block previews for recon candidates. git-svn-id: http://google-refine.googlecode.com/svn/trunk@82 7d457c2a-affb-35e4-300a-418c747d4874 --- .../scripts/project/data-table-cell-ui.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/webapp/scripts/project/data-table-cell-ui.js b/src/main/webapp/scripts/project/data-table-cell-ui.js index 2ee8e2c52..b5f9539da 100644 --- a/src/main/webapp/scripts/project/data-table-cell-ui.js +++ b/src/main/webapp/scripts/project/data-table-cell-ui.js @@ -65,6 +65,11 @@ DataTableCellUI.prototype._render = function() { .addClass("data-table-recon-topic") .attr("href", "http://www.freebase.com/view" + candidate.id) .attr("target", "_blank") + .click(function(evt) { + self._previewCandidateTopic(candidate.id, this); + evt.preventDefault(); + return false; + }) .text(candidate.name) .appendTo(li); @@ -136,3 +141,25 @@ DataTableCellUI.prototype.doPostThenUpdate = function(command, params) { "json" ); }; + +DataTableCellUI.prototype._previewCandidateTopic = function(id, elmt) { + var url = "http://www.freebase.com/widget/topic" + id + '?mode=content&blocks=[{"block"%3A"image"}%2C{"block"%3A"full_info"}%2C{"block"%3A"article_props"}]'; + + var fakeMenu = MenuSystem.createMenu(); + fakeMenu + .width(700) + .height(300) + .css("background", "none") + .css("border", "none"); + + var iframe = $('') + .attr("width", "100%") + .attr("height", "100%") + .css("background", "none") + .css("border", "none") + .attr("src", url) + .appendTo(fakeMenu); + + MenuSystem.showMenu(fakeMenu, function(){}); + MenuSystem.positionMenuLeftRight(fakeMenu, $(elmt)); +};