// Only do anything if jQuery isn't defined
var publicateCss = 'publicateCss';
if (!document.getElementById(publicateCss)){
var cb = function() {
var l = document.createElement('link'); l.rel = 'stylesheet';
l.href = 'https://publicate.it/css/embedded.css';
var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h);
};
var raf = requestAnimationFrame || mozRequestAnimationFrame || webkitRequestAnimationFrame || msRequestAnimationFrame;
if (raf) raf(cb);
else window.addEventListener('load', cb);
}
if (typeof jQuery == 'undefined') {
if (typeof $ == 'function') {
// warning, global var
var thisPageUsingOtherJSLibrary41283 = true;
}
function getScript41283(url, success) {
var script = document.createElement('script');
script.src = url;
var head = document.getElementsByTagName('head')[0],
done = false;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function() {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done = true;
// callback function provided as param
success();
script.onload = script.onreadystatechange = null;
head.removeChild(script);
};
};
head.appendChild(script);
};
getScript41283('https:https://publicate.it/js/jquery.min.js', function() {
if (typeof jQuery=='undefined') {
// Super failsafe - still somehow failed...
} else {
// jQuery loaded! Make sure to use .noConflict just in case
init41283();
// jQuery reliant code for the lead capture
jQuery('body').on('click', '.publicate_lead_capture a', function(e){
if(!publicate_getCookie('publicate_lead_capture_name_'+lc_id)){
pub_block_clicked = jQuery(e.target).closest('a');
e.preventDefault();
jQuery('.publicate_lead_capture_overlay').fadeIn();
}
});
jQuery('body').on('click', '.publicate_lead_capture_overlay', function(e){
jQuery('.publicate_lead_capture_overlay').fadeOut();
});
jQuery('body').on('click', '.publicate_lead_capture_inner', function(e){
e.stopPropagation();
});
jQuery('body').on('click', '.publicate_lead_capture_inner button', function(e){
var name = jQuery(".publicate_lead_capture_inner input[name=name]").val();
var email = jQuery(".publicate_lead_capture_inner input[name=email]").val();
var error = false;
if(!publicate_validateEmail(email)){
error = 1;
alert('invalid email');
}
if(!error){
publicate_setCookie('publicate_lead_capture_name_'+lc_id,encodeURIComponent(name),30);
publicate_setCookie('publicate_lead_capture_email_'+lc_id,encodeURIComponent(email),30);
publicate_set_urls();
jQuery('.publicate_lead_capture_overlay').fadeOut();
window.open($(pub_block_clicked).attr('href'),'_blank');
}
});
var pub_block_clicked;
// ----------------------
if (thisPageUsingOtherJSLibrary41283) {
// Run your jQuery Code
get_publicate_data41283();
} else {
// Use .noConflict(), then run your jQuery Code
}
}
});
} else { // jQuery was already loaded
init41283();
// jQuery reliant code for the lead capture
jQuery('body').on('click', '.publicate_lead_capture a', function(e){
if(!publicate_getCookie('publicate_lead_capture_name_'+lc_id)){
pub_block_clicked = jQuery(e.target).closest('a');
e.preventDefault();
jQuery('.publicate_lead_capture_overlay').fadeIn();
}
});
jQuery('body').on('click', '.publicate_lead_capture_overlay', function(e){
jQuery('.publicate_lead_capture_overlay').fadeOut();
});
jQuery('body').on('click', '.publicate_lead_capture_inner', function(e){
e.stopPropagation();
});
jQuery('body').on('click', '.publicate_lead_capture_inner button', function(e){
var name = jQuery(".publicate_lead_capture_inner input[name=name]").val();
var email = jQuery(".publicate_lead_capture_inner input[name=email]").val();
var error = false;
if(!publicate_validateEmail(email)){
error = 1;
alert('invalid email');
}
if(!error){
publicate_setCookie('publicate_lead_capture_name_'+lc_id,encodeURIComponent(name),30);
publicate_setCookie('publicate_lead_capture_email_'+lc_id,encodeURIComponent(email),30);
publicate_set_urls();
jQuery('.publicate_lead_capture_overlay').fadeOut();
}
});
var pub_block_clicked;
// ----------------------
};
function init41283(){
jQuery( document ).ready(function() {
receive_from_logged_in();
});
get_publicate_data41283();
//jQuery('.pub_title_container').css({height:140});
if(!jQuery.isFunction('fitText2')){
}
}
function fit_text41283(){
if(!jQuery.isFunction('fitText2')){
jQuery.fn.fitText2 = function( kompressor, options ) {
return this.each(function(){
// Store the object
var jQuerythis = jQuery(this);
// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
var maxHeight = jQuerythis.parent().outerHeight();
var maxWidth = jQuerythis.parent().width();
var fontSize = 100;
jQuerythis.css({lineHeight: 'normal', display:'inline-block', padding: 10});
//console.log("mw:"+maxWidth+" mh:"+maxHeight+" for:"+jQuerythis.attr('class'));
do {
//jQuerythis.wrap(calculator);
jQuerythis.css('font-size', fontSize);
textHeight = jQuerythis.outerHeight();
textWidth = jQuerythis.outerWidth();
fontSize = fontSize - 1;
} while ((textHeight > maxHeight || textWidth > maxWidth) && fontSize > 3);
var margin_t = ((jQuerythis.parent().outerHeight()-jQuerythis.outerHeight())/2);
jQuerythis.css('display','block');
jQuerythis.css('marginTop', margin_t);
};
// Call once to set.
resizer();
// Call on resize. Opera debounces their resize by default.
jQuery(window).on('resize.fittext orientationchange.fittext', resizer);
});
}
}
jQuery("#publicate_embed_41283").find(".title_text").fitText2();
}
function get_publicate_data41283(){
jQuery("#publicate_embed_41283").hide();
jQuery.ajax({
cache: false,
crossDomain: true,
url: "https://publicate.it/AJAX/publications/fetch_embed.php?share_pub_id=41283&url="+document.URL,
dataType: 'jsonp',
success: function(data) {
jQuery("#publicate_embed_41283").html(data.html);
fit_text41283();
publicate_set_urls();
},
complete: function(){
jQuery("#publicate_embed_41283").fadeIn(100);
}
});
}
function publicate_setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
}
function publicate_getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i