Removed non working search from epub viewer

pull/85/head
OzzieIsaacs 8 years ago
parent 313116dca7
commit a6b6700a73

@ -1,7 +1,7 @@
EPUBJS.reader.search = {}; EPUBJS.reader.search = {};
// Search Server -- https://github.com/futurepress/epubjs-search // Search Server -- https://github.com/futurepress/epubjs-search
EPUBJS.reader.search.SERVER = "https://pacific-cliffs-3579.herokuapp.com"; EPUBJS.reader.search.SERVER = "";
EPUBJS.reader.search.request = function(q, callback) { EPUBJS.reader.search.request = function(q, callback) {
var fetch = $.ajax({ var fetch = $.ajax({

@ -73,19 +73,15 @@
<!-- Plugins --> <!-- Plugins -->
<!-- <script src="js/plugins/search.js"></script> --> <!-- <script src="js/plugins/search.js"></script> -->
<script src="{{ url_for('static', filename='js/plugins/search.js') }}"></script> <!--script src="{{ url_for('static', filename='js/plugins/search.js') }}"></script-->
<!-- Highlights -->
<!-- <script src="js/libs/jquery.highlight.js"></script> -->
<!-- <script src="js/hooks/extensions/highlight.js"></script> -->
</head> </head>
<body> <body>
<div id="sidebar"> <div id="sidebar">
<div id="panels"> <div id="panels">
<input id="searchBox" placeholder="search" type="search"> <!--input id="searchBox" placeholder="search" type="search"-->
<a id="show-Search" class="show_view icon-search" data-view="Search">Search</a> <!--a id="show-Search" class="show_view icon-search" data-view="Search">Search</a-->
<a id="show-Toc" class="show_view icon-list-1 active" data-view="Toc">TOC</a> <a id="show-Toc" class="show_view icon-list-1 active" data-view="Toc">TOC</a>
<a id="show-Bookmarks" class="show_view icon-bookmark" data-view="Bookmarks">Bookmarks</a> <a id="show-Bookmarks" class="show_view icon-bookmark" data-view="Bookmarks">Bookmarks</a>
<a id="show-Notes" class="show_view icon-edit" data-view="Notes">Notes</a> <a id="show-Notes" class="show_view icon-edit" data-view="Notes">Notes</a>

@ -548,45 +548,45 @@ def read_book(book_id,format):
book_dir = os.path.join(config.MAIN_DIR, "cps","static", str(book_id)) book_dir = os.path.join(config.MAIN_DIR, "cps","static", str(book_id))
if not os.path.exists(book_dir): if not os.path.exists(book_dir):
os.mkdir(book_dir) os.mkdir(book_dir)
if format.lower() == "epub": if format.lower() == "epub":
#check if mimetype file is exists #check if mimetype file is exists
mime_file = str(book_id) +"/mimetype" mime_file = str(book_id) +"/mimetype"
if os.path.exists(mime_file) == False: if os.path.exists(mime_file) == False:
epub_file = os.path.join(config.DB_ROOT, book.path, book.data[0].name) + ".epub" epub_file = os.path.join(config.DB_ROOT, book.path, book.data[0].name) + ".epub"
if not os.path.isfile(epub_file): if not os.path.isfile(epub_file):
raise ValueError('Error opening eBook. File does not exist: ', epub_file) raise ValueError('Error opening eBook. File does not exist: ', epub_file)
zfile = zipfile.ZipFile(epub_file) zfile = zipfile.ZipFile(epub_file)
for name in zfile.namelist(): for name in zfile.namelist():
(dirName, fileName) = os.path.split(name) (dirName, fileName) = os.path.split(name)
newDir = os.path.join(book_dir, dirName) newDir = os.path.join(book_dir, dirName)
if not os.path.exists(newDir): if not os.path.exists(newDir):
try: try:
os.makedirs(newDir) os.makedirs(newDir)
except OSError as exception: except OSError as exception:
if exception.errno == errno.EEXIST: if exception.errno == errno.EEXIST:
pass pass
else: else:
raise raise
if fileName: if fileName:
fd = open(os.path.join(newDir, fileName), "wb") fd = open(os.path.join(newDir, fileName), "wb")
fd.write(zfile.read(name)) fd.write(zfile.read(name))
fd.close() fd.close()
zfile.close() zfile.close()
return render_template('read.html', bookid=book_id, title="Read a Book") return render_template('read.html', bookid=book_id, title="Read a Book")
elif format.lower() == "pdf": elif format.lower() == "pdf":
all_name = str(book_id) +"/"+ urllib.quote(book.data[0].name) +".pdf" all_name = str(book_id) +"/"+ urllib.quote(book.data[0].name) +".pdf"
tmp_file = os.path.join(book_dir,urllib.quote(book.data[0].name)) + ".pdf" tmp_file = os.path.join(book_dir,urllib.quote(book.data[0].name)) + ".pdf"
if os.path.exists(tmp_file) == False: if os.path.exists(tmp_file) == False:
pdf_file = os.path.join(config.DB_ROOT, book.path, book.data[0].name) + ".pdf" pdf_file = os.path.join(config.DB_ROOT, book.path, book.data[0].name) + ".pdf"
copyfile(pdf_file,tmp_file) copyfile(pdf_file,tmp_file)
return render_template('readpdf.html', pdffile=all_name, title="Read a Book") return render_template('readpdf.html', pdffile=all_name, title="Read a Book")
elif format.lower() == "txt": elif format.lower() == "txt":
all_name = str(book_id) +"/"+ urllib.quote(book.data[0].name) +".txt" all_name = str(book_id) +"/"+ urllib.quote(book.data[0].name) +".txt"
tmp_file = os.path.join(book_dir,urllib.quote(book.data[0].name)) + ".txt" tmp_file = os.path.join(book_dir,urllib.quote(book.data[0].name)) + ".txt"
if os.path.exists(all_name) == False: if os.path.exists(all_name) == False:
txt_file = os.path.join(config.DB_ROOT, book.path, book.data[0].name) + ".txt" txt_file = os.path.join(config.DB_ROOT, book.path, book.data[0].name) + ".txt"
copyfile(txt_file,tmp_file) copyfile(txt_file,tmp_file)
return render_template('readtxt.html', txtfile=all_name, title="Read a Book") return render_template('readtxt.html', txtfile=all_name, title="Read a Book")
else : else :
flash("Error opening eBook. File does not exist or file is not accessible:", category="error") flash("Error opening eBook. File does not exist or file is not accessible:", category="error")
return redirect('/' or url_for("index", _external=True)) return redirect('/' or url_for("index", _external=True))

Loading…
Cancel
Save