// Licensed under a BSD license. See license.html for license /* eslint-disable strict */ 'use strict'; // eslint-disable-line /* global jQuery, settings, contributors */ (function($){ function getQueryParams() { return Object.fromEntries(new URLSearchParams(window.location.search).entries()); } // function replaceParams(str, subs) { return str.replace(/\${(\w+)}/g, function(m, key) { return subs[key]; }); } function showContributors() { // contribTemplate: 'Thank you // // ${login} // for ${contributions} contributions', try { const subs = {...settings, ...contributors[Math.random() * contributors.length | 0]}; const template = settings.contribTemplate; const html = replaceParams(template, subs); const parent = document.querySelector('#forkongithub>div'); const div = document.createElement('div'); div.className = 'contributors'; div.innerHTML = html; parent.appendChild(div); } catch (e) { console.error(e); } } showContributors(); $(document).ready(function($){ if (window.prettyPrint) { window.prettyPrint(); } $('span[class=com]') .addClass('translate yestranslate') .attr('translate', 'yes'); const params = getQueryParams(); if (params.doubleSpace || params.doublespace) { document.body.className = document.body.className + ' doubleSpace'; } $('.language').on('change', function() { window.location.href = this.value; }); if (window.threejsLessonUtils) { window.threejsLessonUtils.afterPrettify(); } }); }(jQuery)); // ios needs this to allow touch events in an iframe window.addEventListener('touchstart', {});