<commit_before>import * as pathUtils from '../utils/path'
import * as services from '../services'
import {RootPage} from './root'
import {RegisteredAction, ExecuteOnLoad} from '../utils/actionDecorators'
import {GalleryPage} from './gallery'
import {DictionaryService} from '../utils/dict'

export class SearchPage extends GalleryPage {
	protected darkenInList(artists: Model.Artist[]): void {
		this.jQuery('li.image-item').toArray().forEach(image => {
			unsafeWindow.console.log('analyzing image');
			let artistId = parseInt(this.jQuery(image).find('a.user').attr('data-user_id'));
			// Artist save format is [<id>] - <username>
			if (artists.some(artist => artist.id === artistId)) {
				this.jQuery(image).css('background-color', '#333334');
			}
		});
	}

	protected getTagElements() {
		return [
			'nav.breadcrumb > span > a > span',
			'a.self',
			'dl.column-related ul.tags li.tag a.text'
		].map(x => this.jQuery(x)).concat(super.getTagElements());
	}

	public changeTitle(): void {
		let titleMatch = document.title.match(/「(.*)」/);
		if(titleMatch && titleMatch[1]){
			let translatedText = DictionaryService.getTranslation(titleMatch[1]);
			if (translatedText) {
				let newTitle = document.title.replace(/「(.*)」/, `「${translatedText}」`);
				// If I set the title directly pixiv will eventually try to set the title
				// again, reverting my changes. This sets the field that pixiv's own functions
				// use. They'll do my work for me.
				(<any>unsafeWindow).pixiv.title.original = newTitle;
			}
		}
	}

	public translateTagsOnPage(): void {
		this.changeTitle();
		super.translateTagsOnPage();
	}
<commit_msg>Added logging to search page<commit_after>import * as pathUtils from '../utils/path'
import * as services from '../services'
import {RootPage} from './root'
import {RegisteredAction, ExecuteOnLoad} from '../utils/actionDecorators'
import {GalleryPage} from './gallery'
import {DictionaryService} from '../utils/dict'

import {log} from '../utils/log'

export class SearchPage extends GalleryPage {
	protected darkenInList(artists: Model.Artist[]): void {
		this.jQuery('li.image-item').toArray().forEach(image => {
			unsafeWindow.console.log('analyzing image');
			let artistId = parseInt(this.jQuery(image).find('a.user').attr('data-user_id'));
			// Artist save format is [<id>] - <username>
			if (artists.some(artist => artist.id === artistId)) {
				this.jQuery(image).css('background-color', '#333334');
			}
		});
	}

	protected getTagElements() {
		return [
			'nav.breadcrumb > span > a > span',
			'a.self',
			'dl.column-related ul.tags li.tag a.text'
		].map(x => this.jQuery(x)).concat(super.getTagElements());
	}

	public changeTitle(): void {
		let titleMatch = document.title.match(/「(.*)」/);
		if(titleMatch && titleMatch[1]){
			let translatedText = DictionaryService.getTranslation(titleMatch[1]);
			if (translatedText) {
				let newTitle = document.title.replace(/「(.*)」/, `「${translatedText}」`);
				log(`SearchPage.changeTitle | replacing title from [${document.title}] to [${newTitle}]`);
				// If I set the title directly pixiv will eventually try to set the title
				// again, reverting my changes. This sets the field that pixiv's own functions
				// use. They'll do my work for me.
				(<any>unsafeWindow).pixiv.title.original = newTitle;
			}
		}
	}

	public translateTagsOnPage(): void {
		this.changeTitle();
		super.translateTagsOnPage();
	}

{'fraction_non_alphanumeric': 0.16471277842907386, 'fraction_numerical': 0.004689331770222743, 'mean_word_length': 4.033923303834809, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, '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': '4511586', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1059, 'n_words': 265}