rrssb-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +70 -0
- data/Rakefile +11 -0
- data/app/helpers/rrssb/rails/buttons_helper.rb +52 -0
- data/lib/rrssb-rails.rb +1 -0
- data/lib/rrssb/rails.rb +7 -0
- data/lib/rrssb/rails/engine.rb +6 -0
- data/lib/rrssb/rails/version.rb +5 -0
- data/rrssb-rails.gemspec +25 -0
- data/test/dummy/.gitignore +2 -0
- data/test/dummy/app/assets/stylesheets/sprockets-require.css +3 -0
- data/test/dummy/app/controllers/pages_controller.rb +2 -0
- data/test/dummy/app/views/pages/buttons.html.erb +1 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +19 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +2 -0
- data/test/helpers/buttons_helper_test.rb +15 -0
- data/test/integration/rrssb_rails_test.rb +42 -0
- data/test/test_helper.rb +7 -0
- data/vendor/assets/images/delicious.min.svg +1 -0
- data/vendor/assets/images/facebook.min.svg +1 -0
- data/vendor/assets/images/github.min.svg +1 -0
- data/vendor/assets/images/google_plus.min.svg +1 -0
- data/vendor/assets/images/hackernews.min.svg +1 -0
- data/vendor/assets/images/instagram.min.svg +1 -0
- data/vendor/assets/images/linkedin.min.svg +1 -0
- data/vendor/assets/images/mail.min.svg +1 -0
- data/vendor/assets/images/pinterest.min.svg +1 -0
- data/vendor/assets/images/pocket.min.svg +1 -0
- data/vendor/assets/images/reddit.min.svg +1 -0
- data/vendor/assets/images/tumblr.min.svg +1 -0
- data/vendor/assets/images/twitter.min.svg +1 -0
- data/vendor/assets/images/vk.min.svg +1 -0
- data/vendor/assets/images/youtube.min.svg +1 -0
- data/vendor/assets/javascripts/rrssb.js +358 -0
- data/vendor/assets/stylesheets/rrssb.css +1 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e8cc41fed7b1be9c9d1e38b3161ba22804dd1377
|
4
|
+
data.tar.gz: 85a82241971754258abe8b4ef59230574a2cc98a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b1a23e1bbec4bda803b80d6caa6d65c0788c1cb77f6938a314e614eb59c04d719249b6fd163e78a83d1529e7894677db3946568f13f55401e323de0402c2f49
|
7
|
+
data.tar.gz: 7be4b98801006b0e2763dec5507465a86e3cf1353fdeadab43a97631318bf02997d4c7e7694d0347f39f84db5a172e817867288d4ce75853cd1bd71edb2a4f02
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Damien Imberdis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# rrssb-rails
|
2
|
+
|
3
|
+
This gem packages [rrssb](https://github.com/kni-labs/rrssb) for the Rails 3.2+ asset pipeline.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rrssb-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
```bash
|
15
|
+
$ bundle
|
16
|
+
```
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
```bash
|
20
|
+
$ gem install rrssb-rails
|
21
|
+
```
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
To start using the rrssb-rails plugin in your Rails application, enable it via the asset pipeline.
|
25
|
+
|
26
|
+
If your server is running, you will need to **restart Rails** before using the gem.
|
27
|
+
|
28
|
+
Add the following to your JavaScript manifest file (`application.js`):
|
29
|
+
```js
|
30
|
+
//= require rrssb
|
31
|
+
```
|
32
|
+
|
33
|
+
Add the following to your style sheet file:
|
34
|
+
|
35
|
+
If you are using SCSS, modify your `application.scss` file:
|
36
|
+
```scss
|
37
|
+
@import 'rrssb';
|
38
|
+
```
|
39
|
+
|
40
|
+
If you are using LESS, modify your `application.less` file,
|
41
|
+
If you're using plain CSS, modify your `application.css` file:
|
42
|
+
```css
|
43
|
+
*= require rrssb
|
44
|
+
```
|
45
|
+
|
46
|
+
### Helper
|
47
|
+
|
48
|
+
You can use the helper `rrssb_tag` to generate and customize your social share buttons inside your view.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
rrssb_tag(url: 'http://my_url.com', buttons: %w{facebook twitter google_plus})
|
52
|
+
# => Generate 3 responsive social share button for facebook, twitter and google+ in this order
|
53
|
+
```
|
54
|
+
|
55
|
+
For more information, see the dummy rails application available in `/test`.
|
56
|
+
|
57
|
+
## Tests
|
58
|
+
|
59
|
+
Run:
|
60
|
+
```bash
|
61
|
+
$ rake test
|
62
|
+
```
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it ( https://github.com/dam/rrssb-rails/fork )
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module Rrssb
|
2
|
+
module Rails
|
3
|
+
module ButtonsHelper
|
4
|
+
def rrssb_tag(opts={})
|
5
|
+
buttons = opts[:buttons] || []
|
6
|
+
url = opts.delete(:url) { '#' }
|
7
|
+
contents = opts[:contents] || {}
|
8
|
+
|
9
|
+
html = []
|
10
|
+
html << "<ul class='rrssb-buttons clearfix' id='#{opts[:id]}'>"
|
11
|
+
buttons.each do |button|
|
12
|
+
content = contents[button.to_sym] || {}
|
13
|
+
html << "<li class='rrssb-#{button.gsub(/[_-]/,'')}'>"
|
14
|
+
html << case button
|
15
|
+
when 'email'
|
16
|
+
label = content.delete(:label) { button }
|
17
|
+
subject = content.delete(:subject) { nil }
|
18
|
+
cc = content.delete(:cc) { nil }
|
19
|
+
to = content.delete(:to) { nil }
|
20
|
+
link_content = "<span class='rrssb-icon'>#{image_tag('mail.min.svg')}</span><span class='rrssb-text'>#{label}</span>"
|
21
|
+
|
22
|
+
mail_to(to, link_content.html_safe, subject: subject, cc: cc)
|
23
|
+
else
|
24
|
+
label = content.delete(:label) { button.humanize }
|
25
|
+
image_name = "#{button}.min.svg"
|
26
|
+
link_content = "<span class='rrssb-icon'>#{image_tag(image_name)}</span><span class='rrssb-text'>#{label}</span>"
|
27
|
+
html_options = { 'class' => 'popup' }
|
28
|
+
|
29
|
+
link_to(link_content.html_safe, social_url(button, url, content), html_options)
|
30
|
+
end
|
31
|
+
html << "</li>"
|
32
|
+
end
|
33
|
+
|
34
|
+
html << '</ul>'
|
35
|
+
raw html.join("\n")
|
36
|
+
end
|
37
|
+
|
38
|
+
# cf. https://github.com/huacnlee/social-share-button
|
39
|
+
def social_url(button, url, opts={})
|
40
|
+
case button
|
41
|
+
when 'facebook' then "https://www.facebook.com/sharer/sharer.php?u=#{url}"
|
42
|
+
when 'twitter'
|
43
|
+
via = opts.delete(:via) { nil }
|
44
|
+
text = opts.delete(:text) { '' }
|
45
|
+
"https://twitter.com/intent/tweet?url=#{url}&text=#{text}&via=#{via}"
|
46
|
+
when 'google_plus' then "https://plus.google.com/share?url=#{url}"
|
47
|
+
else url
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/rrssb-rails.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'rrssb/rails'
|
data/lib/rrssb/rails.rb
ADDED
data/rrssb-rails.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rrssb/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rrssb-rails"
|
8
|
+
spec.version = Rrssb::Rails::VERSION
|
9
|
+
spec.authors = ["Damien Imberdis"]
|
10
|
+
spec.email = ["imberdis.damien@gmail.com"]
|
11
|
+
spec.summary = 'Ridiculously Responsive Social Sharing Buttons for Rails'
|
12
|
+
spec.description = 'Ridiculously Responsive Social Sharing Buttons for Rails is based on RRSSB from KNI Labs'
|
13
|
+
spec.homepage = 'https://github.com/Merchbro/rrssb-rails'
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'rails', '>= 3.2'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= rrssb_tag(url: 'http://my_url.com', buttons: %w{facebook twitter google_plus}) %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# require "rails/all"
|
4
|
+
require "sprockets/railtie"
|
5
|
+
|
6
|
+
Bundler.require(:default, :development)
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
config.encoding = "utf-8"
|
11
|
+
config.assets.enabled = true
|
12
|
+
config.assets.version = '1.0'
|
13
|
+
|
14
|
+
# replacement for environments/*.rb
|
15
|
+
config.active_support.deprecation = :stderr
|
16
|
+
config.eager_load = false
|
17
|
+
config.active_support.test_order = :random rescue nil
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class Rrssb::Rails::ButtonsHelperTest < ActionView::TestCase
|
4
|
+
test "#rrssb_tag accepts url and buttons options" do
|
5
|
+
identifier_url = 'http://myurl.com'
|
6
|
+
result = rrssb_tag(url: identifier_url, buttons: %w{facebook twitter})
|
7
|
+
doc = HTML::Document.new(result)
|
8
|
+
|
9
|
+
assert_select doc.root, "ul.rrssb-buttons"
|
10
|
+
assert_select doc.root, "li", 2
|
11
|
+
assert_select doc.root, "a.popup", 2 do
|
12
|
+
assert_select "[href=?]", /.*#{identifier_url}.*/ # Href property for the 2 includes the given url
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RrssbRailsTest < ActionDispatch::IntegrationTest
|
4
|
+
teardown { clean_sprockets_cache }
|
5
|
+
|
6
|
+
test "engine is loaded" do
|
7
|
+
assert_equal ::Rails::Engine, Rrssb::Rails::Engine.superclass
|
8
|
+
end
|
9
|
+
|
10
|
+
test "stylesheets are served" do
|
11
|
+
get '/assets/rrssb.css'
|
12
|
+
assert_response :success
|
13
|
+
assert_match(/.rrssb-buttons/, response.body)
|
14
|
+
end
|
15
|
+
|
16
|
+
test "stylesheet is available in a sprocket require" do
|
17
|
+
get '/assets/sprockets-require.css'
|
18
|
+
assert_response :success
|
19
|
+
assert_match(/.rrssb-buttons/, response.body)
|
20
|
+
end
|
21
|
+
|
22
|
+
test "javascripts are served" do
|
23
|
+
get '/assets/rrssb.js'
|
24
|
+
assert_response :success
|
25
|
+
assert_match(/\$.fn.rrssb/, response.body)
|
26
|
+
end
|
27
|
+
|
28
|
+
test "helpers are available in the view" do
|
29
|
+
get '/buttons'
|
30
|
+
assert_response :success
|
31
|
+
assert_select "ul.rrssb-buttons"
|
32
|
+
assert_select "li.rrssb-facebook"
|
33
|
+
assert_select "li.rrssb-twitter"
|
34
|
+
assert_select "li.rrssb-googleplus"
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def clean_sprockets_cache
|
40
|
+
FileUtils.rm_rf File.expand_path("../dummy/tmp", __FILE__)
|
41
|
+
end
|
42
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M4.78.188C2.36.188.188 2.354.188 4.78v18.44c0 2.426 2.167 4.592 4.594 4.592h18.44c2.42 0 4.592-2.173 4.592-4.593V4.78c0-2.426-2.167-4.592-4.593-4.592H4.78zm-.155 3.437H14V14h10.375v9.375c0 .552-.448 1-1 1H14V14H3.625V4.625c0-.552.448-1 1-1z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29" fill="#FFF"><path d="M26.4 0H2.6C1.714 0 0 1.715 0 2.6v23.8c0 .884 1.715 2.6 2.6 2.6h12.393V17.988h-3.996v-3.98h3.997v-3.062c0-3.746 2.835-5.97 6.177-5.97 1.6 0 2.444.173 2.845.226v3.792H21.18c-1.817 0-2.156.9-2.156 2.168v2.847h5.045l-.66 3.978h-4.386V29H26.4c.884 0 2.6-1.716 2.6-2.6V2.6c0-.885-1.716-2.6-2.6-2.6z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M13.97 1.57c-7.03 0-12.733 5.703-12.733 12.74 0 5.622 3.636 10.393 8.717 12.084.637.13.87-.277.87-.615 0-.302-.013-1.103-.02-2.165-3.54.77-4.29-1.707-4.29-1.707-.578-1.473-1.413-1.863-1.413-1.863-1.154-.79.09-.775.09-.775 1.276.104 1.96 1.316 1.96 1.312 1.135 1.936 2.99 1.393 3.712 1.06.116-.823.445-1.384.81-1.704-2.83-.32-5.802-1.414-5.802-6.293 0-1.39.496-2.527 1.312-3.418-.132-.322-.57-1.617.123-3.37 0 0 1.07-.343 3.508 1.305 1.016-.282 2.105-.424 3.188-.43 1.082 0 2.167.156 3.198.44 2.43-1.65 3.498-1.307 3.498-1.307.695 1.754.258 3.043.13 3.37.815.903 1.314 2.038 1.314 3.43 0 4.893-2.978 5.97-5.814 6.286.458.388.876 1.16.876 2.358 0 1.703-.016 3.076-.016 3.482 0 .334.232.748.877.61 5.056-1.687 8.7-6.456 8.7-12.08-.055-7.058-5.75-12.757-12.792-12.75z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M14.703 15.854l-1.22-.948c-.37-.308-.88-.715-.88-1.46 0-.747.51-1.222.95-1.662 1.42-1.12 2.84-2.31 2.84-4.817 0-2.58-1.62-3.937-2.4-4.58h2.098l2.203-1.384h-6.67c-1.83 0-4.467.433-6.398 2.027C3.768 4.287 3.06 6.018 3.06 7.576c0 2.634 2.02 5.328 5.603 5.328.34 0 .71-.033 1.083-.068-.167.408-.336.748-.336 1.324 0 1.04.55 1.685 1.01 2.297-1.523.104-4.37.273-6.466 1.562-1.998 1.187-2.605 2.915-2.605 4.136 0 2.512 2.357 4.84 7.288 4.84 5.822 0 8.904-3.223 8.904-6.41.008-2.327-1.36-3.49-2.83-4.73h-.01zM10.27 11.95c-2.913 0-4.232-3.764-4.232-6.036 0-.884.168-1.797.744-2.51.543-.68 1.49-1.12 2.372-1.12 2.807 0 4.256 3.797 4.256 6.24 0 .613-.067 1.695-.845 2.48-.537.55-1.438.947-2.295.95v-.003zm.032 13.66c-3.62 0-5.957-1.733-5.957-4.143 0-2.408 2.165-3.223 2.91-3.492 1.422-.48 3.25-.545 3.556-.545.34 0 .52 0 .767.034 2.574 1.838 3.706 2.757 3.706 4.48-.002 2.072-1.736 3.664-4.982 3.648l.002.017zM23.254 11.89V8.52H21.57v3.37H18.2v1.714h3.367v3.4h1.684v-3.4h3.4V11.89"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M14 13.626l-4.508-9.19H6.588l6.165 12.208v6.92h2.51v-6.92l6.15-12.21H18.69"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M4.066.636h19.867c1.887 0 3.43 1.543 3.43 3.43v19.868c0 1.888-1.543 3.43-3.43 3.43H4.066c-1.887 0-3.43-1.542-3.43-3.43V4.066c0-1.887 1.544-3.43 3.43-3.43zm16.04 2.97c-.66 0-1.203.54-1.203 1.202v2.88c0 .662.542 1.203 1.204 1.203h3.02c.663 0 1.204-.54 1.204-1.202v-2.88c0-.662-.54-1.203-1.202-1.203h-3.02zm4.238 8.333H21.99c.224.726.344 1.495.344 2.292 0 4.446-3.72 8.05-8.308 8.05s-8.31-3.604-8.31-8.05c0-.797.122-1.566.344-2.293H3.606v11.29c0 .584.48 1.06 1.062 1.06H23.28c.585 0 1.062-.477 1.062-1.06V11.94h.002zm-10.32-3.2c-2.963 0-5.367 2.33-5.367 5.202 0 2.873 2.404 5.202 5.368 5.202 2.965 0 5.368-2.33 5.368-5.202s-2.403-5.2-5.368-5.2z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M25.424 15.887v8.447h-4.896v-7.882c0-1.98-.71-3.33-2.48-3.33-1.354 0-2.158.91-2.514 1.802-.13.315-.162.753-.162 1.194v8.216h-4.9s.067-13.35 0-14.73h4.9v2.087c-.01.017-.023.033-.033.05h.032v-.05c.65-1.002 1.812-2.435 4.414-2.435 3.222 0 5.638 2.106 5.638 6.632zM5.348 2.5c-1.676 0-2.772 1.093-2.772 2.54 0 1.42 1.066 2.538 2.717 2.546h.032c1.71 0 2.77-1.132 2.77-2.546C8.056 3.593 7.02 2.5 5.344 2.5h.005zm-2.48 21.834h4.896V9.604H2.867v14.73z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M20.11 26.147c-2.335 1.05-4.36 1.4-7.124 1.4C6.524 27.548.84 22.916.84 15.284.84 7.343 6.602.45 15.4.45c6.854 0 11.8 4.7 11.8 11.252 0 5.684-3.193 9.265-7.398 9.3-1.83 0-3.153-.934-3.347-2.997h-.077c-1.208 1.986-2.96 2.997-5.023 2.997-2.532 0-4.36-1.868-4.36-5.062 0-4.75 3.503-9.07 9.11-9.07 1.713 0 3.7.4 4.6.972l-1.17 7.203c-.387 2.298-.115 3.3 1 3.4 1.674 0 3.774-2.102 3.774-6.58 0-5.06-3.27-8.994-9.304-8.994C9.05 2.87 3.83 7.545 3.83 14.97c0 6.5 4.2 10.2 10 10.202 1.987 0 4.09-.43 5.647-1.245l.634 2.22zM16.647 10.1c-.31-.078-.7-.155-1.207-.155-2.572 0-4.596 2.53-4.596 5.53 0 1.5.7 2.4 1.9 2.4 1.44 0 2.96-1.83 3.31-4.088l.592-3.72z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M14.02 1.57c-7.06 0-12.784 5.723-12.784 12.785S6.96 27.14 14.02 27.14c7.062 0 12.786-5.725 12.786-12.785 0-7.06-5.724-12.785-12.785-12.785zm1.24 17.085c-1.16-.09-1.648-.666-2.558-1.22-.5 2.627-1.113 5.146-2.925 6.46-.56-3.972.822-6.952 1.462-10.117-1.094-1.84.13-5.545 2.437-4.632 2.837 1.123-2.458 6.842 1.1 7.557 3.71.744 5.226-6.44 2.924-8.775-3.324-3.374-9.677-.077-8.896 4.754.19 1.178 1.408 1.538.49 3.168-2.13-.472-2.764-2.15-2.683-4.388.132-3.662 3.292-6.227 6.46-6.582 4.008-.448 7.772 1.474 8.29 5.24.58 4.254-1.815 8.864-6.1 8.532v.003z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="#FFF"><path d="M28.782.002c2.03.002 3.193 1.12 3.182 3.106-.022 3.57.17 7.16-.158 10.7-1.09 11.773-14.588 18.092-24.6 11.573C2.72 22.458.197 18.313.057 12.937c-.09-3.36-.05-6.72-.026-10.08C.04 1.113 1.212.016 3.02.008 7.347-.006 11.678.004 16.006.002c4.258 0 8.518-.004 12.776 0zM8.65 7.856c-1.262.135-1.99.57-2.357 1.476-.392.965-.115 1.81.606 2.496 2.453 2.334 4.91 4.664 7.398 6.966 1.086 1.003 2.237.99 3.314-.013 2.407-2.23 4.795-4.482 7.17-6.747 1.203-1.148 1.32-2.468.365-3.426-1.01-1.014-2.302-.933-3.558.245-1.596 1.497-3.222 2.965-4.75 4.526-.706.715-1.12.627-1.783-.034-1.597-1.596-3.25-3.138-4.93-4.644-.47-.42-1.123-.647-1.478-.844z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M11.794 15.316c0-1.03-.835-1.895-1.866-1.895-1.03 0-1.893.866-1.893 1.896s.863 1.9 1.9 1.9c1.023-.016 1.865-.916 1.865-1.9zM18.1 13.422c-1.03 0-1.895.864-1.895 1.895 0 1 .9 1.9 1.9 1.865 1.03 0 1.87-.836 1.87-1.865-.006-1.017-.875-1.917-1.875-1.895zM17.527 19.79c-.678.68-1.826 1.007-3.514 1.007h-.03c-1.686 0-2.834-.328-3.51-1.005-.264-.265-.693-.265-.958 0-.264.265-.264.7 0 1 .943.9 2.4 1.4 4.5 1.402.005 0 0 0 0 0 .005 0 0 0 0 0 2.066 0 3.527-.46 4.47-1.402.265-.264.265-.693.002-.958-.267-.334-.688-.334-.988-.043z"/><path d="M27.707 13.267c0-1.785-1.453-3.237-3.236-3.237-.792 0-1.517.287-2.08.76-2.04-1.294-4.647-2.068-7.44-2.218l1.484-4.69 4.062.955c.07 1.4 1.3 2.6 2.7 2.555 1.488 0 2.695-1.208 2.695-2.695C25.88 3.2 24.7 2 23.2 2c-1.06 0-1.98.616-2.42 1.508l-4.633-1.09c-.344-.082-.693.117-.803.454l-1.793 5.7C10.55 8.6 7.7 9.4 5.6 10.75c-.594-.45-1.3-.75-2.1-.72-1.785 0-3.237 1.45-3.237 3.2 0 1.1.6 2.1 1.4 2.69-.04.27-.06.55-.06.83 0 2.3 1.3 4.4 3.7 5.9 2.298 1.5 5.3 2.3 8.6 2.325 3.227 0 6.27-.825 8.57-2.325 2.387-1.56 3.7-3.66 3.7-5.917 0-.26-.016-.514-.05-.768.965-.465 1.577-1.565 1.577-2.698zm-4.52-9.912c.74 0 1.3.6 1.3 1.3 0 .738-.6 1.34-1.34 1.34s-1.343-.602-1.343-1.34c.04-.655.596-1.255 1.396-1.3zM1.646 13.3c0-1.038.845-1.882 1.883-1.882.31 0 .6.1.9.21-1.05.867-1.813 1.86-2.26 2.9-.338-.328-.57-.728-.57-1.26zm20.126 8.27c-2.082 1.357-4.863 2.105-7.83 2.105-2.968 0-5.748-.748-7.83-2.105-1.99-1.3-3.087-3-3.087-4.782 0-1.784 1.097-3.484 3.088-4.784 2.08-1.358 4.86-2.106 7.828-2.106 2.967 0 5.7.7 7.8 2.106 1.99 1.3 3.1 3 3.1 4.784C24.86 18.6 23.8 20.3 21.8 21.57zm4.014-6.97c-.432-1.084-1.19-2.095-2.244-2.977.273-.156.59-.245.928-.245 1.036 0 1.9.8 1.9 1.9-.016.522-.27 1.022-.57 1.327z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M18.02 21.842c-2.03.052-2.422-1.396-2.44-2.446v-7.294h4.73V7.874H15.6V1.592h-3.714s-.167.053-.182.186c-.218 1.935-1.144 5.33-4.988 6.688v3.637h2.927v7.677c0 2.8 1.7 6.7 7.3 6.6 1.863-.03 3.934-.795 4.392-1.453l-1.22-3.54c-.52.213-1.415.413-2.115.455z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M24.253 8.756C24.69 17.08 18.297 24.182 9.97 24.62c-3.122.162-6.22-.646-8.86-2.32 2.702.18 5.375-.648 7.507-2.32-2.072-.248-3.818-1.662-4.49-3.64.802.13 1.62.077 2.4-.154-2.482-.466-4.312-2.586-4.412-5.11.688.276 1.426.408 2.168.387-2.135-1.65-2.73-4.62-1.394-6.965C5.574 7.816 9.54 9.84 13.802 10.07c-.842-2.738.694-5.64 3.434-6.48 2.018-.624 4.212.043 5.546 1.682 1.186-.213 2.318-.662 3.33-1.317-.386 1.256-1.248 2.312-2.4 2.942 1.048-.106 2.07-.394 3.02-.85-.458 1.182-1.343 2.15-2.48 2.71z"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="70 70 378.7 378.7" fill="#FFF"><path d="M254.998 363.106h21.217s6.408-.706 9.684-4.23c3.01-3.24 2.914-9.32 2.914-9.32s-.415-28.47 12.796-32.663c13.03-4.133 29.755 27.515 47.482 39.685 13.407 9.206 23.594 7.19 23.594 7.19l47.407-.662s24.797-1.53 13.038-21.027c-.96-1.594-6.85-14.424-35.247-40.784-29.728-27.59-25.743-23.126 10.063-70.85 21.807-29.063 30.523-46.806 27.8-54.405-2.596-7.24-18.636-5.326-18.636-5.326l-53.375.33s-3.96-.54-6.892 1.216c-2.87 1.716-4.71 5.726-4.71 5.726s-8.452 22.49-19.714 41.618c-23.77 40.357-33.274 42.494-37.16 39.984-9.037-5.842-6.78-23.462-6.78-35.983 0-39.112 5.934-55.42-11.55-59.64-5.802-1.4-10.076-2.327-24.915-2.48-19.046-.192-35.162.06-44.29 4.53-6.072 2.975-10.757 9.6-7.902 9.98 3.528.47 11.516 2.158 15.75 7.92 5.472 7.444 5.28 24.154 5.28 24.154s3.145 46.04-7.34 51.758c-7.193 3.922-17.063-4.085-38.253-40.7-10.855-18.755-19.054-39.49-19.054-39.49s-1.578-3.873-4.398-5.947c-3.42-2.51-8.2-3.307-8.2-3.307l-50.722.33s-7.612.213-10.41 3.525c-2.488 2.947-.198 9.036-.198 9.036s39.707 92.902 84.672 139.72c41.234 42.93 88.048 40.112 88.048 40.112"/></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="#FFF"><path d="M27.688 8.512c0-2.268-1.825-4.093-4.106-4.093H4.39C2.143 4.42.312 6.243.312 8.51v10.976c0 2.268 1.825 4.093 4.076 4.093h19.19c2.275 0 4.107-1.824 4.107-4.092V8.512zm-16.425 10.12V8.322l7.817 5.154-7.817 5.156z"/></svg>
|
@@ -0,0 +1,358 @@
|
|
1
|
+
/*!
|
2
|
+
Ridiculously Responsive Social Sharing Buttons
|
3
|
+
Team: @dbox, @joshuatuscan
|
4
|
+
Site: http://www.kurtnoble.com/labs/rrssb
|
5
|
+
Twitter: @therealkni
|
6
|
+
|
7
|
+
___ ___
|
8
|
+
/__/| /__/\ ___
|
9
|
+
| |:| \ \:\ / /\
|
10
|
+
| |:| \ \:\ / /:/
|
11
|
+
__| |:| _____\__\:\ /__/::\
|
12
|
+
/__/\_|:|____ /__/::::::::\ \__\/\:\__
|
13
|
+
\ \:\/:::::/ \ \:\~~\~~\/ \ \:\/\
|
14
|
+
\ \::/~~~~ \ \:\ ~~~ \__\::/
|
15
|
+
\ \:\ \ \:\ /__/:/
|
16
|
+
\ \:\ \ \:\ \__\/
|
17
|
+
\__\/ \__\/
|
18
|
+
*/
|
19
|
+
|
20
|
+
(function(window, $, undefined) {
|
21
|
+
'use strict';
|
22
|
+
|
23
|
+
var support = {
|
24
|
+
calc : false
|
25
|
+
};
|
26
|
+
|
27
|
+
/*
|
28
|
+
* Public Function
|
29
|
+
*/
|
30
|
+
|
31
|
+
$.fn.rrssb = function( options ) {
|
32
|
+
|
33
|
+
// Settings that $.rrssb() will accept.
|
34
|
+
var settings = $.extend({
|
35
|
+
description: undefined,
|
36
|
+
emailAddress: undefined,
|
37
|
+
emailBody: undefined,
|
38
|
+
emailSubject: undefined,
|
39
|
+
image: undefined,
|
40
|
+
title: undefined,
|
41
|
+
url: undefined
|
42
|
+
}, options );
|
43
|
+
|
44
|
+
// Return the encoded strings if the settings have been changed.
|
45
|
+
for (var key in settings) {
|
46
|
+
if (settings.hasOwnProperty(key) && settings[key] !== undefined) {
|
47
|
+
settings[key] = encodeString(settings[key]);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
if (settings.url !== undefined) {
|
52
|
+
$(this).find('.rrssb-facebook a').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + settings.url);
|
53
|
+
$(this).find('.rrssb-tumblr a').attr('href', 'http://tumblr.com/share/link?url=' + settings.url + (settings.title !== undefined ? '&name=' + settings.title : '') + (settings.description !== undefined ? '&description=' + settings.description : ''));
|
54
|
+
$(this).find('.rrssb-linkedin a').attr('href', 'http://www.linkedin.com/shareArticle?mini=true&url=' + settings.url + (settings.title !== undefined ? '&title=' + settings.title : '') + (settings.description !== undefined ? '&summary=' + settings.description : ''));
|
55
|
+
$(this).find('.rrssb-twitter a').attr('href', 'https://twitter.com/intent/tweet?text=' + (settings.description !== undefined ? settings.description : '') + '%20' + settings.url);
|
56
|
+
$(this).find('.rrssb-hackernews a').attr('href', 'https://news.ycombinator.com/submitlink?u=' + settings.url + (settings.title !== undefined ? '&text=' + settings.title : ''));
|
57
|
+
$(this).find('.rrssb-reddit a').attr('href', 'http://www.reddit.com/submit?url=' + settings.url + (settings.description !== undefined ? '&text=' + settings.description : '') + (settings.title !== undefined ? '&title=' + settings.title : ''));
|
58
|
+
$(this).find('.rrssb-googleplus a').attr('href', 'https://plus.google.com/share?url=' + (settings.description !== undefined ? settings.description : '') + '%20' + settings.url);
|
59
|
+
$(this).find('.rrssb-pinterest a').attr('href', 'http://pinterest.com/pin/create/button/?url=' + settings.url + ((settings.image !== undefined) ? '&media=' + settings.image : '') + (settings.description !== undefined ? '&description=' + settings.description : ''));
|
60
|
+
$(this).find('.rrssb-pocket a').attr('href', 'https://getpocket.com/save?url=' + settings.url);
|
61
|
+
$(this).find('.rrssb-github a').attr('href', settings.url);
|
62
|
+
}
|
63
|
+
|
64
|
+
if (settings.emailAddress !== undefined) {
|
65
|
+
$(this).find('.rrssb-email a').attr('href', 'mailto:' + settings.emailAddress + '?' + (settings.emailSubject !== undefined ? 'subject=' + settings.emailSubject : '') + (settings.emailBody !== undefined ? '&body=' + settings.emailBody : ''));
|
66
|
+
}
|
67
|
+
|
68
|
+
};
|
69
|
+
|
70
|
+
/*
|
71
|
+
* Utility functions
|
72
|
+
*/
|
73
|
+
var detectCalcSupport = function(){
|
74
|
+
//detect if calc is natively supported.
|
75
|
+
var el = $('<div>');
|
76
|
+
var calcProps = [
|
77
|
+
'calc',
|
78
|
+
'-webkit-calc',
|
79
|
+
'-moz-calc'
|
80
|
+
];
|
81
|
+
|
82
|
+
$('body').append(el);
|
83
|
+
|
84
|
+
for (var i=0; i < calcProps.length; i++) {
|
85
|
+
el.css('width', calcProps[i] + '(1px)');
|
86
|
+
if(el.width() === 1){
|
87
|
+
support.calc = calcProps[i];
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
el.remove();
|
93
|
+
};
|
94
|
+
|
95
|
+
var encodeString = function(string) {
|
96
|
+
// Recursively decode string first to ensure we aren't double encoding.
|
97
|
+
if (string !== undefined && string !== null) {
|
98
|
+
if (string.match(/%[0-9a-f]{2}/i) !== null) {
|
99
|
+
string = decodeURIComponent(string);
|
100
|
+
encodeString(string);
|
101
|
+
} else {
|
102
|
+
return encodeURIComponent(string);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
var setPercentBtns = function() {
|
108
|
+
// loop through each instance of buttons
|
109
|
+
$('.rrssb-buttons').each(function(index) {
|
110
|
+
var self = $(this);
|
111
|
+
var buttons = $('li:visible', self);
|
112
|
+
var numOfButtons = buttons.length;
|
113
|
+
var initBtnWidth = 100 / numOfButtons;
|
114
|
+
|
115
|
+
// set initial width of buttons
|
116
|
+
buttons.css('width', initBtnWidth + '%').attr('data-initwidth',initBtnWidth);
|
117
|
+
});
|
118
|
+
};
|
119
|
+
|
120
|
+
var makeExtremityBtns = function() {
|
121
|
+
// loop through each instance of buttons
|
122
|
+
$('.rrssb-buttons').each(function(index) {
|
123
|
+
var self = $(this);
|
124
|
+
//get button width
|
125
|
+
var containerWidth = self.width();
|
126
|
+
var buttonWidth = $('li', self).not('.small').first().width();
|
127
|
+
|
128
|
+
// enlarge buttons if they get wide enough
|
129
|
+
if (buttonWidth > 170 && $('li.small', self).length < 1) {
|
130
|
+
self.addClass('large-format');
|
131
|
+
} else {
|
132
|
+
self.removeClass('large-format');
|
133
|
+
}
|
134
|
+
|
135
|
+
if (containerWidth < 200) {
|
136
|
+
self.removeClass('small-format').addClass('tiny-format');
|
137
|
+
} else {
|
138
|
+
self.removeClass('tiny-format');
|
139
|
+
}
|
140
|
+
});
|
141
|
+
};
|
142
|
+
|
143
|
+
var backUpFromSmall = function() {
|
144
|
+
// loop through each instance of buttons
|
145
|
+
$('.rrssb-buttons').each(function(index) {
|
146
|
+
var self = $(this);
|
147
|
+
|
148
|
+
var buttons = $('li', self);
|
149
|
+
var smallButtons = buttons.filter('.small');
|
150
|
+
var totalBtnSze = 0;
|
151
|
+
var totalTxtSze = 0;
|
152
|
+
var upCandidate = smallButtons.first();
|
153
|
+
var nextBackUp = parseFloat(upCandidate.attr('data-size')) + 55;
|
154
|
+
var smallBtnCount = smallButtons.length;
|
155
|
+
|
156
|
+
if (smallBtnCount === buttons.length) {
|
157
|
+
var btnCalc = smallBtnCount * 42;
|
158
|
+
var containerWidth = self.width();
|
159
|
+
|
160
|
+
if ((btnCalc + nextBackUp) < containerWidth) {
|
161
|
+
self.removeClass('small-format');
|
162
|
+
smallButtons.first().removeClass('small');
|
163
|
+
|
164
|
+
sizeSmallBtns();
|
165
|
+
}
|
166
|
+
|
167
|
+
} else {
|
168
|
+
buttons.not('.small').each(function(index) {
|
169
|
+
var button = $(this);
|
170
|
+
var txtWidth = parseFloat(button.attr('data-size')) + 55;
|
171
|
+
var btnWidth = parseFloat(button.width());
|
172
|
+
|
173
|
+
totalBtnSze = totalBtnSze + btnWidth;
|
174
|
+
totalTxtSze = totalTxtSze + txtWidth;
|
175
|
+
});
|
176
|
+
|
177
|
+
var spaceLeft = totalBtnSze - totalTxtSze;
|
178
|
+
|
179
|
+
if (nextBackUp < spaceLeft) {
|
180
|
+
upCandidate.removeClass('small');
|
181
|
+
sizeSmallBtns();
|
182
|
+
}
|
183
|
+
}
|
184
|
+
});
|
185
|
+
};
|
186
|
+
|
187
|
+
var checkSize = function(init) {
|
188
|
+
// loop through each instance of buttons
|
189
|
+
$('.rrssb-buttons').each(function(index) {
|
190
|
+
|
191
|
+
var self = $(this);
|
192
|
+
var buttons = $('li', self);
|
193
|
+
|
194
|
+
// get buttons in reverse order and loop through each
|
195
|
+
$(buttons.get().reverse()).each(function(index, count) {
|
196
|
+
|
197
|
+
var button = $(this);
|
198
|
+
|
199
|
+
if (button.hasClass('small') === false) {
|
200
|
+
var txtWidth = parseFloat(button.attr('data-size')) + 55;
|
201
|
+
var btnWidth = parseFloat(button.width());
|
202
|
+
|
203
|
+
if (txtWidth > btnWidth) {
|
204
|
+
var btn2small = buttons.not('.small').last();
|
205
|
+
$(btn2small).addClass('small');
|
206
|
+
sizeSmallBtns();
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
if (!--count) backUpFromSmall();
|
211
|
+
});
|
212
|
+
});
|
213
|
+
|
214
|
+
// if first time running, put it through the magic layout
|
215
|
+
if (init === true) {
|
216
|
+
rrssbMagicLayout(sizeSmallBtns);
|
217
|
+
}
|
218
|
+
};
|
219
|
+
|
220
|
+
var sizeSmallBtns = function() {
|
221
|
+
// loop through each instance of buttons
|
222
|
+
$('.rrssb-buttons').each(function(index) {
|
223
|
+
var self = $(this);
|
224
|
+
var regButtonCount;
|
225
|
+
var regPercent;
|
226
|
+
var pixelsOff;
|
227
|
+
var magicWidth;
|
228
|
+
var smallBtnFraction;
|
229
|
+
var buttons = $('li', self);
|
230
|
+
var smallButtons = buttons.filter('.small');
|
231
|
+
|
232
|
+
// readjust buttons for small display
|
233
|
+
var smallBtnCount = smallButtons.length;
|
234
|
+
|
235
|
+
// make sure there are small buttons
|
236
|
+
if (smallBtnCount > 0 && smallBtnCount !== buttons.length) {
|
237
|
+
self.removeClass('small-format');
|
238
|
+
|
239
|
+
//make sure small buttons are square when not all small
|
240
|
+
smallButtons.css('width','42px');
|
241
|
+
pixelsOff = smallBtnCount * 42;
|
242
|
+
regButtonCount = buttons.not('.small').length;
|
243
|
+
regPercent = 100 / regButtonCount;
|
244
|
+
smallBtnFraction = pixelsOff / regButtonCount;
|
245
|
+
|
246
|
+
// if calc is not supported. calculate the width on the fly.
|
247
|
+
if (support.calc === false) {
|
248
|
+
magicWidth = ((self.innerWidth()-1) / regButtonCount) - smallBtnFraction;
|
249
|
+
magicWidth = Math.floor(magicWidth*1000) / 1000;
|
250
|
+
magicWidth += 'px';
|
251
|
+
} else {
|
252
|
+
magicWidth = support.calc+'('+regPercent+'% - '+smallBtnFraction+'px)';
|
253
|
+
}
|
254
|
+
|
255
|
+
buttons.not('.small').css('width', magicWidth);
|
256
|
+
|
257
|
+
} else if (smallBtnCount === buttons.length) {
|
258
|
+
// if all buttons are small, change back to percentage
|
259
|
+
self.addClass('small-format');
|
260
|
+
setPercentBtns();
|
261
|
+
} else {
|
262
|
+
self.removeClass('small-format');
|
263
|
+
setPercentBtns();
|
264
|
+
}
|
265
|
+
}); //end loop
|
266
|
+
|
267
|
+
makeExtremityBtns();
|
268
|
+
};
|
269
|
+
|
270
|
+
var rrssbInit = function() {
|
271
|
+
$('.rrssb-buttons').each(function(index) {
|
272
|
+
$(this).addClass('rrssb-'+(index + 1));
|
273
|
+
});
|
274
|
+
|
275
|
+
detectCalcSupport();
|
276
|
+
|
277
|
+
setPercentBtns();
|
278
|
+
|
279
|
+
// grab initial text width of each button and add as data attr
|
280
|
+
$('.rrssb-buttons li .rrssb-text').each(function(index) {
|
281
|
+
var buttonTxt = $(this);
|
282
|
+
var txtWdth = buttonTxt.width();
|
283
|
+
buttonTxt.closest('li').attr('data-size', txtWdth);
|
284
|
+
});
|
285
|
+
|
286
|
+
checkSize(true);
|
287
|
+
};
|
288
|
+
|
289
|
+
var rrssbMagicLayout = function(callback) {
|
290
|
+
//remove small buttons before each conversion try
|
291
|
+
$('.rrssb-buttons li.small').removeClass('small');
|
292
|
+
|
293
|
+
checkSize();
|
294
|
+
|
295
|
+
callback();
|
296
|
+
};
|
297
|
+
|
298
|
+
var popupCenter = function(url, title, w, h) {
|
299
|
+
// Fixes dual-screen position Most browsers Firefox
|
300
|
+
var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left;
|
301
|
+
var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top;
|
302
|
+
|
303
|
+
var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
304
|
+
var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
305
|
+
|
306
|
+
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
|
307
|
+
var top = ((height / 3) - (h / 3)) + dualScreenTop;
|
308
|
+
|
309
|
+
var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
|
310
|
+
|
311
|
+
// Puts focus on the newWindow
|
312
|
+
if (window.focus) {
|
313
|
+
newWindow.focus();
|
314
|
+
}
|
315
|
+
};
|
316
|
+
|
317
|
+
var waitForFinalEvent = (function () {
|
318
|
+
var timers = {};
|
319
|
+
return function (callback, ms, uniqueId) {
|
320
|
+
if (!uniqueId) {
|
321
|
+
uniqueId = "Don't call this twice without a uniqueId";
|
322
|
+
}
|
323
|
+
if (timers[uniqueId]) {
|
324
|
+
clearTimeout (timers[uniqueId]);
|
325
|
+
}
|
326
|
+
timers[uniqueId] = setTimeout(callback, ms);
|
327
|
+
};
|
328
|
+
})();
|
329
|
+
|
330
|
+
// init load
|
331
|
+
$(document).ready(function(){
|
332
|
+
/*
|
333
|
+
* Event listners
|
334
|
+
*/
|
335
|
+
|
336
|
+
$(document).on('click', '.rrssb-buttons a.popup', {}, function popUp(e) {
|
337
|
+
var self = $(this);
|
338
|
+
popupCenter(self.attr('href'), self.find('.rrssb-text').html(), 580, 470);
|
339
|
+
e.preventDefault();
|
340
|
+
});
|
341
|
+
|
342
|
+
// resize function
|
343
|
+
$(window).resize(function () {
|
344
|
+
|
345
|
+
rrssbMagicLayout(sizeSmallBtns);
|
346
|
+
|
347
|
+
waitForFinalEvent(function(){
|
348
|
+
rrssbMagicLayout(sizeSmallBtns);
|
349
|
+
}, 200, "finished resizing");
|
350
|
+
});
|
351
|
+
|
352
|
+
rrssbInit();
|
353
|
+
});
|
354
|
+
|
355
|
+
// Make global
|
356
|
+
window.rrssbInit = rrssbInit;
|
357
|
+
|
358
|
+
})(window, jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
.rrssb-buttons{box-sizing:border-box;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;height:36px;margin:0;padding:0;width:100%}.rrssb-buttons:after{clear:both}.rrssb-buttons:after,.rrssb-buttons:before{content:' ';display:table}.rrssb-buttons li{box-sizing:border-box;float:left;height:100%;line-height:13px;list-style:none;margin:0;padding:0 2px}.rrssb-buttons li.rrssb-email a{background-color:#0a88ff}.rrssb-buttons li.rrssb-email a:hover{background-color:#006ed6}.rrssb-buttons li.rrssb-facebook a{background-color:#306199}.rrssb-buttons li.rrssb-facebook a:hover{background-color:#244872}.rrssb-buttons li.rrssb-tumblr a{background-color:#32506d}.rrssb-buttons li.rrssb-tumblr a:hover{background-color:#22364a}.rrssb-buttons li.rrssb-linkedin a{background-color:#007bb6}.rrssb-buttons li.rrssb-linkedin a:hover{background-color:#005983}.rrssb-buttons li.rrssb-twitter a{background-color:#26c4f1}.rrssb-buttons li.rrssb-twitter a:hover{background-color:#0eaad6}.rrssb-buttons li.rrssb-googleplus a{background-color:#e93f2e}.rrssb-buttons li.rrssb-googleplus a:hover{background-color:#ce2616}.rrssb-buttons li.rrssb-youtube a{background-color:#df1c31}.rrssb-buttons li.rrssb-youtube a:hover{background-color:#b21627}.rrssb-buttons li.rrssb-reddit a{background-color:#8bbbe3}.rrssb-buttons li.rrssb-reddit a:hover{background-color:#62a3d9}.rrssb-buttons li.rrssb-pinterest a{background-color:#b81621}.rrssb-buttons li.rrssb-pinterest a:hover{background-color:#8a1119}.rrssb-buttons li.rrssb-pocket a{background-color:#ed4054}.rrssb-buttons li.rrssb-pocket a:hover{background-color:#e4162d}.rrssb-buttons li.rrssb-github a{background-color:#444}.rrssb-buttons li.rrssb-github a:hover{background-color:#2b2b2b}.rrssb-buttons li.rrssb-instagram a{background-color:#517fa4}.rrssb-buttons li.rrssb-instagram a:hover{background-color:#406582}.rrssb-buttons li.rrssb-delicious a{background-color:#0B79E5}.rrssb-buttons li.rrssb-delicious a:hover{background-color:#095fb4}.rrssb-buttons li.rrssb-vk a{background-color:#4d71a9}.rrssb-buttons li.rrssb-vk a:hover{background-color:#3d5a86}.rrssb-buttons li.rrssb-hackernews a{background-color:#f60}.rrssb-buttons li.rrssb-hackernews a:hover{background-color:#cc5200}.rrssb-buttons li a{background-color:#ccc;border-radius:2px;box-sizing:border-box;display:block;font-size:11px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:700;height:100%;padding:11px 7px 12px 27px;position:relative;text-align:center;text-decoration:none;text-transform:uppercase;-webkit-transition:background-color .2s ease-in-out;transition:background-color .2s ease-in-out;width:100%}.rrssb-buttons li a .rrssb-icon{display:block;left:10px;padding-top:9px;position:absolute;top:0;width:10%}.rrssb-buttons li a .rrssb-icon svg{height:17px;width:17px}.rrssb-buttons li a .rrssb-icon svg path{fill:#fff}.rrssb-buttons li a .rrssb-text{color:#fff}.rrssb-buttons li a:active{box-shadow:inset 1px 3px 15px 0 rgba(22,0,0,.25)}.rrssb-buttons li.small a{padding:0}.rrssb-buttons li.small a .rrssb-icon{left:auto;margin:0 auto;overflow:hidden;position:relative;top:auto;width:100%}.rrssb-buttons li.small a .rrssb-text{visibility:hidden}.rrssb-buttons.large-format,.rrssb-buttons.large-format li{height:auto}.rrssb-buttons.large-format li:first-child:nth-last-child(1) a{font-size:20px;font-size:4vw}.rrssb-buttons.large-format li:first-child:nth-last-child(2) a,.rrssb-buttons.large-format li:first-child:nth-last-child(2)~li a{font-size:16px;font-size:2vw}.rrssb-buttons.large-format li:first-child:nth-last-child(3) a,.rrssb-buttons.large-format li:first-child:nth-last-child(3)~li a{font-size:14px;font-size:1.7vw}.rrssb-buttons.large-format li:first-child:nth-last-child(4) a,.rrssb-buttons.large-format li:first-child:nth-last-child(4)~li a{font-size:13px;font-size:1.4vw}.rrssb-buttons.large-format li:first-child:nth-last-child(5) a,.rrssb-buttons.large-format li:first-child:nth-last-child(5)~li a{font-size:13px;font-size:1.2vw}.rrssb-buttons.large-format li:first-child:nth-last-child(6) a,.rrssb-buttons.large-format li:first-child:nth-last-child(6)~li a{font-size:12px;font-size:1.05vw}.rrssb-buttons.large-format li:first-child:nth-last-child(7) a,.rrssb-buttons.large-format li:first-child:nth-last-child(7)~li a{font-size:11px;font-size:.9vw}.rrssb-buttons.large-format li:first-child:nth-last-child(8) a,.rrssb-buttons.large-format li:first-child:nth-last-child(8)~li a{font-size:11px;font-size:.8vw}.rrssb-buttons.large-format li:first-child:nth-last-child(9) a,.rrssb-buttons.large-format li:first-child:nth-last-child(9)~li a{font-size:11px;font-size:.7vw}.rrssb-buttons.large-format li:first-child:nth-last-child(10) a,.rrssb-buttons.large-format li:first-child:nth-last-child(10)~li a{font-size:11px;font-size:.6vw}.rrssb-buttons.large-format li:first-child:nth-last-child(11) a,.rrssb-buttons.large-format li:first-child:nth-last-child(11)~li a{font-size:11px;font-size:.5vw}.rrssb-buttons.large-format li a{-webkit-backface-visibility:hidden;backface-visibility:hidden;border-radius:.2em;padding:8.5% 0 8.5% 12%}.rrssb-buttons.large-format li a .rrssb-icon{height:100%;left:7%;padding-top:0;width:12%}.rrssb-buttons.large-format li a .rrssb-icon svg{height:100%;position:absolute;top:0;width:100%}.rrssb-buttons.large-format li a .rrssb-text{-webkit-backface-visibility:hidden;backface-visibility:hidden}.rrssb-buttons.small-format{padding-top:5px}.rrssb-buttons.small-format li{height:80%;padding:0 1px}.rrssb-buttons.small-format li a .rrssb-icon{height:100%;padding-top:0}.rrssb-buttons.small-format li a .rrssb-icon svg{height:48%;position:relative;top:6px;width:80%}.rrssb-buttons.tiny-format{height:22px;position:relative}.rrssb-buttons.tiny-format li{padding-right:7px}.rrssb-buttons.tiny-format li a{background-color:transparent;padding:0}.rrssb-buttons.tiny-format li a .rrssb-icon svg{height:70%;width:100%}.rrssb-buttons.tiny-format li a:active,.rrssb-buttons.tiny-format li a:hover{background-color:transparent}.rrssb-buttons.tiny-format li.rrssb-email a .rrssb-icon svg path{fill:#0a88ff}.rrssb-buttons.tiny-format li.rrssb-email a .rrssb-icon:hover .rrssb-icon svg path{fill:#0054a3}.rrssb-buttons.tiny-format li.rrssb-facebook a .rrssb-icon svg path{fill:#306199}.rrssb-buttons.tiny-format li.rrssb-facebook a .rrssb-icon:hover .rrssb-icon svg path{fill:#18304b}.rrssb-buttons.tiny-format li.rrssb-tumblr a .rrssb-icon svg path{fill:#32506d}.rrssb-buttons.tiny-format li.rrssb-tumblr a .rrssb-icon:hover .rrssb-icon svg path{fill:#121d27}.rrssb-buttons.tiny-format li.rrssb-linkedin a .rrssb-icon svg path{fill:#007bb6}.rrssb-buttons.tiny-format li.rrssb-linkedin a .rrssb-icon:hover .rrssb-icon svg path{fill:#003650}.rrssb-buttons.tiny-format li.rrssb-twitter a .rrssb-icon svg path{fill:#26c4f1}.rrssb-buttons.tiny-format li.rrssb-twitter a .rrssb-icon:hover .rrssb-icon svg path{fill:#0b84a6}.rrssb-buttons.tiny-format li.rrssb-googleplus a .rrssb-icon svg path{fill:#e93f2e}.rrssb-buttons.tiny-format li.rrssb-googleplus a .rrssb-icon:hover .rrssb-icon svg path{fill:#a01e11}.rrssb-buttons.tiny-format li.rrssb-youtube a .rrssb-icon svg path{fill:#df1c31}.rrssb-buttons.tiny-format li.rrssb-youtube a .rrssb-icon:hover .rrssb-icon svg path{fill:#84111d}.rrssb-buttons.tiny-format li.rrssb-reddit a .rrssb-icon svg path{fill:#8bbbe3}.rrssb-buttons.tiny-format li.rrssb-reddit a .rrssb-icon:hover .rrssb-icon svg path{fill:#398bcf}.rrssb-buttons.tiny-format li.rrssb-pinterest a .rrssb-icon svg path{fill:#b81621}.rrssb-buttons.tiny-format li.rrssb-pinterest a .rrssb-icon:hover .rrssb-icon svg path{fill:#5d0b11}.rrssb-buttons.tiny-format li.rrssb-pocket a .rrssb-icon svg path{fill:#ed4054}.rrssb-buttons.tiny-format li.rrssb-pocket a .rrssb-icon:hover .rrssb-icon svg path{fill:#b61124}.rrssb-buttons.tiny-format li.rrssb-github a .rrssb-icon svg path{fill:#444}.rrssb-buttons.tiny-format li.rrssb-github a .rrssb-icon:hover .rrssb-icon svg path{fill:#111}.rrssb-buttons.tiny-format li.rrssb-instagram a .rrssb-icon svg path{fill:#517fa4}.rrssb-buttons.tiny-format li.rrssb-instagram a .rrssb-icon:hover .rrssb-icon svg path{fill:#2f4a60}.rrssb-buttons.tiny-format li.rrssb-delicious a .rrssb-icon svg path{fill:#0B79E5}.rrssb-buttons.tiny-format li.rrssb-delicious a .rrssb-icon:hover .rrssb-icon svg path{fill:#064684}.rrssb-buttons.tiny-format li.rrssb-vk a .rrssb-icon svg path{fill:#4d71a9}.rrssb-buttons.tiny-format li.rrssb-vk a .rrssb-icon:hover .rrssb-icon svg path{fill:#2d4263}.rrssb-buttons.tiny-format li.rrssb-hackernews a .rrssb-icon svg path{fill:#f60}.rrssb-buttons.tiny-format li.rrssb-hackernews a .rrssb-icon:hover .rrssb-icon svg path{fill:#993d00}
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rrssb-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Damien Imberdis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Ridiculously Responsive Social Sharing Buttons for Rails is based on
|
56
|
+
RRSSB from KNI Labs
|
57
|
+
email:
|
58
|
+
- imberdis.damien@gmail.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- app/helpers/rrssb/rails/buttons_helper.rb
|
69
|
+
- lib/rrssb-rails.rb
|
70
|
+
- lib/rrssb/rails.rb
|
71
|
+
- lib/rrssb/rails/engine.rb
|
72
|
+
- lib/rrssb/rails/version.rb
|
73
|
+
- rrssb-rails.gemspec
|
74
|
+
- test/dummy/.gitignore
|
75
|
+
- test/dummy/app/assets/stylesheets/sprockets-require.css
|
76
|
+
- test/dummy/app/controllers/pages_controller.rb
|
77
|
+
- test/dummy/app/views/pages/buttons.html.erb
|
78
|
+
- test/dummy/config.ru
|
79
|
+
- test/dummy/config/application.rb
|
80
|
+
- test/dummy/config/boot.rb
|
81
|
+
- test/dummy/config/environment.rb
|
82
|
+
- test/dummy/config/routes.rb
|
83
|
+
- test/dummy/config/secrets.yml
|
84
|
+
- test/helpers/buttons_helper_test.rb
|
85
|
+
- test/integration/rrssb_rails_test.rb
|
86
|
+
- test/test_helper.rb
|
87
|
+
- vendor/assets/images/delicious.min.svg
|
88
|
+
- vendor/assets/images/facebook.min.svg
|
89
|
+
- vendor/assets/images/github.min.svg
|
90
|
+
- vendor/assets/images/google_plus.min.svg
|
91
|
+
- vendor/assets/images/hackernews.min.svg
|
92
|
+
- vendor/assets/images/instagram.min.svg
|
93
|
+
- vendor/assets/images/linkedin.min.svg
|
94
|
+
- vendor/assets/images/mail.min.svg
|
95
|
+
- vendor/assets/images/pinterest.min.svg
|
96
|
+
- vendor/assets/images/pocket.min.svg
|
97
|
+
- vendor/assets/images/reddit.min.svg
|
98
|
+
- vendor/assets/images/tumblr.min.svg
|
99
|
+
- vendor/assets/images/twitter.min.svg
|
100
|
+
- vendor/assets/images/vk.min.svg
|
101
|
+
- vendor/assets/images/youtube.min.svg
|
102
|
+
- vendor/assets/javascripts/rrssb.js
|
103
|
+
- vendor/assets/stylesheets/rrssb.css
|
104
|
+
homepage: https://github.com/Merchbro/rrssb-rails
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.2.2
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Ridiculously Responsive Social Sharing Buttons for Rails
|
128
|
+
test_files:
|
129
|
+
- test/dummy/.gitignore
|
130
|
+
- test/dummy/app/assets/stylesheets/sprockets-require.css
|
131
|
+
- test/dummy/app/controllers/pages_controller.rb
|
132
|
+
- test/dummy/app/views/pages/buttons.html.erb
|
133
|
+
- test/dummy/config.ru
|
134
|
+
- test/dummy/config/application.rb
|
135
|
+
- test/dummy/config/boot.rb
|
136
|
+
- test/dummy/config/environment.rb
|
137
|
+
- test/dummy/config/routes.rb
|
138
|
+
- test/dummy/config/secrets.yml
|
139
|
+
- test/helpers/buttons_helper_test.rb
|
140
|
+
- test/integration/rrssb_rails_test.rb
|
141
|
+
- test/test_helper.rb
|