பயனர்:Shrikarsan/common.js

விக்கிமேற்கோள் இலிருந்து

குறிப்பு - சேமித்த பின்னர், நீங்கள் செய்த மாற்றங்களைக் காண்பதற்கு உங்கள் உலவியின் இடைமாற்று அகற்றப்பட வேண்டும்.

  • மொஸில்லா பயர்பாக்ஸ் / சபாரி: Shift+Reload, அல்லது Ctrl-F5 அல்லது Ctrl-R (⌘-R Mac ல்)
  • கூகிள் குரோம் Ctrl-Shift-R அழுத்தவும். (⌘-Shift-R Mac ல்) ;
  • இண்டர்நெட் எக்ஸ்ப்ளோரர்: Ctrl-Refresh அல்லது Ctrl-F5 ஐ அழுத்தவும்.
  • ஒபேரா: Tools → Preferences இல் இடைமாற்றை அகற்றவும்;
mw.loader.using( 'mediawiki.util', function () {
	var showNotice = function () {
 
		// Stick a "Watchlist update!" notice after the notification count
		$( "#pt-notifications" ).after(
        	$( "<li>" ).append( $( "<a>" )
        		.text( "Watchlist update!" )
        		.css( {
        			"background-color": "green",
        			"color": "white",
        			"border-radius": "2px",
        			"padding": "0.25em 0.45em 0.2em",
        			"cursor": "pointer",
        			"font-weight": "bold",
        			"transition": "background-color 0.5s"
        		} )
        		.attr( "href", "/wiki/Special:Watchlist" )
        		.mouseover( updateNotice )
        	)
        	.attr( "id", "watchlist-update-notice" )
        );
	};
	
	var updateNotice = function() {
		// Lighten the background color so the user knows we're updating
		$( "#watchlist-update-notice a" ).css( "background-color", "#7bff7b" );
		
		// Update the notice
		$.getJSON(
    		mw.util.wikiScript( 'api' ),
    		{
    			format: "json",
    			action: "query",
    			list: "watchlist",
    			
    			title:"மலையாளப் பழமொழிகள்",
    			
    			wlshow: "unread",
    			wllimit: 1 // Because we're checking if there are *any* entries
    		} ).done(function( data ) {
    			if( !data.query ) return;
    			if( data.query.watchlist.length ) {
 
    				// There are new watchlist diffs to read, so show notice
    				if( !$( "#watchlist-update-notice" ).length ) {
    					
    					// That is, if it isn't shown already
    					showNotice();
    					$( '#watchlist-update-notice' ).click( function( e ) {
			$( '#watchlist-update-notice' ).hide();
			e.preventDefault();
		} );
    				} else {
    					
    					// There's already a notice, so change background
    					$( "#watchlist-update-notice a" ).css( "background-color", "green" );
    				}
    			} else {
    				
    				// No new watchlist diffs to read, so hide notice
    				$( "#watchlist-update-notice" ).remove();
    			}
    		}
    	);
	};
 
    $( document ).ready( function () { 
	    updateNotice();
    } );
} );

mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js');
/**
 * Tutorial script: QuickRC ("Quick Recent Changes")
 *
 * A tutorial user script which adds a link to the toolbox to show a pop-up
 * dialog with up to 25 recent edits.
 *
 * Demonstrates:
 * - Use of the API
 * - Use of jQuery
 * - Use of ResourceLoader and some of the default modules that come with it
 *
 * (Be bold and improve it!)
 *
 * Authors:
 * Erik Moeller, 2011, public domain
 * 
 */
 
// Import the jQuery dialog plugin before starting the rest of this script
mw.loader.using(['jquery.ui'], function() {
 
    function renderQuickRCDialog( pageLinks ) {
    	var $dialog = $( '<div></div>' )
			.html(
				'<strong>Welcome, ' + mw.user.getName() +
				'!</strong> The following pages have been recently modified:<br/><ul><li>' +
				pageLinks.join( '<br /><li>' ) + '</ul>'
			)
			.dialog({
				autoOpen: true,
				title: 'Hello there!',
				width: '70%',
				modal: true
			});
	}
 
	function quickRC() {
		var myPageLinks = [];
		var myTitles = [];
 
		// Fetch recent changes from the API by one of jQuery's AJAX functions
		jQuery.getJSON(
			mw.util.wikiScript( 'api' ),
			{
				'format': 'json',
				'action': 'query',
				'list': 'recentchanges',
				'rclimit' : 25
			},
			function( data ) {
 
				// Build a unique array of links, using the mw.html library to format them.
				$.each ( data.query.recentchanges , function( index , rc ) {
					// Don't link to this title if we've seen this title already
					if ( $.inArray( rc.title, myTitles ) === -1 ) {
						myPageLinks.push(
							mw.html.element(
								'a', { href: mw.util.getUrl( rc.title ) }, rc.title
							)
						);
					}
 
					myTitles.push( rc.title );
				} ) ;
 
				renderQuickRCDialog( myPageLinks );
			}
		);
	}
 
	$(document).ready( function() {
 
    	// Add a link to the toolbox
		var link = mw.util.addPortletLink(
            'navigation_widget.widget.sidebox.navigation_box',
			'#',
			'Quick changelog',
    		'qchangelog',
			'Show a quick overview of changes',
			null,
			'#t-whatlinkshere'
		);
 
		// Create a jQuery object for this link so that we get
		// to use jQuery awesomeness like .click() for binding functions to events
		// and methods like e.preventDefault();
		$(link).click( function( e ) {
			// Avoid the browser going to '#'
			e.preventDefault();
 
			// Initiate quickRC!
			quickRC();
		});
 
	});
 
});

/* Display {{work}}/{{trope}} wanted pages without real redlinks */
$( window ).load(function() {
  // Hilight submenus
  $(".sp-menu ul li ul li:has(ul)").find("a:first").append(" &raquo;");
 
  var dropdown = document.getElementById('tm-wantedpages');
  if (!dropdown) { return true; }
 
  var mainpage = document.getElementById('tm-toplevelpage').innerHTML + '/';
  mainpage = mainpage.substr(6);
  var mainpage_uri = encodeURIComponent(mainpage);
 
  var templateelem = document.getElementById('tm-templatetype');
  templatetype = templateelem ? templateelem.innerHTML : 'work';
 
  var sp = document.getElementById( 'tm-Wanted' ).innerHTML.split("\t");
  sp.forEach( function(subpage) {
    var sp_underscore = subpage.replace(" ", "_");
    var sp_nospace = subpage.replace(" ", "");
 
    var li = document.createElement('li');
	var link = document.createElement('a');
    link.href = '/w/index.php?title='+ mainpage_uri + sp_underscore
      + '&preload=Mediawiki:'+ sp_nospace
      + '&preloadparams[]=' + templatetype
      + '&action=edit&redlink=1';
 
    var icon = document.createElement('span');
	icon.id = "tm-" + sp_underscore;
 
	link.appendChild(icon);
	link.innerHTML += subpage;
	li.appendChild(link);
	dropdown.appendChild(li);
  });
 
  var li = document.createElement('li');
  li.innerHTML = '<strong><form action="/w/index.php?" accept-charset=utf-8><input type="text" name="title" value="'+mainpage.replace("_", " ")+'" style="max-width:70%; font-size:10px">'
  + '<input type="hidden" name="action" value="edit"><input type="hidden" name="redlink" value="1"><input type="hidden" name="preload" value="Mediawiki:GenericSubpage"><input type="hidden" name="preloadparams[]" value="'+templatetype+'"><input type="submit" value="Go"></form></strong>';
  dropdown.appendChild(li);
});
"https://ta.wikiquote.org/w/index.php?title=பயனர்:Shrikarsan/common.js&oldid=36249" இலிருந்து மீள்விக்கப்பட்டது