×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Влад Якуб
Added: Dec 11, 2019 6:12 AM
Modified: Mar 18, 2022 2:54 PM
Views: 4157
Tags: no tags
  1. $vtext5 = [
  2.     'r*c1'  => '1',
  3.     'r*c2'  => '2',
  4.     'r*c3'  => '3',
  5.     'r*c4'  => '4',
  6.     'r*c5'  => '5',
  7.     'r*c99'  => '?',
  8. ];
  9. $css5 = '
  10.     tr.pr-row-head { background: transparent !important; }
  11.     tr.pr-row-head td { border: none !important; }
  12.     [cnum="1"] pr-col-title { text-align: left }
  13.     [cnum="5"] pr-col-title { text-align: right }
  14.     pr-elem-reminder {width: 4em; min-height: 40px; font-size: 150%; margin: auto}
  15.     @media screen and (max-device-width:650px) {
  16.         tbody {lineHeight: 1em; font-size: 70%}
  17.         pr-elem-reminder {width: 2em;}
  18.     }
  19. ';
  20. $js5 = '
  21.     $(".pr-row-head [cnum]:not([cnum=1],[cnum=5])").remove();
  22.     $(".pr-row-head [cnum=1]").attr("colspan", 3);
  23.     $(".pr-row-head [cnum=5]").attr("colspan", 2);
  24.     $("pr-elem").hide();
  25.  
  26.     var colors = {
  27.         1: "bg-red-l1",
  28.         2: "bg-red-l3",
  29.         3: "bg-yellow-l4",
  30.         4: "bg-green-l3",
  31.         5: "bg-green-l1",
  32.     };
  33.  
  34.     $(document).on("change", "pr-question-main :radio, pr-question-main :checkbox", function () {
  35.         $("[rnum]:not([rnum=99]) [cnum]").each(function () {
  36.             var $td = $(this),
  37.                 $input = $td.find(":radio, :checkbox"),
  38.                 cnum = $td.attr("cnum");
  39.             $td.toggleClass(colors[cnum], $input.prop("checked") && !$input.prop("disabled"));
  40.         });
  41.     });
  42. ';