Augmented Browsing: added template for document info bar

pull/1/head
cominch 13 years ago
parent c2f0d16d2c
commit e4dab19045

@ -102,7 +102,7 @@ public class getpageinfo {
}
if (scraper != null) {
// put the document title
prop.putXML("title", scraper.dc_title());
prop.putXML("title", removelinebreaks(scraper.dc_title()));
// put the favicon that belongs to the document
prop.put("favicon", (scraper.getFavicon()==null) ? "" : scraper.getFavicon().toString());
@ -119,7 +119,7 @@ public class getpageinfo {
}
prop.put("tags", count);
// put description
prop.putXML("desc", scraper.dc_description());
prop.putXML("desc", removelinebreaks(scraper.dc_description()));
// put language
final Set<String> languages = scraper.getContentLanguages();
prop.putXML("lang", (languages == null) ? "unknown" : languages.iterator().next());
@ -185,7 +185,14 @@ public class getpageinfo {
return prop;
}
private static String checkOAI(final String url) {
private static String removelinebreaks(String dc_title) {
String newtitle = dc_title.replace ("\r", "");
newtitle = newtitle.replace ("\n", "");
newtitle = newtitle.replace ("\r\n", "");
return newtitle;
}
private static String checkOAI(final String url) {
final DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
try {

@ -0,0 +1,61 @@
<span id="sci_doc_#[hash]#" class="sci_doc" style="display: none;">
<img id="sci_doc_#[hash]#_img" src="/currentyacypeer/interaction_elements/document.png" width="16px" height="16px" alt="0" onclick="/* $('#sci_doc_#[hash]#_box').toggle();*/ return false">&nbsp; <span style="font-size: x-small; position: absolute; margin-top: 4px;"><span id="sci_doc_#[hash]#_title"></span></span>
</span>
<style type="text/css" >
.sci_panel {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
right: 0;
background: #ffffff;
border:1px solid #5a346e;
width: 210px;
height: auto;
padding: 30px 110px 30px 30px;
z-index:99998;
color: #5a346e;
}
.sci_document {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
right: 100px;
top: 0;
background: #ffffff;
border:0px;
width: 65px;
height: 20px;
padding: 5px 5px 5px 5px;
z-index:99998;
color: #5a346e;
}
</style>
<div id="sci_doc_#[hash]#_box" class="sci_panel" style="top: 50px; display: none;">
<script type="text/javascript" charset="utf-8">
document.getElementById('sci_doc_#[hash]#').style.display = "";
var metajson = getMetadata('#[url]#');
document.getElementById('sci_doc_#[hash]#_title').innerHTML = metajson.item.title;
</script>
</div>

@ -0,0 +1,28 @@
package interaction_elements;
import java.util.Collection;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.document.LibraryProvider;
import net.yacy.search.Switchboard;
import de.anomic.data.UserDB;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class Document_part {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
prop.put("hash", post.get("hash", ""));
prop.put("url", post.get("url", ""));
return prop;
}
}

@ -179,7 +179,10 @@ z-index:99999;
<div id="sidebar-logo" class="sci_left" style="">
<img src="/currentyacypeer/env/grafics/yacy.png" height="20px" width="36px"/>
<!--#include virtual="/currentyacypeer/interaction_elements/Tag_part.html?hash=#[urlhash]#" -->
<img src="/currentyacypeer/env/grafics/empty.gif" height="20px" width="20px"/>
<!--#include virtual="/currentyacypeer/interaction_elements/Document_part.html?hash=#[urlhash]#&url=#[url]#" -->
<img src="/currentyacypeer/env/grafics/empty.gif" height="20px" width="20px"/>
<!--#include virtual="/currentyacypeer/interaction_elements/Tag_part.html?hash=#[urlhash]#" -->
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

@ -2,7 +2,7 @@
function getMetadata (url) {
var res = {"item": ""};
var res = {"item": {"title": "no title"}};
$.ajaxSetup({async: false});

Loading…
Cancel
Save