4chan-x/src/Miscellaneous/Dice.coffee
Zixaphir 9d95bbea35 Merge branch 'mayhem' into v3 -- Still broken, do not merge (yet)
Conflicts:
	CHANGELOG.md
	Gruntfile.coffee
	css/burichan.css
	css/futaba.css
	css/photon.css
	css/style.css
	css/tomorrow.css
	css/yotsuba-b.css
	css/yotsuba.css
	html/General/Index-navlinks.html
	html/General/Settings-section-Rice.html
	html/General/Settings.html
	html/Posting/QR.html
	json/archives.json
	package.json
	src/Filtering/PostHiding.coffee
	src/Filtering/Recursive.coffee
	src/Filtering/ThreadHiding.coffee
	src/General/Build.coffee
	src/General/Config.coffee
	src/General/Get.coffee
	src/General/Header.coffee
	src/General/Index.coffee
	src/General/Main.coffee
	src/General/Settings.coffee
	src/General/UI.coffee
	src/General/lib/$.coffee
	src/General/lib/databoard.class
	src/General/lib/post.class
	src/General/lib/thread.class
	src/Images/ImageExpand.coffee
	src/Images/RevealSpoilers.coffee
	src/Linkification/Linkify.coffee
	src/Menu/Menu.coffee
	src/Miscellaneous/ExpandThread.coffee
	src/Miscellaneous/IDColor.coffee
	src/Miscellaneous/Keybinds.coffee
	src/Monitoring/ThreadUpdater.coffee
	src/Monitoring/Unread.coffee
	src/Posting/QR.captcha.coffee
	src/Posting/QR.coffee
	src/Posting/QR.cooldown.coffee
	src/Quotelinks/QuoteBacklink.coffee
	src/Quotelinks/QuoteCT.coffee
	src/Quotelinks/QuoteOP.coffee
	src/Quotelinks/QuoteStrikeThrough.coffee
	src/Quotelinks/QuoteYou.coffee
	src/Quotelinks/Quotify.coffee
2014-02-23 14:04:45 -07:00

12 lines
429 B
CoffeeScript
Executable File

Dice =
init: ->
return if g.BOARD.ID isnt 'tg' or !Conf['Show Dice Roll']
Post.callbacks.push
name: 'Show Dice Roll'
cb: @node
node: ->
return if @isClone or not dicestats = @info.email?.match /dice[+\s](\d+)d(\d+)/
# Use the text node directly, as the <b> has two <br>.
roll = $('b', @nodes.comment).firstChild
roll.data = "Rolled #{dicestats[1]}d#{dicestats[2]}: #{roll.data.slice 7}"