How to detect all document library web parts and do something with CSS or JavaScript

%3CLINGO-SUB%20id%3D%22lingo-sub-446969%22%20slang%3D%22en-US%22%3EHow%20to%20detect%20all%20document%20library%20web%20parts%20and%20do%20something%20with%20CSS%20or%20JavaScript%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-446969%22%20slang%3D%22en-US%22%3E%3CP%3EI'd%20like%20to%20apply%20certain%20CSS%2FJavaScript%20to%20ALL%20Document%20libraries%20within%20the%20site%20collection.%20For%20example%2C%20I'd%20like%20to%20add%20a%20banner%20on%20the%20top%20of%20every%20document%20library%20for%20some%20informational%20verbiage.%3C%2FP%3E%3CP%3EI%20figured%20this%20perhaps%20should%20be%20done%20within%20the%20.master%20file%20as%20it%20is%20being%20applied%20globally.%20However%2C%20I'm%20having%20a%20hard%20time%20finding%20a%20detector%2Fgrabber%20that%20could%20pin%20point%20all%20the%20document%20library%20web%20parts%20on%20the%20page.%20Is%20there%20any%20unique%20identifiers%20such%20as%20%22Id%3D%22%20%22Class%3D%22%20or%20other%20properties%20that%20I%20could%20have%20CSS%2FJavaScript%20to%20recognize%20that%20the%20web%20part%20is%20a%20document%20library%20and%20do%20something%20about%20it%3F%3C%2FP%3E%3CP%3EPlease%20note%20the%20two%20following%20conditions%20that%20the%20solution%20should%20also%20be%20able%20to%20overcome%20-%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3EMake%20distinction%20between%20Document%20library%20v.s.%20Generic%20List%2C%20although%20they%20rendered%20similar%20in%20many%20ways.%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3EIt%20should%20work%20when%20the%20document%20library%20is%20either%20on%20its%20own%20aspx%20page%20or%20gets%20added%20to%20a%20zone%20of%20another%20page%20as%20a%20web%20part.%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-446969%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

I'd like to apply certain CSS/JavaScript to ALL Document libraries within the site collection. For example, I'd like to add a banner on the top of every document library for some informational verbiage.

I figured this perhaps should be done within the .master file as it is being applied globally. However, I'm having a hard time finding a detector/grabber that could pin point all the document library web parts on the page. Is there any unique identifiers such as "Id=" "Class=" or other properties that I could have CSS/JavaScript to recognize that the web part is a document library and do something about it?

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

  1. Make distinction between Document library v.s. Generic List, although they rendered similar in many ways.

  2. It should work when the document library is either on its own aspx page or gets added to a zone of another page as a web part.

0 Replies