12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- // 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
- // <a href="${html_url}">
- // <img src="${avatar_url}">${login}<a/>
- // for <a href="https://github.com/${owner}/${repo}/commits?author=${login}">${contributions} contributions</a>',
- 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', {});
|