views:

76

answers:

2

Hello expert,

please check this file

http://www.findmyshift.com/scripts/minified/4.1.1518127339_-603332839.js?20100812231650

The script is written in an interesting method,Could you please explain how this is done ?

Anyone can explain how a simple function can write in this method ?

Thank you

+2  A: 

This is a process called minificiation. I believe the specific script you mention is using Packer, but there are tons of services that do this (the YUI compressor is one notable example).


Edit

For some reason, you don't believe this is minification because of the piping at the end. Try using Packer's example code:

// sample code

var input, output;

// notice the semi-colon at the END of function declarations

onload = function() {
  input = document.getElementById("input");
  output = document.getElementById("output");
  clearAll(true);
};

function packScript() {
  output.value = pack(input.value);
};

function clearAll(focus) {
  output.value = input.value = "";
  // the "if" statement is NOT terminated with a semi-colon
  if (focus) {
    input.focus();
  }
};

Paste it into Packer, check Base62 encode. It produces a similar result.

Mark Trapp
I dont think these are compressed, please check at the strings at the end separated by |, j compressors can't do this
john
Yes, they can. What leads you to believe they can't?
Mark Trapp
Thank you Mr.Mark Trapp, Now I believe this, thanks a lot for your code. As you said I was little confused about the piping at the end,you done a great job
john
A: 

It's pretty simple, just copy & paste your javascript in here: http://dean.edwards.name/packer/.

GuidoH
I dont think these are compressed, please check at the strings at the end separated by |, j compressors can't do this
john
Yeah, just check the "Base62 encode" checkbox.
GuidoH