vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Moon Phases in Calendar Monthly (https://vborg.vbsupport.ru/showthread.php?t=181442)

Ozy 06-03-2008 11:43 PM

Moon Phases in Calendar Monthly
 
Hi,

I run a non-profit site for our Astronomy club. I want to add the current moon phase to each day in the calendar view. I can source JPG's for moon phase for the view. I can also provide the logic for calculating the phase for that day. I just don't know how to make these changes. Any help would be great.

Code:

// CREDITS:
// Moon Phase Clock
// by Urs Dudli and Peter Gehrig
// Copyright (c) 2002 Peter Gehrig and Urs Dudli. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.24fun.com/fast/index.html
// info@24fun.com
// 6/25/2002

// IMPORTANT:
// If you add this script to a script-library or a script-archive
// you have to insert a link to http://www.24fun.com
// right into the webpage where the script will be displayed.

var pastdate
var pastyear=2002
var pastmonth=5
var pastday=11
var nowdate
var c
var pausenormal=50
var pausenowmoon=3000
var moonday
var i_mooncycle=1
var mooncycle=29.530589

var picture = new Array("moonitems/n1.gif","moonitems/n2.gif","moonitems/n3.gif","moonitems/n4.gif","moonitems/n5.gif","moonitems/n6.gif","moonitems/n7.gif","moonitems/n8.gif","moonitems/n9.gif","moonitems/n10.gif","moonitems/n11.gif","moonitems/n12.gif","moonitems/n13.gif","moonitems/n14.gif","moonitems/n15.gif","moonitems/n16.gif","moonitems/n17.gif","moonitems/n18.gif","moonitems/n19.gif","moonitems/n20.gif","moonitems/n21.gif","moonitems/n22.gif","moonitems/n23.gif","moonitems/n24.gif","moonitems/n25.gif","moonitems/n26.gif","moonitems/n27.gif","moonitems/n28.gif","moonitems/n29.gif")

var imgpreload=new Array()
for (i=0;i<=picture.length;i++) {
        imgpreload[i]=new Image()
        imgpreload[i].src=picture[i]
}

pastdate=new Date(pastyear,pastmonth,pastday,0,0,0)
nowdate=new Date()
resultdays=(Date.parse(nowdate)-Date.parse(pastdate))/1000/60/60/24
moonday=resultdays/mooncycle
moonday=(resultdays/mooncycle)-(Math.floor(resultdays/mooncycle))
moonday=Math.round(mooncycle*moonday)
c="<img src='moonitems/n"+moonday+".gif' name='moonimg'>"

window.onload=animatemoon

function animatemoon() {
        if (i_mooncycle==moonday) {
                var pause=pausenowmoon
        }
        else {
                var pause=pausenormal
        }
        var mimg="moonitems/n"+i_mooncycle+".gif"
        document.moonimg.src=mimg
        i_mooncycle++
        if (i_mooncycle>29) {i_mooncycle=1}
        var timer=setTimeout("animatemoon()",pause)
}


StepOnFrog 07-23-2008 01:20 AM

I am also interested in your idea....

I found this in the meantime --> https://vborg.vbsupport.ru/showthrea...ht=moon+phases

;-D
step

Reeve of shinra 07-23-2008 02:21 AM

The current Calendar isn't the best for tihs kind of stuff :(


All times are GMT. The time now is 10:59 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01084 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete