add test of HTML building
This commit is contained in:
parent
00c5b55704
commit
65048751ad
@ -28,6 +28,7 @@ module.exports = (grunt) ->
|
|||||||
'src/General/UI.coffee'
|
'src/General/UI.coffee'
|
||||||
'src/General/Notice.coffee'
|
'src/General/Notice.coffee'
|
||||||
'src/General/CrossOrigin.coffee'
|
'src/General/CrossOrigin.coffee'
|
||||||
|
'src/General/BuildTest.coffee'
|
||||||
'src/Filtering/**/*.coffee'
|
'src/Filtering/**/*.coffee'
|
||||||
'src/Quotelinks/**/*.coffee'
|
'src/Quotelinks/**/*.coffee'
|
||||||
'src/Posting/QR.coffee'
|
'src/Posting/QR.coffee'
|
||||||
|
|||||||
25
src/General/BuildTest.coffee
Normal file
25
src/General/BuildTest.coffee
Normal file
@ -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
|
||||||
|
|
||||||
@ -345,6 +345,7 @@ Main =
|
|||||||
['Keybinds', Keybinds]
|
['Keybinds', Keybinds]
|
||||||
['Show Dice Roll', Dice]
|
['Show Dice Roll', Dice]
|
||||||
['Banner', Banner]
|
['Banner', Banner]
|
||||||
|
['Build Test', BuildTest]
|
||||||
]
|
]
|
||||||
|
|
||||||
Main.init()
|
Main.init()
|
||||||
|
|||||||
@ -3,6 +3,10 @@ class Post
|
|||||||
toString: -> @ID
|
toString: -> @ID
|
||||||
|
|
||||||
constructor: (root, @thread, @board, that={}) ->
|
constructor: (root, @thread, @board, that={}) ->
|
||||||
|
root2 = root.cloneNode true
|
||||||
|
$.rm el for el in $$ '.mobile', root2
|
||||||
|
@originalHTML = root2.outerHTML
|
||||||
|
|
||||||
@ID = +root.id[2..]
|
@ID = +root.id[2..]
|
||||||
@fullID = "#{@board}.#{@ID}"
|
@fullID = "#{@board}.#{@ID}"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user