Skip to content

Instantly share code, notes, and snippets.

View jdlrobson's full-sized avatar

Jon Robson jdlrobson

View GitHub Profile
@jdlrobson
jdlrobson / Template:Main_Page_Minerva.css
Last active June 26, 2023 16:15
A MediaWiki compatibility stylesheet for responsive Minerva support
/* This template is loaded on the main page to address T32405
Please feel free to adapt the code, translate this message.
Updates can be found in https://gist.github.com/jdlrobson/dbb124296ed2a1fc7242018c7b589059 */
@media screen and ( max-width: 720px ) {
body.skin-minerva td,
body.skin-minerva tr,
body.skin-minerva .mp-column,
body.skin-minerva .floatleft,
body.skin-minerva .floatright,
body.skin-minerva tbody,
@jdlrobson
jdlrobson / T323223.php
Created November 28, 2022 23:56
testpage
$group = MediaWikiServices::getInstance()->getRepoGroup();
$size = 80;
/*
Generate using following code:
fetch(`https://wikimedia.org/api/rest_v1/metrics/pageviews/top/en.wikipedia.org/all-access/2022/10/10`).then((r) => r.json()).then((r)=> {
const articles = r.items[0].articles.map((a) => a.article);
const all = [];
for( let i = 0; i < articles.length; i += 50 ) {
const t = encodeURIComponent( articles.slice(i, i+50).join('|') );
diff --git a/extension.json b/extension.json
index a8563346..ecd8e5f0 100644
--- a/extension.json
+++ b/extension.json
@@ -164,6 +164,11 @@
}
},
"attributes": {
+ "Popups": {
+ "PluginModules": [
diff --git a/extension.json b/extension.json
index 7abe13ead..b023ebcfb 100644
--- a/extension.json
+++ b/extension.json
@@ -835,7 +835,7 @@
},
"MFSearchAPIParams": {
"value": {
- "ppprop": "displaytitle"
+ "wbetterms": "label"
@jdlrobson
jdlrobson / 5186.patch
Created May 29, 2021 22:48
Suggested changes for #5186
diff --git a/openlibrary/plugins/openlibrary/js/edit.js b/openlibrary/plugins/openlibrary/js/edit.js
index 95e467078..7ab4eea08 100644
--- a/openlibrary/plugins/openlibrary/js/edit.js
+++ b/openlibrary/plugins/openlibrary/js/edit.js
@@ -62,16 +62,16 @@ export function initIdentifierValidation() {
}
const label = $('#select-id').find(`option[value='${data.name}']`).html();
if (data.value == '') {
- return error('#id-errors', 'id-value', dataConfig['You need to give a value to ID.'].replace(/ID/, label));
+ return error('#id-errors', 'id-value', dataConfig.emptyIDError.replace(/ID/, label));
@jdlrobson
jdlrobson / index.js
Created December 9, 2020 23:16
Generating client error reports
npm install csv
mkdir csv
# manual work
# visit https://logstash.wikimedia.org/goto/1def4b2013f38bdcd40dfd51e831254c
# export formatted in " file uri split"
# copy the download to the csv folder
node index.js
@jdlrobson
jdlrobson / core.diff
Last active March 17, 2020 23:56
Allow skins to opt out of sortable and collapsible
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index 44a9eb09a9..c90d4b0da2 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -164,6 +164,40 @@ abstract class Skin extends ContextSource {
*/
public function initPage( OutputPage $out ) {
$this->preloadExistence();
+ $out->addJsConfigVars( [
+ 'wgCollapsible' => $this->supportsFeature( 'table-sorting' ),
diff --git a/src/mobile.notifications.overlay/NotificationsOverlay.js b/src/mobile.notifications.overlay/NotificationsOverlay.js
index 06de6c4b2..b893a5e53 100644
--- a/src/mobile.notifications.overlay/NotificationsOverlay.js
+++ b/src/mobile.notifications.overlay/NotificationsOverlay.js
@@ -2,28 +2,26 @@ var Overlay = require( '../mobile.startup/Overlay' ),
util = require( '../mobile.startup/util' ),
View = require( '../mobile.startup/View' ),
promisedView = require( '../mobile.startup/promisedView' ),
- mfExtend = require( '../mobile.startup/mfExtend' ),
Anchor = require( '../mobile.startup/Anchor' );
@jdlrobson
jdlrobson / gist:e516699c2b78009139e5c69a5cac518c
Created March 13, 2019 01:04
How to submit a MobileFrontend patch.md

Welcome brave explorer to your Wikimedia adventure....

To become a Wikipedia mobile developer you must first, pass 3 brave quests!

Quest 1 - Get a working local version of MobileFrontend

Your first challenge is to clone the three essential repos that you need to get the Wikipedia mobile site showing on your local machine. Imagine these are three crystals that will unlock the power of mobile (or something like that!)

To do this, follow these steps:

@jdlrobson
jdlrobson / pixies.py
Last active February 20, 2019 19:35
#!/usr/bin/env python
'''
Copyright [2017] [Jon Robson]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0