Jump to content

Talk:Snippets

About this board

Previous page history was archived for backup purposes at Talk:Snippets/LQT Archive 1 on 2015-07-10.

Make it possible to import the snippets directly

3
He7d3r (talkcontribs)

Hi!

I was wondering if wouldn't be better to have the snippets code in real .js pages (e.g. on MediaWiki: namespace, problably as gadgets) so that people could use

mw.loader.load( '//www.mediawiki.org/w/index.php?title=MediaWiki:SomeSnippet.js&action=raw&ctype=text/javascript' );

instead of copying the source from Mediawiki pages. The migration guide suggests we should avoid duplication of code.

In case it is necessary to display the source on documentation page, that could be achieved easily by using something like

{{#tag:syntaxhighlight
  |{{:MediaWiki:Gadget-HotCat.js}}
  |lang=javascript
  }}

which results in

mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400' );

which is the content of MediaWiki:Gadget-HotCat.js.

Krinkle (talkcontribs)

Indeed, but these are small snippets intended as inspiration or examples or so simple that they need no centralization.

The last thing you want is to load all of these as separate http requests for 10 lines of code, that'd be a significant cut in performance.

Stuff that is more advanced or stuff you think should be a gadget, simply make it a gadget and remove the snippet.

He7d3r (talkcontribs)

We should reconsider this, as there are many outdated copies of Snippets copied to WMF wikis' MediaWiki:Common.js pages (or default gadgets).

Reply to "Make it possible to import the snippets directly"

"How to use snippets" page missing

3
Nakohdo (talkcontribs)

Links from the individual snippet pages point to Snippets but content is not available (any more?).

Reply to ""How to use snippets" page missing"
There are no older topics