Changeset 32869

Show
Ignore:
Timestamp:
04/28/09 06:04:42 (10 months ago)
Author:
otsune
Message:

Add tumblr.like (via http://dara-j.tumblr.com/post/100517201/like )

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/playontumblr.user.js

    r18825 r32869  
    2727                        try { execute( 'tumblr.reblogcount', execute('current-node')); } catch (e) { } 
    2828                }}); 
     29 
     30    addShortcutkey({ 
     31        key: "l",  
     32        description: 'tumblr.like',  
     33        command: function() { 
     34            try { execute( 'tumblr.like', execute('current-node')); } catch(e) { } 
     35        }}); 
    2936 
    3037        addCommand({ 
     
    6875                        return stdin; 
    6976                }}); 
     77 
     78    addCommand({ 
     79        name: "tumblr.like", 
     80        command: function(stdin) { 
     81            try { 
     82                if (!stdin.length) stdin = execute('current-node'); 
     83                var count = $X('.//input[contains(concat(" ",@class," "), " like_button ")]', stdin[0]); 
     84                for (var n = 0; n < count.length; n++) { 
     85                    if(!count[n].clientWidth) continue; 
     86                    count[n].click(); 
     87                    return stdin; 
     88                } 
     89            } catch(e) {} 
     90            return stdin; 
     91         }}); 
    7092} 
     93