code for ning networks - Blogs - Ning Creators Social Network2024-03-28T17:18:37Zhttps://creators.ning.com/blogs/feed/tag/code+for+ning+networksMove follow linkshttps://creators.ning.com/blogs/move-follow-links2011-07-10T22:30:00.000Z2011-07-10T22:30:00.000ZChrishttps://creators.ning.com/members/Chris619<div><p> </p>
<p><span style="font-size: 16px;">This script moves the "follow" links to the top of the page and make them more noticeable. Try them. Post screenshots of them in use. Give me feedback and tell me about bugs, and follow this blog for updates. The latest version will always be in this description.</span></p>
<p> </p>
<p> </p>
<p><strong>Set your options in the script where indicated.</strong></p>
<p><strong>Add this script code to your "custom code" as the LAST thing.</strong></p>
<p></p>
<div style="max-width: 650px; padding: 10px 0 10px 20px; border: 1px solid #ccc; white-space: nowrap; overflow: auto; font-size: 0.8em; margin: auto;">
<p> </p>
<p><script type="text/javascript"><br />
/* chris's "move the follow link" code v0.9.2 *//*all options*/<br />
/* latest version <a href="http://creators.ning.com/profiles/blogs/move-follow-links">http://creators.ning.com/profiles/blogs/move-follow-links</a> */<br />
/* choose your options here */<br />
<br />
/* Include extra text? Choices: "yes", "no" */<br />
var c_xtra_txt="yes";<br />
<br />
/* If it's too long to fit do what? Choices: "down", "shrink" */<br />
var c_too_long="shrink";<br />
<br />
/* If it's forced down, align it left or right? Choices: "left", "right" */<br />
var c_align="right"; <br />
<br />
if (typeof(x$)!="undefined") {function c_move_follow_link() {var c_follow_link= x$('.xg_sprite.xg_sprite-follow-add, .xg_sprite.xg_sprite-follow-remove');if (c_follow_link.length){if (x$(c_follow_link[0]).attr('_removeurl').indexOf('stopFollowingMembership') > -1) {var c_new_follow_link=c_follow_link[1];} else {var c_new_follow_link=c_follow_link[0];}var c_follow_span=x$(c_new_follow_link).parent().children()[1];if (c_xtra_txt=="no") {var c_span_style="display:none;"; } else { var c_span_style="font-size:0.8em;font-weight:400;";}var c_new_follow_li='<li id="newFollowLi" title="'+ c_follow_span.innerHTML+'" class="right xg_lightborder navbutton" style="list-style:none;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;" onmouseover="this.title=x$(\'#followSpan\').text();"><span id="followSpan" style="'+c_span_style+'"></span></li>';if(x$('.navigation.easyclear').length){x$(c_new_follow_li).appendTo('.navigation.easyclear');var cnfli_in_place = x$('#newFollowLi');var e_top=cnfli_in_place.offset().top;var c_prev_height=cnfli_in_place.prev().height();x$('#followSpan').html(c_follow_span.innerHTML);cnfli_in_place.prepend(c_new_follow_link);if (cnfli_in_place.prev().hasClass('right') && (cnfli_in_place.height() > c_prev_height || cnfli_in_place.offset().top != e_top)) {if (c_too_long=="down") {cnfli_in_place.height(c_prev_height);cnfli_in_place.css({'white-space':'nowrap'});cnfli_in_place.width('auto');if (c_align=="left") {cnfli_in_place.before('<p><br /></p>');cnfli_in_place.removeClass('right');cnfli_in_place.addClass('left');} else {cnfli_in_place.before('<p>&nbsp;</p><p>&nbsp;</p>');}} else {cnfli_in_place.height(c_prev_height);var safetyctr=0;while (safetyctr < 15 && cnfli_in_place.offset().top > e_top) {safetyctr++;cnfli_in_place.width(cnfli_in_place.width()-30);}}} }else{x$(c_new_follow_li).appendTo('.xg_module.module_searchbar');var cnfli_in_place = x$('#newFollowLi');cnfli_in_place.prepend(c_new_follow_link);if (c_align=="left") {cnfli_in_place.removeClass('right');cnfli_in_place.addClass('left');cnfli_in_place.css({'margin': '5px 0px !important'});}}x$(c_follow_span).html('(follow at <a href="#">top</a>)');}}x$().ready(function() {setTimeout('c_move_follow_link();', 500);} );}</script></p>
<p> </p>
<p> </p>
</div>
<p> </p>
<p style="text-align: center;"><span style="color: #444;" class="font-size-1">If you use this script, do the right thing...</span> <a rel="nofollow" href="http://www.dreamhost.com/donate.cgi?id=14872"><img border="0" alt="Donate towards my web hosting bill!" src="https://secure.newdream.net/donate2.gif" class="align-center" /></a></p>
<p> </p>
<p> </p>
<p>This will not create "follow" links where there aren't any (blogs, notes etc.). All options *should* now work in Firefox, Safari, Chrome and IE8, but I haven't tested thoroughly - that's your job!</p>
<p> </p>
<p>Known issues:</p>
<ul>
<li><span class="font-size-1">When there's no "follow" link on the page to start with, this script will not create one. It's not possible. I've noticed that sometimes pages that should have them load without them. Nothing I can do about that, except file a ticket with Ning. If you think you should see a link at the top but don't, check to see if there's one at the bottom. If there is, then this script has failed to move it. If there are no follow links anywhere on the page then it's nothing to do with this script. It moves follow links. It doesn't create or delete them.</span><br /></li>
<li><span class="font-size-1">There are <strong>no</strong> "follow" links to be moved on <b>Notes</b>, <b>Blog lists</b> pages, The <b>All Blogs</b> page, or on <strong>Group Discussion</strong> pages if you're <strong>not a member</strong> of that group. This script will not create them. Try removing this code. Do you see a follow link? If not, then this script won't do anything on that page. There has to already be a "follow" link there to be moved.</span><br /></li>
<li><span class="font-size-1">Firefox doesn't support the css ellipsis ("...") as in "email me whe..." so the text runs right to the edge of the button if you're using "shrink". This does work in safari, chrome and also in IE8, oddly.</span><br /></li>
<li><span class="font-size-1">If a button is clicked and it grows, it may move on the page. Being worked on.</span></li>
</ul>
<p> </p>
<p> </p>
<p><em><span class="font-size-1" style="color: #333333;">Changelog:</span></em></p>
<p><em><span class="font-size-1" style="color: #333333;">16 jul 11: v0.9.2 fixed for firefox.</span></em></p>
<p><em><span class="font-size-1" style="color: #333333;">15 Jul 11: v:0.9 multiple options in one script. added align left option. fixed group bug.</span></em></p>
<p><em><span class="font-size-1" style="color: #333333;">10 jul 11: v0.7 "Title" now updates. In navigationeasyclear by default now. Created two versions.</span></em></p>
</div>