index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. $(this).click(function(){
  20. var target_url = $(this).attr("href") ;
  21. if (target_url.indexOf(window.top.location.host + window.top.location.pathname) > -1 ){
  22. window.top.location.href = target_url;
  23. return false;
  24. }
  25. });
  26. });
  27. if (!isMobile()) {
  28. $("th").css("min-width","77px");
  29. };
  30. $("table thead tr").css({"background-color":"#08c","color":"#fff"});
  31. $("table tr").each(function(){
  32. if($(this).find("td").eq(1).html()=="object" || $(this).find("td").eq(1).html()=="array[object]")
  33. {
  34. $(this).css({"background-color":"#99CC99","color":"#000"});
  35. }
  36. });
  37. })