PageRenderTime 37ms CodeModel.GetById 18ms app.highlight 14ms RepoModel.GetById 2ms app.codeStats 0ms

/www/jquery.jqGrid.js

http://cupsfilter.googlecode.com/
JavaScript | 67 lines | 60 code | 2 blank | 5 comment | 11 complexity | bd9b8230e5ce9d92439ad53cc1f67bfc MD5 | raw file
 1function jqGridInclude()
 2{
 3    var pathtojsfiles = "js/"; // need to be ajusted
 4    // set include to false if you do not want some modules to be included
 5    var combineIntoOne = false; 
 6    var combinedInclude = new Array();
 7    var combinedIncludeURL = "combine.php?type=javascript&files=";
 8    var minver = true;
 9    var modules = [
10        { include: true, incfile:'grid.locale-ru.js',minfile: 'min/grid.locale-ru-min.js'}, // jqGrid translation
11        { include: true, incfile:'grid.base.js',minfile: 'min/grid.base-min.js'}, // jqGrid base
12        { include: false, incfile:'grid.common.js',minfile: 'min/grid.common-min.js' }, // jqGrid common for editing
13        { include: false, incfile:'grid.formedit.js',minfile: 'min/grid.formedit-min.js' }, // jqGrid Form editing
14        { include: false, incfile:'grid.inlinedit.js',minfile: 'min/grid.inlinedit-min.js' }, // jqGrid inline editing
15        { include: true, incfile:'grid.celledit.js',minfile: 'min/grid.celledit-min.js' }, // jqGrid cell editing
16        { include: true, incfile:'grid.subgrid.js',minfile: 'min/grid.subgrid-min.js'}, //jqGrid subgrid
17        { include: false, incfile:'grid.treegrid.js',minfile: 'min/grid.treegrid-min.js'}, //jqGrid treegrid
18        { include: true, incfile:'grid.custom.js',minfile: 'min/grid.custom-min.js'}, //jqGrid custom 
19        { include: true, incfile:'grid.postext.js',minfile: 'min/grid.postext-min.js'}, //jqGrid postext
20        { include: false, incfile:'grid.tbltogrid.js',minfile: 'min/grid.tbltogrid-min.js'}, //jqGrid table to grid 
21        { include: true, incfile:'grid.setcolumns.js',minfile: 'min/grid.setcolumns-min.js'}, //jqGrid setcolumns
22        { include: false, incfile:'grid.import.js',minfile: 'min/grid.import-min.js'}, //jqGrid import
23        { include: true, incfile:'jquery.fmatter.js',minfile: 'min/jquery.fmatter-min.js'}, //jqGrid formater
24        { include: true, incfile:'json2.js',minfile: 'min/json2-min.js'}, //json utils
25        { include: false, incfile:'JsonXml.js',minfile: 'min/JsonXml-min.js'} //xmljson utils
26    ];
27    var filename;
28    for(var i=0;i<modules.length; i++)
29    {
30        if(modules[i].include === true) {
31        	
32        	if (minver !== true) filename = pathtojsfiles+modules[i].incfile;
33        	else filename = pathtojsfiles+modules[i].minfile;
34        	if (combineIntoOne !== true) {
35        		if(jQuery.browser.safari || jQuery.browser.msie ) {
36        			jQuery.ajax({url:filename,dataType:'script', async:false, cache: true});
37        		} else {
38        			IncludeJavaScript(filename);
39        		}
40        	} else {
41        		combinedInclude[combinedInclude.length] = filename;
42            }
43        }
44    }
45	if ((combineIntoOne === true) && (combinedInclude.length>0) ) {
46		var fileList = implode(",",combinedInclude);
47		IncludeJavaScript(combinedIncludeURL+fileList);
48	}
49	function implode( glue, pieces ) {
50    // http://kevin.vanzonneveld.net
51    //original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
52    //example 1: implode(' ', ['Kevin', 'van', 'Zonneveld']);
53    //returns 1: 'Kevin van Zonneveld'
54		return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces );
55    };
56    
57    function IncludeJavaScript(jsFile)
58    {
59        var oHead = document.getElementsByTagName('head')[0];
60        var oScript = document.createElement('script');
61        oScript.type = 'text/javascript';
62        oScript.charset = 'utf-8';
63        oScript.src = jsFile;
64        oHead.appendChild(oScript);        
65    };
66};
67jqGridInclude();