Post by bass5098 on Sept 11, 2011 15:08:55 GMT -5
Description: This allows you to integrate your twitter feed directly into your forum. It is displayed in a thread-like format with the newest tweets showing first.
Preview: Click this link
Placement: Global Headers & Global Footers
Editing: The editing is at the top of the code.
// Change below
var twitter_id = "H5_Network";
var twitter_limit = 20;
var twitter_poster_name = "Twitter";
var twitter_poster_url = "h5network.proboards.com/";
var twitter_page_name = "Twitter Feed";
var twitter_page_url = "twitterfeed";
var twitter_page_image = "i50.tinypic.com/osbmhd.gif";
var twitter_icon_show = true;
var twitter_show_board = false;
// Change above
Red: This is your twitter ID. You must change this to reflect your twitter url or id number. twitter.com/Your_ID
Yellow: This is the amount of tweets you want to be displayed. The default is 10, and is the recommended amount. This number should not go above 20 because twitter normally doesn't allow it.
Green: On the twitter feed page, this is the name of what the "poster" will be. In my preview it is "Twitter" and is bolded.
Orange: This is the location to where the "poster" will lead to. In my preview, it is set to the url of H5.
Navy Blue: This is the url to the image that will be displayed in the menu bar. The default one is shown below and can be used by anyone.
Light/Normal Blue: Keep this as true to have the button appear at end of the menu bar. Set it to false if you dont want the button to be displayed.
Brown: Set this to what you want the page to be called. This shows in the navigation and the title bar.
And now... the two hardest variables...
Teal: This is what is displayed after the "action=" or "board=" in the url. You can change any page by combining this with the next variable. In this case, I used "twitterfeed" because it will show as "action=twitterfeed" and looks good.
Lime Green: This determines what the url is going to be. If you want it to start with "action=" you would keep it as it is. If you want to it start as "board=", you would set it to true. Most people would set this as true if they would want to have it display instead of a thread or a board. Some examples are below.
Example 1
var twitter_page_url = "twitterfeed";
var twitter_show_board = false;
The url that this would show on in my example would be http://BOARD_URL/?action=twitterfeed
Example 2
var twitter_page_url = "twitter";
var twitter_show_board = true;
The url that this would show on in my example would be http://BOARD_URL/?board=twitter. This would show up if the user clicked a board with the id of "twitter".
Example 3
var twitter_page_url = "twitter&action=display&thread=1";
var twitter_show_board = false;
The url that this would show on in my example would be http://BOARD_URL/?action=twitterfeed. This would display on a thread in the board "twitter" with the thread id number of "1".
I'm sure if you posted a request in the help boards, somebody would be able to adjust it to suit your forum.
Code: It has taken this long, and we aren't done yet...
Global Header - Editable Options
Global Footer - No Editable Options
Preview: Click this link
Placement: Global Headers & Global Footers
Editing: The editing is at the top of the code.
// Change below
var twitter_id = "H5_Network";
var twitter_limit = 20;
var twitter_poster_name = "Twitter";
var twitter_poster_url = "h5network.proboards.com/";
var twitter_page_name = "Twitter Feed";
var twitter_page_url = "twitterfeed";
var twitter_page_image = "i50.tinypic.com/osbmhd.gif";
var twitter_icon_show = true;
var twitter_show_board = false;
// Change above
Red: This is your twitter ID. You must change this to reflect your twitter url or id number. twitter.com/Your_ID
Yellow: This is the amount of tweets you want to be displayed. The default is 10, and is the recommended amount. This number should not go above 20 because twitter normally doesn't allow it.
Green: On the twitter feed page, this is the name of what the "poster" will be. In my preview it is "Twitter" and is bolded.
Orange: This is the location to where the "poster" will lead to. In my preview, it is set to the url of H5.
Navy Blue: This is the url to the image that will be displayed in the menu bar. The default one is shown below and can be used by anyone.
Light/Normal Blue: Keep this as true to have the button appear at end of the menu bar. Set it to false if you dont want the button to be displayed.
Brown: Set this to what you want the page to be called. This shows in the navigation and the title bar.
And now... the two hardest variables...
Teal: This is what is displayed after the "action=" or "board=" in the url. You can change any page by combining this with the next variable. In this case, I used "twitterfeed" because it will show as "action=twitterfeed" and looks good.
Lime Green: This determines what the url is going to be. If you want it to start with "action=" you would keep it as it is. If you want to it start as "board=", you would set it to true. Most people would set this as true if they would want to have it display instead of a thread or a board. Some examples are below.
Example 1
var twitter_page_url = "twitterfeed";
var twitter_show_board = false;
The url that this would show on in my example would be http://BOARD_URL/?action=twitterfeed
Example 2
var twitter_page_url = "twitter";
var twitter_show_board = true;
The url that this would show on in my example would be http://BOARD_URL/?board=twitter. This would show up if the user clicked a board with the id of "twitter".
Example 3
var twitter_page_url = "twitter&action=display&thread=1";
var twitter_show_board = false;
The url that this would show on in my example would be http://BOARD_URL/?action=twitterfeed. This would display on a thread in the board "twitter" with the thread id number of "1".
I'm sure if you posted a request in the help boards, somebody would be able to adjust it to suit your forum.
Code: It has taken this long, and we aren't done yet...
Global Header - Editable Options
<script type="text/javascript">
<!--
/*
Twitter Page Code By Bass5098
Do not repost without permission from the author
http://h5network.proboards.com - http://ismywebsite.com
Global Header - Editing At Top
*/
// Change below
var twitter_id = "H5_Network";
var twitter_limit = 20;
var twitter_poster_name = "Twitter";
var twitter_poster_url = "http://h5network.proboards.com/";
var twitter_page_name = "Twitter Feed";
var twitter_page_url = "twitterfeed";
var twitter_page_image = "http://i47.tinypic.com/1zn216c.gif";
var twitter_icon_show = true;
var twitter_show_board = false;
// Change above
// My custom page functions - Only thing in this script that can be taken or reposted
function changeTitle(title){
document.title = document.title.replace(/\s-\s.+?(?!\s-\s)$/i," - "+title);
document.getElementsByTagName('font').item(1).innerHTML = "« "+title+" »";
}
function makeNav(title){
document.write("<table width='92%' align='center' cellpadding='0' cellspacing='0'><tr><td><a href='?' class='nav'>"+document.title.split(/\s-\s/)[0]+"</a> :: "+title);
}
function addMenuButton(url, image, title){
document.body.getElementsByTagName( "td" )[5].innerHTML += ' <a href="'+url+'" title="'+title+'"><img src="'+image+'" alt="['+title+']" border="0" /></a>';
}
// Load the data
document.write('<script src="http://sz-ex.com/premades/bass5098/getInfo.php?u='+twitter_id+'&l='+twitter_limit+'"></script>');
//Twitter Feed Page
if(twitter_show_board){
var twitter_page_regex = "board="+twitter_page_url;
}else{
var twitter_page_regex = "action="+twitter_page_url;
}
if(location.href.match(twitter_page_regex)){
document.write('<div style="display:none;">');
}
//-->
</script>
Global Footer - No Editable Options
<script type="text/javascript">
<!--
/*
Twitter Page Code By Bass5098
Do not repost without permission from the author
http://h5network.proboards.com - http://ismywebsite.com
Global Footer - No Editing Needed
*/
// Show menu button if enabled
if(twitter_icon_show){
addMenuButton("/index.cgi?"+twitter_page_regex, twitter_page_image, twitter_page_name);
}
if(location.href.match(twitter_page_regex)){
document.write('</div>');
changeTitle(twitter_page_name);
makeNav(twitter_page_name);
document.write('<table width="100%" id="twitter_table" align="center" cellpadding="4" cellspacing="1" class="bordercolor">');
document.write('<tr><td colspan="2" class="titlebg"><font size="2"><b>Twitter Feed: Latest '+tweets.length+' Posts</b></font></td></tr>');
for(i=0; i<tweets.length; i++) {
document.write('<tr><td width="20%" align="left" class="windowbg" valign="top"><b><a href="'+twitter_poster_url+'">'+twitter_poster_name+'</a></b><br />Via Twitter</td>');
document.write('<td width="80%" align="left" class="windowbg" valign="top"><table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2" ><tr><td align="left" valign="middle" width="5%"><img src="http://s1.images.proboards.com/xx.gif" alt=" " border="0"/></td><td align="left" valign="middle" width="55%"><font size="2"><b>Twitter Post #'+eval(user_info["tweet_number"]-i)+'</b></font><br/><font size="1">« Tweeted on '+tweets[i][1]+' »</font></td>');
document.write('<td align="right" valign="bottom" height="20" width="40%"><a href="http://twitter.com/?status=@'+twitter_id+'%20&in_reply_to_status_id='+tweets[i][0]+'&in_reply_to='+twitter_id+'" title="Reply to this tweet"><img src="http://s1.images.proboards.com/buttons/reply.gif" border="0" alt="Reply" /></a></td></tr><tr><td colspan="3" valign="top"><hr width="100%" size="1" class="hr"><font size="2">'+tweets[i][2]+'</font></td></tr></table></td></tr>');
}
document.write('</table></td></tr></table><br />');
}
//-->
</script>