User:Nischayn22/OCLC.js

( function( $ ) {

$( document ).ready( function { //jquery      $( 'span.Z3988' ).each( function ( i, member ) { var attributes_str = ($(member).attr('title')); var rft_attribs = attributes_str.replace("ctx_ver=Z39.88-2004&", ""); var oclc_url = "//fulltext.wmflabs.org/local-reference-api/jake.php";

$.ajax({             url: oclc_url,                headers: { 'params' : rft_attribs },                success: function( data ) {                data = JSON.parse(data);                if (data === undefined || data === null || data[0] === undefined) return;                if (data[0]['url'] === undefined)                  $(member).prepend("  LINK")                else                  $(member).prepend("  LINK")              }            }); } );   } );

} )( $ );