User:Diriector Doc/Scripts/DiscussionTools.js

// const imgDataURI = { signature: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48dGl0bGU+c2lnbmF0dXJlPC90aXRsZT48cGF0aCBkPSJNMCAxOGgyMHYxSDB6bS0uMDAzLTYuMTU1bDEuMDYtMS4wNiA0LjM2MyA0LjM2Mi0xLjA2IDEuMDZ6Ii8+PHBhdGggZD0iTS4wMDQgMTUuMTQ3bDQuMzYzLTQuMzYzIDEuMDYgMS4wNjEtNC4zNjIgNC4zNjN6TTE3IDVjMCA5LTExIDktMTEgOXYtMS41czggLjUgOS41LTYuNUMxNiA0IDE1IDIuNSAxNCAyLjVTMTEgNCAxMC43NSAxMGMtLjA4IDIgLjc1IDQuNSAzLjI1IDQuNSAxLjUgMCAyLTEgMy41LTFhMi4wNyAyLjA3IDAgMDEyLjI1IDIuNWgtMS41cy4xMy0xLS41LTFDMTYgMTUgMTYgMTYgMTQgMTZjMCAwLTQuNzUgMC00Ljc1LTZTMTIgMSAxNCAxYy41IDAgMyAwIDMgNHoiLz48L3N2Zz4=", clock: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHR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xNTQ5IDUuMjc1OTk3LC0wLjgxMjUwMSBDIDcuODQxMDEzOSwxOS45OTI4NzMgMTEuNDY4MDc3LDIwIDExLjQ2ODA3NywyMCAxNC4xMzQ3MiwyMCAxNC4xMzQ3MiwxOC42NjY2NjcgMTYuNDY4MDM0LDE4LjY2NjY2NyAxNy4zMDgwMjgsMTguNjY2NjY3IDE3LjEzNDY5NiwyMCAxNy4xMzQ2OTYsMjAgaCAxLjk5OTk4MiBBIDIuNzU5OTc2NywyLjc2IDAgMCAwIDE2LjEzNDcwNCwxNi42NjY2NjcgQyAxNC4xMzQ3MiwxNi42NjY2NjcgMTMuNDY4MDU5LDE4IDExLjQ2ODA3NywxOCA5Ljc1NDU2MDMsMTggOC42MzcyNTM5LDE3LjExNDE3IDcuOTYyODk4MiwxNS44OTU4MzQgMTEuNjg2MjYzLDE0LjQxOTc4MiAxNS40NjgwNDIsMTEuNDI3NjcxIDE1LjQ2ODA0Miw1LjMzMzMzMzMgMTUuNDY4MDQyLDAgMTIuMTM0NzM3LDAgMTEuNDY4MDc3LDAgWiBtIDAsMiBDIDEyLjgwMTM5OSwyIDE0LjEzNDcyLDQgMTMuNDY4MDU5LDYuNjY2NjY2NiAxMi41NzQxNjYsMTAuODM4MjA0IDkuOTQ5OTY1NCwxMy4wMDQxOTYgNy4zMTk2NzQzLDE0LjEzMjgxMyA3LjE2NzIzODIsMTMuNDIyODE0IDcuMTA3MTc4OCwxMi42OTAwMjcgNy4xMzQ3Nzk5LDEyIDcuNDY4MTEwMyw0IDEwLjEzNDc1NCwyIDExLjQ2ODA3NywyIFoiCiAgICAgaWQ9InBhdGg2IgogICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgc3R5bGU9InN0cm9rZS13aWR0aDoxLjMzMzMyNzc3IiAvPgo8L3N2Zz4K" }; importScript("User:Diriector Doc/Scripts/DialogBox.js");

var customizeToolbar = function{ //Sometimes, this script loads before window.Forms does. If this happens, the script will reload (catch) try{ Forms = window.Forms; dialogBox = window.dialogBox; //upon difinition, "new dialogBox" will at itself to Forms.Templates so there is no need co create a variable for it. new dialogBox("Discussion", "disc",		[		{"field": "Result"}		],		[],		(function{ var tem = Forms.getOpenTemplate; let content = "{{subst:" + "Discussion top"; var fieldname = tem.basic[0].field; var field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; }			return { pre: content+"\n}}\n", post: '\n' };		})		);		let atopBox = function(name, short){ new dialogBox(name, short,			[			{"field": "Result"},			{"field": "Status", "tooltip": "status-tooltip"}			],			[],			(function{ var tem = Forms.getOpenTemplate; let content = "{{subst:" + short; for(var i = 0; i < tem.basic.length; i++) { var fieldname = tem.basic[i].field; var field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; }				}				return { pre: content+"\n}}\n", post: '\n' };			})			);		};		atopBox("Archive Top", "atop"); atopBox("Archive Top Red", "atopr"); atopBox("Archive Top Green", "atopg"); atopBox("Archive Top Yellow", "atopy"); new dialogBox("Poll", "pot",		[		{"field": "Result"},		{"field": "Type", "tooltip": "poll-type-tooltip"}		],		[],		(function{ var tem = Forms.getOpenTemplate; let content = "{{subst:" + "pot"; for(var i = 0; i < tem.basic.length; i++) { var fieldname = tem.basic[i].field; var field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; }			}			return { pre: content+"\n}}\n", post: '\n' };		})		);		new dialogBox("RM", "rm",		[		{"field": "Result"},		{"field": "NAC", "tooltip": "nac-tooltip"},		{"field": "PMC", "tooltip": "pmc-tooltip"}		],		[],		(function{ var tem = Forms.getOpenTemplate; let content = "{{subst:" + "RM top"; for(var i = 0; i < tem.basic.length; i++) { var fieldname = tem.basic[i].field; var field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; if(i == 2) break; }			}			return { pre: content+"\n}}\n", post: '\n' };		})		);		new dialogBox("Closed rfc", "rfc",		[		{"field": "Reason"}		],		[],		(function{ var tem = Forms.getOpenTemplate; let content = "{{rfc top"; var fieldname = tem.basic[0].field; var field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "|" + field; }			return { pre: content+"}}\n", post: '\n' };		})		);		new dialogBox("Collapse", "col",		[		{"field": "Title"},		{"field": "Status", "tooltip": "status-tooltip"}		],		[		{"field": "Warning", "tooltip": "col-warning-tooltip"},		{"field": "Collapse", "tooltip": "col-collapse-tooltip"}		],		(function{ var tem = Forms.getOpenTemplate; let content = "{{Collapse top"; var fieldname, field; for(var i = 0; i < tem.basic.length; i++) { fieldname = tem.basic[i].field; field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; }			}			for(var i = 0; i < tem.extra.length; i++) { fieldname = tem.extra[i].field; field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; }			}			return { pre: content+"\n}}\n", post: '\n' };		})		);		new dialogBox("Hidden", "hat",		[		{"field": "Reason"},		{"field": "Closer"},		{"field": "Collapse", "tooltip": "col-collapse-tooltip"}		],		[],		(function{ var tem = Forms.getOpenTemplate; let content = "{{Hidden archive top"; var fieldname, field; for(var i = 0; i < tem.basic.length; i++) { fieldname = tem.basic[i].field; field = $.trim($('#form-'+Forms.escStr(tem.shortform)+'-'+fieldname).val); if (field) { content += "\n| " + fieldname.toLocaleLowerCase + " = " + field; }			}			return { pre: content+"\n}}\n", post: '\n' };		})		);		//Now that I have designed the dialog box, I need to turn it into an availible module Forms.init; } catch(e) { //This reloads the script after 500ms in order to correctly grab window.Forms when it loads setTimeout(customizeToolbar, 500); return; }	//Adding a new dropdown section to the toolbar $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {		'sections': {			'discussion': {				'type': 'toolbar',				'label': 'Discussion'			}		}	}); //Adding a news sections to the new dropdown toolbar $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {		'section': 'discussion',		'groups': {			'signing': {				//'labelMsg': 'group-signing-label'			},			'pinging': {				'label': 'Pinging'			},			'archiving': {				'label': 'Archiving'			},			'editRequests': {				'label': 'Edit Request'			}		}	}); //Adding buttons to the "signing" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {		'section': 'discussion',		'group': 'signing',		'tools': {			'sigAndTime': {				label: 'Signature and timestamp',				type: 'button',				icon: imgDataURI.signature,				action: {					type: 'encapsulate',					options: {						pre: "--" + ""					}				}			},			'justTime': {				label: 'Just timestamp',				type: 'button',				icon: imgDataURI.clock,				action: {					type: 'encapsulate',					options: {						pre: "" + "~" + ""					}				}			},			'justSig': {				label: 'Just signature',				type: 'button',				icon: imgDataURI.calligraphy,				action: {					type: 'encapsulate',					options: {						pre: "--" + "~"					}				}			}		}	}); //Adding dropdown to the "pinging" section $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {		'section': 'discussion',		'group': 'pinging',		'tools': {			'pingSelect': {				label: 'Templates',				type: 'select',				list: {					'Ping-button': {						label: ,						action: {							type: 'encapsulate',							options: {								pre: 							}						}					},					'Reply_to-button': {						label: ,						action: {							type: 'encapsulate',							options: {								pre: 							}						}					},					'Hidden_ping-button': {						label: ,						action: {							type: 'encapsulate',							options: {								pre: 							}						}					},					'To-button': {						label: ,						action: {							type: 'encapsulate',							options: {								pre: 							}						}					},					'User_link-button': {						label: ,						action: {							type: 'encapsulate',							options: {								pre: ,								post: 							}						}					},					'No_ping-button': {						label: , action: { type: 'encapsulate', options: { pre: '' }						}					}				}			}		}	});	//Adding drop-down to the "archiving" section	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'discussion', 'group': 'archiving', 'tools': { 'archiveSelect': { label: 'Templates', type: 'select', list: { 'Archive-button': { label: '', action: { type: 'dialog', module: 'dialog-atop' }					},					'Discussion-button': { label: '', action: { type: 'dialog', module: 'dialog-disc' }					},					'Poll-button': { label: '', action: { type: 'dialog', module: 'dialog-pot' }					},					'Collapse-button': { label: '', action: { type: 'dialog', module: 'dialog-col' }					},					'Hidden_archive-button': { label: '', action: { type: 'dialog', module: 'dialog-hat' }					},					'Closed_RFC-button': { label: '', action: { type: 'dialog', module: 'dialog-rfc' }					},					'RM-button': { label: '', action: { type: 'dialog', module: 'dialog-rm' }					},					'Archive_r-button': { label: ' (red)', action: { type: 'dialog', module: 'dialog-atopr' }					},					'Archive_g-button': { label: ' (green)', action: { type: 'dialog', module: 'dialog-atopg' }					},					'Archive_y-button': { label: ' (yellow)', action: { type: 'dialog', module: 'dialog-atopy' }					}				}			}		}	});	//Adding drop-down to the "edit request" section	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'discussion', 'group': 'editRequests', 'tools': { 'pingSelect': { label: 'Templates', type: 'select', list: { 'FPER': { label: '', action: { type: 'encapsulate', options: { pre: '' }						}					},					'SPER': { label: '', action: { type: 'encapsulate', options: { pre: '' }						}					},					'EPER': { label: '', action: { type: 'encapsulate', options: { pre: '' }						}					},					'TPER': { label: '', action: { type: 'encapsulate', options: { pre: '' }						}					},					'IPER': { label: '', action: { type: 'encapsulate', options: { pre: '' }						}					},					'edit': { label: '', action: { type: 'encapsulate', options: { pre: '' }						}					},					'move':{ label: '', action: { type: 'encapsulate', options: { pre: '', post: ' \n\n' }						}					}				}			}		}	});	mw.usability.addMessages({ "status-tooltip": "Possible values: resolved, withdrawn, moved, or none", "poll-type-tooltip": "Used when it is not a move proposal", "nac-tooltip": 'Set to "yes" to indicate a non-admin closure (overrides PMC)', "pmc-tooltip": 'Set to "yes" to indicate a page mover closure', "col-warning-tooltip": 'Set to "no" to remove the "Do not modify" warning', "col-collapse-tooltip": 'Set to "no" to have content be shown on page load.', "wikieditor-toolbar-tool-atop-title": "Archive Top", "wikieditor-toolbar-tool-atopr-title": "Archive Top (Red)", "wikieditor-toolbar-tool-atopg-title": "Archive Top (Green)", "wikieditor-toolbar-tool-atopy-title": "Archive Top (Yellow)", "wikieditor-toolbar-tool-col-title": "Collapse Top", "wikieditor-toolbar-tool-disc-title": "Discussion Top", "wikieditor-toolbar-tool-hat-title": "Hidden Archive", "wikieditor-toolbar-tool-pot-title": "Poll Top", "wikieditor-toolbar-tool-rfc-title": "Rfc Top", "wikieditor-toolbar-tool-rm-title": "RM Top" }); };

/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ if(['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1){ /*	* Will only procede if in one of these namespaces: ** *Talk			1 ** *User			2 ** *User talk		3 ** *Wikipedia		4 ** *Wikipedia talk	5 ** *File talk		7 ** *MediaWiki talk	9 ** *Template talk	11 ** *Help talk		13 ** *Category talk	15 ** *Portal talk		101 ** *Draft talk		119 ** *Module talk 	829 * Basically only pages with discussions going on	*/ if([1, 2, 3, 4, 5, 7, 9, 11, 13, 15, 101, 119, 829].some(function(e){return mw.config.get('wgNamespaceNumber') == e})){ let pagename = mw.config.get('wgPageName'); /* Will only procede if not in not using code editor (hopefully) */ if(!((pagename.substr(pagename.length - 3) === ".js" || pagename.substr(pagename.length - 4) === ".css") && mw.config.get('wgNamespaceNumber') % 2 === 0)){ mw.loader.using('user.options').then(function{				// This can be the string "0" if the user disabled the preference (T54542)				if(mw.user.options.get('usebetatoolbar') == 1){					$.when(mw.loader.using('ext.wikiEditor'), $.ready).then(customizeToolbar);				}			}); }	} } //