Changes to image-load check (used for patron images and amazon book covers) to tweak when the script checked for loaded images (now window.load() instead of document.ready())

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Owen Leonard 2007-12-04 15:00:07 -06:00 committed by Joshua Ferraro
parent 5a541da6ce
commit b72a0d0653
11 changed files with 70 additions and 28 deletions

View file

@ -16,3 +16,17 @@ function _(s) { return s } // dummy function for gettext
});
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_patron_images() {
for (var i = 0; i < document.images.length; i++) {
img = document.images[i];
if ((img.src.indexOf('patronimages') >= 0)) {
w = img.width;
h = img.height;
if ((w == 0) && (h == 0) || ((img.complete != null) && (!img.complete))) {
img.src = '/intranet-tmpl/prog/img/patron-blank.png';
}
}
}
}

View file

@ -12,20 +12,6 @@
verify_patron_images();
});
//]]>
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_patron_images() {
for (var i = 0; i < document.images.length; i++) {
img = document.images[i];
if ((img.src.indexOf('patronimages') >= 0)) {
w = img.width;
h = img.height;
if ((w == 0) && (h == 0) || ((img.complete != null) && (!img.complete))) {
img.src = '/intranet-tmpl/prog/img/patron-blank.png';
}
}
}
}
</script>
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
</head>

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Patrons &rsaquo; Account for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Borrowers &rsaquo; Create Manual Credit</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Borrowers &rsaquo; Create Manual Invoice</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Patrons &rsaquo; Set Privileges for <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Patrons &rsaquo; <!-- TMPL_IF NAME="newpassword" -->Password Updated <!-- TMPL_ELSE -->Update Password for <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --><!-- /TMPL_IF --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -2,20 +2,13 @@
<title>Koha &rsaquo; Patrons &rsaquo; <!-- TMPL_IF NAME="unknowuser" -->Patron does not exist<!-- TMPL_ELSE -->Patron Details for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_IF --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
function verify_patron_images() {
for (var i = 0; i < document.images.length; i++) {
img = document.images[i];
if ((img.src.indexOf('patronimages') >= 0)) {
w = img.width;
h = img.height;
if ((w == 0) && (h == 0) || ((img.complete != null) && (!img.complete))) {
img.src = '/intranet-tmpl/prog/img/patron-blank.png';
}
}
}
}
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body onload="verify_patron_images();">
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -1,6 +1,13 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Reading Record for <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$(window).load(function() {
verify_patron_images();
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="header.inc" -->

View file

@ -24,7 +24,7 @@
var MSG_NRECORDS_IN_BASKET = _("already in the bag");
var MSG_NO_RECORD_SELECTED = _("No item was selected");
var MSG_NO_RECORD_ADDED = _("No item was added to your book bag");
<!-- TMPL_IF NAME="AmazonContent" -->$(document).ready(function() {
<!-- TMPL_IF NAME="AmazonContent" -->$(window).load(function() {
verify_images();
});<!-- /TMPL_IF -->
//]]>