reddit_bot 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -7
- data/examples/boilerplate.rb +2 -2
- data/examples/councilofricks/Gemfile +2 -2
- data/examples/councilofricks/Gemfile.lock +8 -7
- data/examples/councilofricks/main.rb +24 -13
- data/examples/cptflairbot3/.bashrc +1 -0
- data/examples/cptflairbot3/Code.gs +13 -0
- data/examples/cptflairbot3/Gemfile +2 -1
- data/examples/cptflairbot3/Gemfile.lock +64 -4
- data/examples/cptflairbot3/app.js +40 -0
- data/examples/cptflairbot3/casual/casualpokemontrades.htm +910 -0
- data/examples/cptflairbot3/casual/script.js +55 -0
- data/examples/cptflairbot3/casual/style.css +1099 -0
- data/examples/cptflairbot3/log.htm +1 -0
- data/examples/cptflairbot3/main.rb +31 -10
- data/examples/cptflairbot3/package.json +6 -0
- data/examples/cptflairbot3/pubsub.rb +30 -0
- data/examples/cptflairbot3/update_gas_hook_secret.rb +4 -0
- data/examples/devflairbot/Gemfile +1 -1
- data/examples/devflairbot/Gemfile.lock +3 -3
- data/examples/devflairbot/main.rb +1 -1
- data/examples/largeimages/Gemfile +5 -0
- data/examples/largeimages/Gemfile.lock +26 -0
- data/examples/largeimages/main.rb +183 -0
- data/examples/mlgtv/Gemfile +1 -1
- data/examples/mlgtv/Gemfile.lock +3 -3
- data/examples/mlgtv/channels.txt +110 -0
- data/examples/mlgtv/main.rb +67 -12
- data/examples/realtimeww2/Gemfile +4 -0
- data/examples/realtimeww2/Gemfile.lock +23 -0
- data/examples/realtimeww2/main.rb +82 -0
- data/examples/sexypizza/Gemfile +1 -1
- data/examples/sexypizza/Gemfile.lock +4 -4
- data/examples/wallpaper/Gemfile +1 -1
- data/examples/wallpaper/Gemfile.lock +3 -3
- data/examples/wallpaper/main.rb +1 -1
- data/examples/yayornay/Gemfile +1 -5
- data/examples/yayornay/Gemfile.lock +3 -3
- data/examples/yayornay/main.rb +1 -1
- data/lib/reddit_bot/version.rb +3 -0
- data/lib/reddit_bot.rb +3 -7
- data/reddit_bot.gemspec +1 -4
- 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
|
+
});
|