XML文件预览支持切换纯文本模式
This commit is contained in:
parent
4747ee93b2
commit
12c85c60c7
|
@ -13,7 +13,14 @@
|
|||
<input hidden id="textData" value="${textData}"/>
|
||||
<div class="container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div id="xml_btn" class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
||||
${file.name}
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="text_btn" class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
|
||||
${file.name}
|
||||
|
@ -31,6 +38,7 @@
|
|||
* 初始化
|
||||
*/
|
||||
window.onload = function () {
|
||||
$("#xml_btn").hide()
|
||||
initWaterMark();
|
||||
loadXmlData()
|
||||
}
|
||||
|
@ -40,11 +48,25 @@
|
|||
*/
|
||||
function loadXmlData() {
|
||||
var textData = Base64.decode($("#textData").val())
|
||||
window.textPreData = "<xmp style='background-color: #FFFFFF;overflow-y: scroll;border:none'>" + textData + "</xmp>";
|
||||
var xmlNode = xmlTreeViewer.parseXML(textData);
|
||||
var retNode = xmlTreeViewer.getXMLViewerNode(xmlNode.xml);
|
||||
$("#xml").html(retNode);
|
||||
window.retNode = xmlTreeViewer.getXMLViewerNode(xmlNode.xml);
|
||||
$("#xml").html(window.retNode);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$("#xml_btn").click(function () {
|
||||
$("#xml").html(window.retNode);
|
||||
$("#text_btn").show()
|
||||
$("#xml_btn").hide()
|
||||
});
|
||||
|
||||
$("#text_btn").click(function () {
|
||||
$("#xml_btn").show()
|
||||
$("#text_btn").hide();
|
||||
$("#xml").html(window.textPreData);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in New Issue