ElToba
unread,May 8, 2012, 11:25:19 AM5/8/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to selectivizr
Is not efficient, JSLint /*evil:true*/
Saves the selectivizr code in a string and reexecute at will calling
selectivzrRedraw.
var selectivzrRedraw = (function(){
var timer, selectivizrCode;
/*
// More inefficient
if((/MSIE/).test(window.navigator.userAgent)){
timer = setInterval(reSelectivizr, 10000);
}*/
function reSelectivizr(){
if(selectivizrCode === undefined){
$.get('js/selectivizr-min.js', {}, function(data){
selectivizrCode = data;
eval(selectivizrCode);
},'text');
}else{
eval(selectivizrCode);
}
}
return reSelectivizr;
}());
selectivzrRedraw(); // FirstCall
/** AutoRedraw in jQuery .load | NO TESTED, it's a posible solution
**/
(function($){
var PREV_LOAD = jQuery.fn.load;
jQuery.fn.load = function(){
if(jQuery.isFunction(arguments[2])){
var prevCbk = arguments[2];
arguments[2] = function(){
try{
prevCbk();
}catch(e){};
selectivzrRedraw();
}
}else{
if(undefined === arguments[1]){
arguments[1] = {};
}
arguments[2] = selectivzrRedraw
}
return PREV_LOAD.apply(this, arguments);
}
}(jQuery));