diff options
-rw-r--r-- | views/message.erb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/views/message.erb b/views/message.erb index 5e2537d..fa58a63 100644 --- a/views/message.erb +++ b/views/message.erb @@ -37,7 +37,7 @@ </table> </div> -<pre class="ag-message-content"><div class="d-flex flex-row"><div class="text-right pr-3"><% strip_email(message['_source']['content']).split("\n").each_with_index do |line, index| %><a id="L<%= index + 1 %>" class="ag-line-number" href="#L<%= index + 1 %>"><%= index + 1 %></a><br/><% end %></div><div><%= linkize(strip_email(message['_source']['content'])) %></div></div></pre> +<pre class="ag-message-content"><div class="d-flex flex-row"><div class="text-right pr-3"><% strip_email(message['_source']['content']).split("\n").each_with_index do |line, index| %><a id="L<%= index + 1 %>" class="ag-line-number" href="#L<%= index + 1 %>"><%= index + 1 %></a><br/><% end %></div><div id="ag-message-body" class="w-100"><%= linkize(strip_email(message['_source']['content'])) %></div></div></pre> <% if message['_source']['attachments'] and not message['_source']['attachments'].empty? %> <h3>Attachments</h3> @@ -84,3 +84,13 @@ <a href="<%= msgid_to_googlegroup(message['_source']['raw_message_id']) %>" class="btn btn-outline-secondary"><span class="fa fa-fw fa-share-square"></span>Find on Google Groups</a> </div> </div> + +<script> + var lineNumber = window.location.hash.substr(1).replace("L", ""); + + if(!isNaN(parseFloat(lineNumber)) && isFinite(lineNumber)){ + var lines = document.getElementById("ag-message-body").innerHTML.split("\n"); + lines[parseFloat(lineNumber) - 1] = '<div style="display: inline-block;background-color:#FFF3CD;">' + lines[parseFloat(lineNumber) - 1] + '</div>' + document.getElementById("ag-message-body").innerHTML = lines.join("\n"); + } +</script>
\ No newline at end of file |