Announcement

Collapse
No announcement yet.

Use prototype.js library with vBulletin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use prototype.js library with vBulletin

    When I try to incorporate the prototype.js Javascript Library into vbulletin I have the following problem:

    When I edit a message (not advanced mode) and I click the save button, it saves the message but it does not go back to the message normally (the editor window remains).

    The javascript error (from FireFox Error Log):
    Error: this.popups[popupname].parentNode has no properties
    Source File: http://forums.deadgod.net/clientscri...tedit.js?v=364
    Line: 1141

    That line (bold):
    Code:
    	/**
    	* Destroy Popup
    	*/
    	this.destroy_popup = function(popupname)
    	{
                    [b]this.popups[popupname].parentNode.removeChild(this.popups[popupname]);[/b]
    		this.popups[popupname] = null;
    	}
    I spoke to people who develop the prototype library and they are not sure of the exact problem as they are not familiar with that code.. But they say typically only problems arise with quickly written/poorly written javascript.

    I would very much like to be able to use prototype with vBulletin, if you have any ideas as to what is causing this or how to fix it please share.

  • #2
    It's not vBulletin's fault... well, maybe.

    Prototpye must've used a same or similar named library for something in that line (perhaps a class with a same name; but without that attribute). So when you included prototype.js, your browser doesn't know which one to use and then farks things up in a real fun way by telling you there's an error and stop execution.

    If I was correct on the above, what could be a solution? None. ...Unless you want to re-write prototype.js's libraries or vBulletin's libraries. But please note that I don't think both parties (vBulletin/Prototype.js developers) would be willing to change variable name and break their naming conventions...
    Best Regards,
    Andy Huang

    Comment


    • #3
      I don't think it's a naming problem, afterall the only two unique names given in the vbulletin function are popups and popupname, neither are found in prototype.js

      Prototype overloads many underlining objects/functions in javascript in an effort to enhance it.

      For example, if you create an Array object while prototype is loaded the array object will be loaded with many other objects, as prototype extends the Array.prototype.

      I believe something similar is going on here, but I don't know what.

      I was hoping someone may have specific experience with prototype + vbulletin.

      I understand that this is most likly a lost cause asking for help here, just hoping for some luck with someone who's had this issue =)

      What I'm trying to do specifically is be able to use either the moo.fx or the scriptaculous special effects library. Both of which require prototype (well, moo.fx can use mootools instead, but since it's basically a copy of prototype it causes the same problems).

      Comment


      • #4
        has anyone successfully integrated prototype into vB? I've spent far too much time figuring out what the issues are between them.
        Yogi
        Tribalwar | Go Terps

        Comment


        • #5
          Found the issue.

          vB uses a lot of "for (var i in array_var)" and any extensions to Array's prototype will show up as i and won't be a real object.

          The easiest change to make is change that loop to be: "for (var i=0; i < array_var.length; i++)"

          Not sure if this is a change the vB folks would be willing to make (or are even able to make).

          Another possible solution is to do something like:
          if(typeof x[i] == 'function') continue;
          Last edited by YogiTW; Sun 11 Feb '07, 1:00pm.
          Yogi
          Tribalwar | Go Terps

          Comment


          • #6
            After doing a grep on everything in clientscript, it's only 36 times where this happens.
            Yogi
            Tribalwar | Go Terps

            Comment


            • #7
              I uploaded a fix to vbulletin.org

              http://www.vbulletin.org/forum/showthread.php?t=139175
              Yogi
              Tribalwar | Go Terps

              Comment


              • #8
                Awesome. Thanks

                Comment


                • #9
                  I know it's been a long time on this issue but thank you very much.
                  There's just so much you can do with prototype and scriptalicious/mootools to efficently make very nice looking effects.

                  Anyway, thank you!

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X