<script>
window.my_title = function(doc,i){
if ((doc.attrs.type == 'application/pdf' || doc.attrs.type == 'pdf') && doc.title == '') {
var m = doc.uri.match(/([^#]*)(#.*)?/);
var t = m[1].replace(/.*\/([^/]+\/?)/, '$1') + (m[2]||'');
t = decodeURIComponent(t);
return [{id:0, text:t, type:'custom'}];
}
}
</script>