Copy locally and extract Jira bundled plugin jira-fileviewer-plugin-7.2.1.jar located at ./atlassian-jira/WEB-INF/atlassian-bundled-plugins
In extracted folder open file-service.js and delete (or wrap in comment) following lines:
if (!featureManager.isFeatureEnabled("jira.fileviewer.disable.pdf")) {
selectors.document.push("a[file-preview-type=document]");
}
addDocumentSelector: function addDocumentSelector(sel) {
pushSingleOrArray(selectors.document, sel);
}
Remove same lines from minified file-service-min.js. You can use JS prettify and minify tools to do this.
Save files. Put folder content in ZIP. Rename file to jira-fileviewer-plugin-7.2.1.jar, copy to server and restart Jira.
On Jira 8 – same .jar, editing fileviewer.js (and minified version) does the trick:
you just have to edit the viewers: [“image”, “document”] array to [“image”]