Module:Citation/CS1/styles.css: Difference between revisions

From IxWiki
Jump to navigation Jump to search
wp>Trappist the monk
sync from sandbox;
 
>Izno
nix notes
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
/*-------------------------< P R O T E C T I O N  I C O N >--------------------
/* Protection icon
 
the following line controls the page-protection icon in the upper right corner
the following line controls the page-protection icon in the upper right corner
it must remain within this comment
it must remain within this comment
Line 7: Line 6:
*/
*/


/* Overrides
Some wikis do not override user agent default styles for HTML <cite> and <q>,
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].


/*-------------------------< O V E R R I D E S >--------------------------------
The word-wrap and :target styles were moved here from Common.css.
 
On en.wp, keep these the same as [[Template:Citation/styles.css]].
cs1|2 references are wrapped in <cite>...</cite> tags. Some wikis have not
chosen to override the generic user agent italic styling as en.wiki has.  This
(untested) styling should override the user agent default when cs1|2 templates
are rendered.
 
Similarly, some languages use different quotation punctuation so that setting
is also made available here.
*/
*/
cite.citation {
cite.citation {
/* Reset italic styling set by user agent (only for cs1|2 templates; the
font-style: inherit; /* Remove italics for <cite> */
reason for the .citation qualifier) */
/* Break long urls, etc., rather than overflowing box */
font-style: inherit;
word-wrap: break-word;
}
}


.citation q {
.citation q {
/* Straight quote marks for <q>; keep same as [[MediaWiki:Common.css]] */
quotes: '"' '"' "'" "'"; /* Straight quote marks for <q> */
quotes: '"' '"' "'" "'";
}
 
/* Highlight linked elements (such as clicked references) in blue */
.citation:target {
/* ignore the linter - all browsers of interest implement this */
background-color: rgba(0, 127, 255, 0.133);
}
}


Line 33: Line 33:
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
That's essentially 2 classes and 1 element.
the .id-lock-... selectors are for use by non-citation templates like
{{Catalog lookup link}}


the .id-lock-... selectors are for use by non-citation templates like {{Catalog lookup link}}
bg-size `contain` in Minerva and Timeless is too large, so we set a size for them
and then exclude them later
*/
*/
 
.id-lock-free.id-lock-free a {
.id-lock-free a,
background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
.citation .cs1-lock-free a {
right 0.1em center/9px no-repeat;
background-image: url(//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png);
background-image: linear-gradient(transparent, transparent), url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg);
background-repeat: no-repeat;
background-size: 9px;
background-position: right .1em center;
}
}


.id-lock-limited a,
.id-lock-limited.id-lock-limited a,
.id-lock-registration a,
.id-lock-registration.id-lock-registration a {
.citation .cs1-lock-limited a,
background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
.citation .cs1-lock-registration a {
right 0.1em center/9px no-repeat;
background-image: url(//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png);
background-image: linear-gradient(transparent, transparent), url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg);
background-repeat: no-repeat;
background-size: 9px;
background-position: right .1em center;
}
}


.id-lock-subscription a,
.id-lock-subscription.id-lock-subscription a {
.citation .cs1-lock-subscription a {
background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
background-image: url(//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png);
right 0.1em center/9px no-repeat;
background-image: linear-gradient(transparent, transparent), url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg);
background-repeat: no-repeat;
background-size: 9px;
background-position: right .1em center;  
}
}


.cs1-subscription,
/* Wikisource
.cs1-registration {
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource
color: #555;
as in cite wikisource
*/
.cs1-ws-icon a {
background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
right 0.1em center/12px no-repeat;
}
}


.cs1-subscription span,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-free a,
.cs1-registration span {
body:not(.skin-timeless):not(.skin-minerva) .id-lock-limited a,
border-bottom: 1px dotted;
body:not(.skin-timeless):not(.skin-minerva) .id-lock-registration a,
cursor: help;
body:not(.skin-timeless):not(.skin-minerva) .id-lock-subscription a,
}
body:not(.skin-timeless):not(.skin-minerva) .cs1-ws-icon a {
 
background-size: contain;
/* Wikisource icon
/* Common.css has a padding set for PDF URLs. bg-contain expands to the
Experiment to see if it is possible/practical to add support for a wikisource
* size of the padding which makes the icons very large. we "reset" the
icon when |chapter= or |title= is wikilinked to a source in wikisource ala cite wikisource
* padding here. 1em picked out of a hat based on console having a similar
*/
* rule from elsewhere
.cs1-ws-icon a {
*/
background-image: url(//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/12px-Wikisource-logo.svg.png);
padding: 0 1em 0 0;
background-image: linear-gradient(transparent, transparent), url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg);
background-repeat: no-repeat;
background-size: 12px;
background-position: right .1em center;
}
}


/* Errors and maintenance */
/* Errors and maintenance */
code.cs1-code {
.cs1-code {
/* <code>...</code> style override: mediawiki's css definition is specified here:
/* <code>...</code> style override: mediawiki's css definition is specified here:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/
69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
*/
*/
color: inherit;
color: inherit;
background: inherit;
background: inherit;
border: inherit; /* code editor doesn't like inherit with border?
border: none;
https://www.w3.org/wiki/CSS/Properties/border
suggests that inherit is ok
the actual spec says the code editor is correct:
https://www.w3.org/TR/css-backgrounds-3/#borders
*/
padding: inherit;
padding: inherit;
}
}
Line 107: Line 94:
.cs1-hidden-error {
.cs1-hidden-error {
display: none;
display: none;
font-size: 100%;
color: var(--color-error, #d33);
}
}


.cs1-visible-error {
.cs1-visible-error {
font-size: 100%;
color: var(--color-error, #d33);
}
}


.cs1-maint {
.cs1-maint {
display: none;
display: none;
color: #33aa33;
color: #085;
margin-left: 0.3em;
margin-left: 0.3em;
}
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-subscription,
.cs1-registration,
.cs1-format {
font-size: 95%;
}
}


/* kerning */
/* kerning */
.cs1-kern-left,
.cs1-kern-left {
.cs1-kern-wl-left {
padding-left: 0.2em;
padding-left: 0.2em;
}
}


.cs1-kern-right,
.cs1-kern-right {
.cs1-kern-wl-right {
padding-right: 0.2em;
padding-right: 0.2em;
}
}
Line 145: Line 119:
.citation .mw-selflink {
.citation .mw-selflink {
font-weight: inherit;
font-weight: inherit;
}
@media screen {
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-format {
font-size: 95%;
}
html.skin-theme-clientpref-night .cs1-maint {
color: #18911f;
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .cs1-maint {
color: #18911f;
}
}
}

Latest revision as of 13:48, 2 August 2024

/* Protection icon
the following line controls the page-protection icon in the upper right corner
it must remain within this comment
	{{sandbox other||{{pp-template}}}}

*/

/* Overrides
Some wikis do not override user agent default styles for HTML <cite> and <q>,
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].

The word-wrap and :target styles were moved here from Common.css.
On en.wp, keep these the same as [[Template:Citation/styles.css]].
*/
cite.citation {
	font-style: inherit; /* Remove italics for <cite> */
	/* Break long urls, etc., rather than overflowing box */
	word-wrap: break-word;
}

.citation q {
	quotes: '"' '"' "'" "'"; /* Straight quote marks for <q> */
}

/* Highlight linked elements (such as clicked references) in blue */
.citation:target {
	/* ignore the linter - all browsers of interest implement this */
	background-color: rgba(0, 127, 255, 0.133);
}

/* ID and URL access
Both core and Common.css have selector .mw-parser-output a[href$=".pdf"].external
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
That's essentially 2 classes and 1 element.

the .id-lock-... selectors are for use by non-citation templates like
{{Catalog lookup link}}

bg-size `contain` in Minerva and Timeless is too large, so we set a size for them
and then exclude them later
*/
.id-lock-free.id-lock-free a {
	background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
		right 0.1em center/9px no-repeat;
}

.id-lock-limited.id-lock-limited a,
.id-lock-registration.id-lock-registration a {
	background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
		right 0.1em center/9px no-repeat;
}

.id-lock-subscription.id-lock-subscription a {
	background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
		right 0.1em center/9px no-repeat;
}

/* Wikisource
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource
as in cite wikisource
*/
.cs1-ws-icon a {
	background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
		right 0.1em center/12px no-repeat;
}

body:not(.skin-timeless):not(.skin-minerva) .id-lock-free a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-limited a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-registration a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-subscription a,
body:not(.skin-timeless):not(.skin-minerva) .cs1-ws-icon a {
	background-size: contain;
	/* Common.css has a padding set for PDF URLs. bg-contain expands to the
	 * size of the padding which makes the icons very large. we "reset" the
	 * padding here. 1em picked out of a hat based on console having a similar
	 * rule from elsewhere
	 */
	padding: 0 1em 0 0;
}

/* Errors and maintenance */
.cs1-code {
	/* <code>...</code> style override: mediawiki's css definition is specified here:
	https://git.wikimedia.org/blob/mediawiki%2Fcore.git/
		69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
	*/
	color: inherit;
	background: inherit;
	border: none;
	padding: inherit;
}

.cs1-hidden-error {
	display: none;
	color: var(--color-error, #d33);
}

.cs1-visible-error {
	color: var(--color-error, #d33);
}

.cs1-maint {
	display: none;
	color: #085;
	margin-left: 0.3em;
}

/* kerning */
.cs1-kern-left {
	padding-left: 0.2em;
}

.cs1-kern-right {
	padding-right: 0.2em;
}

/* selflinks – avoid bold font style when cs1|2 template links to the current page */
.citation .mw-selflink {
	font-weight: inherit;
}

@media screen {
	/* Small text size
	Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
	~0.85, which is the lower bound for size for accessibility. Old styling for this
	was just 0.85. We could write the rule so that when this template is inside
	references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
	.cs1-format {
		font-size: 95%;
	}
	
	html.skin-theme-clientpref-night .cs1-maint {
		color: #18911f;
	}
}

@media screen and (prefers-color-scheme: dark) {
	html.skin-theme-clientpref-os .cs1-maint {
		color: #18911f;
	}
}