/**
* This Script generates a Link to the current TYPO3-Page with the type-Parameter set to PDF_TYPENUM.
* That's useful in combination with the TYPO3-Extension pdf_generator, to serve a PDF version of the current page
* even if the URI of the current page looks like /index.php?&id=1&type=0&extkey[this]=kjfdfgsdfgsfdg&anotherkey=jkdfhhjdf
* work's with simulateStaticDocuments
* The link is only generated if JavaScript is enabled.
* the result looks like:
PDF
**/
var PDF_TYPENUM = 123; // Enter your pdf_generator TypeNum here!
var pdfUri = location.href;
if (pdfUri.search(/html/) != -1) {
pdfUri = pdfUri.replace(/.0.html/,'.html');
pdfUri = pdfUri.replace(/.html/,'.'+PDF_TYPENUM+'.html');
pdfUri += '?&type='+PDF_TYPENUM;
} else {
pdfUri = pdfUri.replace(/type=0/,'type='+PDF_TYPENUM);
if (pdfUri.indexOf('?') == -1) pdfUri += '?';
if (pdfUri.search(/type/) == -1) pdfUri += '&type='+PDF_TYPENUM;
pdfUri += '&type='+PDF_TYPENUM;
}
// Change this line if you like
document.write('PDF');