const fs = require('fs');
const path = require('path');
const HTMLParser = require('node-html-parser');
const folderPath = 'html'
fs.readdirSync(folderPath).map(fileName => {
fs.readFile(path.join(folderPath, fileName), 'utf8', function(err, html){
const root = HTMLParser.parse(html);
console.log(root.querySelector('h2').rawText);
});
});
var textTo = document.getElementById('lermontov');
var poesi = textTo.innerHTML;
var xhr = new XMLHttpRequest;
var key ='Ваш ключ -35d211642e6820a07c07d47303a';
var api = 'https://translate.yandex.net/api/v1.5/tr.json/translate';
var textTo = document.getElementById('lermontov');
var poesi = textTo.innerHTML;
var language ='&lang=ru-en';
var url = api+'?';
url += 'key=' + key;
url += '&text='+ encodeURIComponent(textTo.innerHTML);
url += language;
xhr.open('GET',url,true);
xhr.onreadystatechange= function(){
if(xhr.readyState == 4){
if(xhr.status == 200){
console.log(JSON.parse(this.responseText))
document.getElementById('result').innerHTML += this.responseText;
}
}
}
xhr.send()
<ul id="menu" class="menu"></ul>
function MenuView (obj) {
return `<li id="${Object.keys(obj)}">${Object.values(obj)}</li>`
}
const fetchMenu = async (name) =>{
const url = `https://testprese.firebaseio.com/${name}/.json`;
const response = await fetch(url);
return await response.json();
}
(async ()=>{
const menu = await fetchMenu ("menu");
let list = '';
menu.forEach((item) => {list += MenuView(item);});
document.getElementById('menu').innerHTML = list;
})();
function getData() {
const url = 'https://mcapi.ca/query/play.minesuperior.com/info';
const response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
var params = JSON.parse(response.getContentText());
var d = new Date();
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var n =sheet.getRange("A1").getValue()+2;
sheet.getRange("A"+n).setValue(d);
sheet.getRange("B"+n).setValue(params.players.online);
sheet.getRange("A1").setValue(n-1);
}