国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
4.8KB

  1. $(function(){
  2. //文本框Style
  3. $(".txt").mouseover(function(){
  4. $(this).addClass("txt_o");
  5. }).mouseout(function(){
  6. $(this).removeClass("txt_o");
  7. }).focus(function(){
  8. $(this).addClass("txt_s");
  9. }).blur(function(){
  10. $(this).removeClass("txt_s");
  11. });
  12. //表格折叠
  13. $(".tform").find("tbody tr th[_show]").each(function(i){
  14. //加入折叠提示
  15. if($(this).attr("_show")=="no"){
  16. $(this).append(" <button type=\"button\" class=\"tbody_up\"></button>");
  17. }else{
  18. $(this).append(" <button type=\"button\" class=\"tbody_down\"></button>");
  19. }
  20. //折叠动作
  21. $(this).click(function(){
  22. if($(this).find("button[class^='tbody_']").attr("class")=="tbody_up"){
  23. $(this).find("button[class^='tbody_']").attr("class","tbody_down");
  24. $(this).parent("tr").parent("tbody").find("tr").not($(this).parent("tr")).hide();
  25. }else if($(this).find("button[class^='tbody_']").attr("class")=="tbody_down"){
  26. $(this).find("button[class^='tbody_']").attr("class","tbody_up");
  27. $(this).parent("tr").parent("tbody").find("tr").not($(this).parent("tr")).show();
  28. }
  29. }).mouseover(function(){
  30. $(this).addClass("mouseon");
  31. }).mouseout(function(){
  32. $(this).removeClass("mouseon");
  33. }).click();
  34. });
  35. //列表行高亮
  36. $("table[_dlist*='light']").children("tbody").children("tr").mouseover(function(){
  37. if($(this).attr("_nolight")!="yes")$(this).addClass("t_on");
  38. }).mouseout(function(){
  39. $(this).removeClass("t_on");
  40. });
  41. //列表行整行选择
  42. $("table[_dlist*='check']").each(function(){
  43. //处理行点击
  44. $(this).find("tbody tr").click(function(){
  45. checkbox = $(this).find("td input[type='checkbox']");
  46. tr = $(this);
  47. if(checkbox.attr("checked")===false){
  48. checkbox.attr("checked","checked");
  49. tr.addClass("t_sl");
  50. }else{
  51. checkbox.removeAttr("checked");
  52. tr.removeClass("t_sl");
  53. }
  54. });
  55. //处理checkbox点击
  56. $(this).find("td input[type='checkbox']").click(function(){
  57. tr = $(this).parent("td").parent("tr");
  58. if($(this).attr("checked")===false){
  59. $(this).attr("checked","checked");
  60. tr.removeClass("t_sl");
  61. }else{
  62. $(this).removeAttr("checked");
  63. tr.addClass("t_sl");
  64. }
  65. });
  66. //排除链接及按钮点击
  67. $(this).find("tbody tr td a,tbody tr td button,tbody tr td table").click(function(){
  68. tr = $(this).parent("td").parent("tr");
  69. checkbox = tr.find("td input[type='checkbox']");
  70. if(checkbox.attr("checked")===false){
  71. checkbox.attr("checked","checked");
  72. tr.removeClass("t_sl");
  73. }else{
  74. checkbox.removeAttr("checked");
  75. tr.addClass("t_sl");
  76. }
  77. });
  78. });
  79. //高亮初始化
  80. setChecklight();
  81. //全选按钮
  82. $("button[_click='allSelect']").click(function(){
  83. ckbox = $(this).parent("td").parent("tr").parent("tbody").find("td input[type='checkbox']");
  84. ckbox.attr("checked","checked");
  85. setChecklight();
  86. });
  87. //反选按钮
  88. $("button[_click='unSelect']").click(function(){
  89. ckbox = $(this).parent("td").parent("tr").parent("tbody").find("td input[type='checkbox']");
  90. ckbox.each(function(){
  91. $(this).attr("checked") === false ? $(this).attr("checked","checked") : $(this).removeAttr("checked");
  92. });
  93. setChecklight();
  94. });
  95. //自定义提交
  96. $("button[_submit]").click(function(){
  97. url = $(this).attr("_submit");
  98. if(/\[new\].*/.test(url)){
  99. url = url.replace(/\[new\]/,"");
  100. }else{
  101. url = $(this).parents("form").attr("action")+url;
  102. }
  103. $(this).parents("form").attr("action",url).submit();
  104. });
  105. });
  106. /*高亮初始化*/
  107. function setChecklight(){
  108. $(".tlist[_dlist*='check']").find("tbody tr td input[type='checkbox']").each(function(i){
  109. tr = $(this).parent("td").parent("tr");
  110. if($(this).attr("checked")){
  111. tr.addClass("t_sl");
  112. }else{
  113. tr.removeClass("t_sl");
  114. }
  115. });
  116. }
  117. /*栏目跳转*/
  118. function AC(mid){
  119. f = $(window.parent.document);
  120. mlink = f.find("a[id='"+mid+"']");
  121. if(mlink.size()>0){
  122. box = mlink.parents("div[id^='menu_']");
  123. boxid = box.attr("id").substring(5,128);
  124. if($("body").attr("class")!="showmenu")$("#togglemenu").click();
  125. if(mlink.attr("_url")){
  126. $("#menu").find("div[id^=menu]").hide();
  127. box.show();
  128. mlink.addClass("thisclass").blur().parents("#menu").find("ul li a").not(mlink).removeClass("thisclass");
  129. if($("#mod_"+boxid).attr("class")==""){
  130. $("#nav").find("a").removeClass("thisclass");
  131. $("#nav").find("a[id='mod_"+boxid+"']").addClass("thisclass").blur();
  132. }
  133. window.location.href = mlink.attr("_url");
  134. }else if(mlink.attr("_open") && mlink.attr("_open")!=undefined){
  135. window.open(mlink.attr("_open"));
  136. }
  137. }
  138. }