(function() { var css = ""; document.write(css); // Localize jQuery variable var jQuery; /******** Load jQuery if not present *********/ if (window.jQuery === undefined) { var script_tag = document.createElement('script'); script_tag.setAttribute("type","text/javascript"); script_tag.setAttribute("src", "http://code.jquery.com/jquery-1.7.1.min.js"); if (script_tag.readyState) { script_tag.onreadystatechange = function () { // For old versions of IE if (this.readyState == 'complete' || this.readyState == 'loaded') { scriptLoadHandler(); } }; } else { // Other browsers script_tag.onload = scriptLoadHandler; } // Try to find the head, otherwise default to the documentElement (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag); } else { // The jQuery version on the window is the one we want to use jQuery = window.jQuery; main(); } /******** Called once jQuery has loaded ******/ function scriptLoadHandler() { // Restore $ and window.jQuery to their previous values and store the // new jQuery in our local jQuery variable jQuery = window.jQuery.noConflict(true); // Call our main function main(); } function popup(url) { } function followgrambutton (data) { var flag=0; var userid=data.userid; var button=$('a.btnfollowgram[rel='+userid+']'); if (data.logged!=0){ if (data.data.outgoing_status=='follows'){ button.addClass('active'); button.attr('action','unfollow'); button.html('Unfollow @'+username); flag=1; } if (data.data.outgoing_status=='none'){ button.removeClass('active'); button.attr('action','follow'); button.html('Follow @'+username); flag=1; } if (flag==0) { button.html('Follow @'+username); } } else { button.html('Follow @'+username); } } /******** Our main function ********/ function main() { jQuery(document).ready(function($) { $('.followgrambutton').each(function(index) { var button=$(this); button.addClass('btnfollowgram'); var href=button.attr('href'); button.attr('href',null); var username=button.attr('username'); var userid=button.attr('rel'); var html=button.html(); if (userid){ button.html('Loading...'); button.html('Follow @'+username); } else button.html('Follow @'+username); }); $(".followgrambutton").live("click", function(e){ e.preventDefault(); var username=$(this).attr('username'); var action=$(this).attr('action'); url='http://followgram.me/'+username+'/modal' var w = 500; var h = 400; var l = Math.floor((screen.width-w)/2); var t = Math.floor((screen.height-h)/2); window.open(url,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l); }); }); } })();