<commit_before>(function( $, window, undefined ) {

	"use strict";

	window.Gallery = function( options ){

		this.file = {
			"VIEWER"       : options.VIEWER,
			"AJAX_LISTING" : options.AJAX_LISTING,
			"AJAX_FEATURE" : options.AJAX_FEATURE
		};

		this.current_page = options.current_page || 1;
		this.default_page = this.current_page;
		this.total_pages  = options.total_pages;

		this.key = {
			"LEFT_ARROW"  : 37,
			"UP_ARROW"    : 38,
			"RIGHT_ARROW" : 39,
			"DOWN_ARROW"  : 40
		};
		this.nav_visible  = options.nav_visible || false;
		this.current_img  = options.current_img;
		this.default_img  = this.current_img;
		this.imgs_per_nav = options.imgs_per_nav || 6;
	};

	Gallery.prototype.init = function( type ){
		var gallery = this;
		type = type || "listing";

		if ( type == "listing" ) {

			$(window).on('hashchange', function(evt){
				gallery.change_page(evt, gallery);
			});
			this.change_page(null, gallery);

		} else if ( type == "viewer" ) {

			$(window).on('hashchange', function(evt){
				gallery.change_img(evt, gallery);
			});
			this.change_img(null, gallery);
			this.display_nav();

			$(document).on('keypress', function(evt){
				gallery.key_pressed(evt, gallery);
			});

		}

		$('#gallery, #thumb-nav').on('click', '.img-thumb-box a', function(evt){
			gallery.open_image(evt, gallery);
		});
	};


	Gallery.prototype.change_page = function(evt, gallery){
		var page = location.hash.replace(/^#page-/,"");

		console.log( {page:page, current:gallery.current_page, file:gallery.file} );
<commit_msg>support keyboard navigation in all browsers<commit_after>(function( $, window, undefined ) {

	"use strict";

	window.Gallery = function( options ){

		this.file = {
			"VIEWER"       : options.VIEWER,
			"AJAX_LISTING" : options.AJAX_LISTING,
			"AJAX_FEATURE" : options.AJAX_FEATURE
		};

		this.current_page = options.current_page || 1;
		this.default_page = this.current_page;
		this.total_pages  = options.total_pages;

		this.key = {
			"LEFT_ARROW"  : 37,
			"UP_ARROW"    : 38,
			"RIGHT_ARROW" : 39,
			"DOWN_ARROW"  : 40
		};
		this.nav_visible  = options.nav_visible || false;
		this.current_img  = options.current_img;
		this.default_img  = this.current_img;
		this.imgs_per_nav = options.imgs_per_nav || 6;
	};

	Gallery.prototype.init = function( type ){
		var gallery = this;
		type = type || "listing";

		if ( type == "listing" ) {

			$(window).on('hashchange', function(evt){
				gallery.change_page(evt, gallery);
			});
			this.change_page(null, gallery);

		} else if ( type == "viewer" ) {

			$(window).on('hashchange', function(evt){
				gallery.change_img(evt, gallery);
			});
			this.change_img(null, gallery);
			this.display_nav();

			$(document).on('keydown', function(evt){
				gallery.key_pressed(evt, gallery);
			});

		}

		$('#gallery, #thumb-nav').on('click', '.img-thumb-box a', function(evt){
			gallery.open_image(evt, gallery);
		});
	};


	Gallery.prototype.change_page = function(evt, gallery){
		var page = location.hash.replace(/^#page-/,"");

		console.log( {page:page, current:gallery.current_page, file:gallery.file} );

{'fraction_non_alphanumeric': 0.1677917068466731, 'fraction_numerical': 0.006428801028608165, 'mean_word_length': 3.6726726726726726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7281063', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1117, 'n_words': 187}