1/* 2 * [y] hybris Platform 3 * 4 * Copyright (c) 2000-2016 SAP SE or an SAP affiliate company. 5 * All rights reserved. 6 * 7 * This software is the confidential and proprietary information of SAP 8 * ("Confidential Information"). You shall not disclose such Confidential 9 * Information and shall use it only in accordance with the terms of the 10 * license agreement you entered into with SAP. 11 */ 12$(function() { 13 if (window.opener != null && window.opener.PAYPAL != undefined){ 14 window.opener.location = window.location; 15 window.opener.PAYPAL.apps.Checkout.closeFlow(); 16 } 17 // paymentMethod(); 18 // $('[name=paymentMethodSelection]').change(function() { 19 // paymentMethod(); 20 // }); 21 if ($('#whatIsPayPalLink>a').length > 0){ 22 $('#whatIsPayPalLink>a').on('click', function(){ 23 newwindow=window.open($(this).attr('href'),'','height=768,width=1280,menubar=no,status=no'); 24 if (window.focus) {newwindow.focus()} 25 return false; 26 }); 27 } 28 29 /*$('.paypal-button-logo').on("click", function() { 30 var msgdiv = $('.js-pp-creditmessage iFrame'); 31 if(msgdiv.length > 0 && msgdiv.contents().height() == 0) 32 loadCreditMsgSdk(); 33 });*/ 34 35 if($('.js-paypalcredit-sdk').length>0){ 36 loadCreditMsgSdk(); 37 if($('.js-pp-creditmessage').length>0 ){ 38 var ppdivs = $('.js-pp-creditmessage'); 39 var waitForSdk = setInterval(function () { 40 if((typeof paypal !== "undefined" && typeof paypal.Messages !== "undefined") || (typeof paypal2 !== "undefined" && typeof paypal2.Messages !== "undefined")){ 41 clearInterval(waitForSdk); 42 ppdivs.each(function(){ 43 var includePrice = $(this).data("include-price"); 44 var placement = $(this).data("placement") || ""; 45 var ppDiv = $(this); 46 ppDiv.addClass("pp-message"); 47 if("product_tile" === placement){ 48 placement = ""; 49 } 50 if($('.pp-credit-banner'+placement).length > 0){ 51 $('.pp-credit-banner'+placement).each(function () { 52 var price = includePrice == true ? $(this).data("price") : "0"; 53 var removeMsg = $(this).data("remove-msg"); 54 if(removeMsg !== true){ 55 var clazz = "pp-message-"+Math.floor((Math.random() * 100) + 1); 56 $(this).addClass(clazz); 57 loadPPBanner(price, ppDiv, clazz); 58 } 59 }); 60 ppDiv.remove(); 61 } 62 else if($('.pp-credit-remove').length > 0){ 63 ppDiv.remove(); 64 } 65 else{ 66 loadPPBanner("0", ppDiv, "pp-message"); 67 } 68 }); 69 } 70 }, 200); 71 } 72 } 73}); 74 75function loadCreditMsgSdk(){ 76 if($('.js-paypalcredit-sdk').length>0){ 77 var src = $('.js-paypalcredit-sdk').data("sdk-src"); 78 if ($('script[src="'+ src + '"]').length == 0) { 79 var tag = document.createElement("script"); 80 tag.src = src; 81 if($('script[src="https://www.paypalobjects.com/api/checkout.js"]').length > 0 ) 82 tag.setAttribute("data-namespace", "paypal2"); 83 document.getElementsByTagName("body")[0].appendChild(tag); 84 } 85 86 } 87} 88 89function loadPPBanner(price, ppDiv, clazz){ 90 var obj = typeof paypal2 !== "undefined" ? paypal2 : paypal; 91 if(typeof obj.Messages !== "undefined"){ 92 var plment = ppDiv.data("pp-placement") == "product Tile" ? "product" : ppDiv.data("pp-placement"); 93 var lyout = ppDiv.data("pp-style-layout") == "" ? 'text' : ppDiv.data("pp-style-layout"); 94 var color = ppDiv.data("pp-style-color") == "" ? 'blue': ppDiv.data("pp-style-color"); 95 var ratio = ppDiv.data("pp-style-ratio") == "" ? '20X1': ppDiv.data("pp-style-ratio"); 96 var textColor = ppDiv.data("pp-style-text-color") == "" ? 'black': ppDiv.data("pp-style-text-color"); 97 var logoType = ppDiv.data("pp-style-logo-type") == "" ? 'primary' : ppDiv.data("pp-style-logo-type"); 98 var logoPosition = ppDiv.data("pp-style-logo-position") == "" ? 'left' : ppDiv.data("pp-style-logo-position"); 99 obj.Messages({ 100 amount: price, 101 placement: plment, 102 style: { 103 layout: lyout, 104 color:color, 105 ratio:ratio, 106 text: { 107 color: textColor 108 }, 109 logo: { 110 type: logoType, 111 position: logoPosition 112 } 113 } 114 }) 115 .render('.'+clazz); 116 } 117} 118 119function paymentMethod() { 120 // $(document).ready(function(){ 121 // if($("#checkoutContentPanelPayment").hasClass("paymentDone")){ 122 // $("#checkoutContentPanelPayment").hide(); 123 // $('.payWithCardSection').show(); 124 // $("#paypalTab").click(); 125 // }else{ 126 // $("#cardTab").click(); 127 // $('.payWithCardSection').hide(); 128 // $("#checkoutContentPanelPayment").show(); 129 // } 130 // }); 131 132 133 // $(".paywithcard").click(function(){ 134 // if ($(".paywithcard").hasClass("active")){ 135 // $('.payWithCardSection').hide(); 136 // $(".paywithcard").removeClass("active") 137 // } 138 // else{ 139 // $(".paywithcard").addClass("active") 140 // $('.payWithCardSection').show(); 141 // } 142 // }); 143}
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.