A screenshot of the "compilation" page from my minisite.
Well, so JavaScript is. Fun. I think it is both the most rewarding and absolutely frustrating thing that I’ve worked on so far. After hours and hours of trying to make one little thing work, when it finally does, there’s just this enormous sense of victory and accomplishment. I think this is more so than working exclusively with CSS or HTML because JavaScript is interactive, so you can see your work interacting with the user. It’s so rewarding to see your stuff actually working. Even if it’s just a little alert popping up, knowing that the stuff behind all of the layers is working is just. It’s wonderful.
With that being said, I also want to say that about 90% of the time, I wanted to reach into the computer and just smack JavaScript around a bit.
Okay, so as you can see, I based my sites not off exactly anything that necessarily exists but rather the world of Rowling’s Harry Potter. I got this idea when I was attempting to determine what kind of site would take down my information. I was feeling rather uninspired by my Scroogle site, so I tried having fun with this information-gathering-page. And then a funny thought appeared in my head of the Ministry of Magic using online forms to collect data. Since it was about Harry Potter, obviously I decided to run with it, since it is apparently my thing to mix my obsessions with web design assignments (see my ARG project for my last minisite). Anyways, having a theme and something that I was interested in made doing this a lot more fun. I was able to customize it a lot more and add in some fun quirks.
The part that I had the most fun with was doing stuff in Photoshop since I got to play with fonts and make banners and add Harry Potter swag to it. I think my favorite page might be the Diagon Alley page just because it’s so. Awesome. I’m so proud of my little banner logo. It totally looks like a mock up of Amazon and the fact that I got to make a magical equivalent to it in the form of Diagon Alley just makes me happy. I also am rather pleased with all of my individual page menu buttons. They turned out quite splendidly if I do say so myself.
Screenshot of my Diagon Alley/Amazon page
There were some things that obviously gave me quite a bit of trouble. Figuring out how to put the images in the Diagon Alley page was a pain just because I only kind of sort of knew how to do it. But with the help of the wonderful Aly Miller, I figured it out, and I’m quite pleased with how it turned out. My problem was that I had it set to search for if localStorage.hogwartsHouse was equal to “gryffindor” and not “Gryffindor.” Those darn capital letters really got me, and I was a bit frustrated that something as simple as capital letters could mess up the entire function of the JavaScript.
The intrusive JavaScript element that I decided to add that we didn’t talk about in class was a function that checks to see if a user’s password is acceptable to the website’s standards. It seems pretty useful and it works pretty well. Plus the way that the text inputs into the box is actually the little circles and not actual text, so that’s pretty cool. I edited the script a little bit because an 8 character password, which is what it originally was, is super annoying. But the function checks if it has at least one lower case and one upper case character plus a number. I got the code from this little website by literally just Googling “things you can do with javascript.” When I was searching other terms to find other things I could add with JavaScript, the results came back with super complex things that I couldn’t even begin to wrap my head around. Initially, I really wanted to add some location-based JavaScript or Geolocation, but I couldn’t find a code that I could understand or get to work, so I found something else. I modified the code, as I said, both to add more characters in the password and so that it functioned in my external JavaScript page and not just as a script element in my HTML page, which is how it was originally set up. It worked as an internal element in the HTML, but I really wanted to keep all my JavaScript in the same place. It was much neater that way.
Another problem I ran into was a bit odd, and I’m still not even exactly sure what it was. But what I really, really wanted to do for the full report page was to have a banner appear declaring what priority each individual was, because the Ministry would totally do that. It seemed so easy because I had done basically the exact same thing with the Diagon Alley page– check to see what some variable was in localStorage and then put up a picture depending on what it was. Totally simple. But for some reason, it just would not work. I was so frustrated. I copied and pasted the code exactly in separate documents, I stripped it down to the bare essentials and worked up from there, and still it just would not cooperate. The thing that kept happening was that the JavaScript only seemed to run after I refreshed the page. So I would type in the stuff in the registration page, go to the report page, and the correct text would be there, but the wrong priority banner would be there. However, when I refreshed the page, it would work. I was so frustrated because it was working… but not quite.
Finally I figured out the two things that were making this happen. Firstly, I kept hitting the back button on the browser to go back to the registration page instead of clicking the menu choice which reloaded the page completely. That was somehow messing up the travel of information and what was stored in the localStorage variables. The other thing was that I was constantly checking and adding in new options to see if they were working. The thing that I realized is that once I added something new in the JavaScript, I needed to refresh the compilation page to let it “absorb” this new information. In my mind, I was letting it get used to this new information. So I found that once I changed anything in the JavaScript, I needed to go visit the other pages of the site to make sure that that JavaScript was fully in place in that page. Then when I would start with the registration page, it would work perfectly. So essentially I needed to be more patient between my various changes in my script and let the pages “absorb” what was going on. That’s not exactly what was going on, I’m sure, but that’s how I understood it.
Anyways, I finally got it all to be working. And my favorite part is that the priority banners pop up based on Harry Potter logic. If you type in Harry Potter, your priority level automatically pops up as high, since even though he’s half blood (or pureblood?? I’m not sure how Lily’s blood plays into this since she’s a muggle-born but a witch. Does her blood become magical? That’s a Potter debate for another time), which would make him medium priority, his name bumps him up to high priority. Additionally, I made non-human ancestors bump up an individual to high priority status (since the Ministry and Dolores Umbridge just won’t tolerate that) even if the person is half or pure blood (eg. Hagrid or Fleur).