Adding the change observer after the initial filter occurs seems to be able to cause race conditions, particularly on Startpage. This commit moves the change observer addition to the beginning of the filtering function. The downside is that adding the change observer before filtering starts isn't ideal, since filtering manipulates the DOM and can trigger a re-check.
When hiding or replacing Google search results, we now use the search result container's parentNode. This avoids some UI conflicts and issues, particularly when injecting the replacement button.
For Google search result re-ordering, we still use the original search container w/o the parent node.
Adding a check for div.MjjYud when injecting redirect button into Google search results. This helps resolve UI issues with non-traditional search results (like video results).
Google will insert the user's searches into some of their meta links. If the user does a Google search for a non-indie domain (e.g. mario.fandom.com), that domain can appear in those Google meta links and cause IWB to detect them. By filtering out links that start with /search, we avoid capturing these.
Refactor code that depends on the destination wiki's platform in order
to support generic wiki platforms (e.g. Wikidot).
Redirection to the Main Page now uses the destination_content_path to
send users directly to the destination wiki's main page, rather than
using a different URL depending on the destination wiki's software.
The only remaining code that depends on the destination wiki's software
is the construction of the search path. This code now has a default case
that doesn't add any software-specific path to a constructed search URL.
This allows any wiki, regardless of the software it runs on, to be
added by putting its full search path in the "destination_search_path"
property of the redirect definition.
As a result of these changes, it is now possible to add redirects to
Wikidot wikis, by just defining the full search path in their redirect
entry's "destination_search_path".
Co-authored-by: SnorlaxMonster <snorlaxmonster@users.noreply.github.com>