Changeset 24344 for lang/javascript

Show
Ignore:
Timestamp:
11/19/08 23:27:11 (5 years ago)
Author:
drry
Message:
  • added 2 filters and resolver.
    • "@cosme - Cleansing cream"
    • "Wassr - Remove insistent username prefixes"
  • renamed some filters.
Files:
1 modified

Legend:

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

    r21684 r24344  
    1717 /* Resolve TinyURL */ | 1 << 6 
    1818 /* Resolve RSS Suite */ | 1 << 7 
     19 /* Resolve @cosme */ | 1 << 8 
    1920; 
    2021 
     
    7879                        }); 
    7980                }, 
     81                "@cosme - Cleansing cream" : function(f) { 
     82                        if ((PREFILTER & 1 << 8) < 1 || 
     83                            f.channel.feedlink != "http://www.cosme.net/rss/news.php") return; 
     84 
     85                        foreach(f.items, function(i) { 
     86                                var link = i.link; 
     87                                if (! truePermalinks[link]) return; 
     88                                i.link = truePermalinks[link]; 
     89                                delete truePermalinks[link]; 
     90                        }); 
     91                }, 
    8092                "Seesaa BLOG - Remove ads" : function(f) { 
    8193                        if (! /^http:\/\/[^.]+\.seesaa\.net\//.test(f.channel.link)) return; 
     
    219231                        }); 
    220232                }, 
    221                 "Remove bodies same as its title" : function(f) { 
     233                "Wassr - Remove insistent username prefixes" : function(f) { 
     234                        if (f.channel.feedlink.indexOf("http://api.wassr.jp/user_timeline.rss?") != 0) return; 
     235 
     236                        var re = /^\S+ : /; 
     237                        if (! f.items[0] || ! re.test(f.items[0].title)) return; 
     238 
     239                        foreach(f.items, function(i) { i.title = i.title.replace(re, ""); }); 
     240                }, 
     241                "Remove bodies same as its title and linkify HTTP URLs" : function(f) { 
    222242                        var re = /https?:\/\/[-\w!#$%&'()*+,.\/:;=?@~]+/g; 
    223243                        foreach(f.items, function(i) { 
     
    233253                        if (f.channel.feedlink.indexOf("http://twitter.com/statuses/user_timeline/") != 0) return; 
    234254 
    235                         var re = /^\w+:/; 
     255                        var re = /^[^:]+: /; 
    236256                        if (! f.items[0] || ! re.test(f.items[0].title)) return; 
    237257 
     
    293313                        }); 
    294314                }, 
    295                 "RSS Suite - Resolve" : function(f) { 
     315                "RSS Suite - Resolve permalink" : function(f) { 
    296316                        var re = /\/item_\d+_\d+_\d+\.html$/; 
    297317                        if ((PREFILTER & 1 << 7) < 1 || 
     
    300320 
    301321                        foreach(f.items, function(i) { re.test(i.link) && resolvePermalink(i.link); }); 
     322                }, 
     323                "@cosme - Resolve permalink" : function(f) { 
     324                        if ((PREFILTER & 1 << 8) < 1 || 
     325                            f.channel.feedlink != "http://www.cosme.net/rss/news.php") return; 
     326 
     327                        foreach(f.items, function(i) { resolvePermalink(i.link); }); 
    302328                }, 
    303329                "TinyURL - Resolve" : function(f) {