小编DSh*_*ltz的帖子

当iPhone方向从纵向更改为横向时,保留HTML字体大小

我有一个移动的Web应用程序,其中包含多个列表项的无序列表,每个列表中都有一个超链接:

...我的问题是如何格式化超链接,以便在iPhone上查看时不会改变大小,并且accellerometer从纵向切换 - >横向?现在,我的超链接字体大小规格为14px,但是当切换到横向时,它会爆炸到20px.我希望font-size保持不变.这是代码:

ul li a
{
  font-size:14px;
  text-decoration: none;
  color: #cc9999;
}
Run Code Online (Sandbox Code Playgroud)
<ul>
  <li id="home" class="active">
    <a href="home.html">HOME</a>
  </li>
  <li id="home" class="active">
    <a href="test.html">TEST</a>
  </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

html css iphone

197
推荐指数
7
解决办法
9万
查看次数

使用 activeTab 权限与 &lt;all_urls&gt;

我有一个使用 content_script 以声明方式指定的扩展:

清单.json:

"content_scripts": [
  {
    "matches": ["<all_urls>"],
    "js": ["content.js"],
    "run_at": "document_end"
  }
],
Run Code Online (Sandbox Code Playgroud)

我正在阅读它,而不是指定 activeTab 权限,它不会在安装过程中发出有关权限的警报:

https://developer.chrome.com/extensions/activeTab

我的问题是:你如何切换到使用

"permissions":["activeTab"]
Run Code Online (Sandbox Code Playgroud)

从使用 content_scripts ?

这是我调用 content_script 的 popup.js 代码:

chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
chrome.tabs.sendMessage(tabs[0].id, { action: "checkForCode" }, function (response) {
    if (!!response) { showResults(response.results); }
  });
});
Run Code Online (Sandbox Code Playgroud)

和 content_script 的事件处理程序:

chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
    if (request.action == "checkForCode") {
        getCode(request, sender, sendResponse);//method sends callback.
        return true;
    }
});
Run Code Online (Sandbox Code Playgroud)

这段代码工作得很好,但我想知道如何将它与 activeTab 权限一起使用。我应该通过 chrome.tags.executeScript() …

javascript google-chrome-extension

6
推荐指数
1
解决办法
2090
查看次数

多次调用 window.open() 第一次后失败

我有一个脚本可以循环访问多个网址并在新选项卡中打开它们。以前可以用,但现在只能打开第一个。甚至有一个 w3schools 测试编辑器据说可以打开多个窗口,但在第一个窗口之后它也失败了:

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open6

但是,如果我在调试模式下单步执行并将焦点每次重置到原始选项卡,它确实会打开每个窗口。所以我的问题是,如何打开多个窗口(选项卡),但使用原始脚本将焦点保持在我的窗口上?它曾经是这样做的,但现在,一旦添加新选项卡,它就会获得焦点,并且脚本停止打开窗口。这是完整的 w3schools 失败脚本:

<!DOCTYPE html>
<html>
<body>

<p>Click the button to open multiple windows.</p>

<button onclick="myFunction()">Open Windows</button>

<script>
function myFunction() {
    window.open("http://www.google.com/");
    window.open("https://www.w3schools.com/");
}
</script>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome

6
推荐指数
1
解决办法
3912
查看次数

KendoUI设置下拉列表的宽度

我正在寻找设置KendoUI下拉列表宽度的最佳方法 - 通过Kendo HTML Helper.

@(Html.Kendo().DropDownList()
    .Name("ddlAccount")
    .DataTextField("Name")
    .DataValueField("Id")
    //This doesn't work, it styles the hidden input instead of the ddl
    .HtmlAttributes(new {style="width:200px;"})
)
Run Code Online (Sandbox Code Playgroud)

我正在设置DropDownList的宽度,但是在生成的HTML中注意,在隐藏文本输入上设置了200像素的宽度,而不是下拉列表:

<span aria-busy="false" aria-readonly="false" aria-disabled="false" aria-owns="ddlAccount_listbox" tabindex="0" aria-expanded="false" aria-haspopup="true" role="listbox" class="k-widget k-dropdown k-header styled_select" style="" unselectable="on" aria-activedescendant="ddlAccount_option_selected">

<span class="k-dropdown-wrap k-state-default">
    <span class="k-input">Choice One</span>
    <span class="k-select">
        <span class="k-icon k-i-arrow-s">select</span>
    </span>
</span>
<input id="ddlAccount" name="ddlAccount" style="width: 200px; display: none;" type="text" data-role="dropdownlist">
Run Code Online (Sandbox Code Playgroud)

...所以生成的DropDownList仍然水平和垂直滚动,这是我不想要的.

razor asp.net-mvc-4 kendo-ui

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

将 Mongoose 模式字段设为只读

我有一个猫鼬“用户”模式,其中一个字段需要是只读的。(“帐户”字段可以在外部更新,因此我不希望对用户的更新覆盖更改。)

var UserSchema = new Schema({
firstName: {
    type: String,
    trim: true,
    default: '',
    validate: [validateLocalStrategyProperty, 'Please fill in your first name']
},
lastName: {
    type: String,
    trim: true,
    default: '',
    validate: [validateLocalStrategyProperty, 'Please fill in your last name']
},
displayName: {
    type: String,
    trim: true
},
email: {
    type: String,
    trim: true,
    default: '',
    validate: [validateLocalStrategyProperty, 'Please fill in your email'],
    match: [/.+\@.+\..+/, 'Please fill a valid email address']
},
username: {
    type: String,
    unique: 'Username already exists',
    required: …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js

4
推荐指数
2
解决办法
3715
查看次数

向 Postgres 物化视图添加新列

我需要向 Postgres 中现有的物化视图添加一个新列。

根据本文档: https://www.postgresql.org/docs/9.3/sql-altermaterializedview.html

它说这些是列的选项:

ALTER [ COLUMN ] column_name SET STATISTICS integer
ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] )
ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] )
ALTER [ COLUMN ] column_name SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN }
Run Code Online (Sandbox Code Playgroud)

但没有添加新列的语法示例,即使它说column_name是“新列或现有列的名称”

...或者我应该使用SET SCHEMA new_schema

postgresql materialized-views

4
推荐指数
2
解决办法
7661
查看次数

WebStorm/grunt调试运行抛出EADDRINUSE错误

我有一个使用WebStorm IDE开发的Node/Angular应用程序.我可以通过WebStorm(Shift + F10)运行应用程序.但是,每当我尝试在调试模式下运行时,我都会收到EADDRINUSE错误:

Running "concurrent:default" (concurrent) task
Verifying property concurrent.default exists in config...OK
Files: [no src] -> default
Options: limit=10, logConcurrentOutput
Error: listen EADDRINUSE :::52387
Run Code Online (Sandbox Code Playgroud)

这是我的gruntfile.js- 就像我说的,WebStorm构建并运行它很好,直到我尝试在调试模式下运行它,它会抛出错误:

'use strict';

var fs = require('fs');

module.exports = function(grunt) {
// Unified Watch Object
var watchFiles = {
    serverViews: ['app/views/**/*.*'],
    serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js', '!app/tests/'],
    clientViews: ['public/modules/**/views/**/*.html'],
    sass: ['public/css/*.scss'],
    clientJS: ['public/js/*.js', 'public/modules/**/*.js'],
    clientCSS: ['public/modules/**/*.css'],
    mochaTests: ['app/tests/**/*.js']
};

// Project Configuration
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    watch: {
        serverViews: { …
Run Code Online (Sandbox Code Playgroud)

node.js webstorm gruntjs

3
推荐指数
1
解决办法
794
查看次数