From bcbae6c84f7131e42bdcc6109621159254292d7a Mon Sep 17 00:00:00 2001 From: carboncopy Date: Fri, 19 Jul 2013 23:18:11 -0500 Subject: [PATCH 1/2] display rolled dice while on /tg/ --- src/General/Config.coffee | 1 + src/General/Main.coffee | 1 + src/Miscellaneous/Dice.coffee | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 src/Miscellaneous/Dice.coffee diff --git a/src/General/Config.coffee b/src/General/Config.coffee index f7a1e24e4..2badf110b 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -13,6 +13,7 @@ Config = 'Index Navigation': [false, 'Add buttons to navigate between threads.'] 'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'] 'Check for Updates': [true, 'Notify when updated versions of <%= meta.name %> are available.'] + 'Show Dice Rolled': [true, 'Show dice that were entered into the email field.'] 'Filtering': 'Anonymize': [false, 'Make everyone Anonymous.'] 'Filter': [true, 'Self-moderation placebo.'] diff --git a/src/General/Main.coffee b/src/General/Main.coffee index a1dd45ae4..044796280 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -114,6 +114,7 @@ Main = initFeature 'Thread Watcher', ThreadWatcher initFeature 'Index Navigation', Nav initFeature 'Keybinds', Keybinds + initFeature 'Dice Checker', Dice # c.timeEnd 'All initializations' $.on d, 'AddCallback', Main.addCallback diff --git a/src/Miscellaneous/Dice.coffee b/src/Miscellaneous/Dice.coffee new file mode 100644 index 000000000..1614a6ca9 --- /dev/null +++ b/src/Miscellaneous/Dice.coffee @@ -0,0 +1,20 @@ +Dice = + init: -> + return if g.VIEW is 'catalog' or !Conf['Show Dice Rolled'] + # or !Conf['Show dice being rolled'] + return if g.BOARD.ID isnt 'tg' + Post::callbacks.push + name: 'Dice roller' + cb: @node + node: -> + return if @isClone + email = @info.email + dicestats = /dice\W(\d+)d(\d+)/.exec(email) + return if not dicestats + roll = ($$("b",@nodes.comment).filter (elem)->elem.innerHTML.lastIndexOf("Rolled", 0) == 0)[0] + return if not roll + rollResults = roll.innerHTML.slice 7 + dicestr = dicestats[1]+"d"+dicestats[2] + roll.innerHTML = "Rolled " + dicestr + " and got " + rollResults + + From 5eabd9ce0d5f44a3ff6bba4778931a921c0fe8f2 Mon Sep 17 00:00:00 2001 From: carboncopy Date: Wed, 7 Aug 2013 15:55:57 -0500 Subject: [PATCH 2/2] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 793177903..04a47aa59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Added dice monitoring on /tg/ - Fix impossibility to create new threads when in dead threads. ### 3.5.7 - *2013-07-13*