Jump to content

User:Nischayn22/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if (wgCanonicalSpecialPageName == 'Watchlist') 
  importScript('user:js/watchlist.js');


$(function() {
		mw.loader.using( ['jquery.ui', 'mediawiki.api'], function() {
			if ( !$('.wp-twa').length ) {
				return;
			}
			$('.wp-twa').find( '.submit' )
				.click( function( e ) {
					e.preventDefault();
					var targetPage = $( '.wp-twa' ).find( '.wp-twa-page' ).text();
					var msgPage = $( '.wp-twa' ).find( '.wp-twa-msg' ).text();
					var api = new mw.Api();
 
					api.get( {
						'action' : 'query',
						'titles' : msgPage,
						'prop'   : 'revisions|info',
						'intoken' : 'edit',
						'rvprop' : 'content',
						'indexpageids' : 1
					}, {
						'ok' : function(result) {
							result = result.query;
							var page = result.pages[result.pageids[0]];
							var text = page.revisions[0]['*'];
							api.post(
								{
									'action' : 'edit',
									'title' : targetPage,
									'appendtext' : "\n" + text,
									'summary' : 'New Message ([[WP:The Wikipedia Adventure|The Wikipedia Adventure]])',
									'token' : page.edittoken
								},
								{
									'ok' : function() {window.location.reload();}
								}
							);
						}
					}	);
				});
			}
		);
	});




window.twa_msg = function( targetPage, msgPage ) {
	var api = new mw.Api();

	api.get( {
		'action' : 'query',
		'titles' : msgPage,
		'prop'   : 'revisions|info',
		'intoken' : 'edit',
		'rvprop' : 'content',
		'indexpageids' : 1
	}, {
		'ok' : function(result) {
			result = result.query;
			var page = result.pages[result.pageids[0]];
			var text = page.revisions[0]['*'];
			api.post(
				{
					'action' : 'edit',
					'title' : targetPage,
					'appendtext' : "\n" + text,
					'summary' : 'New Message ([[WP:The Wikipedia Adventure|The Wikipedia Adventure]])',
					'token' : page.edittoken
				},
				{
					'ok' : function() {window.location.reload();}
				}
			);
		}
	}	);
}

 importScript("User:Nischayn22/OCLC.js");//OCLC API Full text reference tool
 importScript("User:Writ Keeper/Scripts/commonHistory.js");
importScript("User:Nischayn22/OCLC.js");
importScript("User:Nischayn22/OCLC.js");


mw.loader.using( 'ext.visualEditor.viewPageTarget.init', function(){
	mw.libs.ve.addPlugin( function() { 
		return $.getScript('https://en.wikipedia.org/w/index.php?title=User:Nischayn22/veSMW.js&action=raw&ctype=text/javascript'); 
	} );
});
importStylesheet( 'User:Nischayn22/veSMW.css' );

mw.loader.using( 'ext.visualEditor.viewPageTarget.init', function(){
	// Register plugins to VE. will be loaded once the user opens the VE
	mw.libs.ve.addPlugin( function() { 
		return $.getScript('https://en.wikipedia.org/w/index.php?title=User:ערן/refToolbarVe.js&action=raw&ctype=text/javascript'); 
	} );
});

mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Matma_Rex/visualeditor-signature.js&action=raw&ctype=text/javascript');

importScript( 'User:Technical 13/Scripts/Gadget-veditLinks.js' );// [[User:Technical 13/Scripts/Gadget-veditLinks]]