├── .editorconfig
├── CNAME
├── README.md
├── demo.html
├── docs
├── .gitignore
├── 404.html
├── CNAME
├── Gemfile
├── Gemfile.lock
├── _config.yml
├── _layouts
│ ├── default.html
│ └── landing.html
├── _posts
│ └── blog-post.markdown
├── _sass
│ ├── _highlighting.scss
│ ├── _normalise.scss
│ ├── _typography.scss
│ └── _utilities.scss
├── css
│ └── main.scss
├── favicon.ico
├── img
│ ├── github.svg
│ ├── mb-browser.gif
│ ├── product-hunt-2.png
│ ├── product-hunt.png
│ ├── theme-one.png
│ ├── theme-three.png
│ └── theme-two.png
├── index.md
└── js
│ └── makerbadge.js
└── makerbadge.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | makerbadge.app
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MakerBadge
2 | ### An open-source badge to put your mark on every project.
3 |
4 |
9 |
10 | ### How to run the demo site:
11 | To serve jekyll site, from /docs, run: `bundle exec jekyll serve`
12 |
13 |
14 |
15 | ---
16 |
17 | # How to use MakerBadge:
18 | Use it in 2 steps:
19 |
20 | ## 1. Get your badge:
21 |
22 | ```html
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 | ```
33 | Your Product Hunt ID can be foud on your PH profile page (e.g. #309280).
34 |
35 | Download MakerBadge.js
36 |
37 | ## 2. Customise your badge (Beta):
38 |
39 | Choose from 3 themes, and customise layout:
40 |
41 | ```html
42 |
52 | ```
53 |
54 | ---
55 |
56 | # Contribute
57 |
58 | Proudly an open source project.
59 |
60 | Feel free to contribute here
61 |
--------------------------------------------------------------------------------
/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Random page
7 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | _site
2 | .sass-cache
3 | .jekyll-metadata
4 |
--------------------------------------------------------------------------------
/docs/404.html:
--------------------------------------------------------------------------------
1 | ---
2 | layout: default
3 | ---
4 |
5 |
404
6 |
Page not found :(
7 |
The requested page could not be found.
8 |
9 |
--------------------------------------------------------------------------------
/docs/CNAME:
--------------------------------------------------------------------------------
1 | makerbadge.app
--------------------------------------------------------------------------------
/docs/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | # Hello! This is where you manage which Jekyll version is used to run.
4 | # When you want to use a different version, change it below, save the
5 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
6 | #
7 | # bundle exec jekyll serve
8 | #
9 | # This will help ensure the proper Jekyll version is running.
10 | # Happy Jekylling!
11 | # gem "jekyll", "~> 3.8.4"
12 |
13 | # This is the default theme for new Jekyll sites. You may change this to anything you like.
14 | gem "minima", "~> 2.0"
15 |
16 | # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
17 | # uncomment the line below. To upgrade, run `bundle update github-pages`.
18 | gem "github-pages", group: :jekyll_plugins
19 |
20 | # If you have any plugins, put them here!
21 | group :jekyll_plugins do
22 | gem "jekyll-feed", "~> 0.6"
23 | end
24 |
25 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
26 | gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
27 |
28 | # Performance-booster for watching directories on Windows
29 | gem "wdm", "~> 0.1.0" if Gem.win_platform?
30 |
31 |
--------------------------------------------------------------------------------
/docs/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | activesupport (4.2.10)
5 | i18n (~> 0.7)
6 | minitest (~> 5.1)
7 | thread_safe (~> 0.3, >= 0.3.4)
8 | tzinfo (~> 1.1)
9 | addressable (2.5.2)
10 | public_suffix (>= 2.0.2, < 4.0)
11 | coffee-script (2.4.1)
12 | coffee-script-source
13 | execjs
14 | coffee-script-source (1.11.1)
15 | colorator (1.1.0)
16 | commonmarker (0.17.13)
17 | ruby-enum (~> 0.5)
18 | concurrent-ruby (1.0.5)
19 | dnsruby (1.61.2)
20 | addressable (~> 2.5)
21 | em-websocket (0.5.1)
22 | eventmachine (>= 0.12.9)
23 | http_parser.rb (~> 0.6.0)
24 | ethon (0.11.0)
25 | ffi (>= 1.3.0)
26 | eventmachine (1.2.7)
27 | execjs (2.7.0)
28 | faraday (0.15.3)
29 | multipart-post (>= 1.2, < 3)
30 | ffi (1.9.25)
31 | forwardable-extended (2.6.0)
32 | gemoji (3.0.0)
33 | github-pages (192)
34 | activesupport (= 4.2.10)
35 | github-pages-health-check (= 1.8.1)
36 | jekyll (= 3.7.4)
37 | jekyll-avatar (= 0.6.0)
38 | jekyll-coffeescript (= 1.1.1)
39 | jekyll-commonmark-ghpages (= 0.1.5)
40 | jekyll-default-layout (= 0.1.4)
41 | jekyll-feed (= 0.10.0)
42 | jekyll-gist (= 1.5.0)
43 | jekyll-github-metadata (= 2.9.4)
44 | jekyll-mentions (= 1.4.1)
45 | jekyll-optional-front-matter (= 0.3.0)
46 | jekyll-paginate (= 1.1.0)
47 | jekyll-readme-index (= 0.2.0)
48 | jekyll-redirect-from (= 0.14.0)
49 | jekyll-relative-links (= 0.5.3)
50 | jekyll-remote-theme (= 0.3.1)
51 | jekyll-sass-converter (= 1.5.2)
52 | jekyll-seo-tag (= 2.5.0)
53 | jekyll-sitemap (= 1.2.0)
54 | jekyll-swiss (= 0.4.0)
55 | jekyll-theme-architect (= 0.1.1)
56 | jekyll-theme-cayman (= 0.1.1)
57 | jekyll-theme-dinky (= 0.1.1)
58 | jekyll-theme-hacker (= 0.1.1)
59 | jekyll-theme-leap-day (= 0.1.1)
60 | jekyll-theme-merlot (= 0.1.1)
61 | jekyll-theme-midnight (= 0.1.1)
62 | jekyll-theme-minimal (= 0.1.1)
63 | jekyll-theme-modernist (= 0.1.1)
64 | jekyll-theme-primer (= 0.5.3)
65 | jekyll-theme-slate (= 0.1.1)
66 | jekyll-theme-tactile (= 0.1.1)
67 | jekyll-theme-time-machine (= 0.1.1)
68 | jekyll-titles-from-headings (= 0.5.1)
69 | jemoji (= 0.10.1)
70 | kramdown (= 1.17.0)
71 | liquid (= 4.0.0)
72 | listen (= 3.1.5)
73 | mercenary (~> 0.3)
74 | minima (= 2.5.0)
75 | nokogiri (>= 1.8.2, < 2.0)
76 | rouge (= 2.2.1)
77 | terminal-table (~> 1.4)
78 | github-pages-health-check (1.8.1)
79 | addressable (~> 2.3)
80 | dnsruby (~> 1.60)
81 | octokit (~> 4.0)
82 | public_suffix (~> 2.0)
83 | typhoeus (~> 1.3)
84 | html-pipeline (2.8.4)
85 | activesupport (>= 2)
86 | nokogiri (>= 1.4)
87 | http_parser.rb (0.6.0)
88 | i18n (0.9.5)
89 | concurrent-ruby (~> 1.0)
90 | jekyll (3.7.4)
91 | addressable (~> 2.4)
92 | colorator (~> 1.0)
93 | em-websocket (~> 0.5)
94 | i18n (~> 0.7)
95 | jekyll-sass-converter (~> 1.0)
96 | jekyll-watch (~> 2.0)
97 | kramdown (~> 1.14)
98 | liquid (~> 4.0)
99 | mercenary (~> 0.3.3)
100 | pathutil (~> 0.9)
101 | rouge (>= 1.7, < 4)
102 | safe_yaml (~> 1.0)
103 | jekyll-avatar (0.6.0)
104 | jekyll (~> 3.0)
105 | jekyll-coffeescript (1.1.1)
106 | coffee-script (~> 2.2)
107 | coffee-script-source (~> 1.11.1)
108 | jekyll-commonmark (1.2.0)
109 | commonmarker (~> 0.14)
110 | jekyll (>= 3.0, < 4.0)
111 | jekyll-commonmark-ghpages (0.1.5)
112 | commonmarker (~> 0.17.6)
113 | jekyll-commonmark (~> 1)
114 | rouge (~> 2)
115 | jekyll-default-layout (0.1.4)
116 | jekyll (~> 3.0)
117 | jekyll-feed (0.10.0)
118 | jekyll (~> 3.3)
119 | jekyll-gist (1.5.0)
120 | octokit (~> 4.2)
121 | jekyll-github-metadata (2.9.4)
122 | jekyll (~> 3.1)
123 | octokit (~> 4.0, != 4.4.0)
124 | jekyll-mentions (1.4.1)
125 | html-pipeline (~> 2.3)
126 | jekyll (~> 3.0)
127 | jekyll-optional-front-matter (0.3.0)
128 | jekyll (~> 3.0)
129 | jekyll-paginate (1.1.0)
130 | jekyll-readme-index (0.2.0)
131 | jekyll (~> 3.0)
132 | jekyll-redirect-from (0.14.0)
133 | jekyll (~> 3.3)
134 | jekyll-relative-links (0.5.3)
135 | jekyll (~> 3.3)
136 | jekyll-remote-theme (0.3.1)
137 | jekyll (~> 3.5)
138 | rubyzip (>= 1.2.1, < 3.0)
139 | jekyll-sass-converter (1.5.2)
140 | sass (~> 3.4)
141 | jekyll-seo-tag (2.5.0)
142 | jekyll (~> 3.3)
143 | jekyll-sitemap (1.2.0)
144 | jekyll (~> 3.3)
145 | jekyll-swiss (0.4.0)
146 | jekyll-theme-architect (0.1.1)
147 | jekyll (~> 3.5)
148 | jekyll-seo-tag (~> 2.0)
149 | jekyll-theme-cayman (0.1.1)
150 | jekyll (~> 3.5)
151 | jekyll-seo-tag (~> 2.0)
152 | jekyll-theme-dinky (0.1.1)
153 | jekyll (~> 3.5)
154 | jekyll-seo-tag (~> 2.0)
155 | jekyll-theme-hacker (0.1.1)
156 | jekyll (~> 3.5)
157 | jekyll-seo-tag (~> 2.0)
158 | jekyll-theme-leap-day (0.1.1)
159 | jekyll (~> 3.5)
160 | jekyll-seo-tag (~> 2.0)
161 | jekyll-theme-merlot (0.1.1)
162 | jekyll (~> 3.5)
163 | jekyll-seo-tag (~> 2.0)
164 | jekyll-theme-midnight (0.1.1)
165 | jekyll (~> 3.5)
166 | jekyll-seo-tag (~> 2.0)
167 | jekyll-theme-minimal (0.1.1)
168 | jekyll (~> 3.5)
169 | jekyll-seo-tag (~> 2.0)
170 | jekyll-theme-modernist (0.1.1)
171 | jekyll (~> 3.5)
172 | jekyll-seo-tag (~> 2.0)
173 | jekyll-theme-primer (0.5.3)
174 | jekyll (~> 3.5)
175 | jekyll-github-metadata (~> 2.9)
176 | jekyll-seo-tag (~> 2.0)
177 | jekyll-theme-slate (0.1.1)
178 | jekyll (~> 3.5)
179 | jekyll-seo-tag (~> 2.0)
180 | jekyll-theme-tactile (0.1.1)
181 | jekyll (~> 3.5)
182 | jekyll-seo-tag (~> 2.0)
183 | jekyll-theme-time-machine (0.1.1)
184 | jekyll (~> 3.5)
185 | jekyll-seo-tag (~> 2.0)
186 | jekyll-titles-from-headings (0.5.1)
187 | jekyll (~> 3.3)
188 | jekyll-watch (2.0.0)
189 | listen (~> 3.0)
190 | jemoji (0.10.1)
191 | gemoji (~> 3.0)
192 | html-pipeline (~> 2.2)
193 | jekyll (~> 3.0)
194 | kramdown (1.17.0)
195 | liquid (4.0.0)
196 | listen (3.1.5)
197 | rb-fsevent (~> 0.9, >= 0.9.4)
198 | rb-inotify (~> 0.9, >= 0.9.7)
199 | ruby_dep (~> 1.2)
200 | mercenary (0.3.6)
201 | mini_portile2 (2.3.0)
202 | minima (2.5.0)
203 | jekyll (~> 3.5)
204 | jekyll-feed (~> 0.9)
205 | jekyll-seo-tag (~> 2.1)
206 | minitest (5.11.3)
207 | multipart-post (2.0.0)
208 | nokogiri (1.8.4)
209 | mini_portile2 (~> 2.3.0)
210 | octokit (4.12.0)
211 | sawyer (~> 0.8.0, >= 0.5.3)
212 | pathutil (0.16.1)
213 | forwardable-extended (~> 2.6)
214 | public_suffix (2.0.5)
215 | rb-fsevent (0.10.3)
216 | rb-inotify (0.9.10)
217 | ffi (>= 0.5.0, < 2)
218 | rouge (2.2.1)
219 | ruby-enum (0.7.2)
220 | i18n
221 | ruby_dep (1.5.0)
222 | rubyzip (1.2.2)
223 | safe_yaml (1.0.4)
224 | sass (3.6.0)
225 | sass-listen (~> 4.0.0)
226 | sass-listen (4.0.0)
227 | rb-fsevent (~> 0.9, >= 0.9.4)
228 | rb-inotify (~> 0.9, >= 0.9.7)
229 | sawyer (0.8.1)
230 | addressable (>= 2.3.5, < 2.6)
231 | faraday (~> 0.8, < 1.0)
232 | terminal-table (1.8.0)
233 | unicode-display_width (~> 1.1, >= 1.1.1)
234 | thread_safe (0.3.6)
235 | typhoeus (1.3.0)
236 | ethon (>= 0.9.0)
237 | tzinfo (1.2.5)
238 | thread_safe (~> 0.1)
239 | unicode-display_width (1.4.0)
240 |
241 | PLATFORMS
242 | ruby
243 |
244 | DEPENDENCIES
245 | github-pages
246 | jekyll-feed (~> 0.6)
247 | minima (~> 2.0)
248 | tzinfo-data
249 |
250 | BUNDLED WITH
251 | 1.16.5
252 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | # Welcome to Jekyll!
2 | #
3 | # This config file is meant for settings that affect your whole blog, values
4 | # which you are expected to set up once and rarely edit after that. If you find
5 | # yourself editing this file very often, consider using Jekyll's data files
6 | # feature for the data you need to update frequently.
7 | #
8 | # For technical reasons, this file is *NOT* reloaded automatically when you use
9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10 |
11 | # Site settings
12 | # These are used to personalize your new site. If you look in the HTML files,
13 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14 | # You can create any custom variable you would like, and they will be accessible
15 | # in the templates via {{ site.myvariable }}.
16 | title: MakerBadge
17 | email: chriskoningsi@gmail.com
18 | description: >- # this means to ignore newlines until "baseurl:"
19 | MakerBadge is the website badge for makers with easy access to Product Hunt stats and more!
20 | baseurl: "" # the subpath of your site, e.g. /blog
21 | url: "makerbadge.prototypr.com" # the base hostname & protocol for your site, e.g. http://example.com
22 | twitter_username: chriskonings
23 | github_username: chriskonings
24 | markdown: kramdown
25 | highlighter: rouge
26 | sass:
27 | sass_dir: _sass
28 | style: compressed
29 | plugins:
30 | - jekyll-feed
31 | kramdown:
32 | input: GFM
33 | syntax_highlighter: rouge
34 |
35 | # Exclude from processing.
36 | # The following items will not be processed, by default. Create a custom list
37 | # to override the default setting.
38 | # exclude:
39 | # - Gemfile
40 | # - Gemfile.lock
41 | # - node_modules
42 | # - vendor/bundle/
43 | # - vendor/cache/
44 | # - vendor/gems/
45 | # - vendor/ruby/
46 |
--------------------------------------------------------------------------------
/docs/_layouts/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ page.title }}
6 |
7 |
8 |
9 |
12 |
13 | {{ content }}
14 |
15 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/docs/_layouts/landing.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ page.title }}
6 |
7 |
8 |
9 |
12 |
13 | {{ content }}
14 |
15 |
18 |
21 |
22 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/docs/_posts/blog-post.markdown:
--------------------------------------------------------------------------------
1 | ---
2 | layout: post
3 | title: "Blog post"
4 | # date: 2018-09-28 14:25:24 -0700
5 | categories: blog update
6 | ---
7 |
8 | Here's a blog post if we need one
9 |
--------------------------------------------------------------------------------
/docs/_sass/_highlighting.scss:
--------------------------------------------------------------------------------
1 | .highlight .hll { background-color: #ffffcc }
2 | .highlight { color: #151515; background: #f8f8f8; padding: 1rem; }
3 | .highlight .c { color: #408080; font-style: italic } /* Comment */
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
5 | .highlight .k { color: #008000; font-weight: bold } /* Keyword */
6 | .highlight .o { color: #666666 } /* Operator */
7 | .highlight .ch { color: #408080; font-style: italic } /* Comment.Hashbang */
8 | .highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
9 | .highlight .cp { color: #BC7A00 } /* Comment.Preproc */
10 | .highlight .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #888888 } /* Generic.Output */
19 | .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #008000 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #B00040 } /* Keyword.Type */
29 | .highlight .m { color: #666666 } /* Literal.Number */
30 | .highlight .s { color: #BA2121 } /* Literal.String */
31 | .highlight .na { color: #7D9029 } /* Name.Attribute */
32 | .highlight .nb { color: #008000 } /* Name.Builtin */
33 | .highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #880000 } /* Name.Constant */
35 | .highlight .nd { color: #AA22FF } /* Name.Decorator */
36 | .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
38 | .highlight .nf { color: #0000FF } /* Name.Function */
39 | .highlight .nl { color: #A0A000 } /* Name.Label */
40 | .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #19177C } /* Name.Variable */
43 | .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #666666 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #666666 } /* Literal.Number.Float */
47 | .highlight .mh { color: #666666 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #666666 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #666666 } /* Literal.Number.Oct */
50 | .highlight .sa { color: #BA2121 } /* Literal.String.Affix */
51 | .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
52 | .highlight .sc { color: #BA2121 } /* Literal.String.Char */
53 | .highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */
54 | .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
55 | .highlight .s2 { color: #BA2121 } /* Literal.String.Double */
56 | .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
57 | .highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
58 | .highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
59 | .highlight .sx { color: #008000 } /* Literal.String.Other */
60 | .highlight .sr { color: #BB6688 } /* Literal.String.Regex */
61 | .highlight .s1 { color: #BA2121 } /* Literal.String.Single */
62 | .highlight .ss { color: #19177C } /* Literal.String.Symbol */
63 | .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
64 | .highlight .fm { color: #0000FF } /* Name.Function.Magic */
65 | .highlight .vc { color: #19177C } /* Name.Variable.Class */
66 | .highlight .vg { color: #19177C } /* Name.Variable.Global */
67 | .highlight .vi { color: #19177C } /* Name.Variable.Instance */
68 | .highlight .vm { color: #19177C } /* Name.Variable.Magic */
69 | .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
70 |
--------------------------------------------------------------------------------
/docs/_sass/_normalise.scss:
--------------------------------------------------------------------------------
1 | /* ==========================================================================
2 | Normalize.scss settings
3 | ========================================================================== */
4 | /**
5 | * Includes legacy browser support IE6/7
6 | *
7 | * Set to false if you want to drop support for IE6 and IE7
8 | */
9 |
10 | $legacy_browser_support: false !default;
11 |
12 | /* Base
13 | ========================================================================== */
14 |
15 | /**
16 | * 1. Set default font family to sans-serif.
17 | * 2. Prevent iOS and IE text size adjust after device orientation change,
18 | * without disabling user zoom.
19 | * 3. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using
20 | * `em` units.
21 | */
22 |
23 | html {
24 | font-family: sans-serif; /* 1 */
25 | -ms-text-size-adjust: 100%; /* 2 */
26 | -webkit-text-size-adjust: 100%; /* 2 */
27 | @if $legacy_browser_support {
28 | *font-size: 100%; /* 3 */
29 | }
30 | }
31 |
32 | /**
33 | * Remove default margin.
34 | */
35 |
36 | body {
37 | margin: 0;
38 | }
39 |
40 | /* HTML5 display definitions
41 | ========================================================================== */
42 |
43 | /**
44 | * Correct `block` display not defined for any HTML5 element in IE 8/9.
45 | * Correct `block` display not defined for `details` or `summary` in IE 10/11
46 | * and Firefox.
47 | * Correct `block` display not defined for `main` in IE 11.
48 | */
49 |
50 | article,
51 | aside,
52 | details,
53 | figcaption,
54 | figure,
55 | footer,
56 | header,
57 | hgroup,
58 | main,
59 | menu,
60 | nav,
61 | section,
62 | summary {
63 | display: block;
64 | }
65 |
66 | /**
67 | * 1. Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
68 | * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
69 | */
70 |
71 | audio,
72 | canvas,
73 | progress,
74 | video {
75 | display: inline-block; /* 1 */
76 | vertical-align: baseline; /* 2 */
77 | @if $legacy_browser_support {
78 | *display: inline;
79 | *zoom: 1;
80 | }
81 | }
82 |
83 | /**
84 | * Prevents modern browsers from displaying `audio` without controls.
85 | * Remove excess height in iOS 5 devices.
86 | */
87 |
88 | audio:not([controls]) {
89 | display: none;
90 | height: 0;
91 | }
92 |
93 | /**
94 | * Address `[hidden]` styling not present in IE 8/9/10.
95 | * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
96 | */
97 |
98 | [hidden],
99 | template {
100 | display: none;
101 | }
102 |
103 | /* Links
104 | ========================================================================== */
105 |
106 | /**
107 | * Remove the gray background color from active links in IE 10.
108 | */
109 |
110 | a {
111 | background-color: transparent;
112 | }
113 |
114 | /**
115 | * Improve readability of focused elements when they are also in an
116 | * active/hover state.
117 | */
118 |
119 | a {
120 | &:active, &:hover {
121 | outline: 0;
122 | };
123 | }
124 |
125 | /* Text-level semantics
126 | ========================================================================== */
127 |
128 | /**
129 | * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
130 | */
131 |
132 | abbr[title] {
133 | border-bottom: 1px dotted;
134 | }
135 |
136 | /**
137 | * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
138 | */
139 |
140 | b,
141 | strong {
142 | font-weight: bold;
143 | }
144 |
145 | @if $legacy_browser_support {
146 | blockquote {
147 | margin: 1em 40px;
148 | }
149 | }
150 |
151 | /**
152 | * Address styling not present in Safari and Chrome.
153 | */
154 |
155 | dfn {
156 | font-style: italic;
157 | }
158 |
159 | /**
160 | * Address variable `h1` font-size and margin within `section` and `article`
161 | * contexts in Firefox 4+, Safari, and Chrome.
162 | */
163 |
164 | h1 {
165 | font-size: 2em;
166 | margin: 0.67em 0;
167 | }
168 |
169 | @if $legacy_browser_support {
170 | h2 {
171 | font-size: 1.5em;
172 | margin: 0.83em 0;
173 | }
174 |
175 | h3 {
176 | font-size: 1.17em;
177 | margin: 1em 0;
178 | }
179 |
180 | h4 {
181 | font-size: 1em;
182 | margin: 1.33em 0;
183 | }
184 |
185 | h5 {
186 | font-size: 0.83em;
187 | margin: 1.67em 0;
188 | }
189 |
190 | h6 {
191 | font-size: 0.67em;
192 | margin: 2.33em 0;
193 | }
194 | }
195 |
196 | /**
197 | * Addresses styling not present in IE 8/9.
198 | */
199 |
200 | mark {
201 | background: #ff0;
202 | color: #000;
203 | }
204 |
205 | @if $legacy_browser_support {
206 |
207 | /**
208 | * Addresses margins set differently in IE 6/7.
209 | */
210 |
211 | p,
212 | pre {
213 | *margin: 1em 0;
214 | }
215 |
216 | /*
217 | * Addresses CSS quotes not supported in IE 6/7.
218 | */
219 |
220 | q {
221 | *quotes: none;
222 | }
223 |
224 | /*
225 | * Addresses `quotes` property not supported in Safari 4.
226 | */
227 |
228 | q:before,
229 | q:after {
230 | content: '';
231 | content: none;
232 | }
233 | }
234 |
235 | /**
236 | * Address inconsistent and variable font size in all browsers.
237 | */
238 |
239 | small {
240 | font-size: 80%;
241 | }
242 |
243 | /**
244 | * Prevent `sub` and `sup` affecting `line-height` in all browsers.
245 | */
246 |
247 | sub,
248 | sup {
249 | font-size: 75%;
250 | line-height: 0;
251 | position: relative;
252 | vertical-align: baseline;
253 | }
254 |
255 | sup {
256 | top: -0.5em;
257 | }
258 |
259 | sub {
260 | bottom: -0.25em;
261 | }
262 |
263 | @if $legacy_browser_support {
264 |
265 | /* ==========================================================================
266 | Lists
267 | ========================================================================== */
268 |
269 | /*
270 | * Addresses margins set differently in IE 6/7.
271 | */
272 |
273 | dl,
274 | menu,
275 | ol,
276 | ul {
277 | *margin: 1em 0;
278 | }
279 |
280 | dd {
281 | *margin: 0 0 0 40px;
282 | }
283 |
284 | /*
285 | * Addresses paddings set differently in IE 6/7.
286 | */
287 |
288 | menu,
289 | ol,
290 | ul {
291 | *padding: 0 0 0 40px;
292 | }
293 |
294 | /*
295 | * Corrects list images handled incorrectly in IE 7.
296 | */
297 |
298 | nav ul,
299 | nav ol {
300 | *list-style: none;
301 | *list-style-image: none;
302 | }
303 |
304 | }
305 |
306 | /* Embedded content
307 | ========================================================================== */
308 |
309 | /**
310 | * 1. Remove border when inside `a` element in IE 8/9/10.
311 | * 2. Improves image quality when scaled in IE 7.
312 | */
313 |
314 | img {
315 | border: 0;
316 | @if $legacy_browser_support {
317 | *-ms-interpolation-mode: bicubic; /* 2 */
318 | }
319 | }
320 |
321 | /**
322 | * Correct overflow not hidden in IE 9/10/11.
323 | */
324 |
325 | svg:not(:root) {
326 | overflow: hidden;
327 | }
328 |
329 | /* Grouping content
330 | ========================================================================== */
331 |
332 | /**
333 | * Address margin not present in IE 8/9 and Safari.
334 | */
335 |
336 | figure {
337 | margin: 1em 40px;
338 | }
339 |
340 | /**
341 | * Address differences between Firefox and other browsers.
342 | */
343 |
344 | hr {
345 | box-sizing: content-box;
346 | height: 0;
347 | }
348 |
349 | /**
350 | * Contain overflow in all browsers.
351 | */
352 |
353 | pre {
354 | overflow: auto;
355 | }
356 |
357 | /**
358 | * Address odd `em`-unit font size rendering in all browsers.
359 | * Correct font family set oddly in IE 6, Safari 4/5, and Chrome.
360 | */
361 |
362 | code,
363 | kbd,
364 | pre,
365 | samp {
366 | font-family: monospace, monospace;
367 | @if $legacy_browser_support {
368 | _font-family: 'courier new', monospace;
369 | }
370 | font-size: 1em;
371 | }
372 |
373 | /* Forms
374 | ========================================================================== */
375 |
376 | /**
377 | * Known limitation: by default, Chrome and Safari on OS X allow very limited
378 | * styling of `select`, unless a `border` property is set.
379 | */
380 |
381 | /**
382 | * 1. Correct color not being inherited.
383 | * Known issue: affects color of disabled elements.
384 | * 2. Correct font properties not being inherited.
385 | * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
386 | * 4. Improves appearance and consistency in all browsers.
387 | */
388 |
389 | button,
390 | input,
391 | optgroup,
392 | select,
393 | textarea {
394 | color: inherit; /* 1 */
395 | font: inherit; /* 2 */
396 | margin: 0; /* 3 */
397 | @if $legacy_browser_support {
398 | vertical-align: baseline; /* 3 */
399 | *vertical-align: middle; /* 3 */
400 | }
401 | }
402 |
403 | /**
404 | * Address `overflow` set to `hidden` in IE 8/9/10/11.
405 | */
406 |
407 | button {
408 | overflow: visible;
409 | }
410 |
411 | /**
412 | * Address inconsistent `text-transform` inheritance for `button` and `select`.
413 | * All other form control elements do not inherit `text-transform` values.
414 | * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
415 | * Correct `select` style inheritance in Firefox.
416 | */
417 |
418 | button,
419 | select {
420 | text-transform: none;
421 | }
422 |
423 | /**
424 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
425 | * and `video` controls.
426 | * 2. Correct inability to style clickable `input` types in iOS.
427 | * 3. Improve usability and consistency of cursor style between image-type
428 | * `input` and others.
429 | * 4. Removes inner spacing in IE 7 without affecting normal text inputs.
430 | * Known issue: inner spacing remains in IE 6.
431 | */
432 |
433 | button,
434 | html input[type="button"], /* 1 */
435 | input[type="reset"],
436 | input[type="submit"] {
437 | -webkit-appearance: button; /* 2 */
438 | cursor: pointer; /* 3 */
439 | @if $legacy_browser_support {
440 | *overflow: visible; /* 4 */
441 | }
442 | }
443 |
444 | /**
445 | * Re-set default cursor for disabled elements.
446 | */
447 |
448 | button[disabled],
449 | html input[disabled] {
450 | cursor: default;
451 | }
452 |
453 | /**
454 | * Remove inner padding and border in Firefox 4+.
455 | */
456 |
457 | button::-moz-focus-inner,
458 | input::-moz-focus-inner {
459 | border: 0;
460 | padding: 0;
461 | }
462 |
463 | /**
464 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in
465 | * the UA stylesheet.
466 | */
467 |
468 | input {
469 | line-height: normal;
470 | }
471 |
472 | /**
473 | * 1. Address box sizing set to `content-box` in IE 8/9/10.
474 | * 2. Remove excess padding in IE 8/9/10.
475 | * Known issue: excess padding remains in IE 6.
476 | */
477 |
478 | input[type="checkbox"],
479 | input[type="radio"] {
480 | box-sizing: border-box; /* 1 */
481 | padding: 0; /* 2 */
482 | @if $legacy_browser_support {
483 | *height: 13px; /* 3 */
484 | *width: 13px; /* 3 */
485 | }
486 | }
487 |
488 | /**
489 | * Fix the cursor style for Chrome's increment/decrement buttons. For certain
490 | * `font-size` values of the `input`, it causes the cursor style of the
491 | * decrement button to change from `default` to `text`.
492 | */
493 |
494 | input[type="number"]::-webkit-inner-spin-button,
495 | input[type="number"]::-webkit-outer-spin-button {
496 | height: auto;
497 | }
498 |
499 | /**
500 | * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
501 | * 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
502 | */
503 |
504 | input[type="search"] {
505 | -webkit-appearance: textfield; /* 1 */
506 | box-sizing: content-box; /* 2 */
507 | }
508 |
509 | /**
510 | * Remove inner padding and search cancel button in Safari and Chrome on OS X.
511 | * Safari (but not Chrome) clips the cancel button when the search input has
512 | * padding (and `textfield` appearance).
513 | */
514 |
515 | input[type="search"]::-webkit-search-cancel-button,
516 | input[type="search"]::-webkit-search-decoration {
517 | -webkit-appearance: none;
518 | }
519 |
520 | /**
521 | * Define consistent border, margin, and padding.
522 | */
523 |
524 | fieldset {
525 | border: 1px solid #c0c0c0;
526 | margin: 0 2px;
527 | padding: 0.35em 0.625em 0.75em;
528 | }
529 |
530 | /**
531 | * 1. Correct `color` not being inherited in IE 8/9/10/11.
532 | * 2. Remove padding so people aren't caught out if they zero out fieldsets.
533 | * 3. Corrects text not wrapping in Firefox 3.
534 | * 4. Corrects alignment displayed oddly in IE 6/7.
535 | */
536 |
537 | legend {
538 | border: 0; /* 1 */
539 | padding: 0; /* 2 */
540 | @if $legacy_browser_support {
541 | white-space: normal; /* 3 */
542 | *margin-left: -7px; /* 4 */
543 | }
544 | }
545 |
546 | /**
547 | * Remove default vertical scrollbar in IE 8/9/10/11.
548 | */
549 |
550 | textarea {
551 | overflow: auto;
552 | }
553 |
554 | /**
555 | * Don't inherit the `font-weight` (applied by a rule above).
556 | * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
557 | */
558 |
559 | optgroup {
560 | font-weight: bold;
561 | }
562 |
563 | /* Tables
564 | ========================================================================== */
565 |
566 | /**
567 | * Remove most spacing between table cells.
568 | */
569 |
570 | table {
571 | border-collapse: collapse;
572 | border-spacing: 0;
573 | }
574 |
575 | td,
576 | th {
577 | padding: 0;
578 | }
579 |
--------------------------------------------------------------------------------
/docs/_sass/_typography.scss:
--------------------------------------------------------------------------------
1 | html {font-size: 1em;}
2 |
3 | .body {
4 | font-family: 'Roboto', sans-serif;
5 | font-weight: 400;
6 | line-height: 1.45;
7 | color: #fff;
8 | }
9 |
10 | h1, h2, h3, h4 {
11 | font-weight: inherit;
12 | line-height: 1.2;
13 | }
14 |
15 | h1 {
16 | font-size: 2.441rem;
17 | }
18 |
19 | h2 {font-size: 1.953em;}
20 |
21 | h3 {font-size: 1.563em;}
22 |
23 | h4 {font-size: 1.25em;}
24 |
25 | small, .font_small {font-size: 0.8em;}
26 |
--------------------------------------------------------------------------------
/docs/_sass/_utilities.scss:
--------------------------------------------------------------------------------
1 | .u-text-center {
2 | text-align: center;
3 | }
4 |
--------------------------------------------------------------------------------
/docs/css/main.scss:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 |
4 | @charset "utf-8";
5 | @import "normalise";
6 | @import "typography";
7 | @import url('https://fonts.googleapis.com/css?family=Roboto');
8 | @import "highlighting";
9 | @import "utilities";
10 |
11 | html {
12 | box-sizing: border-box;
13 | }
14 |
15 | *, *:before, *:after {
16 | box-sizing: inherit;
17 | }
18 |
19 | a {
20 | color: #fff;
21 | font-weight: 800;
22 | text-decoration: none;
23 | }
24 |
25 | .btn {
26 | border: 2px solid #fff;
27 | border-radius: 5px;
28 | padding: 1rem 2rem;
29 | }
30 |
31 | .body {
32 | background: #ea4965;
33 | }
34 |
35 | .main {
36 | max-width: 700px;
37 | margin: 0 auto;
38 | }
39 |
40 |
41 | .landing-header {
42 | position: relative;
43 | font-size: 4rem;
44 | font-weight: 800;
45 | letter-spacing: .3rem;
46 | border: 4px solid #fff;
47 | padding: 1rem;
48 | &::after {
49 | content: '';
50 | width: 100%;
51 | height: 100%;
52 | background: #00000017;
53 | display: block;
54 | position: absolute;
55 | left: -20px;
56 | bottom: -20px;
57 | }
58 | }
59 |
60 | .landing-header__text {
61 | z-index: 5;
62 | position: relative;
63 | }
64 |
65 | .landing-icon {
66 | display: block;
67 | margin: 2rem auto;
68 | }
69 |
70 | .landing-arrow {
71 | display: none;
72 | transition: all .3s ease;
73 | height: 70px;
74 | width: 70px;
75 | animation: updown 2s ease-in-out;
76 | animation-iteration-count: infinite;
77 | svg {transform: rotate(-35deg);}
78 | position: absolute;
79 | top: -55px;
80 | right: 55px;
81 | }
82 |
83 | @keyframes updown{
84 | 0% { transform: translate(0px) }
85 | 50% { transform: translate(-10px, -10px) }
86 | 100% { transform: translateY(0px) }
87 | }
88 |
89 | .footer {
90 | margin-top: 2rem;
91 | padding: 2rem;
92 | text-align: center;
93 | }
94 |
95 | .top-gif, .product-hunt {
96 | width:100%;
97 | max-width: 450px;
98 | margin: 5rem auto;
99 | display: block;
100 | border: 4px solid black;
101 | border-radius: 5px;
102 | }
103 |
104 | .product-hunt {
105 | max-width: 700px;
106 | margin: 0;
107 | }
108 |
109 | .news {
110 | margin: 2rem 0;
111 | }
112 |
113 | .news__title {
114 | font-weight: 800;
115 | font-size: 3rem;
116 | transform: rotate(-10deg);
117 | margin-bottom: 1rem;
118 | display: inline-block;
119 | }
120 |
121 | .ph-badge {
122 | width: 180px;
123 | margin-top: 1rem;
124 | display: inline-block;
125 | border-radius: 4px;
126 | }
127 |
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/favicon.ico
--------------------------------------------------------------------------------
/docs/img/github.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/docs/img/mb-browser.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/img/mb-browser.gif
--------------------------------------------------------------------------------
/docs/img/product-hunt-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/img/product-hunt-2.png
--------------------------------------------------------------------------------
/docs/img/product-hunt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/img/product-hunt.png
--------------------------------------------------------------------------------
/docs/img/theme-one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/img/theme-one.png
--------------------------------------------------------------------------------
/docs/img/theme-three.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/img/theme-three.png
--------------------------------------------------------------------------------
/docs/img/theme-two.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chriskonings/maker-badge/cbe80e4fa0804dc75265aa1d21b3a0f2542a9487/docs/img/theme-two.png
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | # Feel free to add content and custom Front Matter to this file.
3 | # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
4 | title: MakerBadge
5 | layout: landing
6 | footer: A collaboration by @chriskonings & @graeme_fulton
7 | ---
8 |
9 | MakerBadge
10 |
11 |
12 | An open-source badge to put your mark on every project.
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 1. Get your badge:
25 |
26 |
27 |
28 | ```html
29 |
30 |
31 |
33 |
34 |
35 |
36 |
39 | ```
40 |
41 |
42 | Your Product Hunt ID can be foud on your PH profile page (e.g. #309280).
43 |
44 |
45 |
50 |
51 | 2. Customise your badge (Beta):
52 |
53 |
58 |
59 | Choose from 3 themes, and customise layout:
60 |
61 |
62 | ```html
63 |
73 | ```
74 |
75 |
76 |
NEWS
77 |
Sept 30 2018
78 |
79 |
We launched MakerBadge September 30th 2018 on Product Hunt , it received over 300 upvotes and earned #2 Product of the Day! We have lots of ideas to push MakerBadge further and are excited for the future!
80 |
81 |
82 | Contribute
83 |
84 |
85 |
86 |
87 |
88 | Proudly an open source project
89 |
90 |
91 | Feel free to contribute
92 | here
93 |
94 |
--------------------------------------------------------------------------------
/docs/js/makerbadge.js:
--------------------------------------------------------------------------------
1 | MakerBadge.prototype={
2 |
3 | constructor:MakerBadge,
4 |
5 | init:function(settings, callback){
6 |
7 | //set properties
8 | if(settings.id){
9 | this.userId = settings.id
10 | }
11 |
12 | if(settings.position){
13 | this.position=settings.position
14 | }
15 |
16 | if(settings.theme){
17 | this.theme= settings.theme;
18 | }
19 |
20 | if(settings.name){
21 | this.name=settings.name
22 | }
23 |
24 | if (settings.twitter){
25 | this.twitter = settings.twitter
26 | }
27 |
28 | if(settings.customHTML){
29 | this.customHTML = settings.customHTML
30 | }
31 |
32 |
33 | //only using pic in theme 2
34 | if(this.theme!=1){
35 | if(settings.pic){
36 | this.pic=' '
37 | }
38 | }
39 |
40 | //trigger the badge
41 | //pass callback function for arrow to show after loaded
42 | this.run(callback)
43 | },
44 |
45 | run:function(callback){
46 | const body = document.querySelector('body');
47 | const container = document.createElement('div');
48 | const content = document.createElement('div');
49 | const button = document.createElement('div');
50 | const statsList = document.createElement('ul');
51 | const username = document.createElement('div');
52 | const profileLink = document.createElement('a');
53 | const twitter = document.createElement('a');
54 | const makerbadge = document.createElement('a');
55 | makerbadge.style = "display:block;margin: 5px 0;font-size:10px;color:#d85637;text-decoration:none;font-weight:400;"
56 | makerbadge.innerHTML = "Get your MakerBadge"
57 | makerbadge.href = "https://makerbadge.app"
58 | twitter.style = "display:inline-block;"
59 | twitter.href = "https://twitter.com/"+this.twitter;
60 | twitter.target = "_blank"
61 | twitter.innerHTML = ' '
62 | //set the style based on theme
63 | const customHTML = document.createElement('div');
64 | customHTML.innerHTML = this.customHTML;
65 |
66 | this.setStyle()
67 |
68 | document.getElementsByTagName('head')[0].appendChild(this.style);
69 | button.innerHTML = 'Maker';
70 | profileLink.innerHTML = 'P'
71 | profileLink.target = '_blank';
72 | profileLink.classList = 'ph-btn';
73 | container.classList = 'maker-badge';
74 | button.classList = 'maker-badge__btn';
75 | content.classList = 'maker-badge__content';
76 | statsList.classList = 'maker-badge__stats';
77 | username.style = 'text-align:center;margin:.5rem 0;font-weight:800;'
78 | button.innerHTML = 'Maker'
79 | container.appendChild(button);
80 | container.appendChild(content);
81 | const request = new XMLHttpRequest();
82 | request.open('GET', 'https://api.producthunt.com/v1/users/' + this.userId, true);
83 | request.setRequestHeader('Authorization','Bearer ' + 'c531da26873a8dc7ea8be6d7e519f296f5f521d2d756bf9862552b6ed5f5f161 ');
84 | let containerHeight = 0;
85 | var that= this
86 | //@TODO: separate themes out into their own sections
87 | request.onload = function() {
88 | if (request.status >= 200 && request.status < 400) {
89 | const data = JSON.parse(request.responseText);
90 | const userPic = that.pic ? that.pic : data.user.image_url['50px']
91 | const userPicSize = that.theme === 3 ? 50 : 30
92 | const picEl = ' '
93 | const name = that.name ? that.name : data.user.name
94 | username.innerHTML = '@' + data.user.username;
95 |
96 | if (that.theme === 2) {
97 | button.innerHTML = picEl + 'by ' + name;
98 | } else if (that.theme === 3) {
99 | button.innerHTML = picEl;
100 | } else {
101 | button.innerHTML = 'by ' + name;
102 | }
103 |
104 | profileLink.href = data.user.profile_url;
105 | statsList.innerHTML = '' + data.user.posts_count + ' ' + ' posts ' +
106 | '' + data.user.maker_of_count + ' ' + ' products ' +
107 | '' + data.user.followers_count + ' ' + ' followers ';
108 | content.appendChild(profileLink)
109 | content.appendChild(username);
110 | content.appendChild(statsList);
111 | if (that.twitter) {
112 | content.appendChild(twitter)
113 | }
114 | if (that.customHTML) {
115 | content.appendChild(customHTML)
116 | }
117 | content.appendChild(makerbadge);
118 | body.appendChild(container);
119 | containerHeight = container.clientHeight;
120 | if (that.theme === 3) {
121 | container.style.bottom = 'calc(-' + containerHeight + 'px + 80px)';
122 | } else {
123 | container.style.bottom = 'calc(-' + containerHeight + 'px + 40px)';
124 | }
125 | container.classList.add('transition');
126 | container.style.visibility = 'visible';
127 | //run callback to say everything has loaded
128 | if(callback){
129 | callback()
130 | }
131 | } else {
132 | // We reached our target server, but it returned an error
133 | }
134 | };
135 | request.onerror = function(err) {
136 | console.log(err)
137 | };
138 | request.send();
139 |
140 | button.addEventListener('click', () => {
141 | if (container.classList.contains('isOpen')) {
142 | if (that.theme === 3) {
143 | container.setAttribute('style', 'visibility:visible;bottom:calc(-' + containerHeight + 'px + 80px)');
144 | } else {
145 | container.setAttribute('style', 'visibility:visible;bottom:calc(-' + containerHeight + 'px + 40px)');
146 | }
147 | container.classList.remove('isOpen')
148 | } else {
149 | container.setAttribute('style', 'visibility:visible;');
150 | container.classList.add('isOpen')
151 | }
152 | })
153 | },
154 |
155 | setStyle: function() {
156 | let isOpenStyle = '.isOpen{bottom: 0;}'
157 | const transitionStyle = '.transition {transition: all .3s ease}'
158 | this.style = document.createElement('style');
159 | this.style.type = 'text/css';
160 | //style 1 (default style)
161 | if (this.theme === 1) {
162 | var profileLinkStyle = ".ph-btn{margin: 0 auto;\
163 | height: 30px; \
164 | width: 30px; \
165 | text-align: center; \
166 | line-height: 30px;\
167 | background: #da552f;\
168 | display: block;\
169 | border-radius: 50%;\
170 | font-size: 1rem;\
171 | color: #fff;\
172 | text-decoration: none;\
173 | font-weight: 800;}";
174 | const borderBxStyle = '.maker-badge, .maker-badge *,.maker-badge *:before,.maker-badge *:after{box-sizing: border-box;}'
175 | const containerStyle = '.maker-badge{z-index:99;color:#2b2b2b;font-size:16px;font-family:helvetica;text-align:right;height:auto;min-width:160px;position:fixed;bottom:-100%;' + this.position + ':0;}';
176 | const contentStyle = '.maker-badge__content{text-align:center;font-size:.9rem;border: 2px solid #e8e8e8;background-color: #f7f7f7;padding:.5rem;display:block;background:#f7f7f7;height:100%;}'
177 | const buttonStyle = '.maker-badge__btn{display:inline-block;height:40px;line-height:40px;padding: 0 .5rem;cursor:pointer;border:2px solid #e8e8e8;border-bottom:0;background:#f7f7f7;}'
178 | const statsListStyle = '.maker-badge__stats{list-style: none;padding: 0;margin: .3rem 0;} .maker-badge__stats li {margin: .3rem 0}'
179 | const buttonImgStyle = '.maker-badge__btn-img {border-radius: 50%;}'
180 | this.style.innerHTML = transitionStyle + buttonImgStyle + statsListStyle + borderBxStyle + containerStyle + contentStyle + buttonStyle + profileLinkStyle + isOpenStyle;
181 | }
182 | //style option 2
183 | if (this.theme === 2) {
184 | var profileLinkStyle = ".ph-btn{margin: 0 auto;\
185 | height: 30px; \
186 | width: 30px; \
187 | text-align: center; \
188 | line-height: 30px;\
189 | background: #da552f;\
190 | display: block;\
191 | border-radius: 50%;\
192 | font-size: 1rem;\
193 | color: #fff;\
194 | text-decoration: none;\
195 | font-weight: 800;}";
196 | const borderBxStyle = '.maker-badge, .maker-badge *,.maker-badge *:before,.maker-badge *:after{box-sizing: border-box;}'
197 | const containerStyle = '.maker-badge{z-index:99;color:#2b2b2b;font-size:16px;font-family:helvetica;text-align:right;height:auto;min-width:160px;position:fixed;bottom:-100%;'+this.position+':0;border-top-left-radius:6px;}';
198 | const contentStyle = '.maker-badge__content{text-align:center;font-size:.9rem;border: 1px solid #eaeaea;padding:.5rem;display:block;background:#fdfdfd;height:100%;}'
199 | const buttonStyle = '.maker-badge__btn{display:flex;justify-content:center;align-items:center;height:40px;line-height:40px;padding: 0 .5rem;cursor:pointer;border:1px solid #eaeaea;border-bottom:0;background:#fdfdfd;border-top-left-radius:6px;color:#767676;}'
200 | const statsListStyle = '.maker-badge__stats{list-style: none;padding: 0;margin: .3rem 0;} .maker-badge__stats li {margin: .3rem 0}'
201 | const buttonImgStyle = '.maker-badge__btn-img {border-radius: 50%;}'
202 | this.style.innerHTML = transitionStyle + buttonImgStyle + statsListStyle + borderBxStyle + containerStyle + contentStyle + buttonStyle + profileLinkStyle + isOpenStyle;
203 | }
204 | if (this.theme === 3) {
205 | isOpenStyle = '.isOpen{\
206 | bottom: 0;}\
207 | .isOpen .maker-badge__btn {\
208 | margin-bottom: -20px;\
209 | z-index: 99;}\
210 | .isOpen .maker-badge__content{\
211 | box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.75);\
212 | }'
213 | var profileLinkStyle = ".ph-btn{margin: 0 auto;\
214 | height: 30px; \
215 | width: 30px; \
216 | text-align: center; \
217 | line-height: 30px;\
218 | background: #da552f;\
219 | display: block;\
220 | border-radius: 50%;\
221 | font-size: 1rem;\
222 | color: #fff;\
223 | text-decoration: none;\
224 | font-weight: 800;}";
225 | const borderBxStyle = '.maker-badge, .maker-badge *,.maker-badge *:before,.maker-badge *:after{box-sizing: border-box;}'
226 | const containerStyle = '.maker-badge{z-index:99;visibility:hidden;color:#2b2b2b;font-size:16px;font-family:helvetica;text-align:' + this.position + ';height:auto;min-width:160px;position:fixed;bottom:-100%;'+this.position+':0;border-top-left-radius:6px;}';
227 | const contentStyle = '.maker-badge__content{\
228 | position:relative;\
229 | text-align:center;\
230 | font-size:.9rem;\
231 | border: 1px solid #eaeaea;\
232 | padding:.5rem;\
233 | display:block;\
234 | background:#fdfdfd;\
235 | height:100%;}\
236 | .maker-badge__content::before{\
237 | content:"";\
238 | display: block;\
239 | position: absolute;\
240 | top: -10px;\
241 | ' + this.position + ': 25px;\
242 | width: 0;\
243 | height: 0;\
244 | border-left: 10px solid transparent;\
245 | border-right: 10px solid transparent;\
246 | border-bottom: 10px solid #fff;';
247 | const buttonStyle = '.maker-badge__btn{\
248 | transition: all .3s ease;\
249 | display: inline-flex;\
250 | justify-content: right;\
251 | align-items: center;\
252 | cursor: pointer;\
253 | position: relative;\
254 | text-align: center;\
255 | width: 50px;\
256 | height: 50px;\
257 | margin: 20px 10px;\
258 | border-radius: 50%;}\
259 | .maker-badge__btn:hover .maker-badge__btn-img {transform:scale(1.1);box-shadow:0px 0px 10px rgba(0,0,0,0.5);}'
260 | const statsListStyle = '.maker-badge__stats{list-style: none;padding: 0;margin: .3rem 0;} .maker-badge__stats li {margin: .3rem 0}';
261 | const buttonImgStyle = '.maker-badge__btn-img {\
262 | border-radius: 50%;\
263 | width: 50px;\
264 | position: absolute;\
265 | top: 0;\
266 | right: 0;\
267 | left: 0;\
268 | bottom: 0;\
269 | transition: all .3s ease;\
270 | border: 3px solid #000;\
271 | margin: auto;}'
272 | this.style.innerHTML = transitionStyle + buttonImgStyle + statsListStyle + borderBxStyle + containerStyle + buttonStyle + profileLinkStyle + isOpenStyle + contentStyle;
273 | }
274 |
275 | }
276 |
277 | }
278 |
279 | /** * MakerBadge Constructor */
280 |
281 | function MakerBadge(settings){
282 |
283 | this.userId = ''
284 | this.position = 'right'
285 | this.theme = 1
286 | this.name=''
287 | this.twitter = ''
288 | this.pic=''
289 | this.coffee=false
290 | this.customHTML = ''
291 |
292 | }
293 |
294 | var MakerBadge = new MakerBadge()
295 |
--------------------------------------------------------------------------------
/makerbadge.js:
--------------------------------------------------------------------------------
1 | MakerBadge.prototype={
2 |
3 | constructor:MakerBadge,
4 |
5 | init:function(settings, callback){
6 |
7 | //set properties
8 | if(settings.id){
9 | this.userId = settings.id
10 | }
11 |
12 | if(settings.position){
13 | this.position=settings.position
14 | }
15 |
16 | if(settings.theme){
17 | this.theme= settings.theme;
18 | }
19 |
20 | if(settings.name){
21 | this.name=settings.name
22 | }
23 |
24 | if (settings.twitter){
25 | this.twitter = settings.twitter
26 | }
27 |
28 | if(settings.customHTML){
29 | this.customHTML = settings.customHTML
30 | }
31 |
32 |
33 | //only using pic in theme 2
34 | if(this.theme!=1){
35 | if(settings.pic){
36 | this.pic=' '
37 | }
38 | }
39 |
40 | //trigger the badge
41 | //pass callback function for arrow to show after loaded
42 | this.run(callback)
43 | },
44 |
45 | run:function(callback){
46 | const body = document.querySelector('body');
47 | const container = document.createElement('div');
48 | const content = document.createElement('div');
49 | const button = document.createElement('div');
50 | const statsList = document.createElement('ul');
51 | const username = document.createElement('div');
52 | const profileLink = document.createElement('a');
53 | const twitter = document.createElement('a');
54 | const makerbadge = document.createElement('a');
55 | makerbadge.style = "display:block;margin: 5px 0;font-size:10px;color:#d85637;text-decoration:none;font-weight:400;"
56 | makerbadge.innerHTML = "Get your MakerBadge"
57 | makerbadge.href = "https://makerbadge.app"
58 | twitter.style = "display:inline-block;"
59 | twitter.href = "https://twitter.com/"+this.twitter;
60 | twitter.target = "_blank"
61 | twitter.innerHTML = ' '
62 | //set the style based on theme
63 | const customHTML = document.createElement('div');
64 | customHTML.innerHTML = this.customHTML;
65 |
66 | this.setStyle()
67 |
68 | document.getElementsByTagName('head')[0].appendChild(this.style);
69 | button.innerHTML = 'Maker';
70 | profileLink.innerHTML = 'P'
71 | profileLink.target = '_blank';
72 | profileLink.classList = 'ph-btn';
73 | container.classList = 'maker-badge';
74 | button.classList = 'maker-badge__btn';
75 | content.classList = 'maker-badge__content';
76 | statsList.classList = 'maker-badge__stats';
77 | username.style = 'text-align:center;margin:.5rem 0;font-weight:800;'
78 | button.innerHTML = 'Maker'
79 | container.appendChild(button);
80 | container.appendChild(content);
81 | const request = new XMLHttpRequest();
82 | request.open('GET', 'https://api.producthunt.com/v1/users/' + this.userId, true);
83 | request.setRequestHeader('Authorization','Bearer ' + 'c531da26873a8dc7ea8be6d7e519f296f5f521d2d756bf9862552b6ed5f5f161 ');
84 | let containerHeight = 0;
85 | var that= this
86 | //@TODO: separate themes out into their own sections
87 | request.onload = function() {
88 | if (request.status >= 200 && request.status < 400) {
89 | const data = JSON.parse(request.responseText);
90 | const userPic = that.pic ? that.pic : data.user.image_url['50px']
91 | const userPicSize = that.theme === 3 ? 50 : 30
92 | const picEl = ' '
93 | const name = that.name ? that.name : data.user.name
94 | username.innerHTML = '@' + data.user.username;
95 |
96 | if (that.theme === 2) {
97 | button.innerHTML = picEl + 'by ' + name;
98 | } else if (that.theme === 3) {
99 | button.innerHTML = picEl;
100 | } else {
101 | button.innerHTML = 'by ' + name;
102 | }
103 |
104 | profileLink.href = data.user.profile_url;
105 | statsList.innerHTML = '' + data.user.posts_count + ' ' + ' posts ' +
106 | '' + data.user.maker_of_count + ' ' + ' products ' +
107 | '' + data.user.followers_count + ' ' + ' followers ';
108 | content.appendChild(profileLink)
109 | content.appendChild(username);
110 | content.appendChild(statsList);
111 | if (that.twitter) {
112 | content.appendChild(twitter)
113 | }
114 | if (that.customHTML) {
115 | content.appendChild(customHTML)
116 | }
117 | content.appendChild(makerbadge);
118 | body.appendChild(container);
119 | containerHeight = container.clientHeight;
120 | if (that.theme === 3) {
121 | container.style.bottom = 'calc(-' + containerHeight + 'px + 80px)';
122 | } else {
123 | container.style.bottom = 'calc(-' + containerHeight + 'px + 40px)';
124 | }
125 | container.classList.add('transition');
126 | container.style.visibility = 'visible';
127 | //run callback to say everything has loaded
128 | if(callback){
129 | callback()
130 | }
131 | } else {
132 | // We reached our target server, but it returned an error
133 | }
134 | };
135 | request.onerror = function(err) {
136 | console.log(err)
137 | };
138 | request.send();
139 |
140 | button.addEventListener('click', () => {
141 | if (container.classList.contains('isOpen')) {
142 | if (that.theme === 3) {
143 | container.setAttribute('style', 'visibility:visible;bottom:calc(-' + containerHeight + 'px + 80px)');
144 | } else {
145 | container.setAttribute('style', 'visibility:visible;bottom:calc(-' + containerHeight + 'px + 40px)');
146 | }
147 | container.classList.remove('isOpen')
148 | } else {
149 | container.setAttribute('style', 'visibility:visible;');
150 | container.classList.add('isOpen')
151 | }
152 | })
153 | },
154 |
155 | setStyle: function() {
156 | let isOpenStyle = '.isOpen{bottom: 0;}'
157 | const transitionStyle = '.transition {transition: all .3s ease}'
158 | this.style = document.createElement('style');
159 | this.style.type = 'text/css';
160 | //style 1 (default style)
161 | if (this.theme === 1) {
162 | var profileLinkStyle = ".ph-btn{margin: 0 auto;\
163 | height: 30px; \
164 | width: 30px; \
165 | text-align: center; \
166 | line-height: 30px;\
167 | background: #da552f;\
168 | display: block;\
169 | border-radius: 50%;\
170 | font-size: 1rem;\
171 | color: #fff;\
172 | text-decoration: none;\
173 | font-weight: 800;}";
174 | const borderBxStyle = '.maker-badge, .maker-badge *,.maker-badge *:before,.maker-badge *:after{box-sizing: border-box;}'
175 | const containerStyle = '.maker-badge{z-index:99;color:#2b2b2b;font-size:16px;font-family:helvetica;text-align:right;height:auto;min-width:160px;position:fixed;bottom:-100%;' + this.position + ':0;}';
176 | const contentStyle = '.maker-badge__content{text-align:center;font-size:.9rem;border: 2px solid #e8e8e8;background-color: #f7f7f7;padding:.5rem;display:block;background:#f7f7f7;height:100%;}'
177 | const buttonStyle = '.maker-badge__btn{display:inline-block;height:40px;line-height:40px;padding: 0 .5rem;cursor:pointer;border:2px solid #e8e8e8;border-bottom:0;background:#f7f7f7;}'
178 | const statsListStyle = '.maker-badge__stats{list-style: none;padding: 0;margin: .3rem 0;} .maker-badge__stats li {margin: .3rem 0}'
179 | const buttonImgStyle = '.maker-badge__btn-img {border-radius: 50%;}'
180 | this.style.innerHTML = transitionStyle + buttonImgStyle + statsListStyle + borderBxStyle + containerStyle + contentStyle + buttonStyle + profileLinkStyle + isOpenStyle;
181 | }
182 | //style option 2
183 | if (this.theme === 2) {
184 | var profileLinkStyle = ".ph-btn{margin: 0 auto;\
185 | height: 30px; \
186 | width: 30px; \
187 | text-align: center; \
188 | line-height: 30px;\
189 | background: #da552f;\
190 | display: block;\
191 | border-radius: 50%;\
192 | font-size: 1rem;\
193 | color: #fff;\
194 | text-decoration: none;\
195 | font-weight: 800;}";
196 | const borderBxStyle = '.maker-badge, .maker-badge *,.maker-badge *:before,.maker-badge *:after{box-sizing: border-box;}'
197 | const containerStyle = '.maker-badge{z-index:99;color:#2b2b2b;font-size:16px;font-family:helvetica;text-align:right;height:auto;min-width:160px;position:fixed;bottom:-100%;'+this.position+':0;border-top-left-radius:6px;}';
198 | const contentStyle = '.maker-badge__content{text-align:center;font-size:.9rem;border: 1px solid #eaeaea;padding:.5rem;display:block;background:#fdfdfd;height:100%;}'
199 | const buttonStyle = '.maker-badge__btn{display:flex;justify-content:center;align-items:center;height:40px;line-height:40px;padding: 0 .5rem;cursor:pointer;border:1px solid #eaeaea;border-bottom:0;background:#fdfdfd;border-top-left-radius:6px;color:#767676;}'
200 | const statsListStyle = '.maker-badge__stats{list-style: none;padding: 0;margin: .3rem 0;} .maker-badge__stats li {margin: .3rem 0}'
201 | const buttonImgStyle = '.maker-badge__btn-img {border-radius: 50%;}'
202 | this.style.innerHTML = transitionStyle + buttonImgStyle + statsListStyle + borderBxStyle + containerStyle + contentStyle + buttonStyle + profileLinkStyle + isOpenStyle;
203 | }
204 | if (this.theme === 3) {
205 | isOpenStyle = '.isOpen{\
206 | bottom: 0;}\
207 | .isOpen .maker-badge__btn {\
208 | margin-bottom: -20px;\
209 | z-index: 99;}\
210 | .isOpen .maker-badge__content{\
211 | box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.75);\
212 | }'
213 | var profileLinkStyle = ".ph-btn{margin: 0 auto;\
214 | height: 30px; \
215 | width: 30px; \
216 | text-align: center; \
217 | line-height: 30px;\
218 | background: #da552f;\
219 | display: block;\
220 | border-radius: 50%;\
221 | font-size: 1rem;\
222 | color: #fff;\
223 | text-decoration: none;\
224 | font-weight: 800;}";
225 | const borderBxStyle = '.maker-badge, .maker-badge *,.maker-badge *:before,.maker-badge *:after{box-sizing: border-box;}'
226 | const containerStyle = '.maker-badge{z-index:99;visibility:hidden;color:#2b2b2b;font-size:16px;font-family:helvetica;text-align:' + this.position + ';height:auto;min-width:160px;position:fixed;bottom:-100%;'+this.position+':0;border-top-left-radius:6px;}';
227 | const contentStyle = '.maker-badge__content{\
228 | position:relative;\
229 | text-align:center;\
230 | font-size:.9rem;\
231 | border: 1px solid #eaeaea;\
232 | padding:.5rem;\
233 | display:block;\
234 | background:#fdfdfd;\
235 | height:100%;}\
236 | .maker-badge__content::before{\
237 | content:"";\
238 | display: block;\
239 | position: absolute;\
240 | top: -10px;\
241 | ' + this.position + ': 25px;\
242 | width: 0;\
243 | height: 0;\
244 | border-left: 10px solid transparent;\
245 | border-right: 10px solid transparent;\
246 | border-bottom: 10px solid #fff;';
247 | const buttonStyle = '.maker-badge__btn{\
248 | transition: all .3s ease;\
249 | display: inline-flex;\
250 | justify-content: right;\
251 | align-items: center;\
252 | cursor: pointer;\
253 | position: relative;\
254 | text-align: center;\
255 | width: 50px;\
256 | height: 50px;\
257 | margin: 20px 10px;\
258 | border-radius: 50%;}\
259 | .maker-badge__btn:hover .maker-badge__btn-img {transform:scale(1.1);box-shadow:0px 0px 10px rgba(0,0,0,0.5);}'
260 | const statsListStyle = '.maker-badge__stats{list-style: none;padding: 0;margin: .3rem 0;} .maker-badge__stats li {margin: .3rem 0}';
261 | const buttonImgStyle = '.maker-badge__btn-img {\
262 | border-radius: 50%;\
263 | width: 50px;\
264 | position: absolute;\
265 | top: 0;\
266 | right: 0;\
267 | left: 0;\
268 | bottom: 0;\
269 | transition: all .3s ease;\
270 | border: 3px solid #000;\
271 | margin: auto;}'
272 | this.style.innerHTML = transitionStyle + buttonImgStyle + statsListStyle + borderBxStyle + containerStyle + buttonStyle + profileLinkStyle + isOpenStyle + contentStyle;
273 | }
274 |
275 | }
276 |
277 | }
278 |
279 | /** * MakerBadge Constructor */
280 |
281 | function MakerBadge(settings){
282 |
283 | this.userId = ''
284 | this.position = 'right'
285 | this.theme = 1
286 | this.name=''
287 | this.twitter = ''
288 | this.pic=''
289 | this.coffee=false
290 | this.customHTML = ''
291 |
292 | }
293 |
294 | var MakerBadge = new MakerBadge()
295 |
--------------------------------------------------------------------------------