views:

44

answers:

1

I use Jquery , and change many compress tool but still cause error "it dont know function I created in this file"

http://gist.github.com/586338

help me !!!

This file run fine , dont have a error if it dont compress

A: 

You should have stated in your question which compress tool you used. Also, knowing what it was compressed to could have helped as well. Using this, it was compressed to:

//...

$(function(){
//...
      /**
       *    CENTER
       */
      $.fn.equalWmargin = function(){
            $(this).css('left',($(window).width()-$(this).outerWidth())/2);
      }
      $.fn.equalHmargin = function(){
            $(this).css('top',($(window).height()-$(this).outerHeight())/2);
      }
      $.fn.equalMargin = function(){
            $(this).css('top',($(window).height()-$(this).outerHeight())/2);
            $(this).css('left',($(window).width()-$(this).outerWidth())/2);
      };
});

You didn't have those last center functions inside the right scope. Here it is compressed:

$(function(){$("#flashMessage,#authMessage").hide();$("#flashMessage,#authMessage").css('top',0).css('left',0);$("#flashMessage,#authMessage").slideDown('fast');setTimeout(function(){$("#flashMessage,#authMessage").slideUp('slow')},10000);$("form").submit(function(){$(this).find(":submit").attr('disabled','disabled');});$("<div/>",{"id":"ajaxloading","style":"background-color:yellow;padding:7px 15px;border-radius: 5px;-moz-border-radius: 5px;-webkit-border-radius: 5px;box-shadow: 5px 5px 2px black;  -moz-box-shadow: 2px 2px 2px #CCC; -webkit-box-shadow: 2px 2px 2px #CCC;z-index:999;"}).appendTo("body");$("#ajaxloading").hide();$("#ajaxloading").css('position','fixed').html("<b>Now Loading ...</b>").css('left',($(window).width()-$("#ajaxloading").outerWidth())/2).css('top',($(window).height()-$("#ajaxloading").outerWidth())/2);});$(function(){$.fn.popBox=function(options){var target=options.target;var trigger=this;function _showOverlay(target,trigger){$(trigger).click(function(){$('<div>',{id:'overlay',css:{width:"100%",height:"100%",left:0,top:0,position:"fixed","z-index":1000,"background-color":"#222",opacity:0.3}}).hide().appendTo(document.body).fadeIn(100);$(target).fadeIn(100);return false;});}
function _hideOverlay(target){$('body').delegate('#overlay','click',function(){$('#overlay').fadeOut(100,function(){$(target).fadeOut(100);$(this).remove();});});}
_showOverlay(target,trigger);_hideOverlay(target);};$.fn.checkedAll=function(){$(this).click(function(){form=$(this).closest('form');if(form.find('input:checkbox').attr('checked')==""){$(form).find('input:checkbox').attr('checked','checked');}else{$(form).find('input:checkbox').attr('checked','');}
return false;});};$.fn.previewImg=function(options){var options=$.extend({'removeOld':true,'event':'click'},options);var xOffset=5;var yOffset=15;if(options.event=='hover'){$(this).hover(function(e){_showPreview(e);},function(){this.title=this.t;$("#screenshot").remove();});$(this).mousemove(function(e){$("#screenshot").css("top",(e.pageY+yOffset)+"px").css("left",(e.pageX+xOffset)+"px");});}
if(options.event=='click'){$(this).bind('click',_showPreview);}
$(this).click(function(){return false});function _showPreview(e){if(options.event=='click'&&options.removeOld==false){idscreenshot=Math.floor(Math.random()*30000);}else{$("#screenshot").remove();idscreenshot='screenshot'};e.currentTarget.t=e.currentTarget.title;e.currentTarget.title="";var c=(e.currentTarget.t!="")?"<br/><div style='text-align:center'>"+e.currentTarget.t+"</div>":"";$("body").append("<div id='"+idscreenshot+"' class='screenshot' class='position:absolute;border:1px solid #ccc;background:#333;padding:5px;display:none;color:#fff;'><img src='"+e.currentTarget.href+"' alt='url preview' />"+c+"</div>");$("#"+idscreenshot).css({position:"absolute",border:"1px solid #ccc",background:"#333","box-shadow":"5px 5px 2px #CCC","-moz-box-shadow":"2px 2px 2px #CCC","-webkit-box-shadow":"4px 4px 4px #CCC",padding:"5px",display:'none',color:"#fff",cursor:"pointer"}).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn("fast");$("#"+idscreenshot).click(function(){$(this).remove();});}}
$.fn.tooltip=function(){xOffset=5;yOffset=10;if($(this).attr('title').length>0){$(this).hover(function(e){idtooltip=Math.floor(Math.random()*30000);this.t=this.title;this.title='';$("body").append("<p id='"+idtooltip+"'>"+this.t+"</p>");$("#"+idtooltip).css({position:"absolute",border:"1px solid #333",background:"#f7f5d1","box-shadow":"5px 5px 2px #CCC","-moz-box-shadow":"2px 2px 2px #CCC","-webkit-box-shadow":"2px 2px 2px #CCC",padding:"2px 5px",color:"#333",display:"none"}).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").fadeIn(100);},function(){this.title=this.t;$("#"+idtooltip).fadeOut('100',function(){$(this).remove();});});$(this).mousemove(function(e){$("#"+idtooltip).css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px");});}};$.fn.equalWmargin=function(){$(this).css('left',($(window).width()-$(this).outerWidth())/2);}
$.fn.equalHmargin=function(){$(this).css('top',($(window).height()-$(this).outerHeight())/2);}
$.fn.equalMargin=function(){$(this).css('top',($(window).height()-$(this).outerHeight())/2);$(this).css('left',($(window).width()-$(this).outerWidth())/2);};});
mangoDrunk