Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- function st(a) {
- return a.replace(/<[^>]*>/, '');
- }
- CmdUtils.CreateCommand({
- names: ["click", "click link", "c"],
- description: "Clicks a link.",
- author: {name: "SHiNKiROU"},
- license: "GPL",
- arguments: [{role: 'object', nountype: noun_arb_text}],
- preview: function preview(pblock, args) {
- pblock.innerHTML = ((args.object.text) ? _("List of links of ") + " <b>" + args.object.html + "</b>:" : '') + "<ul>";
- var doc = CmdUtils.getDocument();
- jQuery("a", doc).each(function(i, link) {
- link = jQuery(link);
- if (st(link.html()).match(args.object.text)) {
- pblock.innerHTML += "<li><b>" + st(link.html()) + "</b> : " + link.attr("href") + "</li>";
- }
- });
- pblock.innerHTML += "</ul>";
- },
- execute: function execute(args) {
- var doc = CmdUtils.getDocument();
- jQuery("a", doc).each(function(i, link) {
- link = jQuery(link);
- if (st(link.html()).match(args.object.text)) {
- CmdUtils.getWindow().location = link.attr("href");
- }
- });
- }
- });
- })();
Add Comment
Please, Sign In to add comment