Advanced search  

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]

Pages: [1]   Go Down

Author Topic: NEWBIE: Hot to intergrate Javascript menu  (Read 5276 times)

0 Members and 1 Guest are viewing this topic.

fernandose

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
NEWBIE: Hot to intergrate Javascript menu
« on: January 30, 2005, 11:32:04 pm »

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 :)
« Last Edit: February 11, 2005, 01:28:58 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #1 on: January 31, 2005, 12:04:42 am »

add it to scripts.js
Logged

fernandose

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #2 on: February 02, 2005, 11:39:03 pm »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #3 on: February 03, 2005, 08:47:27 am »

only actual JavaScript code can go into script.js, the html bits have to go into template.html - you have to put
Code: [Select]
//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
Code: [Select]
<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
Logged

fernandose

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #4 on: February 03, 2005, 11:35:54 pm »

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
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #5 on: February 03, 2005, 11:41:16 pm »

What is line 21 in your theme.php file?
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #6 on: February 04, 2005, 08:44:29 am »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #7 on: February 04, 2005, 11:10:18 am »

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

fernandose

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #8 on: February 04, 2005, 05:11:37 pm »

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
Logged

fernandose

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: NEWBIE: Hot to intergrate Javascript menu
« Reply #9 on: February 04, 2005, 06:00:02 pm »

THANKS, I GOT IT TO WORK!!!
THANKS FOR UR HELP!
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.