turn of problematic setting of dataTable
[unfold.git] / manifold / js / manifold-core-leftovers.js
1 /*
2  * This file is included in tophat_render.php
3  */
4
5 /* getting random error messages with this... -- jordan
6    wait until query code is fixed
7 jQuery(document).ready(function() {
8     // ajax default settings
9     jQuery.ajaxSetup({
10         timeout: 3000,
11         error:function(x,e){
12             if('parsererror'==e) {
13                 alert('Sorry, we ran into a technical problem (parse error). Please try again...');
14             } else if('timeout'==e) {
15                 alert('Request timed out. Please try again...');
16             }
17             else if ( "status" in x ) {
18                 if(0 == x.status){
19                     alert('You are offline! Please check your network.');
20                 }else if (404 == x.status){
21                     alert('Sorry, we ran into a technical problem (404). Please try again...');
22                 }else if(500 == x.status){
23                     alert('Sorry, we ran into a technical problem (500). Please try again...');
24                 }
25             }
26             else {
27                 alert('Sorry, we ran into a technical problem (unknown error). Please try again...');
28             }
29         }
30     });
31 });
32 */
33
34 /*
35 From: http://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-clone-a-javascript-object
36     I want to note that the .clone() method in jQuery only clones DOM elements. In order to clone JavaScript objects, you would do:
37
38     // Shallow copy
39     var newObject = jQuery.extend({}, oldObject);
40
41     // Deep copy
42     var newObject = jQuery.extend(true, {}, oldObject);
43
44     More information can be found in the jQuery documentation <http://docs.jquery.com/Utilities/jQuery.extend>
45 */
46 function clone_object(obj) {
47     return jQuery.extend(true, {}, obj);
48 }
49
50 function executeFunctionByName(functionName, context /*, args */) {
51   var args = Array.prototype.slice.call(arguments).splice(2);
52   var namespaces = functionName.split(".");
53   var func = namespaces.pop();
54   for(var i = 0; i < namespaces.length; i++) {
55     context = context[namespaces[i]];
56   }
57   return context[func].apply(this, args);
58 }