public inbox for [email protected]
help / color / mirror / Atom feedFrom: Magnus Hagander <[email protected]>
To: [email protected]
Subject: New ad code
Date: Tue, 22 Nov 2005 21:53:33 +0100
Message-ID: <[email protected]> (raw)
Attached is a patch that implements new ad code. This code runs async
instead of sync (at least it tries to), meaning we load the whole page
before we load the a <<newadcode.patch>> d. So if the ad server is slow
(common cause) it speeds up the page loading a lot, and if it's down
(not very common, but happened today) it doesn't hang.
I'd like a couple of more eyes looking over the code before I put it
out. It seems so simple, but what did I miss :) That said, I'd like it
out there ASAP, because right now our website isn't really redundant
anymore...
(Oh yes, we intentionally ignore very old browsers. They're few enough
that it's not worth putting a lot of time into. The pages will render
kinda wierd in those scenarios anyway, so people would only use if if
they really need some specific info - which is when they won't hit the
ads anyway)
Also, please beat on it with different browsers. You can test it at
http://magnus-master.pgadmin.org/about/.
//Magnus
Attachments:
[application/octet-stream] newadcode.patch (4.4K, 2-newadcode.patch)
download | inline diff:
Index: template/common.html
===================================================================
RCS file: /usr/local/cvsroot/pgweb/portal/template/common.html,v
retrieving revision 1.26
diff -c -r1.26 common.html
*** template/common.html 29 Mar 2005 14:40:46 -0000 1.26
--- template/common.html 22 Nov 2005 20:43:41 -0000
***************
*** 14,21 ****
<link rel="alternate stylesheet" media="screen" href="/layout/css/blue/fixed_large.css" type="text/css" title="Large Text" />
<script type="text/javascript" src="/layout/js/styleswitcher.js"></script>
<script type="text/javascript" src="/layout/js/geckostyle.js"></script>
</head>
! <body>
<div id="pgContainerWrap">
<div id="pgContainer">
<span class="txtOffScreen"><a href="#pgContent" title="Skip site navigation" accesskey="1">Skip site navigation</a> (1)</span>
--- 14,22 ----
<link rel="alternate stylesheet" media="screen" href="/layout/css/blue/fixed_large.css" type="text/css" title="Large Text" />
<script type="text/javascript" src="/layout/js/styleswitcher.js"></script>
<script type="text/javascript" src="/layout/js/geckostyle.js"></script>
+ <script type="text/javascript" src="/layout/js/pgads.js"></script>
</head>
! <body onload="pgAdsLoad()">
<div id="pgContainerWrap">
<div id="pgContainer">
<span class="txtOffScreen"><a href="#pgContent" title="Skip site navigation" accesskey="1">Skip site navigation</a> (1)</span>
Index: template/navigation/common.html
===================================================================
RCS file: /usr/local/cvsroot/pgweb/portal/template/navigation/common.html,v
retrieving revision 1.4
diff -c -r1.4 common.html
*** template/navigation/common.html 20 Oct 2005 08:02:05 -0000 1.4
--- template/navigation/common.html 22 Nov 2005 20:43:42 -0000
***************
*** 6,27 ****
<div id="pgSponsorWrap">
<ul>
<li><img src="/layout/images/en/hdr_sponsor.png" alt="Sponsor" /></li>
! <li>
! <script language='JavaScript' type='text/javascript' src='http://200.46.208.156/adx.js'></script>
! <script language='JavaScript' type='text/javascript'>
! <!--
! if (!document.phpAds_used) document.phpAds_used = ',';
! phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
!
! document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
! document.write ("http://200.46.208.156/adjs.php?n=" + phpAds_random);
! document.write ("&exclude=" + document.phpAds_used);
! if (document.referrer)
! document.write ("&referer=" + escape(document.referrer));
! document.write ("'><" + "/script>");
! //-->
! </script><noscript><a href='http://200.46.208.156/adclick.php?n=a69db620' target='_blank'><img src='http://200.46.208.156/adview.php?n=a69db620' border='0' alt=''></a></noscript>
! </li>
</ul>
</div>
</div>
--- 6,14 ----
<div id="pgSponsorWrap">
<ul>
<li><img src="/layout/images/en/hdr_sponsor.png" alt="Sponsor" /></li>
! <li><div id="pgSponsorContents">
! <noscript><div><a href="http://200.46.208.156/adclick.php?n=a69db620"><img src="http://200.46.208.156/adview.php?n=a69db620" alt="" /></a></div></noscript>
! </div></li>
</ul>
</div>
</div>
Index: layout/js/pgads.js
===================================================================
RCS file: layout/js/pgads.js
diff -N layout/js/pgads.js
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- layout/js/pgads.js 22 Nov 2005 20:43:43 -0000
***************
*** 0 ****
--- 1,36 ----
+ /* Called by ad code to set the contents of the ad wrapper */
+ function pgSetAdHtml(html)
+ {
+ try
+ {
+ var x = document.getElementById('pgSponsorContents');
+ if (x)
+ {
+ x.innerHTML = html;
+ }
+ }
+ catch (e)
+ {
+ /* Ignore any errors so we don't create a popup */
+ }
+ }
+
+ /* Try to load the ads code async, so we don't hang if the ads server is down */
+ function pgAdsLoad()
+ {
+ try
+ {
+ var x = document.getElementById('pgSponsorContents');
+ if (x)
+ {
+ var scr = document.createElement('script');
+ scr.src = 'http://200.46.208.156/adjs2.php';
+ scr.type = 'text/javascript';
+ document.getElementsByTagName('head')[0].appendChild(scr);
+ }
+ }
+ catch (e)
+ {
+ /* Ignore any errors, so we don't popup anything */
+ }
+ }
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: New ad code
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox