neilin-rails 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ef7ff2e434cbf87c497c192ab42877eda6d25c5a
4
+ data.tar.gz: 6c4c48d6c0a8c54b13d169d913bcdd21907739ec
5
+ SHA512:
6
+ metadata.gz: d939c7586dc932c17b9e6e1f101c0c5befcbb65ab5b8bed38eb9351b6b9c5ba32b518fa681412365fc0c4c003ec7b33dee660cddcff6c2d5cf0cf9b4f73d952c
7
+ data.tar.gz: c1cbbb8950d85f81de0812bfd40b426f2f2baf132c28b954e202a60bf6df15dbfd2692076816110d527984474f2b5da9ed88d6b65b878cbdc030b41442b438bf
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.swp
19
+ *~
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in neilin-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Neil Marion dela Cruz
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,29 @@
1
+ # Neilin::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'neilin-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install neilin-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ require "neilin/rails/version"
2
+
3
+ module Neilin
4
+ module Rails
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Neilin
2
+ module Rails
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -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 'neilin/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "neilin-rails"
8
+ spec.version = Neilin::Rails::VERSION
9
+ spec.authors = ["Neil Marion dela Cruz"]
10
+ spec.email = ["nmfdelacruz@gmail.com"]
11
+ spec.description = %q{social share on text highlight}
12
+ spec.summary = %q{social share on text highlight}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "twitter-bootstrap-rails"
24
+ spec.add_dependency "jquery-rails"
25
+ end
@@ -0,0 +1,123 @@
1
+ if(!window.Neilin){
2
+ Neilin = {};
3
+ }
4
+
5
+ Neilin.Selector = {};
6
+ Neilin.Selector.getSelected = function(){
7
+ var t = '';
8
+ if(window.getSelection){
9
+ t = window.getSelection();
10
+ }else if(document.getSelection){
11
+ t = document.getSelection();
12
+ }else if(document.selection){
13
+ t = document.selection.createRange().text;
14
+ }
15
+ return t;
16
+ }
17
+
18
+ function formatMessage(message){
19
+ if (message.length > 112){
20
+ message = message.substring(0, 112);
21
+ message = '"'+ message +'..." '
22
+ } else {
23
+ message = '"'+ message +'" '
24
+ }
25
+ return message;
26
+ }
27
+
28
+ function computeXY(){
29
+ range = Neilin.Selector.getSelected().getRangeAt(0);
30
+ range.collapse(false);
31
+ dummy = document.createElement("span");
32
+ range.insertNode(dummy);
33
+ rect = dummy.getBoundingClientRect();
34
+ endX = rect.left;
35
+ endY = rect.top;
36
+ dummy.parentNode.removeChild(dummy);
37
+
38
+ range = Neilin.Selector.getSelected().getRangeAt(0);
39
+ range.collapse(true);
40
+ rect = range.getClientRects()[0];
41
+ startX = rect.left;
42
+ startY = rect.top;
43
+
44
+ y = endY > startY ? startY : endY;
45
+ addX = endX > startX ? startX : endX;
46
+
47
+ x = Math.abs(endX - startX) / 2;
48
+ return {'x': addX + x, 'y': y}
49
+ }
50
+
51
+ Neilin.Selector.mouseup = function(e){
52
+ window.endX = e.pageX;
53
+ window.endY = e.pageY;
54
+
55
+
56
+ st = Neilin.Selector.getSelected();
57
+ st = st.toString();
58
+ window.st = st;
59
+
60
+ if(window.startX + window.startY != window.endX + window.endY && st!='') {
61
+ xy = computeXY();
62
+ $(".popup").css({"left": xy['x']-40, "top": xy['y']-45});
63
+ $(".popup").show().animate({ top: xy['y']-65}, {duration: 500, easing: 'easeOutElastic'})
64
+
65
+ } else {
66
+ $(".popup").hide();
67
+ }
68
+ }
69
+
70
+ Neilin.Selector.mousedown = function(e){
71
+ window.startX = e.pageX;
72
+ window.startY = e.pageY;
73
+ }
74
+
75
+
76
+
77
+
78
+ $(document).ready(function(){
79
+ highlightMenu = '<div class="popup highlight-menu highlight-menu-active">'+
80
+ '<div class="highlight-menu-inner">'+
81
+ '<ul class="highlight-menu-buttons">'+
82
+ '<li class="highlight-menu-button highlight-menu-facebook">'+
83
+ '<button class="btn-highlight-menu" data-action="facebook">'+
84
+ '<span class="icons icon-facebook"></span>'+
85
+ '</button>'+
86
+ '</li>'+
87
+ '<li class="highlight-menu-button highlight-menu-google">'+
88
+ '<button class="btn-highlight-menu" data-action="google">'+
89
+ '<span class="icons icon-google-plus"></span>'+
90
+ '</button>'+
91
+ '</li>'+
92
+ '<li class="highlight-menu-button highlight-menu-twitter">'+
93
+ '<button class="btn-highlight-menu" data-action="twitter">'+
94
+ '<span class="icons icon-twitter"></span>'+
95
+ '</button>'+
96
+ '</li>'+
97
+ '</ul>'+
98
+ '</div>'+
99
+ '</div>';
100
+
101
+ $("body").append(highlightMenu);
102
+ $(document).bind("mouseup", Neilin.Selector.mouseup);
103
+ $(document).bind("mousedown", Neilin.Selector.mousedown);
104
+
105
+ $('.btn-highlight-menu').on("click", function(e){
106
+ action = $(this).data('action')
107
+ switch(action) {
108
+ case 'twitter':
109
+ win = window.open('https://twitter.com/intent/tweet?text=' + formatMessage(window.st) + window.location.href,'','width=200,height=100');
110
+ win.focus();
111
+ break;
112
+ case 'facebook':
113
+ win = window.open('https://www.facebook.com/sharer/sharer.php?u='+window.location.href,'','width=200,height=100');
114
+ win.elements['input'].value = 'hello';
115
+ break;
116
+ case 'google':
117
+ win = window.open('https://plus.google.com/share?url='+window.location.href,'','width=200,height=100');
118
+ break;
119
+ }
120
+ });
121
+ });
122
+
123
+
@@ -0,0 +1,116 @@
1
+
2
+ .highlight-menu {
3
+ position:absolute;
4
+ display:inline-block;
5
+ z-index:500;
6
+ -webkit-transition:none;
7
+ -moz-transition:none;
8
+ -ms-transition:none;
9
+ -o-transition:none;
10
+ transition:none
11
+ }
12
+ .highlight-menu-inner{
13
+ position:relative;
14
+ height:43px;
15
+ -webkit-border-radius:5px;
16
+ -moz-border-radius:5px;
17
+ border-radius:5px;
18
+ border:1px solid;border-color:#262625 #1c1c1b #121211;
19
+ box-shadow:0 1px 3px -1px rgba(0,0,0,0.7),inset 0 0 1px rgba(255,255,255,0.07),inset 0 0 2px rgba(255,255,255,0.15000000000000002);
20
+ background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(49,49,47,0.97)),to(#262625));
21
+ background-image:-moz-linear-gradient(top,rgba(49,49,47,0.97),#262625);
22
+ background-image:-webkit-linear-gradient(top,rgba(49,49,47,0.97),#262625);
23
+ background-image:-o-linear-gradient(top,rgba(49,49,47,0.97),#262625);
24
+ background-image:linear-gradient(to bottom,rgba(49,49,47,0.97),#262625);
25
+ background-repeat:repeat-x
26
+ }
27
+ .highlight-menu-buttons{
28
+ padding:0;white-space:nowrap;font-size:0
29
+ }
30
+ .highlight-menu-buttons .highlight-menu-button {
31
+ display: inline-block;
32
+ text-align: center;
33
+ vertical-align: middle;
34
+ }
35
+ .btn-highlight-menu{
36
+ display:block;
37
+ background:rgba(0,0,0,0);
38
+ border:0;
39
+ color:white;
40
+ padding:0 10px;
41
+ box-sizing:content-box
42
+ }
43
+ .highlight-menu-button:first-child .btn-highlight-menu {
44
+ paddine-left:18px
45
+ }
46
+ .highlight-menu-button:last-child .btn-highlight-menu {
47
+ padding-right:18px
48
+ }
49
+ .highlight-menu-button .icons:before {
50
+ color:#fff;
51
+ font-size:22px;
52
+ line-height:42px;
53
+ text-shadow:0 -1px 0 rgba(0,0,0,0.2)
54
+ }
55
+ .highlight-menu-button.active .icons:before{
56
+ color:#60d778
57
+ }
58
+
59
+ .btn-highlight-menu:hover {
60
+ cursor: pointer;
61
+ }
62
+
63
+ .highlight-menu-buttons .icons-link:before{
64
+ position:relative;
65
+ top:1px
66
+ }
67
+ .highlight-menu-notes .icons-notes{
68
+ position:relative
69
+ }
70
+ .highlight-menu-notes .icons-notes:before{
71
+ font-size:20px;
72
+ line-height:41px
73
+ }
74
+ .highlight-menu-notes .icons-notes:after{
75
+ color:#262625;
76
+ position:absolute;
77
+ left:0;
78
+ right:0;
79
+ line-height:39px;
80
+ text-align:center;
81
+ font-size:14px
82
+ }
83
+ .highlight-menu .highlight-menu-arrow-clip{position:absolute;bottom:-11px;left:50%;clip:rect(12px 24px 24px 0);margin-left:-12px}
84
+ .highlight-menu .highlight-menu-arrow-clip .highlight-menu-arrow{display:block;width:20px;height:20px;-webkit-transform:rotate(45deg) scale(0.5);-moz-transform:rotate(45deg) scale(0.5);-o-transform:rotate(45deg) scale(0.5);transform:rotate(45deg) scale(0.5);background-color:#454543;border:2px solid #121211}
85
+ .highlight-menu:after{content:'';display:block;position:absolute;bottom:-3px;left:50%;margin-left:-4px;width:8px;height:8px;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg);background:#262625;box-shadow:0 0 2px #262625}
86
+ .highlight-menu-blockquote{position:relative}
87
+ .highlight-menu-blockquote .icons-blockquote:before{width:10px;display:block;overflow:hidden;margin-right:10px}
88
+ .highlight-menu-blockquote .icons-blockquote:after{position:absolute;left:21px;top:7px;width:10px;overflow:hidden;font-size:22px}.bq-mode .icons-blockquote:before{color:#60d778}.pq-mode .icons-blockquote:before,.pq-mode .icons-blockquote:after{color:#60d778}
89
+ .highlight-menu-linkinput{display:none;position:absolute;top:0;left:0;right:0;bottom:0}
90
+ .highlight-menu-linkinput-field{background:rgba(0,0,0,0);position:absolute;top:0;right:40px;left:10px;padding:7px 0;-webkit-appearance:none;-moz-appearance:none;color:#fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;border:0;outline:0;font-family:"ff-tisa-web-pro",Georgia,Cambria,"Times New Roman",Times,serif;font-weight:400;font-size:16px;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}
91
+ .highlight-menu-linkinput .btn-highlight-menu{position:absolute;top:0;right:0;bottom:4px}
92
+ .highlight-menu-linkmode .highlight-menu-buttons{}
93
+ .highlight-menu-linkmode .highlight-menu-linkinput{display:block;-webkit-animation:pop-upwards 180ms forwards linear;-moz-animation:pop-upwards 180ms forwards linear;-ms-animation:pop-upwards 180ms forwards linear;-o-animation:pop-upwards 180ms forwards linear;animation:pop-upwards 180ms forwards linear}[contenteditable] a{cursor:text}
94
+ .highlight-menu-active{-webkit-transition:top .075s ease-out,left .075s ease-out;-moz-transition:top .075s ease-out,left .075s ease-out;-ms-transition:top .075s ease-out,left .075s ease-out;-o-transition:top .075s ease-out,left .075s ease-out;transition:top .075s ease-out,left .075s ease-out;-webkit-animation:pop-upwards 180ms forwards linear;-moz-animation:pop-upwards 180ms forwards linear;-ms-animation:pop-upwards 180ms forwards linear;-o-animation:pop-upwards 180ms forwards linear;animation:pop-upwards 180ms forwards linear}
95
+
96
+ .icons{width:20px;padding-right:4px;display:inline-block;text-align:center}
97
+ .icons{color:#b3b3b1;float:right;margin-top:2px;margin-right:10px}
98
+ .icons{margin:0}
99
+
100
+ .icons-twitter:before{content:"\e029"}
101
+ .icons-twitter:before{color:#fff;font-size:23px;line-height:0;position:relative;top:2px}
102
+ .icons-twitter:before{top:3px}
103
+ .icons-twitter:before,.btn:hover .icons-heart:before,.btn:hover .icons-solid-check:before,.btn:hover .icons-follow:before{color:#fff}
104
+ .icons-twitter:before{top:1px}
105
+
106
+ .icons-notes:before{content:"\e029"}
107
+ .icons-notes:before{color:#fff;font-size:23px;line-height:0;position:relative;top:2px}
108
+ .icons-notes:before{top:3px}
109
+ .icons-notes:before,.btn:hover .icons-heart:before,.btn:hover .icons-solid-check:before,.btn:hover .icons-follow:before{color:#fff}
110
+ .icons-notes:before{top:1px}
111
+
112
+ .popup {
113
+ display: none;
114
+ opacity: 0.9;
115
+ }
116
+
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: neilin-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Neil Marion dela Cruz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: twitter-bootstrap-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jquery-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: social share on text highlight
70
+ email:
71
+ - nmfdelacruz@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/neilin/rails.rb
82
+ - lib/neilin/rails/version.rb
83
+ - neilin-rails.gemspec
84
+ - vendor/assets/javascripts/neilin.js
85
+ - vendor/assets/stylesheets/neilin.css
86
+ homepage: ''
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.0.0.rc.2
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: social share on text highlight
110
+ test_files: []