自已練功,解決Javascript編碼的問題(破解)

其實這也只是拾人牙慧而以其實,這不是我發生的問題,是廸亞哥的問題,我大概知道解法,就拿這隻apycom.com的jquery下拉選單(drop down menu)來開刀。其實處理的方式沒有很難。只是因為他寫的javascript code太機車,會擋到程式設計師debug的訊息,我才決定拿他開刀的。我不反對版權,但是,這樣的版權提示訊息不能造成使用者的不便,造成使用者的不便,結果使用者跑來吵我,那就不能怪我囉!所以兇手是廸亞哥,我只是共犯。

加密的地方在menu的js,一共有3段加密,前一段是jquery.easing.js V1.3版的內容,第二段是jquery easing compatibility V1的內js內容。我是不知道為什apycom.com拿別人的code過來還加密。拾人牙慧嗎?如果要拾人牙慧,有種的話把板權宣告拿掉,做絕一點,直接擾亂視聽,覺得怎樣啊?重點來了,會造成「No back link」字樣的code在第三段編碼。

傳統的做法,都是在eval(function(p,a,c,k,e,d)這個地方,把eval改成alert或是document.write,這樣,就會把解編碼過後的結果顯示在螢幕上。

最後一投換掉即可,前兩段要換也可以,等下提供
顯示出來的結果其中有一段,就是造成問題的地方

    if (document.body){
var box = document.createElement(‘div’);
box.innerHTML = ‘<div style=”z-index:9999;visibility:visible;display:block;padding:3px;font:bold 11px Arial;background-color:#95d13d;position:absolute;top:10px;left:10px;”><a style=”color:#000;” href=”http://defencew.blog.163.com/blog/http://apycom.com/”>No&nbsp;back&nbsp;link</a></div>’;
document.body.appendChild(box);
}
return false;

拿掉之後,乾淨的第三段內容解編碼如下

jQuery(function(){    var $ = jQuery;
// retarder
$.fn.retarder = function(delay, method){

var node = this;

if (node.length){

if (node[0]._timer_) clearTimeout(node[0]._timer_);

node[0]._timer_ = setTimeout(function(){ method(node); }, delay);

}

return this;

};

(function(){

var links = document.getElementsByTagName(‘a’);

for (var i = 0; i < links.length; i++){

if (links[i].href && /^http:\/\/(?:www\.|)apycom\.com[\/]*$/i.test(links[i].href))

return true;

}
return false;

})();
$(‘#menu’).addClass(‘js-active’);if($.browser.msie&&parseInt($.browser.version)==7)
$(‘#menu’).addClass(‘ie7’);$(‘ul div’,’#menu’).css(‘visibility’,’hidden’);$(‘.menu>li’,’#menu’).hover(function()
{var ul=$(‘div:first’,this);if(ul.length){if(!ul[0].hei)ul[0].hei=ul.height();ul.css({height:20,overflow:’hidden’}).retarder(500,function(i){$(‘#menu’).removeClass(‘js-active’);$(‘a:first’,ul[0].parentNode).addClass(‘over’);$(‘#menu>ul>li.back’).css(‘display’,’none’);i.css(‘visibility’,’visible’).animate({height:ul[0].hei},{duration:500,complete:function(){ul.css(‘overflow’,’visible’)}})})}},function(){var ul=$(‘div:first’,this);if(ul.length){var css={visibility:’hidden’,height:ul[0].hei};$(‘#menu>ul>li.back’).css(‘display’,’block’);$(‘#menu’).addClass(‘js-active’);$(‘a:first’,ul[0].parentNode).removeClass(‘over’);ul.stop().retarder(1,function(i){i.css(css)})}});$(‘ul ul li’,’#menu’).hover(function(){var ul=$(‘div:first’,this);if(ul.length){if(!ul[0].wid)ul[0].wid=ul.width();ul.css({width:0,overflow:’hidden’}).retarder(100,function(i){i.css(‘visibility’,’visible’).animate({width:ul[0].wid},{duration:500,complete:function(){ul.css(‘overflow’,’visible’)}})})}},function(){var ul=$(‘div:first’,this);if(ul.length){var css={visibility:’hidden’,width:ul[0].wid};ul.stop().retarder(1,function(i){i.css(css)})}});$(‘#menu ul.menu’).lavaLamp({speed:400});if($.browser.msie&&$.browser.version.substr(0,1)==’6′){$(‘ul ul a span’,’#menu’).css(‘color’,’rgb(4,52,84)’).hover(function(){$(this).css({color:’rgb(255,255,255)’})},function(){$(this).css({color:’rgb(4,52,84)’})})}
else{$(‘ul ul a span’,’#menu’).css(‘color’,’rgb(4,52,84)’).hover(function(){$(this).animate({color:’rgb(255,255,255)’},500)},
function(){$(this).animate({color:’rgb(4,52,84)’},200)})}});

第一段和第二段編碼的內容如下,喜歡的話,可以貼回去

/** jquery.easing.js ****************/
/*
* jQuery Easing v1.3 – http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE – jQuery Easing
*
* Open source under the BSD License.
*
* Copyright В© 2008 George McGinley Smith
* All rights reserved.
*/
jQuery.easing[‘jswing’] = jQuery.easing[‘swing’];

jQuery.extend( jQuery.easing,
{
def: ‘easeOutQuad’,
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((–t)*(t-2) – 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t – 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t – 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) – 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d – 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t – 1)) + b;
return c/2 * (-Math.pow(2, -10 * –t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 – (t/=d)*t) – 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 – (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 – t*t) – 1) + b;
return c/2 * (Math.sqrt(1 – (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t – s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t – s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c – jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
* jQuery Easing Compatibility v1 – http://gsgd.co.uk/sandbox/jquery.easing.php
*
* Adds compatibility for applications that use the pre 1.2 easing names
*
* Copyright (c) 2007 George Smith
* Licensed under the MIT License:
*   http://www.opensource.org/licenses/mit-license.php
*/
jQuery.extend( jQuery.easing,
{
easeIn: function (x, t, b, c, d) {
return jQuery.easing.easeInQuad(x, t, b, c, d);
},
easeOut: function (x, t, b, c, d) {
return jQuery.easing.easeOutQuad(x, t, b, c, d);
},
easeInOut: function (x, t, b, c, d) {
return jQuery.easing.easeInOutQuad(x, t, b, c, d);
},
expoin: function(x, t, b, c, d) {
return jQuery.easing.easeInExpo(x, t, b, c, d);
},
expoout: function(x, t, b, c, d) {
return jQuery.easing.easeOutExpo(x, t, b, c, d);
},
expoinout: function(x, t, b, c, d) {
return jQuery.easing.easeInOutExpo(x, t, b, c, d);
},
bouncein: function(x, t, b, c, d) {
return jQuery.easing.easeInBounce(x, t, b, c, d);
},
bounceout: function(x, t, b, c, d) {
return jQuery.easing.easeOutBounce(x, t, b, c, d);
},
bounceinout: function(x, t, b, c, d) {
return jQuery.easing.easeInOutBounce(x, t, b, c, d);
},
elasin: function(x, t, b, c, d) {
return jQuery.easing.easeInElastic(x, t, b, c, d);
},
elasout: function(x, t, b, c, d) {
return jQuery.easing.easeOutElastic(x, t, b, c, d);
},
elasinout: function(x, t, b, c, d) {
return jQuery.easing.easeInOutElastic(x, t, b, c, d);
},
backin: function(x, t, b, c, d) {
return jQuery.easing.easeInBack(x, t, b, c, d);
},
backout: function(x, t, b, c, d) {
return jQuery.easing.easeOutBack(x, t, b, c, d);
},
backinout: function(x, t, b, c, d) {
return jQuery.easing.easeInOutBack(x, t, b, c, d);
}
});

祝大家用的愉快。最後說一下,這隻jqeury不貴,大約一千多(NT$),如果是商業用途,還是可以付費支持一下。

隨機文章

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *