coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: etienne on October 22, 2003, 08:23:10 AM

Title: [Patch]Opera and Slideshow
Post by: etienne on October 22, 2003, 08:23:10 AM
The slideshow is not working with Opera... javascript error!
The reason is that there is no 'real' browser detection.

Here is a small modification to slideshow.inc.php in order to make it compatible with Opera:

at the beginning of the javascript add:

// Agent sniffer shamelessly 'stolen' from the excellent X library from cross-browser.com
var xOp7=false,xOp5or6=false,xIE4Up=false,xNN4=false,xUA=navigator.userAgent.toLowerCase();
if(window.opera){
  xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);
  if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);
}
else if(document.layers) xNN4=true;
else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;}


Then replace, in the function runSlideShow alll occurences of:
  if (document.all){
with
  if (xIE4Up){
Title: [Patch]Opera and Slideshow
Post by: jasendorf on October 22, 2003, 04:12:57 PM
Beautiful... tested on my installation and I will fix this in the CVS (edit)once sf is done with its maintenance(/edit).  Thank you etienne!
Title: [Patch]Opera and Slideshow
Post by: rhydewithdis on November 12, 2003, 04:52:11 AM
Hmm I tried this on the phpnuke of cpg 1.2 rc1 - no workie