小编Sna*_*rak的帖子

Webmin php-lib.pl修改

我已将PHP版本更新为5.5.26.使用PHP 5.4,我使用FCGI的Apache配置是:

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
Run Code Online (Sandbox Code Playgroud)

使用新版本的PHP我需要将其他配置工作:

<FilesMatch \.php$>
    SetHandler fcgid-script
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)

没关系,它正在发挥作用.

我的问题是Webmin的Virtualmin模块.我不想每次都更改配置,所以我编辑了Perl文件/usr/share/webmin/virtual-server/php-lib.pl:

# Directives for fcgid
local $dest = "$d->{'home'}/fcgi-bin";
#push(@phplines, "AddHandler fcgid-script .php");

# New config for PHP files
push(@phplines, "<FilesMatch \\.php\$>");
push(@phplines, "SetHandler fcgid-script");
push(@phplines, "</FilesMatch>");

push(@phplines, "FCGIWrapper $dest/php$ver.fcgi .php");
foreach my $v (&list_available_php_versions($d)) {
  #push(@phplines,
  #     "AddHandler fcgid-script .php$v->[0]");
  push(@phplines, "FCGIWrapper $dest/php$v->[0].fcgi " . ".php$v->[0]");
}
Run Code Online (Sandbox Code Playgroud)

但是我的改变没有做任何事,Webmin继续推行AddHandler.我重新启动了Webmin,我清除了文件/etc/webmin/module.infos.cache.

php apache perl webmin

24
推荐指数
1
解决办法
646
查看次数

将 TypeScript 声明编译/复制到 out dir

我在 TypeScript 中有一个模块,当它被编译时,它不会复制我的自定义声明文件,例如接口。

配置示例:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "declaration": true,
    "outDir": "./lib",
    "strict": true,
    "typeRoots": ["node_modules/@types"],
    "esModuleInterop": true
  },
  "include": ["src/**/*.ts"],
  "exclude": ["dist", "lib", "node_modules"]
}
Run Code Online (Sandbox Code Playgroud)

当我编译文件时,声明文件和 JavaScript 文件会在lib文件夹中创建,这要归功于declarationflag。但是,我的自定义界面没有复制到lib,它们可能很有用。

结构示例:

/lib
 - index.d.ts // It contains an error because it is trying to export interface, and it is not in the folder
 - index.js
 - example.js
 - example.d.ts
 - interface.d.ts // missing!!
/src
 - index.ts // Here is exported my interface …
Run Code Online (Sandbox Code Playgroud)

javascript node-modules typescript

7
推荐指数
0
解决办法
233
查看次数

一起创建倒置的边框半径和盒子阴影

我想创建一个类似于以下的倒置边框半径:

倒边界半径

然而,由于box-shadow. 我尝试了很多解决方案,例如使用box-shadowinset 或过滤器,drop-shadowclip-path没有很好的效果。

我在这一点上:

body {
  height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: white;
}

.wrapper {
  width: 100%;
  //filter: drop-shadow(0 0 2rem #0000005c);
}

.header {
   background-color: #efefef;
   width: 85%;
   aspect-ratio: 16/3;
   border-radius: 1.5rem;
   border: 1px solid #d0d0d0;
   box-shadow: 0 0 2rem #0000005c;
  position: relative;
  margin: 0 auto;
  //clip-path: url(#myClip);
}

.dashed {
    width: 100%;
    position: absolute;
    top: 50%;
    border-bottom: 1px dashed black;
}

  
  .dashed:after {
    content: ''; …
Run Code Online (Sandbox Code Playgroud)

html css svg clip-path

7
推荐指数
1
解决办法
696
查看次数

通过JavaScript添加Safari/iOS添加百分比的Bug动画

我想我在动画中发现了一个与Safari百分比有关的错误.我想知道它是真的是一个bug还是一个Safari定制.

错误说明:

在Safari或iOS上,当您使用百分比平移启动动画时,位置错误,动画显示在另一个位置.

在下一个例子中,方形不应该移动,因为变换是相同的,它应该以其大小的10%10%"边距"开始.在一段时间后(例如500毫秒)通过JavaScript添加时会发生错误.

如果您看到该错误,您将在Safari和iOS中看到从0 0跳到10%10%.

var div = document.createElement('div');


setTimeout( function(){
  document.body.appendChild(div);
}, 500);
Run Code Online (Sandbox Code Playgroud)
  div {
    background: red;
    
    width: 200px;
    height: 200px;

    -webkit-transform:  translate(10%, 10%);
    -webkit-animation: 1s bugAnimation;
  }


@-webkit-keyframes bugAnimation {
  from {
    -webkit-transform: translate(10%, 10%);
    background: blue; /* To see the animation */
  }
  to {
    -webkit-transform: translate(10%, 10%);
    background: red; /* To see the animation */
  }
}
Run Code Online (Sandbox Code Playgroud)

可能的解决方案:

  • 按视口单位或其他单位更改百分比值.

显然,选项对所有情况都无效,因为我需要百分比,但如果我知道div的大小(vw,vh,px ......),它现在可能是一个小解决方案.

有人知道这个bug吗?

在Safari 10.1.1和iOS 9.3.1(带webview)上测试.

编辑: 我真的需要translate2D因为我在页面中心旋转DIV并且大小未知,例如:

var div = document.createElement('div');


setTimeout( function(){
  document.body.appendChild(div); …
Run Code Online (Sandbox Code Playgroud)

javascript css safari animation ios

5
推荐指数
1
解决办法
812
查看次数

Typescript 属性“property”在类型“void | ”上不存在 样本

根据 Typescript 的说法,void它是和类型的超类型。因此,具有 void 类型的函数可以返回or 。nullundefinednullundefined

只是问题是当我尝试使用typeof val !== 'undefined'和进行编译时val !== undefined。第二个失败了,但第一个正在工作。

根据文档typeof null应该是object并且typeof undefinedundefined参见此处

那么,第一种方法可以编译而第二种方法失败的原因是什么?这对我来说没有任何意义。

interface IFace {
  data: string;
}

function sample(): void | IFace { // void could be null or undefined
  return null;
}

let value = sample();

if( value !== undefined )
    console.log(value.data); // It fails because value could be null

if( typeof …
Run Code Online (Sandbox Code Playgroud)

javascript typescript

5
推荐指数
1
解决办法
4298
查看次数

如何在具有边框半径的形状周围环绕文本?

是否可以使用CSS自动换行内容以避免切割溢出的文本border-radius

此时,我的文字被隐藏在框外:

p {
  border-bottom-right-radius: 100%;
  border: 1px solid;
  padding: 1rem;
  overflow: hidden;
}
Run Code Online (Sandbox Code Playgroud)
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa …
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
1
解决办法
139
查看次数

在标签中换行时会触发后面的Click事件

我在后面的元素上遇到了点击事件的问题.我有一个输入与另一个元素重置它.该元素绝对位于输入之前.

当我在reset元素中单击时,输入有一个我想要阻止的单击事件.当两个元素都不在LABEL标记中时,这可以正常工作:

$(document).on('click', '.popup_selector', function(e){
	alert('Input cliked, if clicked in X it is an error');
});

$('i').click(function(e){
	$('input').val(''); // clear the input
});
Run Code Online (Sandbox Code Playgroud)
i {
  position: absolute;
  right: 0.5em;
  top: 0.1em;
  width: 1em;
  cursor: pointer;
}

i:after {
  content: 'disable-click';
  visibility: hidden;
  overflow: hidden;
}

input {
  padding-right: 2em;
}

div {
  position: relative;
  display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
  <i class='clear'>X</i>
  <input type="text" class="popup_selector" />
</div>
Run Code Online (Sandbox Code Playgroud)

当两个元素都由LABEL标记包装时,会出现问题.当我单击reset元素时,会触发输入单击事件,这是一个问题:

$(document).on('click', '.popup_selector', function(e){
	alert('Input cliked, if clicked in X …
Run Code Online (Sandbox Code Playgroud)

javascript css jquery

2
推荐指数
1
解决办法
92
查看次数

ESLint 与 eslint-plugin-import 和 typescript-eslint 冲突

我想从eslint-plugin-node包含规则no-unpublished-import,但是,它与我当前的冲突,因为我使用的是 typescript-eslinteslint-import-resolver-typescript.eslintrc

这是我目前的配置:

{
    "parser": "@typescript-eslint/parser", // Specifies the ESLint parser
    "extends": [
        "airbnb-base",
        "plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
        "prettier", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array
        "prettier/@typescript-eslint" // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
    ],
    "parserOptions": {
        "project": "./tsconfig.json",
        "ecmaVersion": 6, // Allows for …
Run Code Online (Sandbox Code Playgroud)

node.js typescript eslint

2
推荐指数
1
解决办法
4176
查看次数

填充底部是否相对于元素的宽度?

填充底部必须相对于元素的宽度,但我在最后一个版本的Chrome和Firefox中测试,padding-bottom相对于父元素的宽度.

我需要一个相对于元素宽度的元素,但它不起作用:

width: 200px;
padding-bottom: 50%; /* must be 100px  */
height: 0;
Run Code Online (Sandbox Code Playgroud)

参见示例:http://dabblet.com/gist/6898263

我能做什么?

css aspect-ratio responsive-design

0
推荐指数
1
解决办法
2204
查看次数