April 19, 2025, 04:48:46 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to Revolution X, where Coding meets Graphics.
 
  Home Help Search Arcade Affiliates Staff List Calendar Members Login Register  
  Show Posts
Pages: 1 [2] 3 4
16  Coding Community / Coding Snippets / Hide Statistics on: May 29, 2009, 09:18:57 am
This is what we're talking about hiding:


Headers or Footers, wherever you'd like it to be.
Code:
<script>$(document).ready(function(){
  $("div#upshrinkHeaderIC tr:contains('Forum Stats')").hide()
  $("div#upshrinkHeaderIC tr:contains('Forum Stats')").next().hide()
});</script>
17  Coding Community / Coding Snippets / Don't Show Links to Guests on: May 28, 2009, 08:31:20 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:
<script type="text/javascript">
// Don't show links to guests
// Script by Celebrus of Aetus Designs[aetus.net] and Revolution X[revolutionx.smfforfree3.com].
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.
18  Coding Community / Tutorials / Re: Common Coding Tasks (and how to accomplish them) on: May 28, 2009, 07:12:40 am
Thanks ^_^

The main inspiration behind this thread was when I had to search through my entire post history to get the loggedIn function. I thought this would make it easier.
19  Coding Community / Tutorials / Common Coding Tasks (and how to accomplish them) on: May 28, 2009, 12:43:30 am
Note: This is by no means a thorough or exhaustive list. As of now it is incomplete. If you would like to see something added to this, please reply to this topic.


Checking whether the user is logged in
This function will return true or false depending on whether the user is logged in.

Code:
function loggedIn() {
  return $('td.titlebg2 span b').not($("td.titlebg2 span b:contains(News)")).html() ? true : false;
}

Example:
Code:
if( ! loggedIn() ) {
  alert("Hey there, guest");
}


Checking whether the user is an admin
This function will return true or false depending on whether the user is logged in.

Code:
function isAdmin() {
return ($("td.maintab_back:contains('Admin')").length == 1 || $("td.maintab_active_back:contains('Admin')").length == 1)
}

Example:
Code:
if( isAdmin() ) {
  alert("Hey there, admin");
}


Notice that fits in with the forum theme
This function will return a string containing HTML that is appropriate for displaying widgets.

Code:
function widget(m) {
return ('<div class="tborder"><div class="windowbg" style="padding:8px">' + m + '</div></div>');
}

Example:
Code:
document.write( widget( 'Hey there!' ) );
20  Graphics Community / Photoshop Tutorials / Painless Forum Markers on: May 27, 2009, 12:15:12 pm
Painless Forum Markers
This tutorial will teach you how to create forum markers(new and no post icons next to individual boards) using Photoshop. The forum markers we will be making shall be 32x32px in size.

Step 1
Create a new document of size 32x32 pixels with a transparent background. Select two different grays. I have #a7a7a7 and #8d8d8d.

Step 2
Draw a gradient over your canvas using these colors.


Step 3
It's time for some gloss. Use the elliptical marquee tool to create a circular selection over your image.

Now create a large white to transparency radial gradient on a new layer. Deselect(Ctrl+D) and set this layer to soft light. Lower it's opacity to around 50%.


Step 4
It's looking real plain now, but we will fix that. Now lets create a border.
Create a new layer for the border. Press Ctrl+A to select the entire canvas. Then go to Edit>Stroke and use these settings.

Lower this layers opacity to around 20%.


Step 5
Let's add a line around the bottom of the forum marker. Zoom in as far as you can go, and then create a new layer. Get your pencil tool out and draw a white line with a 1px brush leaving gaps around the border as show in the image. Hold down the shift button while drawing the line so that it is straight.

Set this layers opacity around 10%. Now draw a similar black line just above the white one on a new layer and set it to soft light at 50% opacity.


Step 6
Now we are almost done, all we need to do is put up a shape in the marker. It could be anything you want, such as your logo, but I am just going to put one of Photoshop's default shapes there, that looks like a '>' there. I set it's blending mode to 'Soft Light'.


Step 7
Time for coloring! Pick your color and fill a new layer with it and then set the layer to 'Soft Light'. I will be using blue. You will need to play around with this for a while. If your color isn't saturated enough, you can duplicate the layer or do a hue/saturation adjustment.


Step 8
All you have to do now is modify this icon to create the rest of your icons. Lower the opacity of the shape a bit to get your no new posts icon. Bring the opacity back to earlier and use the same technique we used to create the line at the bottom of the marker to create a little shape on top for your sub-new posts or child board new posts indicator. And here's the entire set-


I hope you enjoyed this tutorial as much as I enjoyed writing it.

NOTE: Original Topic: http://aetus.net/forum/index.php?topic=110.0
21  Graphics Community / Photoshop Tutorials / Really Simple Gloss on: May 27, 2009, 12:12:16 pm
22  Coding Community / Tutorials / [PHP] Simple Dynamic Signature Tutorial on: May 27, 2009, 12:09:31 pm
This tutorial will teach you how to create a signature with dynamic text using PHP with the GD library installed.

Preview -
 
This was the original -

The 'omikron' text on that was dynamically put there, so I can change it on the fly.

First you need an image to place text on. Once you have that, create a new php file with the usual tags.
Code: (php)
<?php

?>


Now lets get the text that we will use. I am going to place whatever text I receive through a GET variable.
Code: (php)
<?php

$str 
$_GET['txt'];

?>


You might even want to secure the text that you receive, although I won't be doing that right now.
My signature is stored as 'images/dragon.png' relative to the PHP file. Let's load the image now.
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');

?>


You should also select the color you want. You can't use a hexadecimal value here, you will need the appropriate amounts of red, green and blue. The format for this function is imagecolorallocate($image, red, blue, green);

$image is the variable to which we are allocating the color to.
red, blue and green are the appropriate amounts of red blue and green you will use. I wanted a nice brownish color, so I used 226, 220, 210. These value are out of a total of 255. If all three are 255, the color will be white and if all of those are 0, the color would be black.

So now the code is -
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);

?>


Now select the font you want to use. I will use Palatino Linotype, which is located as 'fonts/pala.ttf' relative to the PHP file. Let's store this in a variable so that we can use it later. The font has to be a TTF font.
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);
$font 'fonts/pala.ttf';

?>


You also need the X and Y coordinates where your text will be placed. You will need to play around with these for a while. I ended up with 12(X) and 86(Y).
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);
$font 'fonts/pala.ttf';
$x 12;
$y 86;

?>


You also need to know the font size you are going to use. 10 fits in well for me.
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);
$font 'fonts/pala.ttf';
$x 12;
$y 86;
$size 10;

?>


The last thing you need is the rotation of your text. This is in an anti-clockwise direction. I am leaving mine at 0.
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);
$font 'fonts/pala.ttf';
$x 12;
$y 86;
$size 10;
$rotation 0;

?>


Now we are ready to actually add the text. I will be using the imagettftext function for this.
imagettftext($image, $size, $rotation, $x, $y, $color, $font, $str);
The parameters should be self-explanatory, since we already stored them in variables before.
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);
$font 'fonts/pala.ttf';
$x 12;
$y 86;
$size 10;
$rotation 0;
imagettftext($image$size$rotation$x$y$color$font$str);

?>


Now that we are done with the image, let's send it to the client.

header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);

The header('Content-Type: image/png'); is to tell the browser that we are sending an image.
imagepng($image); is to actually output the image.
imagedestroy($image); will just destroy the image since it has already been sent and isn't needed any more.

So the complete code for the image is -
Code: (php)
<?php

$str 
$_GET['txt'];
$image imagecreatefrompng('images/dragon.png');
$color imagecolorallocate($image226220210);
$font 'fonts/pala.ttf';
$x 12;
$y 86;
$size 10;
$rotation 0;
imagettftext($image$size$rotation$x$y$color$font$str);

header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);

?>

If you saved this on your host as sigs/sig.php, you can access it like this:
http://YOURHOST/sigs/sig.php?txt=MyName

Now, the problem is that some forums don't allow you to add a signature image unless it ends with an image extension(PNG, GIF or JPEG). We can easily fix this using HTACCESS. Your host needs to have mod_rewrite enabled. Open your .htaccess file, or create one if it does not exist. It needs to be in the 'sigs' directory. On a new line, add -
Code:
RewriteEngine On
RewriteRule (.+)/sig.png sig.php?txt=$1

That way, you can access the image as
http://YOURHOST/sigs/MyName/sig.png

The first line in the HTACCESS code simply enables the rewrite engine.
The second line is RewriteRule (.+)/sig.png sig.php?txt=$1.
RewriteRule - A new URL rewriting rule.
(.+)/sig.png - (.+) is a 'catch-all expression'. This represents what your URL will look like.
sig.php?txt=$1 - This represents what the actual file is. $1 is what was caught by the 'catch-all' expression above.

So, http://YOURHOST/sigs/Anything/sig.png will become the same as http://YOURHOST/sigs/sig.php?txt=Anthing
23  Coding Community / Tutorials / Identifying and manipulating elements using jQuery on: May 27, 2009, 12:07:45 pm
Lets begin with this: What is jQuery?

From the jQuery website,
Quote
jQuery is a new type of JavaScript library.
Quote
jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.


- I like to describe jQuery as this really cool javascript library that is here to make your life easy. What you can do with plain old javascript in 20 lines can be done by jQuery in 10 lines, maybe even lesser.

- jQuery has an interesting concept called chainability.

Code:
$("#something").addClass("smalltext").removeClass("largetext").show();
That one line of code finds elements that have the ID 'something', adds the class 'smalltext' to them, removes the class 'largetext' from them and then shows them if they are hidden. Interesting, huh?

- jQuery also has a number of awesome effects. Now you can use awesome animations to show hidden text without programming a single line extra.

- jQuery also has a very nice method of detecting events.

Code:
<script>
$("a").click(function(){
alert("You clicked a link!");
});
</script>
That code, placed in your headers, will alert the user whenever a link is clicked. (Annoying, I know.) That comes in very handy if you are trying to have clean HTML script with all your javascript in one single place.

Enough intro for now, so lets get started with the actual tut. Cool



This tutorial assumes that you have some basic knowledge of HTML. If you don't know HTML, don't worry. It's no biggy. Here are some links that are sure to help you out:
- w3schools
- Cedge's HTML Cheat Sheet


We all know what an element is – and this tutorial will teach you how to identify and manipulate them, in jQuery.

jQuery and CSS identify elements in the same way. If you know CSS, great! It'll be easier for you. Let's start with an example HTML document.

Code:
<html>
<head>
<title>Hi.</title>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
</body>
</html>


You probably know that all scripts go within script tags.

Code:
<script type="text/javascript">

</script>

Now put in a jQuery include. For our purposes, you can put in this:
Code:
<script src="http://9861.smfforfree4.com/jquery.js" type="text/javascript"></script>
 

NOTE: Do not use that in any page you publish. Download the latest jQuery from jquery.com and upload that to your hosting and use it from there.

You have to put that in your head section.

Code:
<html>
<head>
<title>Hi.</title>
<script src="http://9861.smfforfree4.com/jquery.js" type="text/javascript"></script>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
</body>
</html>

Lets try to isolate the ‘Hi there' text first.

This is the code you need:
Code:
$("h1")

Easy, eh? Now to see if that works, lets do something to it. If you put a ‘.hide()' after it, you get:
Code:
<script>
$("h1").hide();
</script>
 
Put that into the document somewhere after the h1 tag, save it and run it. Can you see the contents of h1? If you can, you have done something wrong. Repeat all the steps and try again. I'll explain later why it should be after the h1 tag.
This is what you should have:
Code:
<html>
<head>
<title>Hi.</title>
<script src="http://9861.smfforfree4.com/jquery.js" type="text/javascript"></script>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
<script>
$("h1").hide();
</script>
</body>
</html>
That was pretty easy, wasn't it? Now lets hide the bold stuff.

Code:
<script>
$("b").hide();
</script>

Put that in and try.
But, what if we had two bold elements and wanted to hide only one?
What if this is your document?
Code:
<html>
<head>
<title>Hi.</title>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
<i>I am learning jQuery!</i>
<b>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas metus nisi, euismod vel, mattis eu.</b>
</body>
</html>

OK, we want to hide the second one. How?
Answer: Give it an id.
Lets give it the ID “Lorem".
So this is our document now:
Code:
<html>
<head>
<title>Hi.</title>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
<i>I am learning jQuery!</i>
<b id="lorem">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas metus nisi, euismod vel, mattis eu.</b>
</body>
</html>

Then to hide it, you'd have:
Code:
<script>
$("b#lorem").hide();
</script>

Understood? We affix the id after a ‘#'.

Put that after the bold text and try. It should work.

There are another two methods: using the contains function and using a class.
Lets see how to use a class first.

Let's give the part to hide a class. Classes are usually used by CSS to give an element specific properties. Of course, no one's saying that you can't use IDs in CSS but the general practice is to use classes. This should be the HTML document.
Code:
<html>
<head>
<title>Hi.</title>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
<i>I am learning jQuery!</i>
<b class="lorem">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas metus nisi, euismod vel, mattis eu.</b>
</body>
</html>

As you can see, the lorem ipsum dolor paragraph now has a class, ‘lorem'. Now to hide it, you'd have
Code:
<script>
$("b.lorem").hide();
</script>
It's almost the same as the thing we did for using and id. This time we used a ‘.' Instead of a ‘#'.  Put it just before the </body> and try.


Now consider this document:
Code:
<html>
<head>
<title>Hi.</title>
</head>
<body>
<h1> Hi there </h1>
<h4>Welcome to my site</h4>
<b> Enjoy yourself </b>
<i>I am learning jQuery!</i>
<b>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas metus nisi, euismod vel, mattis eu.</b>
</body>
</html>

It's the same except that the lorem part doesn't have any class or ID. We will be using ':contains' to identify it.
This is the code you have:
Code:
<script>
$("b:contains('lorem')").hide();
</script>
That should be easy. Put it before the '</body>' and try.


Now lets look at another method of identifying a nested element.
Consider this HTML document.
Code:
<html>
<head>
<title>Hi again.</title>
</head>
<body>
<h1>The page</h1>
<div class="wrapper">
Click <a href="#somewhere">here</a>.
</div>
<div id="somewhere">lol</div>
</body>
</html>

We want to hide the link. It contains the text 'here'.

To hide it, you have
Code:
<script>
$("div.wrapper a").hide();
</script>

That code looks for an element that is an 'a' within a div having the class 'wrapper'. But what if there were 2 'a's within div.wrapper?
We will need to add something that gets only the anchors which link to #somewhere.

Code:
<script>
$("div.wrapper a[href='#something']")
</script>

Geddit? The thing in the [square] brackets? Basically, that makes it match only the elements with the property 'href' that is exactly the same as the string '#somthing'.
Try it. Smiley

Some theory on that:
[attribute]    
Matches elements that have the specified attribute.
[attribute=value]    
Matches elements that have the specified attribute with a certain value.
[attribute!=value]    
Matches elements that don't have the specified attribute with a certain value.
[attribute^=value]
Matches elements that have the specified attribute and it starts with a certain value.
[attribute$=value]    
Matches elements that have the specified attribute and it ends with a certain value.
[attribute*=value]
Matches elements that have the specified attribute and it contains a certain value.

What we did up there was the second one. I got that straight from the jQuery documentation. That ends the selecting part of this tutorial. To learn further, go here.

Now lets begin with manipulating elements. You already know how to hide stuff. Let's go deeper. Wink

I'll split this section into parts.

I. Inserting inside

We'll look at two things here - appending and prepending.

1. Appending
This is used to add some text at the end of all matched elements.

For example,
Code:
$("div.wrapper").append("<b>Hello!</b>");
will add Hello! at the end of divs that have the class 'wrapper'.

2. Prepending

This will add something to the beginning of matched elements.

Example:
Code:
$("div.wrapper").prepend("<b>Hello!</b>");
will add Hello! at the start of divs with the class 'wrapper'.

II. Hiding, Showing and Toggling


1. Hide

We already know what this does, no need to repeat.

Code:
$("#something").hide();
will hide all elements with the id '#something'.

2. Show
Will display hidden elements.

Code:
$("#something").show();
will show the #something that we hid above. Wink

3. Toggle
Will toggle elements. Which is to say, if it is hidden, it will show the element and if it is visible it will hide the element.

Code:
$("#something").toggle();


III. Changing contents

1. HTML
Used to set the HTML inside matched elements to something else.

Code:
$("#something").html("<b>Hello!</b>");

2. TEXT
Used to Set the text contents of all matched elements.

Code:
$("#something").text("HTML will not work here.");

Another example:

Source Code
Code:
$("p").text("<i>Some<i> <b>thing</b>");
Result:
Code:
<i>Some<i> <b>thing</b>


For more information on jQuery manipulation, go here.

I promised to tell you why you have to put the code after the element you are trying to identify and manipulate. This is the reason: code is executed the moment it is downloaded, and if the code is below it, it is downloaded later and so the code can not find it at that time. Here is a way around that: put your code in this:
Code:
<script>
$(document).ready(function(){
// Code here
});
</script>

That will make the code execute only after the whole document has loaded.
24  Coding Community / Coding Snippets / Automatically Resize Large Images on: May 24, 2009, 02:46:00 am
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:
<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) an email.
25  Official / Announcements / Re: New Global Moderator on: May 16, 2009, 02:30:15 am
Congrats on the promo. ^_^
26  Coding Community / Coding Snippets / Global Announcements on: May 02, 2009, 08:36:05 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:
<script src="/jquery.js" type="text/javascript"></script>

This goes in your footers:
Code:
<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:
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.
27  Coding Community / Coding Snippets / Re: Auto-Update the Time on: May 01, 2009, 06:20:00 am
Weird. Works now. Thanks!

That's because I just fixed it. I still have to see what happens when the hour is 12...
28  Coding Community / Coding Snippets / Re: Auto-Update the Time on: May 01, 2009, 06:13:15 am
Ok there is that problem. I'm fixing it!
29  Coding Community / Coding Snippets / Re: Auto-Update the Time on: May 01, 2009, 12:08:23 am
Weird, this line is supposed to fix that:
    hour = (hour == 0) ? hour - 12 : "12";
30  Coding Community / Coding Snippets / Re: Alert on Logout on: April 30, 2009, 08:55:16 am
Try this:
Code:
<script type="text/javascript">
var Leave = "YOUR TEXT";

var name = document.getElementsByTagName("span");
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
var username = RegExp.$1;
};};
var Logout = document.links;
for(c=0;c<Logout.length;c++){
if(Logout[c].href.match(/action=logout/i) && Logout[c].parentNode.className == "maintab_back"){
Logout[c].onclick = function(){ if(confirm(Leave) == true) { window.location.href = smf_scripturl + "?action=logout"; } else { return false; } };
};};
if(Leave.match(/{user}/i)) Leave = Leave.replace(/{user}/i,username);
</script>

I basically just got what Agent wrote to return false.
Pages: 1 [2] 3 4
Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy