Created
June 5, 2009 01:16
-
-
Save jmcarbo/123983 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myText(textFormat) { | |
// get the active document in a secure way | |
var doc = CmdUtils.getDocument(); | |
var commenters = ""; | |
jQuery(doc.body).find('.comment-block h4 a').each( | |
function(i){ | |
if(!/img/i.test(this.innerHTML)){ | |
commenters += '@<b>' + this.innerHTML + '</b>: gràcies - gracias - thanks.'; | |
if(textFormat) { | |
commenters += '\n\n'; | |
} | |
else{ | |
commenters += '<br/>\n'; | |
} | |
} | |
} | |
); | |
return(commenters); | |
} | |
/* This is a template command. */ | |
CmdUtils.CreateCommand({ | |
name: "flickr-comment", | |
icon: "http://example.com/example.png", | |
homepage: "http://example.com/", | |
author: {name: "Joan Marc Carbo Arnau", email: "[email protected]"}, | |
license: "GPL", | |
description: "Outputs flickr comment response to users", | |
help: "Just place your cursor in the comment box", | |
takes: {"input": /.*/}, | |
preview: function(pblock, input) { | |
// find div.foo in the body of that document | |
pblock.innerHTML = myText(false); | |
}, | |
execute: function(input) { | |
CmdUtils.setSelection(myText(false),{ text: myText(true)}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment