User:PerfektesChaos/js/editToolStrIns/User Customization

Users might customize the standard appearance of their local project configuration.

JS items beginning with a period are references to the particular application object.

User JS edit

Personal JS settings may be defined in common.js or skin related.

.user object edit

If users define a .user object they are able to provide the following properties:

  • .user[ "custom" ]
    Permits removing, changing or appending elements on the standard list object, which equippes the dropdown gadget.
    • .user[ "custom" ] is an array that assigns a modification of some items.
      1. Even index numbers are pointing to the id.
      2. Odd index numbers indicate the title information of the preceding id.
    • The following values might be allocated by id:
      • string – displayed as title in selection
      • true – take selection title from standard list
      • false – discard item from list
    • Items may be selected from global repository just by id.
    • The non-false assignments appear on top of the selection list.
  • .user[ "list" ]
    Set this list as authoritative for available menus. See Details. Collateral use of "custom" is possible but confusing.
  • .user[ "defs" ]
    Provide a menu (group definitions) or put only some attributes on top.
    • IDs with leading @ are reserved for user definitions.
    • The user definition takes precedence over other definitions with the same ID.
  • .user[ "lang" ]
    Requires particular language code which takes a .l10n into effect.
  • .user[ "config" ]
    is an object for general configuration issues. See Details.

With exception of these properties the system will not touch any element here. Users are free to store related data, function definitions and more in this branch without any conflict.

Other edit

Cookie edit

In addition users can recall the most recent selection of a subset on previous edit pages. The state will be stored by something like a cookie, called sessionStorage.

  • Use this name for a cookie:
   .user.config = { "cookieName": "editToolStrIns" };
   .user.config = { "cookieName": false };

By default no cookie/sessionStorage is used.

Disengaging edit

By creating an .off property the generation of the entire tool is prevented, if provided by local project.

CSS edit

Decorative styles can be applied. See Details.

Individual loading edit

If the script is not yet supported by the current project, it can be imported by

if ( wgAction === "edit"  ||  wgAction === "submit" ) {
   mw.loader.load( "https://www.mediawiki.org/w/index.php?title=User:PerfektesChaos/js/editToolStrIns.js&action=raw&ctype=text/javascript" );
}

If details shall be configured by user, the following practice is independent from current project constellation. Otherwise the object may be overwritten either by project or by user. Possibly repeated call of load() does not matter at all.

   if ( typeof( mw.libs.editToolStrIns ) !== "object" ) {
      mw.libs.editToolStrIns  =  { };
   }
   mw.libs.editToolStrIns[ "user" ] = {................};

Conflicting tools edit

If the local project provides another edit tool, the script tries to hide the competitor, if already known.

If not yet known please drop a note on the talk page. The script will be told after a while.

If you are familiar with HTML, CSS and page sources, you may provide the followig statement to help yourself immediately:

   .user.config = { "old": "#someselector" };

with other edit tool identifiable by #someselector. Note that multiple assigments to .user.config need to be combined.

Example edit