feroxy
Forum Replies Created
-
Forum: Plugins
In reply to: [Enhanced Media Library] White box issueHi
Is there any update on this as I am also experiencing this issue while having the responsive lightbox plugin installed.
Just to chime in that I am having an issue recently too. My icegram campaigns are no longer working and I have made no changes on my end to settings other than an update to plugins (which happens automatically on my host)
Also was working fine for a long time until now. Creating new campaign does nothing – still doesn’t show up.
you need to keep that bit but change expiretime to:
var expiretime = ''
to make it a session cookie
it might be possible to do that with a customised action bar (not the air theme though). My very quick stab at this is below, although it’s not a very tidy implementation. If the close cookie is set, then subsequent page loads will show the icegram but immediately hide it which in the action bar case will still show the tab.
There’s probably a better way to do this, but its something to start from maybe…
var icegram_messageid = 'nnnn'; //enter the correct messageid here function helperf_readCookie(a, b) { b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; } jQuery( window ).on( "track.icegram", function( e ,type, params ) { if(type !== undefined && type !== '' && type == 'closed' ){ var expiretime = new Date(new Date().getTime() + 15 * 60 * 1000).toUTCString();//stay closed for 15 mins document.cookie = "icegram_message_"+icegram_messageid+"_userclosed=1; expires="+expiretime+";path=/"; } else if(type !== undefined && type !== '' && type == 'shown' ){ document.cookie = "icegram_message_"+icegram_messageid+"_userclosed=0;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/"; } }); //if cookie is set, enable then immediately hide the icegram if ('1' === helperf_readCookie("icegram_message_"+icegram_messageid+"_userclosed")) { icegram.get_message_by_id(icegram_messageid).show(); icegram.get_message_by_id(icegram_messageid).hide(); } else //no cookie set, just show icegram message normally { icegram.get_message_by_id(icegram_messageid).show(); }
Make sure you have that first line set to the correct id number. Look in the URL when editing the icegram for postid number and add 1
var icegram_messageid = 'nnnn'
I didn’t bother installing the JQuery cookie plugin which would probably make this look a little more elegant but here’s my code which uses a helper function for cookie reading…
var icegram_messageid = 'nnnn'; //icegram postid+1 function helperf_readCookie(a, b) { b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); return b ? b.pop() : ''; } jQuery( window ).on( "track.icegram", function( e ,type, params ) { if(type !== undefined && type !== '' && type == 'closed' ){ var expiretime = new Date(new Date().getTime() + 15 * 60 * 1000).toUTCString();//stay closed for 15 mins document.cookie = "icegram_message_"+icegram_messageid+"_userclosed=1; expires="+expiretime+";path=/"; } }); //if visitor has not closed me recently, show icegram if ('1' != helperf_readCookie("icegram_message_"+icegram_messageid+"_userclosed")) { icegram.get_message_by_id(icegram_messageid).show(); }
got it working thanks!
on a related note. Is there any way to programmatically determine the current icegram message id for the JS code? (similar to using #ig_this_message in the css)