Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
Prev Previous Post   Next Post Next
  #1  
Old 06-03-2008, 11:43 PM
Ozy Ozy is offline
 
Join Date: Apr 2003
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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)
}
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05585 seconds
  • Memory Usage 2,278KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete