Results 1 to 6 of 6

Thread: View Object

  1. #1
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default [JS] View Object

    This is a script I came up with for site development. It provides a GUI for viewing objects, their properties, and their methods. Any variable type is acceptable.

    HowTo:
    Place this code at the beginning of your page and in your following scripts you
    call the function viewObject(object, bool). The bool argument is optional and has
    a default value of false. If explicitly set as true, the window the viewObject function
    creates is minimized. viewObject creates a window that has all the inside stuff of the object
    displayed, along with all their values (if there are any). You can drag the window by clicking
    and holding down on the numbered box of the window's top right corner. The number in the box
    signifies the number of times the function has been called. If that region is double clicked,
    then the window minimizes. You can click on the bullets before each property to view that object
    in a GUI window. Hitting Ctr+Shift+Z closes all the GUI windows. Crt+Shift+MouseClick views the object
    that the mouse hovers over.

    Edit: Both the key codes for both the shortcuts are customizable. You can add, change, and/or remove the key shortcuts for either command. There is a place early on in the source code with customizable variables.

    Oh, and if the object has innerHTML, outerHTML, innerText, outerText, or textContent, the code does not display them due to speed issues. But that shouldn't be an issue. Just use other attributes, such as childNodes and nodeValue.

    (Updated Code; you may have to recache the script.)

    Source Code:
    http://trinithis.awardspace.com/view.../viewObject.js

    Demo:
    http://trinithis.awardspace.com/viewObject/Test.html

    If you so desire, you can make this in to a greasemonkey .user.js file, but seeing that I don't have greasemonkey, I won't do it. (I don't have greasemonkey because I have to use an old FF browser 1.0.7 since all the other ones I have tried hang my dial-up. Yes, dial-up. And I can't seem to find an old greasemonkey anymore...)
    Last edited by Trinithis; 05-23-2007 at 05:09 AM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You should provide a different shortcut... alt-click is taken by a lot of window managers.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    No functionality in safari and the layout seems wrong on the windows compared to FF. The close, etc. links work, but that's it. No keyboard input or anything with the mouse.

    FF on mac has much of the same trouble, though a bit of limited functionality. the ctrl key on a mac is of a very different nature and actually enables right click with the mouse. This makes things weird.

    Not testing on a PC and it might work great there. But on a mac, it's a mess.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    I've only tested it on FF 1.0.7, IE 6.0.28, and SBC Yahoo Browser 5.02 on windows. As I have no access to a mac, well I can't test it there.

    When displayed in my IE, the boxes are slightly spaced apart due to whether or not the browser renders borders in or out of the elements, but to me it was not a big enough issue to "fix". So I decided to make FF my main focus in looks.

    FF


    IE



    Any ideas for shortcut keys to use that would be good in general?
    Last edited by Trinithis; 05-20-2007 at 11:06 PM.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Well, it's not exactly your fault that it doesn't work on a mac, but something to think about.

    shift is a good key for both platforms and usually doesn't do much to the page.

    control and alt are good, but then you run into problems on a mac, as said above. They also have system functions associated with them (mac and pc), so that's not good either.

    Really, the simple answer here is that you shouldn't be doing what you're doing because the web is designed for presenting info for the most part, not interaction from the keyboard, etc.
    It's a cool idea, so I'm not saying you're 'wrong', but browsers and such just aren't designed for this at this time.

    I think the most important thing to remember is that some of these features are nice, but that there should always be a backup when they don't work, as you'll run into problems a lot. Having a close link instead of just the keyboard command is good, for example.

    Another thing to keep in mind is the "find as you begin typing" feature in firefox (and similar functions) which, as a system/application command, SHOULD take precedence over anything you are using on the page itself.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You could use a mouse sequence... double-click should do it since it's a debug feature. I don't know of any browser that performs a vital function with double-click.

    Actually, wait, no. Opera does. Perhaps you could rig a key sequence -- press a then click?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •