User talk:Enterprisey/draft-sorter.js

Latest comment: 2 years ago by Enterprisey in topic Script updates

Interface-protected edit request on 24 June 2019

edit

@Enterprisey: hasn't been very active lately so here we are...

I have written a script, User:SD0001/draft-sort-burst.js, to help editors sort drafts more quickly using this script. For it to work, I need this script to emit some custom events so that my script can know when to act. These should be uncontroversial changes as they don't affect the working of this script.

After line 99 ( } ); ), add

document.dispatchEvent( new Event( "draft_sort:ready" ) );

After line 140 ( .append( ")" ); ), add

document.dispatchEvent( new Event( "draft_sort:saved" ) );

Minor bug fixes unrelated to above:

  • In line 119, change newText += "{{" + element + "|importance=|class=draft}}"; to newText += "{{" + element + "|importance=|class=draft}}\n"; (a newline is added at the end so that different project tags are on different lines).
  • Remove mw.loader.load( "jquery.chosen" ); from the top; instead wrap lines 97-99 with mw.loader.using( "jquery.chosen" ), that is, make it:
            mw.loader.using( "jquery.chosen" ).then( {
                $( select ).chosen( {
                	"placeholder_text_multiple": "Select some WikiProjects"
                } );
            } );
This is because occasionally the script loads without jquery.chosen (which provides the styles and js for the select menu) having loaded, making the menu unusable. I have seen this happen a few times while testing the burst mode.

SD0001 (talk) 18:06, 24 June 2019 (UTC)Reply

  On hold @SD0001: from recent contributions, @Enterprisey: has edited as recently as today, so let's give them chance to review this request to edit their own personal script. You may of course fork it and make your own at any time. — xaosflux Talk 18:15, 24 June 2019 (UTC)Reply
@Xaosflux: Good idea. It seems that I didn't give the idea of forking much thought before - it does the job better... cancelling edit request. SD0001 (talk) 20:57, 24 June 2019 (UTC)Reply
SD0001, thanks for the patch! Done. (Sorry about the late response...) Enterprisey (talk!) 06:22, 7 July 2019 (UTC)Reply

Script updates

edit

@Enterprisey: I made some updates to a fork of this script at User:Ahecht/Scripts/draft-sorter.js to make it a little more useful. It now scans the talk page to pick up any wikiprojects that are already flagged to avoid duplicates, it will wrap wikiproject banners in {{WikiProject banner shell}} if you add three or more, and it can add templates inside an existing banner shell. Feel free to incorporate these changes into your script. --Ahecht (TALK
PAGE
) 02:12, 29 May 2020 (UTC)Reply

@Ahecht, I'm just gonna point people to your version, if that's ok... :) Enterprisey (talk!) 07:41, 23 October 2021 (UTC)Reply