/* ProposalSpace Publishing Module
Version History
2.0.0 20 Nov 2019 Initial version
2.0.1 03 Jun 2020 Add download SVG */
function ProposalSpacePub(element){
var $el=jQuery('#'+element);
this.isNumeric=function(n){
return (!isNaN(parseFloat(n)) && isFinite(n));
};
if(!$el.length){
console.warn('Could not locate div on page with ID "'+element+'".');
return;
}
if(window.ProposalSpaceContentLoaded) return true;
window.ProposalSpaceContentLoaded=true;
var div=document.createElement('div');
div.innerHTML='';
document.body.insertBefore(div, document.body.childNodes[0]);
var psdomain='https://proposalspace.com';
var pscsslink='';
var psfalink='';
var cssLinks=jQuery('head').find('link[rel=stylesheet]');
if(cssLinks.length){
cssLinks.first().before(psfalink);
cssLinks.first().before(pscsslink);
}else{
jQuery('head').prepend(psfalink);
jQuery('head').prepend(pscsslink);
}
$el.html('
Loading...
');
var eldata=$el.data();
var params={'ps-v': ''};
jQuery.each(Object.keys(eldata),function(k,v){
if(v.substr(0,2)=='ps') params['ps-'+v.substr(2).toLowerCase()]=eldata[v].toString();
});
var gv=(RegExp('ps-v=(.+?)(&|$)').exec(location.search)||[,null])[1];
if(gv !== null) params['ps-v']=gv;
if(!params['ps-v'].length){
console.warn('No value passed for the ps-v GET variable.');
return;
}
var callId='0';
var sessId='0';
var psva=params['ps-v'].toString().split('-');
if(psva.length>0){
if(this.isNumeric(psva[0])){
callId=psva[0];
}else{
console.warn('A Call ID could not be parsed from "'+psva[0]+'".');
return;
}
if(psva.length>1){
if(this.isNumeric(psva[1])){
sessId=psva[1];
}else{
console.warn('A Session ID could not be parsed from "'+psva[1]+'".');
return;
}
}
}else{
console.warn('The value for the ps-v GET variable ("'+params['ps-v']+'") is not valid.');
return;
}
var dataHash={};
dataHash['ps-x']='1';
dataHash['ps-f']=location.pathname;
dataHash['ps-sf']={};
jQuery.each(params,function(k,v){
dataHash[k]=v;
});
var gstring=decodeURIComponent(location.search.replace(/\+/g,'%20')).split('?');
if(gstring.length == 2){
var gstringArray=gstring[1].split('&');
jQuery.each(gstringArray,function(i,v){
var vArray=v.split('=');
if(vArray[1].trim().length) dataHash[vArray[0]]=vArray[1];
});
}
if((/*@cc_on!@*/false) && window.XDomainRequest){
$el.html('Sorry, but your web browser is not supported. Please update your browser to access the schedule.');
}else{
jQuery.ajaxSetup({
'beforeSend': function(xhr){
xhr.setRequestHeader('Accept','text/html;q=0.5,text/javascript');
}
});
jQuery.ajax({
complete: function(r){
$el.html(r.responseText);
setTimeout(function(){
jQuery('.ps-addtocal-link').on('click', function(e){
e.preventDefault();
jQuery(this).next('ul').toggle();
});
jQuery('.pubmod .sessionholder .datetimeholder > ul > li > a').on('click', function(e){
jQuery(this).closest('ul').hide();
});
}, 500);
},
data: dataHash,
url: (psdomain+'/p/'+((parseInt(sessId,10)>0)?(sessId+'/s'):(callId+'/c')))
});
}
}
window.onload=function(){
if(window.jQuery){
ProposalSpacePub('proposalspace_content');
}else{
var jqTag=document.createElement('script');
jqTag.type='text/javascript';
jqTag.src='https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js';
jqTag.onload="ProposalSpacePub('proposalspace_content');";
document.getElementsByTagName('head')[0].appendChild(jqTag);
}
};