Skip to content
Browse files

Altered script to store database name and date when user clicks full-…

…text button twice
  • Loading branch information...
1 parent 8578ba7 commit 944a0e8ae48474448cef53b4e34f12146ff280ae @K-Felk K-Felk committed Apr 20, 2012
Showing with 18 additions and 10 deletions.
  1. +10 −6 360link-reset.2.0.js
  2. +1 −1 360link-reset.2.0.min.js
  3. +7 −3 url_write.php
View
16 360link-reset.2.0.js
@@ -376,6 +376,8 @@ jQuery(".doc-del-tooltip").hide();
// Now let's count clicks
+
+
jQuery("#360link-reset ul li a").click(function() {
clicks = clicks + 1;
@@ -384,16 +386,18 @@ jQuery("#360link-reset ul li a").click(function() {
jQuery(".doc-del-tooltip").show();
//lets also grab the openURL we are passing to the browser and pass it off
//to a PHP script that will write it elsewhere, so it can be checked
- var link = jQuery(this).attr('href');
- var msg;
- link = encodeURIComponent(link);
- link = "URL=" + link;
-
+ var link = "URL=" + encodeURIComponent(window.location);
+ var date = encodeURIComponent(new Date());
+ var DBname = "name=" + encodeURIComponent(jQuery(this).siblings("a.SS_DatabaseHyperLink").text());
+
+ var datastring = "date=" + date + "&" + DBname + "&" + link;
+
+ alert(datastring);
jQuery.ajax({
dataType: "string",
type: "GET",
url: "url_write.php",
- data: link
+ data: datastring
});
View
2 360link-reset.2.0.min.js
@@ -1 +1 @@
-jQuery(document).ready(function(){jQuery("head link").remove();var a="";var b="";var c="";var d="";var e="";var f="";var g=0;var h=jQuery("#RefinerLink0 a").attr("href");var i=false;var j=jQuery("table.CandyWrapper:last a.AnchorButton:contains('Document Delivery')").attr("href");var k=jQuery("table.CandyWrapper:last a.AnchorButton:last").attr("href");var l=jQuery("table.CandyWrapper:last a.AnchorButton:contains('MeLCat')").attr("href");var m=jQuery("span.fn").text();m=jQuery.trim(m);if(format==="Journal"||format==="JournalFormat"){var n=jQuery("td#CitationJournalTitleValue").text();n=jQuery.trim(n);var o=jQuery("td#CitationJournalArticleValue").text();o=jQuery.trim(o);var p=jQuery("td#CitationJournalVolumeValue").text();p=jQuery.trim(p);if(p!==""){p=', <span id="CitationJournalVolumeValue"> '+p+"</span>"}var q=jQuery("td#CitationJournalIssueValue").text();q=jQuery.trim(q);if(q!==""){q='<span id="CitationJournalIssueValue"> ('+q+"),</span>"}var r=jQuery("td#CitationJournalDateValue").text();r=jQuery.trim(r);var s=jQuery("td#CitationJournalPageValue").text();s=jQuery.trim(s);if(s!==""){s='<span id="CitationJournalPageValue"> p. '+s+".</span>"}var u=jQuery("td#CitationJournalIssnValue").text();u=jQuery.trim(u);if(u!==""){u='<span id="CitationJournalIssnValue"> (ISSN: '+u+")</span>"}var v='<span id="CitationJournalAuthorValue">'+m+'</span> <span id="CitationJournalDateValue">('+r+')</span>. <span id="CitationJournalArticleValue">'+o+'.</span> <span id="CitationJournalTitleValue">'+n+".</span> "+p+q+s;var w=encodeURI(n);var x='<li>Not Available Online? <a href="'+j+'">Order a copy from Document Delivery</a></li><li>Found a problem? <a href="mailto:erms@gvsu.edu">Let our crack team of link fixers know</a>!</li>'}if(format==="BookFormat"){var y=jQuery("td#CitationBookTitleValue").text();y=jQuery.trim(y);var z=jQuery("td#CitationBookDateValue").text();z=jQuery.trim(z);var A=jQuery("td#CitationBookISBNValue").text();A=jQuery.trim(A);if(A!==""){A=' <span id="CitationBookISBNValue">(ISBN: '+A+")</span> "}var v='<span id="CitationBookAuthorValue">'+m+'</span> <span id="CitationBookDateValue">('+z+')</span>. <span id="CitationBookTitleValue"><em>'+y+"</em></span>"+A;var B=encodeURI(y);var x='<li><a href="http://library.catalog.gvsu.edu/search/t'+B+'">Search the GVSU Catalog for this book</a></li><li><a href="'+l+'">Order from another Michigan library</a></li><li>Not Available Online? <a href="'+j+'">Order a copy from Interlibrary Loan</a></li><li>Found a problem? <a href="mailto:erms@gvsu.edu">Let our crack team of link fixers know</a>!</li>'}if(format==="UnknownFormat"){var y=jQuery("td#CitationUnknownPublicationValue").text();y=jQuery.trim(y);var z=jQuery("td#CitationUnknownDateValue").text();z=jQuery.trim(z);var A=jQuery("td#CitationBookISBNValue").text();A=jQuery.trim(A);if(A!==""){A=' <span id="CitationBookISBNValue">(ISBN: '+A+")</span> "}var v='<span id="CitationBookAuthorValue">'+m+'</span> <span id="CitationBookDateValue">('+z+')</span>. <span id="CitationBookTitleValue"><em>'+y+'</em></span> <span id="CitationBookISBNValue"> </span>';var B=encodeURI(y);var x='<li><a href="http://library.catalog.gvsu.edu/search/t'+B+'">Search the GVSU Catalog for this book</a></li><li>Not Available Online? <a href="'+j+'">Order a copy from Interlibrary Loan</a></li><li>Found a problem? <a href="mailto:erms@gvsu.edu">Let our crack team of link fixers know</a>!</li>'}jQuery("table#JournalLinkTable").find("tr").each(function(g){if(g!==0){if(jQuery(this).find("#ArticleCL a").length>0){var h=jQuery(this).find("#ArticleCL a").attr("href");b=b+h+"|||"}else{b=b+"NA|||"}if(jQuery(this).find("#JournalCL a").length>0){var h=jQuery(this).find("#JournalCL a").attr("href");c=c+h+"|||"}else{c=c+"NA|||"}var i=jQuery(this).find("#DateCL").text();d=d+i+"|||";var j=jQuery(this).find("#DatabaseCL").text();e=e+j+"|||";var k=jQuery(this).find("#DatabaseCL a").attr("href");f=f+k+"|||"}a=g});var C=b.split("|||");var D=c.split("|||");var E=d.split("|||");var F=e.split("|||");var G=f.split("|||");var H=a-1;if(C[0]==="NA"&&D[0]!=="NA"){TopDatabaseName=jQuery.trim(F[0]);if(TopDatabaseName==="Print at GVSU Libraries"){var I='<ul id="top-result"><li><a href="'+D[0]+'" class="article-button" target="_blank">Find a Copy</a> in <a href="'+G[0]+'" class="SS_DatabaseHyperLink">'+jQuery.trim(F[0])+"</a></li></ul>";var i=true}else{var I='<ul id="top-result"><li><a href="'+D[0]+'" class="article-button" target="_blank">Browse the Journal Online</a> in <a href="'+G[0]+'" class="SS_DatabaseHyperLink">'+jQuery.trim(F[0])+"</a></li></ul>"}}else{var I='<ul id="top-result"><li><a href="'+C[0]+'" class="article-button" target="_blank">Full Text Online</a> from <a href="'+G[0]+'" class="SS_DatabaseHyperLink">'+jQuery.trim(F[0])+'</a> <a class="holding-details"><img src="http://gvsu.edu/icon/help.png" alt="" /></a><div class="tooltip"><p><a href="'+D[0]+'" style="text-decoration: none;">Browse Journal</a></p><p style="font-size: 1em;"><i>Dates covered:</i><br />'+E[0]+"</p></div></li></ul>"}if(H>0){if(H===1){var J="Show 1 More Result"}else{var J="Show "+H+" More Results"}var K="";var L="";var M=1;while(M<a){if(C[M]!=="NA"){if(K===""){K=K+"<h4>Online</h4><ul>"}K=K+'<li><a href="'+C[M]+'" target="_blank">Full Text Online</a> from <a href="'+G[M]+'" class="SS_DatabaseHyperLink">'+F[M]+'</a><a class="holding-details"><img src="http://gvsu.edu/icon/help.png" alt="" /></a><div class="tooltip"><p><a href="'+D[M]+'" style="text-decoration: none;">Browse Journal</a></p><p style="font-size: 1em;"><i>Dates covered:</i><br />'+E[M]+"</p></div></li>"}else{if(jQuery.trim(F[M])==="Print at GVSU Libraries"){var i=true;if(L===""){L=L+"<h4>Print</h4><ul>"}L=L+'<li><a href="'+D[M]+'" target="_blank">Available in Print</a> at the <abbr title="Grand Valley State University">GVSU</abbr> University Libraries</li>'}else{if(K===""){K=K+"<h4>Online</h4><ul>"}K=K+'<li><a href="'+D[M]+'" target="_blank">Browse the Journal Online</a> in <a href="'+G[M]+'" class="SS_DatabaseHyperLink">'+F[M]+'</a><a class="holding-details"><img src="http://gvsu.edu/icon/help.png" alt="" /></a><div class="tooltip"><p style="font-size: 1em;"><i>Dates covered:</i><br />'+E[M]+"</p></div></li>"}}M=M+1}if(K!==""){K=K+"</ul>"}if(L!==""){L=L+"</ul>"}var N='<div class="event-head">'+J+'</div><div class="event-body">'+K+L+"</div>";O=I+N}else{var O=I}if(a===""){var O='<div id="ContentNotAvailableTable"><p class="lib-big-text">We&#8217;re sorry, but this item is not available online.</p><p>Think this is an error? Let our eResources team know at <a href="mailto:erms@gvsu.edu">erms@gvsu.edu</a>.</p></div>'}var P=jQuery(".SS_HoldingText a").attr("href");if(typeof P!=="undefined"){var Q="";var R="";var S="";var T="";jQuery(".SS_HoldingText").each(function(a){var b=jQuery(this).find("a").attr("href");Q=Q+b+"|||";var c=jQuery(this).find(".SS_JournalTitle").text();R=R+c+"|||";var d=jQuery(this).find(".SS_IssnText").text();S=S+d+"|||";T=a});T=T+1;var U=Q.split("|||");var V=R.split("|||");var W=S.split("|||");I='<h4>This item is available in the following publications:</h4><ul id="top-result">';t=0;while(t<T){I=I+'<li><a href="'+U[t]+'">'+V[t]+" "+W[t]+"</a></li>";t=t+1}var O=I+"</ul>"}var X=document.location.search;var Y=X.split("&");if(Y[0]!=="?SS_Page=refiner"){if(i!=true&&(format==="Journal"||format==="JournalFormat")){x='<li class="appeasement"><a href="http://library.catalog.gvsu.edu/search/s'+w+'">Search the Library Catalog for this journal</a></li>'+x}jQuery("#360link-reset").html('<div id="page-content" style="margin: 0; padding-left: 6em; width:85%;"><h2 style="text-align:left;">You are looking for:</h2><div id="citation">'+v+' <a href="'+h+'"><img src="http://gvsu.edu/icon/pencil.png" alt="Edit this Citation" /></a><a id="refworks" href="'+k+'">Export to Refworks</a></div>'+O+'<div id="next-step"><ul>'+x+'</ul></div></div><div class="clear"></div><!-- Begin Custom GVSU Footer code --></div>')}jQuery("#next-step ul").append('<li class="doc-del-tooltip">Having trouble? You can order a copy from Document Delivery, and they\'ll get it for you. It\'s free!<br /><a href="'+j+'" class="lib-db-access-button" style="font-size: 1.2em !important;">Order a Copy</a></li>');jQuery(".doc-del-tooltip").hide();jQuery("#360link-reset ul li a").click(function(){g=g+1;if(g>1){jQuery(".doc-del-tooltip").show();var a=jQuery(this).attr("href");var b;a=encodeURIComponent(a);a="URL="+a;jQuery.ajax({dataType:"string",type:"GET",url:"url_write.php",data:a})}})})
+jQuery(document).ready(function(){jQuery("head link").remove();var a="";var b="";var c="";var d="";var e="";var f="";var g=0;var h=jQuery("#RefinerLink0 a").attr("href");var i=false;var j=jQuery("table.CandyWrapper:last a.AnchorButton:contains('Document Delivery')").attr("href");var k=jQuery("table.CandyWrapper:last a.AnchorButton:last").attr("href");var l=jQuery("table.CandyWrapper:last a.AnchorButton:contains('MeLCat')").attr("href");var m=jQuery("span.fn").text();m=jQuery.trim(m);if(format==="Journal"||format==="JournalFormat"){var n=jQuery("td#CitationJournalTitleValue").text();n=jQuery.trim(n);var o=jQuery("td#CitationJournalArticleValue").text();o=jQuery.trim(o);var p=jQuery("td#CitationJournalVolumeValue").text();p=jQuery.trim(p);if(p!==""){p=', <span id="CitationJournalVolumeValue"> '+p+"</span>"}var q=jQuery("td#CitationJournalIssueValue").text();q=jQuery.trim(q);if(q!==""){q='<span id="CitationJournalIssueValue"> ('+q+"),</span>"}var r=jQuery("td#CitationJournalDateValue").text();r=jQuery.trim(r);var s=jQuery("td#CitationJournalPageValue").text();s=jQuery.trim(s);if(s!==""){s='<span id="CitationJournalPageValue"> p. '+s+".</span>"}var u=jQuery("td#CitationJournalIssnValue").text();u=jQuery.trim(u);if(u!==""){u='<span id="CitationJournalIssnValue"> (ISSN: '+u+")</span>"}var v='<span id="CitationJournalAuthorValue">'+m+'</span> <span id="CitationJournalDateValue">('+r+')</span>. <span id="CitationJournalArticleValue">'+o+'.</span> <span id="CitationJournalTitleValue">'+n+".</span> "+p+q+s;var w=encodeURI(n);var x='<li>Not Available Online? <a href="'+j+'">Order a copy from Document Delivery</a></li><li>Found a problem? <a href="mailto:erms@gvsu.edu">Let our crack team of link fixers know</a>!</li>'}if(format==="BookFormat"){var y=jQuery("td#CitationBookTitleValue").text();y=jQuery.trim(y);var z=jQuery("td#CitationBookDateValue").text();z=jQuery.trim(z);var A=jQuery("td#CitationBookISBNValue").text();A=jQuery.trim(A);if(A!==""){A=' <span id="CitationBookISBNValue">(ISBN: '+A+")</span> "}var v='<span id="CitationBookAuthorValue">'+m+'</span> <span id="CitationBookDateValue">('+z+')</span>. <span id="CitationBookTitleValue"><em>'+y+"</em></span>"+A;var B=encodeURI(y);var x='<li><a href="http://library.catalog.gvsu.edu/search/t'+B+'">Search the GVSU Catalog for this book</a></li><li><a href="'+l+'">Order from another Michigan library</a></li><li>Not Available Online? <a href="'+j+'">Order a copy from Interlibrary Loan</a></li><li>Found a problem? <a href="mailto:erms@gvsu.edu">Let our crack team of link fixers know</a>!</li>'}if(format==="UnknownFormat"){var y=jQuery("td#CitationUnknownPublicationValue").text();y=jQuery.trim(y);var z=jQuery("td#CitationUnknownDateValue").text();z=jQuery.trim(z);var A=jQuery("td#CitationBookISBNValue").text();A=jQuery.trim(A);if(A!==""){A=' <span id="CitationBookISBNValue">(ISBN: '+A+")</span> "}var v='<span id="CitationBookAuthorValue">'+m+'</span> <span id="CitationBookDateValue">('+z+')</span>. <span id="CitationBookTitleValue"><em>'+y+'</em></span> <span id="CitationBookISBNValue"> </span>';var B=encodeURI(y);var x='<li><a href="http://library.catalog.gvsu.edu/search/t'+B+'">Search the GVSU Catalog for this book</a></li><li>Not Available Online? <a href="'+j+'">Order a copy from Interlibrary Loan</a></li><li>Found a problem? <a href="mailto:erms@gvsu.edu">Let our crack team of link fixers know</a>!</li>'}jQuery("table#JournalLinkTable").find("tr").each(function(g){if(g!==0){if(jQuery(this).find("#ArticleCL a").length>0){var h=jQuery(this).find("#ArticleCL a").attr("href");b=b+h+"|||"}else{b=b+"NA|||"}if(jQuery(this).find("#JournalCL a").length>0){var h=jQuery(this).find("#JournalCL a").attr("href");c=c+h+"|||"}else{c=c+"NA|||"}var i=jQuery(this).find("#DateCL").text();d=d+i+"|||";var j=jQuery(this).find("#DatabaseCL").text();e=e+j+"|||";var k=jQuery(this).find("#DatabaseCL a").attr("href");f=f+k+"|||"}a=g});var C=b.split("|||");var D=c.split("|||");var E=d.split("|||");var F=e.split("|||");var G=f.split("|||");var H=a-1;if(C[0]==="NA"&&D[0]!=="NA"){TopDatabaseName=jQuery.trim(F[0]);if(TopDatabaseName==="Print at GVSU Libraries"){var I='<ul id="top-result"><li><a href="'+D[0]+'" class="article-button" target="_blank">Find a Copy</a> in <a href="'+G[0]+'" class="SS_DatabaseHyperLink">'+jQuery.trim(F[0])+"</a></li></ul>";var i=true}else{var I='<ul id="top-result"><li><a href="'+D[0]+'" class="article-button" target="_blank">Browse the Journal Online</a> in <a href="'+G[0]+'" class="SS_DatabaseHyperLink">'+jQuery.trim(F[0])+"</a></li></ul>"}}else{var I='<ul id="top-result"><li><a href="'+C[0]+'" class="article-button" target="_blank">Full Text Online</a> from <a href="'+G[0]+'" class="SS_DatabaseHyperLink">'+jQuery.trim(F[0])+'</a> <a class="holding-details"><img src="http://gvsu.edu/icon/help.png" alt="" /></a><div class="tooltip"><p><a href="'+D[0]+'" style="text-decoration: none;">Browse Journal</a></p><p style="font-size: 1em;"><i>Dates covered:</i><br />'+E[0]+"</p></div></li></ul>"}if(H>0){if(H===1){var J="Show 1 More Result"}else{var J="Show "+H+" More Results"}var K="";var L="";var M=1;while(M<a){if(C[M]!=="NA"){if(K===""){K=K+"<h4>Online</h4><ul>"}K=K+'<li><a href="'+C[M]+'" target="_blank">Full Text Online</a> from <a href="'+G[M]+'" class="SS_DatabaseHyperLink">'+F[M]+'</a><a class="holding-details"><img src="http://gvsu.edu/icon/help.png" alt="" /></a><div class="tooltip"><p><a href="'+D[M]+'" style="text-decoration: none;">Browse Journal</a></p><p style="font-size: 1em;"><i>Dates covered:</i><br />'+E[M]+"</p></div></li>"}else{if(jQuery.trim(F[M])==="Print at GVSU Libraries"){var i=true;if(L===""){L=L+"<h4>Print</h4><ul>"}L=L+'<li><a href="'+D[M]+'" target="_blank">Available in Print</a> at the <abbr title="Grand Valley State University">GVSU</abbr> University Libraries</li>'}else{if(K===""){K=K+"<h4>Online</h4><ul>"}K=K+'<li><a href="'+D[M]+'" target="_blank">Browse the Journal Online</a> in <a href="'+G[M]+'" class="SS_DatabaseHyperLink">'+F[M]+'</a><a class="holding-details"><img src="http://gvsu.edu/icon/help.png" alt="" /></a><div class="tooltip"><p style="font-size: 1em;"><i>Dates covered:</i><br />'+E[M]+"</p></div></li>"}}M=M+1}if(K!==""){K=K+"</ul>"}if(L!==""){L=L+"</ul>"}var N='<div class="event-head">'+J+'</div><div class="event-body">'+K+L+"</div>";O=I+N}else{var O=I}if(a===""){var O='<div id="ContentNotAvailableTable"><p class="lib-big-text">We&#8217;re sorry, but this item is not available online.</p><p>Think this is an error? Let our eResources team know at <a href="mailto:erms@gvsu.edu">erms@gvsu.edu</a>.</p></div>'}var P=jQuery(".SS_HoldingText a").attr("href");if(typeof P!=="undefined"){var Q="";var R="";var S="";var T="";jQuery(".SS_HoldingText").each(function(a){var b=jQuery(this).find("a").attr("href");Q=Q+b+"|||";var c=jQuery(this).find(".SS_JournalTitle").text();R=R+c+"|||";var d=jQuery(this).find(".SS_IssnText").text();S=S+d+"|||";T=a});T=T+1;var U=Q.split("|||");var V=R.split("|||");var W=S.split("|||");I='<h4>This item is available in the following publications:</h4><ul id="top-result">';t=0;while(t<T){I=I+'<li><a href="'+U[t]+'">'+V[t]+" "+W[t]+"</a></li>";t=t+1}var O=I+"</ul>"}var X=document.location.search;var Y=X.split("&");if(Y[0]!=="?SS_Page=refiner"){if(i!=true&&(format==="Journal"||format==="JournalFormat")){x='<li class="appeasement"><a href="http://library.catalog.gvsu.edu/search/s'+w+'">Search the Library Catalog for this journal</a></li>'+x}jQuery("#360link-reset").html('<div id="page-content" style="margin: 0; padding-left: 6em; width:85%;"><h2 style="text-align:left;">You are looking for:</h2><div id="citation">'+v+' <a href="'+h+'"><img src="http://gvsu.edu/icon/pencil.png" alt="Edit this Citation" /></a><a id="refworks" href="'+k+'">Export to Refworks</a></div>'+O+'<div id="next-step"><ul>'+x+'</ul></div></div><div class="clear"></div><!-- Begin Custom GVSU Footer code --></div>')}jQuery("#next-step ul").append('<li class="doc-del-tooltip">Having trouble? You can order a copy from Document Delivery, and they\'ll get it for you. It\'s free!<br /><a href="'+j+'" class="lib-db-access-button" style="font-size: 1.2em !important;">Order a Copy</a></li>');jQuery(".doc-del-tooltip").hide();jQuery("#360link-reset ul li a").click(function(){g=g+1;if(g>1){jQuery(".doc-del-tooltip").show();var a="URL="+encodeURIComponent(window.location);var b=encodeURIComponent(new Date);var c="name="+encodeURIComponent(jQuery(this).siblings("a.SS_DatabaseHyperLink").text());var d="date="+b+"&"+c+"&"+a;alert(d);jQuery.ajax({dataType:"string",type:"GET",url:"url_write.php",data:d})}})})
View
10 url_write.php
@@ -1,8 +1,12 @@
<?
-$url = trim($_GET['URL']) . "\n";
-if (!$DataFile = fopen("dodgy_urls.txt", "a")) {echo "Failure: cannot open file"; die;};
-if (!fwrite($DataFile, $url)) {echo "Failure: cannot write to file"; die;};
+$url = trim($_GET['URL']);
+$name = trim($_GET['name']);
+$date = trim($_GET['date']);
+
+$datastring = $date . "," . $name . "," . $url . "\n";
+if (!$DataFile = fopen("dodgy_urls.csv", "a")) {echo "Failure: cannot open file"; die;};
+if (!fwrite($DataFile, $datastring)) {echo "Failure: cannot write to file"; die;};
fclose($DataFile);
echo "file write successful";

0 comments on commit 944a0e8

Please sign in to comment.
Something went wrong with that request. Please try again.