1var RSGOPRO_PopupPrefix = 'rsgppopup_', 2 RSGOPRO_DivsLeft = '<div class="outer"><div class="inner">', 3 RSGOPRO_DivsRight = '</div></div>', 4 RSGOPRO_ParentsObj; 5 6function RSGoPro_OnOfferChangePopup($elementObj) { 7 var finedOfferID = $elementObj.find('.js-add2basketpid').val(); 8 var element_id = $elementObj.data('elementid'); 9 if(finedOfferID>0) { 10 // image 11 if( RSGoPro_OFFERS[element_id].OFFERS[finedOfferID].IMAGES[0].src && 12 RSGoPro_OFFERS[element_id].OFFERS[finedOfferID].IMAGES[0].src.indexOf("redsign_devfunc_nophoto") < 0 && 13 $elementObj.find('.pic img').length>0 ) { 14 $elementObj.find('.pic img').attr('src', RSGoPro_OFFERS[element_id].OFFERS[finedOfferID].IMAGES[0].src ); 15 } 16 } 17} 18 19function RSGoProPricesJScrollPaneReinitialize() { 20 setTimeout(function(){ // fix for slow shit 21 var pane2api; 22 $('.prs_jscrollpane').parents('.prices').removeClass('jspHasScroll'); 23 $('.prs_jscrollpane').each(function(i){ 24 pane2api = $(this).data('jsp'); 25 pane2api.reinitialise(); 26 if( $(this).hasClass('jspScrollable') ) { 27 $(this).parents('.prices').addClass('jspHasScroll'); 28 } 29 }); 30 },50); 31} 32 33function RSGoPro_FixPreviewText(element_id) { 34 var max_h1 = 350; 35 var line_h = 18; 36 var h1 = $('#'+RSGOPRO_PopupPrefix+element_id).find('.block.right').outerHeight(true); 37 if( h1!=null ) { 38 if( h1>max_h1 ) { 39 var $text = $('#'+RSGOPRO_PopupPrefix+element_id).find('.description').find('.text'); 40 var res = Math.floor( ($text.outerHeight(true)-(h1-max_h1))/line_h )*line_h; 41 $text.css('maxHeight',res+'px'); 42 } 43 } 44} 45 46function RSGoPro_GoPopup(element_id,$parentsObj) { 47 element_id = parseInt( element_id ); 48 RSGOPRO_ParentsObj = $parentsObj; 49 if(element_id>0) { 50 if( $('#'+RSGOPRO_PopupPrefix+element_id).length>0 ) { 51 RSGoPro_ShowPopup(element_id); 52 } else { 53 RSGoPro_AddPopup(element_id); 54 } 55 } else { 56 console.warn( 'GoPopup: element_id is empty' ); 57 } 58} 59 60function RSGoPro_ShowPopup(element_id) { 61 RSGoPro_ChangePosition(element_id); 62 $('#'+RSGOPRO_PopupPrefix+element_id).fadeIn("fast",function() { 63 // Animation complete 64 RSGoPro_FixPreviewText(element_id); 65 RSGoPro_SetSet(); 66 //RSGoProPricesJScrollPaneReinitialize(); 67 RSGoPro_ScrollReinit('.elementpopupinner .prs_jscrollpane', 1); 68 }); 69} 70 71function RSGoPro_HidePopup(element_id) { 72 $('#'+RSGOPRO_PopupPrefix+element_id).fadeOut("fast",function() { 73 // Animation complete 74 }); 75} 76function RSGoPro_ChangePosition(element_id) { 77 var $jsPos; 78 if( RSGOPRO_ParentsObj.find('td.name').outerWidth(true) > 5 ) { 79 $jsPos = RSGOPRO_ParentsObj.find('.js-position'); 80 } else { 81 $jsPos = RSGOPRO_ParentsObj.parents('.artables').find('.js-name'+element_id).find('.js-position'); 82 } 83 var pos_left = $jsPos.position().left + $jsPos.outerWidth(true) + 20; // 20 - td padding 84 $('#'+RSGOPRO_PopupPrefix+element_id).css({'top':$jsPos.position().top+'px','left':pos_left+'px'}); 85} 86 87function RSGoPro_HideAllPopup() { 88 $('.rsgppopup:visible').fadeOut("fast",function() { 89 // Animation complete 90 }); 91} 92 93function RSGoPro_AddPopup(element_id,$parentsObj) { 94 var url_begin = $('.js-element[data-elementid="'+element_id+'"]').attr('data-detail'); 95 var url = url_begin+'?AJAX_CALL=Y&' + rsGoProActionVariableName + '=rsgppopup&' + rsGoProProductIdVariableName + '=' + element_id+''; 96 var html = '<div id="'+RSGOPRO_PopupPrefix+element_id+'" class="rsgppopup" style="display:none;">'+RSGOPRO_DivsLeft+'<div class="loading"></div>'+RSGOPRO_DivsRight+'</div>'; 97 $('body').append( html ); 98 RSGoPro_ShowPopup(element_id); 99 $.ajax({ 100 url: url 101 }).done(function(data){ 102 $('#'+RSGOPRO_PopupPrefix+element_id).find('.inner').html( data ); 103 RSGoPro_SetSet(); 104 RSGoPro_FixPreviewText(element_id); 105 if ($('.elementpopupinner .prs_jscrollpane').length > 0) { 106 RSGoPro_ScrollInit('.elementpopupinner .prs_jscrollpane'); 107 $(window).resize(function(){ 108 RSGoPro_ScrollReinit('.elementpopupinner .prs_jscrollpane', 1); 109 }); 110 } 111 if ($('.elementpopupinner .prices_jscrollpane').length > 0) { 112 RSGoPro_ScrollInit('.elementpopupinner .prices_jscrollpane'); 113 $(window).resize(function(){ 114 RSGoPro_ScrollReinit('.elementpopupinner .prices_jscrollpane', 1); 115 }); 116 } 117 }).fail(function() { 118 console.warn( 'Popup: wrong ajax request' ); 119 }); 120} 121 122$(document).ready(function(){ 123 124 // listeners 125 $(document).on('keydown',function(e){ 126 if(e.keyCode==27) { // esc 127 RSGoPro_HideAllPopup(); 128 } 129 }); 130 $(document).on('click',function(e){ 131 if( $(e.target).parents('.rsgppopup').length>0 ) { 132 133 } else { 134 RSGoPro_HideAllPopup(); 135 } 136 }); 137 138 // window.resize 139 $(window).resize(function(){ 140 RSGoPro_HideAllPopup(); 141 }); 142 143 // change offer 144 $(document).on('RSGoProOnOfferChange',function(e,elementObj){ 145 RSGoPro_OnOfferChangePopup(elementObj); 146 }); 147 148});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.