How to access the search bar in a Firefox 57+ ("Quantum") web extension - firefox-addon-webextensions

I try to write my very first webextension, following this tutorial. I wrote a manifest.json and added a background script as I want to provide global functionality: I want to clear the search bar once the search was performed - basically it's this, but for Firefox 57+.
My question: How can I access the search bar at all?
I found a list of available APIs, including the tabs, the menus, and so on, but no search bar...

Currently it is not possible. You might want to file a bug for it: https://bugzilla.mozilla.org/

I filed a bug request as #Smile4ever suggested, which was declined yesterday. The extension team suggested to file a feature request for what "my" extension should have done, but from the perspective of this question: It is and will not be possible to access the search bar from an extension.

For sake of completeness, here is the URL of the bug (feature request) for FF in order to offer functionality (probably optionable) to clear contents of search bar after a search is performed: Bugzilla 253331

It appears that the search bar has been deliberately removed from Fire Fox Quantum and the address bar doubles as a search bar. So from now on use the address bar to type in your search. You will notice that when no web address is typed into the address bar. The address bar, By Default, has text in it that reads. SEARCH OR ENTER ADDRESS,

Related

Interpolating custom data onto a PDF

I am building an Angular test preparation app (with Laravel 5.1 API). One of the requirements is to allow the user to print a certificate of achievement.
The client wants the person's name and credentials interpolated into the document (e.g., highlighted below). Here is a snapshot of the PDF template they sent:
The way I'm handling PDF viewing is simply by storing the file on S3 and giving them a link to that file.
Interpolating information into a PDF doc doesn't seem trivial and I haven't found much information on programmatically allowing this, but there are tools like DocHub, that allow you do edit while viewing the PDF.
I'm interested in learning:
is doing this programmatically trivial?
are there 3rd party tools I'm unaware of?
would I even be able to send this information along to the S3 link to interpolate in the first place?
Using PDF as a format for editing is usually a bad choice. If you have a form with fixed fields, then it's easy. Create a PDF template with an interactive form. In this form, based on AcroForm technology, you'll define fields with fixed coordinates, and a fixed size. You can then add content to these fields.
One major disadvantage with this approach is the lack of flexibility. Did you notice that I used the word "fixed" three times in the previous paragraph? If text doesn't fit the predefined field, you're out of luck. If the field is overdimensioned, you'll end up with plenty of white space. This approach is great if you can predict what the data will be like. A typical use case is a ticket or a voucher. For instance: the empty form is a really nice page, with only a couple of fields where an automated system can put a name, a date, a time, and a seat number.
This isn't the best approach for the example you show in your screen shot. The position of every line of text, every word, every character is known in advance. If you want to replace a short word with a long word (or vice-versa), then all those positions (of each line, of the complete page, possibly of the complete document) need to be recalculated. That's madness. Only people with very poor design skills come up with such an idea.
A better idea, is to store the template as HTML. See for instance chapter 5 of iText's pdfHTML tutorial, where we have this snippet of HTML:
<html>
<head>
<title>Invitation to SXSW 2018</title>
</head>
<body>
<u><b>Re: Invitation</b></u>
<br>
<p>Dear <name>SXSW visitor</name>,
we hope you had a great SXSW film festival experience last year.
And we would like to invite you to the next edition of SXSW Film
that takes place from March 9 until March 17, 2018.</p>
<p>Sincerely,<br>
The SXSW crew<br>
<date>August 4, 2017</date></p>
</body>
</html>
Actually, it's not really HTML, because the <name> tag and the <date> tag don't exist in HTML. All HTML processors (browsers as well as pdfHTML) ignore those tags and treat their content as if the tag was a <span>:
It doesn't make much sense to have such tags in the context of pure HTML, but it does make a lot of sense in the case of pdfHTML. With pdfHTMLL, you can configure custom tags, and have a result that looks like the PDFs shown below:
Look at the document for "John Doe" and compare it with the document for "Bruno Lowagie". The name "John Doe" is much shorter than my name, hence more words fit on that first line. The text flows nicely (we could also have chosen to justify the text on both sides). This "flow" is impossible to achieve with your approach, because you will never get a PDF template to reflow nicely.
OK, I get it, you probably say, but what about the practical aspects? You talk about a Java / .Net library, but I am working with Laravel and Angular.js. First, let me tell you that I don't think you'll find any good PDF tools for Laravel or Angular.js, because of the nature of PDF and those development environments (in my opinion, those technologies don't play well together). Regardless of my opinion, this shouldn't be much of a problem for you because you work in an Amazon environment. AWS supports Java, and the Java code needed to get pdfHTML working is minimal. Most of the code samples I wrote for the pdfHTML tutorial are shorter than 15 lines. So why not try Java and pdfHTML?
If you're already using Amazon services, why not use an amazon lambda function, in combination with iText7 (java), to generate the pdf on demand?
That way, you are guaranteed that the pdf is correct, and has nice layout every time.
Generating the pdf can either be done by:
converting HTML,
programmatically creating your entire document,
filling and flattening an XFA form.
I think for your use-case, either option 1 or 2 are the most sustainable.

Why does a search engine summary contain text that is not in any of the static html files?

I have a hugo site, and on a search engine (Duckduckgo), my site's summary is:
Add your own "layouts/partials/hero.html" to replace this text.
I tried looking for the string hero in the files in my public folder, can't seem to find it.
I have added this file with some content. Nothing seems to happen. Do I need to edit the theme files or something?
Edit: changed title to make problem clearer. The original question asked about "hero cards", which I thought might have been a standard search engine friendly part of a website.
I think I understand what is happening now. I originally installed the base16 theme which does contain the text:
Add your own "layouts/partials/hero.html" to replace this text.
( it is in the file themes\base16\layouts\partials\hero.html.).
I should have realised, but search engines take time to re-index a site. I originally published the site using base16 with some text unedited. Duckduckgo was showing that old text, it will probably disappear in time when the site is reindexed.
The answer is in the documentation for the base16 theme:
You probably want to edit the homepage. Get started by copying the
supplied homepage to your own site.
$ mkdir -p layouts/partials
$ cp themes/base16/layouts/partials/hero.html layouts/partials/hero.html
After this, you can edit layouts/partials/hero.html and make it
awesome.
The default layouts/partials/hero.html contains the code Add your own "<code>layouts/partials/hero.html</code>" to replace this text., which is what DuckDuckGo was using to make its summary. As you noted in your answer above, if you edit this file then the DuckDuckGo summary should change when DuckDuckGo next indexes your site.

Drupal 7 - Blocks: how do you specify it a list of pages except certain pages?

I created a block that I want to appear on these paths:
example.com/sample/1
example.com/sample/2 example.com/sample/3
example.com/sample/4 example.com/sample/6
However, I don't want it to appear on:
example.com/sample/5
Under the visibility setting for the block, I can select show block on "Only the listed pages"
and enter something like /sample/*
Howevever, how do I tell it not to show up in /sample/5 without typing out all other paths individually? Is there an "except" or "not" indicator somehow like how the * indicates all?
Use the context module to handle the placement of your block. It allows you to specify which paths the block should display on, as well as which it should not (by starting the path with a ~)
For example, in your context you can specify your paths like so:
sample/*
~sample/5
this tells drupal to display your block on all paths that match "sample/*" except for "sample/5"
There is only two ways of getting the fine tuning you need:
You type one by one all the URLs you want to include/exclude
You go for the perfectly customizable php code mode.
Maybe you should try Context module http://drupal.org/project/context and see if the more complex, configurable options it provide serve your purpose/solve your problem.
PD. My first answer completely missed the point, i was thinking on views... sorry!

how to determine which profiles are assigned to a record type

I have 90 profiles,and a bunch of record types. Business wants to know who has access to a current record type (picklists..)
the only way i know how to do this, is to go profile by profile and check the Record Type Settings and see if it's listed.
is there a way to just generate a list or something? either through the point and click or apex?
EDIT:
I tried doing a search on the .profiles but eclipse doesn't support multi-line searches. Though it does support regexes i can't get my regular expression right, OR eclipse doesn't like me. Given my poor programming skills (and how I yell at my computer) it might be the latter. This is the string I want to search on.
<recordType>Event.RTEvent</recordType>
<visible>false</visible>
For something like this, I find that Notepad++ is a huge help. It supports multi-line searches if you enable the extended search mode (a simple radio button at the bottom of the Find menu), allowing you to grab line breaks (\r, \n, etc.). Pretty simple to do this across all of your profiles as well by navigating to the profiles folder of the Eclipse project in Windows Explorer, selecting all files, then right-click and select "Edit with Notepad++". Once they're all open, hit ctrl-F, enable the extended search mode, and search for something like this:
Event.RTEvent</recordType>\n <visible>false
Note that you may need to adjust the number of spaces after the \n depending on how far the data is indented. Click "Find All in All Opened Documents", and it'll give you a list of all occurrences of that string in your profiles files.

Plus One Button not traversing the dom to grab snippet data

It has been stated that the google plus-one button works it's way up the dom hierarchy when it is looking for microdata to set the +snippets information for sharing (Jenny Murphy said this at Google+ +1 Button Snippet+ Problem ). Also, the documentation on the +Snippets site from google at https://developers.google.com/+/plugins/+1button/#plus-snippet states "If the page is annotated with schema.org microdata, the +Snippet will use the name, image, and description properties found on any schema.org type". However, it doesn't appear that this is truly the case in some conditions.
We have a test page at http://www.magnetstreet.com/stores/html/weddings/testPage.html where it is demonstrating a very simple product page which has been marked up with schema.org microdata. This page passes w3c validation and its microdata is parsed properly in Googles rich snippets testing tool. However, when the +1 button is clicked and you proceed to share it, the api is clearly ignoring the itemprops set inside the product tag. This can be seen by how "page title" is displayed instead of "product title" which is the itemprop name.
Does anyone see any obvious issues with this code?
I would like to note, if we only have microdata properties set on the Product div and within (no itemscope or itemtypes on any outer elements), then the button works as expected. However, We have data on much more complex pages that need the other microdata, so removing all other microdata besides the product is not a solution.
There is an ongoing discussion I'm having with Jenny Murphy about this at https://groups.google.com/forum/#!topic/google-plus-developers/MvuZtu8prTo . In short, currently the +1 button only looks at the outermost itemscope for the snippet information. If it doesn't find it there, it stops parsing through microdata and instead looks for other ways to gather snippet info.
In the discussion I linked to, I've described why I think this can be a problem and am hoping to start some good dialog about it.

Resources