<commit_before>var Page = new Class({

	Implements: Options,

	options: {
		
		sidebar: 'components-inner',
		panel: 'types',
		active: ''
		
	},

	initialize: function(options){

		this.setOptions(options);

		this.togglers	= $(this.options.sidebar).getElements('a');
		this.types		= $(this.options.panel).getChildren();
		this.active		= this.options.active;

		this.togglers.each(function(toggle){
			
			var component_name = toggle.getProperty('data-component'), type = this.types.filter(function(type){
				return type.getProperty('data-component') == this;
			}, component_name)[0];
			
			if(type.getProperty('data-component') != this.active) {
				type.setStyle('display', 'none');
			} else {
				toggle.addClass('active selected');
			}

			toggle.addEvent('click', function(event){

				new Event(event).stop();

				this.types.setStyle('display', 'none');
				type.setStyle('display', 'block');
				toggle.getParent().getParent().getElements('a.active').removeClass('active');
				toggle.addClass('active');

			}.bindWithEvent(this));

		}, this);

	}

});<commit_msg>Add redirect page type. re #168 and #219<commit_after>if (!Pages) {
    var Pages = {};
}

Pages.Page = new Class({

	Implements: Options,

	options: {
		
		sidebar: 'components-inner',
		panel: 'types',
		active: '',
		type: ''
		
	},

	initialize: function(options){

		this.setOptions(options);

		this.togglers	= $(this.options.sidebar).getElements('a');
		this.types		= $(this.options.panel).getChildren();
		this.active		= this.options.active;
		this.type       = this.options.type;

		this.togglers.each(function(toggle){
			
			var component_name = toggle.getProperty('data-component'), type = this.types.filter(function(type){
				return type.getProperty('data-component') == this;
			}, component_name)[0];
			
			if(type.getProperty('data-component') != this.active) {
				type.setStyle('display', 'none');
			} else {
				toggle.addClass('active selected');
			}

			toggle.addEvent('click', function(event){

				new Event(event).stop();

				this.types.setStyle('display', 'none');
				type.setStyle('display', 'block');
				toggle.getParent().getParent().getElements('a.active').removeClass('active');
				toggle.addClass('active');

			}.bindWithEvent(this));

		}, this);
		
		if(this.type == 'redirect') {
		    var page = $('page-link-id');
            var url  = $('page-link-url');
            var type = $('page-link-type').getElement('input[name=link_type]:checked');
            
            page.setStyle('display', type.value == 'id' ? 'block' : 'none');
            url.setStyle('display', type.value == 'url' ? 'block' : 'none');
            
            $('page-link-type').getElements('input[name=link_type]').each(function(input) {
		        input.addEvent('click', function() {
		            page.setStyle('display', input.value == 'id' ? 'block' : 'none');
		            url.setStyle('display', input.value == 'url' ? 'block' : 'none');
		        });
		    }.bind(this));
		}

	}

});
{'fraction_non_alphanumeric': 0.19085752419085752, 'fraction_numerical': 0.002669336002669336, 'mean_word_length': 3.319884726224784, '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': '3493896', 'n_tokens_mistral': 1094, 'n_tokens_neox': 933, 'n_words': 148}