| View previous topic :: View next topic |
| Author |
Message |
philwareham
Joined: 05 Jun 2007 Posts: 9
|
Posted: Nov 17, 2008 10:21 am Post subject: Integration with jQuery framework |
|
|
Hi there,
I have a working installation of XUpload, but I want to incorporate the jQuery javascript framework on my page. However there is a conflict with the xupload.js, I think it is because I use the following jQuery recommended method to activate jQuery elements...
$(document).ready(function(){ *my jquery code here* }
Is there a way of modifying the xupload.js file so they play nice together? |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2106 Location: UFO Lab
|
Posted: Nov 17, 2008 10:31 am Post subject: |
|
|
| Try to comment $ function in xupload.js |
|
| Back to top |
|
 |
philwareham
Joined: 05 Jun 2007 Posts: 9
|
Posted: Nov 17, 2008 10:59 am Post subject: |
|
|
If I comment out...
| Code: | | function $(elem){return document.getElementById(elem);} |
At the start of the xupload.js, then my jQuery scripts all start to work as expected and the files upload to my server OK, but the upload progress box does not refresh/update at all. |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2106 Location: UFO Lab
|
Posted: Nov 17, 2008 12:11 pm Post subject: |
|
|
| Check for JS errors. PM me your URL if possible. |
|
| Back to top |
|
 |
philwareham
Joined: 05 Jun 2007 Posts: 9
|
Posted: Nov 17, 2008 1:59 pm Post subject: Solved! |
|
|
OK, PilgrimX182 found a solution for this conflict as follows...
In the xupload.js file rename function (1st line) to:
| Code: | | function $gget(elem){return document.getElementById(elem);} |
Then automatically replace all $ in xupload.js with $gget and it will be all right. |
|
| Back to top |
|
 |
Buyaphoto
Joined: 01 Jul 2008 Posts: 7
|
Posted: Feb 16, 2009 4:33 pm Post subject: same problem with mootools |
|
|
| has anyone had any luck integrating with mootools? |
|
| Back to top |
|
 |
Ugly Mau
Joined: 30 Aug 2007 Posts: 12
|
Posted: May 05, 2009 10:53 am Post subject: |
|
|
Hello,
The solution proposed by philwareham is correct?
We can use it as "official"?
Thanks |
|
| Back to top |
|
 |
PilgrimX182

Joined: 22 Mar 2006 Posts: 2106 Location: UFO Lab
|
Posted: May 05, 2009 1:08 pm Post subject: |
|
|
| This is a 'hack', but it will work for you. |
|
| Back to top |
|
 |
Ugly Mau
Joined: 30 Aug 2007 Posts: 12
|
Posted: May 05, 2009 2:29 pm Post subject: |
|
|
Ok, just to understand if this change causing other problems ...
I have the version 2.6 pro, in the version 3.0 this conflict is resolved? |
|
| Back to top |
|
 |
wfrohwein
Joined: 07 Nov 2009 Posts: 1
|
Posted: Nov 07, 2009 9:25 am Post subject: Re: Solved! |
|
|
| philwareham wrote: | OK, PilgrimX182 found a solution for this conflict as follows...
In the xupload.js file rename function (1st line) to:
| Code: | | function $gget(elem){return document.getElementById(elem);} |
Then automatically replace all $ in xupload.js with $gget and it will be all right. |
i got the new xupload pro version and i was trying to integrate with drupal which uses jquery. I renamed the xupload.js $ function to $$. I also had to modify upload.cgi. Instead of naming my function $gget like PilgrimX182 mentioned, i named it $$. So my upload.cgi looks like so:
| Code: | if($ENV{QUERY_STRING} =~ /^settings/)
{
$c->{pass_required} = $c->{upload_password}&&1;
print"Content-type: text/html\n\n";
print"$_='$c->{$_}';" for qw(ext_allowed ext_not_allowed max_upload_files max_upload_size enable_file_descr pass_required email_required);
print qq[if(\$\$('x_max_files'))\$\$('x_max_files').innerHTML = '$c->{max_upload_files}';];
print qq[if(\$\$('x_max_size'))\$\$('x_max_size').innerHTML='$c->{max_upload_size}';];
print q[if($$('x_password')){$$('x_password').style.display='block';}] if $c->{pass_required};
print q[if($$('x_folder')){$$('x_folder').style.display='block';}] if $c->{allow_ext_folder};
exit;
} |
hope that helps anyone that is having the trouble i did |
|
| Back to top |
|
 |
INTERNOZEROUNO
Joined: 23 Mar 2011 Posts: 8
|
Posted: May 04, 2011 9:21 am Post subject: Re: Solved! |
|
|
| wfrohwein wrote: | | I renamed the xupload.js $ function to $$. I also had to modify upload.cgi. |
Thank you! That works great! |
|
| Back to top |
|
 |
ssanders
Joined: 06 Mar 2012 Posts: 5 Location: Ashland, OH, USA
|
Posted: Mar 06, 2012 9:15 pm Post subject: Fix the source? |
|
|
While I adore open source so I can fix things myself...
jQuery is mad popular -- why not replace all the $() to $$() in an official release, especially for us who purchased Pro? |
|
| Back to top |
|
 |
|