NEWBIE: Hot to intergrate Javascript menu NEWBIE: Hot to intergrate Javascript menu
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

NEWBIE: Hot to intergrate Javascript menu

Started by fernandose, January 30, 2005, 11:32:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fernandose

Hi, i have this javascript menu which i would like to put on my coppermine album. Its a top horizontal menu which appears at the top of the page. Could please tell me where to put this snippet of code and in which section of the page please?

script language="JavaScript">

//Top Nav Bar I v2.1- By Constantin Kuznetsov Jr. (script@esolutiononline.com)
//Modified by Dynamic Drive for NS6/Opera6 compatibility and code streamlining March 4th, 2002
//Visit http://www.dynamicdrive.com for this script

var keepstatic=1 //specify whether menu should stay static 0=non static (works only in IE4+)
var menucolor="#91bef2" //specify menu color
var submenuwidth=150 //specify sub menus' color

</script>
</head>

<body>
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menucontext.js"></script>
<script language="JavaScript">
showToolbar();
</script>
<script language="JavaScript">
function UpdateIt(){
if (ie&&keepstatic&&!opr6)
document.all["MainTable"].style.top = document.body.scrollTop;
setTimeout("UpdateIt()", 200);
}
UpdateIt();
</script>
</body>

Thanks :)

Joachim Müller


fernandose

Sorry i dont understand where do i add that code in script.js

<script language="JavaScript">

//Top Nav Bar I v2.1- By Constantin Kuznetsov Jr. (script@esolutiononline.com)
//Modified by Dynamic Drive for NS6/Opera6 compatibility and code streamlining March 4th, 2002
//Visit http://www.dynamicdrive.com for this script

var keepstatic=1 //specify whether menu should stay static 0=non static (works only in IE4+)
var menucolor="#91bef2" //specify menu color
var submenuwidth=150 //specify sub menus' color

</script>
</head>

<body>
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menucontext.js"></script>
<script language="JavaScript">
showToolbar();
</script>
<script language="JavaScript">
function UpdateIt(){
if (ie&&keepstatic&&!opr6)
document.all["MainTable"].style.top = document.body.scrollTop;
setTimeout("UpdateIt()", 200);
}
UpdateIt();
</script>
</body>

and where do i put that code:?
function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}



function writeCookie(name, data, noDays){

  var cookieStr = name + "="+ data

  if (writeCookie.arguments.length > 2){

    cookieStr += "; expires=" + getCookieExpireDate(noDays)

    }

  document.cookie = cookieStr

}



function readCookie(cookieName){

   var searchName = cookieName + "="

   var cookies = document.cookie

   var start = cookies.indexOf(cookieName)

   if (start == -1){ // cookie not found

     return ""

     }

   start += searchName.length //start of the cookie data

   var end = cookies.indexOf(";", start)

   if (end == -1){

     end = cookies.length

     }

   return cookies.substring(start, end)

}



function blocking(nr, cookie, vis_state)

{

        if (document.layers)

        {

                current = (document.layers[nr].display == 'none') ? vis_state : 'none';

                if (cookie != '')

                        writeCookie(nr, current);

                document.layers[nr].display = current;

        }

        else if (document.all)

        {

                current = (document.all[nr].style.display == 'none') ? vis_state : 'none';

                if (cookie != '')

                        writeCookie(nr, current);

                document.all[nr].style.display = current;

        }

        else if (document.getElementById)

        {

                display = (document.getElementById(nr).style.display == 'none') ? vis_state : 'none';

                if (cookie != '')

                        writeCookie(nr, display);

                document.getElementById(nr).style.display = display;

        }

}





function adjust_popup()

{

        var w, h, fixedW, fixedH, diffW, diffH;



        if (document.all) {

                fixedW = document.body.clientWidth;

                fixedH = document.body.clientHeight;

                window.resizeTo(fixedW, fixedH);

                diffW = fixedW - document.body.clientWidth;

                diffH = fixedH - document.body.clientHeight;

        } else {

                fixedW = window.innerWidth;

                fixedH = window.innerHeight;

                window.resizeTo(fixedW, fixedH);

                diffW = fixedW - window.innerWidth;

                diffH = fixedH - window.innerHeight;

        }

        w = fixedW + diffW;

        h = fixedH + diffH;

        if (h >= screen.availHeight) w += 16;

        if (w >= screen.availWidth)  h += 16;

        w = Math.min(w,screen.availWidth);

        h = Math.min(h,screen.availHeight);

        window.resizeTo(w,h);

        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);

}



thanks

Joachim Müller

only actual JavaScript code can go into script.js, the html bits have to go into template.html - you have to put //Top Nav Bar I v2.1- By Constantin Kuznetsov Jr. (script@esolutiononline.com)
//Modified by Dynamic Drive for NS6/Opera6 compatibility and code streamlining March 4th, 2002
//Visit http://www.dynamicdrive.com for this script

var keepstatic=1 //specify whether menu should stay static 0=non static (works only in IE4+)
var menucolor="#91bef2" //specify menu color
var submenuwidth=150 //specify sub menus' color

function UpdateIt(){
if (ie&&keepstatic&&!opr6)
document.all["MainTable"].style.top = document.body.scrollTop;
setTimeout("UpdateIt()", 200);
}
UpdateIt();
</script>
</body>

and where do i put that code:?
function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}



function writeCookie(name, data, noDays){

  var cookieStr = name + "="+ data

  if (writeCookie.arguments.length > 2){

    cookieStr += "; expires=" + getCookieExpireDate(noDays)

    }

  document.cookie = cookieStr

}



function readCookie(cookieName){

   var searchName = cookieName + "="

   var cookies = document.cookie

   var start = cookies.indexOf(cookieName)

   if (start == -1){ // cookie not found

     return ""

     }

   start += searchName.length //start of the cookie data

   var end = cookies.indexOf(";", start)

   if (end == -1){

     end = cookies.length

     }

   return cookies.substring(start, end)

}



function blocking(nr, cookie, vis_state)

{

        if (document.layers)

        {

                current = (document.layers[nr].display == 'none') ? vis_state : 'none';

                if (cookie != '')

                        writeCookie(nr, current);

                document.layers[nr].display = current;

        }

        else if (document.all)

        {

                current = (document.all[nr].style.display == 'none') ? vis_state : 'none';

                if (cookie != '')

                        writeCookie(nr, current);

                document.all[nr].style.display = current;

        }

        else if (document.getElementById)

        {

                display = (document.getElementById(nr).style.display == 'none') ? vis_state : 'none';

                if (cookie != '')

                        writeCookie(nr, display);

                document.getElementById(nr).style.display = display;

        }

}





function adjust_popup()

{

        var w, h, fixedW, fixedH, diffW, diffH;



        if (document.all) {

                fixedW = document.body.clientWidth;

                fixedH = document.body.clientHeight;

                window.resizeTo(fixedW, fixedH);

                diffW = fixedW - document.body.clientWidth;

                diffH = fixedH - document.body.clientHeight;

        } else {

                fixedW = window.innerWidth;

                fixedH = window.innerHeight;

                window.resizeTo(fixedW, fixedH);

                diffW = fixedW - window.innerWidth;

                diffH = fixedH - window.innerHeight;

        }

        w = fixedW + diffW;

        h = fixedH + diffH;

        if (h >= screen.availHeight) w += 16;

        if (w >= screen.availWidth)  h += 16;

        w = Math.min(w,screen.availWidth);

        h = Math.min(h,screen.availHeight);

        window.resizeTo(w,h);

        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);

}
into scripts.js and<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menucontext.js"></script>
<script language="JavaScript">
showToolbar();
</script>
into template.html (not tested though). You may have to edit the path to menu.js and menucontext.js

Joachim

fernandose

Hi,
I did what you said, but i think i mucked up the theme.php when i was trying to figure out what to do at the very beginning. When i goto the album index this is the error i get:

Parse error: parse error, unexpected '<' in /home/locked/album/themes/classic/theme.php on line 21

kegobeer

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

fernandose

this is the beginning of my theme.php

<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.3.2                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR                                     //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// (http://coppermine.sf.net/team/)                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// CVS version: $Id: theme.php,v 1.5 2004/07/24 15:04:11 gaugau Exp $
// ------------------------------------------------------------------------- //

// HTML template for main menu
$template_main_menu = <head>
<style>
all.clsMenuItemNS, .clsMenuItemIE{text-decoration: none; font: bold 12px Arial; color: black; cursor: hand; z-index:100}
#MainTable A:hover {color: yellow;}
</style>
<title>Welcome to Homepage</title>
</head>
<<<EOT <span class="topmenu">
<!-- BEGIN album_list -->
                        <a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a> ::
<!-- END album_list -->
<!-- BEGIN my_gallery -->
                        <a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a> ::
<!-- END my_gallery -->

Ive highllighted line 21, if im correct that it is.

Joachim Müller

well, that's just bull. Undo your modification, your changes are suppossed to go into template.html, not theme.php!

fernandose

Hi,
Yer i know! But what you see is the theme.php without the modification, i deleted that bit already. It would easy if someone cud post the original theme.php, or i'll just download coppermine and see if theme.php is there.
Thanks

fernandose

THANKS, I GOT IT TO WORK!!!
THANKS FOR UR HELP!