MediaWiki:PrettyLinkWidget.js: Difference between revisions
Content deleted Content added
trying to fix IE8... |
mNo edit summary |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1:
/**
* @fileoverview File containing and invoking widget object▼
* ▼
* @author <a href="mailto:magnusmanske@googlemail.com">Magnus Manske</a>▼
▲ @fileoverview File containing and invoking widget object
▲ @author <a href="mailto:magnusmanske@googlemail.com">Magnus Manske</a>
* Pretty Link Widget
* (c) 2011 by Magnus Manske
* Released under GPL v2 or higher
* USAGE : Add the following line to Special:MyPage/common.js
* mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:PrettyLinkWidget.js&action=raw&ctype=text/javascript')
*
*/
Line 27:
ignore_images : [ 'Commons-logo.svg','Disambig-dark.svg','Wikisource-logo.svg','Wiktfavicon en.svg','Loudspeaker.svg','Portal.svg','Qsicon Lücke.svg','Wikinews-logo.svg','Wikiquote-logo.svg','Reddot.svg',
'Qsicon lesenswert.svg','Wiktionary-logo-en.svg','Wikiversity-logo-Snorky.svg','Wikibooks-logo.svg','North.svg','South.svg','East.svg','West.svg','Red pog.svg','Compass rose pale-50x50.png',
'Speaker Icon.svg','Cscr-featured.svg','Wikispecies-logo.svg','Padlock-silver.svg' ] ,
createDialog : function () {
Line 33:
var h = "\
<div id='prettylinkwidget_dialog' style='display:none;font-size:10pt;overflow:none' title='Pretty link widget'>\
<div id='loading' style='float:right;color:white;background:#888888;padding:2px;display:none'><span id='loading-text'>Loading…</span> <img src='
<p>This widget can help you to generate pretty references to Wikipedia.</p>\
\
Line 91:
// Images
if ( 1 ) {
var url = "
url += escape(prettylinkwidget.title) ;
url += "&prop=imageinfo&gimlimit=500&format=json&iiprop=url|mime&iiurlwidth="+prettylinkwidget.thumbsize+"&iiurlheight="+prettylinkwidget.thumbsize+"&callback=?" ;
jQuery.getJSON ( url,
function ( data ) {
prettylinkwidget.images = data.query ? data.query.pages : [];
prettylinkwidget.check_loaded ( 1 ) ;
} ) ;
Line 103:
// First paragraph
if ( prettylinkwidget.use_desc ) {
var url = "
jQuery.getJSON ( url,
function ( data ) {
Line 164:
jQuery.each ( prettylinkwidget.images , function ( k , v ) {
if ( k != i ) return ;
var url = '
if ( v.imagerepository == 'local' ) url = '
var t = v.title.split(':') ;
t.shift() ;
Line 236:
var url_title = escape ( prettylinkwidget.title.replace(' ','_') ) ;
var wp_url ;
if ( rev === undefined || rev == '' ) wp_url = '
else wp_url = "
h += '<div style="margin-bottom:3px"><a href="' + wp_url + '"><b>' + prettylinkwidget.title.replace('_',' ') + '</b></a> on Wikipedia</div>' + nl ;
Line 250:
}
h += '<div style="font-size:60%">Wikipedia article <a href="
if ( image_license !== undefined && image_license != '' ) h += ' ' + image_license ;
h += '</div>' + nl ;
Line 302:
jQuery(document).ready ( function () {
if ( mw.config.get ( 'wgAction' ) != 'view' ) return ;
mw.util.addPortletLink('p-tb', 'javascript:prettylinkwidget.run()', 'Pretty link widget', 't-prettylinkwidget', 'Pretty link widget', '', '#t-print');
} ) ;
// mw.loader.load('//toolserver.org/~magnus/lib/jquery-ui-1.7.2.custom/css/ui-lightness/jquery-ui-1.7.2.custom.css', 'text/css');
// mw.loader.load('//toolserver.org/~magnus/lib/jquery-ui-1.7.2.custom/js/jquery-ui-1.7.2.custom.min.js');
|