SMF Package Manager Generator

Originally I had wrote my original SMF Package Manager Generator a few years ago. It was sloppy coding, poor JavaScript and relied heavily on the server. Not my absolute best work, but was something I was proud on at the time from my efforts to dive into JavaScripting.

However, todays times are different. So with JQuery out there, I decided to take breaks from my projects for a couple hours for a few days and put forth a effort to rewrite this. Needless to say, I had the initial code wrote in only a few hours. My original script took me a few days alone. That didn’t count the package-info creator I made later which also took a while.

The new script attempts to rely all on JavaScripting via JQuery. It was a fun experience to build it this way. Although, because of JavaScript’s security measures, I couldn’t leave downloading the file outside of the server. So alas, I still have to process the actual download via the server. There is a work around with using Data URIs, however it didn’t provide the filename and sounds a bit flaky when the length of the url gets to be a bit long. I included both as a option though.

Oh and Its on github, because I see no reason to not share the code. Including the code I used to integrate it into my WordPress blog.

JQuery Week Calendar mouseover events

While working with a plugin for JQuery for week calendars. I came across a very annoying little bug. Using mouseover/out events did not seem to work correctly when hovering over the title and time. It just wouldn’t do what it should of.

Well after debugging and messing around for a while, I was able to figure out how to resolve this issue. In jquery.weekcalendar.js open up the file and locate:

After that code we want to add:

A little further down the file is:

We want to add after that:

This makes it work as I excepted it to. My thoughts here are that the inner divs are removing the mouseover events. So by attaching an event to them as well, it makes it work as well.

As a good GitHub person does, I submitted a pull request with these fixes in hopes that it gets merged into the plugin.

new Date() in javascript

It appears that the date object in javascript can have some variances. I had a bug in my code which was only affecting FireFox users on Windows machines. After some debugging time, I figured out that the date object was returning a differently formated value.

These are some examples:
FireFox on Windows 7: Wed Dec 07 2011 16:26:38 GMT-0800 (Pacific Standard Time)
IE 8 on Windows 7: Wed Dec 7 16:29:21 PST 2011
Chrome on Windows 7: Wed Dec 07 2011 16:45:45 GMT -0800 (Pacific Standard Time)
FireFox on OS X Lion: Wed Dec 07 2011 16:37:12 GMT-0800 (PST)
Opera on OS X Lion: Wed Dec 07 2011 16:37:21 GMT-0800
Safari on OS X Lion: Wed Dec 07 2011 16:44:54 GMT-0800 (PST)

It appears that the format of this is left up to the browser to decide. It would be nice if they all followed a specific format. Well it was because of the (Pacific Standard Time) not being recognized by php’s strtotime, that my code failed to work. Some helpful members on IRC brought it to my knowledge that it is up to the browser really.

I find it interesting that out of all the tests, it appears IE just takes a completely different method. While the other browsers are at least semi-similar other than the time zone string at the end. OS X at least appears to be consistent and it appears Opera may just be stripping the string parenthesis from the end.

At least there is a simple solution. Just use some regular expressions to strip off (Pacific Standard Time) and any other variation.

JQuery week calendar reoccurring events

JQuery has a nice plugin called . Very simple to use and I was able to integrate it into the database to handle pulling scheduling data. However I came across one issue. Reoccurring events.

Well after scrambling the web, I came to the conclusion that it wasn’t possible in the code by default. So away into the code I went. To say the least, my solution is nowhere near perfect nor does it allow for reoccurring events yet from different weeks or months. It was decided to take another course of action rather than trying to hack reoccurring events into the code. I just wanted to post what I had so far:

In jquery.weekcalendar.js we have this code:

Now before this and the block of code before it, I added in:

This lets me do reoccurring events for the current week. I am sure it could be greatly improved and somebody may be able to make it support multiple weeks.

In case anybody else wondered, this simply just needs a json array in the data of the weekday numbers (0-6). The key is recurring.