1/* 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 ââââââââ¦ââ¦âââ âââââââââ 4 ââââ ââââââ â⣠ââââ âââ 5 âââââââ© â©â©â© â© ââââ© âââ 6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 Usage & Logic Notes: 8 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 Initially cloned from Click-n-Pledge code, which required changes for Zomia's 10 purposes due to an issue with iframe manipulating window.location. Original code: 11 https://resources.connect.clickandpledge.com/Library/iframe-1.0.0.min.js?636840337273622128 12 13 See also https://www.w3schools.com/tags/att_iframe_sandbox.asp for details of 14 setting the <iframe> sandbox attribute, which is how we prevented window.location changes. 15 */ 16 17function getInternetExplorerVersion() { 18 let rv = -1; 19 if (navigator.appName === 'Microsoft Internet Explorer') { 20 const ua = navigator.userAgent; 21 const re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 22 if (re.exec(ua) != null) { 23 rv = parseFloat(RegExp.$1) 24 } 25 } 26 return rv 27} 28 29function checkVersion() { 30 const ver = getInternetExplorerVersion(); 31 if (ver > -1) { 32 if (ver >= 10.0) { 33 } else { 34 return '<div id="jqueryAlert" style=\"color:#333; background:rgb(250, 247, 200); padding:5px; border:1px solid #ccc;position:fixed;top: 0;left: 0;float: left;z-index: 999999;text-align:center; box-shadow:0 2px 3px -2px #333; width:100%; font-family:arial,sans-serif;\">The Click & Pledge Connect form library requires a more recent browser version than you are using.</div>'; 35 } 36 } 37} 38 39jQuery(document).ready(function ($) { 40 const cnpLoader = $('.CnP_formloader'); // Class assigned to script element that will dynamically iframe - CnP form GUID attached 41 const cnpInlineForm = $('#CnP_inlineform'); // ID of div used for inline form itself 42 const cnpFormContainer = $('#CnP_form_container'); // ID of div present when form is on stand-along donate page (not popup) 43 const cnpLoadAnimation = cnpInlineForm.find('.loader-container'); 44 45 const versionWarning = checkVersion(); 46 if (versionWarning) { 47 cnpInlineForm.append(versionWarning); 48 } 49 50 // Function to consistently append iframe whether we're in a popup or stand-alone page 51 function generateAndAppendIFrame() { 52 const guid = cnpLoader.attr('data-guid'); 53 const style = '<style>#CnP_inlineiframe { width: 1px; min-width: 100%; height: 2480px; border:none; }</style>'; 54 const lib = '<script src="https://resources.connect.clickandpledge.com/Library/iframeResizer.min.js"></script>'; 55 56 // Z-RLL: important: set <sandbox> property below to prevent top-level browser navigation, which is happening in the C&P code 57 const inlineHtml = "<iframe id=\"CnP_inlineiframe\" src=\"https://connect.clickandpledge.com/w/Form/" + guid + "\" " + 58 "width=\"100%\" onload=\"iFrameResize({log:false,checkOrigin:'*'});\" scrolling=\"no\" " + 59 "sandbox=\"allow-scripts allow-forms allow-same-origin allow-popups\"></iframe>"; 60 61 $('head').append('<meta http-equiv="X-UA-Compatible" content="IE=edge">'); 62 63 // And append the style, script lib, and iframe 64 cnpInlineForm.append(style + lib + inlineHtml); 65 } 66 67 // Set up listener so that clicking a .zom-donate popup trigger or the .zomia-donate menu item will initialize the C&P iframe 68 $('.zomia-donate, .zom-donate').on('click', function (e) { 69 // If element (normally <script>) with class CnP_formloader exists with GUID, load iframe dynamically 70 if (cnpLoader.attr('data-guid') != null && cnpInlineForm.children('#CnP_inlineiframe').length === 0) { 71 // Generate the iframe 72 generateAndAppendIFrame(); 73 // Remove our custom animator 74 setTimeout(function () { 75 cnpLoadAnimation.hide(); // Initially, this was placed in iframe onload - but that requires all frame c
75ontent to be loaded, which takes time... 76 }, 2000); 77 } 78 }) 79 80 // And handle the generic embedded form on the donate page 81 if (cnpLoader.attr('data-guid') != null && cnpFormContainer.children().length > 0) { 82 generateAndAppendIFrame(); 83 } 84});
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.