Skip to content

Instantly share code, notes, and snippets.

@fordnox
Created June 29, 2014 11:09
Show Gist options
  • Save fordnox/a6a27adb523e1690befd to your computer and use it in GitHub Desktop.
Save fordnox/a6a27adb523e1690befd to your computer and use it in GitHub Desktop.
One time popup jQuery with facebook like page
$(document).ready(function() {
function rC(nam) {var tC = document.cookie.split('; '); for (var i = tC.length - 1; i >= 0; i--) {var x = tC[i].split('='); if (nam == x[0]) return unescape(x[1]);} return '~';}
function wC(nam,val) {document.cookie = nam + '=' + escape(val);}
function lC(nam,pg) {var val = rC(nam); if (val.indexOf('~'+pg+'~') != -1) return false; val += pg + '~'; wC(nam,val); return true;}
function firstTime(cN) {return lC('meskuciobatonelis',cN);}
function thisPage() {var page = location.href.substring(location.href.lastIndexOf('\/')+1); pos = page.indexOf('.');if (pos > -1) {page = page.substr(0,pos);} return page;}
if (firstTime(thisPage())) {
$('<div>')
.html('<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fmeskutis.lt&amp;width&amp;height=290&amp;colorscheme=light&amp;show_faces=true&amp;header=true&amp;stream=false&amp;show_border=true&amp;appId=153413347342" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:290px;" allowTransparency="true"></iframe>')
.dialog({
modal: true,
minWidth: 330,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment