Path: csiph.com!3.eu.feeder.erje.net!feeder.erje.net!news.mb-net.net!open-news-network.org!.POSTED.120.232.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: alt.computer,comp.lang.javascript,sci.electronics.design Subject: Highlighting text (was: How get windows FIND() to work?) Followup-To: comp.lang.javascript Date: Wed, 05 Aug 2020 08:32:29 +0200 Organization: PointedEars Software (PES) Lines: 127 Message-ID: <3317374.iIbC2pHGDl@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit Injection-Info: gwaiyur.mb-net.net; posting-host="120.232.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.232.120"; logging-data="25932"; mail-complaints-to="abuse@open-news-network.org" User-Agent: KNode/4.14.10 Cancel-Lock: sha1:RmePaIJZ6p155WTRkK2GMdMItYQ= X-User-ID: U2FsdGVkX18FuuayK9beRq3BOi47WiME/LQ8WNlbjiv4IYNoqIKa6A== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Environment: Win7.1 Firefox 78 > > Sample line used: > Downhole Measurements What is happening then depends on the user agent. It is NOT a general command to highlight something. HTML is NOT a programming language. The FIND command of CMD.exe has *nothing to do* with HTML/JavaScript. JavaScript is *case-sensitive*. And “window” is NOT “windows”. > At least execution transfers from the calling HTML to the desired > destination HTML. HTML is _NOT_ a programming language. HTML does NOT “execute” and does NOT “call”. > BUT. the keyword does NOT get underlined or highlighted in any way. Of course not. HTML – HyperText *Markup* Language – is _NOT_ a programming language. To highlight something *in general*, you need a *programming* language. > It would be particularly nice if all the keywords got highlighted > and the first keyword was presented on the screen (think loong document > and keyword was in middle). > > Help? -- downhole-measurements.html ----------------------------------- -- highlight.js ---------------------------------------------------------- /** * highlight.js – Highlights occurrences of text in HTML documents * @author (C) 2020 Thomas 'PointedEars' Lahn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License at * for more details. */ var highlight = { getNeedle: function () { /* Get value of value of “find” parameter */ var value = (window.location.search.match(/[?&]find=([^&#]+)/) || [,]) [1]; if (value) value = decodeURIComponent(value); return value; }, focus: function (needle) { if (needle) { /* Focus first occurence */ if (typeof window.find != 'undefined' && !window.find(needle)) { if (typeof console != 'undefined' && typeof console.log != 'undefined') { console.log('Text not found: "' + needle + '"'); } } } }, highlight: function (needle) { if (needle) { /* Highlight all occurrences */ document.body.innerHTML = document.body.innerHTML.replace( new RegExp( /* slurp textareas and tags */ '(