custom.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. jQuery.noConflict();
  2. window.onscroll = function()
  3. {
  4. if( window.XMLHttpRequest ) {
  5. if (document.documentElement.scrollTop > 0 || self.pageYOffset > 0) {
  6. jQuery('#primary_left').css('position','fixed');
  7. jQuery('#primary_left').css('top','0');
  8. } else if (document.documentElement.scrollTop < 0 || self.pageYOffset < 0) {
  9. jQuery('#primary_left').css('position','absolute');
  10. jQuery('#primary_left').css('top','175px');
  11. }
  12. }
  13. }
  14. function initMenu() {
  15. jQuery('#menu ul ul').hide();
  16. jQuery('#menu ul li').click(function() {
  17. jQuery(this).parent().find("ul").slideUp('fast');
  18. jQuery(this).parent().find("li").removeClass("current");
  19. jQuery(this).find("ul").slideToggle('fast');
  20. jQuery(this).toggleClass("current");
  21. });
  22. }
  23. jQuery(document).ready(function() {
  24. Cufon.replace('h1, h2, h5, .notification strong', { hover: 'true' }); // Cufon font replacement
  25. initMenu(); // Initialize the menu!
  26. jQuery(".tablesorter").tablesorter(); // Tablesorter plugin
  27. jQuery('#dialog').dialog({
  28. autoOpen: false,
  29. width: 650,
  30. buttons: {
  31. "Done": function() {
  32. jQuery(this).dialog("close");
  33. },
  34. "Cancel": function() {
  35. jQuery(this).dialog("close");
  36. }
  37. }
  38. }); // Default dialog. Each should have it's own instance.
  39. jQuery('.dialog_link').click(function(){
  40. jQuery('#dialog').dialog('open');
  41. return false;
  42. }); // Toggle dialog
  43. jQuery('.notification').hover(function() {
  44. jQuery(this).css('cursor','pointer');
  45. }, function() {
  46. jQuery(this).css('cursor','auto');
  47. }); // Close notifications
  48. jQuery('.checkall').click(
  49. function(){
  50. jQuery(this).parent().parent().parent().parent().find("input[type='checkbox']").attr('checked', jQuery(this).is(':checked'));
  51. }
  52. ); // Top checkbox in a table will select all other checkboxes in a specified column
  53. jQuery('.iphone').iphoneStyle(); //iPhone like checkboxes
  54. jQuery('.notification span').click(function() {
  55. jQuery(this).parents('.notification').fadeOut(800);
  56. }); // Close notifications on clicking the X button
  57. jQuery(".tooltip").easyTooltip({
  58. xOffset: -60,
  59. yOffset: 70
  60. }); // Tooltips!
  61. jQuery('#menu li:not(".current"), #menu ul ul li a').hover(function() {
  62. jQuery(this).find('span').animate({ marginLeft: '5px' }, 100);
  63. }, function() {
  64. jQuery(this).find('span').animate({ marginLeft: '0px' }, 100);
  65. }); // Menu simple animation
  66. jQuery('.fade_hover').hover(
  67. function() {
  68. jQuery(this).stop().animate({opacity:0.6},200);
  69. },
  70. function() {
  71. jQuery(this).stop().animate({opacity:1},200);
  72. }
  73. ); // The fade function
  74. //sortable, portlets
  75. jQuery(".column").sortable({
  76. connectWith: '.column',
  77. placeholder: 'ui-sortable-placeholder',
  78. forcePlaceholderSize: true,
  79. scroll: false,
  80. helper: 'clone'
  81. });
  82. jQuery(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all").find(".portlet-header").addClass("ui-widget-header ui-corner-all").prepend('<span class="ui-icon ui-icon-circle-arrow-s"></span>').end().find(".portlet-content");
  83. jQuery(".portlet-header .ui-icon").click(function() {
  84. jQuery(this).toggleClass("ui-icon-minusthick");
  85. jQuery(this).parents(".portlet:first").find(".portlet-content").toggle();
  86. });
  87. jQuery(".column").disableSelection();
  88. jQuery("table.stats").each(function() {
  89. if(jQuery(this).attr('rel')) { var statsType = jQuery(this).attr('rel'); }
  90. else { var statsType = 'area'; }
  91. var chart_width = (jQuery(this).parent().parent(".ui-widget").width()) - 60;
  92. jQuery(this).hide().visualize({
  93. type: statsType, // 'bar', 'area', 'pie', 'line'
  94. width: '800px',
  95. height: '240px',
  96. colors: ['#6fb9e8', '#ec8526', '#9dc453', '#ddd74c']
  97. }); // used with the visualize plugin. Statistics.
  98. });
  99. jQuery(".tabs").tabs(); // Enable tabs on all '.tabs' classes
  100. jQuery( ".datepicker" ).datepicker();
  101. jQuery(".editor").cleditor({
  102. width: '800px'
  103. }); // The WYSIWYG editor for '.editor' classes
  104. // Slider
  105. jQuery(".slider").slider({
  106. range: true,
  107. values: [20, 70]
  108. });
  109. // Progressbar
  110. jQuery(".progressbar").progressbar({
  111. value: 40
  112. });
  113. });