Permalink
Browse files

Super Find and Highlight

  • Loading branch information...
psankar committed Aug 17, 2011
0 parents commit de25d4cb70ccec6ac8df43a6d1414df68964ccc0
Showing with 9,099 additions and 0 deletions.
  1. +21 −0 highlight.css
  2. BIN icon.png
  3. +54 −0 jquery.highlight-3.js
  4. +8,981 −0 jquery.js
  5. +16 −0 manifest.json
  6. +26 −0 popup.html
  7. +1 −0 sfind.css
@@ -0,0 +1,21 @@
+/* Style definition file generated by highlight 2.16, http://www.andre-simon.de/ */
+
+/* Highlighting theme definition: */
+
+body.hl { background-color:#ffffff; }
+pre.hl { color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';}
+.hl.num { color:#2928ff; }
+.hl.esc { color:#ff00ff; }
+.hl.str { color:#ff0000; }
+.hl.dstr { color:#818100; }
+.hl.slc { color:#838183; font-style:italic; }
+.hl.com { color:#838183; font-style:italic; }
+.hl.dir { color:#008200; }
+.hl.sym { color:#000000; }
+.hl.line { color:#555555; }
+.hl.mark { background-color:#ffffbb;}
+.hl.kwa { color:#000000; font-weight:bold; }
+.hl.kwb { color:#830000; }
+.hl.kwc { color:#000000; font-weight:bold; }
+.hl.kwd { color:#010181; }
+
BIN icon.png
Binary file not shown.
@@ -0,0 +1,54 @@
+/*
+
+highlight v3
+
+Highlights arbitrary terms.
+
+<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
+
+MIT license.
+
+Johann Burkard
+<http://johannburkard.de>
+<mailto:jb@eaio.com>
+
+*/
+
+jQuery.fn.highlight = function(pat) {
+ alert ("Hello Scripts, Thankg God");
+ function innerHighlight(node, pat) {
+ var skip = 0;
+ if (node.nodeType == 3) {
+ var pos = node.data.toUpperCase().indexOf(pat);
+ if (pos >= 0) {
+ var spannode = document.createElement('span');
+ spannode.className = 'highlight';
+ var middlebit = node.splitText(pos);
+ var endbit = middlebit.splitText(pat.length);
+ var middleclone = middlebit.cloneNode(true);
+ spannode.appendChild(middleclone);
+ middlebit.parentNode.replaceChild(spannode, middlebit);
+ skip = 1;
+ }
+ }
+ else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
+ for (var i = 0; i < node.childNodes.length; ++i) {
+ i += innerHighlight(node.childNodes[i], pat);
+ }
+ }
+ return skip;
+ }
+ return this.each(function() {
+ innerHighlight(this, pat.toUpperCase());
+ });
+};
+
+jQuery.fn.removeHighlight = function() {
+ return this.find("span.highlight").each(function() {
+ this.parentNode.firstChild.nodeName;
+ with (this.parentNode) {
+ replaceChild(this.firstChild, this);
+ normalize();
+ }
+ }).end();
+};
Oops, something went wrong.

0 comments on commit de25d4c

Please sign in to comment.