User:Millahnna/vector.js

// COMPARE LINK // User:Superm401/Compare link.js importScript("User:Superm401/Compare link.js");

//COMPARESELECTED REVISIONS /** * Convert the "Compare selected versions" button to a link * (Based on w:en:User:Superm401/Compare_link.js) * @source: http://www.mediawiki.org/wiki/Snippets/Compare_link * @rev: 2 * @see: 16165 * * Copyright 2006-2013 Matthew Flaschen (User:Superm401), User:Helder.wiki * * In addition to the GFDL and CC-BY-SA: * * This function (compare link) is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This function is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * A copy of the GPL is available at https://www.gnu.org/licenses/gpl-2.0.txt. * * By modifying Snippets/Compare_link: * You agree to dual-license your contributions under both the * GFDL (http://en.wikipedia.org/wiki/WP:GFDL) and version 2 of the GPL * (https://www.gnu.org/licenses/gpl-2.0.txt) or any later version * of the GPL published by the FSF. * */ function fixCompare { var	$histForm = $('#mw-history-compare'), $diffList = $('#pagehistory'), $buttons = $histForm.find('input.historysubmit'), buttonText, $compareLink; if ( $buttons.length === 0 ) { // Only one version, so do nothing return; }               buttonText = $buttons .remove .first.val; $compareLink = $('', {			'class': 'compare-link',			'text': buttonText		}); $histForm .prepend($compareLink) .append($compareLink.clone); var updateCompare = function{ var	$radio = $histForm.find('input[type=radio]:checked'), genLink = mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&diff=' + $radio.eq(0).val + '&oldid=' + $radio.eq(1).val; $('.compare-link').each(function {			$(this).attr('href', genLink);		}); };	updateCompare; $diffList.change(updateCompare); } if ( mw.config.get('wgAction') === 'history' ) { mw.util.addCSS( '.compare-link { border-radius:5px; color:black; text-decoration:none; border-width:1px 2px 2px 1px; border-style:solid; border-color:#DDDDDD #BBBBBB #BBBBBB #DDDDDD; padding:0.2em 1em; background-color:#EEEEEE; white-space:nowrap; } .compare-link:active{ border-width:0.1em; margin:0.1em; }' ); $(fixCompare); }

// REFLINKS & CHECKLINKS function refcheck { mw.util.addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py?page=" + mw.config.get('wgPageName') + "&citeweb=on", "Check Refs"); } function linkcheck { mw.util.addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/webchecklinks.py?page=" + mw.config.get('wgPageName'), "Check Links"); } if ( mw.config.get('wgNamespaceNumber') == 0 ) { addOnloadHook(refcheck); addOnloadHook(linkcheck); }

// Add WP:Reflinks launcher in the toolbox on left addOnloadHook(function { mw.util.addPortletLink( "p-tb",    // toolbox portlet "//toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + mw.config.get('wgPageName') + "?client=script&citeweb=on&overwrite=&limit=20&lang=" + mw.config.get('wgContentLanguage'), "Reflinks" // link label )});

mw.loader.load( "https://meta.wikimedia.org/w/index.php?title=User:Zhaofeng_Li/Reflinks.js&action=raw&ctype=text/javascript" );