-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #810 from equalizedigital/william/7971471368/conve…
…rt-link_pdf-rule-to-JS Convert link_pdf rule and link_ms_office_doc to js
- Loading branch information
Showing
6 changed files
with
53 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Detects linked MS Office files. | ||
*/ | ||
|
||
const msOfficeFileExtensions = [ '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pps', '.ppsx' ]; | ||
|
||
// This generates a very long list of selectors, 6 in total for each extension: extension at the end, | ||
// extension within having query vars, extension within having #anchors plus uppercase versions of the | ||
// file extension for each one of these cases. It is still quicker that iterating through all the links | ||
// on the page and checking the href in a matches. | ||
const selectorString = msOfficeFileExtensions.map( ( extension ) => `a[href$="${ extension }"], a[href$="${ extension.toUpperCase() }"], a[href*="${ extension }?"], a[href*="${ extension.toUpperCase() }?"], a[href*="${ extension }#"], a[href*="${ extension.toUpperCase() }#"]` ).join( ', ' ); | ||
|
||
export default { | ||
id: 'link_ms_office_file', | ||
selector: selectorString, | ||
excludeHidden: false, | ||
tags: [ | ||
'cat.custom', | ||
], | ||
metadata: { | ||
description: 'Links to MS Office documents typically should be checked.', | ||
}, | ||
all: [], | ||
any: [ 'always-fail' ], | ||
none: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Detects linked PDFs. | ||
*/ | ||
export default { | ||
id: 'link_pdf', | ||
selector: 'a[href$=".pdf"], a[href$=".PDF"], a[href*=".pdf?"], a[href*=".PDF?"], a[href*=".pdf#"], a[href*=".PDF#"]', | ||
excludeHidden: false, | ||
tags: [ | ||
'cat.custom', | ||
], | ||
metadata: { | ||
description: 'Links to PDFs typically should be checked.', | ||
}, | ||
all: [], | ||
any: [ 'always-fail' ], | ||
none: [], | ||
}; |