Skip to content

Commit

Permalink
got search term to show up
Browse files Browse the repository at this point in the history
  • Loading branch information
NishC committed Jun 6, 2018
1 parent 240849d commit a2515ff
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 18 deletions.
6 changes: 6 additions & 0 deletions TripleDataProcessor/src/main/webapp/css/noresults.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 7,12 @@
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}

#term_text{
text-align: center;
margin-bottom: 5px;
}

p {
Expand Down
10 changes: 6 additions & 4 deletions TripleDataProcessor/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 4,18 @@
<head>
<title>Index</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

<link rel="stylesheet" href="/TripleDataProcessor/css/index.css" type="text/css"/>

<script type="text/javascript" src="/TripleDataProcessor/js/cookieCommands.js"></script>

<script type="text/javascript">
window.onload = function(){
document.getElementById('search_text').innerHTML = " " GetCookie('InputString');
// eraseCookie();
}
$(document).ready(function() {
$("#search_text").text(GetCookie('InputString'));
});
</script>

<link href="https://fonts.googleapis.com/css?family=Montserrat:400,600,700" rel="stylesheet">
Expand Down
22 changes: 13 additions & 9 deletions TripleDataProcessor/src/main/webapp/js/cookieCommands.js
Original file line number Diff line number Diff line change
@@ -1,14 1,18 @@
function setCookie(value) {

// expiry set for 1 day
function SetCookie(name, value){
var expires = "";
// if (days) {
delete_cookie(name);
if (true) {
var date = new Date();
date.setTime(date.getTime() (9999999999));
date.setTime(date.getTime() (1*24*60*60*1000));
expires = "; expires=" date.toUTCString();
// }
document.cookie = "InputString=" (value || "") expires "; path=/";
}
document.cookie = name "=" value ";" expires ";";
}
function getCookie() {
var nameEQ = "InputString=";

function GetCookie(name) {
var nameEQ = name "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i ) {
var c = ca[i];
Expand All @@ -18,6 22,6 @@ function getCookie() {
return null;
}

function eraseCookie() {
document.cookie = 'InputString=; Max-Age=-99999999;';
function delete_cookie( name ) {
document.cookie = name '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
7 changes: 5 additions & 2 deletions TripleDataProcessor/src/main/webapp/js/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 5,14 @@ function post( message ) {
url: 'http://localhost:8080/TripleDataProcessor/webapi/myresource',
data: message,
success: function(response) {
console.log('POST successful');
console.log('POST successful');
delete_cookie('InputString');
SetCookie('InputString', document.getElementById('myViafId').value);
window.location = response;
},
contentType: 'text/plain',
});

});
}
}

21 changes: 19 additions & 2 deletions TripleDataProcessor/src/main/webapp/noresults.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 9,24 @@

<link rel="stylesheet" href="/TripleDataProcessor/css/noresults.css" type="text/css"/>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

<script type="text/javascript" src="/TripleDataProcessor/js/cookieCommands.js"></script>

<script type="text/javascript">
$(document).ready(function() {
var cookie = GetCookie('InputString');
if(cookie != null){
$("#term_text").text(cookie);
} else {
$("#term_text").text("The Term you searched");
}
});
</script>

</head>

Expand All @@ -18,7 35,7 @@
<a id = "back" href = "./search"><i class="fa fa-arrow-circle-o-left" style="font-size:50px;font-weight:500;color:#3B5998;"></i></a>

<div id ="main">
<p id="description"> <b> Sorry! </b> </br> </br> TERM does not exists in the UCD Library Catalog as of now. </p>
<p id="description"> <b> Sorry! </b> </br> <p id="term_text"></p> does not exist in the UCD Library Catalog as of now. </p>

</div>

Expand Down
2 changes: 1 addition & 1 deletion TripleDataProcessor/src/main/webapp/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 33,7 @@

<script type="text/javascript" src="/TripleDataProcessor/js/viaf.integration.js"></script>

<script type="text/javascript" src="/TripleDataProcessor/js/cookie.commands.js"></script>
<script type="text/javascript" src="/TripleDataProcessor/js/cookieCommands.js"></script>

<script type="text/javascript" src="/TripleDataProcessor/js/post.js"></script>

Expand Down

0 comments on commit a2515ff

Please sign in to comment.