Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="question radios-with-extra-lines">
    <div class="question__title">
        Пройдите по ссылке и выберите тип, которому соответствует аудитория подписчиков <b>Instagram-аккаунта</b>, исходя из языка, на котором опубликованны посты и комментарии.
     
    </div>
<div>
		<a target="_blank" href = "{{link}}">
		 Ссылка на аккаунт
   </a>
</div>
  <br>
{{#each types}}

<div>
  <span class="text">{{field type="radio" name="audience_type" value=this label=this}}</span>
  <span class="hint_label"> ? <div class="hint_content">{{lookup ../instruction @index}}</div></span>
  </div>
  
{{/each}}
   {{field class="question__field_extra_input" type="input" name="another_type" placeholder="Введите ответ, если вы выбрали пункт 'Трудно определить'" width="60%"}} 

              
            
!

CSS

              
                ul {
  padding: 0;
}

.task , .question__field_block, .question__field_block_with_extra {
  display: block;
}

.question {
  margin-bottom: 30px;
}

.question__field_extra_input {
  display: none;
}

.yes-no-question__title {
  width: 40%;
  margin-right: 5%;
  margin-top: 0;
  padding-left: 10px;
  display: inline-block;
}

.question__field_yes-no {
  width: 20%;
  display: inline-block;
}

@media (max-width: 800px) {
  .yes-no-question__title {
    width: 70%;
    margin-right: 5%;
  }
}



.hint_label {
  color: #555;
  font-weight: bolder;
  position: relative;
  font-size: 1.2em;
  display: inline-block;
  width: 24px;
  height: 24px;
  text-align: center;
  border-radius: 50%;
  background-color: #fafafa;
  border: 1px solid #ccc;
  line-height: 24px;
 }
.hint_content {
  min-width:450px;
  background-color:#fafafa;
  display: none;
  color:#555;
  text-align:left;
  font-size:0.8em;
  border: solid 1px #ddd;
  border-radius:3px;
  padding: 5px 10px;
  top:10px;
  left:20px;
  position: absolute;
  z-index: 10;
  white-space:normal;
  word-wrap:break-word;
  font-weight:normal;
} 
.hint_label:hover > .hint_content {
	display: inline-block;
}

              
            
!

JS

              
                exports.Task = extend(TolokaHandlebarsTask, function (options) {
  TolokaHandlebarsTask.call(this, options);
}, {
  validate: function(solution) {
    var output_values = solution.output_values;
    //если ни одно поле в вопросе c экстра  ответом не было выбрано или если был выбран ответ  "другое", но ничего не введено в выпадающем поле
    if (output_values.audience_type === "Трудно определить" &&
    (output_values.another_type === null || !output_values.another_type))
    {
      TolokaHandlebarsTask.prototype.validate.apply(this, arguments);
      return {
        task_id: this.getTask().id,
        errors: {
            another_type: {
            message: "Поле обязательное для заполнения"
          }
        }
      };
    } else {
      return TolokaHandlebarsTask.prototype.validate.apply(this, arguments);
    }
  },
  onRender: function() {
    // DOM-элемент задания сформирован (доступен через #getDOMElement()) 
   },

  onDestroy: function() {
    // Задание завершено, можно освобождать (если были использованы) глобальные ресурсы
  },

  setSolution: function(solution) {
    var output_values = solution.output_values;
    var extraAnswerInput = this.getDOMElement().querySelector(".question__field_extra_input");
    if (extraAnswerInput) {
      if (output_values.audience_type === "Трудно определить") {
        extraAnswerInput.style.display = "block";
      } else {
        extraAnswerInput.style.display = "none";
      }
    }
    TolokaHandlebarsTask.prototype.setSolution.call(this, solution);
  }
});
function extend(ParentClass, constructorFunction, prototypeHash) {
  constructorFunction = constructorFunction || function () {};
  prototypeHash = prototypeHash || {};
  if (ParentClass) {
    constructorFunction.prototype = Object.create(ParentClass.prototype);
  }
  for (var i in prototypeHash) {
    constructorFunction.prototype[i] = prototypeHash[i];
  }
  return constructorFunction;
}

              
            
!
999px

Console