Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Rref animation" #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion public/files/Article 4v2.json

This file was deleted.

111 changes: 0 additions & 111 deletions public/stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ body {
font-size: 14px;
line-height: 22px;
color: #000;
overflow-x: hidden;
}

html {
Expand Down Expand Up @@ -2943,114 +2942,4 @@ span.stButton_gradient,
color: #000;
font-weight: 400;
letter-spacing: 2px;
}

.node {
cursor: pointer;
}

.node circle {
fill: #fff;
stroke: steelblue;
stroke-width: 1.5px;
}

.node text {
font: 10px sans-serif;
}

.link {
fill: none;
stroke: #ccc;
stroke-width: 1.5px;
}

.item-ref{
min-height: 220px;
font-size: 16px;
font-weight: 300;
line-height: 18px;
vertical-align: center;
margin : 0px 20px;
cursor: pointer;
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
}
.owl-nav{
margin-top : 30px !important;
margin-right: 20px !important;
}
.owl-dots{
display: none;
}
.owl-nav div{
font-size: 18px;
color: #0099ae;
border: 1px solid #2e6da4;
font-family: 'Open Sans', sans-serif;
font-weight: 300;
padding: 10px 25px;
background-color: #337ab7 !important;
height: 30px;
width: 50px;

}


#rref-paper-references{
background-color : #f0f0f0;
}
#rref-papers{
background-color : #f0f0f0 !important;
}


.article-details{
background: transparent !important;
}
.article-details b{
font-weight: 500 !important;
}

.root-ref{
padding: 80px;
}
.child-ref{
padding: 80px;
}
.root-ref>.container-fluid, .child-ref>.container-fluid{
background-color: #fff;
border-radius: 10px;
padding:0px !important;

}
.root-ref .title-bar, .child-ref .title-bar{
background-color: #337ab7;
color: #fff;
padding: 20px;
-webkit-box-shadow: 0px 6px 5px 0px rgba(51, 122, 183, 0.2);
-moz-box-shadow: 0px 6px 5px 0px rgba(51, 122, 183, 0.2);
box-shadow: 0px 6px 5px 0px rgba(51, 122, 183, 0.2);
margin-bottom: 20px;
}

.ref-container{
padding: 0px !important;
}
.ref-container .ref-text{
padding:10px;
}
.ref-title{
background-color: #337ab7;
color: #fff;
padding: 10px;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
}


@media only screen and (max-width: 760px){
.root-ref, .child-ref{
padding: 20px;
}
}
6 changes: 0 additions & 6 deletions public/stylesheets/owl.carousel.min.css

This file was deleted.

6 changes: 0 additions & 6 deletions public/stylesheets/owl.theme.default.min.css

This file was deleted.

185 changes: 0 additions & 185 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module.exports = function(io) {
var hbs = require('hbs');
var mongoose = require("mongoose");
var svgCaptcha = require("svg-captcha");
var async = require("async");
var circular = require("circular-json");

var schema = mongoose.Schema;

Expand Down Expand Up @@ -687,192 +685,9 @@ module.exports = function(io) {
res.render('aminerAPI', {});
});


// Create nested structure for D3.js library.
// var createJson = function(j, level){
// item = {};
// console.log("Level "+level);
// item["name"] = j.details.title;
// console.log("This title is " + item["name"]);
// item["children"]=[];
// if(j.referenced_articles != null){
// var ch = [];
// async.each(j.referenced_articles, function(o, callback){

// console.log("looping for "+o.details.name);
// ch.push(createJson(o, level+1));
// console.log("BACK AT LEVEL "+ level);
// // console.log("children is "+ circular.stringify(ch));

// });
// console.log("children at level "+level+" are");
// // console.log(ch);
// item["children"]=ch;
// // console.log("ITEM IS " + circular.stringify(item["children"]));
// // console.log("Copied ch" + JSON.stringify(item["children"], replacer));
// }

// return item;
// }

router.get('/rref', function(req, res, next) {

/*Following is the code for generating nested structure containing just name and references
This will be required in creating tree structure using D3.js library.*/
// fs.readFile('public/files/Article 4v2.json', {encoding : "utf8"},(err, data) => {
// if (err) throw err;
// var obj = JSON.parse(data);
// console.log("HERE");
// var created = createJson(obj, 0);

// try {
// fs.writeFileSync("public/files/testfile.json", circular.stringify(created), 'utf-8');
// } catch (e) {
// console.log("Error:", e.message);
// }
// console.log(created);
// // console.log("Created:\n" + circular.stringify(created));
// // console.log(created);

// });

var firstNode = {
id : "G",
label : "5452187",
color:{
border : "#a80008",
background:"#a80008",
highlight : "#a80008"
},
title : "The Power of Convex Relaxation: Near-Optimal Matrix Completion"
};
var edgePair = {};
var graph = {};
graph.nodes = firstNode;
graph.edges = edgePair;


var firstArticle ={};
fs.readFile('public/files/Article 4v2.json', {encoding:"utf8"}, (err, data)=>{
if(err) throw err;
var obj = JSON.parse(data);
// console.log("DEATAILS KEYS");
// console.log(Object.keys(obj.details.authors[0]));

firstArticle["title"] = obj.details.title;
firstArticle["articleId"] = obj.details.articleId;
firstArticle["publisher"] = obj.details.publisher;
firstArticle["doi"] = obj.details.doi;
var a="";
for(var i=0; i<obj.details.authors.length; i++){
console.log("HERE");
a += obj.details.authors[i].name ;//+ (i==obj.details.authors.length - 1)?'':',';
a+= (i==obj.details.authors.length - 1)?" ":", ";
}
firstArticle["authors"] = a;

var ch = [];
for(var i=0; i<obj.referenced_articles.length; i++){
item = {};
item["title"] = obj.referenced_articles[i].details.title;
item["articleId"] = obj.referenced_articles[i].details.articleId;
item["id"] = "0-"+i;
ch.push(item);
}
firstArticle["referenced_articles"] = ch;
// console.log(firstArticle);
res.render('rref', {data : firstArticle, graph : graph});

});


});

io.on("connection", function(socket) {
console.log("A user connected");

socket.on('graph_request', function(id){
var colors = ["#266348","#6242f4","#00a838","#1c2820","#a80008"];
var hierarchy = id.split("-");
fs.readFile('public/files/Article 4v2.json', {encoding:"utf8"}, (err, data)=>{
if(err) throw err;
var obj = JSON.parse(data);
var l = 0;
for(var j=1; j<hierarchy.length; j++){
obj = obj.referenced_articles[parseInt(hierarchy[j])];
l++;
}
var nodes = [];
var edgePairs = [];
for(var i=0; obj.referenced_articles && i<obj.referenced_articles.length; i++){
item = {};
item["label"] = obj.referenced_articles[i].details.articleId;
item["id"] = id+"-"+i;
item["color"]={
border : colors[l],
background : colors[l],
highlight : colors[l]
};
item["title"] = obj.referenced_articles[i].details.title;

edgePairItem = {};
edgePairItem.from = id;
edgePairItem.to = item["id"];
nodes.push(item);
edgePairs.push(edgePairItem);
}
var graph = {};
graph.nodes = nodes;
graph.edges = edgePairs;

socket.emit('graph_response', graph);
});

});
socket.on('rref_request', function(id){
var hierarchy = id.split("-");
fs.readFile('public/files/Article 4v2.json', {encoding:"utf8"}, (err, data)=>{
if(err) throw err;
var obj = JSON.parse(data);
var dirStructure = " / "+obj.details.title.substr(0, 20) + "...";
var l = 0;
for(var j=1; j<hierarchy.length; j++){
obj = obj.referenced_articles[parseInt(hierarchy[j])];
dirStructure += " / " + obj.details.title.substr(0, 20) + "...";
l++;
}

console.log("dir:\t" + dirStructure);
var returnArticle = {};
returnArticle["title"] = obj.details.title;
returnArticle["articleId"] = obj.details.articleId;
returnArticle["publisher"] = obj.details.publisher;
returnArticle["doi"] = obj.details.doi;
returnArticle["dirStructure"] = dirStructure;
returnArticle["level"] = l;

var a="";
for(var i=0; i<obj.details.authors.length; i++){
// console.log("HERE");
a += obj.details.authors[i].name ;//+ (i==obj.details.authors.length - 1)?'':',';
a+= (i==obj.details.authors.length - 1)?" ":", ";
}
returnArticle["authors"] = a;

var ch = [];
for(var i=0; obj.referenced_articles && i<obj.referenced_articles.length; i++){
item = {};
item["title"] = obj.referenced_articles[i].details.title;
item["articleId"] = obj.referenced_articles[i].details.articleId;
item["id"] = id+"-"+i;
ch.push(item);
}
returnArticle["referenced_articles"] = ch;
// console.log("ret Article:\n"+JSON.stringify(returnArticle));
socket.emit('rref_response', returnArticle);
});

});
socket.on('request_captcha', function(){
var captcha = svgCaptcha.create();
socket.emit("response_captcha", captcha);
Expand Down
2 changes: 0 additions & 2 deletions views/layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<link rel="stylesheet" type="text/css" href="/stylesheets/select2-bootstrap.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/jquery.dynatable.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css">

<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
Expand All @@ -35,7 +34,6 @@
<body>
{{{body}}}
<script type="text/javascript" src="/javascripts/bootstrap.min.js"></script>

<script type="text/javascript" src="/javascripts/lightbox.min.js"></script>
<script type="text/javascript" src="/javascripts/wow.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery.zoomooz.min.js"></script>
Expand Down
Loading