Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var depart = prompt('zadej čas odjezdu'),
- $obj;
- $(".col_depart").each(
- function () {
- if ($(this).html() == depart) {
- $obj = $(this).parent()
- }
- }
- );
- buyCheapest();
- function findPrices(yBusRowId) {
- var result;
- var skip=false;
- $(".routeDetail").each(function () {
- if(!skip)
- if($(this).attr('ybus:rowid') == yBusRowId){
- result=$(this);
- skip=true;
- }
- });
- return result;
- }
- function buyCheapest(){
- var $prc=findPrices($obj.attr('ybus:rowid'));
- var button=$prc.find('.detail_icon')[0];
- $(button).click();
- submit();
- }
- function hasFreeSpace(obj){
- var $col_space=obj.find(".col_space");
- return parseInt($col_space.text())>0;
- }
- function hasOptions(obj){
- var $purchase_field=$(obj.find(".col_price,.col_price_no_basket_image")[0]);
- if($purchase_field.hasClass('col_price_no_basket_image')){
- return true
- }else{
- return false
- }
- }
- function checkTime() {
- }
- function submit(){
- var win = document.defaultView || this.ownerDocument.parentWindow;
- //"var win = this.ownerDocument.defaultView || this.ownerDocument.parentWindow; if (win == window) { window.location.href='./2?62-2.ILinkListener-basketPanel-orderButton'; } ;return false"
- var onclick=$(".button:first-child").attr('onclick');
- var regex = /window\.location\.href='([^']*)'/;
- console.log(JSON.stringify(regex.exec));
- var url=regex.exec(onclick)[1];
- if (win == window) {
- var $newWindow=$("<iframe></iframe>");
- $newWindow.appendTo('body');$newWindow.css({
- 'position':'fixed',
- 'width':'100%',
- 'height':'700px',
- 'top':0,
- 'left':0,
- 'z-index':1000000
- });
- $newWindow[0].contentWindow.location.href=url;
- $newWindow.load(function(){
- $newWindow[0].contentWindow.location.href='javascript:$("button[name=\'buttonContainer:createTicketButton\']").click()';
- });
- }
- }
- /**
- * Created by Herbert on 28. 4. 2015.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement