Custom Vector theme/skin for GolemWiki, our instance of MediaWiki
Go to file
Timo Tijhof f39a3f028f vector.js: Remove eager calculation of p-cactions width on page load
With these optimisations applied, there is no longer any need for
the width value during most page views, and even for most resize
operations. As such, eagerly computing it ahead of time, even from an
idle callback, no longer makes sense.

It is still memoised because it's worth avoiding a recalc during
some of the code paths that need it. Also because this way the
logic stays compatible. I don't know for sure if all involved logic
would be able to handle the value changing over time.

Optimisations:

* Where possible, don't depend on jQuery width() working on invisible
  elements. Specifically, don't depend on it giving you the width of the
  element *as if* it were visible when it is invisible. When logged-out and,
  when navigating special pages (e.g. Special:Blankpage), the #p-cactions
  element is an emptyPortlet with `display: none;` set.

  The animation logic was depending on initialCactionsWidth() providing
  the width the element would have if it were visible. This is because
  jQuery width(), will actually change 'display: none' to 'display: block',
  force render virtually, compute the width, and then change back.
  Instead of depending on this discouraged feature [1], move this calculation
  to the code dealing with the animation and calculating it there, ourselves,
  right after making it visible for real (but before shrinking it for the
  hidden-to-visible growing expansion animation).

* Document our reliance on this discouraged feature for the remaining two
  callers in expandCondition() and collapseCondition(). Both of those
  need the initial width as-if visible and generally are not in charge
  direclty of making it visible (so there's no better place to measure
  it), and are in fact almost always called when the element is invisible,
  thus pretty much exclusively depending on it, not even as an edge case.

* In collapseCondition(), optimise the logic to remember whether
  collapsing is needed. This way, it won't need to call initialCactionsWidth()
  if the loop iterated zero times (turns out to be impossible, but not
  obvious from the code).

Follows-up 46f1d41 and 9b2bcbb.

Change-Id: I6f3a5c937eb17d194a7e00ab273768a5f2cb7cd2
(cherry picked from commit e32df2ad20)
2019-10-02 12:42:42 +00:00
.phan Upgrade to newer phan 2019-03-20 19:37:59 -07:00
components Replace raster image gradients with CSS where easily applicable 2019-10-01 21:38:24 +00:00
i18n Localisation updates from https://translatewiki.net. 2019-10-01 08:34:32 +02:00
images Replace raster image gradients with CSS where easily applicable 2019-10-01 21:38:24 +00:00
includes Cleaning a[redundant] is done in BaseTemplate 2019-08-21 18:03:47 +00:00
screenshots Add skin screenshot for the installer 2017-08-11 15:37:34 -04:00
skinStyles Replace fixed value with mediawiki.ui variable 2019-09-26 18:54:56 -07:00
.eslintrc.json build: Set "root": true, in .eslintrc.json 2018-12-17 19:02:54 -08:00
.gitignore Merge "Upgrade to newer phan" 2019-03-21 06:55:46 +00:00
.gitreview Use track=1 instead of defaultbranch=master in .gitreview 2016-10-24 17:30:32 -07:00
.phpcs.xml Add method scope visibility 2018-11-01 21:01:32 +01:00
.stylelintrc.json build: Bump devDependencies to latest 2018-02-26 10:29:23 -08:00
CODE_OF_CONDUCT.md build: Updating mediawiki/mediawiki-codesniffer to 22.0.0 2018-09-04 01:45:34 +00:00
COPYING Use the plain-text GPL and fix 'license-name' to match SPDX conventions 2015-01-29 17:04:29 +01:00
Gruntfile.js build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint 2019-06-06 18:08:32 +02:00
README.md Print logo should use an absolute URI 2017-10-11 19:06:29 +00:00
collapsibleTabs.js Decrease onresize debounce from 100ms to 10ms 2019-09-11 19:44:04 +00:00
composer.json build: Updating dependencies 2019-07-16 07:51:49 +00:00
hooks.txt Remove 'SkinVectorStyleModules' hook 2018-01-26 10:33:47 -08:00
jsduck.json collapsibleTabs: Clean up and simplify code 2016-11-29 02:25:00 +00:00
package-lock.json build: Updating eslint-utils to 1.4.2 2019-08-24 03:17:50 +00:00
package.json build: Updating npm dependencies for security issues 2019-06-09 06:51:07 +00:00
print.less Improve print LESS variable setting and handling 2019-09-27 16:11:40 -07:00
responsive.less Move DataAfterContent outside of main content block 2019-06-20 17:55:55 +00:00
screen-hd.less Move DataAfterContent outside of main content block 2019-06-20 17:55:55 +00:00
screen.less build: Introduce stylelint and make pass 2016-11-29 08:40:03 -08:00
skin.json Fix typo in skin.json ResourceModuleSkinStyles 2019-09-27 18:35:00 +00:00
variables.less Replace raster image gradients with CSS where easily applicable 2019-10-01 21:38:24 +00:00
vector.js vector.js: Remove eager calculation of p-cactions width on page load 2019-10-02 12:42:42 +00:00

README.md

Vector Skin

Configuration options

Logo used in print styles. Keys are url, width, and height (in pixels). Note that this solution only works correctly if the image pointed to by url is an SVG that does not specify width and height attributes, or its width and height match the corresponding variables below. Alternatively, a PNG or other type of image can be used, but its dimensions also need to match the corresponding variable below. That in turn may result in blurry images, though.

The URL can be absolute or relative.

Example configuration:

$wgVectorPrintLogo = [
	'url' => 'https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg',
	'width' => 174,
	'height' => 27
];
  • Type: Array
  • Default: false