index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. $(function(){
  2. hljs.initHighlightingOnLoad();
  3. var EditormdView = editormd.markdownToHTML("page_md_content", {
  4. htmlDecode : "style,script,iframe", // you can filter tags decode
  5. emoji : true,
  6. taskList : true,
  7. tex : true, // 默认不解析
  8. flowChart : true, // 默认不解析
  9. sequenceDiagram : true, // 默认不解析
  10. });
  11. //为所有table标签添加bootstap支持的表格类
  12. $("table").addClass("table table-bordered table-hover");
  13. $.each($('table'), function() {
  14. $(this).prop('outerHTML', '<div style="width: 100%;overflow-x: auto;">'+$(this).prop('outerHTML')+'</div>');
  15. });
  16. //超链接都在新窗口打开
  17. $('a[href^="http"]').each(function() {
  18. $(this).attr('target', '_blank');
  19. });
  20. if (!isMobile()) {
  21. $("th").css("min-width","77px");
  22. };
  23. $("table thead tr").css({"background-color":"#08c","color":"#fff"});
  24. $("table tr").each(function(){
  25. if($(this).find("td").eq(1).html()=="object" || $(this).find("td").eq(1).html()=="array[object]")
  26. {
  27. $(this).css({"background-color":"#99CC99","color":"#000"});
  28. }
  29. });
  30. })