Page MenuHomePhabricator

Add conditional loading support for gadgets based on Page action, namespace, or special page
Closed, DuplicatePublic

Description

currently, resourceloader can (dynamically) filter gadgets, based, e.g., on "skin", meaning some gadget may load or not load for a particular user based on "useskin" parameter to index.php. it would be nice to extend this dynamic filtering functionality, for "action" and "namespace", and possibly for special page name.

some gadgets are only useful in certain actions or certain namespaces. such gadgets can be pretty heavy: for instance, wikEd (enwiki) can be safely limited to action=edit|submit, and the heavy commons gadget Cat-a-lot is only useful in the category namespace.

REQUEST:
teach resourceloder to filter with actions= and namespaces= like so:
gadget[Resourceloader|dependecies=1,2,3|rights=a,b,c|namespaces=x,y,z|actions=i,ii,iii]|gadget.js,gadget.css.

bonus points: add "special", e.g., special=Watchlist,RecentChanges,Contributions - there are quite a few gadgets that only do something useful in one of those special pages, and it would be nice to avoid loading them (and their dependencies) elsewhere.

tried to look for a similar request and did not find any. if there is such' please mark as dupe.

peace.

Event Timeline

Krinkle renamed this task from teach resourceloader to filter on action and namespace to Add conditional loading support for gadgets based on Page action or namespace.Jun 5 2017, 5:02 PM
Kipod renamed this task from Add conditional loading support for gadgets based on Page action or namespace to Add conditional loading support for gadgets based on Page action, namespace, or special page.Jun 10 2017, 3:44 PM
Kipod updated the task description. (Show Details)