F5 Test changes

This commit is contained in:
2015-10-05 18:05:57 +02:00
parent 2bb597419d
commit c93d6bec8a
16 changed files with 132 additions and 47 deletions
@@ -0,0 +1,33 @@
window.formatXml = (xml) ->
formatted = ''
reg = /(>)(<)(\/*)/g
xml = xml.replace(reg, '$1\r\n$2$3')
pad = 0
jQuery.each xml.split('\r\n'), (index, node) ->
indent = 0
if node.match(/.+<\/\w[^>]*>$/)
indent = 0
else if node.match(/^<\/\w/)
if pad != 0
pad -= 1
else if node.match(/^<\w[^>]*[^\/]>.*$/)
indent = 1
else
indent = 0
padding = ''
i = 0
while i < pad
padding += ' '
i++
formatted += padding + node + '\r\n'
pad += indent
return
formatted
window.squashXml = (xml)->
result = xml
.trim()
.replace(/^\s+/g, '')
.replace(/\s+$/g, '')
.replace(/>(?:\r\n|\r|\n)/g, '')
.replace(/(?:\r\n|\r|\n)/g, ' ')
result