Changeset 7404
- Timestamp:
- 03/03/08 18:58:05 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/userscripts/googlereaderfullfeed.user.js
r7401 r7404 12 12 // author: mattn <mattn.jp@gmail.com> 13 13 14 var w = unsafeWindow || this; 15 w.onload = function() { 16 googleReaderFullFeed(); 17 }; 18 19 function googleReaderFullFeed() { 20 14 (function(w) { 21 15 // == [CSS] ========================================================= 22 16 const CSS = <><; 125 } 117 for (var i = 0, l = FullFeed.documentFilters.length; i < l; 118 FullFeed.documentFilters[i++](htmldoc, this.itemInfo.itemURL, this.info)); 126 119 try { 127 120 var entry = getElementsByXPath(this.info.xpath, htmldoc); 128 } 129 catch (e) { 121 } catch (e) { 130 122 message(e); 131 123 return; … … 135 127 this.removeEntry(); 136 128 entry = this.addEntry(entry); 137 for (var i = 0, l = FullFeed.filters.length; i < l; ) { 138 FullFeed.filters[i++](entry); 139 } 129 for (var i = 0, l = FullFeed.filters.length; i < l; 130 FullFeed.filters[i++](entry)); 140 131 this.requestEnd(); 141 132 } else { … … 186 177 }; 187 178 var info = {}; 188 for (var i = lines.length; i > 0; ) {179 for (var i = lines.length; i > 0; ) { 189 180 if (reg.test(lines[--i])) { 190 181 info[RegExp.$1] = trimspace(RegExp.$2); … … 198 189 } 199 190 } 200 try {191 try { 201 192 new RegExp(info.url); 202 193 } catch (e) { … … 251 242 252 243 253 FullFeed.getCache = function( ) {254 return eval(GM_getValue( 'cache')) || {};244 FullFeed.getCache = function(key, oDefault) { 245 return eval(GM_getValue(key || 'cache', oDefault || "({})")); 255 246 }; 256 247 … … 258 249 if (!WIDGET) return; 259 250 var exps = []; 260 for (var i = 0, l = SITE_INFO.length; i < l; ) { 261 exps.push(SITE_INFO[i++].url); 262 } 251 for (var i = 0, l = SITE_INFO.length; i < l; exps.push(SITE_INFO[i++].url)); 263 252 for (var url in cacheInfo) { 264 253 var site = cacheInfo[url]; 265 for (var i = 0, l = site.info.length; i < l; ) { 266 exps.push(site.info[i++].url); 267 } 254 for (var i = 0, l = site.info.length; i < l; exps.push(site.info[i++].url)); 268 255 } 269 256 pattern = exps.join('|'); … … 415 402 416 403 if (!c.find) { 417 for (var i = 0, l = SITEINFO_IMPORT_URLS.length; i < l && !c.find; ) { 418 launchFullFeed(cacheInfo[SITEINFO_IMPORT_URLS[i++]].info, c); 419 } 404 for (var i = 0, l = SITEINFO_IMPORT_URLS.length; i < l && !c.find; 405 launchFullFeed(cacheInfo[SITEINFO_IMPORT_URLS[i++]].info, c)); 420 406 } 421 407 … … 457 443 function removeXSSRisks(htmldoc) { 458 444 var attr = "allowScriptAccess"; 445 459 446 Array.forEach(htmldoc.getElementsByTagName("embed"), function(embed) { 460 447 embed.hasAttribute(attr) && embed.setAttribute(attr, "never"); … … 469 456 var current = base.replace(/\/[^\/]+$/, '/'); 470 457 471 Array.forEach(htmldoc.getElementsByTagName("a"), function(elm) { 472 if(elm.getAttribute("href")) elm.href = _rel2abs(elm.getAttribute("href"), top, current); 458 Array.forEach(htmldoc.getElementsByTagName("a"), function(a) { 459 if (a.getAttribute("href")) 460 a.href = _rel2abs(a.getAttribute("href"), top, current); 473 461 }); 474 Array.forEach(htmldoc.getElementsByTagName("img"), function(elm) { 475 if(elm.getAttribute("src")) elm.src = _rel2abs(elm.getAttribute("src"), top, current); 462 Array.forEach(htmldoc.getElementsByTagName("img"), function(img) { 463 if (img.getAttribute("src")) 464 img.src = _rel2abs(img.getAttribute("src"), top, current); 476 465 }); 477 466 } … … 513 502 flash.id = 'FLASH_MESSAGE'; 514 503 hide(flash); 515 document. body.appendChild(flash);504 document.documentElement.appendChild(flash); 516 505 var canceler; 517 506 this.showFlashMessageWindow = function(string, duration) { … … 567 556 //w.message(""); w.message(mes); 568 557 //console.log(mes); 558 FlashMessage.showFlashMessageWindow(""); 569 559 FlashMessage.showFlashMessageWindow(mes, 1000); 570 560 } … … 573 563 function getElementsByXPath(xpath, node) { 574 564 var node = node || document; 575 var doc = node.ownerDocument ? node.ownerDocument : node; 576 var nodesSnapshot = doc.evaluate(xpath, node, null, 577 XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 565 var nodesSnapshot = (node.ownerDocument || node). 566 evaluate(xpath, node, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 578 567 var data = [] 579 for (var i = 0, l = nodesSnapshot.snapshotLength; i < l; ) { 580 data.push(nodesSnapshot.snapshotItem(i++)); 581 } 568 for (var i = 0, l = nodesSnapshot.snapshotLength; i < l; 569 data.push(nodesSnapshot.snapshotItem(i++))); 582 570 return data.length > 0 ? data : null; 583 571 } … … 585 573 function getFirstElementByXPath(xpath, node) { 586 574 var node = node || document; 587 var doc = node.ownerDocument ? node.ownerDocument : node; 588 var result = doc.evaluate(xpath, node, null, 589 XPathResult.FIRST_ORDERED_NODE_TYPE, null); 575 var result = (node.ownerDocument || node). 576 evaluate(xpath, node, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); 590 577 return result.singleNodeValue ? result.singleNodeValue : null; 591 578 } … … 618 605 } 619 606 620 } 607 })(unsafeWindow || this);
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)