public
Clone URL: git://github.com/robbyrussell/rubyurl.git
Search Repo:
Add auto-copy functionality
sprsquish (author)
Wed May 14 09:50:05 -0700 2008
commit  ce1de142547579bc87147a26f35253f5da379208
tree    3d7ef72b00970aa4396f87356c183a5c2166f7bc
parent  65af4e584b40dd9663fa3eebf1b7e79df01335a7
...
4
5
6
 
 
 
 
...
4
5
6
7
8
9
10
0
@@ -4,4 +4,8 @@
0
   
0
   <%= submit_tag 'Go!' -%>
0
 <% end %>
0
+<br />
0
+<label>
0
+ <%= check_box_tag :auto_copy, 1, cookies[:auto_copy] == '1' %> Automatically copy new RubyURL
0
+</label>
...
19
20
21
 
 
 
 
 
 
 
 
 
 
...
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -19,4 +19,14 @@
0
     $('x_copied').show();
0
     
0
 }
0
+
0
+Event.observe(window, 'load', function() {
0
+ // Watch for user's click on "Auto Copy" checkbox
0
+ if ($('auto_copy'))
0
+ Event.observe('auto_copy', 'change', function(event) { document.cookie = 'auto_copy='+($F('auto_copy') ? 1 : 0); });
0
+
0
+ // Perform auto-copy if prudent
0
+ if ((link = $$('#url.arrow a')).length && document.cookie.match(/auto_copy=1/))
0
+ copy(link[0].href);
0
+});

Comments

    No one has commented yet.