User:Jayprakash12345/SWT-Tasks

Warm-up task
Write a UserScript to show which skin is using by the user after their username in the top navigation link. Like "Username (You are using skinname skin)"

Hints:-
 * Use jQuery ready wrapper so that code run only after web content is loaded.
 * Inspect the username to get an element ID.
 * Use .append to add skin text at the end of the element.
 * Figure out which variable should use to get skin from https://www.mediawiki.org/wiki/Manual:Interface/JavaScript.

Task 1
Write a UserScript to make page title in red if the page is not editable by the user.

Hints:-
 * Use jQuery ready wrapper so that code runs only after web content is loaded.
 * Inspect the page title to get an element ID.
 * Use .css to change the color of element.
 * Use wgIsProbablyEditable to check if the page is editable or not, it returns true or false. So use if statement. See https://www.w3schools.com/js/js_if_else.asp

Task 2
Write a UserScript to create a permanent link to the current pages's revision.

Hints:-
 * Use jQuery ready wrapper so that code runs only after web content is loaded.
 * Load "mediawiki.util" then add portlet link with
 * text "Get the perm link"
 * link "https://meta.wikimedia.org/w/index.php?title=pagename&oldid=revisionId"
 * place should be "p-views"
 * To get page name and current revision number, Use wgPageName and wgRevisionId. You can concatenate the URL use "+"
 * Like "https://meta.wikimedia.org/w/index.php?title=" + page_name + "&oldid=" + revision_Id