Skip to content

Instantly share code, notes, and snippets.

View jdlrobson's full-sized avatar

Jon Robson jdlrobson

View GitHub Profile
@jdlrobson
jdlrobson / gather.diff
Last active August 29, 2015 14:16
gather.diff
diff --git a/Gather.php b/Gather.php
index 9991550..60e72fe 100644
--- a/Gather.php
+++ b/Gather.php
@@ -79,6 +79,7 @@ $wgHooks['UnitTestsList'][] = 'Gather\Hooks::onUnitTestsList';
$wgHooks['getUserPermissionsErrors'][] = 'Gather\Hooks::onGetUserPermissionsErrors';
$wgHooks['ContentHandlerDefaultModelFor'][] = 'Gather\Hooks::onContentHandlerDefaultModelFor';
$wgHooks['SkinMinervaDefaultModules'][] = 'Gather\Hooks::onSkinMinervaDefaultModules';
+$wgHooks['MakeGlobalVariablesScript'][] = 'Gather\Hooks::onMakeGlobalVariablesScript';
diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php
index fbca08e..06c418d 100644
--- a/includes/resourceloader/ResourceLoaderFileModule.php
+++ b/includes/resourceloader/ResourceLoaderFileModule.php
@@ -295,6 +295,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
}
if ( $hasTemplates ) {
$this->dependencies[] = 'mediawiki.template';
+ foreach ( $this->templates as $alias => $templatePath ) {
+ // if alias ends with .mustache and mustache is not a dependency
return this.postWithToken( 'watch', {
id: id,
remove: true,
titles: [ page.getTitle() ],
action: 'editlist'
} );
array(14) { ["action"]=> string(5) "query" ["list"]=> string(5) "lists" ["lstids"]=> int(999) ["lstprop"]=> string(30) "label|description|public|image" ["prop"]=> string(19) "pageimages|extracts" ["generator"]=> string(9) "listpages" ["glspid"]=> int(999) ["explaintext"]=> bool(true) ["exintro"]=> bool(true) ["exchars"]=> int(140) ["glsplimit"]=> int(50) ["exlimit"]=> int(50) ["pilimit"]=> int(50) ["continue"]=> string(0) "" }
$api = new ApiMain( new FauxRequest( array(
'action' => 'query',
'list' => 'lists',
'lstmode' => $subPage === 'hidden' ? 'allhidden' : 'allpublic',
// FIXME: Need owner to link to collection
'lstprop' => 'label|description|image|count|updated|owner',
// TODO: Pagination
'continue' => '',
) ) );
@jdlrobson
jdlrobson / GatherPowerAdminTool.js
Created March 31, 2015 23:37
GatherPowerAdminTool
/*jshint unused:vars */
( function ( M, $ ) {
function init() {
var collection = mw.config.get( 'wgGatherCollections' );
if ( collection[0] ) {
collection = collection[0];
}
mw.loader.using( 'ext.gather.watchstar' ).done( function() {
$( '<button class="mw-ui-button mw-ui-destructive">OH NOOOO! Hide it!</button>' )
@jdlrobson
jdlrobson / jkpatrolling.py
Last active August 29, 2015 14:18
Patrol newly created collections
#!/usr/bin/python
#written for python 3.4.2
import urllib.request
import json
from urllib.request import urlopen
from urllib.request import HTTPError, URLError
import time
import urllib.parse
from pprint import pprint
diff --git a/i18n/en.json b/i18n/en.json
index 63ca958..942352a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -105,6 +105,7 @@
"gather-overlay-edit-button": "Edit title and description",
"gather-overlay-continue": "Next",
"right-gather-hidelist": "Force a public user list to become hidden",
+ "gather-api-help-param-sortby": "Specify the sorting mechanism to use on collection.",
"apihelp-gather-description": "List and edit Gather collections.",
diff --git a/javascripts/View.js b/javascripts/View.js
index d76a5a9..41e2979 100644
--- a/javascripts/View.js
+++ b/javascripts/View.js
@@ -195,14 +195,24 @@
* options
*/
render: function ( data ) {
+ var optionsClone, key;
$.extend( this.options, data );
@jdlrobson
jdlrobson / firstPaint.js
Created May 13, 2015 19:21
Time till first paint
var runs = 10;
var times = localStorage.getItem( 'FirstPaint' );
times = times ? times.split( '|' ) : [];
var x = window.chrome.loadTimes();
var dur = x.firstPaintTime - x.startLoadTime;
times.push( String( dur ) );
// create average
console.log( times );
if ( times.length === runs ) {