NY Times: load full article

Load full articles on New York Times (nytimes.com) without redirect & replaceState

  1. // ==UserScript==
  2. // @name NY Times: load full article
  3. // @namespace http://twitter.com/depositado
  4. // @description Load full articles on New York Times (nytimes.com) without redirect & replaceState
  5. // @include http://www.nytimes.com/*
  6. // @version 1.0
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. if (typeof console == "undefined") {
  11. window.console = {
  12. log: function () {}
  13. };
  14. }
  15.  
  16. console.log('userscript loaded: "NY Times: load full article"');
  17.  
  18. jQuery(function(){
  19. var fullArticleLink,
  20. fullArticleLinkSelector = 'div#article ul.shareToolsList li.shareToolsItemSinglepage a';
  21. articleContainerSelector = 'div#article',
  22. canonicalLink = jQuery('link[rel=canonical]').attr('href');
  23. // check if on article page AND if there is a full article link
  24. if ((jQuery(articleContainerSelector).length > 0) && (fullArticleLinkSelector.length > 0)) {
  25. jQuery(articleContainerSelector).load(canonicalLink+' #article > *', function() {
  26. console.log('NY Times: full article loaded');
  27. window.history.replaceState( {page: this.href}, '', canonicalLink);
  28. });
  29. }
  30. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址