1var CHERRY_API; 2 3(function($){ 4 'use strict'; 5 6 CHERRY_API = { 7 name : 'Cherry Js API', 8 varsion : '1.0.0', 9 author : 'Cherry Team', 10 11 variable : { 12 $document : $( document ), 13 $window : $( window ), 14 browser : $.browser, 15 browser_supported : true, 16 security : cherry_ajax, 17 loaded_assets : { 18 script : wp_load_style, 19 style : wp_load_script 20 } 21 }, 22 23 status : { 24 on_load : false, 25 is_ready : false 26 }, 27 28 init : function(){ 29 30 CHERRY_API.set_variable (); 31 32 $( document ).ready( CHERRY_API.ready ); 33 34 $( window ).load( CHERRY_API.load ); 35 }, 36 37 set_variable : function(){ 38 //set variable browser_supported 39 CHERRY_API.variable.browser_supported = ( function (){ 40 var uset_browser = CHERRY_API.variable.browser, 41 not_supported = { 'msie' : [8] }; 42 43 if(typeof uset_browser == "undefined") { 44 uset_browser = {"browser": "undefined"}; 45 } 46 for ( var browser in not_supported ) { 47 if( uset_browser.browser != 'undefined' ){ 48 for ( var version in not_supported[ browser ] ) { 49 if( uset_browser.version <= not_supported [ browser ] [ version ] ){ 50 return false; 51 } 52 } 53 } 54 }; 55 56 return true; 57 }() ) 58 }, 59 60 ready : function(){ 61 CHERRY_API.status.is_ready = true; 62 }, 63 64 load : function(){ 65 CHERRY_API.status.on_load = true; 66 }, 67 68 utilites : { 69 namespace : function( space_path ){ 70 var parts = space_path.split( '.' ), 71 parent = CHERRY_API, 72 length = parts.length, 73 i = 0; 74 75 for(i = 0; i < length; i += 1 ){ 76 if( typeof parent[ parts[ i ] ] === 'undefined' ){ 77 parent[ parts[ i ] ] = {}; 78 } 79 parent = parent[ parts[ i ] ]; 80 } 81 return parent; 82 }, 83 get_compress_assets: function ( url, callback ){ 84 var data = { 85 action : 'get_compress_assets', 86 security : CHERRY_API.variable.security, 87 style : [], 88 script : [] 89 }, 90 reg_name = /([\S.]+\/)/gmi, 91 reg_type = /(\.js|\.css)/gmi, 92 callback_function = callback || function(){}; 93 94 if( !$.isArray( url ) ){ 95 url = [ url ]; 96 } 97 98 for( var index in url ){ 99 var file_url = url[ index ], 100 file_name = file_url.replace( reg_name, '' ), 101 file_type = file_url.match( reg_type )[ 0 ]; 102 103 if( file_type === '.js' && $.inArray( file_name, CHERRY_API.variable.loaded_assets.script ) == -1 ){ 104 data.script.push( file_url ); 105 CHERRY_API.variable.loaded_assets.script.push( file_name ); 106 } 107 108 if( file_type === '.css' && $.inArray( file_name, CHERRY_API.variable.loaded_assets.style ) == -1 ){ 109 data.style.push( file_url ); 110 CHERRY_API.variable.loaded_assets.style.push( file_name ); 111 } 112 } 113 114 $.get(ajaxurl, data, function(response) { 115 var json = $.parseJSON(response), 116 compress_style = json.style, 117 compress_script = json.script; 118 119 if(compress_style){ 120 var style = document.createElement('style'), 121 styleSheet; 122 123 style.type = 'text/css'; 124 style.media = 'all'; 125 style.innerHTML = compress_style; 126 127 $('body', document).append(style); 128 129 } 130 131 if(compress_script){ 132 var script = new Function(compress_script)(); 133 } 134 135 return callback_function(); 136 }); 137 } 138 } 139 }; 140 141 CHERRY_API.init(); 142}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.