PageSourceSearch

https://forms.mountainwestcouncil.org/js/machform_loader.js

js mountainwestcouncil.org collected 2026-10-06 10:41:37 UTC 2,980 bytes, 63 lines download raw bytes

1jQuery(document).ready(function($){
2    var mf_iframe_height;
3    var mf_iframe_padding_bottom = 0;
4
5    if($("#mf_placeholder").data("formheight") !== undefined){
6      __machform_height = $("#mf_placeholder").data("formheight");
7    }
8
9    if($("#mf_placeholder").data("formurl") !== undefined){
10      __machform_url = $("#mf_placeholder").data("formurl");
11    }
12    
13    if($("#mf_placeholder").data("paddingbottom") !== undefined){
14      var mf_iframe_padding_bottom = $("#mf_placeholder").data("paddingbottom");
15    }
16
17    var mf_iframe = $('<iframe id="mf_iframe" height="' + __machform_height + '" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="'+ __machform_url +'"><a href="'+ __machform_url +'">View Form</a></iframe>');
18    $("#mf_placeholder").after(mf_iframe);
19    $("#mf_placeholder").remove();
20
21    $.receiveMessage(function(e){      
22      if(e.data.indexOf('run_safari_cookie_fix') != -1){
23        //execute safari cookie fix if the embedded form is coming from different subdomain/domain 
24        var main_domain = __machform_url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
25        if(main_domain == null){
26             //since the URL can be using relative URL, we need to check it as well 
27             main_domain = __machform_url.match(/^\/\/([^\/?#]+)(?:[\/?#]|$)/i);
28          }
29
30        var embedded_domain = window.location.href.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
31
32        //If parent domain is different, continue to run Safari check. From testing, it seems that a matching parent domain is good enough in order for Safari to allow the iFrame to set cookies.
33        if(main_domain[1] != embedded_domain[1] && embedded_domain[1].indexOf(main_domain[1].replace("forms2", "").replace("forms", "")) == -1){
34          var mf_folder = __machform_url.substring(0,__machform_url.lastIndexOf('/'));
35          window.location.href = mf_folder + '/safari_init.php?ref=' + window.btoa(window.location.href);
36          
37          return;
38        }
39      }else{
40        //adjust the height of the iframe     
41        var new_height = Number( e.data.replace( /.*mf_iframe_height=(\d+)(?:&|$)/, '$1' ) );
42        if (!isNaN(new_height) && new_height > 0 && new_height !== mf_iframe_height) {
43          new_height += mf_iframe_padding_bottom; //add padding bottom
44          
45          //height has changed, update the iframe
46          mf_iframe.height(mf_iframe_height = new_height);
47
48          //just to make sure the height is being applied 
49          document.getElementById("mf_iframe").setAttribute('style','width:100%;border:none;height:' + new_height + 'px !important');
50        }
51      }
52      
53    });
54
55    //scroll to the top of iframe upon submissions
56    $("#mf_iframe").bind('load',function(){
57        if($(this).data("first_loaded") === undefined){
58          $(this).data("first_loaded",true);
59        }else{
60          parent.scrollTo(0,$('#mf_iframe').offset().top - 100);
61        }
62    });
63});

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.