// Underscore.js 1.6.0 // http://underscorejs.org // (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. (function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this); ; /* * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 * http://benalman.com/projects/jquery-bbq-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.sharing_library = {attach: function (context, settings) { var filter_label = $('.top_area_filter'); var sharing_library_js = function() { // This css is in javascript so that it's only applied if javascript is working. // This allows users without javascript to still see the checkboxes. // $('#edit-field-sharing-library-topics-target-id-wrapper .views-widget').css({"position":"absolute", "z-index":"5", "top":"35px", "left":"67px", "margin-top":"0px", "border-top":"none"}); filter_label.val('Showing All Topic Areas'); // prevent function duplication $('#main-content').off('click', ".top_area_filter"); $('#main-content').on('click', ".top_area_filter", function(){ $('.edit-field-sharing-library-topics-target-id-wrapper .views-widget').slideToggle(); }); // prevent function duplication $('.edit-field-sharing-library-topics-target-id-wrapper input').off(); $('.edit-field-sharing-library-topics-target-id-wrapper input').change(rewrite_label) if($(".expand_button").length) { $('.views-row').hide(); // make sure we're not duplicating the click function; $(".expand_button").off(); $(".expand_button").click(function() { $(this).toggleClass('open'); $('.' + $(this).attr('id')).slideToggle(); }); $('.section_header').each(function(){ var results = $(this).nextUntil('.section_header').length; $(this).children('h2').append(" (" + results + ')'); }); $(".expand_header").off(); $('.expand_header').click(function(){ $(this).closest('.section_header').children('.expand_button').click(); }); var all_open = false; $('#expand_all_button, #expand_all_link, #collapse_all_link').off(); $('#expand_all_button, #expand_all_link, #collapse_all_link').click(function(){ $('#expand_all_button').toggleClass('open'); $('#expand_all_button').siblings('h3').toggle(); if (all_open) { $('.expand_button').removeClass('open'); $('.views-row').hide(); all_open = false; } else { $('.expand_button').addClass('open'); $('.views-row').show(); all_open = true; } }); $('.expand_button').first().click(); } // set the 'filtered by' text if ($('#views-exposed-form-sharing-library-list-view-ctools-context-1 .edit-field-sharing-library-topics-target-id-wrapper input:checked').length){ var filter_topics = []; $('#views-exposed-form-sharing-library-list-view-ctools-context-1 .edit-field-sharing-library-topics-target-id-wrapper input:checked').each(function(){ filter_topics.push($(this).siblings('label').text()); }); $('.pane-views-attachments').after("
Filtered by: " + filter_topics.join('; ') + "
"); } // gray out topic areas in the exposed filter which will return zero results $(".form-item-field-sharing-library-topics-target-id input[type='checkbox']").each(function(){ if (!($.inArray($(this).attr('value'), Drupal.settings.Topics) > -1)) { $(this).attr('disabled', 'true'); $(this).siblings('label').css('color', 'gray'); } }); } // Rewrite the 'Topic Area' text to show how many topic areas are selected var rewrite_label = function(){ var num_checked = $('#views-exposed-form-sharing-library-list-view-ctools-context-1 .edit-field-sharing-library-topics-target-id-wrapper input:checked').length; if (num_checked == 1) { filter_label.val('1 Topic Area Selected'); } else if(num_checked){ filter_label.val(num_checked + ' Topic Areas Selected'); } else { filter_label.val('Showing All Topic Areas'); } } if ($('body').hasClass('page-healthy-people-in-action-stories-from-the-field')) { sharing_library_js(); rewrite_label(); } }}}(jQuery, Drupal, this, this.document)); ; (function ($, Drupal, window, document, undefined) { Drupal.behaviors.consortium_search = {attach: function (context, settings) { var topic_filter_label = $('#filter-field_org_topic_area_target_id-wrapper legend'); var orgtype_filter_label = $('#filter-field_organization_type_target_id-wrapper legend'); var filter_js = function () { // $('#filter-field_org_topic_area_target_id-wrapper .views-widget, #filter-field_organization_type_target_id-wrapper .views-widget').css({"position": "absolute", "z-index": "5", "top": "35px", "left": "67px", "margin-top": "0px", "border-top": "none"}); topic_filter_label.html('Show All Topic Areas'); orgtype_filter_label.html('Show All Organization Types'); // prevent function duplication topic_filter_label.off(); orgtype_filter_label.off(); topic_filter_label.click(function () { $('#filter-field_org_topic_area_target_id-wrapper .views-widget').slideToggle(); }); orgtype_filter_label.click(function () { $('#filter-field_organization_type_target_id-wrapper .views-widget').slideToggle(); }); // prevent function duplication $('#filter-field_org_topic_area_target_id-wrapper').off() $('#filter-field_organization_type_target_id-wrapper').off() $('#filter-field_org_topic_area_target_id-wrapper').mouseleave(function () { $('#filter-field_org_topic_area_target_id-wrapper .views-widget').slideUp(); }); $('#filter-field_organization_type_target_id-wrapper').mouseleave(function () { $('#filter-field_organization_type_target_id-wrapper .views-widget').slideUp(); }); // prevent function duplication $('#filter-field_org_topic_area_target_id-wrapper input').off(); $('#filter-field_org_topic_area_target_id-wrapper input').change(topic_rewrite_label) $('#filter-field_org_topic_area_target_id-wrapper input').change(update_reset_filters_link) $('#filter-field_organization_type_target_id-wrapper input').off(); $('#filter-field_organization_type_target_id-wrapper input').change(orgtype_rewrite_label) $('#filter-field_organization_type_target_id-wrapper input').change(update_reset_filters_link) // set the 'filtered by' text if ($('#filter-field_org_topic_area_target_id-wrapper input:checked, #filter-field_organization_type_target_id-wrapper input:checked').length) { var filter_topics = []; $('#filter-field_org_topic_area_target_id-wrapper input:checked, #filter-field_organization_type_target_id-wrapper input:checked').each(function () { filter_topics.push($(this).siblings('label').text()); }); $('#views-exposed-form-consortiums-panel-pane-1').after("
Filtered by: " + filter_topics.join('; ') + "
"); } $('#help_link').colorbox({inline:true, width:"50%"}); } var topic_rewrite_label = function () { var num_checked = $('#filter-field_org_topic_area_target_id-wrapper input:checked').length; if (num_checked == 1) { topic_filter_label.html('1 Topic Area Selected'); topic_filter_label.addClass('active'); } else if (num_checked) { topic_filter_label.html(num_checked + ' Topic Areas Selected'); topic_filter_label.addClass('active'); } else { topic_filter_label.html('Show All Topic Areas'); topic_filter_label.removeClass('active'); } } var orgtype_rewrite_label = function () { var num_checked = $('#filter-field_organization_type_target_id-wrapper input:checked').length; if (num_checked == 1) { orgtype_filter_label.html('1 Organization Type Selected'); orgtype_filter_label.addClass('active'); } else if (num_checked) { orgtype_filter_label.html(num_checked + ' Organization Types Selected'); orgtype_filter_label.addClass('active'); } else { orgtype_filter_label.html('Show All Organization Types'); orgtype_filter_label.removeClass('active'); } } var reset_filters = function () { $('.consortium-search-filter-reset').click(function () { $('#filter-field_org_topic_area_target_id-wrapper input:checked, #filter-field_organization_type_target_id-wrapper input:checked').each(function () { $(this).attr('checked', false); }); $(this).hide(); topic_rewrite_label(); orgtype_rewrite_label(); }); } var update_reset_filters_link = function () { if ($('#filter-field_org_topic_area_target_id-wrapper input:checked, #filter-field_organization_type_target_id-wrapper input:checked').length > 0) { $('.consortium-search-filter-reset').show(); } else { $('.consortium-search-filter-reset').hide(); } } var init_items_per_page = function() { $('#edit-items-per-page-copy').val($('#edit-items-per-page').find(":selected").val()); } var update_items_per_page = function() { $('#edit-items-per-page-copy').change(function() { var new_value = $(this).find(":selected").val(); $('#edit-items-per-page').val(new_value); $('#edit-submit-consortiums').click(); }); } /** * This function rearranges the pager links. * It's only necessary because theme_views_mini_pager is broken in Tao at the moment. * If that issue gets resolved, use that instead of this jquery. * See: https://www.drupal.org/node/1367208 */ var pager_fix = function() { var left_pagers = $('.consortiums-search-footer .pager-first, .consortiums-search-footer .pager-previous'); var pager_numbers = $('.consortiums-search-footer .pager-list'); if(left_pagers.length && pager_numbers.length) { left_pagers = left_pagers.detach(); pager_numbers.before(""); $('#left_pagers').append(left_pagers); } } /** * Reset and disable the 'state' dropdown if there is text entered into the ZIP code box */ var state_disable = function() { var prev_state = 'All' $('#edit-province').change(function(){ prev_state = $(this).val(); }); $('#edit-distance-postal-code').keyup(function(){ if ($(this).val()) { $('#edit-province').val('All').attr('disabled', 'disabled'); } else { $('#edit-province').removeAttr('disabled').val(prev_state); } }); } if ($('.view-consortiums').length > 0) { // update_reset_filters_link(); init_items_per_page(); filter_js(); topic_rewrite_label(); orgtype_rewrite_label(); // reset_filters(); update_items_per_page(); pager_fix(); state_disable(); } } } }(jQuery, Drupal, this, this.document) ) ; ; /* Modernizr 2.8.2 (Custom Build) | MIT & BSD * Build: http://modernizr.com/download/#-backgroundsize-borderimage-borderradius-boxshadow-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssgradients-shiv-cssclasses-testprop-testallprops-prefixes-domprefixes-load */ ; window.Modernizr = (function( window, document, undefined ) { var version = '2.8.2', Modernizr = {}, enableClasses = true, docElement = document.documentElement, mod = 'modernizr', modElem = document.createElement(mod), mStyle = modElem.style, inputElem , toString = {}.toString, prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), omPrefixes = 'Webkit Moz O ms', cssomPrefixes = omPrefixes.split(' '), domPrefixes = omPrefixes.toLowerCase().split(' '), tests = {}, inputs = {}, attrs = {}, classes = [], slice = classes.slice, featureName, _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { hasOwnProp = function (object, property) { return _hasOwnProperty.call(object, property); }; } else { hasOwnProp = function (object, property) { return ((property in object) && is(object.constructor.prototype[property], 'undefined')); }; } if (!Function.prototype.bind) { Function.prototype.bind = function bind(that) { var target = this; if (typeof target != "function") { throw new TypeError(); } var args = slice.call(arguments, 1), bound = function () { if (this instanceof bound) { var F = function(){}; F.prototype = target.prototype; var self = new F(); var result = target.apply( self, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return self; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; return bound; }; } function setCss( str ) { mStyle.cssText = str; } function setCssAll( str1, str2 ) { return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); } function is( obj, type ) { return typeof obj === type; } function contains( str, substr ) { return !!~('' + str).indexOf(substr); } function testProps( props, prefixed ) { for ( var i in props ) { var prop = props[i]; if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { return prefixed == 'pfx' ? prop : true; } } return false; } function testDOMProps( props, obj, elem ) { for ( var i in props ) { var item = obj[props[i]]; if ( item !== undefined) { if (elem === false) return props[i]; if (is(item, 'function')){ return item.bind(elem || obj); } return item; } } return false; } function testPropsAll( prop, prefixed, elem ) { var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); if(is(prefixed, "string") || is(prefixed, "undefined")) { return testProps(props, prefixed); } else { props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); return testDOMProps(props, prefixed, elem); } } tests['flexboxlegacy'] = function() { return testPropsAll('boxDirection'); }; tests['rgba'] = function() { setCss('background-color:rgba(150,255,150,.5)'); return contains(mStyle.backgroundColor, 'rgba'); }; tests['hsla'] = function() { setCss('background-color:hsla(120,40%,100%,.5)'); return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); }; tests['multiplebgs'] = function() { setCss('background:url(https://),url(https://),red url(https://)'); return (/(url\s*\(.*?){3}/).test(mStyle.background); }; tests['backgroundsize'] = function() { return testPropsAll('backgroundSize'); }; tests['borderimage'] = function() { return testPropsAll('borderImage'); }; tests['borderradius'] = function() { return testPropsAll('borderRadius'); }; tests['boxshadow'] = function() { return testPropsAll('boxShadow'); }; tests['textshadow'] = function() { return document.createElement('div').style.textShadow === ''; }; tests['opacity'] = function() { setCssAll('opacity:.55'); return (/^0.55$/).test(mStyle.opacity); }; tests['cssgradients'] = function() { var str1 = 'background-image:', str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', str3 = 'linear-gradient(left top,#9f9, white);'; setCss( (str1 + '-webkit- '.split(' ').join(str2 + str1) + prefixes.join(str3 + str1)).slice(0, -str1.length) ); return contains(mStyle.backgroundImage, 'gradient'); }; for ( var feature in tests ) { if ( hasOwnProp(tests, feature) ) { featureName = feature.toLowerCase(); Modernizr[featureName] = tests[feature](); classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); } } Modernizr.addTest = function ( feature, test ) { if ( typeof feature == 'object' ) { for ( var key in feature ) { if ( hasOwnProp( feature, key ) ) { Modernizr.addTest( key, feature[ key ] ); } } } else { feature = feature.toLowerCase(); if ( Modernizr[feature] !== undefined ) { return Modernizr; } test = typeof test == 'function' ? test() : test; if (typeof enableClasses !== "undefined" && enableClasses) { docElement.className += ' ' + (test ? '' : 'no-') + feature; } Modernizr[feature] = test; } return Modernizr; }; setCss(''); modElem = inputElem = null; ;(function(window, document) { var version = '3.7.0'; var options = window.html5 || {}; var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; var supportsHtml5Styles; var expando = '_html5shiv'; var expanID = 0; var expandoData = {}; var supportsUnknownElements; (function() { try { var a = document.createElement('a'); a.innerHTML = ''; supportsHtml5Styles = ('hidden' in a); supportsUnknownElements = a.childNodes.length == 1 || (function() { (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( typeof frag.cloneNode == 'undefined' || typeof frag.createDocumentFragment == 'undefined' || typeof frag.createElement == 'undefined' ); }()); } catch(e) { supportsHtml5Styles = true; supportsUnknownElements = true; } }()); function addStyleSheet(ownerDocument, cssText) { var p = ownerDocument.createElement('p'), parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; p.innerHTML = 'x'; return parent.insertBefore(p.lastChild, parent.firstChild); } function getElements() { var elements = html5.elements; return typeof elements == 'string' ? elements.split(' ') : elements; } function getExpandoData(ownerDocument) { var data = expandoData[ownerDocument[expando]]; if (!data) { data = {}; expanID++; ownerDocument[expando] = expanID; expandoData[expanID] = data; } return data; } function createElement(nodeName, ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createElement(nodeName); } if (!data) { data = getExpandoData(ownerDocument); } var node; if (data.cache[nodeName]) { node = data.cache[nodeName].cloneNode(); } else if (saveClones.test(nodeName)) { node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); } else { node = data.createElem(nodeName); } return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; } function createDocumentFragment(ownerDocument, data){ if (!ownerDocument) { ownerDocument = document; } if(supportsUnknownElements){ return ownerDocument.createDocumentFragment(); } data = data || getExpandoData(ownerDocument); var clone = data.frag.cloneNode(), i = 0, elems = getElements(), l = elems.length; for(;i h2').each(function(){ var results = $(this).siblings('.expand_box').find('.views-row').length; $(this).append(" (" + results + ')'); }); }; /** * This function controls the showing and hiding of the 'text version' of infographics (in the colorbox) */ var lhi_infographic_text = function(){ $('#text_version').hide(); $('#text_version_show').show(); /** * It would be great to do this using toggle() instead of show and hide, * but events called inside a colorbox automatically fire twice for some reason. * So, toggle() always fires twice. Not very useful. */ $('#text_version_show_button').click(function(){ $('#text_version').show(); $('#text_version_show').hide(); $('#text_version_hide').show(); }); $('#text_version_hide_button').click(function(){ $('#text_version').hide(); $('#text_version_hide').hide(); $('#text_version_show').show(); }); }; var open_colorbox = function(){ var current_hash = window.location.hash.substr(1); if(current_hash) { var hash_target = $("[data-date="+current_hash+"]").parent("a.colorbox-node"); if (hash_target.length) { hash_target.click(); } } $('a.colorbox-node').click(function(){ var hash_id = $(this).children('[data-date]').attr('data-date'); window.location.hash = hash_id; }); $('#cboxPrevious').attr('title', 'Previous infographic'); $('#cboxNext').attr('title', 'Next infographic'); } var track_click_in_google_analytics = function(){ $('a.colorbox-node').click(function() { ga('send', 'event', 'Infographic', 'infographic', $(this).attr('href')); }); } if ($('body').hasClass('LHI-infographic-gallery') || $('body').hasClass('lhi_page')) { if (run_once) { run_once = false; LHITables.init(); lhi_expand_buttons(); open_colorbox(); track_click_in_google_analytics(); } // this needs to run every time a colorbox opens, so it's outside the run_once check. lhi_infographic_text(); } }}}(jQuery, Drupal, this, this.document)); ; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.topic_tabs = {attach: function (context, settings) { var topic_objectives = function() { var all_open = false; $('#expand_all_button').click(function(){ if(all_open) { $(this).removeClass('open'); $('.expand_button, .objective-container').removeClass('open'); $('.expand_all_label').toggle(); $('div.objective_data_table').hide(); all_open = false; } else { $(this).addClass('open'); $('.expand_button, .objective-container').addClass('open') $('.expand_all_label').toggle(); $('div.objective_data_table').show(); all_open = true; } }); /** * expand/collapse all on label. */ $('.expand_all_label').click(function(){ if(all_open) { $('#expand_all_button').removeClass('open'); $('.expand_button, .objective-container').removeClass('open'); $('.expand_all_label').toggle(); $('div.objective_data_table').hide(); all_open = false; } else { $('#expand_all_button').addClass('open'); $('.expand_button, .objective-container').addClass('open') $('.expand_all_label').toggle(); $('div.objective_data_table').show(); all_open = true; } }); var all_related_open = false; $('#related_expand_all_button, #related_expand_all_link').click(function(){ if(all_related_open) { $('#related_expand_all_button, .related-objectives-row, .related_expand_button').removeClass('open'); $('#related_expand_all_link .related_expand_all_label').toggle(); $('.related-objectives-content').hide(); all_related_open = false; } else { $('#related_expand_all_button, .related-objectives-row, .related_expand_button').addClass('open'); $('#related_expand_all_link .related_expand_all_label').toggle(); $('.related-objectives-content').show(); all_related_open = true; } }); $('.objective_data_table, .related-objectives-content').hide(); $('.expand_button, .expand_link').click(function(){ $(this).parents('.title_row').children('.expand_button').toggleClass('open'); $(this).parents('.objective-container').toggleClass('open'); $(this).parents('.title_row').siblings('.objective_data_table').slideToggle(); }); $('.related_expand_button').click(function(){ $(this).toggleClass('open'); $(this).parents('.related-objectives-row').toggleClass('open'); $(this).siblings('.related-objectives-content').slideToggle(); }); $('.related-objectives-row').click(function(event){ if (!$(this).hasClass('open') && !$(event.target).closest('.related_expand_button').length) { $(this).children('.related_expand_button').click(); } }); $('.icon.term, .icon.rlog').hover(function(){ $(this).children('.tool-tip').show(); }, function() { $(this).children('.tool-tip').hide(); }); $('a.expand_link').hover(function(){ $(this).parents('.objective-container').addClass('gray_hover'); }, function() { $(this).parents('.objective-container').removeClass('gray_hover'); }); var objectiveToggle = { init: function() { this.id = window.location.hash; if(this.id.length) { this.openRow.call(this); } }, openRow: function() { $(this.id).click(); } }; $(document).ready(function() { objectiveToggle.init(); }); } var topic_ebrs = function() { if($('#ebr_header').length > 0) { $('#ebr_header_link').show(); } if($('#clin_recs').length > 0) { $('#clin_recs_link').show(); } if($('#cons_info').length > 0) { $('#cons_info_link').show(); } $('.help_link').colorbox({inline:true, width:"50%", onComplete:function(){ if($(this).attr('data-target')) { window.location.hash = ''; window.location.hash = $(this).attr('data-target'); } }}); } var topic_overview = function() { $('.expander_link').click(function() { if($(this).parents('.field').hasClass('more-hidden')) { $(this).parents('.field').removeClass('more-hidden'); $(this).siblings('.show-more').slideDown(100); $(this).text('Hide'); } else { $(this).parents('.field').addClass('more-hidden'); $(this).siblings('.show-more').slideUp(100); $(this).text('More'); } }); } var national_snapshots_expand_all = function() { var all_open = false; $('#expand_all_button, .expand_all_label').click(function(){ if(all_open) { $('#expand_all_button').removeClass('open'); $('.expand_button').removeClass('open'); $('.expand_all_label').toggle(); $('div.wrapper').hide(); all_open = false; } else { $('#expand_all_button').addClass('open'); $('.expand_button').addClass('open'); $('.expand_all_label').toggle(); $('div.wrapper').show(); all_open = true; } }); } var add_new_title = function() { var new_span = $('h1.page-title span.new_title.New'); if(new_span.length) { new_span.html('New'); } } if($('body').hasClass('topics')) { add_new_title(); } if ($('body').hasClass('topic_objectives')) { topic_objectives(); } else if ($('body').hasClass('topic_ebrs')) { topic_ebrs(); } else if ($('body').hasClass('topic_overview')) { topic_overview(); } else if ($('body').hasClass('page-node-national-snapshot')) { national_snapshots_expand_all(); } }}}(jQuery, Drupal, this, this.document)); ; (function ($, Drupal, window, document, undefined) { Drupal.behaviors.objective_node_view = {attach: function (context, settings) { var expand_controls = function () { //these apply to both individual node views and lists of node views $('div.expand_inner').hide(); $('.expand_button').click(function () { $(this).toggleClass('open'); $(this).siblings('.expand_inner').slideToggle(); }); } var single_objective_data_details = function () { var all_open = false; $('#expand_all_button').click(function () { if (all_open) { $(this).removeClass('open'); $('.expand_button').removeClass('open'); $('.expand_all_label').toggle(); $('div.expand_inner').hide(); all_open = false; } else { $(this).addClass('open'); $('.expand_button').addClass('open'); $('.expand_all_label').toggle(); $('div.expand_inner').show(); all_open = true; } }); /** * expand/collapse all on label. */ $('.expand_all_label').click(function(){ if(all_open) { $('#expand_all_button').removeClass('open'); $('.expand_button, .objective-container').removeClass('open'); $('.expand_all_label').toggle(); $('div.expand_inner').hide(); all_open = false; } else { $('#expand_all_button').addClass('open'); $('.expand_button, .objective-container').addClass('open') $('.expand_all_label').toggle(); $('div.expand_inner').show(); all_open = true; } }); var sectionToggle = { init: function() { this.id = window.location.hash; if(this.id.length) { this.openRow.call(this); } }, openRow: function() { $(this.id + ' .expand_button').click(); } }; $(document).ready(function() { sectionToggle.init(); }); } var objective_multi_node_view = function () { var all_open = false; $('#expand_all_button').click(function () { if (all_open) { $(this).removeClass('open'); $('.large_expand_button, .expand_button').removeClass('open') $('.expand_all_label').toggle(); $('div.large_expand, div.expand_inner').hide(); all_open = false; } else { $(this).addClass('open'); $('.large_expand_button, .expand_button').addClass('open') $('.expand_all_label').toggle(); $('div.large_expand, div.expand_inner').show(); all_open = true; } }); $('.expand_link').click(function () { $(this).closest('.node').children('.expand_button').toggleClass('open'); $(this).closest('.node').children('.expand_inner').slideToggle(); }); } var objective_icon_tooltips = function () { $('.icon.term, .icon.rlog').hover(function () { $(this).children('.tool-tip').show(); }, function () { $(this).children('.tool-tip').hide(); }); } if ($('body').hasClass('single-objective-data-details')) { expand_controls(); single_objective_data_details(); objective_icon_tooltips(); } else if ($('body').hasClass('page-node-data-details')) { expand_controls(); objective_multi_node_view(); objective_icon_tooltips(); } else if ($('body').hasClass('page-data-searchdata')) { objective_icon_tooltips(); } else if ($('body').hasClass('page-node-national-snapshot')) { objective_icon_tooltips(); } }} }(jQuery, Drupal, this, this.document)); ; // this variable is here to prevent functions from running again when ajax and colorbox fire. var run_once = true; var also_run_once = true; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.objective_search = {attach: function (context, settings) { // get the parameters from the url var params = $.deparam.querystring(); // these variables are used by chart_link_additions and refreshDropdown to set parameters on the chart page. var ci_visible = false, se_visible = false; // this is set by refreshDropdown and used by remember_display in order to set the population checkboxes at the top of the page var pop_boxes = []; if(params['pop'] != undefined) { pop_boxes = params['pop'].split('-'); } // This is for keeping track of the 'customize display' checkboxes var active_pop_filters = []; var slide_click = function(expand_trigger, expand_div, toggle){ expand_trigger.click(function(){ $(this).toggleClass('expanded'); expand_div.stop().slideToggle(); if (toggle){ $(this).find('.change').toggle(); } }); } // This adds functionality to the duplicate filters at the top of the page. var objective_search_top = function(){ // colorbox logic for help links. This also applies to the links in the 'resource type' column $('#help_link, .help_link').colorbox({inline:true, width:"50%", onComplete:function(){ if($(this).attr('data-target')) { window.location.hash = ''; window.location.hash = $(this).attr('data-target'); } }}); // show and hide the right divs when the radio buttons are changed $('input[type=radio]').change(function(){ $('div.top_filter').hide(); $('#'+$(this).val()).show(); }); // set the slide_click function for each set of checkboxes slide_click($('#topic_filter .expand_button'), $('#topic_expand'), true); slide_click($('#data_filter .expand_button'), $('#data_expand'), true); slide_click($('#show_population_filters'), $('.population_filters')); $('h2.pane_expand_trigger').each(function(){ slide_click($(this), $(this).siblings('.filter_contents')); }); if(params['f'] != undefined) { if (typeof(params['f']) == 'array' || typeof(params['f']) == 'object') { $.each(params['f'], function(index, param) { var filter_value = param.split(':'); if (filter_value[0] == 'field_topic_area' || filter_value[0] == 'field_data_sources' || filter_value[0] == 'field_ebr_topic_area') { $('.top_filter #'+filter_value[1]).attr('checked', 'checked'); } }); } else { var filter_value = params['f'].split(':'); if (filter_value[0] == 'field_topic_area' || filter_value[0] == 'field_data_sources' || filter_value[0] == 'field_ebr_topic_area') { $('.top_filter #'+filter_value[1]).attr('checked', 'checked'); } } } /** * Changes the text if there is already a selection made on this filter. * Apparently they don't want it to do this anymore, so it's removed for now. */ // if ($('#topic_filter').find('input:checked').length) { // $('#topic_filter .closed').text('Search more data by Topic Area'); // $('#topic_filter .closed').addClass('filtered'); // } // if ($('#data_filter').find('input:checked').length) { // $('#data_filter .closed').text('Search more data by Data Source'); // $('#data_filter .closed').addClass('filtered'); // } // also disable checkboxes with no results in the top filter var facet_topics = {}; var f_number = 0; if(params['f'] != undefined) { if (typeof(params['f']) == 'array' || typeof(params['f']) == 'object') { f_number = params['f'].length; } else { f_number = 1; } } $('.filter_contents ul.facetapi-facet-field-topic-area li.leaf a, .filter_contents ul.facetapi-facet-field-ebr-topic-area li.leaf a, .filter_contents ul.facetapi-facet-field-data-sources li.leaf a').each(function(){ var facet_url = $(this).attr('href').split('?')[1]; if (facet_url != undefined) { var facet_params = $.deparam(facet_url); if(facet_params['f'] != undefined) { var new_facet = facet_params['f'][f_number]; if (new_facet != undefined) { var topic_id = new_facet.split(':')[1]; facet_topics[topic_id] = $(this).closest('.leaf'); if ($(this).hasClass('facetapi-zero-results')) { var top_input = $('input#'+topic_id); top_input.attr('disabled', 'true'); top_input.siblings('label').addClass('disabled'); } } } } }); /** * This nonsense is to add links to the Topic Areas facet for topics areas which have no EBRs. * It is bad. * It should be removed if it isn't needed. */ var good_facet = $('#facetapi-facet-search-apiebr-index-block-field-topic-area li.leaf').first(); $("#topic_expand input[type='checkbox']").each(function(){ var fake_facet_id = $(this).attr('id'); if (facet_topics[fake_facet_id] == undefined && $(this).attr('checked') != 'checked') { $(this).attr('disabled', 'true'); $(this).siblings('label').addClass('disabled'); var topic_name = $(this).siblings('label').text(); good_facet.after("
  • "+ ""+ ""+ ""+ topic_name + " (0) Apply " + topic_name + " filter
  • "); good_facet = $("#fake-facetapi-link--" + fake_facet_id).closest('.leaf'); } else { if (facet_topics[$(this).attr('id')] != undefined) { good_facet = facet_topics[$(this).attr('id')]; } else { good_facet = good_facet.next('li.leaf'); } } }); // set the query string when the top filter is 'submitted' $('a.filter_submit').click(function(){ var nid_list = []; var filter_name = ''; var filter_id = ''; if ($(this).attr('id') === 'topic_filter_submit'){ filter_id = '#topic_filter'; if ($('body').hasClass('ebr-search')) { filter_name = 'field_ebr_topic_area'; } else { filter_name = 'field_topic_area'; } } else if ($(this).attr('id') === 'data_filter_submit'){ filter_id = '#data_filter'; filter_name = 'field_data_sources'; } $(filter_id+' input').each(function(){ if($(this).is(':checked')){ nid_list.push($(this).attr('id')); } }); var base_url = window.location.href.split('?')[0]; var new_params = {}; new_params['f'] = []; if(ci_visible) { params['ci'] = 1; } else { params['ci'] = 0; } if(se_visible) { params['se'] = 1; } else { params['se'] = 0; } params['pop'] = pop_boxes.join('-'); $.each(params, function(index, param) { if (index == 'f') { if (typeof(params['f']) == 'array' || typeof(params['f']) == 'object') { $.each(params['f'], function(f_index, f_param){ filter_value = f_param.split(':'); if(filter_value[0] != filter_name) { new_params['f'].push(f_param); } }); } else { filter_value = f_param.split(':'); if(filter_value[0] != filter_name) { new_params['f'].push(param); } } } else { new_params[index] = param; } }); $.each(nid_list, function(index, nid){ new_params['f'].push(filter_name+":"+nid); }); window.location.assign($.param.querystring(base_url, new_params)); }); // make the 'download search results' link work var export_link = $('.feed-icon a').attr('href'); $('a.export').attr('href', export_link); // 'All populations' checkbox $('input#show_all_pops').click(function(){ var pop_checkboxes = $(".customize-display-dropdown .col-3 input[type='checkbox']:not([disabled])"); if($(this).is(':checked')) { pop_checkboxes.attr('checked', 'checked'); } else { pop_checkboxes.removeAttr('checked'); } }); }; // add additional functionality to the filters on the left var objective_search_side = function(){ // modifies the number at the top of each filter based on how many checkboxes are checked within that filter. $('span.check_count').each(function(){ var check_count = $(this).closest('.panel-pane').find('input:checked').length; if (check_count > 0){ $(this).text(check_count); $(this).parent().click(); } }); // disable checkboxes which would result in an empty results set $('.filter_contents .item-list li.leaf a.facetapi-zero-results').each(function(){ $(this).siblings('input').attr('disabled', 'true'); $(this).addClass('disabled'); }); // hide the #results text from the odphp_terms filter $('#facetapi-facet-search-apinew-node-index-block-field-odphp-terms li.leaf a, #facetapi-facet-search-apiebr-index-block-field-odphp-terms li.leaf a').each(function() { orphan = $(this).children().detach(); filter_text = $(this).text().split(' '); filter_text.pop(); $(this).text(filter_text.join(' ')); $(this).append(orphan); }); // powers the 'search within topic area' boxes $('input.search_in_filter').keyup(function(){ var search_text = $(this).val().toLowerCase(); $(this).siblings('.pane-content').find('li.leaf label').each(function(){ if ($(this).text().toLowerCase().split(' ').slice(2, -2).join(' ').indexOf(search_text) > -1) { $(this).parent().show(); } else { $(this).parent().hide(); } }); }); // logic for the 'clear selection(s) buttons' $("a.clear_facet").click(function(){ var base_url = window.location.href.split('?')[0]; var facet_id = $(this).closest('.panel-pane').attr('id'); var new_params = {}; new_params['f'] = []; if(ci_visible) { params['ci'] = 1; } else { params['ci'] = 0; } if(se_visible) { params['se'] = 1; } else { params['se'] = 0; } params['pop'] = pop_boxes.join('-'); $.each(params, function(index, param){ if(index == 'f') { if (typeof(params['f']) == 'array' || typeof(params['f']) == 'object') { $.each(params['f'], function(f_index, f_param){ filter_value = f_param.split(':'); if(filter_value[0] != facet_id) { new_params['f'].push(f_param); } }); } else { filter_value = param.split(':'); if(filter_value[0] != facet_id) { new_params['f'].push(f_param); } } } else { new_params[index] = param; } }); window.location.assign($.param.querystring(base_url, new_params)); }); // special logic for the boolean filters at the bottom // check if the corresponding box is checked var real_checkbox = $('#facetapi-facet-search-apinew-node-index-block-field-is-developmental li.first .facetapi-checkbox'); if(real_checkbox.is(':checked')) { $('#developmental_checkbox').attr('checked', 'checked'); } // check if the corresponding box is disabled if (real_checkbox.is(':disabled')) { $('#developmental_checkbox').attr('disabled', 'disabled'); $('#field_is_developmental .bool_title').addClass('disabled'); } else { $('#developmental_checkbox').change(function(){ real_checkbox.click(); }); } }; var footnote_logic = function() { $('.hide_footnotes, .all_footnotes, .CI_footnote').hide(); $('.data-table').on('click', '.show_footnotes, .hide_footnotes', function(){ $(this).toggle(); $(this).siblings('.show_footnotes, .hide_footnotes, .all_footnotes').toggle(); }); }; /*! * Data table refresh dropdown code */ var refreshDropdown = { init: function() { this.dropdownButton = $('[data-hide-populations]'); this.dropdown = $('div.customize-display-dropdown'); this.checkboxes = this.dropdown.find('.col-3 input[type="checkbox"]').not(function() { return $(this).val() === 'Total'; }); this.dropdown.on('click', 'button[data-refresh-populations]', this.refreshClickEvent.bind(this)); $(document).on('backboneRenderView', this.setupGroups.bind(this)); this.dropdownButton.on('click', this.dropdownButtonClickEvent.bind(this)); }, dropdownButtonClickEvent: function(e) { e.preventDefault(); var $this = $(e.target); this.dropdown.slideToggle(125, function() { if($(this).is(':visible')) { $this.text('Hide Display Preferences ▲'); $this.toggleClass('expanded'); } else { $this.text('Set Display Preferences ▼'); $this.toggleClass('expanded'); } }); }, setupGroups: function() { this.ci = $('[data-ci]'); this.se = $('[data-se]'); this.setRowHeight.call(this); this.disableCheckboxes.call(this); }, disableCheckboxes: function() { var groups = this.groups; var checked_pops = false; var all_checked = true; if(pop_boxes.length > 0) { checked_pops = pop_boxes; } $.each(this.checkboxes, function(index) { var $this = $(this); if(!groups.filter("[data-group='" + $this.val() + "']").get().length) { $this.prop('disabled', 'disabled'); $this.prop('checked', false); $this.parents('label').addClass('disabled'); } else { $this.prop('disabled', false); // if the 'pop' param is set, only check those boxes if(checked_pops && checked_pops != '' && $.inArray(''+index, checked_pops) == -1){ all_checked = false; $this.prop('checked', false); $('ul[data-group="' + $this.val() + '"]').hide(); $('div.objective_footnote[data-popgroup-vocabulary="' + $this.val() + '"]').hide(); } else { $this.prop('checked', true); } $this.parents('label').removeClass('disabled'); } }); if(!all_checked) { $('#show_all_pops').removeAttr('checked'); } if(params['ci'] == 1) { $('#conf_interval').prop('checked', true); ci_visible = true; } if(params['se'] == 1) { $('#standard_error').prop('checked', true); se_visible = true; } $.each($('div.scrolling-data-table'), function() { var $this = $(this); // var height = $this.find('ul').eq(0).outerHeight() + $this.find('ul').eq(1).outerHeight(); var height = 112; if (params['ci'] == 1) { height += 12; } if (params['se'] == 1) { height += 12; } $this.css('height', height); $this.data('closed', true); if($this.find('ul.row:not(:hidden)').length > 2) { $this.siblings('button.view-population-data').text('View Population Data ▼').show(); } else { $this.siblings('button.view-population-data').hide(); } }); }, setRowHeight: function() { this.groups = $('ul[data-group]'); $.each(this.groups, function() { var $lis = $(this).find('li'); $lis.css('height', 'auto'); var heights = $lis.map(function() { return $(this).outerHeight(); }).get(); $lis.filter('.sticky').css('height', Math.max.apply(null, heights)); }); }, refreshClickEvent: function(e) { e.preventDefault(); var ci = $('[data-ci]'); var se = $('[data-se]'); if($('#conf_interval').prop('checked') === true) { ci_visible = true; ci.show(); $('span.CI_footnote').show(); $("#views-exposed-form-objective-faceted-search-panel-pane-1 input[name='ci']").val('1'); } else { ci_visible = false; ci.hide(); $('span.CI_footnote').hide(); $("#views-exposed-form-objective-faceted-search-panel-pane-1 input[name='ci']").val('0'); } if($('#standard_error').prop('checked') === true) { se_visible = true; se.show(); $("#views-exposed-form-objective-faceted-search-panel-pane-1 input[name='se']").val('1'); } else { se_visible = false; se.hide(); $("#views-exposed-form-objective-faceted-search-panel-pane-1 input[name='se']").val('0'); } pop_boxes = []; $.each(this.checkboxes, function(index) { var $this = $(this); var $thisVal = $this.val(); if($this.prop('checked') === false) { $('ul[data-group="' + $thisVal + '"]').hide(); $('div.objective_footnote[data-popgroup-vocabulary="' + $thisVal + '"]').hide(); } else { pop_boxes.push(index); $('ul[data-group="' + $thisVal + '"]').show(); $('div.objective_footnote[data-popgroup-vocabulary="' + $thisVal + '"]').show(); } }); if(pop_boxes.length == 0) { pop_boxes[0] = 'none'; } $("#views-exposed-form-objective-faceted-search-panel-pane-1 input[name='pop']").val(pop_boxes.join('-')); $.each($('div.scrolling-data-table'), function() { var $this = $(this); var height = $this.find('ul').eq(0).outerHeight() + $this.find('ul').eq(1).outerHeight(); $this.css('height', height); $this.data('closed', true); if($this.find('ul.row:not(:hidden)').length > 2) { $this.siblings('button.view-population-data').text('View Population Data ▼').show(); } else { $this.siblings('button.view-population-data').hide(); } }); this.setRowHeight.call(this); } }; /** * This function rearranges the pager links. * It's only necessary because theme_views_mini_pager is broken in Tao at the moment. * If that issue gets resolved, use that instead of this jquery. * See: https://www.drupal.org/node/1367208 */ var pager_fix = function() { var left_pagers = $('#view-pager .pager-first, #view-pager .pager-previous'); var pager_numbers = $('#view-pager .pager-list'); if(left_pagers.length && pager_numbers.length) { left_pagers = left_pagers.detach(); pager_numbers.before(""); $('#left_pagers').append(left_pagers); } } /** * This function adds 'missing' objectives to the objectives filter on the left of the EBR search page. * It is VERY bad. * It should be removed if it isn't necessary. */ var objective_filter_rewrite = function(){ // First, we determine which objectives are already being displayed. var real_links = {}; $('#facetapi-facet-search-apiebr-index-block-field-objectives .leaf > label').each(function(){ var objective_title = $(this).text().split(' ')[2]; real_links[objective_title] = $(this).parent(); }); // Then, we loop over the query results we generated in panels-pane--facet-pane.tpl.php. var prev_link = false; $.each(Drupal.settings.objectives_sort, function(id, title){ var addlinks = true; var class_name = id.replace(/\W+/g, '_'); var complete_title = id + ' ' + Drupal.settings.objectives[id]['field_short_description_value']; var topic_id = Drupal.settings.objectives[id]['field_topic_area_target_id']; // don't add links if there are topic areas being filtered by and this objective isn't in one of those topic areas. if ($('#topic_expand input:checked').length && !$('#topic_expand #'+topic_id+':checked').length) { addlinks = false; } if (addlinks) { if (real_links[id] != undefined) { prev_link = real_links[id]; } else { if (prev_link) { prev_link.after("
  • "+ ""+ ""+ ""+ complete_title + " (0) Apply " + title + " filter
  • "); prev_link = $("#fake-facetapi-link--" + class_name).closest('.leaf'); } else { $('#facetapi-facet-search-apiebr-index-block-field-objectives .leaf').first().before("
  • "+ ""+ ""+ ""+ complete_title + " (0) Apply " + title + " filter
  • "); prev_link = $("#fake-facetapi-link--" + class_name).closest('.leaf'); } } } }); } /** * And the same treatment for the Race & Ethnicity filter... as if it wasn't bad enough already... */ var race_filter_rewrite = function(){ var real_links = {}; $('#facetapi-facet-search-apiebr-index-block-field-ebr-race-and-ethnicity > li > label').each(function(){ var term_title = $(this).text().split(' '); term_title = term_title.splice(2, term_title.length - 4).join(' '); real_links[term_title] = $(this).parent(); }); var prev_link = false; $.each(Drupal.settings.race_taxonomy, function(index, contents){ var title = contents.name; var class_name = title.replace(/\W+/g, '_'); if (real_links[title] != undefined) { prev_link = real_links[title]; } else { if (prev_link) { prev_link.after("
  • "+ ""+ ""+ ""+ title + " (0) Apply " + title + " filter
  • "); prev_link = $("#fake-facetapi-link--" + class_name).closest('.leaf'); } else { $('#facetapi-facet-search-apiebr-index-block-field-ebr-race-and-ethnicity > li').first().before("
  • "+ ""+ ""+ ""+ title + " (0) Apply " + title + " filter
  • "); prev_link = $("#fake-facetapi-link--" + class_name).closest('.leaf'); } } }); } var chart_link_additions = function(){ $('#content').on('click', "a.chart-button", function(event){ event.preventDefault(); var chart_url = $(this).attr('href'); if (ci_visible) { chart_url += '&ci=true'; } if (se_visible) { chart_url += '&se=true'; } var year_list = $(this).closest('div.nd_table').find('.nd_header_wrap .years-list'); if(year_list.find('input:not(:checked)').length) { year_list.find('input.year-checkbox').each(function(i){ if($(this).is(':checked')){ chart_url += "&years["+i+"]="+$(this).val(); } }); } window.open(chart_url, '_blank'); }); } var rlog_icons = function() { $('.icon.term, .icon.rlog').hover(function(){ $(this).children('.tool-tip').show(); }, function() { $(this).children('.tool-tip').hide(); }); } var remember_display = function() { var add_checkbox_params = function(event) { event.preventDefault(); var target = $(event.target); var target_url = target.attr('href'); var target_url_params = {}; if(target_url.split('?')[1] != undefined) { target_url_params = $.deparam(target_url.split('?')[1]); } target_url_params['pop'] = pop_boxes.join('-'); if(ci_visible) { target_url_params['ci'] = 1; } else { target_url_params['ci'] = ''; } if(se_visible) { target_url_params['se'] = 1; } else { target_url_params['se'] = ''; } var new_target_url = $.param.querystring(target_url, target_url_params); window.location.href = new_target_url; } // step 1: the facet links on the left $('.panel-col-first').on('click', 'a.facetapi-checkbox-processed', add_checkbox_params); // make the facet checkboxes work too $('input.facetapi-checkbox').off(); $('.panel-col-first').on('click', 'input.facetapi-checkbox', function(event){ var target = $(event.target); target.siblings('a.facetapi-checkbox-processed').click(); }); $('#view-pager').on('click', 'a.active', add_checkbox_params); } var table_refresh = function(){ $(document).on('event_clear', function(e) { var viewContainer = $('div' + e.container); viewContainer.empty(); Drupal.theme.bb(e.objective, e.fips); }); $('div.views-field-nid').on('click', 'div.state_dropdown', function(event){ var target = $(event.target); var dropdown = target.parents('div.state_dropdown'); dropdown.addClass('open'); dropdown.find('.state_dropdown_inner').slideDown(); }); $('div.views-field-nid').on('mouseleave', 'div.state_dropdown', function(event){ var target = $(event.target); var dropdown = target.parents('div.state_dropdown'); dropdown.removeClass('open'); dropdown.find('.state_dropdown_inner').slideUp(); }); }; if (($('body').hasClass('objective-search') || $('body').hasClass('ebr-search')) && run_once) { objective_search_top(); objective_search_side(); footnote_logic(); refreshDropdown.init(); chart_link_additions(); rlog_icons(); pager_fix(); remember_display(); table_refresh(); run_once = false; } if ($('body').hasClass('ebr-search') && also_run_once) { // hack-y way of getting the custom 'your search for __' text at the top of the view if ($('#searched_for').length) { var filter_value = $('input.facetapi-checkbox:checked').parent() .clone() //clone the element .children() //select all the children .remove() //remove all the children .end() //again go back to selected element .text(); $('#searched_for').html("for " + filter_value + ""); $('#searched_for').show(); } if($('#facetapi-facet-search-apiebr-index-block-field-objectives').length) { objective_filter_rewrite(); } if($('#facetapi-facet-search-apiebr-index-block-field-ebr-race-and-ethnicity').length) { race_filter_rewrite(); } also_run_once = false; } }}}(jQuery, Drupal, this, this.document)); ; /** * When the country field is changed, the drupal behaviors function is called a second time. * This variable is here to prevent that from breaking everything. */ var run_once = true; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.sharing_library_story_submissions = {attach: function (context, settings) { var form_buttons = function() { var title_variations = ['step 1 of 3', 'step 2 of 3', 'step 3 of 3'] var container_ids = ['#node_sharing_library_story_submission_form_group_organization_info, #share_your_story_intro', '#node_sharing_library_story_submission_form_group_organization_work', '#node_sharing_library_story_submission_form_group_other_questions, fieldset.captcha']; var next_button_labels = ['Go to step 2 of 3', 'Go to step 3 of 3', 'Submit']; var current_page = 0; $(container_ids[1]+', '+container_ids[2]).hide(); $('#edit-actions').hide(); $('.vertical-tabs').hide(); $('#form_buttons').show(); $('#form_page').show(); $('#next_page_button').click(function(){ if (form_validate(current_page)) { $('#prev_page_button').show(); if (current_page < 2) { $(container_ids[current_page]).hide(); current_page += 1; $(container_ids[current_page]).show(); $(this).html(next_button_labels[current_page]); $('#form_page').html(title_variations[current_page]); $(window).scrollTop(0); } else if (confirm('Are you sure you want to submit your story?')) { $('#edit-workbench-moderation-state-new').val('needs_review'); $('#edit-submit').click(); } } else { alert("Oops! It looks like you didn't fill out a required field."); } }); $('#prev_page_button').click(function(){ $(container_ids[current_page]).hide(); current_page -= 1; $(container_ids[current_page]).show(); $('#next_page_button').html(next_button_labels[current_page]); $('#form_page').html(title_variations[current_page]); if (current_page < 1) { $(this).hide(); } $(window).scrollTop(0); }); // logic for 'reset form' button $('#reset_form_button').click(function(){ $(container_ids[current_page]).find('input, textarea') .removeAttr('checked') .removeAttr('selected') .not(':button, :submit, :reset, :hidden, :radio, :checkbox') .val(''); $(container_ids[current_page]).find('select').not('#edit-field-story-year-und-0-value-year').val('_none').change(); // special cases $(container_ids[current_page]).find('#edit-field-organization-address-und-0-country, #edit-field-program-address-und-0-country').val('us'); $(container_ids[current_page]).find('#edit-field-story-year-und-0-value-year').val(new Date().getFullYear()); $(container_ids[current_page]).find('#edit-field-text-demonstrate-innovati, #edit-field-text-evidence-based-, #edit-field-text-program-evaluation-, #edit-field-text-data-collected-, #edit-field-text-program-published-, #edit-field-text-program-generalizabl').hide(); $(container_ids[current_page]).find("#edit-field-accompanying-files input[value='Remove']").closest('table').remove(); }); $('#save_button').click(function(){ $('#edit-workbench-moderation-state-new').val('draft'); $('#edit-submit').click(); }); if (!($('#same_address').length)) { $('#edit-field-program-address').before("
    Check this box if your Program Address and Organization Address are the same
    "); } $('#same_address').change(function(){ if($(this).is(':checked')) { $('#edit-field-program-address-und-0-street').val($('#edit-field-organization-address-und-0-street').val()); $('#edit-field-program-address-und-0-additional').val($('#edit-field-organization-address-und-0-additional').val()); $('#edit-field-program-address-und-0-city').val($('#edit-field-organization-address-und-0-city').val()); $('#edit-field-program-address-und-0-province').val($('#edit-field-organization-address-und-0-province').val()); $('#edit-field-program-address-und-0-postal-code').val($('#edit-field-organization-address-und-0-postal-code').val()); $('#edit-field-program-address-und-0-country').val($('#edit-field-organization-address-und-0-country').val()); $('#edit-field-program-phone-und-0-value').val($('#edit-field-phone-und-0-value').val()); $('#edit-field-program-website-und-0-value').val($('#edit-field-user-organization-website-und-0-value').val()); } else { $('#edit-field-program-address-und-0-street').val(''); $('#edit-field-program-address-und-0-additional').val(''); $('#edit-field-program-address-und-0-city').val(''); $('#edit-field-program-address-und-0-province').val(''); $('#edit-field-program-address-und-0-postal-code').val(''); $('#edit-field-program-address-und-0-country').val('us'); $('#edit-field-program-phone-und-0-value').val(''); $('#edit-field-program-website-und-0-value').val(''); } }); /** * These three listeners change the label and content of the objective dropdowns on page 2 based on whatt topic area is selected. * The data being used here is coming from panels-pane--block--formblock-sharing-library-story-submission.tpl.php */ $('#edit-field-topic-area-1-und').change(function(){ if($(this).val() !== '_none') { $('#edit-field-objectives-for-topic-1-1 label').html($(this).children('option:selected').text()); var selectable = Drupal.settings.Topics[$(this).val()]; var select_lists = $('#edit-field-objectives-for-topic-1-1-und, #edit-field-objectives-for-topic-1-2-und, #edit-field-objectives-for-topic-1-3-und'); select_lists.each(function(){ var this_list = $(this); this_list.empty(); this_list.append(""); for (var i = 0; i < selectable['ids'].length; i++) { this_list.append(""); }; }); } }); $('#edit-field-topic-area-2-und').change(function(){ if($(this).val() !== '_none') { $('#edit-field-objectives-for-topic-2-1 label').html($(this).children('option:selected').text()); var selectable = Drupal.settings.Topics[$(this).val()]; var select_lists = $('#edit-field-objectives-for-topic-2-1-und, #edit-field-objectives-for-topic-2-2-und, #edit-field-objectives-for-topic-2-3-und'); select_lists.each(function(){ var this_list = $(this); this_list.empty(); this_list.append(""); for (var i = 0; i < selectable['ids'].length; i++) { this_list.append(""); }; }); } }); $('#edit-field-topic-area-3-und').change(function(){ if($(this).val() !== '_none') { $('#edit-field-objectives-for-topic-3-1 label').html($(this).children('option:selected').text()); var selectable = Drupal.settings.Topics[$(this).val()]; var select_lists = $('#edit-field-objectives-for-topic-3-1-und, #edit-field-objectives-for-topic-3-2-und, #edit-field-objectives-for-topic-3-3-und'); select_lists.each(function(){ var this_list = $(this); this_list.empty(); this_list.append(""); for (var i = 0; i < selectable['ids'].length; i++) { this_list.append(""); }; }); } }); } /** * This function checks to see whether or not it's okay to go to the next page of the form. * Specifically, it's looking for required fields which don't have a value entered into them. */ var form_validate = function(page){ var pages = ['node_sharing_library_story_submission_form_group_organization_info', 'node_sharing_library_story_submission_form_group_organization_work', 'node_sharing_library_story_submission_form_group_other_questions']; var optional = ['edit-field-organization-address-und-0-additional', 'edit-field-user-organization-website-und-0-value', 'edit-field-program-address-und-0-additional', 'edit-field-program-website-und-0-value', 'edit-field-implemented-zip-codes-und-0-value', 'edit-field-topic-area-2-und', 'edit-field-topic-area-3-und', 'edit-field-objectives-for-topic-1-1-und', 'edit-field-objectives-for-topic-1-2-und', 'edit-field-objectives-for-topic-1-3-und', 'edit-field-objectives-for-topic-2-1-und', 'edit-field-objectives-for-topic-2-2-und', 'edit-field-objectives-for-topic-2-3-und', 'edit-field-objectives-for-topic-3-1-und', 'edit-field-objectives-for-topic-3-2-und', 'edit-field-objectives-for-topic-3-3-und', 'edit-field-please-enter-associated-yo-und-0-value', 'edit-field-please-enter-associated-we-und-0-value', 'edit-field-please-enter-second-associ-und-0-value']; var valid = true; // Loop over all the inputs and text areas on the current page. $('#'+pages[page]+' input, #'+pages[page]+' textarea').each(function(){ if ($(this).attr('type') === 'hidden') { // skip 'hidden' elements entirely } else { // pass if it has a value, is in the optional array, is not visible, or is a file upload field. if ($(this).val() || ($.inArray($(this).attr('id'), optional) > -1) || !$(this).is(':visible') || $(this).attr('type') == 'file') { $(this).css('border', '1px solid #ccc') } else { $(this).css('border', '1px solid #F00'); valid = false; } } }); // Loop over all the select lists on the current page; $('#'+pages[page]+' select').each(function(){ // pass if it has a value other than '_none' or is in the optional array. if (($(this).val() && ($(this).val() !== '_none')) || ($.inArray($(this).attr('id'), optional) > -1)) { $(this).css('border', '1px solid #ccc') } else { $(this).css('border', '1px solid #F00'); valid = false; } }); // Loop over all the radio buttons on the current page $('#'+pages[page]+' .form-radios').each(function(){ // pass if at least one of the radios is checked. if($(this).find('input:checked').length) { $(this).css('border', 'none'); } else { $(this).css('border', '1px solid #F00'); valid = false; } }); return valid; } // this function solely exists to modify the color of certain chunks of text var color_changes = function(){ $('#node_sharing_library_story_submission_form_group_organization_info > h2').html("Tell us about your Organization*"); $('#node_sharing_library_story_submission_form_group_program_info > h2').html("Tell us about your Program*"); var markup_1 = $('#node_sharing_library_story_submission_form_group_organization_work > h2').html(); $('#node_sharing_library_story_submission_form_group_organization_work > h2').html(markup_1.slice(6, 77)+""+markup_1.slice(77)); var markup_2 = $('#node_sharing_library_story_submission_form_group_other_questions > h2').html(); $('#node_sharing_library_story_submission_form_group_other_questions > h2').html(markup_2.slice(6, 34)+""+markup_2.slice(34, -74)+""+markup_2.slice(-74, -7)) } if (run_once && ($('body').hasClass('share_your_story') || $('body').hasClass('node-type-sharing-library-story-submission'))) { color_changes(); form_buttons(); run_once = false; } }}}(jQuery, Drupal, this, this.document)); ; /** * When the country field is changed, the drupal behaviors function is called a second time. * This variable is here to prevent that from breaking everything. */ var run_once = true; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.consortium_submission_form = {attach: function (context, settings) { // this function solely exists to modify the color of certain chunks of text var color_changes = function(){ $('#node_consortium_organization_submissi_form_group_organization_info > h2').html("Tell us about your Organization*"); $('#node_consortium_organization_submissi_form_group_contact_info > h2').html("Tell us about who we should contact*"); } // add a reset button to this form var reset_button = function(){ $('#edit-actions').prepend("
    "); $('#reset_form_button').click(function(){ $('#consortium-organization-submissi-node-form').find('input, textarea') .removeAttr('checked') .removeAttr('selected') .not(':button, :submit, :reset, :hidden, :radio, :checkbox') .val(''); // special cases $('#consortium-organization-submissi-node-form').find('#edit-field-organization-type-und, #edit-field-organization-topic-area-und, #edit-field-organization-topic-area-2-und, #edit-field-organization-topic-area-3-und').val('_none'); $('#consortium-organization-submissi-node-form').find('#edit-field-organization-address-und-0-country').val('us').change(); }); } var topic_dropdowns = function() { $('#edit-field-organization-topic-area-2-und, #edit-field-organization-topic-area-3-und').attr('disabled', 'disabled'); $('#edit-field-organization-topic-area-und').change(function(){ if($(this).val() == '_none'){ $('#edit-field-organization-topic-area-2-und').val('_none').attr('disabled', 'disabled').change(); } else { $('#edit-field-organization-topic-area-2-und').removeAttr('disabled'); } }); $('#edit-field-organization-topic-area-2-und').change(function(){ if($(this).val() == '_none'){ $('#edit-field-organization-topic-area-3-und').val('_none').attr('disabled', 'disabled').change(); } else { $('#edit-field-organization-topic-area-3-und').removeAttr('disabled'); } }); } if (run_once && ($('body').hasClass('cons_org_sub'))) { color_changes(); reset_button(); topic_dropdowns(); run_once = false; } }}}(jQuery, Drupal, this, this.document)); ; (function ($, Drupal, window, document, undefined) { Drupal.behaviors.events = { attach: function (context, settings) { if($('body').hasClass('page-node-5816')) { $(".bef-group-heading").first().text('Topic Areas'); $(".bef-group-heading").last().text('LHI Topic Areas'); $(".expand_button").click(function() { if ($(this).hasClass('open')){ $(this).removeClass('open'); } else{ $(this).addClass('open'); } var date_class = $(this).attr('id').split('_').join('-'); $("."+date_class).toggle(); }); var all_open = false; $('.expand_all').click(function(){ if(all_open) { $('#expand_all_button').removeClass('open'); $('.expand_button').removeClass('open'); $('.views-row').hide(); $('.expand_all_label').text('Expand All'); all_open = false; } else { $('#expand_all_button').addClass('open'); $('.expand_button').addClass('open'); $('.views-row').show(); $('.expand_all_label').text('Collapse All'); all_open = true; } }); $('fieldset.bef-select-as-checkboxes-fieldset').addClass('collapsed'); $('fieldset.bef-select-as-checkboxes-fieldset').mouseleave(function(){ var this_filter = $(this); this_filter.find('.fieldset-content').slideUp(400, function(){ this_filter.addClass('collapsed'); }); }); $('.views-row').hide(); // disable checkboxes based on the array built in views-exposed-form--events.tpl.php $('#edit-field-learn-about-target-id-wrapper .form-type-bef-checkbox input').each(function(){ if($.inArray($(this).val(), Drupal.settings.Topics) == -1) { $(this).attr('disabled', 'disabled'); $(this).parent().addClass('disabled'); } }); } } }; }(jQuery, Drupal, this, this.document)); ; (function($, window, document, undefined, _) { var outboundLinks = { init: function() { /*! * Get all links that are outbound and not .gov or .mil sites (unless they have the outbound class) */ this.links = $('a[href^="http"]').not($('a[href*=".gov"], a[href*=".mil"], a[href*="commonmediainc.com"], a[href*="hp-dev.communicatehealth.com"], a[href*="hp-pre-prod.communicatehealth.com"], a[href*="198.102.218.58"]').not('.outbound')); /*! * Bind a click to those links */ if(this.links.length) { this.appendOutboundIcon(); this.links.addClass('offsite'); this.links.on('click', this.outboundLinkClick.bind(this)); } }, template: [ '
    ', '', '', '
    ' ], /*! * append outbound link icon */ appendOutboundIcon: function() { this.links.each(function() { var $this = $(this); /*! * append icon if there isnt already an image inside the link * * */ if($this[0].innerHTML.indexOf('
    ') .parent() .append('External Web Site Policy'); } }); }, outboundLinkClick: function(e) { e.preventDefault(); var data = { href: e.delegateTarget.href }; /*! * Add title attribute of it exists */ if(e.delegateTarget.attributes.title) { data['title'] = e.delegateTarget.attributes.title.value; } else { data['title'] = ''; } var compiledTemplate = _.template(this.template.join(''), data); $('body').append(compiledTemplate); var timer = setTimeout(function() { window.open(data.href); }, 6000); $('[data-stop]').on('click', function(e) { e.preventDefault(); window.clearTimeout(timer); $(this).parents('[data-popup]').remove(); }); } }; $(document).ready(function() { outboundLinks.init(); }); })(jQuery, window, document, undefined, _); ; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.user_register = {attach: function (context, settings) { var user_register = function() { var org_fields = $('#edit-field-organization-type, #edit-field-organization-address, #edit-field-user-organization-e-mail, #edit-field-user-organization-website'); org_fields.hide(); $('#edit-field-user-organization-name-und-0-value').keyup(function(){ // console.log($(this).val()); if ($(this).val() != '') { org_fields.show(); } else { org_fields.hide(); } }); } if ($('body').hasClass('page-user-register')) { user_register(); } }}}(jQuery, Drupal, this, this.document)); ; (function ($, Drupal, window, document, undefined) { Drupal.behaviors.e_learning = {attach: function (context, settings) { var toggle_chapter = function () { $('.swf_link a').click(function(){ var id = $(this).attr('class'); $('.swf_nav_menu li').removeClass('active'); $(this).parents('li').addClass('active'); $('.elearning-swf').hide(); $('#'+id).show(); }); } var getUrlParameter = function (sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } if ($('body').hasClass('node-type-e-learning-module')) { toggle_chapter(); var chapter = getUrlParameter('chapter'); if (chapter) { $('.swf_nav_menu li').removeClass('active'); $('a.'+chapter).parents('li').addClass('active'); $('.elearning-swf').hide(); $('#' + chapter).show(); } } }} }(jQuery, Drupal, this, this.document)); ; /*! * !! * THIS IS REUSABLE * !! */ function init_interactive_populations() { /*! * Get the Charts */ var interactiveCharts = jQuery('div.interactive_population'); /*! * Charts are open by default */ interactiveCharts.data('isOpen', false); /*! * Store their heights in $.data */ interactiveCharts.each(function(index, val) { var $this = jQuery(this); $this.data('closedHeight', $this.outerHeight()); /*! * since we're not on HTML5 and don't have access to data-attributes * we did something kind of weird and store it as the ID.. * ie. follow this format on container div -> id="small_height_[x]" */ $this.data('openHeight', $this.attr('id').split('_')[2]); }); /*! * bind events to chart triggers */ interactiveCharts.find('div#IVP_29_trigger input').on('click', function(e) { e.preventDefault(); var $this = jQuery(this).closest('.interactive_population'); /*! * toggle open and closed */ if ($this.data('isOpen') === true) { $this.data('isOpen', false); $this.stop().animate({ height: $this.data('closedHeight') + 'px' }, 600); $this.find('#chart_open_button').css('display', 'inline'); $this.find('#chart_close_button').css('display', 'none'); } else if ($this.data('isOpen') === false) { $this.data('isOpen', true); $this.stop().animate({ height: $this.data('openHeight') + 'px' }, 600); $this.find('#chart_open_button').css('display', 'none'); $this.find('#chart_close_button').css('display', 'inline'); } }); }; (function($, document, window, undefined) { $(document).ready(function() { if($('body').hasClass('front')) { $('#node-6849, #node-6850, #node-6846, #node-6847, #node-6848 .light_border_top').css({ cursor: 'pointer' }).on('click', function(e) { e.preventDefault(); var href = $(this).find('a').first().attr('href'); if(href && href !== '#') { window.location.assign(href); } }); $('#views_slideshow_cycle_teaser_section_home_page_slideshow-panel_pane_1 a').addClass("homepageSliderLink"); $('div#node-6848 a').addClass("homepageToolsOnHP"); $('div#node-6848 a strong').addClass("homepageToolsOnHP"); $('div.homepage-event-box a').addClass("homepageEventBox"); $('div.homepage-event-box a span').addClass("homepageEventBox"); $('div.views-field-field-registration-link a').addClass("homepageEventBox"); } }); })(jQuery, document, window, undefined);; /** * For now, I'm using this file to add a label to captcha forms. * It's likely possible to do this using the re-captcha API, but the drupal module is handling that * and it's documentation is very unhelpful regarding customization. */ (function ($, Drupal, window, document, undefined) { Drupal.behaviors.captcha_changes = {attach: function (context, settings) { if($('#edit-captcha-form').length) { // make sure this fires after the captcha has fully loaded. $(window).load(function(){ $('#recaptcha_response_field').before(""); }); } }} }(jQuery, Drupal, this, this.document)); ; /** * When the country field is changed, the drupal behaviors function is called a second time. * This variable is here to prevent that from breaking everything. */ var run_once = true; (function ($, Drupal, window, document, undefined) {Drupal.behaviors.ebr_submission_form = {attach: function (context, settings) { // add a reset button to this form var reset_button = function(){ $('#edit-actions').prepend("
    "); $('#reset_form_button').click(function(){ $('#evidence-based-resource-node-form').find('input, textarea') .removeAttr('checked') .removeAttr('selected') .not(':button, :submit, :reset, :hidden, :radio, :checkbox') .val(''); }); } if (run_once && ($('body').hasClass('ebr_submission'))) { reset_button(); run_once = false; } }}}(jQuery, Drupal, this, this.document)); ; (function($){"use strict";$.fn.extend({counter:function(options){var defaults={type:"char",count:"down",goal:140,text:true,target:false,append:true,translation:"",msg:"",container_class:""};var $countObj="",countIndex="",noLimit=false,options=$.extend({},defaults,options);var methods={init:function($obj){var objID=$obj.attr("id"),counterID=objID+"_count";methods.isLimitless();$countObj=$("");var counterDiv=$("
    ").attr("id",objID+"_counter").append($countObj).append(" "+methods.setMsg());if(options.container_class&&options.container_class.length){counterDiv.addClass(options.container_class)}if(!options.target||!$(options.target).length){options.append?counterDiv.insertAfter($obj):counterDiv.insertBefore($obj)}else{options.append?$(options.target).append(counterDiv):$(options.target).prepend(counterDiv)}methods.bind($obj)},bind:function($obj){$obj.bind("keypress.counter keydown.counter keyup.counter blur.counter focus.counter change.counter paste.counter",methods.updateCounter);$obj.bind("keydown.counter",methods.doStopTyping);$obj.trigger("keydown")},isLimitless:function(){if(options.goal==="sky"){options.count="up";noLimit=true;return noLimit}},setMsg:function(){if(options.msg!==""){return options.msg}if(options.text===false){return""}if(noLimit){if(options.msg!==""){return options.msg}else{return""}}this.text=options.translation||"character word left max";this.text=this.text.split(" ");this.chars="s ( )".split(" ");this.msg=null;switch(options.type){case"char":if(options.count===defaults.count&&options.text){this.msg=this.text[0]+this.chars[1]+this.chars[0]+this.chars[2]+" "+this.text[2]}else if(options.count==="up"&&options.text){this.msg=this.text[0]+this.chars[0]+" "+this.chars[1]+options.goal+" "+this.text[3]+this.chars[2]}break;case"word":if(options.count===defaults.count&&options.text){this.msg=this.text[1]+this.chars[1]+this.chars[0]+this.chars[2]+" "+this.text[2]}else if(options.count==="up"&&options.text){this.msg=this.text[1]+this.chars[1]+this.chars[0]+this.chars[2]+" "+this.chars[1]+options.goal+" "+this.text[3]+this.chars[2]}break;default:}return this.msg},getWords:function(val){if(val!==""){return $.trim(val).replace(/\s+/g," ").split(" ").length}else{return 0}},updateCounter:function(e){var $this=$(this);if(countIndex<0||countIndex>options.goal){methods.passedGoal($this)}if(options.type===defaults.type){if(options.count===defaults.count){countIndex=options.goal-$this.val().length;if(countIndex<=0){$countObj.text("0")}else{$countObj.text(countIndex)}}else if(options.count==="up"){countIndex=$this.val().length;$countObj.text(countIndex)}}else if(options.type==="word"){if(options.count===defaults.count){countIndex=methods.getWords($this.val());if(countIndex<=options.goal){countIndex=options.goal-countIndex;$countObj.text(countIndex)}else{$countObj.text("0")}}else if(options.count==="up"){countIndex=methods.getWords($this.val());$countObj.text(countIndex)}}return},doStopTyping:function(e){var keys=[46,8,9,35,36,37,38,39,40,32];if(methods.isGoalReached(e)){if(e.keyCode!==keys[0]&&e.keyCode!==keys[1]&&e.keyCode!==keys[2]&&e.keyCode!==keys[3]&&e.keyCode!==keys[4]&&e.keyCode!==keys[5]&&e.keyCode!==keys[6]&&e.keyCode!==keys[7]&&e.keyCode!==keys[8]){if(options.type===defaults.type){return false}else if(e.keyCode!==keys[9]&&e.keyCode!==keys[1]&&options.type!=defaults.type){return true}else{return false}}}},isGoalReached:function(e,_goal){if(noLimit){return false}if(options.count===defaults.count){_goal=0;return countIndex<=_goal?true:false}else{_goal=options.goal;return countIndex>=_goal?true:false}},wordStrip:function(numOfWords,text){var wordCount=text.replace(/\s+/g," ").split(" ").length;text=$.trim(text);if(numOfWords<=0||numOfWords===wordCount){return text}else{text=$.trim(text).split(" ");text.splice(numOfWords,wordCount,"");return $.trim(text.join(" "))}},passedGoal:function($obj){var userInput=$obj.val();if(options.type==="word"){$obj.val(methods.wordStrip(options.goal,userInput))}if(options.type==="char"){$obj.val(userInput.substring(0,options.goal))}if(options.type==="down"){$countObj.val("0")}if(options.type==="up"){$countObj.val(options.goal)}}};return this.each(function(){methods.init($(this))})}})})(jQuery);;