Facebook Invites

By niknah Last update Oct 11, 2011 — Installed 274,371 times.

New page logic: help, JS wizards

in
Subscribe to New page logic: help, JS wizards 3 posts, 3 voices



Rebecca Mene... User
FirefoxX11

I've got enough skill in debugging unfamiliar languages to spot the two obvious problems:

1) The target URL's changed to something like (using Street Racing as an example):

http://www.facebook.com/social_graph.php?node_i...

...where node_id is the fbappID.

2) The current script logic assumes there's going to be a "next" button with an onclick attribute, and simply executes the onclick code for the appropriate button until it reaches a page where there's no "next" button. The appropriate test is probably to see if you have an item of class *UIPager_ButtonForward, and then, if there is one, click it.

My real problem is #2, where I'm trying to untangle BulkAddMePrevPage, where I assume -most- of the logic can go away. I can just can't parse what part of the logic can go, what I need to replace, and most especially what I need to replace it with. Sorry, not nearly enough JS experience yet.

I suspect these are the only two fixes necessary; the actual page -content-, apart from the prev/next button changes, seems to be the same as before.

 
Lord.Quackstar User
FirefoxWindows

I think a problem with the way this script is programmed is that there is no clear separation between functions. I consider myself very good with js but its extremely hard to understand what's going on.

A new, better, and easier to understand coding style is to give each major function a singleton. This means that bulk add me would have a var, friend lists/invite boxes would have a var, bulk click would have a var, and global functions (the current nHtml var) would have its own var. All singletons could also be tabbed. This would make finding the different singletons 50x easier. Functions could also have comments telling what they do. They don't have to as described as in some other programs (where each function has 6 lines of comment before it), but a simple "This does this" would be nice.

Some advantages of this is that it would be much easier to debug. There are many JS programmers out there that could offer suggestions and fix problems faster than you could. Debugging would be alot easier than you could.

 
ViXaY Xavier Scriptwright
FirefoxWindows

The script is coded using a style that I am not accustomed to, but it's not too difficult to understand. There are different functions with clear boundaries but they are encapsulated in objects. Functions are defined with names in front then the declaration. E.g. TestFuncion: function ().

nHTML provides utility functions for parsing/managing html content on the page.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel