https://www.mediawiki.org/wiki/Special:Code/MediaWiki/115074

Revision: 115074
Author:   wikinaut
Date:     2012-04-28 08:08:38 +0000 (Sat, 28 Apr 2012)
Log Message:
-----------
new version treats body text correctly

Modified Paths:
--------------
    trunk/tools/viaf/viaf.user.js

Modified: trunk/tools/viaf/viaf.user.js
===================================================================
--- trunk/tools/viaf/viaf.user.js       2012-04-27 21:11:51 UTC (rev 115073)
+++ trunk/tools/viaf/viaf.user.js       2012-04-28 08:08:38 UTC (rev 115074)
@@ -4,13 +4,13 @@
 // @require       
https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
 // @require        
http://svn.wikimedia.org/svnroot/mediawiki/trunk/tools/viaf/jquery.cookie.js
 // @require        
http://svn.wikimedia.org/svnroot/mediawiki/trunk/tools/viaf/jquery.ba-replacetext.js
-// @description    locate VIAF numbers in texts and urls on web pages, fetch 
corresponding names from toolserver. (c)T.Gries Version 0.401 201109251000
+// @description    Locate VIAF, PND and GND numbers in texts and urls on web 
pages and fetch available corresponding names from the Toolserver. (c)T.Gries 
Version 0.403 201204281000
 // @include        *
 // ==/UserScript==
 
-var VERSION = "0.401";
+var VERSION = "0.403";
 /***
- * Copyright (c) 2011 T. Gries
+ * Copyright (c) 2011-2012 T. Gries
  *
  * Dual licensed under the MIT and GPL licenses:
  * http://www.opensource.org/licenses/mit-license.php
@@ -54,6 +54,8 @@
  *              Toolserver API adapted: names now returned for VIAF, PND, GND
  *              numbers; detected GND numbers are treated as PND
  * 20110925     summary shows VIAF, and PDN/GND numbers in a single alert box
+ * 20120426     bookmarklet version are available (separate files)
+ * 20120428     treats body text correctly
  *
  ***/
 
@@ -362,7 +364,7 @@
 // try to retrieve as much viaf numbers from text as possible
 // but don't look in an active textareas like mediawiki input textarea
 
-$("body *:not(textarea)")
+$("body,*:not(textarea)")
        .replaceText( 
/(viaf[1-9]?)\s*(:|\/|%2B|%3A|%2F|\s|ID:|=|%3D)+\s*([0-9]+)/gi, "<span 
class='viaf viaf-in-text' viaf='$3'>$1$2$3</span>" )
        .replaceText( 
/([pg]nd[1-9]?)\s*(:|\/|%2B|%3A|%2F|\s|ID:|=|%3D)+\s*([0-9]+x?)/gi, function( 
s0, s1, s2, s3 ){
                s3 = s3.toUpperCase();


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to