<commit_before><?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
?>

<div class="panel">
	<div class="topbar">
		<div>
			<div class="topbar_left">
				<h1 class="tbtitle dnone"><?php echo $comic->url() ?> :: <?php echo $chapter->url() ?></h1>
				<div class="tbtitle dropdown_parent"><div class="text"><?php echo $comic->url() ?> ⤵</div>
					<?php
					echo '<ul class="dropdown">';
					foreach ($comics->all as $co)
					{
						echo '<li>' . $co->url() . '</li>';
					}
					echo '</ul>'
					?>
				</div>	
				<div class="tbtitle dropdown_parent"><div class="text"><?php echo '<a href="' . $chapter->href() . '">' . ((strlen($chapter->title()) > 58) ? (substr($chapter->title(), 0, 50) . '...') : $chapter->title()) . '</a>' ?> ⤵</div>
					<?php
					echo '<ul class="dropdown">';
					foreach ($chapters->all as $ch)
					{
						echo '<li>' . $ch->url() . '</li>';
					}
					echo '</ul>'
					?>
				</div>
				<div class="tbtitle icon_wrapper dnone" ><img class="icon off" src="<?php echo glyphish(181); ?>" /><img class="icon on" src="<?php echo glyphish(181, TRUE); ?>" /></div>
				<?php echo $chapter->download_url(NULL, "fleft"); ?>
			</div>
			<div class="topbar_right">
				<div class="tbtitle dropdown_parent dropdown_right"><div class="text"><?php echo count($pages); ?> ⤵</div>
					<?php
					$url = $chapter->href();
					echo '<ul class="dropdown" style="width:90px;">';
					for ($i = 1; $i <= count($pages); $i++)
					{
						echo '<li><a href="' . $url . 'page/' . $i . '" onClick="changePage(' . ($i - 1) . '); return false;">' . _("Page") . ' ' . $i . '</a></li>';
					}
					echo '</ul>'
					?>
				</div>		

				<div class="divider"></div>
				<span class="numbers">
					<?php
					//for ($i = (($val = $current_page - 3) <= 0)?(1):$val; $i <= count($pages) && $i < $current_page + 3; $i++) {
					for ($i = (($val = $current_page + 2) >= count($pages)) ? (count($pages)) : $val; $i > 0 && $i > $current_page - 3; $i--)
					{
						$current = ((count($pages) / 100 > 1 && $i / 100 < 1) ? '0' : '') . ((count($pages) / 10 > 1 && $i / 10 < 1) ? '0' : '') . $i;
						echo '<div class="number number_' . $i . ' ' . (($i == $current_page) ? 'current_page' : '') . '"><a href="' . $chapter->href . 'page/' . $i . '">' . $current . '</a></div>';
					}
					?>
				</span>
			</div>
		</div>
		<div class="clearer"></div>
	</div>
</div>


<div id="page">

	<div class="inner">
		<a href="<?php echo $chapter->next_page($current_page); ?>" onClick="return nextPage();" >
			<div class="preview"><img src="<?php echo $pages[$current_page - 1]['thumb_url'] ?>" /></div>
			<img class="open" src="<?php echo $pages[$current_page - 1]['url'] ?>" />
		</a>
	</div>
</div>

<div class="clearer"></div>

<div id="bottombar">
    <div class="pagenumber">
		<?php echo _('Page') . ' ' . $current_page ?>
    </div>
    <div class="socialbuttons">
        <div class="tweet">
            <a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo $chapter->href() ?>" data-count="horizontal" data-via="<?php echo get_setting_twitter(); ?>" data-related="<?php echo get_setting_twitter(); ?>">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
        </div>
		<div class="facebook">
			<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($chapter->href()) ?>&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:95px; height:21px;" allowTransparency="true"></iframe>
		</div>
		<div class="googleplus">
			<g:plusone size="medium" href="<?php echo $chapter->href() ?>"></g:plusone>
		</div>
    </div>
</div>

<script src="<?php echo site_url(); ?>assets/js/jquery.plugins.js"></script>
<script type="text/javascript">
	
	

	var title = document.title;
	
	var pages = <?php echo json_encode($pages); ?>;

	var next_chapter = "<?php echo $next_chapter; ?>";
	
	var preload_next = 7;

	var preload_back = 2;

	var current_page = <?php echo $current_page - 1; ?>;
	
	var initialized = false;
	
	var baseurl = '<?php echo $chapter->href() ?>';
	
	var site_url = '<?php echo site_url() ?>';
	
	var gt_page = '<?php echo addslashes(_("Page")) ?>';
	
	var gt_key_suggestion = '<?php echo addslashes(_("Use W-A-S-D or the arrow keys to navigate")) ?>';

	var gt_key_tap = '<?php echo addslashes(_("Double-tap to change page")) ?>';

	function changePage(id, noscroll, nohash)
	{
		id = parseInt(id);
		if (initialized && id == current_page)
			return false;
		
		if(!initialized) {
			create_message('key_suggestion', 4000, gt_key_suggestion);
		}
		
		initialized = true;
		if(id > pages.length-1) 
		{
			location.href = next_chapter;
			return false;
		}
		if(id < 0){
			current_page = 0;
			id = 0;
		} 
		
		preload(id);
		current_page = id;
		next = parseInt(id+1);
		jQuery("html, body").stop(true,true);
		if(!noscroll) jQuery.scrollTo('.panel', 430, {'offset':{'top':-6}});
		
		
		if(pages[id].loaded !== true) {
			jQuery('#page .inner img.open').css({'opacity':'0'});
			jQuery('#page .inner .preview img').attr('src', pages[id].thumb_url);
			jQuery('#page .inner img.open').attr('src', pages[id].thumb_url);
		}
		else {
			jQuery('#page .inner img.open').css({'opacity':'1'});
			jQuery('#page .inner .preview img').attr('src', pages[id].thumb_url);
			jQuery('#page .inner img.open').attr('src', pages[id].url);
		}
		
		resizePage(id);
		
		if(!nohash) History.pushState(null, null, baseurl+'page/' + (current_page + 1));
		document.title = gt_page+' ' + (current_page+1) + ' :: ' + title;
		update_numberPanel();
		jQuery('#pagelist .images').scrollTo(jQuery('#thumb_' + id).parent(), 400);
		jQuery('#pagelist .current').removeClass('current');
		jQuery('#thumb_' + id).addClass('current');
		
		jQuery("#ads_top_banner iframe").attr("src", site_url + "content/ads/ads_top.html");
		jQuery("#ads_bottom_banner iframe").attr("src", site_url + "content/ads/ads_bottom.html");
		
		return false;
	}


	function resizePage(id) {<commit_msg>Fix for iframes reloading in google ads<commit_after><?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');
?>

<div class="panel">
	<div class="topbar">
		<div>
			<div class="topbar_left">
				<h1 class="tbtitle dnone"><?php echo $comic->url() ?> :: <?php echo $chapter->url() ?></h1>
				<div class="tbtitle dropdown_parent"><div class="text"><?php echo $comic->url() ?> ⤵</div>
					<?php
					echo '<ul class="dropdown">';
					foreach ($comics->all as $co)
					{
						echo '<li>' . $co->url() . '</li>';
					}
					echo '</ul>'
					?>
				</div>	
				<div class="tbtitle dropdown_parent"><div class="text"><?php echo '<a href="' . $chapter->href() . '">' . ((strlen($chapter->title()) > 58) ? (substr($chapter->title(), 0, 50) . '...') : $chapter->title()) . '</a>' ?> ⤵</div>
					<?php
					echo '<ul class="dropdown">';
					foreach ($chapters->all as $ch)
					{
						echo '<li>' . $ch->url() . '</li>';
					}
					echo '</ul>'
					?>
				</div>
				<div class="tbtitle icon_wrapper dnone" ><img class="icon off" src="<?php echo glyphish(181); ?>" /><img class="icon on" src="<?php echo glyphish(181, TRUE); ?>" /></div>
				<?php echo $chapter->download_url(NULL, "fleft"); ?>
			</div>
			<div class="topbar_right">
				<div class="tbtitle dropdown_parent dropdown_right"><div class="text"><?php echo count($pages); ?> ⤵</div>
					<?php
					$url = $chapter->href();
					echo '<ul class="dropdown" style="width:90px;">';
					for ($i = 1; $i <= count($pages); $i++)
					{
						echo '<li><a href="' . $url . 'page/' . $i . '" onClick="changePage(' . ($i - 1) . '); return false;">' . _("Page") . ' ' . $i . '</a></li>';
					}
					echo '</ul>'
					?>
				</div>		

				<div class="divider"></div>
				<span class="numbers">
					<?php
					//for ($i = (($val = $current_page - 3) <= 0)?(1):$val; $i <= count($pages) && $i < $current_page + 3; $i++) {
					for ($i = (($val = $current_page + 2) >= count($pages)) ? (count($pages)) : $val; $i > 0 && $i > $current_page - 3; $i--)
					{
						$current = ((count($pages) / 100 > 1 && $i / 100 < 1) ? '0' : '') . ((count($pages) / 10 > 1 && $i / 10 < 1) ? '0' : '') . $i;
						echo '<div class="number number_' . $i . ' ' . (($i == $current_page) ? 'current_page' : '') . '"><a href="' . $chapter->href . 'page/' . $i . '">' . $current . '</a></div>';
					}
					?>
				</span>
			</div>
		</div>
		<div class="clearer"></div>
	</div>
</div>


<div id="page">

	<div class="inner">
		<a href="<?php echo $chapter->next_page($current_page); ?>" onClick="return nextPage();" >
			<div class="preview"><img src="<?php echo $pages[$current_page - 1]['thumb_url'] ?>" /></div>
			<img class="open" src="<?php echo $pages[$current_page - 1]['url'] ?>" />
		</a>
	</div>
</div>

<div class="clearer"></div>

<div id="bottombar">
    <div class="pagenumber">
		<?php echo _('Page') . ' ' . $current_page ?>
    </div>
    <div class="socialbuttons">
        <div class="tweet">
            <a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo $chapter->href() ?>" data-count="horizontal" data-via="<?php echo get_setting_twitter(); ?>" data-related="<?php echo get_setting_twitter(); ?>">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
        </div>
		<div class="facebook">
			<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($chapter->href()) ?>&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:95px; height:21px;" allowTransparency="true"></iframe>
		</div>
		<div class="googleplus">
			<g:plusone size="medium" href="<?php echo $chapter->href() ?>"></g:plusone>
		</div>
    </div>
</div>

<script src="<?php echo site_url(); ?>assets/js/jquery.plugins.js"></script>
<script type="text/javascript">
	
	

	var title = document.title;
	
	var pages = <?php echo json_encode($pages); ?>;

	var next_chapter = "<?php echo $next_chapter; ?>";
	
	var preload_next = 7;

	var preload_back = 2;

	var current_page = <?php echo $current_page - 1; ?>;
	
	var initialized = false;
	
	var baseurl = '<?php echo $chapter->href() ?>';
	
	var site_url = '<?php echo site_url() ?>';
	
	var gt_page = '<?php echo addslashes(_("Page")) ?>';
	
	var gt_key_suggestion = '<?php echo addslashes(_("Use W-A-S-D or the arrow keys to navigate")) ?>';

	var gt_key_tap = '<?php echo addslashes(_("Double-tap to change page")) ?>';

	function changePage(id, noscroll, nohash)
	{
		id = parseInt(id);
		if (initialized && id == current_page)
			return false;
		
		if(!initialized) {
			create_message('key_suggestion', 4000, gt_key_suggestion);
		}
		
		initialized = true;
		if(id > pages.length-1) 
		{
			location.href = next_chapter;
			return false;
		}
		if(id < 0){
			current_page = 0;
			id = 0;
		} 
		
		preload(id);
		current_page = id;
		next = parseInt(id+1);
		jQuery("html, body").stop(true,true);
		if(!noscroll) jQuery.scrollTo('.panel', 430, {'offset':{'top':-6}});
		
		
		if(pages[id].loaded !== true) {
			jQuery('#page .inner img.open').css({'opacity':'0'});
			jQuery('#page .inner .preview img').attr('src', pages[id].thumb_url);
			jQuery('#page .inner img.open').attr('src', pages[id].thumb_url);
		}
		else {
			jQuery('#page .inner img.open').css({'opacity':'1'});
			jQuery('#page .inner .preview img').attr('src', pages[id].thumb_url);
			jQuery('#page .inner img.open').attr('src', pages[id].url);
		}
		
		resizePage(id);
		
		if(!nohash) History.pushState(null, null, baseurl+'page/' + (current_page + 1));
		document.title = gt_page+' ' + (current_page+1) + ' :: ' + title;
		update_numberPanel();
		jQuery('#pagelist .images').scrollTo(jQuery('#thumb_' + id).parent(), 400);
		jQuery('#pagelist .current').removeClass('current');
		jQuery('#thumb_' + id).addClass('current');
		
		jQuery("#ads_top_banner.iframe iframe").attr("src", site_url + "content/ads/ads_top.html");
		jQuery("#ads_bottom_banner.iframe iframe").attr("src", site_url + "content/ads/ads_bottom.html");
		
		return false;
	}


	function resizePage(id) {
{'fraction_non_alphanumeric': 0.23717532467532468, 'fraction_numerical': 0.012012987012987014, 'mean_word_length': 3.6232645403377113, 'pattern_counts': {'":': 0, '<': 257, '<?xml version=': 0, '>': 295, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4107744', 'n_tokens_mistral': 5140, 'n_tokens_neox': 4363, 'n_words': 932}