User:Thisisborin9/WPLAKERSnewsletter.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <pre><nowiki>
// <nowiki>If you are editing a user talk page, click the send Lakers/News button on your tab bar to add "== WikiProject Los Angeles Lakers Newsletter for {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDATE}}, {{subst:CURRENTYEAR}} == <br /> {{subst:Wikipedia:WikiProject Los Angeles Lakers/Newsletter}}" to the top, set "--> deliver WP LAKERS newsletter" as the edit summary, mark it as a minor edit, and submit.</nowiki>
 
function doSwp() {
  document.editform.wpTextbox1.value = '{' + '{' + 'subst:Wikipedia:WikiProject Los Angeles Lakers/Newsletter}}' + '<br />' + '~~' + '~~' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = '[[Wikipedia:LAKERS|WikiProject Los Angeles Lakers]] Newsletter {' + '{subst:CURRENTMONTHNAME}} {' + '{subst:CURRENTDAY}}, {' + '{subst:CURRENTYEAR}}';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
$(function() {
  if (wgNamespaceNumber == 0 || wgCanonicalNamespace == "Talk" || wgCanonicalNamespace == "User" || wgCanonicalNamespace == "Wikipedia" || wgCanonicalNamespace == "Wikipedia_talk" || wgCanonicalNamespace == "Image" || wgCanonicalNamespace == "Image_talk" || wgCanonicalNamespace == "MediaWiki" || wgCanonicalNamespace == "MediaWiki_talk" || wgCanonicalNamespace == "Template" || wgCanonicalNamespace == "Template_talk" || wgCanonicalNamespace == "Help" || wgCanonicalNamespace == "Help_talk" || wgCanonicalNamespace == "Category" || wgCanonicalNamespace == "Category_talk") {
     // wouldn't it make more sense to just check for wgCanonicalNamespace != "", or am I missing something?
     return;
  }
  if (document.editform) {
     mw.util.addPortletLink("p-cactions", "javascript:doSwp()", "send newsletter", "ca-news", "Send Lakers newsletter", "");
  }
});
 
// by Me
// Designed only for the "new section" button on the top of a talk page