How to detect all document library Web Parts and do something with CSS or JavaScript

I would like to apply some CSS / JavaScript to ALL the document libraries of the site collection. For example, I would like to add a banner at the top of each document library for an information word.

I thought that this should perhaps be done in the .master file as it is applied globally. However, I have trouble finding a detector / recorder capable of locating all the Web Parts of the document library on the page. Are there unique identifiers such as "Id =" "Class =" or other properties that I could use in CSS / JavaScript to recognize that the Web part is a library of documents and fix it?

Please note the following two conditions that the solution should also be able to overcome:

  1. Distinguish between the document library v. Generic list, although they have made similar in many ways.

  2. This should work when the document library is on its own aspx page or is added to an area on another page as a Web Part.