dlsite 1.1: works properly in English-language UI as well as Japanese
This commit is contained in:
		
							parent
							
								
									2a6504ee7f
								
							
						
					
					
						commit
						14a47c73ed
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
// ==UserScript==
 | 
			
		||||
// @name        DLSite TL Unclaimed Works
 | 
			
		||||
// @namespace   https://xeno.science/
 | 
			
		||||
// @version     1.0
 | 
			
		||||
// @version     1.1
 | 
			
		||||
// @description See which works on DLSite Translators Unite haven't already been started by other translators
 | 
			
		||||
// @author      xenofem
 | 
			
		||||
// @match       https://*.dlsite.com/*/works/translatable
 | 
			
		||||
| 
						 | 
				
			
			@ -12,7 +12,12 @@
 | 
			
		|||
// @license     MIT
 | 
			
		||||
// ==/UserScript==
 | 
			
		||||
 | 
			
		||||
const MY_LANGUAGE = "英語";
 | 
			
		||||
const TARGET_LANGUAGE_STRINGS = ["英語", "English"];
 | 
			
		||||
const OPEN_STRINGS = ["受付中", "Applications Open"];
 | 
			
		||||
 | 
			
		||||
function isIn(el, ar) {
 | 
			
		||||
  return ar.indexOf(el) !== -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function checkUnclaimed() {
 | 
			
		||||
  const works = document.getElementsByClassName("search_result_img_box_inner");
 | 
			
		||||
| 
						 | 
				
			
			@ -21,8 +26,8 @@ function checkUnclaimed() {
 | 
			
		|||
    let unclaimed = false;
 | 
			
		||||
    const tlTable = work.getElementsByClassName("translation_table")[0];
 | 
			
		||||
    for (const row of tlTable.getElementsByTagName("tr")) {
 | 
			
		||||
      if (row.children[0].textContent === MY_LANGUAGE &&
 | 
			
		||||
          row.children[1].textContent === "受付中" &&
 | 
			
		||||
      if (isIn(row.children[0].textContent, TARGET_LANGUAGE_STRINGS) &&
 | 
			
		||||
          isIn(row.children[1].textContent, OPEN_STRINGS) &&
 | 
			
		||||
          row.children[2].textContent === "0" &&
 | 
			
		||||
          row.children[3].textContent === "0") {
 | 
			
		||||
        unclaimed = true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue