Adds HotS, LotV and NCO campaigns to SC2 game. The world's name has changed to reflect that (it's not only Wings of Liberty now) The client was patched in a way that can still join to games generated prior this change --------- Co-authored-by: Magnemania <magnemight@gmail.com> Co-authored-by: EnvyDragon <138727357+EnvyDragon@users.noreply.github.com> Co-authored-by: Matthew <matthew.marinets@gmail.com> Co-authored-by: hopop201 <benjy.hopop201@gmail.com> Co-authored-by: Salzkorn <salzkitty@gmail.com> Co-authored-by: genderdruid <pallyoffail@gmail.com> Co-authored-by: MadiMadsen <137329235+MadiMadsen@users.noreply.github.com> Co-authored-by: neocerber <neocerber@gmail.com> Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
window.addEventListener('load', () => {
 | 
						|
  // Reload tracker every 15 seconds
 | 
						|
  const url = window.location;
 | 
						|
  setInterval(() => {
 | 
						|
    const ajax = new XMLHttpRequest();
 | 
						|
    ajax.onreadystatechange = () => {
 | 
						|
      if (ajax.readyState !== 4) { return; }
 | 
						|
 | 
						|
      // Create a fake DOM using the returned HTML
 | 
						|
      const domParser = new DOMParser();
 | 
						|
      const fakeDOM = domParser.parseFromString(ajax.responseText, 'text/html');
 | 
						|
 | 
						|
      // Update item tracker
 | 
						|
      document.getElementById('inventory-table').innerHTML = fakeDOM.getElementById('inventory-table').innerHTML;
 | 
						|
      // Update only counters in the location-table
 | 
						|
      let counters = document.getElementsByClassName('counter');
 | 
						|
      const fakeCounters = fakeDOM.getElementsByClassName('counter');
 | 
						|
      for (let i = 0; i < counters.length; i++) {
 | 
						|
        counters[i].innerHTML = fakeCounters[i].innerHTML;
 | 
						|
      }
 | 
						|
    };
 | 
						|
    ajax.open('GET', url);
 | 
						|
    ajax.send();
 | 
						|
  }, 15000)
 | 
						|
 | 
						|
  // Collapsible advancement sections
 | 
						|
  const categories = document.getElementsByClassName("location-category");
 | 
						|
  for (let category of categories) {
 | 
						|
    let hide_id = category.id.split('_')[0];
 | 
						|
    if (hide_id === 'Total') {
 | 
						|
      continue;
 | 
						|
    }
 | 
						|
    category.addEventListener('click', function() {
 | 
						|
      // Toggle the advancement list
 | 
						|
      document.getElementById(hide_id).classList.toggle("hide");
 | 
						|
      // Change text of the header
 | 
						|
      const tab_header = document.getElementById(hide_id+'_header').children[0];
 | 
						|
      const orig_text = tab_header.innerHTML;
 | 
						|
      let new_text;
 | 
						|
      if (orig_text.includes("▼")) {
 | 
						|
        new_text = orig_text.replace("▼", "▲");
 | 
						|
      }
 | 
						|
      else {
 | 
						|
        new_text = orig_text.replace("▲", "▼");
 | 
						|
      }
 | 
						|
      tab_header.innerHTML = new_text;
 | 
						|
    });
 | 
						|
  }
 | 
						|
});
 |