User:Thisisborin9/WPLAKERSnewsletter.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.

// <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 for {{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}, {{subst:CURRENTYEAR}}';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
addOnloadHook(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) {
     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