V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
zhangbohun
V2EX  ›  分享创造

写了一个 chrome 浏览器用的 js 书签,功能是获取 V 站节点的 RSS 订阅页面网址

  •  
  •   zhangbohun · 2016-10-24 00:45:50 +08:00 · 2292 次点击
    这是一个创建于 2755 天前的主题,其中的信息可能已经有所发展或是发生改变。

    javascript:function getRssUrl() { var baseUrl = document.location.href.split("/")[2]; var urlType = document.location.href.split("/")[3]; if (baseUrl == 'www.v2ex.com' && urlType == 'go') { var theUrl = 'https://www.v2ex.com/feed/' + document.location.href.split("/")[4] + '.xml'; } else if (baseUrl == 'www.v2ex.com' && urlType == 't') { var theUrl = 'https://www.v2ex.com/feed/' + document.getElementsByClassName('header')[0].getElementsByTagName('a')[2].getAttribute('href').split("/")[2] + '.xml'; } else { alert('请在 V2EX 帖子或具体节点页面下使用。 —— zhangbohun'); return; } var theUrlDivNode = document.createElement("textarea"); theUrlDivNode.innerText = theUrl; theUrlDivNode.setAttribute("id", "this-page-url"); document.body.appendChild(theUrlDivNode); document.getElementById('this-page-url').select(); document.execCommand("Copy"); document.body.removeChild(document.getElementById('this-page-url')); window.open(theUrl);}getRssUrl();

    功能如题。

    话说还有人在用 RSS 的方式订阅博客之类的么?

    第 1 条附言  ·  2018-01-12 16:28:06 +08:00
    javascript:function getRssUrl() { var baseUrl = document.location.href.split("/")[2]; var urlType = document.location.href.split("/")[3]; if (baseUrl == 'www.v2ex.com'&&; urlType =='go') { var theUrl ='https://www.v2ex.com/feed/' + document.location.href.split("/")[4] + '.xml'; } else if (baseUrl == 'www.v2ex.com'&&; urlType =='t') { var theUrl ='https://www.v2ex.com/feed/' + document.getElementsByClassName('header')[2].getElementsByTagName('a')[2].getAttribute('href').split("/")[2] + '.xml'; } else { alert('请在 V2EX 帖子或具体节点页面下使用。 —— zhangbohun'); return; } var theUrlDivNode = document.createElement("textarea"); theUrlDivNode.innerText = theUrl; theUrlDivNode.setAttribute("id", "this-page-url"); document.body.appendChild(theUrlDivNode); document.getElementById('this-page-url').select(); document.execCommand("Copy"); document.body.removeChild(document.getElementById('this-page-url')); window.open(theUrl);}getRssUrl();
    2 条回复    2016-10-24 13:15:07 +08:00
    aixiaoge
        1
    aixiaoge  
       2016-10-24 08:09:49 +08:00
    有啊,用的 Inoreader
    dynos01
        2
    dynos01  
       2016-10-24 13:15:07 +08:00 via iPhone
    有啊,看 rss 比开一大堆 app 方便多了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1022 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 19:50 · PVG 03:50 · LAX 12:50 · JFK 15:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.