FindInPage-Talk

(redirected from Cookbook.InPageSearch-Talk)

Summary: Talk page for FindInPage.
Maintainer: Petko
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Is conditional inclusion and hiding possible?

Is it possible to include a find-in-page box in a div that is toggled hidden by default? Let's assume the Cookbook:Toggle recipe is installed and that the toggle is a "find" link in the page actions. This would allow the box to be shown on any page when requested by a user as long as the conditionals for showing the link are met. For example, if the page has no page actions, or if it only should be showing selected page actions but not "find", the box should not appear. -- RandyB March 19, 2016, at 02:17 PM

I haven't used Toggle but at first look you probably can use

(:toggle init=hide show="Find" id=fip_form:)
>>id=fip_form<<
>><<

to have the find form hidden initially. A solution to your second question could be placing that snippet in Site.PageActions. But as I think about it, if the "fip_form" element is missing, the form will appear at the top of the "wikitext" element. --Petko March 19, 2016, at 03:05 PM

Maybe the directive (:nofind:) which disables the form will help you. --Petko March 19, 2016, at 03:13 PM

Yes, putting conditional logic in Site.PageActions does seem to work. (Of course, I also have to add (:nofind:) to AuthForm, so the find box does not appear on the login form.)

Is there a conditional that will detect whether Site.PageActions has been included on the current page? I'd like to include (:nofind:) on any page for which PageActions has not been included. -- RandyB March 19, 2016, at 08:10 PM

I am unaware of such a conditional but there is (:noaction:) - if you have it in the page it usually causes the actions to not appear. So you may use (:noaction:)(:nofind:) in that page. What the recipe probably needs is a configuration option to not add a form if there is no fip_form element. --Petko March 19, 2016, at 11:20 PM

Speed

This looks useful. However, when I tried it on a long page (the type of page where it's most useful) it was painfully slow - much slower than using "find" in my browser. If it's technically possible, it might help to have an optional "search" or "highlight" button, so that the search isn't attempted until the search terms are completely entered. Another issue: when I had a PmForm on the page, I saw <mark> etc. inside the input box. -- RandyB February 07, 2016, at 09:17 AM

I've added a delay of 1500 ms between scans, instead of on every key press: this should reduce CPU needs and should "feel" faster. Additionally, you may want to set styles for .ips_notfound as a text "color", say #999, instead of "opacity", which should work faster (I'll change that in the instructions). Thanks for the report on textareas, should be fixed as of 20160207d. I'll think about a button instead of automatic scans. --Petko February 07, 2016, at 09:39 AM

It is indeed faster to use the built-in search in the browser, but 90% of people don't know how to use Ctrl+F when working with a browser or with an office suite, likely even less so in a mobile browser. And on a mobile browser it is hard to find information even in normal-size web pages. With this widget, readers have the program interface before their eyes: hopefully will help them. :-) --Petko February 07, 2016, at 03:32 PM

Nice! The button works great, and calling it "Find in page..." makes better semantic sense. -- RandyB February 09, 2016, at 10:45 PM

Talk page for the FindInPage recipe (users?).