Posted by Brunhilda on 28 May 2010 19:03, last edited by Helmut_pdorf on 28 Dec 2011 11:57
Tags: iframe javascript message
Thanks to kawina's question, Timothy Foster came up to this brilliant idea:
Step 1:
Create a page called javascript:iframe-event with the following code:
[[code type="html"]]
<html>
<head>
<script type="text/javascript">
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var red = "http://sitename.wikidot.com/iframe:event/tags/_m"+month.toString()+"d"+day.toString();
window.location = red;
</script>
</head>
<body>
</body>
</html>
[[/code]]
NOTE: Change sitename to your site's name.
Step 2:
Create a page iframe:event with the following code:
[[module ListPages ... tags="@URL" order="title"]]
%%title%%. %%content%%
[[/module]]
[[module CSS]]
#header,
#side-bar,
#top-bar,
#footer,
#license-area,
#page-title,
#navi-bar,
#navi-bar-shadow,
#breadcrumbs,
.page-tags,
#page-info,
.page-watch-options,
.page-options-bottom,
#footer-bar,
#login-status,
.search-top-box,
#edit-cancel-button{
display: none !important;
}
#action-area h1, #edit-page-form tbody tr:first-child{
display: none !important;
}
#main-content, #container-wrap, #container{
margin: 0;
}
[[/module]]
NOTE: Change the … to whatever the ListPages parameters are.
Step 3:
On your main page, place the following iframe:
[[iframe http://sitename.wdfiles.com/local--code/javascript:iframe-event frameborder="0"]]
NOTE: Change the height and width parameters according to your desire.
Step 4:
Tag every event page with the date it occurred in the following manner:
- _mmonthddate
month is a numerical value between 1 and 12 (Jan=1, Feb=2, etc)
date is a numerical value between 1 and 31, depending on the date.
A tag for May 27 would look like:
- _m5d27
I believe that's all the steps. Now, it will automatically sift through the dates depending on what day it actually is since we are using the Date object in Javascript. ListPages is used to display the pages as the Javascript redirects to the page with that module.
Author
Timothy Foster. Please visit his/her userPage.
Hey Timothy, quick question. Did you create it from scratch, or base it off of this page that I linked you to?
If you based it off that page on the calendars wiki, I think we should add James Kanjo as an author as well here, as he was the one that wrote the original Javascript.
- Shane
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Nah it's fine — I've had a look at the code. He has definitely looked at my Javascript to learn how to create Javascript programs (which is great!), but the final program you see here is completely his.
As it happens James, it was your use of Javascript on the calendar project that got me curious on learning the language myself. My favorite way to learn these languages (like HTML, CSS, and NWScript1) is by example, so these programs you have been making are a great aid to my grasp on the language. For that you have my thanks.
Timothy Foster - @tfAuroratide
Auroratide.com - Go here if you're nerdy like me
Don't worry mate, I'm a geek too — I spend hours of my limited free time working on add-ons for a internet service nobody has heard of XD
Yeah, I could tell that you had seen the Javascript from the calendar project… your code demonstrates good coding habits similar to my own ;-)
My favourite way to learn languages is also through example, but also through trial-and-error (something I do an awful lot of, check it out)