<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Максим</title><generator>teletype.in</generator><description><![CDATA[Максим]]></description><link>https://teletype.in/@aston_max?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/aston_max?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/aston_max?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Wed, 22 Apr 2026 03:35:42 GMT</pubDate><lastBuildDate>Wed, 22 Apr 2026 03:35:42 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@aston_max/getcourse-put-data-to-survey-input</guid><link>https://teletype.in/@aston_max/getcourse-put-data-to-survey-input?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/getcourse-put-data-to-survey-input?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Автоматически записать данные в поле анкеты геткурс. На примере записи даты заполнения анкеты</title><pubDate>Sat, 10 Jun 2023 14:53:23 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/c6/59/c6594cfb-4679-4252-ac07-de6f3aeec907.png"></media:content><description><![CDATA[<img src="https://img3.teletype.in/files/69/09/69097790-249f-43dc-b9f7-23c4089c2119.png"></img>Переходим в раздел Анкеты. В созданной анкете создаем поле даты. Поле можно назвать &quot;Дата заполнения анкеты&quot;. Сохраняем]]></description><content:encoded><![CDATA[
  <nav>
    <ul>
      <li class="m_level_1"><a href="#TTj9">Шаг 1. Создаем поле анкеты с типом \</a></li>
      <li class="m_level_1"><a href="#fukl">Шаг 2. Добавляем блок анкеты на страницу. Присваиваем блоку класс</a></li>
      <li class="m_level_1"><a href="#KYV0">Шаг 3. Пишем js код</a></li>
      <li class="m_level_2"><a href="#MBM7">Как найти ID_ПОЛЯ_АНКЕТЫ?</a></li>
      <li class="m_level_1"><a href="#SbQP">Шаг 4. Проверяем</a></li>
    </ul>
  </nav>
  <h2 id="TTj9">Шаг 1. Создаем поле анкеты с типом &quot;Дата&quot;</h2>
  <p id="74bK">Переходим в раздел Анкеты. В созданной анкете создаем поле даты. Поле можно назвать &quot;Дата заполнения анкеты&quot;. Сохраняем</p>
  <figure id="P8wW" class="m_column">
    <img src="https://img3.teletype.in/files/69/09/69097790-249f-43dc-b9f7-23c4089c2119.png" width="1365" />
  </figure>
  <p id="7C4L"></p>
  <h2 id="fukl">Шаг 2. Добавляем блок анкеты на страницу. Присваиваем блоку класс</h2>
  <p id="5lvW">Нужно поставить класс блоку, например <code>survey_block</code> Это нужно для того, чтобы скрипт обратился к нужному нам блоку с анкетой</p>
  <figure id="QQTi" class="m_column">
    <img src="https://img1.teletype.in/files/0e/aa/0eaa4390-4db4-475f-9a38-eee101042f36.png" width="1325" />
  </figure>
  <p id="yqB5"></p>
  <h2 id="KYV0">Шаг 3. Пишем js код</h2>
  <p id="I9tW">Добавляем блок <em>JavaScript-код </em>и вставляем туда код</p>
  <p id="yVFX">JS v1.0</p>
  <pre id="bQVB" data-lang="javascript">/**
 * Script Name: JS Запись данных в поле анкеты на Getcourse
 * Script description: Автоматически записать данные в поле анкеты геткурс c помощью js кода. На примере записи даты заполнения анкеты
 * Version: 1.0
 * Author: Максим Калмыков
 * Url: https://t.me/getcomponent
 */

$(() =&gt; {

  // Получаем дату для записи в поле анкеты
  const nowDate = new Date().toLocaleDateString(&#x27;ru&#x27;);

  setTimeout(() =&gt; {

    // Записываем данные в поле анкеты     
    // Вместо 1111111 - id поля анкеты
    putDataToSurveyInput(1111111, nowDate, &#x27;.survey_block&#x27;); // putDataToSurveyInput(ID_ПОЛЯ_АНКЕТЫ, ЧТО_ЗАПИСЫВАЕТСЯ_В_ПОЛЕ, &#x27;СЕЛЕКТОР_БЛОКА_АНКЕТЫ&#x27;);

  })


});


// Функция для записи данных в поле анкеты
function putDataToSurveyInput(surveyDataInputId, enteredData = &quot;Данные в поле анкеты&quot;, surveyBlocksSelector = &#x27;.lt-form-survey&#x27;) {

  // Получаем блок анкеты
  const surveyBlocks = $(surveyBlocksSelector);

  surveyBlocks.each((_, survey) =&gt; {
    // Получаем скрытый инпут в анкете
    const surveyJsonInput = $(survey).find(&#x27;input[name=&quot;surveyData&quot;]&#x27;);

    // Получаем поле для записи данных
    const fieldForEntered = $(survey).find(&#x60;#field-input-${surveyDataInputId}&#x60;);

    // Если такие поля не найдены, то скрипт дальше не выполняем
    if (fieldForEntered.length === 0 || surveyJsonInput.length === 0) return;

    // Скрываем видимость блока поля анкеты
    fieldForEntered.parents(&#x27;.field-wrapper&#x27;).hide();

    // Получаем объект данных анкеты
    const surveyData = JSON.parse(surveyJsonInput.val());

    // Записываем в свойство объекта данные
    surveyData[surveyDataInputId] = enteredData;

    // В скрытый инпут записываем json с обновленном значением поля
    surveyJsonInput.val(JSON.stringify(surveyData));


    // Если это поле type=&quot;text&quot; или тег &quot;TEXTAREA&quot; можно записать в них видимые данные (не обязательно)
    if (fieldForEntered.attr(&#x27;type&#x27;) === &#x27;text&#x27; || fieldForEntered[0]?.tagName === &#x27;TEXTAREA&#x27;) {
      fieldForEntered.val(enteredData);
    }

  })


}

</pre>
  <p id="4ujt"></p>
  <p id="SA5C">Нужно прописать в функции параметры</p>
  <p id="s2EC"><code>putDataToSurveyInput(ID_ПОЛЯ_АНКЕТЫ, ЧТО_ЗАПИСЫВАЕТСЯ_В_ПОЛЕ, &#x27;СЕЛЕКТОР_БЛОКА_АНКЕТЫ&#x27;);</code></p>
  <p id="AgwR"></p>
  <p id="sOVU"><code>СЕЛЕКТОР_БЛОКА_АНКЕТЫ</code> - класс блока анкеты который мы задали (например <code>survey_block</code> или <code>survey_block_1 </code>или другой)</p>
  <p id="WIus"></p>
  <h3 id="MBM7">Как найти <code>ID_ПОЛЯ_АНКЕТЫ</code>?</h3>
  <p id="szjP">1. <em>Навести мышку на поле анкеты</em></p>
  <p id="KAcc">2. <em>Нажать ПКМ -&gt; Просмотреть код</em></p>
  <p id="snjU">3. <em>В html коде скопировать цифры из атрибута id=&quot;field-input-<strong>1673820</strong>&quot;</em></p>
  <figure id="Yafq" class="m_column">
    <img src="https://img3.teletype.in/files/6f/ce/6fce3f97-9abb-4f89-9206-beff79547ab6.png" width="1458" />
  </figure>
  <p id="Yc15"></p>
  <p id="bUGH">Вставляем id в код</p>
  <figure id="N9tU" class="m_column">
    <img src="https://img3.teletype.in/files/e7/9e/e79e487f-a1c2-460f-9ea8-da1d4e7a62d0.png" width="1390" />
  </figure>
  <p id="Bs7g"></p>
  <h2 id="SbQP">Шаг 4. Проверяем</h2>
  <p id="94ah">После сохранения можно проверить в коде страницы или отправить анкету</p>
  <figure id="G9TT" class="m_column">
    <img src="https://img3.teletype.in/files/e0/99/e0999811-cdad-4591-869a-02c4a95212e2.png" width="1340" />
  </figure>
  <p id="YQuW"><em>*Скриптом это поле скрывается при просмотре страницы, на данном скриншоте оно показано с помощью инструментов разработчика в хроме</em></p>
  <p id="rt6A"></p>
  <p id="RMmm">Результат после отправки анкеты</p>
  <figure id="SeHg" class="m_column">
    <img src="https://img3.teletype.in/files/e8/0e/e80eeaf4-3fe0-496b-9955-d34a6ac93e32.png" width="1021" />
  </figure>
  <figure id="jGkY" class="m_column">
    <img src="https://img1.teletype.in/files/8b/6a/8b6aa576-d843-4b4f-8194-87827435fbc6.png" width="1513" />
  </figure>
  <p id="4iub">Готово</p>
  <p id="Wki1"></p>
  <p id="RxBr"></p>
  <hr />
  <p id="8oP2"><em>Доп. заметки по решению</em></p>
  <p id="YpHl">1. В поле анкеты записать с помощью скрипта можно не только дату и не только в поле с типом &quot;Дата&quot;</p>
  <figure id="RPcL" class="m_column">
    <img src="https://img2.teletype.in/files/59/34/59345f25-5493-487f-a151-79ec5d9d4592.png" width="845" />
  </figure>
  <figure id="aobH" class="m_column">
    <img src="https://img2.teletype.in/files/d7/b2/d7b2557f-dcb7-4320-84c3-a4dbafcec4c3.png" width="1508" />
  </figure>
  <p id="QPAI"></p>
  <p id="UGbF">2. Если скрипт будет использоваться часто в аккаунте, можно подключить функцию через тему в настройки аккаунта getcourse. Это позволит писать только вызов функции там где нужно (т.е. без самого тела функции, это позволит менять(если нужно будет) функцию из единого места - в теме)</p>
  <p id="ZXT7"></p>
  <p id="FkAK">3 В данном скрипте запись в скрытое поле происходит после загрузки страницы(+небольшой задержки). Можно записать и по триггеру нажатия на кнопку отправки анкеты (это если вдруг хочется заморочиться и учитывать ситуацию при которой пользователь зашел заполнять анкету в 23:59 а отправил на след. день и считать именно то число, когда нажал кнопку отправки )</p>
  <p id="gd9S">Нужно задать класс для кнопки анкеты, например <code>btn_send_survey</code></p>
  <pre id="QNx9" data-lang="javascript">$(() =&gt; {

  // Получаем дату для записи в поле анкеты
  const nowDate = new Date().toLocaleDateString(&#x27;ru&#x27;);


  // Записать после загрузки страницы
  setTimeout(() =&gt; {
    putDataToSurveyInput(1673718, nowDate, &#x27;.survey_block&#x27;);
  })



  // Записать при клике на кнопку 
  $(&#x27;.btn_send_survey .btn&#x27;).on(&#x27;click&#x27;, function (e) {
    e.preventDefault();

    // Записываем данные
    putDataToSurveyInput(1673718, nowDate, &#x27;.survey_block&#x27;);

    // затем отправляем форму
    $(this).parents(&#x27;form&#x27;).submit()
  });

});

// ...</pre>
  <p id="IwDJ"></p>
  <p id="WRgu"></p>
  <p id="moNO"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="XaEb">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/getcourse-modules-1</guid><link>https://teletype.in/@aston_max/getcourse-modules-1?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/getcourse-modules-1?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Оформить модуль, в  котором уроки недоступны + вывести дату выхода первого урока. JS код для списка тренингов в getcourse </title><pubDate>Thu, 11 May 2023 17:12:10 GMT</pubDate><media:content medium="image" url="https://img4.teletype.in/files/3e/de/3edeec70-f383-417c-87f0-9c6af01c67ab.png"></media:content><category>Getcourse scripts</category><description><![CDATA[<img src="https://img4.teletype.in/files/f5/c4/f5c486c3-822b-49c5-a98a-95f08a283646.png"></img>JS-код:]]></description><content:encoded><![CDATA[
  <figure id="pGM2" class="m_column">
    <img src="https://img4.teletype.in/files/f5/c4/f5c486c3-822b-49c5-a98a-95f08a283646.png" width="1368" />
  </figure>
  <p id="GHd3">JS-код:</p>
  <pre id="i2RC" data-lang="javascript">/**
 * Script Name: Добавить класс модулю, в  котором уроки недоступны + вывести дату выхода первого урока. JS код для списка тренингов в getcourse 
 * Version: 1.0
 * Author: Максим Калмыков
 * Url: https://t.me/getcomponent
 */


$(function () {
  // Название класса для модуля в котором недоступные уроки
  const notReachedClassName = &#x27;not_reached&#x27;;

  // Получить модули
  const modules = $(&#x27;.stream-table &gt; tbody &gt; tr&#x27;);

  if (modules.length === 0) return;

  modules.each(function (_, tr) {

    const link = $(tr).find(&#x27;a&#x27;).attr(&quot;href&quot;);

    $.get(link, function (data) {

      const pageDom = $(&#x27;&lt;div&gt;&lt;/div&gt;&#x27;).html(data);

      const lessons = pageDom.find(&#x27;.lesson-list li:not(.lesson-is-hidden)&#x27;);

      // Вывести дату первого урока
      showFirstLessonStart(lessons, tr);

      // Присвоить класс модулю, если нет доступных уроков внутри
      checkLessonsNotReached(lessons, tr);
    });

  });


  function checkLessonsNotReached(lessons, tr) {

    if (lessons.length === 0) return;

    let isNotReached = true;

    for (let i = 0; i &lt; lessons.length; i++) {
      if (!$(lessons[i]).hasClass(&quot;user-state-not_reached&quot;)) {
        isNotReached = false;
        break;
      }
    }

    if (isNotReached) {
      $(tr).addClass(notReachedClassName)
    }
  }


  function showFirstLessonStart(lessons, tr) {

    const dateStartEl = lessons.eq(0).find(&#x27;.has-start-at&#x27;);

    if (dateStartEl.length === 0) return;

    $(tr).find(&#x27;a&#x27;).prepend(dateStartEl);

  }

})</pre>
  <p id="ygek"></p>
  <p id="6MY3"><em>*JS код вставлять в javascript блок или подключать через тему</em></p>
  <p id="SXVG"><em>*Данная версия скрипта(v 1.0) проверяет список уроков только на первом уровне вложенности (т.е. подмодули модуля скрипт не проверяет). </em></p>
  <p id="26wf"></p>
  <p id="TFao">В результате работы скрипта: </p>
  <ul id="HSCx">
    <li id="hlOu">Присвоился класс для модулей, в которых уроки недоступны</li>
    <li id="5TIX">Добавлена дата выхода первого урока в списке (ищется именно первый урок в списке и в нем элемент даты)</li>
  </ul>
  <figure id="NGzo" class="m_column">
    <img src="https://img1.teletype.in/files/0f/9e/0f9e5657-2a70-4717-9ede-0958f79c6900.png" width="985" />
  </figure>
  <p id="heo1"></p>
  <p id="WuNr"></p>
  <p id="HVKZ">Можно использовать добавленный класс <code>not_reached </code>чтобы обратиться к этим модулям для стилизации </p>
  <p id="RE4K"></p>
  <p id="DQ1V">Простой пример CSS кода для списка модулей</p>
  <pre id="wP6T" data-lang="css">.xdget-trainingList .stream-table,
.xdget-trainingList .stream-table tbody,
.xdget-trainingList .stream-table tr,
.xdget-trainingList .stream-table tr td {
  display: block;
  margin: 0;
}


.xdget-trainingList .stream-table tr {
  margin-bottom: 10px;
  border: 1px solid #cccccc;
  border-radius: 10px;
}

.xdget-trainingList .stream-table tr.not_reached {
  opacity: 0.6;
  background-color: #f7f7f7;

}

.xdget-trainingList .stream-table tr td {
  height: auto;
  padding: 0;

}

.xdget-trainingList .stream-table tr td:hover {
  background-color: transparent;
}

.xdget-trainingList .stream-table tr a {
  padding: 10px 10px 10px 20px;
}

.xdget-trainingList .stream-table tr.not_reached a {
  cursor: default;
}

.xdget-trainingList .stream-table tr .has-start-at {
  font-size: 12px;
}


.xdget-trainingList .stream-table a&gt;div&gt;b {
  display: none;
}</pre>
  <p id="XT67"></p>
  <p id="o96s"></p>
  <figure id="UfQh" class="m_column">
    <img src="https://img4.teletype.in/files/f5/c4/f5c486c3-822b-49c5-a98a-95f08a283646.png" width="1368" />
  </figure>
  <p id="Jbsh"></p>
  <p id="QWVN"></p>
  <p id="qfMn"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="8SVK">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/button-scroll-top</guid><link>https://teletype.in/@aston_max/button-scroll-top?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/button-scroll-top?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Кнопка навигации  «Прокрутить наверх». Код для getcourse</title><pubDate>Sat, 18 Mar 2023 15:35:22 GMT</pubDate><description><![CDATA[<img src="https://img1.teletype.in/files/80/f1/80f15c2f-95de-4ea3-9022-73dbfb62b39c.png"></img>Что делает код:]]></description><content:encoded><![CDATA[
  <p id="PWPk">Что делает код:</p>
  <p id="nzdB">Показывает кнопку при определенном значении прокрутки страницы. При нажатии на эту кнопку происходит плавный скролл до начала страницы.</p>
  <p id="pOSO"></p>
  <p id="QoKu">Можно применять на длинных страницах или уроках с множеством блоков контента в визуальном конструкторе геткурса</p>
  <p id="aPrt"></p>
  <p id="QxBY"></p>
  <p id="oEgy"></p>
  <figure id="zce8" class="m_column">
    <img src="https://img1.teletype.in/files/80/f1/80f15c2f-95de-4ea3-9022-73dbfb62b39c.png" width="1735" />
  </figure>
  <p id="nqRU"></p>
  <p id="bkjB">CSS</p>
  <pre id="97SH" data-lang="css">/* Скрыть виджет обратной связи */
.talks-widget-button {
  display: none;
}

#button_to_top {
  display: inline-block;
  width: 50px;
  height: 50px;
  text-align: center;
  border-radius: 50px;
  position: fixed;
  bottom: 20px;
  right: 20px;

  /* Иконка стрелки вверх */
  background-image: url(&quot;https://fs.getcourse.ru/fileservice/file/download/a/629406/sc/385/h/b5328a61e88bd4e767caaa1e5baf96ca.svg&quot;);

  /* Цвет фона кнопки */
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 20px;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.18);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s;
}


#button_to_top:hover {
  cursor: pointer;
  transition: all 0.4s;
}

#button_to_top.btn_show {
  opacity: 0.85;
  visibility: visible;
}

#button_to_top.btn_show:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  #button_to_top {
    margin: 5px;
    width: 40px;
    height: 40px;
    bottom: 10px;
    right: 0;
    background-size: 15px;
  }

  .with-left-menu #button_to_top {
    bottom: 50px;
  }

}

</pre>
  <p id="P5Yi"></p>
  <p id="fJn8">HTML в Блок: HTML</p>
  <pre id="Sfb3" data-lang="html">&lt;div id=&quot;button_to_top&quot;&gt;
&lt;/div&gt;</pre>
  <p id="ybCy"></p>
  <p id="XoQP">JS в Блок: JavaScript</p>
  <pre id="fp77" data-lang="javascript">$(function() {
    /* Сколько нужно проскроллить чтобы появилась кнопка */
    const scroll_value = 600;
    
    /* За сколько миллисекунд должна быть прокрутка до верха страницы */
    const ms = 300;
    
    /* Получаем кнопку */
    const btn = $(&#x27;#button_to_top&#x27;);
    

      if ($(window).scrollTop() &gt; scroll_value) {
        btn.addClass(&#x27;btn_show&#x27;);
      } else {
        btn.removeClass(&#x27;btn_show&#x27;);
      }
    
    
    $(window).scroll(function() {
      if ($(window).scrollTop() &gt; scroll_value) {
        btn.addClass(&#x27;btn_show&#x27;);
      } else {
        btn.removeClass(&#x27;btn_show&#x27;);
      }
    });
    
    btn.on(&#x27;click&#x27;, function(e) {
      e.preventDefault();
      $(&#x27;html, body&#x27;).animate({scrollTop:0}, ms);
    });
})

</pre>
  <p id="Exrq"></p>
  <p id="eGuv"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="pEWy">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/getcourse-accordeon-block</guid><link>https://teletype.in/@aston_max/getcourse-accordeon-block?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/getcourse-accordeon-block?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Блок &quot;Аккордеон&quot; на Getcourse</title><pubDate>Mon, 06 Mar 2023 15:10:01 GMT</pubDate><media:content medium="image" url="https://img2.teletype.in/files/58/cd/58cdab0e-0589-4262-b1ee-0475e4e1dd94.png"></media:content><description><![CDATA[<img src="https://img2.teletype.in/files/12/8c/128cdd77-a575-49c7-a366-335565d0c647.png"></img>Аккордеон-блок на геткурсе можно применить для описания популярных вопросов и ответов, мини-инструкций и т.п.]]></description><content:encoded><![CDATA[
  <nav>
    <ul>
      <li class="m_level_1"><a href="#Dtbr">Шаг 1. Добавляем CSS блок</a></li>
      <li class="m_level_1"><a href="#QOIf">Шаг 2. Добавляем блоки контента и проставляем классы</a></li>
      <li class="m_level_1"><a href="#uIAL">Шаг 3. Добавляем блок с js-кодом</a></li>
    </ul>
  </nav>
  <p id="zrzt">Аккордеон-блок на геткурсе можно применить для описания популярных вопросов и ответов, мини-инструкций и т.п.</p>
  <p id="lYd7">Часто подобный блок можно встретить на продающих страницах, в нем описывают популярные возражения, вопросы, сомнения и закрывают их в раскрывающейся при клике панели.</p>
  <p id="fSdb"><em>Данное решение предназначено для использования в визуальном конструкторе на платформе getcourse</em></p>
  <figure id="VT9t" class="m_column">
    <img src="https://img2.teletype.in/files/12/8c/128cdd77-a575-49c7-a366-335565d0c647.png" width="995" />
    <figcaption>Как выглядит блок-аккордеон на геткурсе</figcaption>
  </figure>
  <p id="PeUQ"></p>
  <h3 id="Dtbr">Шаг 1. Добавляем CSS блок</h3>
  <p id="6X1J"></p>
  <p id="CdwA">CSS-код:</p>
  <pre id="fb9S" data-lang="css">/* Подключение шрифта  Montserrat 400;600 */
@import url(&#x27;https://fonts.googleapis.com/css2?family=El+Messiri&amp;family=Montserrat:wght@400;600&amp;display=swap&#x27;);

:root {

  /* Цвет фона плашки */
  --ac_bgColor: #ffffff;

  /* Цвет заголовка */
  --ac_titleColor: #333333;

  /* Цвет текста */
  --ac_textColor: #777777;

  /* Цвет плюса */
  --ac_accentColor: #f9ba49;

  /* Цвет кружочка плюса */
  --ac_lightColor: #fff1d7;


  --fontM: &quot;Montserrat&quot;, &quot;proxima-nova&quot;, sans-serif;
}


.accordeon_block p {
  line-height: 1.4;
}

.accordeon_block p,
.accordeon_block div,
.accordeon_block .btn {
  font-family: var(--fontM);
}



.accordeon_item {
  margin-bottom: 10px;
  border: 1px solid #ededed;
  border-radius: 5px;
  background-color: var(--ac_bgColor);
  transition: box-shadow 0.4s ease;
}

.accordeon_item:hover {
  box-shadow: 0 15px 25px 0 rgb(0 0 0 / 4%);
  transition: box-shadow 0.4s ease;
}


/* Заголовок элемента аккордена */
.accordeon_item&gt;.f-header {
  padding: 20px 60px 20px 15px;
  border-radius: 5px;
  position: relative;
  cursor: pointer;
}

.accordeon_item&gt;.f-header p {
  margin: 0;
  font-size: 20px;
  user-select: none;
  color: var(--ac_titleColor);
}

/* Оформление плюса(+) */
.accordeon_item&gt;.f-header::after {
  content: &#x27;+&#x27;;
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50px;
  line-height: 1;
  font-size: 36px;
  font-weight: 400;
  font-family: &quot;Arial&quot;, sans-serif;
  color: var(--ac_accentColor);
  transition: all .4s ease;
}

/* При наведнии на заголовок аккордеона */
.accordeon_item&gt;.f-header:hover:after {
  background-color: var(--ac_lightColor);
  transition: all .4s ease;
}

/* При активном аккордеоне поворачиваем плюс */
.accordeon_item.active&gt;.f-header:after {
  background-color: var(--ac_lightColor);
  transform: translateY(-50%) rotate(-45deg);
}

.accordeon_item.active&gt;.f-header:hover:after {
  filter: brightness(101%);
}


/* Контейнер контента */
.accordeon_block .ac_content_wrapper {
  padding: 5px 15px 15px 15px;
}

/* Текст контента */
.accordeon_block .f-text {
  font-size: 16px;
  font-weight: 400;
  color: var(--ac_textColor);
}




/* Адапатация под моб. экраны */
@media (max-width: 640px) {

  .accordeon_item&gt;.f-header {
    padding: 15px 50px 15px 15px;
  }

  .accordeon_item&gt;.f-header p {
    font-size: 16px;
  }

  .accordeon_block .f-text {
    font-size: 14px;
  }

  .accordeon_item&gt;.f-header::after {
    right: 5px;
    width: 40px;
    height: 40px;
    font-size: 32px;
  }

}</pre>
  <p id="nDUF"></p>
  <p id="1FLt"></p>
  <h3 id="QOIf">Шаг 2. Добавляем блоки контента и проставляем классы</h3>
  <p id="tpI0"></p>
  <p id="cgfT">Добавляем блок &quot;Заголовок и текст&quot;</p>
  <p id="gRRq">Ставим этому блоку в настройках класс <em>accordeon_block</em></p>
  <figure id="XM65" class="m_column">
    <img src="https://img1.teletype.in/files/4f/2a/4f2aaa79-faa7-4ec9-bcac-591a099f3399.png" width="1350" />
  </figure>
  <p id="500p"></p>
  <p id="kgMR">Для заголовка(который будет заголовком вкладки элемента аккордеона) ставим класс <em>accordeon_item</em></p>
  <figure id="7K3Z" class="m_original">
    <img src="https://img4.teletype.in/files/3b/a0/3ba02750-6adb-434a-b10f-350843858284.png" width="540" />
  </figure>
  <p id="kHkM"></p>
  <p id="bHnf">Контентные элементы ниже заголовка будут относиться к этому заголовку до следующего заголовка с классом <em>accordeon_item</em></p>
  <figure id="S16s" class="m_column">
    <img src="https://img3.teletype.in/files/e5/1b/e51bbba5-61c9-4572-8414-b0b6ad1cd41e.png" width="1170" />
  </figure>
  <p id="uhiv"></p>
  <h3 id="uIAL">Шаг 3. Добавляем блок с js-кодом</h3>
  <p id="K3yx"></p>
  <p id="dX0N">JS-код:</p>
  <pre id="xNGl" data-lang="javascript">/**
 * Script Name: Активация аккордеона в визуальном редакторе Getcourse
 * Version: 1.01
 * Author: Максим Калмыков
 * Url: https://t.me/getcomponent
 */

$(function () {


  accordeonInit({
    accordeonBlockSelector: &#x27;.accordeon_block&#x27;, // Класс блока с аккордеоном
    isBind: false, // Активна только одна вкладка(на которой был клик) (true - да / false - нет)
    showFirstItem: true // Открыть первую вкладку (true - да / false - нет)
  });


});


function accordeonInit({ accordeonBlockSelector = &#x27;.accordeon_block&#x27;, isBind = false, showFirstItem = false }) {

  const acItems = $(accordeonBlockSelector).find(&#x27;.accordeon_item&#x27;);

  if (acItems.length === 0) return;

  acItems.append(&#x27;&lt;div class=&quot;ac_content_wrapper&quot; style=&quot;display: none; &quot;&gt;&lt;/div&gt;&#x27;);

  acItems.each((_, item) =&gt; {

    $(item).find(&quot;.ac_content_wrapper&quot;).append($(item).nextUntil(&quot;.accordeon_item&quot;).not(&quot;style&quot;));

    $(item).find(&quot;.f-header&quot;).on(&quot;click&quot;, function () {

      const acItem = $(this).parent();
      const acItemContent = $(this).nextAll(&#x27;.ac_content_wrapper&#x27;);


      console.log(&#x27;acItemContent&#x27;, acItemContent)
      if (isBind) {
        acItem.toggleClass(&#x27;active&#x27;).siblings().removeClass(&#x27;active&#x27;);

        acItem.parent().find(&#x27;.ac_content_wrapper&#x27;).slideUp();

        if (acItemContent.is(&quot;:hidden&quot;)) {
          acItemContent.slideDown();
        }

        return;
      }

      acItem.toggleClass(&#x27;active&#x27;);

      if (acItemContent.is(&quot;:hidden&quot;)) {
        acItemContent.slideDown();
      } else {
        acItemContent.slideUp();
      }

    });
  });


  if (showFirstItem) {

    const firstAcItem = $(&#x60;${accordeonBlockSelector} .accordeon_item&#x60;).eq(0);

    firstAcItem.addClass(&#x27;active&#x27;);
    firstAcItem.find(&quot;.ac_content_wrapper&quot;).show();
  }

}

</pre>
  <p id="RVHK"></p>
  <p id="nA0S"></p>
  <p id="E3vp">В этом месте кода мы активируем аккордеон и можем включить некоторые настройки:</p>
  <ul id="jcY9">
    <li id="pUyC">isBInd - при нажатию на одну вкладку, она открывается а остальные закрываются <em>(true - сделать, false - не делать)</em></li>
    <li id="sEFA">showFirstItem - Открыть первую вкладку <em>(true - сделать, false - не делать)</em></li>
  </ul>
  <figure id="Wqjn" class="m_column">
    <img src="https://img1.teletype.in/files/48/03/48039a09-db78-4331-aa74-972dd70650bd.png" width="956" />
  </figure>
  <p id="tuDR"></p>
  <p id="AH22">Готово</p>
  <figure id="Z8XJ" class="m_column">
    <img src="https://img3.teletype.in/files/a9/29/a929c26d-e4c9-47f8-ac77-4ed9dbb569d2.png" width="900" />
  </figure>
  <p id="kgit"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="vrBZ">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
    <p id="z6AN">Youtube: <a href="https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg" target="_blank">https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg</a></p>
    <p id="UbUk">VK: <a href="https://vk.com/getcomponent" target="_blank">https://vk.com/getcomponent</a></p>
    <p id="LNlx">Нельзяграм: @maximilia_n</p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/edit-product-block-on-getcourse</guid><link>https://teletype.in/@aston_max/edit-product-block-on-getcourse?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/edit-product-block-on-getcourse?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Меняем текст в блоке продления покупки в тренингах на геткурсе с помощью JS</title><pubDate>Tue, 07 Feb 2023 22:08:54 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/82/41/824130a8-b6a4-496a-82ea-1a653996486f.png"></media:content><description><![CDATA[<img src="https://img1.teletype.in/files/8d/53/8d5321a8-421b-4bbd-af57-e627474c6cc7.png"></img>JS-код:]]></description><content:encoded><![CDATA[
  <figure id="ION0" class="m_column">
    <iframe src="https://www.youtube.com/embed/xOZCUY75jY8?autoplay=0&loop=0&mute=0"></iframe>
  </figure>
  <p id="FrTo">JS-код:</p>
  <pre id="z15d" data-lang="javascript">/*
  * Name: Функция для замены текста в блоке продления покупки в тренингах на геткурсе
  * Version: 1.0
*/



// Объявление функции которая заменяет текст в блоке продления продукта в гк 
function changeTextOnProductBlock(productBlockSelector = &#x27;.xdget-productTiming&#x27;, replaceTextArr = [&#x27;Поддержка доступна&#x27;, &quot;Поддержка&quot;, &#x27;Поддержка закончилась&#x27;]) {

  if (!Array.isArray(replaceTextArr)) return;

  const productInfo = document.querySelector(&#x60;${productBlockSelector} .user-product-block&#x60;);

  if (!productInfo) return;

  const notAccessEl = productInfo.querySelector(&quot;b&quot;);

  if (notAccessEl &amp;&amp; productInfo.childNodes[0].textContent.trim() == &#x27;&#x27;) {
    notAccessEl.textContent = notAccessEl.textContent.replace(&#x27;Доступ к тренингу закончился&#x27;, replaceTextArr[2]);
    return;
  }
  const newTextProduct = productInfo.childNodes[0].textContent
    .replace(&#x27;Тренинг доступен&#x27;, replaceTextArr[0])
    .replace(&quot;Доступ к тренингу&quot;, replaceTextArr[1]);
  productInfo.childNodes[0].textContent = newTextProduct;


}


$(function () {

  // Примеры вызова функции для заменты текста в блоке продления покупки


  changeTextOnProductBlock(&#x27;.product_1&#x27;, [&#x27;Курс доступен&#x27;, &#x27;Доступ к курсу&#x27;, &#x27;Доступ к курсу закончился&#x27;]);

  changeTextOnProductBlock(&#x27;.product_2&#x27;, [&#x27;Поддержка доступна&#x27;, &#x27;Поддержка&#x27;, &#x27;Поддержка закончилась&#x27;]);

});</pre>
  <p id="ITuk"></p>
  <p id="YEKO">*Перед тем как выполнить скрипт блокам были заданы классы, в данном примере это <code>product_1 </code>и <code>product_2</code></p>
  <p id="j400"></p>
  <p id="RNnS">В вызове функции можно написать свои строки текста</p>
  <p id="P0AK"><br /><code>changeTextOnProductBlock(&#x27;.product_3&#x27;, [&#x27;База знаний доступна&#x27;, &#x27;Доступ к базе знаний&#x27;, &#x27;Доступ к базе знаний закончился&#x27;]);</code></p>
  <p id="iO37"></p>
  <p id="sTeu"></p>
  <p id="eRnL"></p>
  <p id="2Z23">Вариант CSS-стилизации:</p>
  <pre id="wryp" data-lang="css">/* Блок продления продукта */
.xdget-productTiming {
  margin-bottom: 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0 0 0 / 0.15);
  background-color: #7367F0;
  background-image: linear-gradient(225deg, rgba(206, 159, 252, 1) -20%, rgba(115, 103, 240, 1) 90%);
}


.xdget-productTiming .user-product-block&gt;.text-muted {
  margin-top: 2px;
  font-weight: 400;
  color: #ffffff;
}


/* Продлить доступ */
.user-product-block a.dotted-link {
  margin-top: 4px;
  display: inline-block;
  font-weight: 400;
  color: #ffffff;
  border-color: #ffffff;
  transition: all .4s ease;
}

.user-product-block a.dotted-link:hover {
  color: #FAC9B4;
  border-color: #FAC9B4;
  transition: all .4s ease;
}



/* Кнопка &quot;Продлить&quot; */
.xdget-productTiming .user-product-block .prolong-offers button {
  border: 0;
  border-radius: 30px;
  font-size: 16px;
  padding: 8px 60px;
  min-height: 50px;
  background-color: #2b2e43;
  transition: filter .4s ease;
}

.xdget-productTiming .user-product-block .prolong-offers button:hover {
  filter: brightness(120%);
  transition: filter .4s ease;
}

.xdget-productTiming .user-product-block&gt;b {
  color: #FAC9B4 !important;
}

/* &lt;/ Блок продления продукта */</pre>
  <p id="ryjg"></p>
  <p id="TC17"></p>
  <p id="v1qS">Результат:</p>
  <figure id="7SHS" class="m_column">
    <img src="https://img1.teletype.in/files/8d/53/8d5321a8-421b-4bbd-af57-e627474c6cc7.png" width="1561" />
  </figure>
  <p id="3ChZ"></p>
  <hr />
  <p id="pBA6">* Возможность продлить доступ появляется если это предварительно настроено в настройках продукта</p>
  <figure id="Td4p" class="m_column">
    <img src="https://img4.teletype.in/files/33/a6/33a60c0a-a951-40b5-9aba-d7c7ed797465.png" width="1428" />
  </figure>
  <p id="xokn"></p>
  <p id="LRlY"><em>Telegram: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></em></p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/getcourse-file-storadge-script</guid><link>https://teletype.in/@aston_max/getcourse-file-storadge-script?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/getcourse-file-storadge-script?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>JS скрипт для файлового хранилища Getcourse</title><pubDate>Fri, 27 Jan 2023 16:33:07 GMT</pubDate><media:content medium="image" url="https://img4.teletype.in/files/b4/2a/b42a7f7a-8530-4ce0-8ac8-526c0e4b8810.png"></media:content><category>Getcourse scripts</category><description><![CDATA[<img src="https://img3.teletype.in/files/63/db/63db24b7-7eed-4e24-9b18-0eb76aea12aa.png"></img>Оглавление]]></description><content:encoded><![CDATA[
  <figure id="bkRQ" class="m_column">
    <img src="https://img3.teletype.in/files/63/db/63db24b7-7eed-4e24-9b18-0eb76aea12aa.png" width="1893" />
    <figcaption>Пример работы скрипта</figcaption>
  </figure>
  <p id="f2ve"><strong>Оглавление</strong></p>
  <nav>
    <ul>
      <li class="m_level_1"><a href="#X0FU">Что делает скрипт</a></li>
      <li class="m_level_1"><a href="#mZml">JS-код</a></li>
      <li class="m_level_1"><a href="#K7d2">Как вставить код на геткурс</a></li>
    </ul>
  </nav>
  <p id="87Bq"></p>
  <p id="EhJT"></p>
  <h3 id="X0FU">Что делает скрипт</h3>
  <p id="1Aa1">1. В боковой панели в подменю добавляет к ссылке на файловое хранилище параметры, при которых страница файлового хранилища будет открываться с сортировкой файлов от новым к старым (новые файлы сверху).</p>
  <p id="qnyR">2. Добавляет кнопки быстрого переключения &quot;Сначала новые файлы&quot; &quot;Сначала старые файлы&quot; </p>
  <figure id="j67z" class="m_original">
    <img src="https://img4.teletype.in/files/f7/ca/f7ca95a1-b9b1-4bea-9905-205b597040cd.png" width="533" />
  </figure>
  <p id="qDAT">3. Добавляет превью файлов(в основных популярных форматах):</p>
  <ul id="4Tty">
    <li id="BOM3">Изображения</li>
    <li id="z5r2">Видео</li>
    <li id="tjEq">Аудио</li>
  </ul>
  <p id="BUTa">4. Для некоторых документов с популярным форматом (docx, xlsx, pdf) добавляет иконки </p>
  <p id="A1i3">5. Добавляет кнопку копирования ссылки на файл (ссылка берется из страницы файла в поле где рекомендуемая для размещения ссылка)<br /></p>
  <figure id="Lr4W" class="m_column">
    <img src="https://img4.teletype.in/files/be/09/be0970cd-a7fa-44e6-84a9-a8a03dffcd18.png" width="825" />
  </figure>
  <p id="ufZ2">6. Добавляет иконку при загрузке файла в хранилище. При клике на иконку происходит копирование ссылки на файл</p>
  <figure id="AgWd" class="m_original">
    <img src="https://img2.teletype.in/files/5f/d7/5fd764bf-520d-4284-ade3-70ae6bb2ad57.png" width="560" />
  </figure>
  <p id="FbEX"></p>
  <h3 id="mZml">JS-код</h3>
  <pre id="95dI" data-lang="javascript">/**
 * Script Name: JS-скрипт для файлового хранилища Getcourse
 * Version: 1.0
 * Author: Максим Калмыков
 * Url: https://t.me/getcomponent
 */


$(function () {

    if (!window.userInfo.isAdmin) return;

    (function () {

        if (!window.gcAccountUserMenu) return;

        const profile = window.gcAccountUserMenu.items.find(menuItem =&gt; menuItem.id === &#x27;profile&#x27;);
        if (!profile) return;

        const fileService = profile.subitems.find(profileItem =&gt; profileItem.id === &#x27;fileserviceAccountStat&#x27;);
        if (fileService) fileService.url += &#x27;?sort=-created_at&#x27;;

    })();

    if (location.pathname.indexOf(&quot;/fileservice/control/account/storage&quot;) === -1) return;

    $(&#x27;.standard-page-content &gt; .btn-group&#x27;).prepend(&quot;&lt;p&gt;&lt;strong&gt;Показать сначала:&lt;/strong&gt;&lt;/p&gt;&lt;a href=&#x27;/fileservice/control/account/storage?sort=-created_at&#x27; class=&#x27;btn btn-default sort_new&#x27;&gt;Новые файлы&lt;/a&gt;&lt;a href=&#x27;/fileservice/control/account/storage&#x27; class=&#x27;btn btn-default sort_old&#x27;&gt;Старые файлы&lt;/a&gt;&quot;);

    const archiveImage = &quot;https://fs.getcourse.ru/fileservice/file/download/a/556025/sc/469/h/389a4619093e40c4ae3576d7b6340425.png&quot;;

    const docsInfo = {

        pdf: {
            icon: &quot;https://fs.getcourse.ru/fileservice/file/download/a/556025/sc/206/h/d8f3c98573c09bc7e43750dc7ad51d54.png&quot;,
            exts: [&#x27;pdf&#x27;]
        },

        sheet: {
            icon: &quot;https://fs.getcourse.ru/fileservice/file/download/a/556025/sc/163/h/39f56b599f06e954a521c515bf3df8c3.png&quot;,
            exts: [&#x27;xlsx&#x27;, &#x27;csv&#x27;]
        },

        doc: {
            icon: &quot;https://fs.getcourse.ru/fileservice/file/download/a/556025/sc/245/h/a58bcff963c7d8ad326014b6328bfb64.png&quot;,
            exts: [&#x27;docx&#x27;, &#x27;doc&#x27;]
        },

        js: {
            icon: &quot;https://fs.getcourse.ru/fileservice/file/download/a/556025/sc/111/h/d1093f7c9ea35d210357795a495e28ee.png&quot;,
            exts: [&#x27;js&#x27;]
        },

        css: {
            icon: &quot;https://fs.getcourse.ru/fileservice/file/download/a/556025/sc/294/h/7d9010eb630eeaf84fd3c88aaa92791e.png&quot;,
            exts: [&#x27;css&#x27;]
        },

        eml: {
            icon: &quot;https://fs.getcourse.ru/fileservice/file/download/a/602055/sc/204/h/7d037cda84be880d8964cac137f3c663.png&quot;,
            exts: [&#x27;eml&#x27;]
        }
    };


    $(&#x27;#files .gc-file-link&#x27;).each((_, row) =&gt; {

        const $fileShowContainer = $(row).find(&#x27;td[data-col-seq=&quot;2&quot;]&#x27;),
            fileNameStr = $fileShowContainer.text().trim(),
            fileShowItemLink = $fileShowContainer.find(&#x27;a&#x27;).attr(&#x27;href&#x27;),
            fileTypeText = $(row).find(&#x27;td[data-col-seq=&quot;3&quot;]&#x27;).text(),
            pageFileLink = $(row).find(&#x27;td[data-col-seq=&quot;1&quot;] &gt; a&#x27;).attr(&#x27;href&#x27;);

        if (fileTypeText == &#x27;изображение&#x27; || fileTypeText == &#x27;image&#x27; || fileTypeText == &#x27;fotografías&#x27;) {
            $fileShowContainer.append(&#x60;&lt;div&gt;&lt;img height=&quot;200&quot; src=&quot;${fileShowItemLink}&quot;&gt;&lt;/div&gt;&#x60;);
        } else if (fileTypeText == &#x27;видео&#x27; || fileTypeText == &#x27;video&#x27; || fileTypeText == &#x27;vídeos&#x27;) {
            $fileShowContainer.append(&#x60;
    &lt;div&gt;
        &lt;video width=&quot;100%&quot; controls=&quot;controls&quot; src=&quot;${fileShowItemLink}&quot;&gt;&lt;/video&gt;
    &lt;/div&gt;&#x60;);
        } else if (fileTypeText == &#x27;аудио&#x27; || fileTypeText == &#x27;audio&#x27; || fileTypeText == &#x27;audios&#x27;) {
            $fileShowContainer.append(&#x60;
    &lt;div&gt;
        &lt;audio src=&quot;${fileShowItemLink}&quot; controls=&quot;controls&quot;&gt;&lt;/audio&gt;
    &lt;/div&gt;&#x60;);
        } else if (fileTypeText == &#x27;архив&#x27; || fileTypeText == &#x27;archive&#x27; || fileTypeText == &#x27;archivos&#x27;) {
            insertBadge($fileShowContainer, archiveImage);
        } else if (fileTypeText == &#x27;документ&#x27; || fileTypeText == &#x27;document&#x27; || fileTypeText == &#x27;documentos&#x27;) {
            insertBadge($fileShowContainer, getDocIcon(fileNameStr, docsInfo));
        }

        getFileLink(pageFileLink, $fileShowContainer);

    });


    function insertBadge($container, badge) {

        if (!badge) return;

        $container.prepend(&#x60;
            &lt;div style=&quot;display: inline-block; width: 40px; height: 40px; margin: 0 10px 5px 0;&quot;&gt;
                &lt;img src=&quot;${badge}&quot; width=&quot;100%&quot;&gt;
            &lt;/div&gt;&#x60;);
    }

    function getDocIcon(fileName, docsInfo) {

        const extension = fileName.match(/\.([^.]+)$|$/)[1];

        if (!extension) return false;

        for (key in docsInfo) {
            if (docsInfo[key][&#x27;exts&#x27;].includes(extension)) {
                return docsInfo[key][&#x27;icon&#x27;];
            }
        }

        return false;

    }

    function getFileLink(fileToLink, $container) {

        $.get(fileToLink, function (data) {

            const htmlPage = $(&#x27;&lt;div&gt;&lt;/div&gt;&#x27;).html(data);

            $container.append(htmlPage.find(&#x27;.col-md-10 &gt; input[type=&quot;text&quot;]&#x27;).css({ &quot;display&quot;: &quot;block&quot;, &quot;height&quot;: 0, &quot;padding&quot;: 0, &quot;opacity&quot;: 0, &quot;border&quot;: 0 }));
            $container.append(&quot;&lt;button class=&#x27;btn btn-success btn_copy&#x27; style=&#x27;display:block; margin-top:5px;&#x27;&gt;&lt;i class=&#x27;fa fa-copy&#x27;&gt;&lt;/i&gt; Копировать ссылку&lt;/button&gt;&quot;);


            $container.on(&#x27;click&#x27;, (e) =&gt; {
                if (e.target &amp;&amp; ($(e.target).hasClass(&#x27;btn_copy&#x27;) || $(e.target).hasClass(&#x27;form-control&#x27;))) {


                    $(e.target).parent().find(&#x27;input&#x27;)[0].select();
                    document.execCommand(&#x27;copy&#x27;);


                    $(e.target).parent().find(&#x27;.btn_copy&#x27;).html(&#x27;&lt;i class=&quot;fa fa-check-square&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; Скопированна&#x27;).addClass(&#x27;btn-info&#x27;);

                }
            });
        });

    }

    $(&#x27;.uploadify-container&#x27;).data(&#x27;uploadifive&#x27;).settings.onUploadComplete = function (e, fileHashNameStr) {

        const $item = e.queueItem;
        const link = &#x60;/fileservice/control/account/file-by-hash?hash=${fileHashNameStr}&amp;from=storage&#x60;;

        $item.find(&#x27;.fileinfo&#x27;).html(&#x60; &lt;a target=&quot;_blank&quot; href=&quot;${link}&quot;&gt;${fileHashNameStr}&lt;/a&gt; &#x60;);

        $.get(link, (data) =&gt; {


            const pageHtml = $(&#x27;&lt;div&gt;&lt;/div&gt;&#x27;).html(data),

                fileLinkStr = pageHtml.find(&#x27;input.form-control[type=&quot;text&quot;]&#x27;).val(),
                inputEl = document.createElement(&#x27;input&#x27;),
                spanEl = document.createElement(&#x27;span&#x27;);

            $item.find(&#x27;span.filename&#x27;).before(spanEl);
            $item.find(&#x27;span.filename&#x27;).after(inputEl);
            $(inputEl).attr(&#x27;type&#x27;, &#x27;text&#x27;).val(fileLinkStr).css({ &quot;display&quot;: &quot;block&quot;, &quot;height&quot;: 0, &quot;padding&quot;: 0, &quot;opacity&quot;: 0, &quot;border&quot;: 0 });


            $(spanEl).html(&#x27;&lt;i class=&quot;fa fa-copy&quot;&gt;&lt;/i&gt; &#x27;)
                .css({ &quot;cursor&quot;: &quot;pointer&quot;, &quot;font-size&quot;: &quot;20px&quot; }).on(&#x27;click&#x27;, function () {
                    inputEl.select();
                    document.execCommand(&#x27;copy&#x27;);
                    $(spanEl).css(&#x27;color&#x27;, &quot;#45dc4b&quot;);
                });
        });

    }


});</pre>
  <p id="ekRY"></p>
  <h3 id="K7d2">Как вставить код на геткурс</h3>
  <p id="d3f0"></p>
  <p id="keFA"><em>Способ 1. Через подключение темы в настройках аккаунта</em></p>
  <p id="fTVH">При таком способе скрипт будет выполняться для всех админов в аккаунте</p>
  <p id="fEyc"></p>
  <p id="WZd3"><em>Последовательность:</em></p>
  <p id="RctR">Добавить тему</p>
  <figure id="6hai" class="m_column">
    <img src="https://img3.teletype.in/files/ee/d6/eed60e5c-2979-472d-bee1-f7dd5ff820f5.png" width="1358" />
  </figure>
  <p id="uhjs">Вставить код во вкладке JS</p>
  <figure id="IUlt" class="m_column">
    <img src="https://img2.teletype.in/files/14/ae/14ae7404-4a80-46f9-87fb-d5dfc34ec50d.png" width="1253" />
  </figure>
  <p id="tpbI">Сохранить</p>
  <p id="dlXA">Скопировать ссылку на js файл</p>
  <figure id="TQX9" class="m_column">
    <img src="https://img4.teletype.in/files/33/b1/33b18475-22f5-4aba-bfef-a951e775ffb9.png" width="1212" />
  </figure>
  <p id="RmPr">Подключить в настройки аккаунта в скрипты для BODY</p>
  <pre id="GA5M" data-lang="html">&lt;!-- Скрипт для файлового хранилища --&gt;
&lt;script src=&quot;ССЫЛКА_НА_ТЕМУ&quot;&gt;&lt;/script&gt;</pre>
  <p id="Mmsg"></p>
  <p id="dsnY"><em>Способ 2 Подключить файл js из хранилища</em></p>
  <p id="xIb8">Подключить в настройки аккаунта в скрипты для BODY</p>
  <pre id="pSum" data-lang="html">&lt;!-- Скрипт для файлового хранилища v1.0 --&gt;
&lt;script src=&quot;https://fs.getcourse.ru/fileservice/file/download/a/608456/sc/251/h/9690e8beee22036e4f2a9eaf95dc7122.js&quot;&gt;&lt;/script&gt;</pre>
  <p id="5c0I"></p>
  <p id="eYyt">Файл закружен в хранилище геткурса, также можно загрузить js файл в свое хранилище на аккаунте и вставить ссылку в атрибут <em>src</em></p>
  <p id="PlP5">Скачать файл можно по ссылке:</p>
  <p id="RWBo"><a href="https://drive.google.com/file/d/1mRQr8aczrmGEZ_1X8sJSTSjY1U57-m7k/view?usp=share_link" target="_blank">https://drive.google.com/file/d/1mRQr8aczrmGEZ_1X8sJSTSjY1U57-m7k/view?usp=share_link</a></p>
  <p id="kLH7"></p>
  <p id="igWK"></p>
  <p id="rf5F"><em>Способ 3. Подключить скрипт локально в своем браузере</em></p>
  <p id="0iWS">При подключении скрипта локально скрипт будет выполняться только у вас в браузере</p>
  <p id="2YUT"></p>
  <p id="fmzq">Например, можно использовать расширение для хрома <em>User JavaScript and CSS </em></p>
  <p id="z0kF"><a href="https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld" target="_blank">https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld</a></p>
  <p id="AvuX"></p>
  <p id="K3Ho">Добавляем скрипт в расширение в поле JS</p>
  <figure id="MuFq" class="m_column">
    <img src="https://img2.teletype.in/files/d8/3b/d83b81a5-3323-4c34-855a-64658b6f42d2.png" width="1920" />
  </figure>
  <p id="ndzP">Включаем</p>
  <figure id="YVJU" class="m_original">
    <img src="https://img4.teletype.in/files/3f/a2/3fa28f6d-e3f9-465b-bfb5-bf4f327a90da.png" width="613" />
  </figure>
  <p id="CNE3">Обновляем страницу и смотрим результат</p>
  <p id="CHZK"></p>
  <p id="YnrD"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="vrBZ">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
    <p id="z6AN">Youtube: <a href="https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg" target="_blank">https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg</a></p>
    <p id="UbUk">VK: <a href="https://vk.com/getcomponent" target="_blank">https://vk.com/getcomponent</a></p>
    <p id="LNlx">Нельзяграм: @maximilia_n</p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/send-response-after-submitting-questionnaire</guid><link>https://teletype.in/@aston_max/send-response-after-submitting-questionnaire?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/send-response-after-submitting-questionnaire?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Отправляем задание урока после заполнения анкеты. Скрипт для getcourse</title><pubDate>Thu, 24 Nov 2022 11:09:47 GMT</pubDate><media:content medium="image" url="https://img4.teletype.in/files/3c/92/3c9287d2-9d18-4dd1-bcd7-e1afe792dc30.png"></media:content><category>Getcourse scripts</category><description><![CDATA[<img src="https://img4.teletype.in/files/bf/af/bfaf266d-6853-4a39-b3a6-1042998c6470.png"></img>Изначально понадобится сделать:]]></description><content:encoded><![CDATA[
  <figure id="OCCo" class="m_column">
    <iframe src="https://www.youtube.com/embed/xKQVlldMGjo?autoplay=0&loop=0&mute=0"></iframe>
  </figure>
  <p id="VaMs">Изначально понадобится сделать:</p>
  <ul id="ZubX">
    <li id="GA4N">Урок с заданием (стандартное поле задания и автопринятие ответа)</li>
    <li id="o0xW">Блок с анкетой в уроке</li>
  </ul>
  <p id="oqTV"></p>
  <nav>
    <ul>
      <li class="m_level_1"><a href="#qMIe">Шаг 1. Подключаем JS код на страницу урока</a></li>
      <li class="m_level_1"><a href="#4kyY">Шаг 2. Вызываем скрипт после отправки анкеты</a></li>
      <li class="m_level_1"><a href="#M653">Шаг 3. Скрываем блок ответа</a></li>
    </ul>
  </nav>
  <p id="6gHX"></p>
  <h3 id="qMIe">Шаг 1. Подключаем JS код на страницу урока</h3>
  <p id="ZnDq"></p>
  <p id="zxvb">JS-код v1.1:</p>
  <pre id="b608" data-lang="javascript">
// ОТПРАВЛЯЕМ ДЗ ЧЕРЕЗ СКРИПТ
function sendLessonAnswer(answerText = &quot;Анкета отправлена&quot;) {

  const link = window.location.href;

  // Проверка на нахождение внутри урока
  if (link.indexOf(&quot;teach/control/lesson/&quot;) === -1) return;


  // Проверка на наличие блока с заданием ( если находимся в веб-браузере )
  if (link.indexOf(&quot;teach/control/lesson/view&quot;) !== -1 &amp;&amp; $(&quot;#LessonAnswer_answer_text&quot;).length == 0) return;


  // Проверка на наличие блока с вкладкой &quot;Задание&quot; ( если находимся в приложении )
  if (link.indexOf(&quot;teach/control/lesson/webview&quot;) !== -1 &amp;&amp; $(&quot;nav.mode-selector a[data-mode=&#x27;mission&#x27;]&quot;).length == 0) return;

  // .. если проверки пройдены

  // Формируем параметры запроса
  const dataPost = { &quot;LessonAnswer[answer_text]&quot;: answerText, &quot;send-answer&quot;: &quot;&quot; };

  // Делаем запрос (Отправка ДЗ)
  $.post(link, dataPost);

}


 </pre>
  <p id="iGpm"></p>
  <p id="JPFj">Код можно вставить в JS-блок на странице урока либо подключить через тему (рекомендуется).</p>
  <pre id="XMLu">&lt;script src=&quot;ССЫЛКА_НА_ТЕМУ&quot;&gt;&lt;/script&gt;</pre>
  <figure id="aFfh" class="m_column">
    <img src="https://img4.teletype.in/files/bf/af/bfaf266d-6853-4a39-b3a6-1042998c6470.png" width="1620" />
  </figure>
  <p id="crw6">Пример</p>
  <p id="OyWn">Подключение темы в блоке HTML:</p>
  <pre id="48TQ" data-lang="html">&lt;!--[JS] Автоматически отправить ответ в уроке --&gt;
&lt;script src=&quot;/pl/cms/layout/js?id=21248&amp;hash=a7dc761c666dd70b4aba1e9329b518c2&amp;bundle=1&quot;&gt;&lt;/script&gt;</pre>
  <p id="XCLr"><em>* в src ставить ссылку без домена на вашу тему</em></p>
  <p id="jzwE"></p>
  <p id="MD4h">Если уроков с отправкой задания после заполнения анкеты будет много, то можно подключить тему с нашей функцией глобально в <em>Настройки аккаунта --&gt; Счетчики и прочие скрипты для BODY (применяются в течение 10 минут )</em></p>
  <p id="iV17"></p>
  <p id="hVd7"></p>
  <h3 id="4kyY">Шаг 2. Вызываем скрипт после отправки анкеты</h3>
  <p id="BCFv"></p>
  <p id="CfEH">В обработчике анкеты выбираем &quot;Произвольное действие&quot; → &quot;Вызов Javascript&quot;</p>
  <figure id="li5C" class="m_original">
    <img src="https://img2.teletype.in/files/94/e4/94e4b405-4c70-4f85-9bdd-aa116b5b785a.png" width="600" />
  </figure>
  <p id="vZkH"></p>
  <p id="F5Ne">В поле &quot;Javascript&quot; пишем вызов функцию</p>
  <pre id="MS0s" data-lang="javascript">sendLessonAnswer();</pre>
  <p id="9nZY"></p>
  <p id="0O8o">Опционально:</p>
  <pre id="0xb4" data-lang="javascript">sendLessonAnswer(&quot;Анкета заполнена и отправлена&quot;);</pre>
  <p id="zUF6">В параметры функции можно передать строку, эта строка будет в ответе к заданию. Если не передавать строку, то по умолчанию ответ в уроке будет &quot;Анкета отправлена&quot; (в функции можно изменить ответ по умолчанию)</p>
  <p id="bY3p"></p>
  <p id="UB1q">Если на данном этапе протестировать, то после заполнения анкеты:</p>
  <ul id="DJcF">
    <li id="vFR2">анкета и задание отправляется</li>
    <li id="n4M0">страница перезагружаться</li>
    <li id="A3h0">ответ принят автоматически</li>
  </ul>
  <p id="yMF0"></p>
  <p id="ByLq">Само поле для ответа нужно скрыть, чтобы ученики не отправляли ответы без заполнения анкеты. Это можно сделать с помощью CSS.</p>
  <p id="THfJ"></p>
  <h3 id="M653">Шаг 3. Скрываем блок ответа</h3>
  <p id="tNGE"></p>
  <p id="a3Ds">Вариант 1</p>
  <p id="nkIC">В редактировании урока блоку с заданием прописываем класс <em>view-collapsed </em>Этот класс скроет видимость всего блока с заданием при просмотре</p>
  <figure id="BncO" class="m_column">
    <img src="https://img2.teletype.in/files/5a/21/5a2187cf-bf63-4118-bc26-e496ce2e665b.png" width="1038" />
  </figure>
  <p id="qfj7"></p>
  <p id="FV4P">Вариант 2</p>
  <p id="BeHo">Для показа текста задания и блока статуса задания после отправки</p>
  <p id="2dHi">Написать текст задания, например:  <em>Заполните и отправьте анкету</em></p>
  <figure id="6R8K" class="m_column">
    <img src="https://img2.teletype.in/files/db/d7/dbd786b3-54a6-4fb5-9ac6-08534e755085.png" width="875" />
  </figure>
  <p id="xIPd">В подробные настройки блока &quot;Задание&quot;:</p>
  <figure id="TOjn" class="m_column">
    <img src="https://img1.teletype.in/files/4b/20/4b201374-e8ac-4d5d-8bfa-a22d4bc92c09.png" width="1783" />
  </figure>
  <p id="7nLg">CSS </p>
  <pre id="lZJa" data-lang="css">/* Скрываем поля ответа в уроке */
.lesson-send-answer-block {
    display: none;
}</pre>
  <p id="TKrB">или подключить этот стиль через тему</p>
  <pre id="p7Pk" data-lang="css">@import url(&quot;/pl/cms/layout/css?id=21248&amp;hash=8ac884e322f5a4e345f338722db1cd29&amp;bundle=1&quot;);</pre>
  <figure id="1NQF" class="m_column">
    <img src="https://img1.teletype.in/files/c8/51/c851de6a-6c2b-4214-a847-f8faa97ca3e0.png" width="913" />
  </figure>
  <figure id="bWHi" class="m_column">
    <img src="https://img2.teletype.in/files/92/76/9276da5e-740f-40c1-ac65-c875b19d330a.png" width="885" />
    <figcaption>Показываем ученику &quot;Задание принято&quot;</figcaption>
  </figure>
  <figure id="ccsv" class="m_column">
    <img src="https://img1.teletype.in/files/45/cd/45cdac44-9c52-4be2-a2e1-ee68f73e55e2.jpeg" width="1080" />
  </figure>
  <p id="UQdn"></p>
  <p id="0CRL"><em>Доп. информация:</em></p>
  <p id="t9og">Версия JS 1.1<br />Работает в приложении Getcourse</p>
  <p id="SeuE">Анкету можно скрыть по сегменту. В сегмент включить тех, кто выполнил урок(&quot;Ответ принят&quot;)</p>
  <p id="aRNk"></p>
  <p id="96J3"></p>
  <p id="atGY">Готово ✨</p>
  <p id="mYxn">Обязательно все внимательно проверьте и протестируйте  </p>
  <p id="05C0"></p>
  <p id="loaX"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="vrBZ">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
    <p id="z6AN">Youtube: <a href="https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg" target="_blank">https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg</a></p>
    <p id="UbUk">VK: <a href="https://vk.com/getcomponent" target="_blank">https://vk.com/getcomponent</a></p>
    <p id="LNlx">Нельзяграм: @maximilia_n</p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/timecodesForPlyrOnGetcourse</guid><link>https://teletype.in/@aston_max/timecodesForPlyrOnGetcourse?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/timecodesForPlyrOnGetcourse?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Делаем плеер с таймкодами на getcourse с помощью плагина Plyr и скриптов</title><pubDate>Mon, 14 Nov 2022 20:36:59 GMT</pubDate><media:content medium="image" url="https://img2.teletype.in/files/d6/a8/d6a858af-1d75-4917-a481-dcbb8eb74184.png"></media:content><category>Оформление геткурс</category><description><![CDATA[<img src="https://img2.teletype.in/files/14/7c/147c8731-5aac-43be-9997-87abd1fc53b5.png"></img>Плеер с таймкодами делаем используя &quot;Визуальный конструктор&quot; геткурса т.е. можно разместить видео в уроках или на страницах.]]></description><content:encoded><![CDATA[
  <nav>
    <ul>
      <li class="m_level_1"><a href="#o28X">Шаг 1. Подключаем Plyr</a></li>
      <li class="m_level_1"><a href="#g0Wl">Шаг 2. Вставляем видео в HTML</a></li>
      <li class="m_level_1"><a href="#bY3Z">Шаг 3. Вставляем JS-код</a></li>
      <li class="m_level_1"><a href="#2PGX">Шаг 4. Заголовок-контейнер для таймкодов на геткурс</a></li>
      <li class="m_level_1"><a href="#mPN0">Шаг 5. Добавляем стилизацию</a></li>
    </ul>
  </nav>
  <p id="KM3g">Плеер с таймкодами делаем используя &quot;Визуальный конструктор&quot; геткурса т.е. можно разместить видео в уроках или на страницах.</p>
  <p id="ikbo"></p>
  <p id="9tFi"><em>Что мы будем использовать:</em></p>
  <ol id="frte">
    <li id="mfrK">Визуальный конструктор геткурса(можно вставлять плеер на страницы и в уроки)</li>
    <li id="gyCJ">Plyr плеер (Ссылка на документацию: <a href="https://github.com/sampotts/plyr" target="_blank">https://github.com/sampotts/plyr</a> )</li>
    <li id="Jynm">HTML(для вставки видео), CSS и JS(в геткурсе по умолчанию подключен JQuery)</li>
  </ol>
  <p id="B510"></p>
  <figure id="iyhr" class="m_column">
    <iframe src="https://www.youtube.com/embed/q0ax0fc6vvI?autoplay=0&loop=0&mute=0"></iframe>
  </figure>
  <p id="Zbnc"></p>
  <h3 id="o28X">Шаг 1. Подключаем Plyr</h3>
  <p id="hXjI"></p>
  <p id="hhbl">HTML:</p>
  <pre id="jvrh" data-lang="html">&lt;!-- plyr 3.7.2 --&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.plyr.io/3.7.2/plyr.css&quot; /&gt;
&lt;script src=&quot;https://cdn.plyr.io/3.7.2/plyr.polyfilled.js&quot;&gt;&lt;/script&gt;</pre>
  <p id="Cjq4"></p>
  <p id="fReo">Подключение Plyr на Getcourse страницу, варианты: </p>
  <p id="snbh">1. В поле страницы <em>Теги в разделе HEAD </em></p>
  <figure id="Xlhw" class="m_column">
    <img src="https://img2.teletype.in/files/14/7c/147c8731-5aac-43be-9997-87abd1fc53b5.png" width="1378" />
    <figcaption>Пример вставки кода для подключиения Plyr в &quot;Теги в разделе HEAD&quot;</figcaption>
  </figure>
  <p id="oN3u">ИЛИ</p>
  <p id="b8Om">2. В HTML блок наверху страницы</p>
  <figure id="4Spz" class="m_column">
    <img src="https://img2.teletype.in/files/10/36/10364116-89d5-4ae4-acbe-a84909970a91.png" width="1503" />
    <figcaption>Пример вставки кода для подключиения Plyr в &quot;HTML блок&quot;</figcaption>
  </figure>
  <p id="5QjN"></p>
  <h3 id="g0Wl">Шаг 2. Вставляем видео в HTML</h3>
  <p id="hp4h"></p>
  <pre id="skDT" data-lang="html">&lt;video id=&quot;player&quot; playsinline controls&gt;
  &lt;source src=&quot;https://fs.getcourse.ru/fileservice/file/download/a/581768/sc/356/h/ed8c52d4e70d8cc5da72ac875e88b65f.mp4&quot; type=&quot;video/mp4&quot; /&gt;
&lt;/video&gt;</pre>
  <p id="zCwB"><em>*где  src=&quot;ССЫЛКА_НА_ВИДЕО_ИЗ_ГЕТКУРС_ХРАНИЛИЩА&quot;</em></p>
  <p id="03cW"><em>id=&quot;<strong>player</strong>&quot;  -  <strong>player </strong>это идентификатор, по которому мы скриптом обращаемся к видео</em></p>
  <p id="9E69"></p>
  <figure id="vE6P" class="m_column">
    <img src="https://img1.teletype.in/files/08/ab/08abae63-a957-47a5-84d5-8e4afd4b3c46.png" width="833" />
  </figure>
  <figure id="zsiR" class="m_column">
    <img src="https://img3.teletype.in/files/a9/ee/a9ee2020-2f67-4f62-832f-c2e0b130c5bf.png" width="1555" />
  </figure>
  <p id="Ke6G"></p>
  <h3 id="bY3Z">Шаг 3. Вставляем JS-код</h3>
  <p id="R5g5"></p>
  <p id="V2j6">Для того, чтобы на данном этапе убедиться что мы все делаем правильно, вставляем в JS-блок код</p>
  <pre id="WdgU" data-lang="javascript">const player = new Plyr(&#x27;#player&#x27;);</pre>
  <p id="F8BC"></p>
  <figure id="zTU9" class="m_column">
    <img src="https://img3.teletype.in/files/6f/29/6f299cb4-7485-4030-bce0-83aa7db76f8a.png" width="1500" />
  </figure>
  <figure id="KSq1" class="m_column">
    <img src="https://img4.teletype.in/files/f5/e5/f5e53b51-4d93-407b-86a9-fe551b25d7fc.png" width="1363" />
  </figure>
  <p id="bGBW"><em>*Javascript-блок должен находиться ниже чем блок с видео</em></p>
  <p id="m162"></p>
  <p id="eHhI">Сохраняем -&gt; Проверяем</p>
  <figure id="yXGc" class="m_column">
    <img src="https://img4.teletype.in/files/bc/ef/bcef130c-19be-4138-aca5-32ab851dee49.png" width="853" />
  </figure>
  <p id="QA4F">Если в нашем видео интерфейс плеера Plyr, значит мы подключили и инициализировали его правильно.</p>
  <p id="3di4"></p>
  <p id="4PTB">Очищаем JS поле, вместо него ставим</p>
  <p id="XxJB">JS-код:</p>
  <p id="e6ZL"></p>
  <pre id="e6ZL" data-lang="javascript">
/*  
@name timecodesForPlyrOnGetcourse  
@author Maksim Kalmykov  
@version 1.0
*/

$(function () {


  const timecodesArr = [
    {
      time: &quot;00:06&quot;,
      label: &quot;Чебурашка начинает петь&quot;
    },

    {
      time: &quot;00:25&quot;,
      label: &quot;Чебурашка летит в пузыре&quot;
    },
    {
      time: &quot;00:40&quot;,
      label: &quot;Чебурашка крутит юлу&quot;
    },
    {
      time: &quot;01:21&quot;,
      label: &quot;Чебурашка и Гена играют в шахматы&quot;
    }

  ];


  initPlyr(&quot;#player&quot;, timecodesArr, &quot;.timecodes-title&quot;);


});


function initPlyr(plyrVideoSelector, timecodesArr = [], timecodeTitleSelector = null) {

  const videoPlayer = document.querySelector(plyrVideoSelector);

  if (!videoPlayer) return;

  const timecodesTitle = document.querySelector(timecodeTitleSelector);

  const timecodesContent = document.createElement(&quot;div&quot;);
  timecodesContent.className = &quot;timecodes-ac-content&quot;;


  timecodesArr.forEach(item =&gt; {
    timecodesContent.innerHTML += &#x60;
&lt;p class=&quot;timecode_item&quot;&gt;
&lt;span class=&quot;item_time&quot;&gt;${item.time}&lt;/span&gt;
&lt;span class=&quot;item_desc&quot;&gt;${item.label}&lt;/span&gt;
&lt;/p&gt;
&#x60;;
  });


  const timecodesArrForPlyr = timecodesArr.reduce((acc, curr) =&gt; {
    curr.time = parseTimeInSeconds(curr.time);
    acc.push(curr);
    return acc;
  }, []);


  const player = new Plyr(videoPlayer, {
    markers: {
      enabled: true,
      points: timecodesArrForPlyr
    }
  });

  timecodesContent.querySelectorAll(&quot;.timecode_item&quot;).forEach((timecode, i) =&gt; {

    timecode.addEventListener(&quot;click&quot;, function () {
      player.currentTime = timecodesArrForPlyr[i].time;
    });

  });


  if (timecodesTitle &amp;&amp; timecodesArr.length) {
    timecodesTitle.append(timecodesContent);
  }

  if ($(timecodesTitle).hasClass(&quot;timecodes-ac-trigger&quot;)) {
    $(timecodesTitle).find(&quot;.f-header&quot;).on(&quot;click&quot;, function () {
      $(this).toggleClass(&quot;active&quot;);
      $(this).next().slideToggle();
    });
  }
}


function parseTimeInSeconds(timeStr) {

  let s = 0;

  if (typeof timeStr !== &quot;string&quot;) return s;

  const arrTime = timeStr.split(&#x27;:&#x27;);

  if (arrTime.length === 2) {
    s = parseInt(arrTime[0]) * 60 + parseInt(arrTime[1]);
  } else if (arrTime.length === 3) {
    s = parseInt(arrTime[0]) * 60 * 60 + parseInt(arrTime[1]) * 60 + parseInt(arrTime[2]);
  }

  return s;

}
</pre>
  <p id="uZql"></p>
  <p id="mkbw"><em>P.S. Уже просматривая видео решил что лучше будет если порядок аргументов в функции будет такой: </em></p>
  <p id="aw9U"><code>initPlyr(&quot;#player&quot;, timecodesArr, &quot;.timecodes-title&quot;);</code></p>
  <p id="CXOB"><em>(массив объектов таймкодов стал вторым а селектор заголовка 3-м)</em></p>
  <p id="ntYM"></p>
  <p id="xfhb">timecodesArr - массив объектов, в котором через запятую прописаны свойства конкретного таймкода. В этом массиве мы ставим свои значения. Эти значения подтянутся скриптом в метки на видео и в html код внутри контейнера указанного заголовка таймкодов.</p>
  <pre id="m8cx" data-lang="javascript">
  const timecodesArr = [
    {
    
      time: &quot;00:06&quot;, // Время таймкода
      label: &quot;Чебурашка начинает петь&quot; // Описаине таймкода
    }

  ];
</pre>
  <p id="zq75"></p>
  <p id="aDRn"></p>
  <pre id="zvpo" data-lang="javascript">  initPlyr(&quot;#player&quot;, timecodesArr, &quot;.timecodes-title&quot;);</pre>
  <p id="llr6"></p>
  <p id="OWx5"><code>initPlyr(&quot;<em>*CЕЛЕКТОР_ЭЛЕМЕНТА_ВИДЕО*</em>&quot;, <em>*МАССИВ_ОБЪЕКТОВ_ТАЙМКОДОВ*,</em> &quot;<em>*CЕЛЕКТОР_ЗАГОЛОВКА_ТАЙМКОДОВ*</em>&quot;);</code></p>
  <p id="h5Dj"></p>
  <h3 id="2PGX">Шаг 4. Заголовок-контейнер для таймкодов на геткурс</h3>
  <p id="iNYb"></p>
  <p id="Ghpp">В данном решении мы прописываем таймкоды в объекте timecodesArr, эти данные  пойдут в настройки плеера, а также под них подготовится html-разметка.</p>
  <p id="I6mk">Для того, чтобы вставить html-разметку таймкодов, нам нужно привязаться к какому либо контейнеру на странице. Этим контейнером будет блок геткурс с заголовком, скрипт найдет его по определенному классу(например <em>timecodes-title</em>)</p>
  <p id="sqJ8"></p>
  <p id="bI9I">Создаем заголовок на геткурс стандартным способом</p>
  <figure id="KUZc" class="m_original">
    <img src="https://img1.teletype.in/files/47/55/47558a31-cf22-45a7-aaa6-abc35a5b594e.png" width="530" />
  </figure>
  <p id="6KMZ"></p>
  <p id="JM6L">Ставим блоку с заголовком класс -  <em>timecodes-title</em></p>
  <figure id="yJHE" class="m_original">
    <img src="https://img1.teletype.in/files/42/c4/42c4bfa1-30f2-4891-9b96-08be61a268e7.png" width="550" />
  </figure>
  <p id="bbiX">Сохраняем</p>
  <figure id="99JD" class="m_column">
    <img src="https://img2.teletype.in/files/91/ce/91ce65e6-fcc9-4c80-8392-611d32483c76.png" width="910" />
  </figure>
  <p id="RFtj">Возле заголовка автоматически появилась разметка с таймкодами, и они даже работают при клике, но не хватает стилизации</p>
  <p id="RX0W"></p>
  <h3 id="mPN0">Шаг 5. Добавляем стилизацию</h3>
  <p id="mMIb"></p>
  <p id="X1n1">CSS-стили</p>
  <pre id="mGUE" data-lang="css">/* Подключение шрифта Montserrat 400;700 */
@import url(&#x27;https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&amp;display=swap&#x27;);


:root {

  /* Основной цвет плеера */
  --plyr-color-main: #C96BFF;

  --fontTimecodes: &quot;Montserrat&quot;, &quot;proxima-nova&quot;, sans-serif;
}


.plyr__progress .plyr__tooltip {
  
/* Ширина тултипов */
  width: 160px;
}


.timecodes-title p,
.timecode_item {
  font-family: var(--fontTimecodes);
}

.timecodes-title .f-header {
  font-size: 24px;
  padding-bottom: 15px;
}

.timecode_item {
  padding: 4px 0;
  font-size: 16px;
  display: flex;
  cursor: pointer;
}

.timecode_item span {
  display: inline-block;
  line-height: 1.2;
}


.timecode_item .item_time {
  margin-right: 8px;
  flex:0 0 50px;
  font-weight: 700;

  /* Цвет времени в таймкоде*/
  color: #4848ee;
  transition: color .4s ease;
}


.timecode_item:hover .item_time {
  /* Цвет времени в таймкоде при наведении*/
  color: var(--plyr-color-main);
}

@media (max-width: 375px) {
  .timecode_item {
    font-size: 14px;
  }
}



/* СТИЛИ АККОРДЕОНА */
.timecodes-ac-trigger {
  cursor: pointer;
  box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
  border-radius: 4px;
}


.timecodes-ac-trigger .f-header {
  padding: 20px 16px 20px 70px;
  position: relative;
  user-select: none;
}


.timecodes-ac-trigger .f-header::before {
  content: &quot;&quot;;
  width: 40px;
  height: 40px;
  display: inline-block;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50px;
/* Изображение стрелки */
  background-image: url(&quot;https://fs.getcourse.ru/fileservice/file/download/a/581768/sc/243/h/5d184da29d96d2785c216cca452febb3.svg&quot;);
/* Цвет круглого фона стрелки */
  background-color: #ffdda7;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  transition:filter .4s ease, transform .4s ease ;
}

.timecodes-ac-trigger .f-header.active::before {
  transform: translateY(-50%) rotate(180deg);
}

.timecodes-ac-trigger .f-header:hover::before {
  filter: brightness(105%);
}


.timecodes-ac-trigger .timecodes-ac-content {
  display: none;
  padding: 8px 16px 16px 16px;
}


@media (max-width: 375px) {
  .timecodes-ac-trigger .f-header {
    font-size: 18px;
  }

  .timecodes-ac-trigger .f-header::before {
    width: 32px;
    height: 32px;
    background-size: 16px;
  }

  .timecodes-ac-trigger .f-header {
    padding: 15px 15px 15px 60px;
  }

}
/* &lt;/ СТИЛИ АККОРДЕОНА */


</pre>
  <p id="DsP9"></p>
  <p id="iW87">Можно добавить в CSS-блок либо вставить и подключить через тему</p>
  <p id="Snkc"></p>
  <p id="nnSw"></p>
  <p id="Hy37">На данный момент таймкоды и видео выглядят так</p>
  <p id="RpCJ">Простой вариант:</p>
  <figure id="KLIv" class="m_column">
    <img src="https://img1.teletype.in/files/80/86/80861c0d-a718-4ff5-8501-3d1ab7263148.png" width="910" />
  </figure>
  <p id="p0D2"></p>
  <p id="I6CJ">В скрипте и стилях предусмотрен вариант таймкодов в виде выпадающего списка</p>
  <p id="Nbpj">Чтобы инициализировать аккордеон добавляем класс <em>timecodes-ac-trigger</em> в классы заголовка </p>
  <figure id="swf4" class="m_original">
    <img src="https://img3.teletype.in/files/64/02/640260c2-8a50-468f-ae30-e27453400a1d.png" width="553" />
  </figure>
  <p id="e8Wb"></p>
  <p id="WN9h"></p>
  <p id="WA29">Результат:</p>
  <figure id="Bcnk" class="m_column">
    <img src="https://img3.teletype.in/files/2d/f5/2df5ef99-d122-4d5f-aa26-02b06d2850f7.png" width="813" />
  </figure>
  <figure id="7018" class="m_column">
    <img src="https://img2.teletype.in/files/91/98/9198dc87-2e03-4bf8-a6e3-e52f6ade1387.png" width="816" />
  </figure>
  <p id="qGns"></p>
  <p id="pu03"></p>
  <p id="Drbh"><em>Как сделать несколько видео с таймкодами?</em></p>
  <p id="3a5R">Самый простой способ - вызывать несколько функций инициализации плеера с уникальными параметрами</p>
  <p id="ofyB"></p>
  <p id="yfIp">Пример</p>
  <pre id="0i6b" data-lang="javascript">$(function () {


    const timecodesArr1 = [
        {
            time: &quot;00:06&quot;,
            label: &quot;Чебурашка начинает петь&quot;
        },

        {
            time: &quot;00:26&quot;,
            label: &quot;Чебурашка летит в пузыре&quot;
        },
        {
            time: &quot;00:40&quot;,
            label: &quot;Чебурашка крутит юлу&quot;
        },
        {
            time: &quot;01:22&quot;,
            label: &quot;Чебурашка и Гена играют в шахматы&quot;
        }

    ];

    const timecodesArr2 = [
        {
            time: &quot;00:06&quot;,
            label: &quot;2 Чебурашка начинает петь&quot;
        },

        {
            time: &quot;00:26&quot;,
            label: &quot;2 Чебурашка летит в пузыре&quot;
        },
        {
            time: &quot;00:40&quot;,
            label: &quot;2 Чебурашка крутит юлу&quot;
        },
        {
            time: &quot;01:22&quot;,
            label: &quot;2 Чебурашка и Гена играют в шахматы&quot;
        }

    ];


    initPlyr(&quot;#player&quot;, timecodesArr1, &quot;.timecodes-title_1&quot;);

    
    // player2 - id видео в html
    // timecodesArr2 - еще один массив с таймкодами
    // timecodes-title_2 - класс заголовка
    initPlyr(&quot;#player2&quot;, timecodesArr2, &quot;.timecodes-title_2&quot;);

});</pre>
  <p id="4W5u"></p>
  <p id="346V">id видео ставится в html атрибуте  - <em>id</em></p>
  <figure id="q0bv" class="m_original">
    <img src="https://img3.teletype.in/files/29/4f/294f1189-7966-433d-a2ce-a8da0b5d7aab.png" width="470" />
  </figure>
  <p id="2AT5">Уникальный класс для заголовка можно поставить в настройках заголовка</p>
  <figure id="dgAj" class="m_original">
    <img src="https://img3.teletype.in/files/ac/05/ac051fe8-a356-4ebe-86ee-e4d04e3e116a.png" width="548" />
  </figure>
  <p id="POXq"></p>
  <pre id="1h5U">initPlyr(&quot;#player&quot;, timecodesArr1, &quot;.timecodes-title_1&quot;);</pre>
  <p id="nSPv">Передавая параметры в функцию мы решаем, какая сущность к чему относится</p>
  <p id="ym2Y">т.е. #player - инициализируем тот плеер, которого <em>id=&quot;player&quot;</em></p>
  <p id="QLtH">timecodesArr1 - берем именно этот массив таймкодов</p>
  <p id="Etac">&quot;.timecodes-title_1&quot; - контейнером таймкодов будет заголовок с классом <em>timecodes-title_1</em></p>
  <p id="bpee"></p>
  <p id="oWB7"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="vrBZ">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
    <p id="z6AN">Youtube: <a href="https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg" target="_blank">https://www.youtube.com/channel/UCAVwlN_NSAEFR4mJRpzyvCg</a></p>
    <p id="UbUk">VK: <a href="https://vk.com/getcomponent" target="_blank">https://vk.com/getcomponent</a></p>
    <p id="LNlx">Нельзяграм: @maximilia_n</p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/ajol-mGbE9E</guid><link>https://teletype.in/@aston_max/ajol-mGbE9E?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/ajol-mGbE9E?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Геткурс. Оформление блока «Достижение пользователя»</title><pubDate>Sat, 10 Sep 2022 11:57:24 GMT</pubDate><media:content medium="image" url="https://img1.teletype.in/files/40/ee/40ee3a34-31d1-46e5-a212-b65b236b3bb9.png"></media:content><category>Оформление геткурс</category><description><![CDATA[<img src="https://img2.teletype.in/files/d9/70/d9704d11-7523-4df3-8f2d-70fdd2a09ebd.jpeg"></img>Мини-инструкция о том, как можно стилизовать блок &quot;Достижение пользователя в тренинге&quot;]]></description><content:encoded><![CDATA[
  <p id="fQRO">Мини-инструкция о том, как можно стилизовать блок &quot;Достижение пользователя в тренинге&quot;</p>
  <p id="RX85"></p>
  <nav>
    <ul>
      <li class="m_level_1"><a href="#nQJo">Шаг 1. Вставляем CSS код</a></li>
      <li class="m_level_1"><a href="#BDFY">Шаг 2. Меняем видимое пользователю название шкалы</a></li>
      <li class="m_level_1"><a href="#RM9s">Шаг 3. Заменяем слово «балл» с помощью JS-кода </a></li>
    </ul>
  </nav>
  <p id="ll81"></p>
  <p id="e9Xn"></p>
  <p id="E2ry">Прежде чем оформлять данный блок, он должен быть на странице</p>
  <figure id="FrLq" class="m_column">
    <img src="https://img2.teletype.in/files/d9/70/d9704d11-7523-4df3-8f2d-70fdd2a09ebd.jpeg" width="1384" />
    <figcaption>Создание шкалы достижений в тренинге</figcaption>
  </figure>
  <p id="xhrB"></p>
  <figure id="IDvA" class="m_original">
    <img src="https://img1.teletype.in/files/80/92/8092b908-6c63-4aa9-b450-5090bce98451.png" width="535" />
    <figcaption>Вид по умолчанию блока &quot;Достижение пользователя в тренинге&quot;</figcaption>
  </figure>
  <p id="vMjU"></p>
  <p id="U1f5"></p>
  <h2 id="nQJo">Шаг 1. Вставляем CSS код</h2>
  <p id="pH3V"></p>
  <figure id="QNQr" class="m_original">
    <img src="https://img3.teletype.in/files/2e/eb/2eeb29ef-7dbb-4e90-a6c8-82dfbcc26899.jpeg" width="534" />
  </figure>
  <p id="o5o8"></p>
  <figure id="IytO" class="m_column">
    <img src="https://img2.teletype.in/files/54/21/542100b7-68d8-4c59-b742-9bfa10bf920f.png" width="948" />
  </figure>
  <p id="4Rus"><br />CSS-код:</p>
  <pre id="hg2p" data-lang="css">/* Шрифт Montserrat 400, 500, 700 */
@import url(&#x27;https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&amp;display=swap&#x27;);


:root {
  --fontM: &quot;Montserrat&quot;, &quot;proxima-nova&quot;, sans-serif;
}


/* ШКАЛА ДОСТИЖЕНИЙ */

.xdget-trainingAchievements {
  padding: 20px 20px 10px 20px;
  margin: 0 auto;
  border-radius: 12px;
  max-width: 440px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Заголовок блока */
.xdget-trainingAchievements .table&gt;thead&gt;tr&gt;th {
  border: 0;
  padding: 0 0 15px 0;
  font-size: 0;
  font-family: var(--fontM);
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
  text-transform: uppercase;
  color: #333333;
}

/* Меняем строку заголовка */
.xdget-trainingAchievements .table&gt;thead&gt;tr&gt;th::before {
  content: &#x27;Мои достижения&#x27;;
  font-size: 20px;
}


.xdget-trainingAchievements .table&gt;tbody&gt;tr&gt;td {
  padding: 10px 0 10px 0;
  font-family: var(--fontM);
  vertical-align: middle;
}

.xdget-trainingAchievements .table&gt;tbody&gt;tr&gt;td a {
  font-size: 16px;
  color: #242240;
}

/* Элемент с отображением баллов */
.xdget-trainingAchievements .badge {
  margin: 0 !important;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 20px;

  /* Цвет плашки с баллами */
  background-color: #00aa8d;
}


@media (max-width:400px) {
  .xdget-trainingAchievements {
    padding: 15px 15px 10px 15px;
  }

  .xdget-trainingAchievements .table&gt;thead&gt;tr&gt;th {
    padding: 0 0 10px 0;
  }


  .xdget-trainingAchievements .table&gt;thead&gt;tr&gt;th::before {
    font-size: 18px;
  }

  .xdget-trainingAchievements .table&gt;tbody&gt;tr&gt;td a {
    font-size: 14px;
  }

  .xdget-trainingAchievements .badge {
    font-size: 12px;
    padding: 3px 8px;
  }
}

/* &lt;/ ШКАЛА ДОСТИЖЕНИЙ */</pre>
  <p id="EFso"></p>
  <figure id="zhjR" class="m_column">
    <img src="https://img1.teletype.in/files/0e/05/0e05c2f9-3106-4442-91e1-4da77204189b.jpeg" width="1678" />
  </figure>
  <figure id="yNLc" class="m_original">
    <img src="https://img2.teletype.in/files/93/d0/93d08166-d846-49ac-a558-08523f2c045e.jpeg" width="298" />
  </figure>
  <p id="5GnJ"></p>
  <p id="8ZIT">После вставки CSS-кода и сохранения изменений блок принимает такой вид:</p>
  <figure id="HpBU" class="m_column">
    <img src="https://img3.teletype.in/files/6c/77/6c777ab6-0eed-407b-8659-48202ba93731.png" width="910" />
  </figure>
  <p id="ssWR"></p>
  <p id="ZsQi"></p>
  <h2 id="BDFY">Шаг 2. Меняем видимое пользователю название шкалы</h2>
  <p id="DivB"></p>
  <figure id="BqjO" class="m_original">
    <img src="https://img3.teletype.in/files/6f/38/6f383615-688e-4356-87f5-7d2131fe026c.png" width="550" />
  </figure>
  <p id="qw6P">Это название можно изменить с помощью стандартных настроек шкалы в геткурсе</p>
  <figure id="3Z1r" class="m_column">
    <img src="https://img3.teletype.in/files/28/91/28914576-8823-4e6f-97a2-dae2a328dc0b.png" width="1250" />
  </figure>
  <p id="syrZ"></p>
  <p id="xNcN"></p>
  <h2 id="RM9s">Шаг 3. Заменяем слово «балл» с помощью JS-кода </h2>
  <p id="P4CD"></p>
  <p id="zWUK"></p>
  <figure id="M7DH" class="m_original">
    <img src="https://img3.teletype.in/files/6b/f0/6bf009b1-b5b3-44af-95f5-af28e8f16ba8.png" width="510" />
    <figcaption>Стандартное слово - балл</figcaption>
  </figure>
  <p id="NikN"></p>
  <p id="WkNz"><em>Настоить вид <strong>→ </strong>Добавить блок <strong>→</strong>Javascript</em></p>
  <figure id="cRTe" class="m_column">
    <img src="https://img2.teletype.in/files/de/48/de483936-7af3-4a34-b1be-4711a82b8dbe.png" width="1827" />
  </figure>
  <p id="xnm6"></p>
  <p id="MEjn">JS-код:</p>
  <pre id="jybU" data-lang="javascript">$(document).ready(function () {
  $(&#x27;.xdget-trainingAchievements .badge&#x27;).text($(&#x27;.xdget-trainingAchievements .badge&#x27;).text()
    .replace(&#x27;баллов&#x27;, &#x27;кристаллов&#x27;)
    .replace(&#x27;балла&#x27;, &#x27;кристалла&#x27;)    
    .replace(&#x27;балл&#x27;, &#x27;кристалл&#x27;));
});
</pre>
  <p id="hZLv"></p>
  <figure id="OTAr" class="m_original">
    <img src="https://img4.teletype.in/files/bc/ce/bcced0c7-577b-4ec4-8af1-39274150f98d.jpeg" width="688" />
  </figure>
  <figure id="buvU" class="m_original">
    <img src="https://img2.teletype.in/files/93/d0/93d08166-d846-49ac-a558-08523f2c045e.jpeg" width="298" />
  </figure>
  <p id="cQ27"></p>
  <p id="9Hzc">* Вместо слов &quot;кристалл&quot; можно написать свои слова в необходимых склонениях</p>
  <p id="UZdK"></p>
  <p id="5gkd">Наш результат:</p>
  <figure id="K1sN" class="m_column">
    <img src="https://img3.teletype.in/files/6c/30/6c30fe61-f98e-4e0f-8698-8693f2dd5e84.png" width="1300" />
  </figure>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="vrBZ">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
    <p id="UbUk">VK: <a href="https://vk.com/getcomponent" target="_blank">https://vk.com/getcomponent</a></p>
    <p id="LNlx">Нельзяграм: @maximilia_n</p>
  </section>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@aston_max/UeIu50bnN8u</guid><link>https://teletype.in/@aston_max/UeIu50bnN8u?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max</link><comments>https://teletype.in/@aston_max/UeIu50bnN8u?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=aston_max#comments</comments><dc:creator>aston_max</dc:creator><title>Скрываем элементы на геткурсе с помощью кодов</title><pubDate>Tue, 30 Aug 2022 08:32:26 GMT</pubDate><category>Оформление геткурс</category><description><![CDATA[<img src="https://img4.teletype.in/files/fa/34/fa34c220-536e-4beb-92c1-2ce0abdcac2e.jpeg"></img>Выписал несколько кодов по скрытию элементов на геткурсе которые часто приходилось применять на практике]]></description><content:encoded><![CDATA[
  <p id="Hu8C">Выписал несколько кодов по скрытию элементов на геткурсе которые часто приходилось применять на практике</p>
  <p id="h5Py"></p>
  <h2 id="zLHs">Тренинги</h2>
  <h3 id="6lLW">Обратиться к конкретному тренингу в списке тренингов геткурса и скрыть его</h3>
  <p id="wJ9Z"></p>
  <p id="YNqX">CSS-код:</p>
  <pre id="GlOK" data-lang="css">/* Скрыть конкретный тренинг */
.stream-table tr[data-training-id=&quot;635682646&quot;] {
    display: none;
}</pre>
  <p id="hgpA"></p>
  <p id="TtkX">где <em>635682646</em> - это id нужного тренинга.</p>
  <p id="Zcci">Этот id можно взять посмотрев код элемента в панели разработчика</p>
  <figure id="s0JH" class="m_original">
    <img src="https://img4.teletype.in/files/fa/34/fa34c220-536e-4beb-92c1-2ce0abdcac2e.jpeg" width="740" />
  </figure>
  <p id="qics">Или из ссылки на тренинг</p>
  <figure id="9CUp" class="m_original">
    <img src="https://img2.teletype.in/files/90/cc/90cc7881-8f41-49c1-9e16-758949142f2f.jpeg" width="606" />
  </figure>
  <p id="EOgz"></p>
  <h3 id="u230">Скрыть количество уроков в списке тренингов</h3>
  <p id="xQst"></p>
  <figure id="QBL1" class="m_column">
    <img src="https://img1.teletype.in/files/c5/e2/c5e27123-ecda-4e1b-a325-48f26f74e498.png" width="1188" />
  </figure>
  <p id="mCBy">CSS-код:</p>
  <pre id="kESq" data-lang="css">/* Скрыть количество уроков в списке тренингов */
.stream-table tr &gt; td &gt; a &gt; div &gt; b {
  display: none;
}</pre>
  <p id="KRxg"></p>
  <p id="599e"></p>
  <p id="A041"></p>
  <h3 id="EQYi">Скрыть строку имя учителя в списке тренингов</h3>
  <p id="Xnd8"></p>
  <figure id="CN09" class="m_column">
    <img src="https://img3.teletype.in/files/e1/53/e1535bb3-d567-438e-9e40-bafe4ddd6224.png" width="1188" />
  </figure>
  <p id="pIM3">JS код:</p>
  <pre id="r19B" data-lang="javascript">$(function() {
    
    const teacherStr = &quot;Максим Калмыков.&quot;;

    $(&#x60;.stream-table tr &gt; td &gt; a &gt; div:contains(${teacherStr})&#x60;).each((i, el)=&gt; {

        $(el).html($(el).html().replace(teacherStr, &#x27;&#x27;));
    
    });
    
});</pre>
  <p id="8NPq">* где <em>Максим Калмыков. </em>- это строка имени учителя, которая удалится (прописывать внутри кавычек)</p>
  <p id="As4B">* это JS-код, его нужно вставлять в javascript блок</p>
  <p id="FRG8"></p>
  <p id="3sQO"></p>
  <h3 id="ixnc">Скрыть описание тренингов</h3>
  <figure id="4G0j" class="m_column">
    <img src="https://img4.teletype.in/files/f2/1f/f21fb6f5-571f-4219-bb60-c96fd9a90b82.png" width="1188" />
  </figure>
  <p id="8zgs">CSS-код:</p>
  <pre id="1UJ1" data-lang="css">/* Скрыть описание тренингов */
.stream-table tr &gt; td &gt; a &gt; div {
  display: none;
}</pre>
  <p id="iu4E"></p>
  <p id="hFiH"></p>
  <p id="2fen"></p>
  <h2 id="ipUB">Список уроков</h2>
  <p id="qI7x"></p>
  <h3 id="6epq">Скрыть конкретный урок</h3>
  <p id="XlTF">Обратиться к конкретному уроку в списке уроков и скрыть его ( Например, чтобы вынести ссылку на него в отдельную кнопку: правила, расписание и тд. )</p>
  <pre id="v1up" data-lang="css">/* Скрыть конкретный урок */
.lesson-list .lesson-id-253731501 {
  display: none;
}</pre>
  <p id="lgbX">* где <em>253731501</em> - это id урока. Можно взять из ссылки на урок или из элемента в панели разработчика.</p>
  <p id="FVnL"></p>
  <p id="9548"></p>
  <h3 id="Wvx6">Скрыть надпись &quot;Есть задание&quot; в списке уроков</h3>
  <p id="4CTD"></p>
  <figure id="dlWA" class="m_column">
    <img src="https://img1.teletype.in/files/c6/da/c6da22c0-ae32-43be-b34a-d54e76a18713.png" width="1328" />
  </figure>
  <p id="Ehrm">CSS-код:</p>
  <pre id="42B3" data-lang="css">/* Скрыть надпись &quot;Есть задание&quot; в списке уроков */
.lesson-list li.user-state-has_mission .user-state-label:not(.has-start-at):not(.is-stop-lesson) {
  display: none;
} </pre>
  <p id="YzVD"></p>
  <p id="OjKC"></p>
  <h3 id="D5d4">Скрыть надпись &quot;Чтобы получить доступ к следующим урокам, вам необходимо выполнить задание в предыдущем&quot;</h3>
  <p id="Wm8d"></p>
  <figure id="4tqi" class="m_column">
    <img src="https://img4.teletype.in/files/39/dc/39dc7d5e-f620-44b8-a67b-aea9e60b2c9f.png" width="1303" />
  </figure>
  <pre id="xsry" data-lang="css">/* Скрыть надпись в списке уроков &quot;Чтобы получить доступ к следующим урокам, вам необходимо выполнить задание в предыдущем&quot; */
.lesson-list li.divider {
     display: none; 
}</pre>
  <p id="ZaIE"></p>
  <p id="8W64"></p>
  <p id="yVnS"></p>
  <h2 id="WWBA">Внутри урока</h2>
  <p id="mdT4"></p>
  <h3 id="ZrHE">Скрыть количество уроков в шапке урока</h3>
  <p id="uOnd"></p>
  <figure id="hw59" class="m_column">
    <img src="https://img2.teletype.in/files/56/30/5630eb9a-95c8-4265-8122-2527c9e73401.png" width="1183" />
  </figure>
  <p id="pSNZ">CSS-код:</p>
  <pre id="t8qN" data-lang="css">/* Скрыть количество уроков в шапке урока */
.lesson-navigation tbody &gt; tr &gt; td.text-center.hidden-xs &gt; span {
    display: none;
}</pre>
  <p id="wGqq"></p>
  <p id="ueCN"></p>
  <h3 id="3Jov">Скрыть кнопку &quot;Сохранить черновик&quot; в блоке задания</h3>
  <p id="Ypy7"></p>
  <figure id="irRB" class="m_column">
    <img src="https://img3.teletype.in/files/ac/33/ac336e51-8178-46e3-b426-822db2b44aeb.png" width="1183" />
  </figure>
  <p id="xJok"></p>
  <p id="9oGq">CSS-код:</p>
  <pre id="XyCh" data-lang="css">/* Скрыть кнопку &quot;Сохранить черновик&quot; */
.lt-lesson-mission-block .btn-save-draft {
  display: none;
}</pre>
  <p id="RJHW"></p>
  <p id="AnqE"></p>
  <p id="t23q"></p>
  <section style="background-color:hsl(hsl(0, 0%, var(--autocolor-background-lightness, 95%)), 85%, 85%);">
    <p id="vrBZ">Телеграм-канал: <a href="https://t.me/getcomponent" target="_blank">https://t.me/getcomponent</a></p>
    <p id="UbUk">VK: <a href="https://vk.com/getcomponent" target="_blank">https://vk.com/getcomponent</a></p>
    <p id="LNlx">Нельзяграм: @maximilia_n</p>
  </section>

]]></content:encoded></item></channel></rss>