Skip to content

Instantly share code, notes, and snippets.

@soh335
Created February 22, 2009 04:41
Show Gist options
  • Save soh335/68334 to your computer and use it in GitHub Desktop.
Save soh335/68334 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name addPermLink4tumblrDashboard
// @namespace d.hatena.ne.jp/sugarbabe335/
// @description add PermLink fot tumblr Dashboard page
// @include http://www.tumblr.com/dashboard/*
// @include http://www.tumblr.com/dashboard
// ==/UserScript==
(function(){
var ol = document.getElementById('posts');
for(var i = 0;i<ol.childNodes.length;i++){
if(ol.childNodes[i].id != undefined && ol.childNodes[i].id != ""){
var node = findByClassName(ol.childNodes[i].childNodes, "so_ie_doesnt_treat_this_as_inline");
if(node != null){
var href = node.childNodes[5].href;
}
var link = document.createElement('a');
link.setAttribute("href",href);
var text = document.createTextNode("link");
link.appendChild(text);
ol.childNodes[i].childNodes[3].appendChild(link);
}
}
function findByClassName(nodes, str){
for(var i = 0;i<nodes.length;i++){
if(nodes[i].className == str){
return nodes[i];
}
}
return null;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment