MediaWiki:Gadget-autowelcome.js: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Created page with "/** * autowelcome.js - from https://runescape.wiki/w/User:Quarenon/autowelcome.js * * Automatically insert the welcome notice code when editing a new user talk page. * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope th...") |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
/** * autowelcome.js - from https://runescape.wiki/w/User:Quarenon/autowelcome.js * * Automatically insert the welcome notice code when editing a new user talk page. * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */// <nowiki>$(function() { if (mw.config.get('wgCanonicalNamespace') == 'User_talk' && !mw.config.get('wgTitle').match(/([0-9]{1,3}\.){3}[0-9]{1,3}/) && // don't welcome IPv4 !mw.config.get('wgTitle').match(/([0-9A-F]{1,4}:){7}[0-9A-F]{1,4}/) && // don't welcome IPv6 mw.config.get('wgAction') == 'edit' && mw.config.get('wgArticleId') === 0 && mw.config.get('wgTitle').split('.').length != 4 && mw.config.get('wgTitle').indexOf('/') == -1 && !document.getElementsByClassName('mw-logline-block').length ) { $('#wpTextbox1').val((typeof(window.autoWelcomeText) == 'undefined') ? '{{Welcome}}\n\n-- ~~~~' : window.autoWelcomeText); $('#wpSummary,#wpSummaryEnhanced').val((typeof(window.autoWelcomeSummary) == 'undefined') ? 'Welcome!' : window.autoWelcomeSummary); }})// </nowiki> |
|||
/** |
|||
* autowelcome.js - from https://runescape.wiki/w/User:Quarenon/autowelcome.js |
|||
* |
|||
* Automatically insert the welcome notice code when editing a new user talk page. |
|||
* |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
// <nowiki> |
|||
$(function() { |
|||
if (mw.config.get('wgCanonicalNamespace') == 'User_talk' && |
|||
!mw.config.get('wgTitle').match(/([0-9]{1,3}\.){3}[0-9]{1,3}/) && // don't welcome IPv4 |
|||
!mw.config.get('wgTitle').match(/([0-9A-F]{1,4}:){7}[0-9A-F]{1,4}/) && // don't welcome IPv6 |
|||
mw.config.get('wgAction') == 'edit' && |
|||
mw.config.get('wgArticleId') === 0 && |
|||
mw.config.get('wgTitle').split('.').length != 4 && |
|||
mw.config.get('wgTitle').indexOf('/') == -1 && |
|||
!document.getElementsByClassName('mw-logline-block').length |
|||
) { |
|||
$('#wpTextbox1').val((typeof(window.autoWelcomeText) == 'undefined') ? '{{Welcome}}\n\n-- ~~~~' : window.autoWelcomeText); |
|||
$('#wpSummary,#wpSummaryEnhanced').val((typeof(window.autoWelcomeSummary) == 'undefined') ? 'Welcome!' : window.autoWelcomeSummary); |
|||
} |
|||
}) |
|||
// </nowiki> |
Revision as of 17:12, 17 October 2024
/** * autowelcome.js - from https://runescape.wiki/w/User:Quarenon/autowelcome.js * * Automatically insert the welcome notice code when editing a new user talk page. * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */// <nowiki>$(function() { if (mw.config.get('wgCanonicalNamespace') == 'User_talk' && !mw.config.get('wgTitle').match(/([0-9]{1,3}\.){3}[0-9]{1,3}/) && // don't welcome IPv4 !mw.config.get('wgTitle').match(/([0-9A-F]{1,4}:){7}[0-9A-F]{1,4}/) && // don't welcome IPv6 mw.config.get('wgAction') == 'edit' && mw.config.get('wgArticleId') === 0 && mw.config.get('wgTitle').split('.').length != 4 && mw.config.get('wgTitle').indexOf('/') == -1 && !document.getElementsByClassName('mw-logline-block').length ) { $('#wpTextbox1').val((typeof(window.autoWelcomeText) == 'undefined') ? '{{Welcome}}\n\n-- ~~~~' : window.autoWelcomeText); $('#wpSummary,#wpSummaryEnhanced').val((typeof(window.autoWelcomeSummary) == 'undefined') ? 'Welcome!' : window.autoWelcomeSummary); }})// </nowiki>