Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences

For details and instructions about other browsers, see Wikipedia:Bypass your cache.

$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', {
  dataType: 'script',
  cache: true
}).then(function() {
  // page NS
  pathoschild.TemplateScript.add(
  	[
  	  {
        name: "Line collapse",
        position: "cursor",
        //accessKey: 'c', // enable for use of access-key shortcut
        // see, e.g. https://en.wikipedia.org/wiki/Wikipedia:Keyboard_shortcuts
        script: function(editor) {
          editor

            // join words that are hyphenated across a line break
            // (but leave "|-" table syntax alone)
            .replace(/([^\|])-\n/g, '$1')

            // remove single line breaks; preserve multiple.
            // not if there's a tag, template, table syntax either side of line break
            .replace(/([^>}\n])\n([^<{\|\n])/g, '$1 $2');
        }
      },
    ], {
      forNamespaces: 'page'
    } // common fields
  );
});