<commit_before>viewer_is_shown = false;
function hidePDFviewer() {
  viewer_is_shown = false;
  $('table').show();
  $('#controls').html(oldcode);
  $("#viewer").remove();
  $("#loading").remove()
  document.title = lastTitle;
}
function showPDFviewer(dir,filename){
	if(!viewer_is_shown){
		$("#editor").hide();
		var url = OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(filename)+"&dir="+encodeURIComponent(dir);
		$('table').hide();
		function im(path) { return OC.filePath('files_pdfviewer','js','pdfjs/web/images/'+path); }
		oldcode = $("#controls").html();
		$("#controls").empty();
		$("#controls").html('<button id="previous" onclick="PDFView.page--;" oncontextmenu="return false;"><img src="'+im('go-up.svg')+'" align="top" height="10"/>Previous</button><button id="next" onclick="PDFView.page++;" oncontextmenu="return false;"><img src="'+im('go-down.svg')+'" align="top" height="10"/>Next</button><div class="separator"></div><input style="width:25px;" type="number" id="pageNumber" onchange="PDFView.page = this.value;" value="1" size="4" min="1" /><span>/</span><span id="numPages">--</span><div class="separator"></div><button id="zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();" oncontextmenu="return false;"><img src="'+im('zoom-out.svg')+'" align="top" height="10"/></button><button id="zoomIn" title="Zoom In" onclick="PDFView.zoomIn();" oncontextmenu="return false;"><img src="'+im('zoom-in.svg')+
			'" align="top" height="10"/></button><div class="separator"></div><select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;"><option id="customScaleOption" value="custom"></option><option value="0.5">50%</option><option value="0.75">75%</option><option value="1">100%</option><option value="1.25" selected="selected">125%</option><option value="1.5">150%</option><option value="2">200%</option><option id="pageWidthOption" value="page-width">Page Width</option><option id="pageFitOption" value="page-fit">Page Fit</option></select><div class="separator"></div><button id="print" onclick="window.print();" oncontextmenu="return false;"><img src="'+im('document-print.svg')+'" align="top" height="10"/>Print</button><button id="download" title="Download" onclick="PDFView.download();" oncontextmenu="return false;">'+
			'<img src="'+im('download.svg')+'" align="top" height="10"/>Download</button><button id="close" title="Close viewer" onclick="hidePDFviewer();" oncontextmenu="return false;">x</button><span id="info">--</span></div>');
		oldcontent = $("#content").html();
		$("#content").html(oldcontent+'<div id="loading">Loading... 0%</div>    <div id="viewer"></div>');
		lastTitle = document.title;
		PDFView.Ptitle = filename;
		PDFView.open(url,1.00);
		$("#pageWidthOption").attr("selected","selected");
		$("header").css({zIndex:0});
		viewer_is_shown = true;
	}
}

var extrahtml = '<li id="extra" style="display:none;"><a title="" href="'+OC.webroot+"/apps/files_pdfviewer/lastopened.php"+'" style="background-image:url(/owncloud/apps/files_pdfviewer/css/history.png)">Last opened</a></li>';

$(document).ready(function(){
     if(location.href.indexOf("files")!=-1) {
        PDFJS.workerSrc = OC.filePath('files_pdfviewer','js','pdfjs/build/pdf.js');
	if(typeof FileActions!=='undefined'){
		FileActions.register('application/pdf','Edit','',function(filename){
			showPDFviewer($('#dir').val(),filename);
		});
		FileActions.setDefault('application/pdf','Edit');
	}
	OC.search.customResults.Text=function(row,item){
		var text=item.link.substr(item.link.indexOf('file=')+5);
		var a=row.find('a');
		a.data('file',text);
		a.attr('href','#');
		a.click(function(){
			var file=text.split('/').pop();
			var dir=text.substr(0,text.length-file.length-1);
			showFileEditor(dir,file);
		});
	}
    }
});
<commit_msg>some coding style fixes for the pdf viewer<commit_after>function hidePDFviewer() {
	showPDFviewer.shown = false;
	$('table').show();
	$('#controls').html(showPDFviewer.oldcode);
	$("#viewer").remove();
	$("#loading").remove()
	document.title = showPDFviewer.lastTitle;
}

function showPDFviewer(dir,filename){
	if(!showPDFviewer.shown){
		$("#editor").hide();
		var url = OC.filePath('files','ajax','download.php')+'?files='+encodeURIComponent(filename)+"&dir="+encodeURIComponent(dir);
		$('table').hide();
		function im(path) { return OC.filePath('files_pdfviewer','js','pdfjs/web/images/'+path); }
		showPDFviewer.oldcode = $("#controls").html();
		$("#controls").empty();
		$("#controls").html('<button id="previous" onclick="PDFView.page--;" oncontextmenu="return false;"><img src="'+im('go-up.svg')+'" align="top" height="10"/>Previous</button><button id="next" onclick="PDFView.page++;" oncontextmenu="return false;"><img src="'+im('go-down.svg')+'" align="top" height="10"/>Next</button><div class="separator"></div><input style="width:25px;" type="number" id="pageNumber" onchange="PDFView.page = this.value;" value="1" size="4" min="1" /><span>/</span><span id="numPages">--</span><div class="separator"></div><button id="zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();" oncontextmenu="return false;"><img src="'+im('zoom-out.svg')+'" align="top" height="10"/></button><button id="zoomIn" title="Zoom In" onclick="PDFView.zoomIn();" oncontextmenu="return false;"><img src="'+im('zoom-in.svg')+
			'" align="top" height="10"/></button><div class="separator"></div><select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;"><option id="customScaleOption" value="custom"></option><option value="0.5">50%</option><option value="0.75">75%</option><option value="1">100%</option><option value="1.25" selected="selected">125%</option><option value="1.5">150%</option><option value="2">200%</option><option id="pageWidthOption" value="page-width">Page Width</option><option id="pageFitOption" value="page-fit">Page Fit</option></select><div class="separator"></div><button id="print" onclick="window.print();" oncontextmenu="return false;"><img src="'+im('document-print.svg')+'" align="top" height="10"/>Print</button><button id="download" title="Download" onclick="PDFView.download();" oncontextmenu="return false;">'+
			'<img src="'+im('download.svg')+'" align="top" height="10"/>Download</button><button id="close" title="Close viewer" onclick="hidePDFviewer();" oncontextmenu="return false;">x</button><span id="info">--</span></div>');
		var oldcontent = $("#content").html();
		$("#content").html(oldcontent+'<div id="loading">Loading... 0%</div><div id="viewer"></div>');
		showPDFviewer.lastTitle = document.title;
		PDFView.Ptitle = filename;
		PDFView.open(url,1.00);
		$("#pageWidthOption").attr("selected","selected");
		showPDFviewer.shown = true;
	}
}
showPDFviewer.shown=false;
showPDFviewer.oldCode='';
showPDFviewer.lastTitle='';

var extrahtml = '<li id="extra" style="display:none;"><a title="" href="'+OC.webroot+"/apps/files_pdfviewer/lastopened.php"+'" style="background-image:url(/owncloud/apps/files_pdfviewer/css/history.png)">Last opened</a></li>';

$(document).ready(function(){
	if(location.href.indexOf("files")!=-1) {
		PDFJS.workerSrc = OC.filePath('files_pdfviewer','js','pdfjs/build/pdf.js');
		if(typeof FileActions!=='undefined'){
			FileActions.register('application/pdf','Edit','',function(filename){
				showPDFviewer($('#dir').val(),filename);
			});
			FileActions.setDefault('application/pdf','Edit');
		}
	}
});

{'fraction_non_alphanumeric': 0.24821452634415847, 'fraction_numerical': 0.014014283789246733, 'mean_word_length': 8.095588235294118, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 131, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5980584', 'n_tokens_mistral': 2539, 'n_tokens_neox': 2400, 'n_words': 320}