Skip to content

Conversation

kxxoling
Copy link
Collaborator

@kxxoling kxxoling commented Nov 7, 2017

Preview:
image

And my settings:

  "plugins": [
     "github-buttons"
   ],
   "pluginsConfig": {
     "github-buttons": {
       "buttons": [{
         "user": "kxxoling",
         "type": "follow",
         "size": "large",
         "width": "234"
       }]
     }
  }

@kxxoling
Copy link
Collaborator Author

kxxoling commented Nov 7, 2017

Since this would break the former config, it's better to publish with a higher version, which is 3.0.0.

src/plugin.js Outdated
var size = size || "large";
var width = width || (size === "large" ? "150" : "100");
var height = height || (size === "large" ? "30" : "20");
var count = typeof count === "undefined" ? "true" : "false";
Copy link
Owner

@azu azu Nov 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should treat count: true setting as var count = true.

Can you change this to following?

var count = typeof count === "boolean" ? String(count) : "false";

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved from your code: https://github.com/azu/gitbook-plugin-github-buttons/blob/master/src/plugin.js#L58
and would be applied to both createButton and createUserButton. Should I?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved from your code:

Oh, sorry.

would be applied to both createButton and createUserButton. Should I?

Yes, Could you please do it?

Copy link
Collaborator Author

@kxxoling kxxoling Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I think var count = typeof count === "boolean" ? count : false; would be more directly.

One more thing, should we regard non boolean (including undefined) values as false or true?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing, should we regard non boolean (including undefined) values as false or true?

https://ghbtns.com/github-btn.html?user=twbs&repo=bootstrap&type=watch
Default value seem to be false.

Copy link
Owner

@azu azu Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var count = typeof count === "boolean" ? count : false;

I agree. (also need to update README.md)

      "buttons": [{
        "user": "azu",
        "repo": "JavaScript-Plugin-Architecture",
        "type": "star",
        "size": "large"
      }, {
        "user": "azu",
        "type": "follow",
        "width": "230",
-        "count": "false"
+        "count": false
      }]

@kxxoling kxxoling force-pushed the feature/user-follow-support branch from b4d81ff to f746e82 Compare November 8, 2017 11:58
@kxxoling
Copy link
Collaborator Author

kxxoling commented Nov 8, 2017

Fixed and updated.

@azu azu merged commit afa4ac5 into azu:master Nov 11, 2017
@azu
Copy link
Owner

azu commented Nov 11, 2017

@kxxoling Thanks!

@azu azu mentioned this pull request Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants