MediaWiki talk:Common.js

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)

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)