MediaWiki talk:Common.js

Require a license value
Try adding this to the end of the script, code from codepen. It might also be possible to adapt so that a description must be entered too. ~Njt (talk) 14:50, November 2, 2019 (EDT) $(function {   $("#mw-upload-form").validate( {       rules: {         #wpLicense: {           required: true }       }      });	});

Change to remove "None selected" as a license option on Upload page
Below is some code that can be added to end of this page in order to remove "None selected" as a license option on the File Upload page, while preselecting the "I don't know/Unknown License" option. User:Notjusttired, could you review this code to see if you think it's worth trying? Pyrrhus (talk) 23:04, August 21, 2019 (EDT)
 * Which code is this linked to? I am not sure this would work, and removing option 0 might renumber our chosen option. I did find that the "None selected" message is set from MediaWiki:Nolicense - what about renaming this to be "I don't know exactly", and removing "I don't know exactly" from MediaWiki:Licenses? Javascript is usually a last resort for when no other way exists and also may be disabled on some people's devices or computers. I've also seen code that would give a pop-up error with "None selected" chosen, warning then their file is likely to be deleted. Also Javascript and possibly very annoying since it will also beep - and we'd need to make sure it didn't trigger when the user first viewed the form and hasn't had time to pick a license. Code here.
 * I have also wondered about changing the default upload boxes so there is a source box, and possibly a category one?
 * On a separate note, is it worth installing the upload wizard? Would it run from the Visual editor when Insert media was selected? notjusttired (talk) 10:50, August 22, 2019 (EDT)

select#wpLicense.selectedIndex = "1"; select#wpLicense.remove(0);

Clearer disclaimer?
This page contains code that adds a bright banner to the top of every page in the “Potential treatments” and “Medical hypotheses” categories. The banner presents a brief disclaimer saying “This is a Potential Treatment page” or “This is a Medical hypothesis page”. I believe the purpose of this disclaimer is to warn readers to expect a slightly lower standard of evidence than that used in other pages. (In line with the “room for debate and speculation” section of MEpedia:About.) What about making this more explicit by adding to the end of each disclaimer, in smaller font, “Please read critically.” Tagging User:JaimeS User:Notjusttired User:Kmdenmark User:Canele User:Sisyphus User:EscapeTheFog User:Hip User:JenB Pyrrhus (talk) 01:35, July 20, 2019 (EDT)

-I'm ok with this. A bit out of topic perhaps but I always thought the sentence: "The information provided at this site is not intended to diagnose or treat any illness." should be at the top of the page and featured more prominently. - Sisyphus.
 * I would rather leave as it is, extra words would make the heading cluttered and less readable. I think the words "hypothesis" and "potential" already flag up that these are controversial / may not have much support. I disagree that the content of the page has weaker sources. I think it's just flagging up that someone once suggested something. As Sisyphus said we already have the disclaimer. notjusttired (talk) 06:17, July 20, 2019 (EDT)
 * Heh, am I allowed to agree with all of the above? I share Pyrhhus and Sisyphus's desire to emphasize disclaimers more strongly (e.g., MEpedia:General disclaimer still needs the update Jaime approved). At the same time, I also agree with Njt that 1, we should be attentive to the paradoxical effect where the less there is to read, the better the chances the message actually gets through, and 2, I worry about differentiating some pages as having lower standards lest it become a false promise about the higher standard elsewhere: as a wiki, where we are never able to 100% monitor and guarantee quality, my preference is encourage readers to apply careful scrutiny across the board.
 * Maybe we could name-check Hypotheses and Potential treatments pages in the Science guidelines as places to be particularly attentive to making sure the prose specifies the quality/limits of evidence available? Canele (talk) 17:07, July 20, 2019 (EDT)
 * It would be easy to put an additional short disclaimer under the page title, perhaps in italics, stating something like "Many potential treatments have been suggested for ME or its symptoms, but the evidence base and theory behind many treatments may be very weak. This treatment may be harmful. There is no cure." or some such thing. This would avoid "information overload" / clutter in the heading.notjusttired (talk) 04:47, July 21, 2019 (EDT)
 * In order to see if adding "Please read critically" would make the banner more cluttered or less readable, I placed both banners side-by-side on the Biopsychosocial model page. Please take a look and see if adding those three words are an improvement or not.  Also consider whether we should move the banner from above the page title to below the page title.  Placing the banner below the page title would allow us to provide foreign-language translations for the banner.  User:Notjusttired User:Hip
 * Pyrrhus (talk) 19:23, October 24, 2019 (EDT)
 * User:Pyrrhus having "please read critically" in the same size as the rest makes it look cluttered but also it looks like part of the title rather than an instruction. The new banner isn't used classes/styles for the colors, so this would need sorting. A bit idea would be a second line in smaller text, possibly another color. Why can't translations be added with the existing banner position? ~Njt (talk)
 * Just checked the common.js code - it can easily be changed to call a template instead of using fixed text, although since the banner should match page language (rather than user language) it wouldn't be a lot of work to add a Javascript translation for the pages in other languages. Creating a separate banner for each page (rather than just per category) would be a mistake. Something not yet considered is a tool tip popup that would appear only when people ran their mouse over the banner, and could be attached to a tiny "info" ℹ︎ icon or image at the end of the word instead, or a banner at the top or bottom that needs to be clicked to make it go away - see this example with wording for bookies - could easily be done as a gadget. Frankly I think there are enough disclaimers and warnings already. ~Njt (talk) 12:33, October 25, 2019 (EDT)
 * I've updated the new banner at Biopsychosocial model. How does it look now User:Notjusttired?  I removed the "Please read critically" and I changed the font to better differentiate it from the title.  Since the banner includes a link to the category page, any further disclaimers can be placed at the top of the category page.  I think the banner is still a bit too big, maybe reduce the banner size a bit?  Any feedback User:Kmdenmark?
 * Pyrrhus (talk) 14:34, October 25, 2019 (EDT)
 * The link colors need sorting - visited links cause blue-on-light blue, for Potential treatments it would be blue-on-lime green. Would be better to have the link in white but also in bold - example at the bottom of this page. As far as I know this can only be sorted with (very simple) CSS. I think it would look better perhaps at 1.6em size text (a bit smaller), and it scrolls off to the right on mobiles - I don't know if this is because of the left/right padding gets added to the 100% width or not - could easily be changed to no padding with a (visible space) before and after text which will look almost the same.  ~Njt (talk) 17:29, October 25, 2019 (EDT)
 * I'm wary about changing the link colors, as people will have trouble recognizing a link in non-standard colors. I think it might be better to adjust the background color to work with the link colors, instead of vice-versa.  I have removed the padding and changed the font to 1.6em. User:Notjusttired
 * Pyrrhus (talk) 18:33, October 25, 2019 (EDT)
 * I looked into color options, seems like #0645AD is the standard link color, I suggest using the darker pastel shades suggested here by Wikipedia (right column), eg This is a #|link and Dark skin with #|link Dark skin with #|link  contrast checker shows them as much better contrast than we have at the moment (looks better too). On the dark skin the link colors are different (orange), a shade of black/grey might be best for add above.  ~Njt (talk) 21:18, October 25, 2019 (EDT)
 * Thanks User:Notjusttired for doing that research on colors! I set the background color to the pastel shade in your example in Common.css, and I set the background color to black in Timeless.css.  Let me know how it looks.
 * Pyrrhus (talk) 22:44, October 25, 2019 (EDT)
 * User:Pyrrhus please undelete MediaWiki talk:Top-notice-Biopsychosocial_model or retrieve the old contents and put them on the new banner talk page. I did not expect it to go so soon and that content is not anywhere else. Feedback on changes - will put Screenshots on Slack:


 * Colors look great on Timeless
 * Banner still in the wrong place, it means both the banner and AddThis tools are above the content, which is cluttered and distracting. The old Javascript can put the banner above the title, like it was before.
 * Class name is really unhelpful: category-banner or hypothesis-banner / treatments-banner would be a better choice. Heading and header have specific meanings and refer to other components or tags / HTML elements.
 * The banner is not centered - a space needs adding after the full stop.
 * I also don't know why it still scrolls, I trying a width of auto instead of 100%
 * I would prefer the banner link text to always used the same color, on Timeless it changes between orange (unvisited link) and blue (visited link) - I would prefer just blue. Feels inconsistent. See code in User:Notjusttired/timeless.css to fix this.
 * Special upload changes made at the same time do not work, so should be reverted. I suggest disabling the None selected option in Javascript instead, which will prevent the user continuing without selecting a licence.
 * Just noticed the Timeless skin does not have the "Special:Upload" link in the sidebar that Pivot has. Instead it's on the right with wikitools. (It's supposed to be in the Tools area, which is on the right on Timeless). ~Njt (talk) 18:45, October 26, 2019 (EDT)

New code for this page to fix Pivot
User:Kmdenmark Please replace the code with that listed below - it adds a few new lines that use a different class for banners on pivot. This will hopefully make the Potential treatments and other banners visible on Pivot skin. If it turns out that the change ruins the banner on other pages then please reverse it. You can check via pages like Ampligen. Thanks notjusttired (talk) 04:57, July 21, 2019 (EDT)
 * Done! Kmdenmark (talk) 14:10, July 30, 2019 (EDT)
 * Can you take another look please, using the code under the Code subheading underneath? The page looks the same as before at the moment. User:Kmdenmark notjusttired (talk) 17:59, July 31, 2019 (EDT)
 * How about now? Kmdenmark (talk) 13:14, August 1, 2019 (EDT)
 * Brilliant!! Thanks!!! notjusttired (talk) 11:46, August 2, 2019 (EDT)

Code
/* Any JavaScript here will be loaded for all users on every page load. */

// Globals at https://www.mediawiki.org/wiki/Manual:Interface/JavaScript

// GOOGLE ANALYTICS (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function{ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date;a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-60945029-2', 'auto'); ga('send', 'pageview'); // END GOOGLE ANALYTICS

// Require a summary on edit pages $('#editform').submit(function (e) {   var summary = $('#wpSummary');    // https://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces    if (wgPageName.match(/^(User|Talk|Module|.*?_talk):/) || !summary.val.match(/^(\/\*.*?\*\/)?\s*$/)) {        return;    }    summary[0].scrollIntoView;    alert("Please enter a summary of the changes you are making in the designated text box.");    summary.focus;    e.preventDefault; });

//Override template:totalviews to get the number of total views of the website

$.ajax ("/wiki/Special:Statistics").done (function (response){ $('span.totalnumbderofviews').text(($(response).find('#mw-hitcounters-statistics-views-total>.mw-statistics-numbers').text)); });

//Set color to specific categories

//For Medical hypotheses category if (wgCategories.includes ("Medical hypotheses")){ //$(".mw-body-content").css ("background-color","#dae6ff"); //$(".toc").css ("background-color","#dae6ff"); $(".firstHeading").prepend (' This is a Medical hypothesis page ');

// pivot fix $("h1.title").prepend (' This is a Medical hypothesis page '); }

//For Potential treatments category if (wgCategories.includes ("Potential treatments")){ //$(".mw-body-content").css ("background-color","#f8d6c2"); //$(".toc").css ("background-color","#f8d6c2"); $(".firstHeading").prepend (' This is a Potential treatments page ');

// pivot fix $("h1.title").prepend (' This is a Potential treatments page '); }

Possible typo
Are there issues with the hits reported on Special:Statistics or Special:PopularPages, which comes from mw:Extension:HitCounters? Possible typo found - span.totalnumb d erofviews must not be corrected until certain it is wrong  ~Njt (talk)
 * $('span.totalnumbderofviews').text(($(response).find('#mw-hitcounters-statistics-views-total>.mw-statistics-numbers').text));
 * It's a "permanent typo", and is not to be changed. I read some MediaWiki page that has a special note regarding this typo.  It annoys me every time I see it, but that's just how it goes, I guess.
 * Pyrrhus (talk) 22:48, October 5, 2019 (EDT)