highlighting

Highlight search terms (select only leaf nodes)

末鹿安然 提交于 2019-11-27 05:30:27
I would like to highlight search terms on a page, but not mess with any HTML tags. I was thinking of something like: $('.searchResult *').each(function() { $(this.html($(this).html().replace(new RegExp('(term)', 'gi'), '<span class="highlight">$1</span>')); )}; However, $('.searchResult *').each matches all elements, not just leaf nodes. In other words, some of the elements matched have HTML inside them. So I have a few questions: How can I match only leaf nodes? Is there some built-in jQuery RegEx function to simplify things? Something like: $(this).wrap('term', $('<span />', { 'class':

How to do hit-highlighting of results from a SQL Server full-text query

天大地大妈咪最大 提交于 2019-11-27 03:27:21
问题 We have a web application that uses SQL Server 2008 as the database. Our users are able to do full-text searches on particular columns in the database. SQL Server's full-text functionality does not seem to provide support for hit highlighting. Do we need to build this ourselves or is there perhaps some library or knowledge around on how to do this? BTW the application is written in C# so a .Net solution would be ideal but not necessary as we could translate. 回答1: Expanding on Ishmael's idea,

LaTeX package to do syntax highlighting of code in various languages

試著忘記壹切 提交于 2019-11-27 02:29:28
I am looking for a LaTeX package that does syntax highlighting on code. For example, right now I use the verbatim block to write code: \begin{verbatim} <html> <head> <title>Hello</title> </head> <body>Hello</body> </html> \end{verbatim} And this works fine to display the code on my document. But, suppose I wanted to highlight the HTML markup the way an IDE would in the output document? Is there a package that could help? I would like to do the same for various languages such as Java, C#, HTML, CSS and so on. You can use the listings package. It supports many different languages and there are

Emacs: highlighting TODO *only* in comments

南楼画角 提交于 2019-11-27 01:22:22
问题 This question is related to another one, Emacs :TODO indicator at left side. I recently came across a minor mode I like a lot called FixmeMode. It supports auto highlighting of TODO marks, and navigating between them. However, I think it makes more sense to recognize the "TODO" strings only in comments, rather than polluting the whole file. Is it possible? 回答1: Check out the library fic-mode.el, it has been verified in C++ and Emacs-Lisp. It was written specifically to answer this question.

highlighting search results in php/mysql

拟墨画扇 提交于 2019-11-26 23:37:55
问题 how do i highlight search results from mysql query using php? this is my [modified] code: $search_result = ""; $search_result = $_GET["q"]; $result = mysql_query('SELECT cQuotes, vAuthor, cArabic, vReference FROM thquotes WHERE cQuotes LIKE "%' . $search_result .'%" ORDER BY idQuotes DESC', $conn) or die ('Error: '.mysql_error()); function h($s) { echo htmlspecialchars($s, ENT_QUOTES); } ?> <div class="caption">Search Results</div> <div class="center_div"> <table> <?php while ($row= mysql

How does one change the color for text highlighting in Xcode 4 for warnings and errors? [duplicate]

China☆狼群 提交于 2019-11-26 22:54:23
问题 Possible Duplicate: Fix for Xcode's indiscernible highlighting of inline errors? Does anyone know how to change the color of the in-line highlighting for warnings and errors in Xcode 4? With almost every theme, the yellow warning highlight makes the underlying code impossible to read. Example picture 回答1: Just came across this, which seems to be able to modify some of Xcode's behaviors by creating some sort of plugin. Maybe one can be developed to change text highlight color. http:/github.com

jQuery “blinking highlight” effect on div?

人走茶凉 提交于 2019-11-26 22:32:11
问题 I'm looking for a way to do the following. I add a <div> to a page, and an ajax callback returns some value. The <div> is filled with values from the ajax call, and the <div> is then prepended to another <div> , which acts as a table column. I would like to get the user's attention, to show her/him that there is something new on the page. I want the <div> to blink, not show/hide, but to highlight/unhighlight for some time, lets say 5 seconds. I have been looking at the blink plugin, but as

Search and Highlight in jQuery

南笙酒味 提交于 2019-11-26 22:19:24
I would like to search and highlight text using jQuery/Java Script. sample HTML 1: <div id="div1"><b>Good</b> <b>Morning</b> </div> <div id="div2">Good Evening</div> <div id="div3">Good Morning</div>Searched String = "Good Morning" When i search for String "Good Morning", Both the contents in div1 and div3 should get highlighted. ie. the output html should be <div id="div1"><span class="highlight"><b>Good</b> <b>Morning</b> </span></div> <div id="div2">Good Evening</div> <div id="div3"><span class="highlight">Good Morning</span></div> I have used the plugin https://raw.github.com/bartaz

Android: Disable highlighting in GridView

丶灬走出姿态 提交于 2019-11-26 18:58:58
问题 How can I turn off the orange highlight when clicking an item in a GridView? I haven't been able to find a solution in the documentation or through testing. 回答1: Use android:listSelector="#00000000" in your GridView element in your XML layout file. 回答2: Another option is to reference the transparent color via @android:color/transparent <?xml version="1.0" encoding="utf-8"?> <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid" android:layout_width="fill

How to stop highlighting of a div element when double-clicking

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 18:58:42
问题 I have this div element with a background image and I want to stop highlighting on the div element when double-clicking it. Is there a CSS property for this? 回答1: The CSS below stops users from being able to select text. Live example: http://jsfiddle.net/hGTwu/20/ -webkit-user-select: none; /* Chrome/Safari */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* IE10+ */ /* Rules below not implemented in browsers yet */ -o-user-select: none; user-select: none; To target IE9