Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var depart = prompt('zadej čas odjezdu'),
  2.     $obj;
  3.  
  4. $(".col_depart").each(
  5.     function () {
  6.         if ($(this).html() == depart) {
  7.             $obj = $(this).parent()
  8.         }
  9.     }
  10. );
  11. buyCheapest();
  12. function findPrices(yBusRowId) {
  13.     var result;
  14.     var skip=false;
  15.     $(".routeDetail").each(function () {
  16.         if(!skip)
  17.         if($(this).attr('ybus:rowid') == yBusRowId){
  18.             result=$(this);
  19.             skip=true;
  20.         }
  21.     });
  22.     return result;
  23. }
  24. function buyCheapest(){
  25.     var $prc=findPrices($obj.attr('ybus:rowid'));
  26.     var button=$prc.find('.detail_icon')[0];
  27.     $(button).click();
  28.     submit();
  29. }
  30. function hasFreeSpace(obj){
  31.     var $col_space=obj.find(".col_space");
  32.     return parseInt($col_space.text())>0;
  33. }
  34.  
  35. function hasOptions(obj){
  36.     var $purchase_field=$(obj.find(".col_price,.col_price_no_basket_image")[0]);
  37.     if($purchase_field.hasClass('col_price_no_basket_image')){
  38.         return true
  39.     }else{
  40.         return false
  41.     }
  42. }
  43. function checkTime() {
  44.  
  45. }
  46. function submit(){
  47.     var win = document.defaultView || this.ownerDocument.parentWindow;
  48.     //"var win = this.ownerDocument.defaultView || this.ownerDocument.parentWindow; if (win == window) { window.location.href='./2?62-2.ILinkListener-basketPanel-orderButton'; } ;return false"
  49.     var onclick=$(".button:first-child").attr('onclick');
  50.     var regex = /window\.location\.href='([^']*)'/;
  51.     console.log(JSON.stringify(regex.exec));
  52.     var url=regex.exec(onclick)[1];
  53.     if (win == window) {
  54.         var $newWindow=$("<iframe></iframe>");
  55.  
  56.         $newWindow.appendTo('body');$newWindow.css({
  57.             'position':'fixed',
  58.             'width':'100%',
  59.             'height':'700px',
  60.             'top':0,
  61.             'left':0,
  62.             'z-index':1000000
  63.         });
  64.         $newWindow[0].contentWindow.location.href=url;
  65.         $newWindow.load(function(){
  66.             $newWindow[0].contentWindow.location.href='javascript:$("button[name=\'buttonContainer:createTicketButton\']").click()';
  67.         });
  68.     }
  69.  
  70. }
  71. /**
  72.  * Created by Herbert on 28. 4. 2015.
  73.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement