我正在尝试创建一些网站模板来帮助我提高我的前端开发技能,因为我目前在后端工作方面要好得多.
我试图在某种程度上复制我自己网站的风格(https://thomas-smyth.co.uk/),这是一个简单的Bootstrap模板.但是,我不想在标题中使用静态照片,而是将其替换为Youtube视频.我开始减少我的网站中使用的模板,并将其剥离到我认为我可以得到它而不打破标题.
我在这个地方找到了一些代码来展示如何将Youtube视频设置为整个页面的背景,而不是页面特定部分的背景.我怎样才能做到这一点?注意 - 它必须从YouTube流式传输,因为我的主机不允许我在其服务器上托管视频.
我目前的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>Group Name | Home</title>
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="dist/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!-- Custom -->
<link rel="stylesheet" href="dist/css/mainstyle.css">
</head>
<body>
<header>
<div class="header-content">
<div class="header-content-inner">
<h1>This is going once vid is done.</h1>
</div>
</div> …Run Code Online (Sandbox Code Playgroud) 我正在开发一个 Electron 应用程序,作为界面的一部分,一旦发生某些事情,我想增加窗口的大小(我现在已将其绑定到一个按钮),以便我可以显示其他数据。我尝试使用以下在 a 上激活的代码来执行此操作onclick=resize():
require('./renderer.js');
let remote = require('electron').remote;
function resize() {
let win = remote.getCurrentWindow().setBounds({
height: 1000
});
}
Run Code Online (Sandbox Code Playgroud)
但是,我在窗口/浏览器控制台中收到以下错误:
Uncaught Error: Could not call remote function 'setBounds'. Check that the function signature is correct. Underlying error: Error processing argument at index 0, conversion failure from #<Object>
Error: Could not call remote function 'setBounds'. Check that the function signature is correct. Underlying error: Error processing argument at index 0, conversion failure from #<Object>
at callFunction (C:\Users\Thomas\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\rpc-server.js:257:11) …Run Code Online (Sandbox Code Playgroud) 我正在通过一个小清单来升级我已经完成的网络系统部分的内容,其中之一是确保我的 Google reCaptcha 的安全性是正确的。
目前,我使用此代码:
//reCaptcha
$Url = "https://www.google.com/recaptcha/api/siteverify";
$SecretKey = "----Secret Key----";
$Response = file_get_contents($Url."?secret=".$SecretKey."&response=".$_POST['Response']);
$Robot = json_decode($Response);
Run Code Online (Sandbox Code Playgroud)
这很好用,但是谷歌的文档说你应该使用 POST 方法而不是 get,显然是为了确保有人没有得到我的密钥。但是,我不确定如何执行此操作,因此将不胜感激。我知道我可能不得不使用 cURL,但是,我对此一无所知,我不确定如何安装它(如果需要)。
谢谢,汤姆。
我正在研究 NPM 模块,但我的 babel 配置遇到了问题。我正在使用 ES6,特别是异步/等待、静态类方法和导入/导出。
起初,我得到了一个共同的问题:ReferenceError: regeneratorRuntime is not defined. 因此,我babel-plugin-transform-runtime将其安装为开发依赖项并将其添加到.babelrc. 当需要使用路径名或通过 npm 作为依赖项的模块时,我遇到了错误Error: Cannot find module 'babel-runtime/regenerator'。似乎要解决这个问题,我必须 require babel-runtime,但是,当它是您发布的模块时,很多人似乎建议不要这样做。
在寻找一些指南后,我发现一个建议不要使用导入/导出,所以我尝试了。在本地构建并要求它之后,它就可以工作了。但是,当发布到 npm 并作为依赖项导入时,我继续收到错误:Error: Cannot find module 'babel-runtime/regenerator'.
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^10.0.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"eslint": "^5.12.0",
"eslint-config-prettier": "^3.4.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"husky": "^1.3.1",
"jest": "^23.6.0",
"lint-staged": "^8.1.0",
"nodemon": "^1.18.9",
"prettier": "^1.15.3",
"rimraf": "^2.6.3"
},
Run Code Online (Sandbox Code Playgroud)
{
"presets": [
"env" …Run Code Online (Sandbox Code Playgroud) 我正在为我正在开发的某个系统创建一个界面,我需要围绕系统中其他地方使用的预先存在的 PHP AJAX 函数编写 Javascript(纯粹是因为做我们的数据库工作的人太忙了)使代码适应我的需要)。
使用 Select2,我需要创建一个选择字段,用户在数据库中搜索他们的姓名并选择与其匹配的姓名,以便稍后可以将其发布到另一个 AJAX 函数。我已经使用以下代码完成了此操作:
//<select id="sltMyName" style="width: 100%;"></select>
$("#sltMyName").select2({
ajax: {
type: "POST",
url: "includes/php/report_searchPlayers.php",
delay: 250,
data: function (params) {
return {
q: params.term // search term
};
},
processResults: function (data) {
console.log({ results: data.split(",") });
return { results: data.split(",") };
}
},
minimumInputLength: 1
});
Run Code Online (Sandbox Code Playgroud)
这应该将返回的字符串格式转换name1,name2,name3,name...为 Select2 显示所需的格式,但是,它当前不起作用。下拉菜单仅显示为空白。
我见过一些涉及 text 和 id 属性的问题,但是,它们都在返回的 JSON 字符串的上下文中,所以我不确定这里是否需要它们以及如何在这种上下文中使用它们。此外,我在文档中找不到任何这些内容。
有什么建议么?提前致谢。
返回数据:
Tommy,Jak_Tommy_Lee_Jones,Tommy_Shelby,Tommy_Balboner,TommyCZ,GA_Tommy,VA_Tommy,Tommy_Skrattar,Tommy_Knocker,Tommy_of_Elektro,Tommy_the_Destroyer,Old_Tommy,tommy_of_house_shelby,TommyDermo,TommyC,TommyCash_CZ,Tommyb69k,SA_Tommy,tommyfaster,Tommy_See,Tommy_de_Destroyer,Tommy_of_Whiteroses,TommyShelby,Templar_Intiate_Tommy,Templar_Initiate_Tommy,tommysuckspp,Tommy_the_Overweight