myscripts.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. $(function() {
  2. var thisview;
  3. $("a[rel=myconfig]").live("click", function() {
  4. thisview = $(this).parents(".box-element").find(".view").children();
  5. var conf = $(this).next().children();
  6. var id=Math.random();
  7. $(this).parents(".box-element").attr("sid",id);
  8. //myconsole.log(conf.html());
  9. $("#myconfigModal .modal-body").empty();
  10. $("#myconfigModal .modal-body").append(conf.clone());
  11. $("#myconfigModal").attr("sid",id);
  12. $("#myconfigModal").modal();
  13. $(".modal-body .colorpicker").colorpicker();
  14. });
  15. //修改背景色
  16. $("button[rel=myconfig1]").live("click", function() {
  17. thisview = $(".container");
  18. var conf = $(this).next().children();
  19. var id=Math.random();
  20. //$(this).parents(".container").attr("sid",id);
  21. //myconsole.log(conf.html());
  22. $("#myconfigModal .modal-body").empty();
  23. $("#myconfigModal .modal-body").append(conf.clone());
  24. $("#myconfigModal").attr("sid",id);
  25. $("#myconfigModal").modal();
  26. $(".modal-body .colorpicker").colorpicker();
  27. });
  28. $(".prop").live("change", function() {
  29. var tag=$(this).get(0).tagName;
  30. if(tag=="SELECT"){
  31. var r = "";
  32. $(this).find("option").each(function() {
  33. r += $(this).val() + " "
  34. });
  35. thisview.removeClass(r);
  36. thisview.addClass($(this).val());
  37. }else if(tag=="INPUT"){
  38. var val=$(this).val();
  39. var ref=$(this).attr("ref");
  40. thisview.css(ref,val+"px");
  41. }
  42. });
  43. $(".bindColumn").live("change", function() {
  44. var _conf=$(this);
  45. var columnID=$(this).val();
  46. var sid=_conf.closest("#myconfigModal").attr("sid");
  47. var _thisWidget=$(this).closest("body").find("[sid='"+sid+"']");
  48. _thisWidget.find(".getTitlePic").attr("th\:each","info:\${\#fsmtag.getTitlePic('"+columnID+"',7)}");
  49. _thisWidget.find(".getColumnByID").attr("th\:with","column=\$\{\#fsmtag.getColumnByID('"+columnID+"')}");
  50. });
  51. })