×

Welcome to TagMyCode

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