diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 9eac1679d..ed5a9ef8d 100755 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -28,6 +28,7 @@ module.exports = (grunt) -> 'src/General/UI.coffee' 'src/General/Notice.coffee' 'src/General/CrossOrigin.coffee' + 'src/General/BuildTest.coffee' 'src/Filtering/**/*.coffee' 'src/Quotelinks/**/*.coffee' 'src/Posting/QR.coffee' diff --git a/src/General/BuildTest.coffee b/src/General/BuildTest.coffee new file mode 100644 index 000000000..cc350b511 --- /dev/null +++ b/src/General/BuildTest.coffee @@ -0,0 +1,25 @@ +BuildTest = + init: -> + return if !Conf['Menu'] + + a = $.el 'a', + textContent: 'Test HTML building' + + $.on a, 'click', @runTest + + $.event 'AddMenuEntry', + type: 'post' + el: a + open: (post) -> + a.dataset.fullID = post.fullID + + runTest: -> + post = g.posts[@dataset.fullID] + c.log post.originalHTML + $.cache "//a.4cdn.org/#{post.board.ID}/thread/#{post.thread.ID}.json", -> + for postData in @response.posts + if postData.no is post.ID + root = Build.postFromObject postData, post.board.ID + post2 = new Post root, post.thread, post.board + c.log post2.originalHTML + diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 596a9d497..684c5a24c 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -345,6 +345,7 @@ Main = ['Keybinds', Keybinds] ['Show Dice Roll', Dice] ['Banner', Banner] + ['Build Test', BuildTest] ] Main.init() diff --git a/src/General/lib/post.class b/src/General/lib/post.class index fa9f681d7..5c1dcea3f 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -3,6 +3,10 @@ class Post toString: -> @ID constructor: (root, @thread, @board, that={}) -> + root2 = root.cloneNode true + $.rm el for el in $$ '.mobile', root2 + @originalHTML = root2.outerHTML + @ID = +root.id[2..] @fullID = "#{@board}.#{@ID}"