Last active
August 29, 2015 14:02
-
-
Save happyrainb/81541e23049e30b281d2 to your computer and use it in GitHub Desktop.
360 Link Get Database names: Script to find the SS_DatabaseHyperLink in the 360 Link search result page and add the license Info link to that provider. You can also add links to other classes in that page use this method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Script to database provider name in the 360 Link search result page and add the license Info link to that provider. | |
<script type="text/javascript" language="JavaScript" src="http://xxx/jquery-1.9.0.js"></script> | |
Please copy the "http://code.jquery.com/jquery-1.9.0.js" to your web site and replace the URL. | |
Please insert the URL of this JavaScript file "http://xxx/get_license.js"in 360 Link Admin>Header. | |
*/ | |
$(document).ready(function() | |
{ | |
$(".SS_DatabaseHyperLink").each ( | |
function() | |
{ | |
//replace the url for libraryLicenses.php below with the URL where you put the php file | |
$('<a target="_blank" href="baseURL/?name='+(urlencode($(this).text()))+'">[License of Use]</a>').insertAfter($(this)); | |
$('<span> </span>').insertAfter($(this)); | |
} | |
); | |
function urlencode(str) { | |
// discuss at: http://phpjs.org/functions/urlencode/ | |
// original by: Philip Peterson | |
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// improved by: Brett Zamir (http://brett-zamir.me) | |
// improved by: Lars Fischer | |
// input by: AJ | |
// input by: travc | |
// input by: Brett Zamir (http://brett-zamir.me) | |
// input by: Ratheous | |
// bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// bugfixed by: Joris | |
// reimplemented by: Brett Zamir (http://brett-zamir.me) | |
// reimplemented by: Brett Zamir (http://brett-zamir.me) | |
// note: This reflects PHP 5.3/6.0+ behavior | |
// note: Please be aware that this function expects to encode into UTF-8 encoded strings, as found on | |
// note: pages served as UTF-8 | |
// example 1: urlencode('Kevin van Zonneveld!'); | |
// returns 1: 'Kevin+van+Zonneveld%21' | |
// example 2: urlencode('http://kevin.vanzonneveld.net/'); | |
// returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F' | |
// example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'); | |
// returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a' | |
str = (str + '') | |
.toString(); | |
// Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current | |
// PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following. | |
return encodeURIComponent(str) | |
.replace(/!/g, '%21') | |
.replace(/'/g, '%27') | |
.replace(/\(/g, '%28') | |
.replace(/\)/g, '%29') | |
.replace(/\*/g, '%2A') | |
.replace(/\+/g, '%20'); //replace this last line in the urlencode(str) | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment