Changeset 28151

Show
Ignore:
Timestamp:
01/08/09 06:59:37 (6 months ago)
Author:
drry
Message:
  • fixed the @namespace.
  • et cetera.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/pic2ch.key.control.user.js

    r28150 r28151  
    11// ==UserScript== 
    22// @name           pic2ch key control 
    3 // @namespace      http://svn.coderepos.org/share/lang/javascript/userscripts/pic2ch.keycontrol.user.js 
     3// @namespace      http://svn.coderepos.org/share/lang/javascript/userscripts/pic2ch.key.control.user.js 
    44// @description    keyboard control for pic2ch 
    55// @include        http://pic2ch.giox.org/thread/* 
     
    1818        var view = doc.defaultView; 
    1919        var ev = doc.createEvent("MouseEvents"); 
    20         ev.initMouseEvent("click", true, true, view, 1, 1, 1, 0, 0,     false, 0, false, false, 0, null); 
     20        ev.initMouseEvent("click", true, true, view, 1, 1, 1, 0, 0, false, 0, false, false, 0, null); 
    2121        elem.dispatchEvent(ev); 
    2222    } 
    2323} 
    2424 
    25 window.addEventListener("keypress", function(ev){ 
     25window.addEventListener("keypress", function(ev) { 
    2626    var press = ev.which; 
    27     for(var i=0;i<KEY_SETTING.length;++i) { 
    28         var [key, id] = KEY_SETTING[i]; 
     27    KEY_SETTING.forEach(function(setting) { 
     28        var [key, id] = setting; 
    2929        if(press == key.charCodeAt(0)) { 
    3030            click(id); 
    3131        } 
    32     } 
     32    }); 
    3333}, false); 
    3434