Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <script type="text/javascript">
  2.         $(':checkbox').click(function() {
  3.             var row = $(this).parent().parent().parent().parent();
  4.             alert($(row).html());
  5.             isFinished(row);
  6.  
  7.         });
  8.         $(document).ready(function () {
  9.             $('#MainContent_ctl00_listItemsTable tr').each(function () {
  10.                 changeColorOfRow(this);
  11.                 isFinished(this);
  12.             });
  13.  
  14.         });
  15.  
  16.         function isFinished(row) {
  17.             if ($(row).attr('data-finished') == 'True') {
  18.                 $(row).find('td p').css('text-decoration', 'line-through');
  19.  
  20.             } else {
  21.                 $(row).find('td p').css('text-decoration', '');
  22.             }
  23.         }
  24.         function changeColorOfRow(row) {
  25.             var priority = $(row).attr('data-priority');
  26.  
  27.             if (priority == 0) {
  28.                 $($(row).find('td')).each(function () {
  29.                     determineColor(this, 'red');
  30.                 });
  31.             }
  32.             if (priority == 1) {
  33.                 $($(row).find('td')).each(function () {
  34.                     determineColor(this, 'yellow');
  35.                 });
  36.             }
  37.             if (priority == 2) {
  38.                 $($(row).find('td')).each(function () {
  39.                     determineColor(this, 'blue');
  40.                 });
  41.             }
  42.             if (priority == 3) {
  43.                 $($(row).find('td')).each(function () {
  44.                     determineColor(this, 'blue');
  45.                 });
  46.             }
  47.             if (priority == 5) {
  48.                 $($(row).find('td')).each(function () {
  49.                     determineColor(this, 'green');
  50.                 });
  51.             }
  52.             if (priority == 6) {
  53.                 $($(row).find('td')).each(function () {
  54.                     determineColor(this, 'purple');
  55.                 });
  56.             }
  57.         }
  58.         function determineColor(column, color) {
  59.             $(column).css('background-color', color);
  60.         }
  61.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement