I'm running jest tests using puppeteer. On some of them I manually add some specific css styles and other tweaks like the following:
const content = `
*,
*::after,
*::before {
transition-delay: 0s !important;
transition-duration: 0s !important;
animation-delay: -0.0001s !important;
animation-duration: 0s !important;
animation-play-state: paused !important;
caret-color: transparent !important;
}`;
page.addStyleTag({ content });
as well as some listeners. I would like to remove everything by "resetting" the page to its pristine status for each test. What's the best way to accomplish this?
Related
(SharePoint online, SPFx, modern website)
My end goal is this :
I want to customize some visual aspects of a SharePoint page (title, left nav bar, fonts, etc.)
I want it to happen only on one page
The solution I chose for that was to create a SPFx web part, as opposed to an extension, which I believe would apply to the entire site. I'm simply going to put the web part on that one page and be done with it.
My issue is :
The CSS gets applied properly to the part of the DOM that represents my web part
the CSS does NOT seem to be applied (at all) to anything else from the page.
For example, I don't see this take effect or even appearing at all in the rendered page :
#spLeftNav {
color: red !important;
}
However, this works as expected :
.myWebPartFooBar {
.container {
color:red !important;
}
}
Question : Is there some sort of sanitation mechanism that I'm missing? Does SharePoint intercept that CSS and prevent it from being applied to anything outside of my web part? I don't see any trace of such protection system in online literature but maybe it's common knowledge.
I had similar problem. The problem is that if you are using scss, compiler translates those css tags #spLeftNav into custom webpart only tags to prevent css mismatch on entire site.
To override it put those global css tag in global variable (this will prevent compiler to change it).
My example of "global css":
:global {
#O365_MainLink_Help {
display:none;
visibility:hidden;
}
.InfoPane-section.InfoPaneSection--properties {
display: none;
}
.o365cs-nav-bposLogo .o365cs-nav-brandingText {
display: none;
}
.o365cs-base.o365cs-topnavBGColor-2 {
background-color: #17375e !important;
}
.o365cs-base .o365cs-nav-rightMenus {
background-color: #17375e !important;
}
#spPageChromeAppDiv,
.ms-Nav
{
background-color: #eeece1 !important;
}
.ms-FocusZone .ms-Nav {
top: 0px !important;
}
#O365_NavHeader button#O365_MainLink_NavMenu,
#O365_NavHeader button#O365_MainLink_NavMenu_Responsive,
.o365button .o365cs-nav-brandingText,
.ms-searchux-searchbox {
display: none !important;
}
.CanvasZone:not(.CanvasZone--fullWidth) .ControlZone {
padding: 0px !important;
}
input:not([type]), input[type=email], input[type=file], input[type=password], input[type=text], select, textarea {
background-color: #eeece1 !important;
border-color: #c8c8c8 !important;
color: #17375e !important;
}
.ms-CommandBarItem-link[disabled] i,
.ms-CommandBarItem-link[disabled] span
{
color: unset !important;
}
.ms-compositeHeader-mainLayout {
height: 77px;
}
div[class^='commentsWrapper_'] {
display: none;
}
span.ms-siteHeader-siteName {
white-space: normal !important;
}
.ControlZone {
margin-top: 0px !important;
}
.ControlZone-control,
.ms-SearchBox,
.ms-BasePicker,
.ms-SearchBox-field {
background-color: #eeece1 !important;
}
.commandBarWrapper .ms-CommandBar {
display: none;
}
.ms-compositeHeader {
padding: 0 32px 0px;
}
}
I need to apply background image for ngx-admin
http://akveo.com/ngx-admin/#/pages/dashboard
similar to http://akveo.com/blur-admin/#/tables/basic.
Gopi
try this...
body.nb-theme-cosmic::before {
position: relative !important;
background: url(http://akveo.com/blur-admin/assets/img/blur-bg.jpg) center center no-repeat !important;
background-size: cover !important;
}
Try add this to your #theme/styles/stlyes.scss
.nb-theme-corporate nb-layout-header.fixed ~ .layout-container{
background:url(your-url);
}
The problem I'm facing is that when I click on a button to show this element, on IE 10 it doesn't show up. I'm adding the display: block property via JavaScript, that's why it's not in the CSS. It works on all other browsers except IE.
If I remove the transition it shows up.
section {
display: none;
position: relative;
top: 50%;
margin: 0 auto;
width: 400px;
transition: all 0.5s linear;
transform: translate(0,-300%);
}
section.visible {
transform: translate(0,-50%);
}
I solved the issue by showing the section when adding display: block on the visible class rather than using jQuery show(). Guess IE10+ has issues with that.
<img src="/images/home-1a.png" id ="tab66" alt="home" />
#tab66 {
margin-left:0px;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(...);
}
This is my code of png image in ie6 but still it does not show transparency
Try this jQuery plugin:
http://allinthehead.com/retro/338/supersleight-jquery-plugin
That said you should avoid having to use this hack in the first place.
Use .GIF's unless you really have to use PNG
body{ background: #0D657B;}
.png_hack {
margin:0 auto;
width:400px;
height:100px;
background-image: url(Img/png.png) !important;
background-image: none;
filter: none !important;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='Img/png.png');
}
it's works
http://www.newstyleonline.net/post/ie6-png-hack.html
That is because AlphaImageLoader works like background-image, showing behind the image inside the img tag - the most common trick here is replacing src="/images/home-1a.png" with a 1x1 pixels transparent gif.
A quicker solution for you here would be:
<div id="tab66"></div>
#tab66 {
margin-left:0px;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(...);
width: Xpx;
height: Ypx;
}
if you want to automate this, I'd recommend instead DD_belatedPNG.
How can I change the default graphic for the Infowindow close button?
You can do it with CSS, like this:
img[src="http://maps.gstatic.com/intl/en_us/mapfiles/iw_close.gif"]
{ content:url("/img/own_close_button.png"); }
Works on:
Chrome 14.0.835.163
Safari 4.0.5
Opera 10.6
Most mobile devices (default browser)
Does not work on:
FireFox 27.0
IE 11.0
If you're using google maps API V3, then you might want to use the official add on infobox.
Google Maps Utility - Infobox
First you need to hide the default close icon:
.gm-style-iw button.gm-ui-hover-effect img {
display: none !important;
}
Second, force the default button (that holds the image) to have full opacity:
.gm-style-iw button.gm-ui-hover-effect {
opacity: 1 !important;
}
Third, set your own image and position it:
.gm-style-iw button.gm-ui-hover-effect:before {
display: block;
content: "";
background: url('assets/close-red.svg') center center no-repeat;
background-size: cover;
width: 8px;
height: 8px;
right: -19px;
position: relative;
}
Result:
With jQuery you can change the image file location. If I have an image button_close.png that is 16px in size:
jQuery('img[src="http://maps.gstatic.com/intl/en_us/mapfiles/iw_close.gif"]').livequery(function() {
jQuery(this).attr('width', 16).attr('height', 16).css({
width: '16px',
height: '16px'
}).attr('src', 'button_close.png');
});
Of course this only works as long as Google uses this file location.
button.gm-ui-hover-effect {
background: url(your-img.png) !important;
background-size: contain !important;
}
button.gm-ui-hover-effect img {
display: none !important;
}
Using what Dimitrije Djekanovic and Grant suggested, here is a working version for the current API version 3.49 (Mid-May of 2022):
/* hides the x image */
button.gm-ui-hover-effect > span {
display: none !important;
}
/* inserts the customized and clickable image instead */
button.gm-ui-hover-effect {
opacity: 1 !important;
background: url('close.svg') center center !important;
background-repeat: no-repeat !important;
background-size: 16px 16px !important;
/* above is a good size or uncomment the next line */
/* background-size: contain !important; */
}
To test this, go to the StackBlitz demo provided by the official documentation and paste the style.css file while having background changed to:
background: url('https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Mr._Smiley_Face.svg/414px-Mr._Smiley_Face.svg.png')
center center !important;
There isn't really a way to do this. Your best bet would probably be to use a third-party or custom Infowindow.
There's a list of some third-party solutions here.
To replace with (or whatever image you might like), after
infowindow.open(map, marker);
you can try to add these lines
$('img[src="http://maps.gstatic.com/intl/en_us/mapfiles/iw_close.gif"]').each(function() {
$(this).attr('width', 14);
$(this).attr('height', 13);
$(this).css({width: '14px',height: '13px'});
$(this).attr('src','http://www.google.com/intl/en_us/mapfiles/close.gif');
});