added the codepot_merge_path() javascript function
This commit is contained in:
		| @ -33,7 +33,7 @@ function prepare_page_button (i, req_size) | |||||||
| 			var filter = codepot_ascii_to_hex(last_successful_filter); | 			var filter = codepot_ascii_to_hex(last_successful_filter); | ||||||
| 			var offset = parseInt($(this).text()); | 			var offset = parseInt($(this).text()); | ||||||
| 			$.ajax({ | 			$.ajax({ | ||||||
| 				url: "<?php print site_url(); ?>/project/catalog_json/" + filter + "/" + ((offset  - 1) * req_size), | 				url: codepot_merge_path("<?php print site_url(); ?>", "/project/catalog_json/" + filter + "/" + ((offset  - 1) * req_size)), | ||||||
| 				dataType: "json", | 				dataType: "json", | ||||||
| 				success: function(data) { render_project_list (data); } | 				success: function(data) { render_project_list (data); } | ||||||
| 			}); | 			}); | ||||||
| @ -146,7 +146,7 @@ $(function () { | |||||||
| 			var filter = codepot_ascii_to_hex(last_attempted_filter); | 			var filter = codepot_ascii_to_hex(last_attempted_filter); | ||||||
|  |  | ||||||
| 			$.ajax({ | 			$.ajax({ | ||||||
| 				url: "<?php print site_url(); ?>/project/catalog_json/" + filter, | 				url: codepot_merge_path("<?php print site_url(); ?>", "/project/catalog_json/" + filter), | ||||||
| 				dataType: "json", | 				dataType: "json", | ||||||
| 				success: function(data) { render_project_list (data); } | 				success: function(data) { render_project_list (data); } | ||||||
| 			}); | 			}); | ||||||
|  | |||||||
| @ -53,7 +53,7 @@ function render_wiki() | |||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	$("#project_home_sidebar_log_all_button").button ().click (function () { | 	$("#project_home_sidebar_log_all_button").button ().click (function () { | ||||||
| 		$(location).attr ('href', "<?php print site_url(); ?>/project/log/" + "<?php print $project->id; ?>"); | 		$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", "/project/log/" + "<?php print $project->id; ?>")); | ||||||
| 	}); | 	}); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ $(function () { | |||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	$("#site_home_sidebar_log_all_button").button ().click (function () { | 	$("#site_home_sidebar_log_all_button").button ().click (function () { | ||||||
| 		$(location).attr ('href', "<?php print site_url(); ?>/site/log"); | 		$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", "/site/log")); | ||||||
| 	}); | 	}); | ||||||
| }); | }); | ||||||
| </script> | </script> | ||||||
|  | |||||||
| @ -163,13 +163,13 @@ $(function () { | |||||||
| 			var term = codepot_string_to_hex(request.term); | 			var term = codepot_string_to_hex(request.term); | ||||||
|  |  | ||||||
| 			$.ajax({ | 			$.ajax({ | ||||||
| 				url: "<?php print site_url(); ?>/project/quickfind_json/" + term, | 				url: codepot_merge_path("<?php print site_url(); ?>", "/project/quickfind_json/" + term), | ||||||
| 				dataType: "json", | 				dataType: "json", | ||||||
| 				success: function(data) { response(data); }, | 				success: function(data) { response(data); }, | ||||||
| 			}); | 			}); | ||||||
| 		}, | 		}, | ||||||
| 		select: function( event, ui ) { | 		select: function( event, ui ) { | ||||||
| 			$(location).attr ('href', "<?php print site_url(); ?>/project/home/" + ui.item.id); | 			$(location).attr ('href', codepot_merge_path("<?php print site_url(); ?>", "/project/home/" + ui.item.id)); | ||||||
| 			//ui.item.value , ui.item.id ,  this.value | 			//ui.item.value , ui.item.id ,  this.value | ||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
|  | |||||||
| @ -62,6 +62,7 @@ | |||||||
| 	white-space: -moz-pre-wrap; | 	white-space: -moz-pre-wrap; | ||||||
| 	white-space: -o-pre-wrap; | 	white-space: -o-pre-wrap; | ||||||
| 	white-space: pre-wrap; | 	white-space: pre-wrap; | ||||||
|  | 	color: #333333; | ||||||
| } | } | ||||||
|  |  | ||||||
| #log_mainarea_result_table td.pages { | #log_mainarea_result_table td.pages { | ||||||
|  | |||||||
| @ -442,3 +442,19 @@ function codepot_string_to_hex (x) | |||||||
| 	var utf8 = codepot_utf8_encode(x); | 	var utf8 = codepot_utf8_encode(x); | ||||||
| 	return codepot_ascii_to_hex(utf8); | 	return codepot_ascii_to_hex(utf8); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function codepot_merge_path (base, path) | ||||||
|  | { | ||||||
|  | 	// | ||||||
|  | 	// if 'base' ends with '/', remove all leading slashes off 'path' | ||||||
|  | 	// before adding 'base' and 'path'. | ||||||
|  | 	// | ||||||
|  | 	if (base.charAt(base.length - 1) == "/") | ||||||
|  | 	{ | ||||||
|  | 		var i; | ||||||
|  | 		for (i = 0; path.charAt(i) == '/'; i++); | ||||||
|  | 		return base + path.substr(i); | ||||||
|  | 	} | ||||||
|  | 	else return base + path; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user