tryed to fix html display problem in tooltip + fixed problem button showPaste in modal not pointing to the paste

This commit is contained in:
Mokaddem 2016-11-10 10:30:29 +01:00
parent 34221b083f
commit 317005c2b4
2 changed files with 4 additions and 4 deletions

View file

@ -92,12 +92,13 @@ def event_stream_getImportantPasteByModule(module_name):
data["module"] = module_name data["module"] = module_name
data["index"] = index data["index"] = index
data["path"] = path data["path"] = path
data["content"] = content[0:content_range] data["content"] = content[0:content_range].replace("\"", "\'").replace("\r", " ").replace("\n", " ")
data["linenum"] = paste.get_lines_info()[0] data["linenum"] = paste.get_lines_info()[0]
data["date"] = curr_date data["date"] = curr_date
data["char_to_display"] = max_preview_modal data["char_to_display"] = max_preview_modal
data["finished"] = True if index == len(all_pastes_list) else False data["finished"] = True if index == len(all_pastes_list) else False
time.sleep(0.002) #So that the front end client is not flooded by data time.sleep(0.002) #So that the front end client is not flooded by data
print data["path"]
yield 'data: %s\n\n' % json.dumps(data) yield 'data: %s\n\n' % json.dumps(data)
@ -481,7 +482,7 @@ def importantPasteByModule():
paste = Paste.Paste(path) paste = Paste.Paste(path)
content = paste.get_p_content().decode('utf8', 'ignore') content = paste.get_p_content().decode('utf8', 'ignore')
content_range = max_preview_char if len(content)>max_preview_char else len(content)-1 content_range = max_preview_char if len(content)>max_preview_char else len(content)-1
all_content.append(content[0:content_range]) all_content.append(content[0:content_range].replace("\"", "\'").replace("\r", " ").replace("\n", " "))
curr_date = str(paste._get_p_date()) curr_date = str(paste._get_p_date())
curr_date = curr_date[0:4]+'/'+curr_date[4:6]+'/'+curr_date[6:] curr_date = curr_date[0:4]+'/'+curr_date[4:6]+'/'+curr_date[6:]
paste_date.append(curr_date) paste_date.append(curr_date)

View file

@ -34,7 +34,6 @@ function deploy_source() {
source.onmessage = function(event) { source.onmessage = function(event) {
var feed = jQuery.parseJSON( event.data ); var feed = jQuery.parseJSON( event.data );
var curr_numElem = parseInt($("#myTable_"+moduleName).attr('data-numElem')); var curr_numElem = parseInt($("#myTable_"+moduleName).attr('data-numElem'));
console.log(curr_numElem);
if (feed.index > curr_numElem & feed.module == moduleName) { // Avoid doubling the pastes if (feed.index > curr_numElem & feed.module == moduleName) { // Avoid doubling the pastes
// Add the row to the table // Add the row to the table
search_table.row.add( [ search_table.row.add( [
@ -42,7 +41,7 @@ function deploy_source() {
"<a target=\"_blank\" href=\"{{ url_for('showsavedpaste') }}?paste="+feed.path+"&num="+feed.index+"\"> "+ feed.path +"</a>", "<a target=\"_blank\" href=\"{{ url_for('showsavedpaste') }}?paste="+feed.path+"&num="+feed.index+"\"> "+ feed.path +"</a>",
feed.date, feed.date,
feed.linenum, feed.linenum,
"<p><span class=\"glyphicon glyphicon-info-sign\" data-toggle=\"tooltip\" data-placement=\"left\" title=\""+feed.content+"\"></span> <button type=\"button\" class=\"btn-link\" data-num=\""+feed.index+"\" data-toggle=\"modal\" data-target=\"#mymodal\" data-url=\"{{ url_for('showsavedpaste') }}?paste=\""+feed.path+"\"&num=\""+feed.index+"\" data-path=\""+feed.path+"\"><span class=\"fa fa-search-plus\"></span></button></p>" "<p><span class=\"glyphicon glyphicon-info-sign\" data-toggle=\"tooltip\" data-placement=\"left\" title=\""+feed.content+"\"></span> <button type=\"button\" class=\"btn-link\" data-num=\""+feed.index+"\" data-toggle=\"modal\" data-target=\"#mymodal\" data-url=\"{{ url_for('showsavedpaste') }}?paste="+feed.path+"&num="+feed.index+"\" data-path=\""+feed.path+"\"><span class=\"fa fa-search-plus\"></span></button></p>"
] ).draw( false ); ] ).draw( false );
$("#myTable_"+moduleName).attr('data-numElem', curr_numElem+1); $("#myTable_"+moduleName).attr('data-numElem', curr_numElem+1);
if(feed.finished) { if(feed.finished) {