Changeset 8626
- Timestamp:
- 04/02/08 06:20:47 (5 years ago)
- Files:
-
- 1 modified
-
lang/javascript/userscripts/ldrprefav.user.js (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/userscripts/ldrprefav.user.js
r8616 r8626 8 8 // ==/UserScript== 9 9 10 var doneIDs = [];10 var filteredIDs, preFilteredIDs; 11 11 12 12 with (this.unsafeWindow || this) { … … 14 14 "Pheedo - Depheedo" : function(f) { 15 15 var item; 16 for (var i = f.items.length; item = f.items[--i];) {16 for (var i = 0; item = f.items[i++];) { 17 17 if (item.title.indexOf("AD: ") != 0) break; 18 18 } … … 20 20 21 21 filter(f.items, function(i) { return i.title.indexOf("AD: ") != 0 }); 22 var re = /<img(?:\s+[^>]+) *?\s+src\s*=\s*["']?\s*http:\/\/www\.pheedo\.jp\/(?:img\.phdo|feeds\/tracker\.php)\?[^>]+>/g; //ig22 var re = /<img(?:\s+[^>]+)?\s+src\s*=\s*["']?\s*http:\/\/www\.pheedo\.jp\/(?:img\.phdo|feeds\/tracker\.php)\?[^>]+>(?:<\/img>)?/g; //ig 23 23 foreach(f.items, function(i) { i.body = i.body.replace(re, ""); }); 24 24 }, 25 "FeedBurner - Detracking and RemoveGarbled" : function(f) {26 var re = /<a(?:\s+[^>]+) *?\s+href\s*=\s*["']?\s*http:\/\/[^\/]+\/~\w\/[^>]+>[\s\S]+?<\/a\s*>|<img(?:\s+[^>]+)*?\s+src\s*=\s*["']?\s*http:\/\/[^\/]+\/~\w\/[^>]+>/g;27 if ( f.channel.feedlink.indexOf("http://feeds.feedburner.") != 0&&25 "FeedBurner - Detracking and Filter Garbled" : function(f) { 26 var re = /<a(?:\s+[^>]+)?\s+href\s*=\s*["']?\s*http:\/\/[^\/]+\/~\w\/[^>]+>[\s\S]+?<\/a\s*>|<img(?:\s+[^>]+)*?\s+src\s*=\s*["']?\s*http:\/\/[^\/]+\/~\w\/[^>]+>(?:<\/img>)?/g; 27 if (! /^http:\/\/feeds\.feedburner\.(?:com|jp)\//.test(f.channel.feedlink) && 28 28 ! (f.items[0] && 29 /^http:\/\/ feeds\.feedburner\.(?:com|jp)\/~r\//.test(f.items[0].link) ||29 /^http:\/\/[^\/]+\/~r\/[^\/]+/.test(f.items[0].link) || 30 30 re.test(f.items[0].body))) return; 31 31 … … 36 36 filter(f.items, function(i) { return i.author != "rssad.jp" }); 37 37 //filter(f.items, function(i) { return i.title.indexOf("PR: ") != 0 }); 38 var re = /<a(?:\s+[^>]+)*?\s+href\s*=\s*["']?\s*http:\/\/rss\.rssad\.jp\/[^>]+>[\s\S]+?<\/a\s*>|<img(?:\s+[^>]+)*?\s+src\s*=\s*["']?\s*http:\/\/rss\.rssad\.jp\/[^>]+>/g; 39 foreach(f.items, function(i) { 40 i.body = i.body.replace(re, ""); 41 }); 38 var re = /<a(?:\s+[^>]+)?\s+href\s*=\s*["']?\s*http:\/\/rss\.rssad\.jp\/[^>]+>[\s\S]+?<\/a\s*>|<img(?:\s+[^>]+)*?\s+src\s*=\s*["']?\s*http:\/\/rss\.rssad\.jp\/[^>]+>(?:<\/img\s*>)?/g; 39 foreach(f.items, function(i) { i.body = i.body.replace(re, ""); }); 42 40 }, 43 41 "Userscripts.org - Trim Spam" : function(f) { … … 56 54 }, 57 55 "Flickr - Enlarge Thumbnails" : function(f) { // http://userscripts.org/scripts/show/14809 58 if (doneIDs.indexOf(f.subscribe_id) > -1 || 59 f.channel.link.indexOf("http://www.flickr.com/") != 0) return; 56 if (f.channel.link.indexOf("http://www.flickr.com/") != 0) return; 60 57 61 58 var re = /_m(?=\.(?:jpe?g|gif|png)")|\s+(?:width|height)="\d+"/g; … … 71 68 }, 72 69 "4U - Enlarge Thumbnails" : function(f) { // http://d.hatena.ne.jp/Constellation/20080327/1206633302 73 if (doneIDs.indexOf(f.subscribe_id) > -1 || 74 f.channel.link != "http://4u.straightline.jp/") return; 70 if (f.channel.link != "http://4u.straightline.jp/") return; 75 71 76 72 var re = /(?:\/m){2}(?=_)/; … … 80 76 if (! /^http:\/\/[^.]+\.blog\d+\.fc2\.com\//.test(f.channel.link)) return; 81 77 82 var re = /(<img(?:\s+[^>]+) *?\ssrc="[^"]+)s(\.jpg")/g;78 var re = /(<img(?:\s+[^>]+)?\ssrc="[^"]+)s(\.jpg")/g; 83 79 foreach(f.items, function(i) { i.body = i.body.replace(re, "$1$2"); }); 84 80 }, … … 86 82 if (f.channel.link.indexOf("//knuttz.net/") < 0) return; 87 83 88 var RE = /<a(?:\s+[^>]+) *?\s+href="([^"]+)"[^>]*>.*?Clic?k\s+Here[\S\s]*?<\/a\s*>/i;84 var RE = /<a(?:\s+[^>]+)?\s+href="([^"]+)"[^>]*>.*?Clic?k\s+Here[\S\s]*?<\/a\s*>/i; 89 85 foreach(f.items, function(i) { 90 86 if (! RE.test(i.body)) return; … … 96 92 if (f.channel.link != "http://www.gizmodo.jp/") return; 97 93 98 var re = /<a(?:\s+[^>]+) *?\s+href="([^"]+)"[^>]*>\u7D9A\u304D\u3092\u8AAD\u3080<\/a>/;94 var re = /<a(?:\s+[^>]+)?\s+href="([^"]+)"[^>]*>\u7D9A\u304D\u3092\u8AAD\u3080<\/a>/; 99 95 foreach(f.items, function(i) { 100 96 if (! re.test(i.body)) return; … … 107 103 f.channel.link != "http://slashdot.jp/") return; 108 104 109 var re = /<a(?:\s+[^>]+) *?\s+href="([^"]+)"[^>]*>Read more of this story<\/a>/;105 var re = /<a(?:\s+[^>]+)?\s+href="([^"]+)"[^>]*>Read more of this story<\/a>/; 110 106 foreach(f.items, function(i) { 111 if (! re.test(i.body)) return; 112 i.link = RegExp.$1; 107 if (re.test(i.body)) i.link = RegExp.$1; 113 108 }); 114 109 }, … … 124 119 if (! (f.items[0] && re.test(f.items[0].link))) return; 125 120 126 foreach(f.items, function(i) { i.link = i.link.replace(re, "").replace(/\?(?=#|$)/, ""); }); 121 foreach(f.items, function(i) { 122 i.link = i.link.replace(re, "").replace(/\?(?=#|$)/, ""); 123 }); 127 124 }, 128 125 "Trim Spaces to Compact Items" : function(f) { 129 126 foreach(f.items, function(i) { 130 i.body = i.body.replace(/(^|<[ap](?:\s+[^>]*)?>)(?:\s|<br(?:\s+[^>]* |\s*\/?)>)+|(?:\s|<br(?:\s+[^>]*|\s*\/?)>)+($|<\/[ap]\s*>)|<a(?:\s+[^>]*)?>(?:\s|<br(?:\s+[^>]*|\s*\/?)>)*<\/a\s*>/ig, "$1$2")131 .replace(/<(p(?:re)?)(?:\s+[^>]*)?>(?:\s|<br(?:\s+[^>]* |\s*\/?)>)*<\/\1\s*>/ig, "");127 i.body = i.body.replace(/(^|<[ap](?:\s+[^>]*)?>)(?:\s|<br(?:\s+[^>]*)?>(?:<\/br>)?)+|(?:\s|<br(?:\s+[^>]*)?>(?:<\/br>)?)+($|<\/[ap]>)|<a(?:\s+[^>]*)?>(?:\s|<br(?:\s+[^>]*)?>(?:<\/br>)?)*<\/a>/ig, "$1$2") 128 .replace(/<(p(?:re)?)(?:\s+[^>]*)?>(?:\s|<br(?:\s+[^>]*)?>(?:<\/br>)?)*<\/\1>/ig, ""); 132 129 }); 133 130 } … … 135 132 136 133 const preFilters = { 137 "Flickr - Enlarge and Prefetch Thumbnails" : function(f) { // http://userscripts.org/scripts/show/14809 138 if (doneIDs.indexOf(f.subscribe_id) > -1 || 139 f.channel.link.indexOf("http://www.flickr.com/") != 0) return; 134 "Flickr - Prefetch Thumbnails" : function(f) { // http://userscripts.org/scripts/show/14809 135 if (f.channel.link.indexOf("http://www.flickr.com/") != 0) return; 140 136 141 doneIDs.push(f.subscribe_id); 142 var re = /([^"]+?)_m(\.(?:jpe?g|gif|png))(?=")|\s+(?:width|height)="\d+"/g; 137 var re = /([^"]+?)_m(\.(?:jpe?g|gif|png))(?=")/g; 143 138 foreach(f.items, function(i) { 144 i.body = i.body.replace(re, "$1$2"); 145 new this.Image().src = RegExp.$1 + RegExp.$2; 139 if (re.test(i.body)) new this.Image().src = RegExp.$1 + RegExp.$2; 146 140 }); 147 141 }, 148 "4U - Enlarge and Prefetch Thumbnails" : function(f) { 149 if (doneIDs.indexOf(f.subscribe_id) > -1 || 150 f.channel.link != "http://4u.straightline.jp/") return; 142 "4U - Prefetch Thumbnails" : function(f) { 143 if (f.channel.link != "http://4u.straightline.jp/") return; 151 144 152 doneIDs.push(f.subscribe_id);153 145 var re = /([^"]+?)(?:\/m){2}(\w+\.(?:jpe?g|gif|png))(?=")/; 154 146 foreach(f.items, function(i) { 155 i.body = i.body.replace(re, "$1/l/l$2"); 156 new this.Image().src = RegExp.$1 + "/l/l" + RegExp.$2; 147 if (re.test(i.body)) new this.Image().src = RegExp.$1 + "/l/l" + RegExp.$2; 157 148 }); 158 149 }, 159 150 "Prefetch Images from Secure Sites" : function(f) { 160 151 var link = f.channel.link; 161 if (doneIDs.indexOf(f.subscribe_id) > -1 || 162 link != "http://ffffound.com/" && 152 if (link != "http://ffffound.com/" && 163 153 ! /^http:\/\/[^.]+\.tumblr\.com/.test(link)) return; 164 154 165 doneIDs.push(f.subscribe_id);166 155 var re = /http:\/\/(?:img\.ffffound|data\.tumblr)\.com\/[\w\/-]+?\.(?:jpe?g|gif|png)/; 167 156 foreach(f.items, function(i) { 168 if (re.test(i.body)) 169 new this.Image().src = RegExp.lastMatch; 157 if (re.test(i.body)) new this.Image().src = RegExp.lastMatch; 170 158 }); 171 159 } 172 160 }; 173 161 162 register_hook("BEFORE_SUBS_LOAD", function() { 163 filteredIDs = preFilteredIDs = []; 164 }); 165 174 166 register_hook("BEFORE_PRINTFEED", function(feed) { 175 if (! subs_item(feed.subscribe_id).unread_count) return; 167 if (filteredIDs.include(feed.subscribe_id) || 168 ! subs_item(feed.subscribe_id).unread_count) return; 176 169 170 filteredIDs.push(parseInt(feed.subscribe_id)); 177 171 for (var filter in filters) 178 172 filters[filter](feed); 179 173 }); 180 174 181 /* preInvoke(get_unread.cache, "set", function(sid, feed) { // http://userscripts.org/scripts/show/14809 182 if (typeof feed == "object" && subs_item(feed.subscribe_id).unread_count) 183 for (var filter in preFilters) 184 preFilters[filter](feed); 185 }); */ 175 if (false) 176 preInvoke(get_unread.cache, "set", function(sid, feed) { // http://userscripts.org/scripts/show/14809 177 if (typeof feed != "object" || preFilteredIDs.include(feed.subscribe_id)) return; 178 179 preFilteredIDs.push(parseInt(feed.subscribe_id)); 180 for (var filter in preFilters) 181 preFilters[filter](feed); 182 }); 186 183 } 187 184 … … 191 188 } 192 189 193 function preInvoke(target, name, f) { // http://userscripts.org/scripts/show/14809190 function preInvoke(target, name, f) { 194 191 var _target = target[name]; 195 192 target[name] = function() { … … 198 195 }; 199 196 } 197 198 Array.prototype.include = function(id) { return this.indexOf(parseInt(id)) > -1 };
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)