reddit_bot 1.3.0 → 1.3.1

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -7
  3. data/examples/boilerplate.rb +2 -2
  4. data/examples/councilofricks/Gemfile +2 -2
  5. data/examples/councilofricks/Gemfile.lock +8 -7
  6. data/examples/councilofricks/main.rb +24 -13
  7. data/examples/cptflairbot3/.bashrc +1 -0
  8. data/examples/cptflairbot3/Code.gs +13 -0
  9. data/examples/cptflairbot3/Gemfile +2 -1
  10. data/examples/cptflairbot3/Gemfile.lock +64 -4
  11. data/examples/cptflairbot3/app.js +40 -0
  12. data/examples/cptflairbot3/casual/casualpokemontrades.htm +910 -0
  13. data/examples/cptflairbot3/casual/script.js +55 -0
  14. data/examples/cptflairbot3/casual/style.css +1099 -0
  15. data/examples/cptflairbot3/log.htm +1 -0
  16. data/examples/cptflairbot3/main.rb +31 -10
  17. data/examples/cptflairbot3/package.json +6 -0
  18. data/examples/cptflairbot3/pubsub.rb +30 -0
  19. data/examples/cptflairbot3/update_gas_hook_secret.rb +4 -0
  20. data/examples/devflairbot/Gemfile +1 -1
  21. data/examples/devflairbot/Gemfile.lock +3 -3
  22. data/examples/devflairbot/main.rb +1 -1
  23. data/examples/largeimages/Gemfile +5 -0
  24. data/examples/largeimages/Gemfile.lock +26 -0
  25. data/examples/largeimages/main.rb +183 -0
  26. data/examples/mlgtv/Gemfile +1 -1
  27. data/examples/mlgtv/Gemfile.lock +3 -3
  28. data/examples/mlgtv/channels.txt +110 -0
  29. data/examples/mlgtv/main.rb +67 -12
  30. data/examples/realtimeww2/Gemfile +4 -0
  31. data/examples/realtimeww2/Gemfile.lock +23 -0
  32. data/examples/realtimeww2/main.rb +82 -0
  33. data/examples/sexypizza/Gemfile +1 -1
  34. data/examples/sexypizza/Gemfile.lock +4 -4
  35. data/examples/wallpaper/Gemfile +1 -1
  36. data/examples/wallpaper/Gemfile.lock +3 -3
  37. data/examples/wallpaper/main.rb +1 -1
  38. data/examples/yayornay/Gemfile +1 -5
  39. data/examples/yayornay/Gemfile.lock +3 -3
  40. data/examples/yayornay/main.rb +1 -1
  41. data/lib/reddit_bot/version.rb +3 -0
  42. data/lib/reddit_bot.rb +3 -7
  43. data/reddit_bot.gemspec +1 -4
  44. metadata +20 -2
@@ -0,0 +1,55 @@
1
+ function enableSubmitButton() {
2
+ var fc = $("#fc").val();
3
+ if ($("#ign").val().length > 0 && $("#pkmn")[0].selectedIndex > 0 && /^\d{4}-\d{4}-\d{4}$/.test(fc)) {
4
+ $("[type=submit]").removeAttr("disabled").removeAttr("title");
5
+ } else {
6
+ disableSubmitButton();
7
+ }
8
+ }
9
+
10
+ function disableSubmitButton() {
11
+ $("[type=submit]").attr("disabled", "disabled").attr("title", "Please fill all the fields and enter a valid Friend Code.");
12
+ }
13
+
14
+ $(document).ready(function() {
15
+ enableSubmitButton();
16
+
17
+ $("[type=submit]").click(function(e) {
18
+ e.preventDefault();
19
+ var message = encodeURIComponent($("#ign").val()) + encodeURI('\n' + $("#fc").val() + '\n' + $('select').val() + '\n\nDO NOT EDIT THIS MESSAGE OR ITS SUBJECT -- JUST CLICK SEND!');
20
+ window.location = 'http://www.reddit.com/message/compose/?to=CPTFlairBot3&subject=casualpokemontrades&message=' + message;
21
+ });
22
+
23
+ var propertyChangeUnbound = false;
24
+ $("input[id]").on("propertychange", function(e) {
25
+ if (e.originalEvent.propertyName == "value") {
26
+ enableSubmitButton();
27
+ }
28
+ });
29
+
30
+ $("input[id]").on("input", function() {
31
+ if (!propertyChangeUnbound) {
32
+ $("input").unbind("propertychange");
33
+ propertyChangeUnbound = true;
34
+ }
35
+ enableSubmitButton();
36
+ });
37
+
38
+ $('select').change(function () {
39
+ enableSubmitButton();
40
+ $('.flair').removeAttr('class').addClass('flair flair-' + $(this).val());
41
+ });
42
+
43
+ $('#ign').keyup(function() {
44
+ $('.ign').text($(this).val());
45
+ });
46
+
47
+ $('#fc').keyup(function() {
48
+ var foo = $(this).val().split("-").join(""); // remove hyphens
49
+ if (foo.length > 0) {
50
+ foo = foo.match(new RegExp('.{1,4}', 'g')).join("-");
51
+ }
52
+ $(this).val(foo);
53
+ $('.fc').text(foo);
54
+ });
55
+ });