Advertise Here

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Celebrus

Pages: [1] 2 3 4 ... 6
1
SMF For Free Codes and Support / [code] Hide Statistics
« on: May 29, 2009, 09:24:58 am »
This is what we're gonna hide:


Headers or Footers, wherever you'd like it to be.
Code: [Select]
<script type="text/javascript">
$(document).ready(function(){
  $("div#upshrinkHeaderIC tr:contains('Forum Stats')").hide()
  $("div#upshrinkHeaderIC tr:contains('Forum Stats')").next().hide()
});
</script>

2
SMF For Free Codes and Support / [code] Don't Show Links to Guests
« on: May 28, 2009, 08:27:42 am »
Preview: http://9861.smfforfree.com/index.php/topic,9.0.html
Note that on my test forum it will only work for that topic. It should work everywhere for you.

Put this in either your headers or footers.
Code: [Select]
<script type="text/javascript">
// Don't show links to guests
// Script by Celebrus (http://vikhyat.net/)
function logged_in() {
  return $('td.titlebg2 span b').not($("td.titlebg2 span b:contains(News)")).html() ? true : false;
}
$(document).ready(function() {
  if(!logged_in()) {
    $("div.post a").html("<span style='color:red'>[Only members can see links]</span>").removeAttr("href").wrap("<strong></strong>");
  }
});
</script>

Also note that if your guests disable javascript they would be able to see the links and there's no way to get around that.

3
Original Image Resizing Script

I've tweaked that code a bit to get it to fit in a bit and display a message. You can find a preview of it here.

You can put this in either you headers or your footers. You may have to edit the colors in the CSS on top if you are using a custom theme.

Also note that the icon that is displayed is from the silk icon set from famfamfam.com which is licensed under a Creative Commons Attribution 2.5 License.

Code: [Select]
<style type="text/css">
div.resized_image p {
  margin: 2px;
  margin-top: 0;
  font-size: 8px;
  /* Awesome icon from here: http://www.famfamfam.com/lab/icons/silk/ */
  background: url(http://i242.photobucket.com/albums/ff244/9861_omikron/error.png) no-repeat;
  padding-left: 20px;
  color: #333;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
  (
    function(maxht, maxwt, minht, minwt) {
      var imgs = document.getElementsByTagName('img');
      // Image resizing function
      var resize_image = function(img, newht, newwt) {
        img.height = newht;
        img.width  = newwt;
        $(img).wrap('<table><tr><td class="tborder"><div class="resized_image"><a href="' + img.src + '" target="_blank"></a></div></td></tr></table>');
        $(img).parent().before('<p>NOTE: This image was resized. To view it full-size, click on the image.</p>');
        $(img).parent().after('<p style="text-align:right;background:none;margin:0;padding-right:3px">Image resizing script by <a href="http://aetus.net/217/programming/automatically-resize-large-images-with-javascript/">Aetus Designs</a>.</p>');
      };
     
      for (var i = 0; i < imgs.length; i++) {
        // Set a variable for the current image to make the code make more sense.
        var img = imgs[i];
        if (img.height > maxht || img.width > maxwt) {
          // Use Ratios to constraint proportions.
          var old_ratio = img.height / img.width;
          var min_ratio = minht / minwt;
          // If it can scale perfectly.
          if (old_ratio === min_ratio) {
            resize_image(img, minht, minwt);
          }
          // We need to do some magic now.
          else {
            var newdim = [img.height, img.width];
            // Sort out the height first.
            newdim[0] = minht;
            // The logic behind this is that if ratio = ht / wt, then wt = ht / ratio.
            newdim[1] = newdim[0] / old_ratio;
            // Do we still have to sort out the width?
            if (newdim[1] > maxwt) {
              // Just do what we did with the height
              newdim[1] = minwt;
              newdim[0] = newdim[1] * old_ratio;
            }
            // So yeah, resize the image
            resize_image(img, newdim[0], newdim[1]);
          }
        }
      }
    }
  )(500, 500, 500, 500);
});
</script>

If large images aren't common on your forum, then the small credit line at the bottom of resized images wouldn't be very intrusive. If you don't want it there and would prefer, say, a link in your footers, send me a PM or (preferably) a email.

4
SMF For Free Codes and Support / [Code] Global Announcements
« on: May 02, 2009, 08:34:18 am »
Preview is here: http://9861.smfforfree.com/index.php

I have two boards on that forum, the announcements show up in both.

First off, ensure you have this in your headers:
Code: [Select]
<script src="/jquery.js" type="text/javascript"></script>
This goes in your footers:
Code: [Select]
<script type="text/javascript">
// Edit after this line
var announcements = [
 ['Aetus Designs', 'http://aetus.net/'],
 ['RevolutionX', 'http://revolutionx.smfforfree3.com']
];
// Stop editing if you don't know what you are doing
/**
 * Global Announcements
 * http://aetus.net/
 * http://revolutionx.smfforfree3.com/
 *
 *  While there is NO warranty on this script unless you pay me a very large fee,  I will *TRY*
 *  to the best of my ability to help you out.
 *
 *  License: WTFPL (http://sam.zoy.org/wtfpl/)
 * 
 *  Feel free to remove this copyright notice, just visit those two sites listed above.
 *  Thanks for using this script.
 *
 */
(function($,topics){
  if(window.location.href.match(/board=/) || window.location.href.match(/board,/)){
    var html = '<tr><td class="titlebg2" colspan="7">Global Announcements</td></tr><tr><td class="windowbg2" colspan="7">';
    for(var i = 0;i<topics.length;i++){
      html += '<a href="' + topics[i][1] + '">' + topics[i][0] + '</a><br />';
    }
    html += '</td></tr><tr><td class="titlebg2" colspan="7">Regular Topics</td></tr>';
    $("div#bodyarea div.tborder table.bordercolor tbody tr td.catbg3:contains('Subject')").parent().after(html);
  }
})(jQuery, announcements);
</script>

You have to edit the first part of the script, the part before the copyright message. The part which looks like this:
Code: [Select]
var announcements = [
 ['Aetus Designs', 'http://aetus.net/'],
 ['RevolutionX', 'http://revolutionx.smfforfree3.com']
];

More specifically, the two lines in the center. Delete those two lines and add in your own lines like this:
Quote
['NAME OF THE TOPIC', '*FULL* URL TO THE TOPIC'],

Keep adding lines like that, and when you are done, remove the comma at the end of the last line.

As usual this has been tested on Firefox and Opera. (I realized that Epiphany uses Firefox's rendering engine so no point mentioning that.) If it doesn't on another browser let me know and I'll try to iron out the bugs.

That's it. If you have any problems with this let me know. Also, if you liked this code I'd appreciate it very very very much if you linked to my site(Aetus Designs) somewhere.

5
SMF For Free Codes and Support / [Code] Auto-Update the Time
« on: April 30, 2009, 02:12:28 am »
Preview: http://celebrusisawesome.smfforfree.com/

Has been tested on Firefox, Epiphany and Opera.

First ensure you have this in your headers:
Code: [Select]
<script src="/jquery.js" type="text/javascript"></script>

If you have that, proceed. If you don't, add it and return.

Then stick this in your footers:
Code: [Select]
<script type="text/javascript">
/**
 * Auto-Update the Time
 * http://aetus.net/
 * http://revolutionx.smfforfree3.com/
 *
 *  While there is NO warranty on this script unless you pay me a very large fee,  I will *TRY*
 *  to the best of my ability to help you out.
 *
 *  License: WTFPL (http://sam.zoy.org/wtfpl/)
 * 
 *  Feel free to remove this copyright notice, just visit those two sites listed above.
 *  Thanks for using this script.
 *
 */
function getTimeString() {
  var t = new Date();
  var months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July',
  'August', 'September', 'October', 'November', 'December' ];
  var month = months[t.getMonth()];
  var date = t.getDate();
  var year = t.getFullYear();
  var hour = t.getHours();
  var suffix = "am";
  if (hour >= 12) {
    suffix = "pm";
    hour = (hour == 12) ? "12" : hour - 12;
  }
  if(hour < 10) { hour = "0" + hour; } 
  var minute = t.getMinutes();
  if(minute < 10) { minute = "0" + minute; }
  var second = t.getSeconds();
  if(second < 10) { second = "0" + second; }
  return month + " " + date + ", " + year + ", " + hour + ":" + minute + ":" + second + " " + suffix;
}
function updateTheDate($) {
  var timeString = getTimeString();
  var timeDisplay = $("div.tborder table tbody tr td.titlebg2 span.smalltext:contains(pm)");
  if(timeDisplay.length === 0) {
    timeDisplay = $("div.tborder table tbody tr td.titlebg2 span.smalltext:contains(am)");
  }
  timeDisplay.html(timeString);
}
setInterval("updateTheDate(jQuery)", 1000);
</script>

And voila, you now have a clock that shows the time *right now*, not when the page was loaded. And the time is from the user's computer, so you (and your members) don't have to mess with time offsets.

6
SMF For Free Codes and Support / [code] Twitter Widget in Profile
« on: March 19, 2009, 05:54:44 am »
First off, this is a preview:
http://9861.smfforfree.com/index.php?action=profile;u=1

First off, create a new profile field.
These are the settings I have for it.
Name: Twitter
Show in profile: Yes
Show in posts: No
Parse BBC: No
Text to display before field:
Code: [Select]
<div id="twitterstream"><a href="http://twitter.com/Text to display after field:
Code: [Select]
" target="_blank">Twitter</a></div>Field ID: twitter
Only allow admins to edit field: No
Only allow admins to view field: No

You can put in anything you want for anything I didn't mention. Make sure it's type is 'Text'.

Once you are done with that, ensure you have the jQuery code in your headers. It looks like this:
Code: [Select]
<script type="text/javascript" src="/jquery.js"></script>

Then add this to your footers.

Code: [Select]
<script type="text/javascript">
function twitterAdd(o){var u='http://twitter.com/'+username+'/status/'+o.id;$("div#twitterstream div.tborder div.windowbg2 ul").append("<li style='padding-top:5px'><a href='"+u+"' target='_blank'>"+o.text+"</a></li>")}function twitterCallback(j){username=$("div#bodyarea table.bordercolor tbody tr td.windowbg table tbody tr td a:contains('Twitter')").attr('href').match('http://twitter.com/(\.+)')[1];$("div#bodyarea table.bordercolor tbody tr td.windowbg table tbody tr td b:contains('Twitter')").html("Latest Twitter Updates:");$("#twitterstream").html("<div class='tborder' style='opacity:0.55'><div class='windowbg2' style='font-size:0.8em'><ul style='margin:0px;padding-left:5px;padding-bottom:5px;list-style:none'></ul></div></div>");for(i in j){twitterAdd(j[i])}}(function(n){if(window.location.href.indexOf("action=profile")!=-1){username=$("div#bodyarea table.bordercolor tbody tr td.windowbg table tbody tr td a:contains('Twitter')").attr('href').match('http://twitter.com/(\.+)')[1];var a=document.createElement('script');a.setAttribute('src','http://twitter.com/statuses/user_timeline/'+username+'.json?callback=twitterCallback&count='+n);document.body.appendChild(a)}})(5);
</script>

You shouldn't need to edit anything except the 5 at the very end, that is the number of tweets that will be displayed.

And there, the code should work. :) Edit your profile, adding in your twitter username in the field you created to test it.

If you want the uncompressed source, it's below this. You shouldn't need it, but I decided to include it in case anyone wanted to know how it works.
Code: [Select]
function twitterAdd(o){
  var u = 'http://twitter.com/' + username + '/status/' + o.id;
  $("div#twitterstream div.tborder div.windowbg2 ul").append("<li style='padding-top:5px'><a href='"+u+"' target='_blank'>" + o.text + "</a></li>");
}

function twitterCallback(j){
  username = $("div#bodyarea table.bordercolor tbody tr td.windowbg table tbody tr td a:contains('Twitter')").attr('href').match('http://twitter.com/(\.+)')[1];
  $("div#bodyarea table.bordercolor tbody tr td.windowbg table tbody tr td b:contains('Twitter')").html("Latest Twitter Updates:");
  $("#twitterstream").html("<div class='tborder' style='opacity:0.55'><div class='windowbg2' style='font-size:0.8em'><ul style='margin:0px;padding-left:5px;padding-bottom:5px;list-style:none'></ul></div></div>");
  for(i in j){
    twitterAdd(j[i]);
  }
}

(function(n){if(window.location.href.indexOf("action=profile") != -1){
  // This is the profile page.
  username = $("div#bodyarea table.bordercolor tbody tr td.windowbg table tbody tr td a:contains('Twitter')").attr('href').match('http://twitter.com/(\.+)')[1];
  var json = document.createElement('script');
  json.setAttribute('src', 'http://twitter.com/statuses/user_timeline/' + username + '.json?callback=twitterCallback&count=' + n);
  document.body.appendChild(json);
}})(5); // Number of tweets to show

Note on browser compatibility: While I haven't been able to test this code on any browser like IE or Safari that doesn't have a linux version, the screenshots from browsershots.org indicates that it works correctly... sorta. On browsers where it isn't working like IE5.5, it's degrading gracefully, ie it just shows a link to the user's twitter profile.

Also, I think I should move the tweets down and make it look like the 'Additional Information' and 'Recently Uploaded Images'. What do you think?

7
SMF For Free Codes and Support / [Code] Move the Navigation
« on: February 02, 2009, 01:23:35 am »
Preview: http://celebrusisawesome.smfforfree.com/

First, ensure you have the jQuery include in your headers. It looks somewhat like this-
Code: [Select]
<script src="/jquery.js" type="text/javascript"></script>

Next, put this wherever your new tabs should appear.
Code: [Select]
<div id="_nav"></div>
In the preview, I put it at the very top of my headers.

Finally, add this to your footers.
Code: (javascript) [Select]
<script>
/*
 * Code created by Celebrus
 * - www.vikhyat.info
 * - aetus.net
 * - revolutionx.smffofree3.com
 */
// EDIT AFTER THIS IF YOU WANT TO.
reclass =                        "mirrortab";            // decides the root, try changing it to 'maintab' and see what happens
align_to_right =               true;                    // true/false
get_rid_of_top_padding =  false;                   // works better when 'reclass' is set to 'maintab'. once again, true/false
// EDITING ANYTHING AFTER THIS WILL VOID YOUR WARRANTY.

$(".maintab_active_back:contains(Home)").parent().parent().parent().appendTo("#_nav");
$(".maintab_back:contains(Home)").parent().parent().parent().appendTo("#_nav");
if(align_to_right)$("div#_nav").css("float","right").next().css("clear","both");
if(get_rid_of_top_padding)
{
  $("body").css("padding-top","0");
  $("#_nav").css("margin-bottom","10px")
}
$("div#_nav td.maintab_back").removeClass("maintab_back").addClass(reclass+"_back");
$("div#_nav td.maintab_first").removeClass("maintab_first").addClass(reclass+"_first");
$("div#_nav td.maintab_last").removeClass("maintab_last").addClass(reclass+"_last");
$("div#_nav td.maintab_active_back").removeClass("maintab_active_back").addClass(reclass+"_active_back");
$("div#_nav td.maintab_active_last").removeClass("maintab_active_last").addClass(reclass+"_active_last");
$("div#_nav td.maintab_active_first").removeClass("maintab_active_first").addClass(reclass+"_active_first");
</script>

Customization:
As you can see, there are 3 variables you can edit. They should be more or less self-explanatory, but I'll explain them.
reclass: This variable decides what the 'root' class of your new navigation will be. With 'maintab', the curved edges will be at the bottom. It looks like the default tabs. With 'mirrortab' the same thing would be inverted. In the preview, it is set to 'mirrortab'.
align_to_right: In the preview, you'd see that the tabs are to the right of the page. If you want it to be on left, change this to false. (without quotes)
get_rid_of_top_padding: This will basically stick the tabs at the very top of the page (with no gap) if you put the <div> on top of your headers.

Further customization:
If you want to customize it further, such as adding padding, and you know what you are doing, you can customize it with CSS using the div#_nav rule.

Notes:
1. This was inspired by sibyl's Endless theme which was a conversion of one by Crip.
2. I don't know if it's legal to have an underscore at the start of an id.

Disclaimer: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

8
Graphics / Simplicity Tag Tutorial
« on: December 24, 2008, 11:00:54 am »

9
Graphics / Black Cat Tag, and another typography/vector one
« on: December 12, 2008, 10:06:07 am »



Comments and constructive crit appreciated. :)

10
Graphics / Shonen Onmyoji Tag
« on: December 06, 2008, 10:14:43 am »
For a SOTW on Aetus Designs,


11
Graphics / Really Simple Avatar Tutorial
« on: December 06, 2008, 10:13:23 am »

12
General Chat / Terrorist attacks in India (more than 100 people killed)
« on: November 27, 2008, 03:08:08 am »
http://www.latimes.com/news/printedition/front/la-fg-mumbai27-2008nov27,0,5223584,full.story
http://timesofindia.indiatimes.com/articleshow/3761410.cms

From what I know these people seem to have entered through see, heavily armed and starting firing on people and throwing grenades on the roads. They appear to have planned all of this a lot and are very heavily armed (just heard something about police recovering a jacket full of grenades.

At the time of writing the hostage crisis in Taj has ended and the army is marching into the Trident hotel.

13
Graphics / Tenchu Tag Tutorial
« on: November 23, 2008, 03:00:51 am »
This one's more of a screencast. :)

http://aetus.net/forum/index.php?topic=381.0

14
Graphics / Tenchu Tag
« on: November 22, 2008, 10:34:29 pm »
For a SOTW on my forum.



Feedback/comments appreciated.

15
Graphics / Lord of the Rings Tag
« on: November 12, 2008, 11:41:23 pm »


It was very rushed and all, but what do you think?

Pages: [1] 2 3 4 ... 6