Changeset 1526 in ExiteCMS


Ignore:
Timestamp:
07/05/08 20:27:13 (4 years ago)
Author:
hverton
Message:

code block fold-out is now compatible with Konqueror, workaround for IE implemented so the layout doesn't break

Location:
trunk/includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/forum_functions_include.php

    r1524 r1526  
    364364    $id = count($codeblocks); 
    365365    ++$blockcount; 
    366     $link = "<img src='".THEME."images/panel_on.gif' alt='' title='Toggle full code view' name='b_code_".$id."' onclick=\"javascript:flipOverflow('code_".$id."')\" />"; 
     366    $link = "<img src='".THEME."images/panel_on.gif' alt='' title='Toggle full code view' name='b_code_".$blockcount."' onclick=\"javascript:flipOverflow('code_".$blockcount."')\" />"; 
    367367    $link .= "<div class='side' style='display:inline;'> <a href='".BASEDIR."getfile.php?type=fc&amp;forum_id=".$current_message['forum_id']."&amp;thread_id=".$current_message['thread_id']."&amp;post_id=".$current_message['post_id']."&amp;id=".$id."' title='download this ".$matches[1]." code'>download</a> </div>"; 
    368368    $codeblocks[] = array(" 
    369     <div id='box_code_".$id."' class='codecontainer'> 
     369    <div id='box_code_".$blockcount."' class='codecontainer'> 
    370370    <table class='codeblock' cellpadding='0' cellspacing='0'> 
    371371        <tr style='padding:0px;margin:0px;'> 
  • trunk/includes/jscripts/core_functions.js

    r1525 r1526  
    1 /*  
    2 ------------------------------------------ 
    3     Flipbox written by CrappoMan 
    4     simonpatterson@dsl.pipex.com 
    5 ------------------------------------------ 
    6 */ 
     1/*---------------------------------------------------+ 
     2| ExiteCMS Content Management System                 | 
     3+----------------------------------------------------+ 
     4| Copyright 2007 Harro "WanWizard" Verton, Exite BV  | 
     5| for support, please visit http://exitecms.exite.eu | 
     6+----------------------------------------------------+ 
     7| Some portions copyright 2002 - 2006 Nick Jones     | 
     8| http://www.php-fusion.co.uk/                       | 
     9+----------------------------------------------------+ 
     10| Released under the terms & conditions of v2 of the | 
     11| GNU General Public License. For details refer to   | 
     12| the included gpl.txt file or visit http://gnu.org  | 
     13+----------------------------------------------------*/ 
     14 
     15// Flipbox written by CrappoMan, simonpatterson@dsl.pipex.com 
    716function flipBox(who) { 
    817    var tmp; 
     
    2332} 
    2433 
    25 // function based on FlipBox, but usable for normal divs 
     34// Based on FlipBox, but usable for normal divs 
    2635function flipDiv(who) { 
    2736    if (document.getElementById(who).style.display == 'block') 
     
    120129} 
    121130 
    122 function show_hide(msg_id) { 
    123     msg_id.style.display = msg_id.style.display == 'none' ? 'block' : 'none'; 
    124 } 
    125  
    126 function createCookie(name,value,days) { 
    127     if (days) { 
    128         var date = new Date(); 
    129         date.setTime(date.getTime()+(days*24*60*60*1000)); 
    130         var expires = "; expires="+date.toGMTString(); 
    131     } 
    132     else var expires = ""; 
    133     document.cookie = name+"="+value+expires+"; path=/"; 
    134 } 
    135  
    136 function readCookie(name) { 
    137     var nameEQ = name + "="; 
    138     var ca = document.cookie.split(';'); 
    139     for(var i=0;i < ca.length;i++) { 
    140         var c = ca[i]; 
    141         while (c.charAt(0)==' ') c = c.substring(1,c.length); 
    142         if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 
    143     } 
    144     return null; 
    145 } 
    146  
    147 function eraseCookie(name) { 
    148     createCookie(name,"",-1); 
    149 } 
    150  
    151131function incrementalSelect(oSelect, oEvent) { 
    152132    var sKeyCode = oEvent.keyCode; 
     
    180160} 
    181161 
    182 function whichBrowser() { 
    183     //test for Firefox/x.x or Firefox x.x (ignoring remaining digits); 
    184     if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { 
    185         var ffversion=new Number(RegExp.$1); // capture x.x portion and store as a number 
    186         if (ffversion>=3) 
    187             return "FF 3"; 
    188         else if (ffversion>=2) 
    189             return "FF 2"; 
    190         else if (ffversion>=1) 
    191             return "FF 1"; 
    192     } else { 
    193         //test for MSIE x.x; 
    194         if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 
    195             var ieversion=new Number(RegExp.$1); // capture x.x portion and store as a number 
    196             if (ieversion>=8) 
    197                 return "IE 8"; 
    198             else if (ieversion>=7) 
    199                 return "IE 7"; 
    200             else if (ieversion>=6) 
    201                 return "IE 6"; 
    202             else if (ieversion>=5) 
    203                 return "IE 5"; 
    204         } else { 
    205             //test for Opera/x.x or Opera x.x (ignoring remaining decimal places); 
    206             if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { 
    207                 var oprversion=new Number(RegExp.$1); // capture x.x portion and store as a number 
    208                 if (oprversion>=10) 
    209                     return "OP 10"; 
    210                 else if (oprversion>=9) 
    211                     return "OP 9"; 
    212                 else if (oprversion>=8) 
    213                     return "OP 8"; 
    214                 else if (oprversion>=7) 
    215                     return "OP 7"; 
    216                 else 
    217                     return("n/a"); 
    218             } else { 
    219                 return("n/a"); 
    220             } 
    221         } 
    222     } 
    223 } 
     162// Cookie functions 
     163 
     164function createCookie(name,value,days) { 
     165    if (days) { 
     166        var date = new Date(); 
     167        date.setTime(date.getTime()+(days*24*60*60*1000)); 
     168        var expires = "; expires="+date.toGMTString(); 
     169    } 
     170    else var expires = ""; 
     171    document.cookie = name+"="+value+expires+"; path=/"; 
     172} 
     173 
     174function readCookie(name) { 
     175    var nameEQ = name + "="; 
     176    var ca = document.cookie.split(';'); 
     177    for(var i=0;i < ca.length;i++) { 
     178        var c = ca[i]; 
     179        while (c.charAt(0)==' ') c = c.substring(1,c.length); 
     180        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 
     181    } 
     182    return null; 
     183} 
     184 
     185function eraseCookie(name) { 
     186    createCookie(name,"",-1); 
     187} 
     188 
     189// Browser detection 
     190 
     191var BrowserDetect = { 
     192    init: function () { 
     193        this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; 
     194        this.version = this.searchVersion(navigator.userAgent) 
     195            || this.searchVersion(navigator.appVersion) 
     196            || "an unknown version"; 
     197        this.OS = this.searchString(this.dataOS) || "an unknown OS"; 
     198    }, 
     199    searchString: function (data) { 
     200        for (var i=0;i<data.length;i++) { 
     201            var dataString = data[i].string; 
     202            var dataProp = data[i].prop; 
     203            this.versionSearchString = data[i].versionSearch || data[i].identity; 
     204            if (dataString) { 
     205                if (dataString.indexOf(data[i].subString) != -1) 
     206                    return data[i].identity; 
     207            } 
     208            else if (dataProp) 
     209                return data[i].identity; 
     210        } 
     211    }, 
     212    searchVersion: function (dataString) { 
     213        var index = dataString.indexOf(this.versionSearchString); 
     214        if (index == -1) return; 
     215        return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); 
     216    }, 
     217    dataBrowser: [ 
     218        {   string: navigator.userAgent, 
     219            subString: "OmniWeb", 
     220            versionSearch: "OmniWeb/", 
     221            identity: "OmniWeb" 
     222        }, 
     223        { 
     224            string: navigator.vendor, 
     225            subString: "Apple", 
     226            identity: "Safari" 
     227        }, 
     228        { 
     229            prop: window.opera, 
     230            identity: "Opera" 
     231        }, 
     232        { 
     233            string: navigator.vendor, 
     234            subString: "iCab", 
     235            identity: "iCab" 
     236        }, 
     237        { 
     238            string: navigator.vendor, 
     239            subString: "KDE", 
     240            identity: "Konqueror" 
     241        }, 
     242        { 
     243            string: navigator.userAgent, 
     244            subString: "Firefox", 
     245            identity: "Firefox" 
     246        }, 
     247        { 
     248            string: navigator.vendor, 
     249            subString: "Camino", 
     250            identity: "Camino" 
     251        }, 
     252        {       // for newer Netscapes (6+) 
     253            string: navigator.userAgent, 
     254            subString: "Netscape", 
     255            identity: "Netscape" 
     256        }, 
     257        { 
     258            string: navigator.userAgent, 
     259            subString: "MSIE", 
     260            identity: "Explorer", 
     261            versionSearch: "MSIE" 
     262        }, 
     263        { 
     264            string: navigator.userAgent, 
     265            subString: "Gecko", 
     266            identity: "Mozilla", 
     267            versionSearch: "rv" 
     268        }, 
     269        {       // for older Netscapes (4-) 
     270            string: navigator.userAgent, 
     271            subString: "Mozilla", 
     272            identity: "Netscape", 
     273            versionSearch: "Mozilla" 
     274        } 
     275    ], 
     276    dataOS : [ 
     277        { 
     278            string: navigator.platform, 
     279            subString: "Win", 
     280            identity: "Windows" 
     281        }, 
     282        { 
     283            string: navigator.platform, 
     284            subString: "Mac", 
     285            identity: "Mac" 
     286        }, 
     287        { 
     288            string: navigator.platform, 
     289            subString: "Linux", 
     290            identity: "Linux" 
     291        } 
     292    ] 
     293 
     294}; 
     295BrowserDetect.init(); 
  • trunk/includes/templates/forum.viewthread.tpl

    r1524 r1526  
    2929    } else {  
    3030        tmp = document.images['b_' + who].src.replace('_on', '_off'); 
    31         var browser = whichBrowser(); 
    32         if (browser == 'IE 6' || browser == 'IE 7') { 
     31        if (BrowserDetect.browser == "Explorer") { 
    3332            document.getElementById('box_' + who).style.overflowX = 'scroll'; 
    3433        } else { 
Note: See TracChangeset for help on using the changeset viewer.