const API_ID = 68 // код свой;
export function injectVKOpenApi() {
return new Promise((resolve, reject) => {
try {
const fjs = document.getElementsByTagName("script")[0];
if (document.getElementById("vk_openapi_js")) {
resolve();
return;
}
const js = document.createElement("script");
js.id = "vk_openapi_js";
js.src = "//vk.com/js/api/openapi.js?160";
js.onload = resolve;
js.onerror = reject;
fjs.parentNode.insertBefore(js, fjs);
} catch (err) {
reject(err);
}
});
}
/**
* This initializes the VK api
* @param {boolean} onlyWidgets
*/
export const initVK = (onlyWidgets = false) => () =>
VK.init({ apiId: API_ID, onlyWidgets });
export const initCallVK = () =>
new Promise((resolve, reject) => {
try {
window.name = "fXD";
VK.init(resolve);
} catch (err) {
reject(err);
}
});
<template>
<div><div id="vk_comments"></div></div>
</template>
<script>
import { injectVKOpenApi, initVK } from "./vknt.js";
export default {
name: "vk-comments",
props: {},
mounted() {
injectVKOpenApi()
.then(initVK(true))
.then(() => {
VK.Widgets.Comments("vk_comments", { limit: 5, attach: "*" });
});
}
};
</script>
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()
<?php
$id=$_GET["q"];
$say_text=$id;
$qs = http_build_query(array("format" => "mp3","lang" => "ru-RU","speaker" => "jane","key" => "ключ","emotion" => "good", "text" => $say_text)); // параметры запроса
$ctx = stream_context_create(array("http"=>array("method"=>"GET","header"=>"Referer: \r\n")));
$soundfile = file_get_contents("https://tts.voicetech.yandex.net/generate?".$qs, false, $ctx); // запрос на генерацию mp3 файла
file_put_contents('1.mp3',$soundfile); //сохраняю
echo($soundfile);
?>
//module2.js
function module2() {
console.log('module2 started);
setTimeout(function () {
setInterval(function () {
console.log(('module2 timer:' + new Date().getTime()));
}, 2000);
}, 1000);
}
module.exports = module2;
//index.js
const module1 = require('./module1'),
module2 = require('./module2');
module1();
module2();
# Mod_Autoindex
<IfModule mod_autoindex.c>
# Запрещаем просмотр содержимого папок
Options -Indexes
</IfModule>
# Mod_Rewrite
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [L,R=301]
# Backend redirect
RewriteCond %{REQUEST_URI} ^/backend
RewriteRule ^backend/(.*)$ backend/web/$1 [L]
# Storage redirect
RewriteCond %{REQUEST_URI} ^/storage
RewriteRule ^storage/(.*)$ storage/$1 [L]
# Frontend redirect
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule ^(.*)$ frontend/web/$1
</IfModule>