EzDevInfo.com

uglifier

Ruby wrapper for UglifyJS JavaScript compressor.

point of java encapsulation [closed]

I'm trying to figure why people say this is a good way to prevent access to your class file that you don't want but can't I just use reflection to access the class? Isn't obfuscation to prevent unauthorized access better because no one knows what your code does even if they use reflection?


Source: (StackOverflow)

How to debug Uglified code

I have coffee script in my rails project that is easy enough to turn into javascript. The js files are hosted locally in my dev environment in which they work as expected.

When I push to Heroku though, certain behaviour is not occurring (though plenty of stuff within the same file is working as expected). The console is not giving me any errors and the script I'm worried about is now merged with a bunch of other js files and uglified.

How do I find out what the problem is?


Source: (StackOverflow)

Advertisements

Is Uglifier breaking my js?

I'm using rails, uglifier and have just started using coffeescript. My coffee script for handling ajax completion is:

handleAjaxComplete = (xhr, response, status) ->
    myFeatherBox.close() if myFeatherBox?
    if $(xhr.target).hasClass "crud_create"
        #creation button hit
        myFeatherBox = $.featherlight response.responseText, afterOpen: ->
            $('form#frm_create').validate()
            $('#frm_create input[type!=hidden]').first().focus()
            return
    else #etc.

This becomes the following javascript:

handleAjaxComplete = function(xhr, response, status) {
  var new_aka_song_id;
  if (myFeatherBox != null) {
    myFeatherBox.close();
  }
  if ($(xhr.target).hasClass("crud_create")) {
    myFeatherBox = $.featherlight(response.responseText, {
      afterOpen: function() {
        $('form#frm_create').validate();
        $('#frm_create input[type!=hidden]').first().focus();
      }
    });
  } else //etc.

But then when I open the hosted page (it's on heroku), myFeatherBox.close() didn't seem to be running. I checked the uglified code and it seems to have become:

a=function(t,s) {
var o;
if(null!=h&&h.close(),$(t.target).hasClass("crud_create"))
    h=$.featherlight(s.responseText,{
        afterOpen:function(){
            $("form#frm_create").validate(),
            $("#frm_create input[type!=hidden]").first().focus()
        }
    });
else //etc.

(I've added some whitespace where I don't think it will matter to make it a little more readable).

My concern is with the condition on the third line of the uglified code. Am I correct that this is breaking what I'm trying to do? If so, how do I fix my coffee script so that the uglifier plays nice?


Source: (StackOverflow)

Duplicate "function(){}.call(this)" in Uglified JS

My uglified (using rails uglifier) javascript ends like this:

/* ... actual code */}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this);

Or for humans:

}.call(this),
function(){}.call(this),
function(){}.call(this),
function(){}.call(this),
function(){}.call(this),
function(){}.call(this);

Uglifier should be reducing the number of bytes in the final product. I've got some empty coffee files (but more than 6) so as far as I know, it's not because rails is processing them. Anyone know why this would be happening?


Source: (StackOverflow)