cubensosgmail.com / Bankmanagergame - Kons. Immobilien

// ==UserScript==
// @name          Bankmanagergame - Kons. Immobilien
// @namespace     http://scripte.georglink.de/
// @description	  sortieren und so
// @author        Stevo
// @include       http://bankmanagergame.de/index.php?section=konsortium_immobilien*
// @include       http://www.bankmanagergame.de/index.php?section=konsortium_immobilien*
// ==/UserScript==




var $1;

// Add jQuery
(function(){
	if (typeof unsafeWindow.jQuery == 'undefined') {
		var GM_Head = document.getElementsByTagName('head')[0] || document.documentElement,
			GM_JQ = document.createElement('script');

		GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
		GM_JQ.type = 'text/javascript';
		GM_JQ.async = true;

		GM_Head.insertBefore(GM_JQ, GM_Head.firstChild);
	}
	GM_wait();
})();

// Check if jQuery's loaded
function GM_wait() {
	if (typeof unsafeWindow.jQuery == 'undefined') {
		window.setTimeout(GM_wait, 100);
	} else {
		$1 = unsafeWindow.jQuery;
		window.setTimeout(gemma,100);
	 }
}



function gemma() {

  $('#filter').hide();

  var filtermenu = document.createElement('div');


  var haggl1 = document.createElement('input');
  var haggl2 = document.createElement('input');
  var haggl3 = document.createElement('input');
  var haggl4 = document.createElement('input');
  var haggl5 = document.createElement('input');
  var inp1 = document.createElement('input');
  var inp2 = document.createElement('input');
  var inp3 = document.createElement('input');
  var button = document.createElement('input');

  haggl1.type = 'checkbox';
  haggl2.type = 'checkbox';
  haggl3.type = 'checkbox';
  haggl4.type = 'checkbox';
  haggl5.type = 'checkbox';
  button.type = 'button';
  
  haggl1.onchange = function(){    checkFilter();  };
  haggl2.onchange = function(){    checkFilter();  };
  haggl3.onchange = function(){    checkFilter();  };
  haggl4.onchange = function(){    checkFilter();  };
  haggl5.onchange = function(){    checkFilter();  };
  inp3.onchange   = function(){    checkFilter();  };
  inp3.onkeyup    = function(){    checkFilter();  };


  button.value = 'list';
  button.onclick    = function(){   

    $('.immo > td > img').hide();

    $('#listOfCredits th:contains("Mieteinnahmen")').text("Miete");
    $('#listOfCredits th:contains("Vandalismus*")').text("Vandal.");
    $('#listOfCredits th:contains("Mietausfall*")').text("Ausfall");
    $('#listOfCredits th:contains("Wertverlust")').text("Wertv.");

    var s = $('td:contains("Mieteinnahmen")').text();
    s = s.substring(0, s.indexOf('Pkt/Tag'));
    $('td:contains("Mieteinnahmen")').text(s);

    $('td:contains("Höchstgebot")').css('width','300px');
    
   $('td:contains("Höchstgebot") > form > br').hide();
   $('td:contains("Höchstgebot") > form > input').css('width','50px');

   $('td:contains("Höchstgebot") > br').hide();
 

    
 };


  haggl1.id = 'stevofilterh1';
  haggl2.id = 'stevofilterh2';
  haggl3.id = 'stevofilterh3';
  haggl4.id = 'stevofilterh4';
  haggl5.id = 'stevofilterh5';
  inp1.id = 'stevofilteri1';
  inp2.id = 'stevofilteri2';
  inp3.id = 'stevofilteri3';

if (localStorage.haggl1 == 'true') {
  haggl1.checked = 'checked';
}
if (localStorage.haggl2 == 'true') {
  haggl2.checked = 'checked';
}
if (localStorage.haggl3 == 'true') {
  haggl3.checked = 'checked';
}
if (localStorage.haggl4 == 'true') {
  haggl4.checked = 'checked';
}
if (localStorage.haggl5 == 'true') {
  haggl5.checked = 'checked';
}
  
   

  // haggl5.checked = 'checked';

 inp3.value = '3';
 inp3.value = localStorage.inp3;

  haggl1.style.marginRight = '5px';
  haggl2.style.marginRight = '5px';
  haggl3.style.marginRight = '5px';
  haggl4.style.marginRight = '5px';
  haggl5.style.marginRight = '5px';

  inp3.style.marginRight = '5px';
  inp3.style.width = '30px';
  inp3.style.padding = '3px';
  inp3.style.textAlign = 'center';

  haggl1.title = 'Einfamilienhaus';
  haggl2.title = 'Plattenbau';
  haggl3.title = 'Luxus-Mietwohnungen';
  haggl4.title = 'Luxusvilla';
  haggl5.title = 'Wolkenkratzer';
  inp3.title = 'Maximaler Wertverlust';

  filtermenu.appendChild(haggl1);
  filtermenu.appendChild(haggl2);
  filtermenu.appendChild(haggl3);
  filtermenu.appendChild(haggl4);
  filtermenu.appendChild(haggl5);
 
  filtermenu.appendChild(inp3);

  filtermenu.appendChild(button);

  $("select option[value='14891']").attr('selected',true);
  $("button:contains('filtern')").replaceWith(filtermenu);
  
// $('.immo > td > img').css('width','70px');  


  $('.immo > td > b').click(function() {
 
    $(this).parents('.immo > td').css('background','#8d9'); 

  });


  $('.immo > td > img').click(function() {
 
    $(this).parents('.immo').hide();

  });

  checkFilter();
  under_60sec_countdown();
}

function checkFilter() {
  
  $("tr").show();


  var haggl1 = document.getElementById('stevofilterh1').checked;
  var haggl2 = document.getElementById('stevofilterh2').checked;
  var haggl3 = document.getElementById('stevofilterh3').checked;
  var haggl4 = document.getElementById('stevofilterh4').checked;
  var haggl5 = document.getElementById('stevofilterh5').checked;


   localStorage.haggl1 = haggl1;
   localStorage.haggl2 = haggl2;
   localStorage.haggl3 = haggl3;
   localStorage.haggl4 = haggl4;
   localStorage.haggl5 = haggl5;

  var inp3 = document.getElementById('stevofilteri3').value;


   localStorage.inp3 = inp3;


 var i = 10;
 while (i > inp3) {
   $("tr:contains('"+i+" Pkt/Tag')").hide();
   i = (i - 1);
 }


 if (haggl1 != true) {
   $("tr:contains('Einfamilienhaus')").hide();
 }
 if (haggl2 != true) {
   $("tr:contains('Plattenbau')").hide();
 }
 if (haggl3 != true) {
   $("tr:contains('Luxusmietwohnungen')").hide();
 }
 if (haggl4 != true) {
   $("tr:contains('Luxusvilla')").hide();
 }
 if (haggl5 != true) {
   $("tr:contains('Wolkenkratzer')").hide();
 }
 



}



function under_60sec_countdown() {

  var i = 0;
  $("td:contains('Sek.'):not(:contains('Min.'))").each(function() {
//$("td:contains('Sek.')").each(function() {
    
    var startsekunde = this.textContent.match(/\d+/);

    this.id = 'timer'+i;
    start_countdown('timer'+i,startsekunde);
    i++;

  });
  
}

function start_countdown(timer,sec) {

  setInterval(function(){   

    if (sec > 0) {
      sec--;
    }
    document.getElementById(timer).textContent = sec + ' Sek.';

  }, 1000);  

}