easymarklet 0.0.6 → 0.0.7
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.
- data/app/assets/javascripts/easymarklet/consumer.js.erb +3 -0
- data/app/assets/javascripts/easymarklet/dlux.js.erb +21 -0
- data/app/assets/javascripts/easymarklet/producer.js.erb +5 -0
- data/lib/easymarklet/version.rb +1 -1
- data/lib/generators/easymarklet/dlux/USAGE +15 -0
- data/lib/generators/easymarklet/dlux/dlux_generator.rb +29 -0
- data/lib/generators/easymarklet/dlux/templates/dlux_bookmarklet.js +24 -0
- data/lib/generators/easymarklet/dlux/templates/dlux_consumer.js +5 -0
- data/lib/generators/easymarklet/dlux/templates/dlux_producer.js +6 -0
- data/lib/generators/easymarklet/dlux/templates/dlux_producer_controller.rb +12 -0
- data/lib/generators/easymarklet/dlux/templates/dlux_producer_index.html.erb +3 -0
- data/lib/generators/easymarklet/dlux/templates/views/easymarklet_buffer_frame.html.erb +17 -0
- data/lib/generators/easymarklet/dlux/templates/views/easymarklet_layout.html.erb +14 -0
- metadata +14 -4
@@ -41,6 +41,9 @@
|
|
41
41
|
//dest += encodeURIComponent("/bookmarklet/court_cases/check?court_case[url]=" + caseUrl);
|
42
42
|
|
43
43
|
var dest = full_host + bookmarklet.producer.path
|
44
|
+
if(bookmarklet.producer.buffer){
|
45
|
+
dest = full_host + bookmarklet.producer.buffer + "?producer=" + encodeURIComponent(bookmarklet.producer.path);
|
46
|
+
}
|
44
47
|
|
45
48
|
// here we put the main code, in this case we expose an ajax endpoint
|
46
49
|
_this.producer = new easyXDM.Rpc({
|
@@ -0,0 +1,21 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
var Easymarklet = window.Easymarklet || {}
|
4
|
+
Easymarklet.Dlux = Easymarklet.Dlux || {}
|
5
|
+
|
6
|
+
Easymarklet.Dlux.setupInterval = function(){
|
7
|
+
if(parent.Easymarklet && parent.Easymarklet.ProducerUtil){
|
8
|
+
var oldHeight = 0;
|
9
|
+
setInterval(function(){
|
10
|
+
var currentHeight = $('body').outerHeight(true); //document.body.scrollHeight;
|
11
|
+
if(currentHeight != oldHeight){
|
12
|
+
parent.Easymarklet.ProducerUtil.resizeFrame(currentHeight);
|
13
|
+
oldHeight = currentHeight;
|
14
|
+
}
|
15
|
+
},200);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
setTimeout(Easymarklet.Dlux.setupInterval,200);
|
20
|
+
|
21
|
+
})();
|
@@ -1,6 +1,11 @@
|
|
1
1
|
(function(){
|
2
2
|
|
3
3
|
var Easymarklet = window.Easymarklet || {}
|
4
|
+
Easymarklet.ProducerUtil = Easymarklet.ProducerUtil || {}
|
5
|
+
|
6
|
+
Easymarklet.ProducerUtil.resizeFrame = function(height){
|
7
|
+
$('iframe').css({ height : height + "px" });
|
8
|
+
}
|
4
9
|
|
5
10
|
Easymarklet.Producer = function(bookmarklet){
|
6
11
|
if(bookmarklet == null){ alert('You must pass a bookmarklet to Easymarklet.Producer.'); return;}
|
data/lib/easymarklet/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
Description:
|
2
|
+
Generate a new xdm bookmarklet.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate easymarklet:xdm foobaz
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
app/assets/javascripts/foobaz_bookmarklet.js
|
9
|
+
app/assets/javascripts/foobaz_consumer.js
|
10
|
+
app/assets/javascripts/foobaz_producer.js
|
11
|
+
|
12
|
+
|
13
|
+
Then you could link to it with:
|
14
|
+
<%= link_to "FooBaz XDM", easymarklet_js('foobaz_consumer.js') %>
|
15
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Easymarklet
|
2
|
+
class DluxGenerator < Rails::Generators::NamedBase
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def copy_files
|
6
|
+
template "dlux_bookmarklet.js", "app/assets/javascripts/#{file_name}_bookmarklet.js"
|
7
|
+
template "dlux_consumer.js", "app/assets/javascripts/#{file_name}_consumer.js"
|
8
|
+
template "dlux_producer.js", "app/assets/javascripts/#{file_name}_producer.js"
|
9
|
+
template "dlux_producer_controller.rb", "app/controllers/#{file_name}_producer_controller.rb"
|
10
|
+
template "dlux_producer_index.html.erb", "app/views/#{file_name}_producer/index.html.erb"
|
11
|
+
template "views/easymarklet_layout.html.erb", "app/views/layouts/#{file_name}_producer.html.erb"
|
12
|
+
template "views/easymarklet_buffer_frame.html.erb", "app/views/layouts/#{file_name}_producer_buffer.html.erb"
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_routes
|
16
|
+
route("match '#{file_name}_producer' => '#{file_name}_producer#index'")
|
17
|
+
route("match '#{file_name}_producer/buffer' => '#{file_name}_producer#buffer'")
|
18
|
+
end
|
19
|
+
|
20
|
+
def display_msg
|
21
|
+
puts ""
|
22
|
+
puts "You can link to your new bookmarklet with this :"
|
23
|
+
puts ""
|
24
|
+
puts "<%= link_to '#{file_name.titleize}', easymarklet_js('#{file_name}_consumer.js') %>"
|
25
|
+
puts ""
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
var <%= name.camelize %>Bookmarklet = {
|
4
|
+
|
5
|
+
visible : true,
|
6
|
+
consumer : {
|
7
|
+
css : [], // could be an array or a string
|
8
|
+
methods : { // The methods that the producer can call
|
9
|
+
|
10
|
+
}
|
11
|
+
},
|
12
|
+
producer : {
|
13
|
+
buffer : "/<%= name %>_producer/buffer",
|
14
|
+
path : "/<%= name %>_producer", // The path on your app that provides your data service
|
15
|
+
methods : { // The methods that the consumer can call
|
16
|
+
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
window.<%= name.camelize %>Bookmarklet = <%= name.camelize %>Bookmarklet;
|
22
|
+
|
23
|
+
})();
|
24
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= name.titleize %> Producer</title>
|
5
|
+
<%%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
+
<%%= javascript_include_tag "application" %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<iframe src="<%%= params[:producer] %>?url=<%%= params[:xdm_e] %>" frameborder="0"></iframe>
|
12
|
+
|
13
|
+
|
14
|
+
<%%= javascript_include_tag "<%= name %>_producer" %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= name.titleize %> Producer</title>
|
5
|
+
<%%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
+
<%%= javascript_include_tag "application" %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easymarklet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -163,6 +163,7 @@ extensions: []
|
|
163
163
|
extra_rdoc_files: []
|
164
164
|
files:
|
165
165
|
- app/assets/javascripts/easymarklet/consumer.js.erb
|
166
|
+
- app/assets/javascripts/easymarklet/dlux.js.erb
|
166
167
|
- app/assets/javascripts/easymarklet/producer.js.erb
|
167
168
|
- app/assets/javascripts/easymarklet/simple.js.erb
|
168
169
|
- app/helpers/easymarklet/link_helper.rb
|
@@ -174,6 +175,15 @@ files:
|
|
174
175
|
- lib/generators/easymarklet/bare/bare_generator.rb
|
175
176
|
- lib/generators/easymarklet/bare/templates/bare_bookmarklet.js
|
176
177
|
- lib/generators/easymarklet/bare/USAGE
|
178
|
+
- lib/generators/easymarklet/dlux/dlux_generator.rb
|
179
|
+
- lib/generators/easymarklet/dlux/templates/dlux_bookmarklet.js
|
180
|
+
- lib/generators/easymarklet/dlux/templates/dlux_consumer.js
|
181
|
+
- lib/generators/easymarklet/dlux/templates/dlux_producer.js
|
182
|
+
- lib/generators/easymarklet/dlux/templates/dlux_producer_controller.rb
|
183
|
+
- lib/generators/easymarklet/dlux/templates/dlux_producer_index.html.erb
|
184
|
+
- lib/generators/easymarklet/dlux/templates/views/easymarklet_buffer_frame.html.erb
|
185
|
+
- lib/generators/easymarklet/dlux/templates/views/easymarklet_layout.html.erb
|
186
|
+
- lib/generators/easymarklet/dlux/USAGE
|
177
187
|
- lib/generators/easymarklet/iframe/iframe_generator.rb
|
178
188
|
- lib/generators/easymarklet/iframe/templates/iframe_bookmarklet.js
|
179
189
|
- lib/generators/easymarklet/iframe/templates/iframe_consumer.js
|
@@ -212,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
222
|
version: '0'
|
213
223
|
segments:
|
214
224
|
- 0
|
215
|
-
hash:
|
225
|
+
hash: 1153713136749520288
|
216
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
227
|
none: false
|
218
228
|
requirements:
|
@@ -221,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
231
|
version: '0'
|
222
232
|
segments:
|
223
233
|
- 0
|
224
|
-
hash:
|
234
|
+
hash: 1153713136749520288
|
225
235
|
requirements: []
|
226
236
|
rubyforge_project:
|
227
237
|
rubygems_version: 1.8.24
|