这是一个恶意书签吗?

这是一个恶意书签吗?

我正在寻找一种自动滚动的方法,在网上找到了这个方法,并且用了一次。这是否不好?如果不好,我该如何保护我的电脑免受恶意软件的侵害?以下是书签小工具:

javascript:/*The%20Autoscroll%20Bookmarket:Tim%20Harper:http://tim.theenchanter.com*/var%20_ss_interval_pointer;_ss_speed=1;_ss_speed_pairs=[[0,0],[1,200.0],[1,120.0],[1,72.0],[1,43.2],[1,25.9],[2,31.0],[4,37.2],[8,44.8],[8,26.4],[16,32.0]];_ss_last_onkeypress%20=%20document.onkeypress;_ss_stop=function(){clearTimeout(_ss_interval_pointer)};_ss_start=function(){_ss_abs_speed=Math.abs(_ss_speed);_ss_direction=_ss_speed/_ss_abs_speed;_ss_speed_pair=_ss_speed_pairs[_ss_abs_speed];_ss_interval_pointer=setInterval(%27scrollBy(0,%27+_ss_direction*_ss_speed_pair[0]+%27);%20if((pageYOffset%3c=1)||(pageYOffset==document.height-innerHeight))%20_ss_speed=0;%27,_ss_speed_pair[1]);};_ss_adj=function(q){_ss_speed+=q;if(Math.abs(_ss_speed)%3e=_ss_speed_pairs.length)_ss_speed=(_ss_speed_pairs.length-1)*(_ss_speed/Math.abs(_ss_speed))};_ss_quit=function(){_ss_stop();document.onkeypress=_ss_last_onkeypress;};document.onkeypress=function(e){if((e.charCode==113)||(e.keyCode==27)){_ss_quit();return;};if(e.charCode%3e=48&&e.charCode%3c=57)_ss_speed=e.charCode-48;else%20switch(e.charCode){case%2095:_ss_adj(-2);case%2045:_ss_adj(-1);break;case%2043:_ss_adj(2);case%2061:_ss_adj(1);break;};_ss_stop();_ss_start();};_ss_stop();_ss_start();

答案1

不,它不是恶意的。这是美化版本,//每个部分都有注释(以 开头的行):

// Comment with credits
javascript: /*The Autoscroll Bookmarket:Tim Harper:http://tim.theenchanter.com*/

// Just some variable definitions with constants
var _ss_interval_pointer;
_ss_speed = 1;
_ss_speed_pairs = [
    [0, 0],
    [1, 200.0],
    [1, 120.0],
    [1, 72.0],
    [1, 43.2],
    [1, 25.9],
    [2, 31.0],
    [4, 37.2],
    [8, 44.8],
    [8, 26.4],
    [16, 32.0]
];

// Assign whatever is used as current onkeypress to a variable
_ss_last_onkeypress = document.onkeypress;

// Function that just clears setInterval set in function below
_ss_stop = function() {
    clearTimeout(_ss_interval_pointer)
};

// Function that does some maths and adds interval function logic
// (code called each X miliseconds, X defined in array at the top)
_ss_start = function() {
    _ss_abs_speed = Math.abs(_ss_speed);
    _ss_direction = _ss_speed / _ss_abs_speed;
    _ss_speed_pair = _ss_speed_pairs[_ss_abs_speed];
    _ss_interval_pointer = setInterval('scrollBy(0,' + _ss_direction * _ss_speed_pair[0] + '); if((pageYOffset<=1)||(pageYOffset==document.height-innerHeight)) _ss_speed=0;', _ss_speed_pair[1]);
};

// Some more maths
_ss_adj = function(q) {
    _ss_speed += q;
    if (Math.abs(_ss_speed) >= _ss_speed_pairs.length) _ss_speed = (_ss_speed_pairs.length - 1) * (_ss_speed / Math.abs(_ss_speed))
};

// Calls stop function and sets back old onkepress that was saved to a var
_ss_quit = function() {
    _ss_stop();
    document.onkeypress = _ss_last_onkeypress;
};

// Add onkeypress function to detect and handle key presses,
// containing just some logic for key codes and calling previously defined functions
document.onkeypress = function(e) {
    if ((e.charCode == 113) || (e.keyCode == 27)) {
        _ss_quit();
        return;
    };
    if (e.charCode >= 48 && e.charCode <= 57) _ss_speed = e.charCode - 48;
    else switch (e.charCode) {
        case 95:
            _ss_adj(-2);
        case 45:
            _ss_adj(-1);
            break;
        case 43:
            _ss_adj(2);
        case 61:
            _ss_adj(1);
            break;
    };
    _ss_stop();
    _ss_start();
};

_ss_stop();
_ss_start();

相关内容