当我使用bootstrap时,它会在我尝试打印页面时删除背景颜色.几乎我网站上的所有内容都是使用bootstrap类,所以我想在bootstrap之外避免很多手动CSS.我发现bootstrap @media print用来删除背景颜色.我也使用了一个bootstrap主题(主题联合),它也删除了背景颜色.
主题united.css
@media print
*, *:before, *:after {
background: rgba(0, 0, 0, 0) !important;
color: rgb(0, 0, 0) !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
text-shadow: none !important;
Run Code Online (Sandbox Code Playgroud)
bootstrap.min.css
@media print
*, :after, :before {
color: rgb(0, 0, 0)!important;
text-shadow: none!important;
background: 0 0!important;
-webkit-box-shadow: none!important;
box-shadow: none!important;
Run Code Online (Sandbox Code Playgroud)
有没有办法确保在打印时不删除背景颜色而不编辑这2个CSS文件?
例如:当我使用.alert-danger时,我希望在屏幕上显示警告危险,因此将打印为红色框.
见JSFiddle:http: //jsfiddle.net/7mtk7wrh/
我正在唱OpenLayers 3来显示地图.我想使用latLon坐标使地图居中.我正在使用快速启动代码.使用此代码,我无法更改地图的中心.我认为这与此有关Spherical Mercator projection.唯一的问题是,我只有lat lon坐标.
有谁知道如何从openlayers v3中心地图?
我有一个使用另一个特征的特征,现在我收到了关于类中不存在的函数的错误.我简化了代码:
settings.php配置:
<?php
trait settings{
protected function getSetting($type, $setting){ // read setting from config.ini
try{
$configFile=dirname(__FILE__)."/../config.ini";
if(!file_exists($configFile)||!is_file($configFile))throw new Exception("Config file was not found. ");
$configContents=parse_ini_file($configFile,true);
if(is_array($configContents)&&array_key_exists($type,$configContents)&&is_array($configContents[$type])&&array_key_exists($setting,$configContents[$type]))return $configContents[$type][$setting];
else throw new Exception("Setting ".$setting." could not be found in ".$type.".");
}
catch(Exception $e){throw new Exception($e->getMessage());}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
为database.php
<?php
trait database{
use settings,session;
private $pdo;
protected function connect(){ // connect to database
try{
$this->pdo=new PDO("mysql:host=".$this->getSetting("db","host").";dbname=".$this->getSetting("db","database"),$this->getSetting("db","user"),$this->getSetting("db","password"));
$this->init();
}
catch(PDOException $e){throw new Exception($e->getMessage());}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
users.php
<?php
class users{
use database;
public …Run Code Online (Sandbox Code Playgroud) 这里我有另一个问题,这次关于youtube API.我正在使用此代码来获取youtube播放器:
<div id=\"youtubeVideoContainer\"></div><script type=\"text/javascript\">
//Load player api asynchronously.
var tag = document.createElement('script');
tag.src = \"//www.youtube.com/player_api\";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('youtubeVideoContainer', {
height : \"".$height."\",
width : \"".$width."\",
videoId : \"".$id."\",
playerVars : ".json_encode($this->playerParams)."
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
请不要介意\",它是用PHP呈现的,所以它只是为了转义,视频也在播放,所以没有重大错误:)
令我烦恼的是,每当我请求视频时,我都会在我的控制台中看到此消息:不安全的JavaScript尝试使用URL访问框架
https://www.socialthisday.com/playwin/admin/content/edit/project_1/home.html 来自框架,网址为 https://www.youtube.com/embed/2UJH9dCtp7w?autohide=1&autoplay=1&controls=0&border&cc_load_policy=0&color&color1&color2&disablekb&enablejsapi = 1&egm&fs&hd&iv_load_policy&loop&modestbranding = 1&origin = https%3A%2F%2Fwww.socialthisday.com&playerapiid&playlist&rel = 0&showinfo = 0&showsearch&start&theme&version = 3.域,协议和端口必须匹配.
我想解决这个问题,所以我没有看到这个消息.我知道这不是一件很重要的事情,但我现在想要如何在没有看到上述警告的情况下在我的网站上获得youtube播放器.
希望你们能帮助我!
编辑:这是输出:
<div id="YTcontainer_502513c7ebc1b"> </div>
<script type="text/javascript">
//Load player api asynchronously.
var tag = document.createElement('script'); …Run Code Online (Sandbox Code Playgroud) 我正在尝试构建自己的chrome扩展,我正在尝试使用添加事件处理程序onBeforeRequest.
我的manifest.json:
{
"manifest_version": 2,
"name": "My extension",
"description": "some descrpition",
"version": "1.0",
"permissions": [
"activeTab",
"tabs",
"webRequest",
"webNavigation",
"management",
"http://*/*",
"https://*/*"
],
"background": {
"scripts": [
"js/jquery-2.1.4.min.js",
"js/background.js"
],
"persistent": true
},
"browser_action": {
"default_icon": "imgs/img.png",
"default_title": "extension"
},
"icons" : {
"64" : "imgs/vergrootglas.png"
}
}
Run Code Online (Sandbox Code Playgroud)
我的background.js:
function callback(param1,param2,param3){
alert(param1);
alert(param2);
alert(param3);
}
//alert("test");
chrome.webRequest.onBeforeRequest.addListener(callback);
Run Code Online (Sandbox Code Playgroud)
我把它加载到了我的chrome中.但每次我在控制台中收到此消息时:
未捕获的TypeError:无法读取未定义的属性'onBeforeRequest'
我无法弄清楚我错了什么,我发现了这个:https: //developer.chrome.com/extensions/webRequest
但代码的例子似乎和我的做法完全一样.我在这里错过了什么?
javascript jquery google-chrome webrequest google-chrome-extension
我正在使用具有以下表结构的Laravel 5.6:
public function up() {
Schema::create( 'traffic', function ( Blueprint $table ) {
$table->string( 'id' );
$table->unsignedInteger( 'category_id' );
$table->unsignedInteger( 'magnitude_id' );
$table->unsignedInteger( 'start_id' )->nullable();
$table->unsignedInteger( 'destination_id' )->nullable();
$table->unsignedInteger('locale_id');
$table->integer( 'length' )->comment( 'in metres' );
$table->integer( 'delay' )->comment( 'in seconds' );
$table->decimal( 'position_lat', 10, 8 );
$table->decimal( 'position_lon', 10, 8 );
$table->timestamps();
})
Run Code Online (Sandbox Code Playgroud)
当我转储单个记录时,laravel将id字段转换为整数:
Traffic {#351 ?
#casts: array:1 [?]
#connection: "mysql"
#table: null
#primaryKey: "id"
#keyType: "int"
+incrementing: false
#with: []
#withCount: []
#perPage: 15
+exists: …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种在Chrome扩展程序中存储大量数据的有效方法.我有一些大约1-2mb的txt文件.我希望我的chrome扩展程序能够在本地"缓存"它们,所以我不需要每次都获取它们.我找到了syncFileSystem,但这仅适用于打包应用.
尝试安装此扩展程序时出现警告:
'syncFileSystem'仅适用于打包的应用,但这是一个扩展.
在Chrome扩展程序中存储此类数据的最佳方法是什么?
的manifest.json
{
"manifest_version": 2,
"name": "__MSG_name__",
"version": "1.0",
"default_locale": "en",
"description": "__MSG_description__",
"icons" : {
"16" : "img/logo_enabled_16.png",
"48": "img/logo_enabled_48.png",
"128": "img/logo_enabled_128.png"
},
"browser_action": {
"default_icon": "img/logo_enabled_48.png",
"default_title": "__MSG_browser_action_title__",
"default_popup":"options.html"
},
"background": {
"scripts": [
"js/chrome.js",
"js/filter.js",
"js/background.js"
],
"persistent": true
},
"content_scripts": [{
"matches": [
"http://*/*",
"https://*/*"
],
"js": [
"js/docReady.js",
"js/content.js"
]
}],
"offline_enabled":true,
"options_ui": {
"chrome_style": true,
"page":"options.html"
},
"permissions": [
"activeTab",
"tabs",
"webRequest",
"webRequestBlocking",
"webNavigation",
"storage",
"syncFileSystem",
"http://*/*",
"https://*/*"
], …Run Code Online (Sandbox Code Playgroud) javascript storage google-chrome-extension google-chrome-storage chrome-sync
这是我的jquery:
$(document).ready(function(){
$("div#overlay div#getFBid div#overlayClose").on("click", function(){
console.log("test")
});
});
Run Code Online (Sandbox Code Playgroud)
这是我的html,用ajax调用:
<div id="overlay">
<div id="getFBid">
<div id="overlayClose"> </div>
<h1>Wat is mijn Facebook page ID?</h1>
<div id="fbPageURLholder">
<input type="text" id="fbPageURL">
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚我做错了什么,我显然错过了一些我认为应该非常简单的事情.有什么想法吗?
PS.我应该补充一点,我在jquery.com上看到live函数已被弃用,我应该使用delegate或on.
我正在尝试使用连接从一个SQL语句中获取2个表中的数据.这个想法很简单.项目有参与者,在项目概述中,我想用参与者的数量显示项目信息.
现在有2个项目,一个项目有参与者,另一个项目没有参与者.
我用这个查询:
SELECT SQL_CALC_FOUND_ROWS `p`.`id`,
`p`.`title`,
`p`.`live`,
`p`.`startDate`,
`p`.`endDate`,
COUNT(`part`.`id`) AS `participants`
FROM `projects` `p`
LEFT OUTER JOIN `participants` `part`
ON `p`.`id` = `part`.`projectid`
ORDER BY `p`.`live` DESC,
`p`.`startDate` DESC
LIMIT 0,10
Run Code Online (Sandbox Code Playgroud)
问题是,此查询仅返回带有参与者的项目,而没有参与者的项目则被忽略.
我在这做错了什么?
javascript ×5
jquery ×2
ajax ×1
casting ×1
chrome-sync ×1
class ×1
click ×1
css ×1
css3 ×1
events ×1
html ×1
laravel ×1
laravel-5.6 ×1
left-join ×1
mysql ×1
oop ×1
openlayers-3 ×1
outer-join ×1
php ×1
sql ×1
storage ×1
traits ×1
webrequest ×1
youtube ×1
youtube-api ×1