Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 General
 Off topic, News and Updates
 Javascript assistance needed :)
Author « Topic »  

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/01/2018 :  21:24:09  
Hi all,

I'm looking for a dev that would help me out with a Javascript ot JQuery script.

I have a dog pedigree website that will show repeated ancestors within a pedigree using a color array. I can set this to true or false in the config file. The issue I have is that sometimes the colors are too dark & distracting when viewing a pedigree so I currently have this set to false.

What I would like to have a way for the user to click a button to display the color array. The page loads w/o colors (default), user clicks "Show repeated ancestors" (colors show) and then could click "Hide repeated ancestors" (back to default) - hopefully with no page refresh.

Toggle button would appear below the Generations link.

[url]http://www.germanshepherddatabase.org/pp_pedigree.php?id=Tiger%20of%20Hamburg&db=pedigree&gens=4[/url]

Any devs want to help me out?

Julie
Owned & loved by 7 German Shepherds

dbdave
ECT Moderator

USA
10408 Posts

Posted - 11/01/2018 :  22:38:05  
Perhaps it's easy to manipulate the true/false with the toggle button.
Is that javascript where you set the true/false?

I think it's probably easy, but looking at the page, I can't tell what's supposed to happen when the colors show.

Many javascript apps have callback functions allowing you to trigger a function as the program does it's thing.

David

Edited by - dbdave on 11/01/2018 22:39:37

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/02/2018 :  06:48:31  
Hi there David!

It's not Javascript (I don't think)...

Config file:

$bColorizeRepeatedAncestor=false;// set true/false - true to show a unique background color for repeated ancestors

Code that calls the color array:

function PrintPedigreeNode($szNodeId, $szNodeGen)
{
global $aHashDetails, $aPowers, $nHeight, $aWidths, $aExtraFields, $nGens, $nPictureGens, $nPhotoHeight;
global $szPhotoPath, $aRepeated, $aUniqueColors, $bColorizeRepeatedAncestor, $szDatabase, $szPPCorrection;
global $nMarkIndex, $bIgnoreRedMarks;
$nNodeId = (int)$szNodeId;
$szRowspan = $aPowers[$szNodeGen];
$nNodeHeight = $nHeight * $szRowspan;
$szColWidth = $aWidths[$szNodeGen - 1];
$szBgColor = "";
if ($bColorizeRepeatedAncestor && array_key_exists($nNodeId, $aRepeated))
{
$nColorIndex = $aRepeated[$nNodeId];
if ($nColorIndex >= 0)
{
$szColor = Rgb2Hex($aUniqueColors[$nColorIndex], true);
$szBgColor = ";background-color:$szColor";
}
}

if ($szRowspan == 1)
echo "<td style='width:$szColWidth%;height:$nNodeHeight" . "px$szBgColor' >\n";
else
echo "<td style='width:$szColWidth%;height:$nNodeHeight" . "px$szBgColor' rowspan='$szRowspan' >\n";

if ($nNodeId != -1)


Julie
Owned & loved by 7 German Shepherds

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/02/2018 :  06:58:11  
I just changed it to true so you can now see the colored repeated ancestors.

Julie
Owned & loved by 7 German Shepherds

dbdave
ECT Moderator

USA
10408 Posts

Posted - 11/02/2018 :  07:22:25  
That's .php
Scratch what I wrote.
Perhaps we can come up with something that changes the true to false and back again.
I check it out this evening from home

Edited by - dbdave on 11/02/2018 07:25:04

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/02/2018 :  08:14:21  
Thanks!

I've been searching around but can't find anything that applies.

I would thnk maybe a link that says Show/Hide Repeated Ancestors, that when clicked would would toggle the colors, clicked again would toggle them off.

Julie
Owned & loved by 7 German Shepherds

dbdave
ECT Moderator

USA
10408 Posts

Posted - 11/02/2018 :  08:26:42  
Yes, but it looks like the colors are dynamic. Meaning based on some criteria, the colors are different for each of those cells.
I think we would need to toggle the true/false to make it work right.
Of course I don't know much about that program you have there.
Is this a software package you are using?

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/02/2018 :  09:30:06  
Yep, it's Pedigree Point with a lot of custom edits I did.

We can make a test page of the pp_pedigree page and the pp_commonped page, play around with that.

PM me and I'll send you the ftp info.

Julie
Owned & loved by 7 German Shepherds

dbdave
ECT Moderator

USA
10408 Posts

Posted - 11/02/2018 :  22:34:55  
I sent an email back Julie, it's working - http://www.germanshepherddatabase.org/pp_pedigreetest.php?id=Morex%20of%20Long-Worth&gens=4&db=pedigree
It does require a page reload to set that. It's really just a parameter change like your ect store includes.
We set a cookie to off when the page is first loaded and clicking the toggle button toggles the cookie on/off and forces a reload.
On reload, the .php is checking that cookie and setting the parameter to turn that color on or off.

We set a 30 day cookie, so the users preference there is saved.

Edited by - dbdave on 11/02/2018 22:37:49

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/03/2018 :  07:55:37  
You are so awesome David!!!

The test page is exactly what I wanted. The page reload is fine. :)

I am so excited!

Julie
Owned & loved by 7 German Shepherds

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 11/03/2018 :  09:00:50  
Check it out!

[url]http://www.germanshepherddatabase.org/pp_pedigree.php?id=Elsa%20vom%20Walrabe&gens=4&db=pedigree[/url]



Julie
Owned & loved by 7 German Shepherds

dbdave
ECT Moderator

USA
10408 Posts

Posted - 11/03/2018 :  11:39:13  
Glad I could help. The cookie usage is a good way to do it so the visitors preference is maintained. I just hopped around and it's really nice the way it works I think.
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000