Google+

Prelude

Ughh.. AP Comp Sci. I thought it would be a chill class because it’s all basic Java. But I seriously, seriously hate it.

It’s not hard. And I BS all the homework and projects. For an AP class, it’s on par with Environmental Sciences. But we’re just wasting time in that class.

The methodology and thinking process might be good. But seriously, who uses Java? You don’t see multi-billion dollar companies based on Java. Normal people tend not to have JRE. What is the friggen point. You will literally hear me say "stupid waste of time" ten times during any given class period.

(I will not complain about specifics, so I don’t bore all of you.)

But there’s one language that’s very very useful. Unless you were hiding under a rock for the past ten years, you have heard of it.

It’s... JavaScript! Yes! Ten times more useful than Java. Why? Well simply put, the only similarities that Java and JavaScript have in common is.. their name.

JavaJavaScript
Runs by itself.Runs in your Internet Browser
Coffee Cup thing.No real logo.
You might hear once in a while.Major fighting point in browser wars.
Taught in AP Comp Sci.Uh.. Not taught in AP Comp Sci.
A programming language.Awesome.


See the difference?

So, now I’m going to show you first hand how awesome JavaScript is in comparison to Java with three practical things you can do with JavaScript:

**No, you don’t need to be super-smart to understand this. It’ll be simple (i promise)**

and you won’t need anything but an Internet Browser


1. Messing Around

At first, this trick seems really stupid. But you wouldn’t believe how fun it is. (see below screenshot)


Image: example.png

Behold, the final product.


The idea is simply, Replacing Text. We look for text, and we replace it with something else!

First of all, everything I will be doing in this tutorial will be done, from the Address Bar! (Also known as the URL Bar, the Awesome Bar, and the Omnibar.)

Clear the address bar and type in javascript: into the Address bar. Make sure that it looks like this:


Image: protocol.png

Yay a picture!


technical explanation: This is the JavaScript protocol. All JavaScript that you type into a Address Bar must begin with javascript:


Use this as a reference later: Lol


BTW Do this on RogerHub.com, not Google.


Now, after the javascript: part, type in:

document.body.innerHTML = document.body.innerHTML.replace("Lol","l0l"); void(0);


So.. the entire thing should look like:

javascript:document.body.innerHTML = document.body.innerHTML.replace("Lol","l0l"); void(0);


Now, press ENTER


Image: seethelol.png

Scroll up and look at the reference text above. If you don’t see something like this, try restarting your Internet Browser.

Now.. go back to the code! It’s really not that hard to memorize:

javascript:document.body.innerHTML = document.body.innerHTML.replace("Lol","l0l"); void(0);

Don’t change anything but "Lol" and "l0l". (Make sure you keep the quotation marks in there!!)

The first word is the word you are trying to change. And you are changing it to the second word.


**More Examples:

javascript:document.body.innerHTML = document.body.innerHTML.replace("you","j00"); void(0);

javascript:document.body.innerHTML = document.body.innerHTML.replace("Images","pix"); void(0);


Get the gist of it?

If you want to change more than one instance of the text, use this code:


javascript:document.body.innerHTML = document.body.innerHTML.replace(/Images/g,"pix"); void(0);


Change Images and pix to whatever you want. But keep the slashes and the g.


Image: norris.png

Um... yeah.


2. Cheating

This trick is a bit harder and longer to do than the previous one. Don’t even think about "that’s what she said".


Image: result.PNG

The final result.


Well, first, we need to do some recon. (gathering information)

I will be using Conjuguemos.com for my demonstration:


http://conjuguemos.com/home/docs/nologin/spanish_vocabulary_book_124.html


Click that link above, and do this:

Internet Explorer: Click the View menu and press Page Source.

Everyone else: On your keyboard, press CTRL + U


Image: pagesource.png

This thingy shows you the underlying code of the page you are viewing. The code is called the Page Source.


We need to search for files that have the ending .js So, do a CTRL + F and search for .js


On this particular document, we find 2 instances of .js

Image: finding.png

See the file name? It says vocabulary313.js.


Vocabulary313? The number at the end just tells you that whatever’s inside must be specific to certain pages.

So, click on the link (http://conjuguemos.com/home/activities/public/vocabulary/vocabulary313.js) and look what’s inside:

Image: answers.png

A boring list of Questions and Answers.


So, nothing too important (lol). Answers might be useful, but we’re looking for something even better.

There’s another .js in the Page Source. (see below pic)


Image: otherjs.png

Vocabulary.js? Looks promising

Click on the link (http://conjuguemos.com/home/docs/php/javascript/vocabulary.js) You should see something like this:

Image: variables.png

There’s a whole bunch of things with the format foo=bar;


These things that look like foo=bar; are called Variables. Just like in Math, Variables store information.

Two of these variables catch my eye: attempted and correct.

You can probably figure out what these variables store. But the question is, how do I change them? Well, Simple:

javascript:variablename = value; void(0);


The variable name is.. well, the name of the variable. In this case, the names are "attempted" and "correct".

Choose any value you want. Values can be numbers like 3 and 4294967296, or they can be text like "Hello" or "ROGER is AWESOME".

Obviously, our goal is to increase the number of "Corrects" and "Attempted".

NOTE: In this special case, you have to press the "START" button first. Or it wont register the changes.


Image: thecode.png

First, I’m gonna change the "attempted" variable.

Image: thecode2.png

Next I’m gonna change the "correct" variable.


Now, try clicking the View button. Yep that’s it! You can even send the score to your teacher. It looks completely legitimate, (unless you put like 20 attempted 20000 correct)


3. Annoying


Image: sigma.png


This, is sigma notation.


Image: infinite.png


This, is a summation of an infinite series.


Image: infiniteloop.gif


This, is awesome.


This trick spouts a message box that reappears after you try to close it. Very annoying :)

javascript:while(true)alert("Hello!");


You can replace "Hello!" with anything you want.

It’s easy to do on friends when they turn their backs on their computers. (If you can memorize it)

For added fun, change the message to "VIRUS!" or something.

You can also use prompt("Hello!"); or confirm("Hello!"); for some different kinds of dialog boxes.


--------


Image: Photo1096.jpg

What a delightful bun!

Now.. answer the poll:

Poll
    Q: Does it look real?
  • yeah gimme one pl0x :)
  • 350%
  • no that looks like plastix
  • 350%


    --------

    Image: yumm.jpg

    Yumm!

    -Number Phenomenon-

    A Pokémon Soul Silver save file consists of 4 Megabits (4,194,304 bits = 524,288 bytes) of data

    The total number of combination of save files is approximately 101517824 (99.9% of these will crash your game).

    How does it make you feel, that every time you save your game, you are merely choosing one of the 101517824 combinations?

    How does it feel to know that your name, pokemon (type, level, stats), items, location and progress have all been preset and determined, long before you ever touched the game?

    How does it feel that your entire identity along with (hundreds of) hours of hard work can be represented in full with a single number from 1 to 101517824?

    Can you still consider yourself unique?




    Relient K - Who I Am Hates Who I’ve Been



    Linkin Park - Easier To Run

    Omg i haven’t heard this song in years. Thanks julian for bringing it up again :)


    -Roger

    5 CommentsAdd one

    sus
    Thu, 14 Dec 2023 01:49:06 GMT

    sus!

    Canuck
    Tue, 25 Jan 2011 21:11:26 GMT

    http://www.addeffects.net has many CSS & java scriptlets to use with web browser for adding effects to any webpage, just enter a URL.

    Example usage:
    http://rogerhub.com.addeffects.net/archives/179
    http://www.yahoo.com.addeffects.net

    clairec
    Sun, 04 Apr 2010 06:10:45 GMT

    NEVERMIND ROGER about the ipod thing haha

    James
    Mon, 29 Mar 2010 03:19:22 GMT

    10^1517824 is much more than the world’s population. (approx 7x10^9)... So yes, indeed I do... though I don’t even play pokemon.

    Allan
    Sat, 27 Mar 2010 03:32:02 GMT

    I cant believe that you hate the class with such hate and passion, and it all boils down to the fact that we learn Java? is that seriously your main reason?

    Post a Comment

    Mon, 30 Dec 2024 17:20:35 GMT