Buttonky další/předchozí korektura
This commit is contained in:
		
							parent
							
								
									773cd7d419
								
							
						
					
					
						commit
						283320b161
					
				
					 4 changed files with 107 additions and 1 deletions
				
			
		|  | @ -145,6 +145,40 @@ form { | ||||||
| 	&[data-selected="false"] { opacity: 0.5; } | 	&[data-selected="false"] { opacity: 0.5; } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* Šipky na posouvání korektur */ | ||||||
|  | #korektury-sipky { | ||||||
|  | 	position: fixed; | ||||||
|  | 	bottom: 5px; | ||||||
|  | 	left: 5px; | ||||||
|  | 
 | ||||||
|  | 	button, img { | ||||||
|  | 		border: 1px solid white; | ||||||
|  | 		background-color:transparent; | ||||||
|  | 		margin:0; | ||||||
|  | 		padding: 1px; | ||||||
|  | 
 | ||||||
|  | 		border-radius: 5px; | ||||||
|  | 
 | ||||||
|  | 		&:hover { | ||||||
|  | 			border: 1px solid black; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	button img { pointer-events: none; } | ||||||
|  | 
 | ||||||
|  | 	#predchozi-korektura, #dalsi-korektura { | ||||||
|  | 		background-color: #EEEEEE; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	#predchozi-korektura-k-oprave, #dalsi-korektura-k-oprave { | ||||||
|  | 		background-color: #FF0000; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	#predchozi-korektura-k-zaneseni, #dalsi-korektura-k-zaneseni { | ||||||
|  | 		background-color: #00FF00; | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| /**** ROZLIŠENÍ MEZI LOKÁLNÍM, TESTOVACÍM A PRODUKČNÍM WEBEM ****/ | /**** ROZLIŠENÍ MEZI LOKÁLNÍM, TESTOVACÍM A PRODUKČNÍM WEBEM ****/ | ||||||
| body.localweb, body.testweb, body.suprodweb { | body.localweb, body.testweb, body.suprodweb { | ||||||
|  |  | ||||||
|  | @ -0,0 +1,69 @@ | ||||||
|  | {% load static %} | ||||||
|  | 
 | ||||||
|  | <div id="korektury-sipky"> | ||||||
|  |   <button type='button' id="predchozi-korektura" title='Předchozí korektura'> | ||||||
|  |     <img class='toggle-button' src='{% static "korektury/imgs/hide.png" %}' alt='⬆'/> | ||||||
|  |   </button> | ||||||
|  |   <button type='button' id="predchozi-korektura-k-oprave" title='Předchozí korektura k opravě'> | ||||||
|  |     <img class='toggle-button' src='{% static "korektury/imgs/hide.png" %}' alt='⬆'/> | ||||||
|  |   </button> | ||||||
|  |   <button type='button' id="predchozi-korektura-k-zaneseni" title='Předchozí korektura k zaneseni'> | ||||||
|  |     <img class='toggle-button' src='{% static "korektury/imgs/hide.png" %}' alt='⬆'/> | ||||||
|  |   </button> | ||||||
|  |   <br> | ||||||
|  |   <button type='button' id="dalsi-korektura" title='Další korektura'> | ||||||
|  |     <img class='toggle-button' src='{% static "korektury/imgs/hide.png" %}' alt='⬇' style="transform: rotate(180deg);"/> | ||||||
|  |   </button> | ||||||
|  |   <button type='button' id="dalsi-korektura-k-oprave" title='Další korektura k opravě'> | ||||||
|  |     <img class='toggle-button' src='{% static "korektury/imgs/hide.png" %}' alt='⬇' style="transform: rotate(180deg);"/> | ||||||
|  |   </button> | ||||||
|  |   <button type='button' id="dalsi-korektura-k-zaneseni" title='Další korektura k zaneseni'> | ||||||
|  |     <img class='toggle-button' src='{% static "korektury/imgs/hide.png" %}' alt='⬇' style="transform: rotate(180deg);"/> | ||||||
|  |   </button> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  |   const predchozi_k = document.getElementById('predchozi-korektura'); | ||||||
|  |   const dalsi_k = document.getElementById('dalsi-korektura'); | ||||||
|  |   const predchozi_k_o = document.getElementById('predchozi-korektura-k-oprave'); | ||||||
|  |   const dalsi_k_o = document.getElementById('dalsi-korektura-k-oprave'); | ||||||
|  |   const predchozi_k_z = document.getElementById('predchozi-korektura-k-zaneseni'); | ||||||
|  |   const dalsi_k_z = document.getElementById('dalsi-korektura-k-zaneseni'); | ||||||
|  | 
 | ||||||
|  |   function dalsi_nebo_predchozi_korektura(dalsi=true, stav=null) { | ||||||
|  |     let predchozi = null; | ||||||
|  |     for (let [_, opravy] of Object.entries(comments)) { | ||||||
|  |       for (const oprava of opravy) { | ||||||
|  |         if (stav == null || oprava.status === stav) { | ||||||
|  |           console.log(oprava, oprava.htmlElement.getBoundingClientRect().y); | ||||||
|  |           const y = oprava.htmlElement.getBoundingClientRect().y; | ||||||
|  |           if (y >= -1) { | ||||||
|  |             if (dalsi) { | ||||||
|  |               if (y > 1) { | ||||||
|  |                 oprava.htmlElement.scrollIntoView(); | ||||||
|  |                 return; | ||||||
|  |               } | ||||||
|  |             } else { | ||||||
|  |               console.log(predchozi); | ||||||
|  |               if (predchozi !== null) predchozi.htmlElement.scrollIntoView(); else alert("Výše už není žádná taková korektura."); | ||||||
|  |               return; | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |           predchozi = oprava; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     if (!dalsi && predchozi !== null) { | ||||||
|  |       predchozi.htmlElement.scrollIntoView(); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     alert("Žádná další korektura."); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   predchozi_k.addEventListener('click', _ => { dalsi_nebo_predchozi_korektura(false) }); | ||||||
|  |   dalsi_k.addEventListener('click', _ => { dalsi_nebo_predchozi_korektura(true) }); | ||||||
|  |   predchozi_k_o.addEventListener('click', _ => { dalsi_nebo_predchozi_korektura(false, "k_oprave") }); | ||||||
|  |   dalsi_k_o.addEventListener('click', _ => { dalsi_nebo_predchozi_korektura(true, "k_oprave") }); | ||||||
|  |   predchozi_k_z.addEventListener('click', _ => { dalsi_nebo_predchozi_korektura(false, "k_zaneseni") }); | ||||||
|  |   dalsi_k_z.addEventListener('click', _ => { dalsi_nebo_predchozi_korektura(true, "k_zaneseni") }); | ||||||
|  | </script> | ||||||
|  | @ -71,7 +71,7 @@ | ||||||
| 
 | 
 | ||||||
|     #komentare; #tagy; |     #komentare; #tagy; | ||||||
|     htmlElement; pointer; |     htmlElement; pointer; | ||||||
|     id; x; y; img_id; zobrazit = true; {# oprava_data; #} |     id; x; y; img_id; status; zobrazit = true; {# oprava_data; #} | ||||||
| 
 | 
 | ||||||
|     constructor(oprava_data) { |     constructor(oprava_data) { | ||||||
|       this.htmlElement = preoprava.cloneNode(true); |       this.htmlElement = preoprava.cloneNode(true); | ||||||
|  | @ -120,6 +120,7 @@ | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     set_status(status) { |     set_status(status) { | ||||||
|  |       this.status = status; | ||||||
|       this.htmlElement.dataset.opravastatus=status; |       this.htmlElement.dataset.opravastatus=status; | ||||||
|       this.pointer.dataset.opravastatus=status; |       this.pointer.dataset.opravastatus=status; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -6,6 +6,8 @@ | ||||||
| {% include "korektury/korekturovatko/__oprava.html" %} | {% include "korektury/korekturovatko/__oprava.html" %} | ||||||
| {% include "korektury/korekturovatko/__komentar.html" %} | {% include "korektury/korekturovatko/__komentar.html" %} | ||||||
| 
 | 
 | ||||||
|  | {% include "korektury/korekturovatko/__dalsi_korektura.html" %} | ||||||
|  | 
 | ||||||
| <script> | <script> | ||||||
|   /** |   /** | ||||||
|    * |    * | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue