Skip to content

Instantly share code, notes, and snippets.

@rtDNVdza
Created October 7, 2014 14:29
Show Gist options
  • Save rtDNVdza/3c4bf62be9741b1724c6 to your computer and use it in GitHub Desktop.
Save rtDNVdza/3c4bf62be9741b1724c6 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name v2NewReply
// @namespace http://bazqux.com?me=fdsfwf
// @include http://*.v2ex.com/my/topics*
// @include http://v2ex.com/my/topics*
// @version 1
// @grant none
// ==/UserScript==
function xpath(query){
return document.evaluate(query, document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}
var titles = xpath(" //span[@class='item_title'] ");
var yahoopipes = "http://pipes.yahoo.com/pipes/pipe.run?_id=37820060cc28fe2692d3aa0056aba4c2&_render=rss&topic=";
var bazqux = "https://bazqux.com/add?url=";
var title;
for (var i=0; i<titles.snapshotLength; i++){
title = titles.snapshotItem(i);
var feeds = document.createElement("span");
var topic_link = "http://v2ex.com" + title.firstChild.attributes.href.value;
feeds.innerHTML = '<br /> <a target="_blank" href=" ' + yahoopipes + topic_link + ' ">Feed |</a> <a target="_blank" href=" ' + bazqux + encodeURIComponent(yahoopipes + topic_link) +'"> Bazqux </a>';
title.appendChild(feeds);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment