-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sainivikas/slave
Slave
- Loading branch information
Showing
6 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# Info-Reader | ||
This is the UI version of Info Reader | ||
This is the simple UI version of Info Reader. | ||
Currently show only all content of info format file. | ||
|
||
How to Operate: | ||
================ | ||
Open home.html file | ||
Press O for open a file, page will automatically redirect after choose a info format file | ||
and give error if format of file is not info. | ||
The new page will show the content of file. | ||
Press B for go back on home.html. | ||
|
||
|
||
|
||
|
||
Issue: | ||
======= | ||
Not fully keyboard-centric for Firefox currently. | ||
Will fix in later release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
h1,h2,h3 { | ||
text-align:center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function key_pressed(key) | ||
{ | ||
var key_ascii; | ||
if(window.event) // For IE | ||
{ | ||
key_ascii = key.keyCode; | ||
} | ||
else if(key.which) // For other browsers | ||
{ | ||
key_ascii = key.which; | ||
} | ||
if(key_ascii == 111) | ||
open_file(); | ||
} | ||
|
||
function open_file() | ||
{ | ||
var input_id = document.getElementById("info_file"); | ||
input_id.click(); | ||
} | ||
|
||
function changeContent(evt) | ||
{ | ||
var file_obj = document.getElementById("info_file").files[0]; | ||
var file_name = file_obj.name; | ||
var ext_obj = file_name.split('.'), extension; | ||
var i; | ||
for(i in ext_obj) | ||
extension = ext_obj[i]; | ||
// check file extension is info or not | ||
if(extension == 'info') | ||
{ | ||
if (file_obj) | ||
{ | ||
var reader = new FileReader(); | ||
reader.onload = function(e) | ||
{ | ||
contents = e.target.result; | ||
localStorage.setItem('contents', contents); | ||
localStorage.setItem('file_name', file_name); | ||
document.getElementById("home_form").submit(); | ||
} | ||
reader.readAsText(file_obj); | ||
} | ||
else | ||
{ | ||
alert("Sorry,Failed to load file,Try Again"); | ||
} | ||
} | ||
else | ||
alert("Wrong file format,Please open files of info format only"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function write() | ||
{ | ||
lines = localStorage.getItem('contents'); | ||
file_name = localStorage.getItem('file_name'); | ||
var length = lines.length; | ||
var content = ""; | ||
for(i=0;i<length;i++) | ||
{ | ||
if(lines.charAt(i) == '\n') | ||
content = content + '<br>'; | ||
else | ||
content = content + lines.charAt(i); | ||
} | ||
document.getElementById("file_name").innerHTML = 'Contents of ' + file_name; | ||
document.getElementById("file_content").innerHTML = content; | ||
} | ||
|
||
|
||
function key_pressed(key) | ||
{ | ||
var key_ascii; | ||
if(window.event) // For IE | ||
{ | ||
key_ascii = key.keyCode; | ||
} | ||
else if(key.which) // For other browsers | ||
{ | ||
key_ascii = key.which; | ||
} | ||
if(key_ascii == 98) | ||
window.open("home.html","_self"); | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title> Info File Reader </title> | ||
<script src="../js/reader.js"></script> | ||
<link rel="stylesheet" type="text/css" href="../css/show.css"> | ||
</head> | ||
<body onkeypress="key_pressed(event)"> | ||
<h1>Welcome to Info Reader</h1> | ||
<hr/> | ||
<br> | ||
<h2>Press O for open a file</h2> | ||
<br> | ||
<br> | ||
<br> | ||
<center> | ||
<form id="home_form" action="show.html"> | ||
<input type="file" id="info_file" onchange="changeContent()" /> | ||
</form> | ||
</center> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Info File Reader</title> | ||
<script src="../js/writter.js"></script> | ||
<link rel="stylesheet" type="text/css" href="../css/show.css"> | ||
<link rel="stylesheet" type="text/css" href="../css/pagediv.css"> | ||
</head> | ||
<body onload="write()" onkeypress="key_pressed(event)"> | ||
|
||
<h1>Press B For Go Back</h1> | ||
<hr/> | ||
<h2 id="file_name"></h2> | ||
<hr/> | ||
<h3 id="file_content"></h3> | ||
|
||
</body> | ||
</html> |