Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

flipsides (newbie question)

Author Message
rsommerer



Joined: 05 Oct 2007
Posts: 2

Posted: Fri Oct 05, 2007 - 2:12 pm    Post subject: flipsides (newbie question) Reply with quote

hi folks,

donīt even know where to start here.. background is, i startet to develop interest for coding a year ago, started out with html, then javascript and now i am trying to get into dashboard because of itīs appeal of writing code for something that has functionality.

so i started out with the usual text stuff, got into divs and since yesterday i have been trying to get the code running from appleīs homepage for flipping the widget. it wonīt work, i did exactly write the same code as displayed on the apple page (right now, i mainly copy and paste).

this is my grammar..

.html
Code:

<html>

<title>

new.html

</title>

<head>

<style type="text/css">

    @import "new.css";

</style>

<script type='text/javascript' src='new.js'>
<script type='text/javascript' src='/System/Library/WidgetResources/AppleClasses/AppleInfoButton.js' charset='utf-8'/>
<script type='text/javascript' src='/System/Library/WidgetResources/AppleClasses/AppleAnimator.js' charset='utf-8'/>
<script type='text/javascript' src='/System/Library/WidgetResources/AppleClasses/AppleButton.js' charset='utf-8'/>

</script>

</head>

<body onload='setup();'>

<div id="front">
   
<div id="newText">das ist ein erstes widget...<br>oder nicht..?</div>

   <div id="infoButton"></div>

</div>
   

<div id="back">

<div id="newText">Select Playlist:

   <div id='playlist' class='label'>
   <select id='playlist-popup' class='popup' onchange='playlistchanged(this);'><option value='1'>Library</option></select></div>
      
         <div id="doneButton"></div>

   </div>


</body>

</html>


.css
Code:

/* background settings */

  body {

  margin: 0;
  background-image: url("Default.png");
  background-repeat: no-repeat;
 
}

/* font settings */

#newText {
  font: 12px "Lucida Grande";
  font-weight: bold;
  color: pink;
  position: absolute;
  top: 15px;
  left: 32px

}


/* front and backside */

#infoButton {
    position:absolute;
    top:2px;
    left:5px;
}
 
#front {
    display:block;
}
 
#back {
    display:none;
}
 
#doneButton {
    position:absolute;
    top:2px;
    left:5px;
}


.js
Code:

/* backside and glass button */

var gDoneButton;
var gInfoButton;
 
function setup()
{
    gDoneButton = new AppleGlassButton(document.getElementById("doneButton"), "Done", hidePrefs);
    gInfoButton = new AppleInfoButton(document.getElementById("infoButton"), document.getElementById("front"), "white", "white", showPrefs);
}

gInfoButton.setStyle("black","black");

/* switch to back */

function showPrefs()
{
    var front = document.getElementById("front");
    var back = document.getElementById("back");
 
    if (window.widget)
        widget.prepareForTransition("ToBack");
 
    front.style.display="none";
    back.style.display="block";
 
    if (window.widget)
        setTimeout ('widget.performTransition();', 0);
}


/* switch to front */

function hidePrefs()
{
    var front = document.getElementById("front");
    var back = document.getElementById("back");
 
    if (window.widget)
        widget.prepareForTransition("ToFront");
 
    back.style.display="none";
    front.style.display="block";
 
    if (window.widget)
        setTimeout ('widget.performTransition();', 0);
}


/* saves cpu power unless visible */

if (window.widget) {
    widget.onhide = onhide;
    widget.onshow = onshow;
}

function onshow() {
    if (timerInterval == null) {
        timerInterval = setInterval("updateTime(true);", 1000);
    }
}

function onhide() {
    if (timerInterval != null) {
        clearInterval(timerInterval);
        timerInterval = null;
    }
}


kindly nevermind the playlist selector, and personally, i think the cpu power saver is sweet, donīt you think?

kind regards, guys
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group