I need to run a JavaScript script when a document library is opened/shown. The script should be available only on the specific document library.
One possible solution could be adding the script directly in the site master page, but that would make it present on every page using that master page (even if the script isn't actually run - I could check the page url or something similar) while I would prefer to not have it included when unnecessary.
Can anyone provide some guidance on how to achieve this? I don't have specific requirements other than the above, so fell free to suggest the most fitting solution you may think of.