PageSourceSearch

https://bridgethegulfproject.org/sites/default/files/js/js_6i3y6xGLHZKUSLmPjrtT-wRjsgko4eMHwGy72OvjczA.js

js bridgethegulfproject.org collected 2026-10-02 05:47:22 UTC 14,295 bytes, 365 lines download raw bytes

1(function ($) {
2
3/**
4 * The recommended way for producing HTML markup through JavaScript is to write
5 * theming functions. These are similiar to the theming functions that you might
6 * know from 'phptemplate' (the default PHP templating engine used by most
7 * Drupal themes including Omega). JavaScript theme functions accept arguments
8 * and can be overriden by sub-themes.
9 *
10 * In most cases, there is no good reason to NOT wrap your markup producing
11 * JavaScript in a theme function.
12 */
13Drupal.theme.prototype.btgExampleButton = function (path, title) {
14  // Create an anchor element with jQuery.
15  return $('<a href="' + path + '" title="' + title + '">' + title + '</a>');
16};
17
18/**
19 * Behaviors are Drupal's way of applying JavaScript to a page. The advantage
20 * of behaviors over simIn short, the advantage of Behaviors over a simple
21 * document.ready() lies in how it interacts with content loaded through Ajax.
22 * Opposed to the 'document.ready()' event which is only fired once when the
23 * page is initially loaded, behaviors get re-executed whenever something is
24 * added to the page through Ajax.
25 *
26 * You can attach as many behaviors as you wish. In fact, instead of overloading
27 * a single behavior with multiple, completely unrelated tasks you should create
28 * a separate behavior for every separate task.
29 *
30 * In most cases, there is no good reason to NOT wrap your JavaScript code in a
31 * behavior.
32 *
33 * @param context
34 *   The context for which the behavior is being executed. This is either the
35 *   full page or a piece of HTML that was just added through Ajax.
36 * @param settings
37 *   An array of settings (added through drupal_add_js()). Instead of accessing
38 *   Drupal.settings directly you should use this because of potential
39 *   modifications made by the Ajax callback that also produced 'context'.
40 */
41Drupal.behaviors.btgTheme = {
42  attach: function (context, settings) {
43    $('#block-search-form').before('<div id="search-icon"><span></span></div>');
44
45    /* prepend menu icon */
46    $('.l-branding').prepend('<div id="mobile-menu"><span>Menu</span></div>');
47    
48    //clone menu to add to menu icon and use breakpoints to show/hide
49    if ($('.nav-clone').length == 0) {
50      //move search and util to the accordian menu
51      //var $divClone = $("div#source").clone();
52      var $navClone = $('#block-menu-block-1').clone();
53      var $utilClone = $('.block--menu-secondary-menu ul.menu').clone();
54      var $searchClone = $('#block-search-form').clone();
55      
56      $navClone.attr("class", "nav-clone");
57      $utilClone.attr("class", "utility-clone");
58      $searchClone.attr("id", "block-search-clone");
59      
60
61      $('#mobile-menu').append($navClone);
62      $("#mobile-menu ul.menu").prepend($searchClone);
63      $("#mobile-menu ul.menu").append($utilClone);
64
65      $('#block-search-clone').wrap('<li></li>');
66      $('.utility-clone').wrap('<li></li>');
67
68      //change the value of the submit button on search 
69      $("#block-search-clone #edit-submit").prop('value',htmlDecode('&#xe602'));
70
71    }
72
73    $('#mobile-menu span').click(function(){
74      
75      $('#block-menu-block-1').slideToggle();
76      //$(this).toggleClass('active');
77    });
78
79    //add videoWrapper around iframes to make them responsive
80    $(".field--name-body iframe").wrap( "<div class='videoWrapper'></div>" );
81    //remove any inline styles
82    $(".field--name-body iframe").removeAttr( 'style' );
83
84    //add videoWrapper around iframes to make them responsive
85    $(".field--name-body object").wrap( "<div class='videoWrapper'></div>" );
86    //remove any inline styles
87    $(".field--name-body object").removeAttr( 'style' );
88
89
90    //add videoWrapper around iframes to make them responsive
91    $(".teaser-text iframe").wrap( "<div class='videoWrapper'></div>" );
92    //remove any inline styles
93    $(".teaser-text iframe").removeAttr( 'style' );
94
95    //add videoWrapper around iframes to make them responsive
96    $(".teaser-text object").wrap( "<div class='videoWrapper'></div>" );
97    //remove any inline styles
98    $(".teaser-text object").removeAttr( 'style' );
99
100    
101
102
103    $('#search-icon').click(function(){
104      //$('#block-search-form').toggle('slide');
105      var elem = $("#block-search-form")[0];
106      if(elem.style.display == 'none')
107           $("#block-search-form").show();
108      else
109      {
110           $("#block-search-form").hide();         
111      }
112      //$('#block-search-form').animate({width: 'toggle'});
113      //$(this).toggleClass('active');
114    });
115
116      //used to decode html character codes used for icomoon font
117    function htmlDecode(value){
118      //create a in-memory div, set it's inner text(which jQuery automatically encodes)
119      //then grab the encoded contents back out.  The div never exists on the page.
120      return $('<div/>').html(value).text();
121    }
122    
123  }
124};
125
126
127Drupal.behaviors.btgEqualHeight = {
128  attach: function (context, settings) {
129    //used to keep block sections at tablet and desktop the same height  
130    equalheight = function(container){
131
132     var currentTallest = 0,
133     currentRowStart = 0,
134     rowDivs = new Array(),
135     $el,
136     topPosition = 0;
137
138     $(container).each(function() {
139
140       $el = $(this);
141       $($el).height('auto')
142       topPostion = $el.position().top;
143
144       if (currentRowStart != topPostion) {
145         for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
146           rowDivs[currentDiv].height(currentTallest);
147         }
148         rowDivs.length = 0; // empty the array
149         currentRowStart = topPostion;
150         currentTallest = $el.height();
151         rowDivs.push($el);
152       } else {
153         rowDivs.push($el);
154         currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
155      }
156       for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
157         rowDivs[currentDiv].height(currentTallest);
158       }
159     });
160    }
161
162    $(window).load(function() {
163      equalheight('.equal-heights');
164    });
165
166
167    $(window).resize(function(){
168      $('.equal-heights').css('height','auto');
169      equalheight('.equal-heights');
170    });
171  }
172}
173})(jQuery);;
174$(document).ready(function() {    
175
176var fnames = new Array();var ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';
177try {
178    var jqueryLoaded=jQuery;
179    jqueryLoaded=true;
180} catch(err) {
181    var jqueryLoaded=false;
182}
183var head= document.getElementsByTagName('head')[0];
184if (!jqueryLoaded) {
185    var script = document.createElement('script');
186    script.type = 'text/javascript';
187    script.src = '//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js';
188    head.appendChild(script);
189    if (script.readyState && script.onload!==null){
190        script.onreadystatechange= function () {
191              if (this.readyState == 'complete') mce_preload_check();
192        }    
193    }
194}
195
196var err_style = '';
197try{
198    err_style = mc_custom_error_style;
199} catch(e){
200    err_style = '#mc_embed_signup input.mce_inline_error{border-color:#6B0505;} #mc_embed_signup div.mce_inline_error{margin: 0 0 1em 0; padding: 5px 10px; background-color:#6B0505; font-weight: bold; z-index: 1; color:#fff;}';
201}
202var head= document.getElementsByTagName('head')[0];
203var style= document.createElement('style');
204style.type= 'text/css';
205if (style.styleSheet) {
206  style.styleSheet.cssText = err_style;
207} else {
208  style.appendChild(document.createTextNode(err_style));
209}
210head.appendChild(style);
211setTimeout('mce_preload_check();', 250);
212
213var mce_preload_checks = 0;
214function mce_preload_check(){
215    if (mce_preload_checks>40) return;
216    mce_preload_checks++;
217    try {
218        var jqueryLoaded=jQuery;
219    } catch(err) {
220        setTimeout('mce_preload_check();', 250);
221        return;
222    }
223    var script = document.createElement('script');
224    script.type = 'text/javascript';
225    script.src = 'http://downloads.mailchimp.com/js/jquery.form-n-validate.js';
226    head.appendChild(script);
227    try {
228        var validatorLoaded=jQuery("#fake-form").validate({});
229    } catch(err) {
230        setTimeout('mce_preload_check();', 250);
231        return;
232    }
233    mce_init_form();
234}
235function mce_init_form(){
236    jQuery(document).ready( function($) {
237      var options = { errorClass: 'mce_inline_error', errorElement: 'div', onkeyup: function(){}, onfocusout:function(){}, onblur:function(){}  };
238      var mce_validator = $("#mc-embedded-subscribe-form").validate(options);
239      $("#mc-embedded-subscribe-form").unbind('submit');//remove the validator so we can get into beforeSubmit on the ajaxform, which then calls the validator
240      options = { url: 'http://bridgethegulfproject.us3.list-manage.com/subscribe/post-json?u=d20a2c0a56d4112f40da93653&id=5015bab89e&c=?', type: 'GET', dataType: 'json', contentType: "application/json; charset=utf-8",
241                    beforeSubmit: function(){
242                        $('#mce_tmp_error_msg').remove();
243                        $('.datefield','#mc_embed_signup').each(
244                            function(){
245                                var txt = 'filled';
246                                var fields = new Array();
247                                var i = 0;
248                                $(':text', this).each(
249                                    function(){
250                                        fields[i] = this;
251                                        i++;
252                                    });
253                                $(':hidden', this).each(
254                                    function(){
255                                        var bday = false;
256                                        if (fields.length == 2){
257                                            bday = true;
258                                            fields[2] = {'value':1970};//trick birthdays into having years
259                                        }
260                                      if ( fields[0].value=='MM' && fields[1].value=='DD' && (fields[2].value=='YYYY' || (bday && fields[2].value==1970) ) ){
261                                        this.value = '';
262                      } else if ( fields[0].value=='' && fields[1].value=='' && (fields[2].value=='' || (bday && fields[2].value==1970) ) ){
263                                        this.value = '';
264                      } else {
265                          if (/\[day\]/.test(fields[0].name)){
266                                              this.value = fields[1].value+'/'+fields[0].value+'/'+fields[2].value;                         
267                          } else {
268                                              this.value = fields[0].value+'/'+fields[1].value+'/'+fields[2].value;
269                                          }
270                                      }
271                                    });
272                            });
273                        $('.phonefield-us','#mc_embed_signup').each(
274                            function(){
275                                var fields = new Array();
276                                var i = 0;
277                                $(':text', this).each(
278                                    function(){
279                                        fields[i] = this;
280                                        i++;
281                                    });
282                                $(':hidden', this).each(
283                                    function(){
284                                        if ( fields[0].value.length != 3 || fields[1].value.length!=3 || fields[2].value.length!=4 ){
285                                        this.value = '';
286                      } else {
287                          this.value = 'filled';
288                                      }
289                                    });
290                            });
291                        return mce_validator.form();
292                    }, 
293                    success: mce_success_cb
294                };
295      $('#mc-embedded-subscribe-form').ajaxForm(options);
296      
297      
298    });
299}
300function mce_success_cb(resp){
301    $('#mce-success-response').hide();
302    $('#mce-error-response').hide();
303    if (resp.result=="success"){
304        $('#mce-'+resp.result+'-response').show();
305        $('#mce-'+resp.result+'-response').html(resp.msg);
306        $('#mc-embedded-subscribe-form').each(function(){
307            this.reset();
308      });
309    } else {
310        var index = -1;
311        var msg;
312        try {
313            var parts = resp.msg.split(' - ',2);
314            if (parts[1]==undefined){
315                msg = resp.msg;
316            } else {
317                i = parseInt(parts[0]);
318                if (i.toString() == parts[0]){
319                    index = parts[0];
320                    msg = parts[1];
321                } else {
322                    index = -1;
323                    msg = resp.msg;
324                }
325            }
326        } catch(e){
327            index = -1;
328            msg = resp.msg;
329        }
330        try{
331            if (index== -1){
332                $('#mce-'+resp.result+'-response').show();
333                $('#mce-'+resp.result+'-response').html(msg);            
334            } else {
335                err_id = 'mce_tmp_error_msg';
336                html = '<div id="'+err_id+'" style="'+err_style+'"> '+msg+'</div>';
337                
338                var input_id = '#mc_embed_signup';
339                var f = $(input_id);
340                if (ftypes[index]=='address'){
341                    input_id = '#mce-'+fnames[index]+'-addr1';
342                    f = $(input_id).parent().parent().get(0);
343                } else if (ftypes[index]=='date'){
344                    input_id = '#mce-'+fnames[index]+'-month';
345                    f = $(input_id).parent().parent().get(0);
346                } else {
347                    input_id = '#mce-'+fnames[index];
348                    f = $().parent(input_id).get(0);
349                }
350                if (f){
351                    $(f).append(html);
352                    $(input_id).focus();
353                } else {
354                    $('#mce-'+resp.result+'-response').show();
355                    $('#mce-'+resp.result+'-response').html(msg);
356                }
357            }
358        } catch(e){
359            $('#mce-'+resp.result+'-response').show();
360            $('#mce-'+resp.result+'-response').html(msg);
361        }
362    }
363}
364
365});;

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.