Commit graph

8 commits

Author SHA1 Message Date
Bartosz Dziewoński
8c9ff9c46c ResourceLoaderImageModule: Remove 'type' stuff
Provides no value and makes the definitions uglier. Also, the
implementation sucks.

This is a breaking change, but ResourceLoaderImageModule was not in
any public release yet.

Submitted patches to fix two usages in extensions:
* Gather: I371209afe7b48e7c215ea9912826d4eb2cacf4e5
* MobileFrontend: I1963f5fe759c3a031220157d3a6f0f3b42bc5426

Bug: T94073
Change-Id: I36cfdb09bb203b8d9958e6016447e446dd6ff78b
2015-03-29 19:37:11 +02:00
Bartosz Dziewoński
8edbfb5feb ResourceLoaderImageModule: Implement CSS selector templates
Instead of a 'prefix', a 'selector' can be specified, with a string
containing a simple template to use for CSS selector. For example:

    'selector' => '.mw-ui-icon-{name}'

'prefix' continues to work as before.

When using variants, one might want to provide separate
'selectorWithoutVariant' and 'selectorWithVariant' options.

Available variables are {prefix}, {type}, {name}, and {variant}.

Bug: T78215
Change-Id: I99ccaf25e8d24fed5afd0c4b770d2f389789ce4b
2015-03-29 17:25:02 +00:00
Bartosz Dziewoński
5042d260ce ResourceLoaderImageModule: Improve PHP 5.3 compatibility
In PHP 5.3.x and older, the isset() check in code example below will
yield true. In PHP 5.4 and later, and HHVM, it will correctly yield
false. http://3v4l.org/8p3hm

  $options = 'foo';
  isset( $options['bar'] );

Let's not depend on this behavior here.

Change-Id: I67e83af8afe85b3ddfb5db0009759b8ac5bb7d67
2015-03-29 18:29:41 +02:00
Bartosz Dziewoński
a71167895c ResourceLoaderImageModule: Synchronize CSS with .background-image-svg LESS mixin
Bug: T87504
Change-Id: I790bd953fabbd4ff03f15c94fe101e2f65891520
2015-03-24 18:54:04 +00:00
Kunal Mehta
f63bbdeb08 Fix phpcs warning and errors in includes/resourceloader
Mainly breaking long lines

Change-Id: Ide37c81d156348cfb8a010043d79eaf80f95fded
2015-03-14 18:52:45 -07:00
Bryan Davis
1157312f1e Guard against unset key access in ResourceLoaderImageModule
Seen in production error logs:
  Undefined index: icon in ResourceLoaderImageModule.php on line 162
  Undefined index: icon in ResourceLoaderImageModule.php on line 185

Change-Id: I44e16563bda2dcc0be3c9694ed2b09d20b3d7468
2015-01-09 18:58:46 +00:00
jdlrobson
4cd748a006 ResourceLoaderImageModule: Allow use on mobile
Change-Id: Ic7913aa1a1e1fb8d3742503cbe8a6cb3427fc826
2014-12-10 23:34:40 +00:00
Bartosz Dziewoński
aa00a3e838 ResourceLoaderImageModule for icons
ResourceLoaderImageModule needs a set of SVG files and some data in
the module definition, and produces styles for a set of CSS classes,
one for each image, optionally with differently colored variants,
generated in SVG and PNG, data-URI-embedded if possible, compatible
with all browsers, and generally slick.

The intended usage is to ship icon libraries with MediaWiki that can
be used throughout the pages with no additional code.

* ResourceLoaderImageModule implements all of the logic for data
  parsing and CSS generation.
* ResourceLoaderImage implements the logic for SVG image colorization
  (for variants) and rasterization.
* ResourceLoader and ResourceLoaderContext were extended to serve a
  new kind of load.php request that delivers a single image file. This
  is used for fallback PNG images served to browsers that don't
  understand SVG.

See change Ic6a76bfb for a demo.

Bug: T76473
Co-Authored-By: Trevor Parscal <trevorparscal@gmail.com>
Co-Authored-By: Bartosz Dziewoński <matma.rex@gmail.com>
Change-Id: Idf6ff4eb8e94f45946f15d283d34108b881fae6e
2014-12-09 20:11:07 +01:00