jQuery conflict

Phoca Download - download manager
nooraban
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 27 Nov 2014, 12:18

jQuery conflict

Post by nooraban »

Hi,
Where are these functions:

Code: Select all

function pdRating(id, vote) {
		
			var result 			= "pdresult" + id;
			var resultvoting 	= "pdvoting" + id;
			var pdRequest = new Request.JSON({
			url: "index.php?option=com_phocadownload&view=ratingfilea&task=rate&format=json&4f47c9ea185e33dccfff804a5f1d33cc=1",
			method: "post",
			
			onRequest: function(){
				$(result).set("html", "<img src=\"http://localhost/chemeng.ir8test/components/com_phocadownload/assets/images/icon-loading2.gif\" alt=\"\" />");
			  },
			
			onComplete: function(jsonObj) {
				try {
					var r = jsonObj;
				} catch(e) {
					var r = false;
				}
			
				if (r) {
					if (r.error == false) {
						$(result).set("text", jsonObj.message);
						
						// Refreshing Voting
						var pdRequestRefresh = new Request.JSON({
							url: "index.php?option=com_phocadownload&view=ratingfilea&task=refreshrate&small=1&format=json&4f47c9ea185e33dccfff804a5f1d33cc=1",
							method: "post",
							
							onComplete: function(json2Obj) {
								try {
									var rr = json2Obj;
								} catch(e) {
									var rr = false;
								}
							
								if (rr) {
									$(resultvoting).set("html", json2Obj.message);
								} else {
									$(resultvoting).set("text", "Error while requesting rating");
								}
							},
						
							onFailure: function() {
								$(resultvoting).set("text", "Error while requesting rating");
							}
						})
				  
						pdRequestRefresh.send({
							data: {"ratingId": id, "ratingVote": vote, "format":"json"}
						});
						//End refreshing voting
						
					} else {
						$(result).set("html", r.error);
					}
				} else {
					$(result).set("text", "Error while requesting rating");
				}
			},
			
			onFailure: function() {
				$(result).set("text", "Error while requesting rating");
			
			}
			})
	  
			pdRequest.send({
				data: {"ratingId": id, "ratingVote": vote, "format":"json"},
			});
  
		};
There is a jQuery conflict in my code and I have to use noconflict for those function, What is file and directory?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: jQuery conflict

Post by Jan »

Hi, here:
administrator\components\com_phocadownload\helpers\phocadownloadrate.php

Yes, this is good idea to change from $ to jQuery.

Please if you will change it and will test it, can you paste here the confirmation, it works with jQuery.

Thank you, Jan
If you find Phoca extensions useful, please support the project
nooraban
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 27 Nov 2014, 12:18

Re: jQuery conflict

Post by nooraban »

Thank you so much Jan,
It solved just by adding jQuery $.noConflict(); before functions,
like this:

Code: Select all

<!--

		function pdRating(id, vote) {
			$.noConflict();
			
			var result 			= "pdresult" + id;
			var resultvoting 	= "pdvoting" + id;
			var pdRequest = new Request.JSON({
			url: "index.php?option=com_phocadownload&view=ratingfilea&task=rate&format=json&df4e468f2362e5b838058a654a12ba30=1",
			method: "post",
			
			onRequest: function(){
				$(result).set("html", "<img src=\"http://localhost/chemeng.ir8test/components/com_phocadownload/assets/images/icon-loading2.gif\" alt=\"\" />");
			  },
			
			onComplete: function(jsonObj) {
				try {
					var r = jsonObj;
				} catch(e) {
					var r = false;
				}
			
				if (r) {
					if (r.error == false) {
						$(result).set("text", jsonObj.message);
						
						// Refreshing Voting
						var pdRequestRefresh = new Request.JSON({
							url: "index.php?option=com_phocadownload&view=ratingfilea&task=refreshrate&small=1&format=json&df4e468f2362e5b838058a654a12ba30=1",
							method: "post",
							
							onComplete: function(json2Obj) {
								try {
									var rr = json2Obj;
								} catch(e) {
									var rr = false;
								}
							
								if (rr) {
									$(resultvoting).set("html", json2Obj.message);
								} else {
									$(resultvoting).set("text", "Error while requesting rating");
								}
							},
						
							onFailure: function() {
								$(resultvoting).set("text", "Error while requesting rating");
							}
						})
				  
						pdRequestRefresh.send({
							data: {"ratingId": id, "ratingVote": vote, "format":"json"}
						});
						//End refreshing voting
						
					} else {
						$(result).set("html", r.error);
					}
				} else {
					$(result).set("text", "Error while requesting rating");
				}
			},
			
			onFailure: function() {
				$(result).set("text", "Error while requesting rating");
			
			}
			})
	  
			pdRequest.send({
				data: {"ratingId": id, "ratingVote": vote, "format":"json"},
			});
  
		};
//-->
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: jQuery conflict

Post by Jan »

Ok

Jan
If you find Phoca extensions useful, please support the project
Post Reply