Buttons by Author

Re: Buttons by Author

Postby bo3 » Wed Jul 31, 2013 10:52 pm

hi srazzano, you did a great job.
your buttons are awesome,
many thanks for you!
Image
bo3
 
Posts: 19
Joined: Wed Jul 17, 2013 9:02 am

Re: Buttons by Author

Postby morat » Fri Dec 13, 2013 5:31 am

Great button :D

BTW, I wrote a button to show the number of topics in the database for each user.

Code: Select all
/*Code*/
function getHrefAttribute(aAuthor) {
  return "http://custombuttons.sourceforge.net/forum/search.php" +
    "?author=" + aAuthor + "&fid%5b%5d=4&sf=titleonly&sr=topics";
}
var node = content.document.querySelector(".pagination");
if (content.document.domain == "custombuttons.sourceforge.net" &&
    content.document.location.pathname == "/forum/viewforum.php" && node) {
  var topics = node.textContent.match(/\d+/g)[0];
  for (var i = 25; i < topics; i = i + 25)
    gBrowser.addTab(content.document.location.href + "&start=" + i);
  if (topics > 25 && !content.confirm("Please wait for other tabs to load."))
    return;
  var o = {};
  for (var i = gBrowser.tabs.length - 1; i >= 0; i--) {
    if (gBrowser.tabContainer.selectedIndex > i) continue;
    var tab = gBrowser.tabs[i];
    var doc = tab.linkedBrowser.contentDocument;
    if (doc.domain == "custombuttons.sourceforge.net" &&
        doc.location.pathname == "/forum/viewforum.php") {
      var nodes = doc.querySelectorAll(".topictitle ~ a:last-of-type");
      for (var j = 0; j < nodes.length; j++) {
        var p = nodes[j].textContent;
        o[p] = o[p] ? o[p] + 1 : 1;
      }
      if (gBrowser.selectedTab != tab) gBrowser.removeTab(tab);
    }
  }
  var a = [];
  for (var p in o) a.push([p, o[p]]);
  a.sort(function (x, y) { return x[0].toLowerCase() > y[0].toLowerCase(); });
  a.sort(function (x, y) { return y[1] - x[1]; });
  for (var i = 0; i < a.length; i++) {
    a[i][1] = a[i][1] == 1 ? a[i][1] + " topic" : a[i][1] + " topics";
    a[i] = a[i][0].link(getHrefAttribute(a[i][0])) + " &#8211; " + a[i][1];
  }
  var data = [];
  data.push('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "<html>", "<head>");
  data.push('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
  data.push("<title>" + "Custom Buttons" + "</title>", "</head>", "<body>");
  data.push("<div>", a.join("<br>" + "\r\n"), "</div>", "</body>", "</html>");
  gBrowser.selectedTab = gBrowser.addTab("data:text/html;charset=utf-8;base64," +
    btoa(data.join("\r\n")));
} else {
  var url = "http://custombuttons.sourceforge.net/forum/viewforum.php?f=4";
  gBrowser.selectedTab = gBrowser.addTab(url);
}

morat - 37 topics
srazzano - 36 topics
slbgz - 27 topics
mrbunnylamakins - 14 topics
makondo - 11 topics
darkmatter - 9 topics
LouCypher - 7 topics
Barbiegirl - 5 topics
Odyseus - 5 topics
quick-orange - 4 topics
BobbyW - 3 topics
Infocatcher - 3 topics
caveatrob - 2 topics
Michele Pezza - 2 topics
steve.marks59 - 2 topics
dinosaur - 1 topic
Drake1132 - 1 topic
Fliegenwedel - 1 topic
Kvantum - 1 topic
Ruler2112 - 1 topic
Spectrix - 1 topic
squeaky - 1 topic

The button creates an html page with links to the database.
Last edited by morat on Sat Dec 14, 2013 10:18 am, edited 3 times in total.
Reason: skip tabs on left, add :last-of-type for mods
morat
 
Posts: 945
Joined: Wed Dec 28, 2011 2:38 pm

Re: Buttons by Author

Postby slbgz » Fri Dec 13, 2013 9:18 am

morat wrote:
morat - 37 topics
srazzano - 36 topics
slbgz - 27 topics
mrbunnylamakins - 14 topics
makondo - 11 topics
darkmatter - 9 topics
LouCypher - 7 topics
Barbiegirl - 5 topics
Odyseus - 5 topics
quick-orange - 4 topics
BobbyW - 3 topics
Infocatcher - 3 topics
caveatrob - 2 topics
Michele Pezza - 2 topics
steve.marks59 - 2 topics
dinosaur - 1 topic
Drake1132 - 1 topic
Fliegenwedel - 1 topic
Kvantum - 1 topic
Ruler2112 - 1 topic
Spectrix - 1 topic
squeaky - 1 topic

The button creates an html page with links to the database.

If this html page is opened in tab already (I am not sure... that it is the reason of ...), the next two clicks the button creates non-correct new html page (non-correct the number of topics):
srazzano - 44 topics
morat - 42 topics
slbgz - 29 topics
mrbunnylamakins - 14 topics
makondo - 11 topics
darkmatter - 9 topics
LouCypher - 8 topics
Odyseus - 8 topics
Barbiegirl - 6 topics
Infocatcher - 4 topics
quick-orange - 4 topics
BobbyW - 3 topics
caveatrob - 3 topics
Drake1132 - 2 topics
Fliegenwedel - 2 topics
Michele Pezza - 2 topics
squeaky - 2 topics
steve.marks59 - 2 topics
dinosaur - 1 topic
Kvantum - 1 topic
Ruler2112 - 1 topic
Spectrix - 1 topic
slbgz
 
Posts: 559
Joined: Sat Mar 10, 2012 5:51 pm
Location: село біля Львова, Україна

Re: Buttons by Author

Postby morat » Fri Dec 13, 2013 1:15 pm

@slbgz

You could add the following line to skip the tabs on the left.

Code: Select all
  for (var i = gBrowser.tabs.length - 1; i >= 0; i--) {
+   if (gBrowser.tabContainer.selectedIndex > i) continue;

slbgz wrote:If this html page is opened in tab already...

The button should not extract users from "/forum/viewtopic.php" threads.
morat
 
Posts: 945
Joined: Wed Dec 28, 2011 2:38 pm

Re: Buttons by Author

Postby slbgz » Sun Dec 15, 2013 6:53 pm

morat wrote:You could add the following line to skip the tabs on the left.


Thanks.
I added this line and added another line:
Code: Select all
 +   gBrowser.selectedTab = gBrowser.tabs[gBrowser.tabs.length - 1];
    var node = content.document.querySelector(".pagination");

All works fine now. :)
I will add your code to my CB forum search [buttons] by author [menu] button on long left click later. :D
slbgz
 
Posts: 559
Joined: Sat Mar 10, 2012 5:51 pm
Location: село біля Львова, Україна

Re: Buttons by Author

Postby makondo » Thu Sep 10, 2015 9:46 pm

srazzano,
my button moves on hover, about 1-2px down and right. Any idea why?

Buttons by Author
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

Re: Buttons by Author

Postby srazzano » Fri Sep 11, 2015 5:19 pm

Probably because you use 18px icons.
srazzano
 
Posts: 1508
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

Re: Buttons by Author

Postby makondo » Fri Sep 11, 2015 10:24 pm

Nothing else looks right. 16 does the same and looks weirdly small, 24 is too big and still moves ... No other button does this. I tried margins on hover, it just jumps around even worse. What size do you want me to use? In all other buttons, i we simply change the image in the image field/browse. But in your buttons most of them, i need to change it some other ways, either by changing it in the code or though options. I can't understand why.
In any case, what size do i need to stop this?
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

Re: Buttons by Author

Postby srazzano » Sat Sep 12, 2015 5:07 am

Try commenting out everything in the Help tab section, if anything is in there, and see if the issues goes away. There is no image sizing in the script section.
srazzano
 
Posts: 1508
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

Re: Buttons by Author

Postby makondo » Sat Sep 12, 2015 4:33 pm

I did and it's still the same. I also disabled all styles and it's still the same. As i said, oddly enough this is the only button that does this. The image is the same size i use on all my CB buttons. I just can't figure this one out ....
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

PreviousNext

Return to Buttons made by forum users