1function _dynamicContent( id, layer, params ) { 2 3 this.id = id; 4 this.jQ = layer; 5 this.params = jQuery.extend( {}, _.plugins.nvx._private_.defaults, params, true ); 6 7 this.type = "nvx"; 8 9 this.ns = this.params.ns; 10 this.act = this.params.act; 11 this.pID = this.params.pID; 12 13 this.ready = false; 14 15 this.one = false; 16 17 this.disabled = this.params.disabled; 18 19// this.URL = this.params.URL||""; 20 21 this.loading = false; 22 23} 24 25_dynamicContent.prototype = { 26 27 init: function() { 28 29 var _self = this; 30 31 // console.log(_self.id); 32 // console.log(_.env.STATICS.EVENTS[ _self.params.evt ]); 33 34 _self.jQ.off(); 35 _self.jQ.on( _.env.STATICS.EVENTS[ _self.params.evt ], function(e) { 36 37 e.preventDefault(); 38 e.stopPropagation(); 39 40 if( _self.one || _self.disabled ) return; 41 42 if ( _self.jQ.attr("href") && _self.jQ.attr("href") != "" && _self.jQ.attr("href") != "#" ) { 43 _self.URL = _self.jQ.attr("href"); 44 _self.params.ajx = false; 45 } else { 46 _self.params.ajx = true; 47 _self.URL = _self.params.URL; 48 } 49 50 prevURL = "";//_self.URL; 51 _self.URL = _.plugins.nvx.buildURL( _self ); 52 53 if( _self.URL != prevURL || !_self.ready || _self.params.evt != "ready" ) { 54 55 if( _self.act ) { 56 if( typeof _self.act == "string" ) { 57 if( _self.pID && _self.ns && _.plugins[ _self.ns ][ _self.pID ][ _self.act ] ) 58 _.plugins[ _self.ns ][ _self.pID ][ _self.act ].call( _.plugins[ _self.ns ][ _self.pID ], _self.args||jQuery.extend(_.plugins[ _self.ns ][ _self.pID ].params, {evt: e.type}), _self.jQ ); 59 else if( _self.ns && _.plugins[ _self.ns ][ _self.act ] ) 60 _.plugins[ _self.ns ][ _self.act ].call( _.plugins[ _self.ns ], jQuery.extend( {evt: e.type}, { args: _self.args }), _self.jQ ); 61 else 62 _.utils.script.handler( _.plugins.nvx[ _self.id ].act, _self.jQ ); 63 } else _.utils.script.handler( _.plugins.nvx[ _self.id ].act, _self.jQ ); 64 } 65 66 _.plugins.nvx.requestManager( _self ); 67 } 68 if( _self.params.one ) _self.one = true; 69 70 }); 71 72 if( _self.params.evt == "ready" && _self.URL != "" ) _self.jQ.trigger( _.env.STATICS.EVENTS.ready ); 73 74 _self.ready = true; 75 76 }, 77 78 destroy: function() { 79 80 }, 81 82 devChg: function() { 83 if( !this.one ) this.jQ.trigger( _.env.STATICS.EVENTS.ready ); 84 }, 85 86 refresh: function() {} 87 88} 89 90var _nvx = _.plugins.nvx = { 91 92 _private_: { 93 94 name: "BBTools.UI.dynamicContent", 95 version: "1.0", 96 97 objectType: "_dynamicContent", 98 99 defaults: { 100 act: null, 101 ns: null, 102 pID: null, 103 ajx: true, 104 evt: "ready", 105 queryString: {}, 106 method: "get", 107 URL: "", 108 one: false,
109 wFC: false, 110 extData: false 111 } 112 113 }, 114 115 buildURL: function () { 116 117 var $_len = arguments.length, 118 args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} 119 120 var dynContent = args[0]; 121 122 var fullURL = dynContent.URL; 123 124 //console.log(dynContent.params.queryString) 125 126 for (prop in dynContent.params.queryString) { 127 128 fullURL += (fullURL.indexOf("?") != -1 ? "&" : "?") + prop + "="; 129 if(dynContent.params.queryString[prop]) { 130 fullURL += _.utils.script.get( dynContent.params.queryString[prop], dynContent.jQ ); 131 } 132 133 } 134 135 // console.log( fullURL ) 136 137 // for (prop in _.settings.URLParams ) { 138 139 // fullURL += (fullURL.indexOf("?") != -1 ? "&" : "?") + prop + "=" + _.settings.URLParams[ prop ]; 140 141 // } 142 143 return fullURL; 144 145 }, 146 147 requestManager: function() { 148 149 var $_len = arguments.length, 150 args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} 151 152 var dynContent = args[0]; 153 154 if( dynContent.params.ajx ) { 155 156 if( !dynContent.loading ) { 157 dynContent.loading = true; 158 _.ajax[ dynContent.params.method ]( 159 dynContent.URL, 160 function() { 161 dynContent.loading = false; 162 if( typeof dynContent.params.callback == "string" ) eval( dynContent.params.callback ); 163 else if ( typeof dynContent.params.callback == "function" ) dynContent.params.callback.call(dynContent); 164 }, 165 dynContent, 166 dynContent.params.extData 167 ); 168 } 169 170 } else { 171 172 if( dynContent.params.target ) 173 window.open( dynContent.URL, dynContent.params.target ) 174 else 175 window.location = dynContent.URL; 176 177 } 178 179 } 180 181} 182 183_.ajax = { 184 185 get: function( URL, callback, object, externalData ) { 186 var _self = this; 187 URL += ( ( URL.indexOf("?") == -1 ) ? "?" : "&" )+ "_ajx=true&device=" + ( _.env.responsive ? (_.env.responsive.breakpoints.indexOf(_.env.responsive.device)) : "0" ); 188 189 jQuery.get( URL, function( data ) { 190 /*if( type ) { 191 _self.processData( _.utils.parseHTML( "<div data-_='"+type+"' data-params='{ callback: "+(callback||"")+" }'>" + data + "</div>", true), object ); 192 } else {*/ 193 _self.processData( _.utils.parseHTML(data, externalData ? false : true), object ); 194 if(callback) callback.call( window, data, object ); 195 //} 196 }); 197 }, 198 199 post: function( URL, callback, object, postData ) { 200 var _self = this; 201 URL += ( ( URL.indexOf("?") == -1 ) ? "?" : "&" )+ "_ajx=true&device=" + ( _.env.responsive ? (_.env.responsive.breakpoints.indexOf(_.env.responsive.device)) : "0" ); 202 jQuery.post( URL, postData, function( data ) { 203 _self.processData( _.utils.parseHTML(data, true), object ); 204 if(callback) callback.call( window, data, object ); 205 }); 206 }, 207 208 processData: function( data, plugin ) { 209 210 var _self = this; 211 212 //if( typeof loader != "undefined" && jQuery("#loaderLayer").length == 1 ) loader.hide(); 213 _.page.loading = false; 214 if( _.utils.loader.dsp ) _.utils.loader.hide(); 215 216 if( typeof data == "string" ) return false; 217 218 data.each( function( i, el ) { 219 220 var jQ = jQuery(this), 221 type = jQ.attr("data-_"), 222 params = _.utils.getParams(jQ.attr("data-params")||"{}"); 223 224 switch( type ) { 225 226 // ------------ MESSAGE BOX ---------// 227 case "msg": 228 229 if( jQuery("#"+jQ.attr("id")).length == 0 ) { 230 jQ.appendTo("body"); 231 _.plugins.add( jQuery("#"+jQ.attr("id") ), true ); 232 _.plugins.msg[ jQ.attr("id") ].open(); 233 } else { 234 235 _.utils.updContent( { data: _.utils.parseHTML(jQ.html()), pluginID: jQ.attr("id"), type: "msg", target: jQuery("#"+jQ.attr("id") ), append: false, width: params.width, height: params.height, callback: params.callback }, false ); 236 //_.plugins.msg[ jQ.attr("id") ].update( ); 237 } 238 239 break; 240 241 case "htm": 242 243 params.data = _.utils.parseHTML(jQ.html()); 244 //params.pluginID = plugin.id; 245 //console.log(plugin) 246 if( params.target ) { 247 params.target = jQuery( params.target ); 248 //params.pluginID = plugin.id; 249 } else { 250 params.target = plugin.jQ; 251 //params.updateTree = plugin.jQ.attr("id") ? true : false; 252 253 } 254 255 //console.log( params.target ) 256 257 _.utils.updContent( params, typeof params.animated != "undefined" ? params.animated : true ); 258 _.page.loading = false; 259 260 break; 261 262 case "jzn": 263 264 // console.log( jQ.html() ) 265 // Ameliore la gestion du setting du plugin 266 _.utils.script.handler( jQuery.parseJSON( jQ.html() ), params.target||plugin||jQuery( document ), params.callback ); 267 268 break; 269 270 // ------------ LIGHTBOX ------------// 271 case "lbx": 272 if( !_lbx.dsp ) { 273 params.data = obj.html(); 274 _lbx.open( params ); 275 } else { 276 277 _lbx.params.width = params.width; 278 _lbx.params.height = params.height; 279 280 _bb.utils.updContent({ 281 data: obj.html(), 282 append: params.append, 283 target: _lbx.win, 284 pRefresh: true, 285 callback: function(){ 286 if( params.callback != undefined ) { 287 if( typeof params.callback == "object" ) { 288 if( typeof params.callback.complete == "function" ) params.callback.complete.call(); 289 else if ( typeof params.callback.complete == "string" ) eval( params.callback.complete ); 290 } else { 291 if( typeof params.callback == "function" ) params.callback.call(); 292 else if ( typeof params.callback == "string" ) eval( params.callback ); 293 } 294 } 295 if(params.btn||false) _lbx.addCloseBtn();
296 }, 297 height: params.height, 298 width: params.width, 299 pRefresh: true 300 }, true ); 301 } 302 303 break; 304 305 // ------------ JSON ----------------// 306 case "jsn": 307 if( params != undefined && params.callback != undefined ) params.callback.call( window, jQuery.parseJSON( jQ.html() ) ); 308 break; 309 310 case "js": 311 eval( jQ.html() ); 312 break; 313 314 default: 315 break; 316 317 } 318 319 }); 320 321 } 322 323}
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.