widget lässt sich nicht mehr öffnen

fabiopigi

fabiopigi

Aktives Mitglied
Thread Starter
Dabei seit
03.06.2005
Beiträge
2.714
Reaktionspunkte
253
hi


ich bin gerade daran, ein widget zu erstellen.

nun, auf jedenfall lässt es sich seit "irgendwann" nicht mehr öffnen.
in safari funktioniert noch alles (ausser die setpreference, etc), aber ewnn ich das widget doppelklicke "zoomt" zwar der finder die datei als würde er sie öffnen, aber mehr auch nicht.

in der dashboard leiste ist zwar das icon zum widget, aber ich kann es nicht "wegziehen".


ich weiss echt nicht mehr weiter.

ich habe bereits alle einstellungen zu dashboard allgemein gelöscht (also auch alle anderen widget.com.apple.... gelöscht), auch die com.apple.dashboard.plist gelöscht und den finder natürlich immer neugestartet.

aber nichts hilft.

ich denke langsam, dass irgendetwas am code nicht ganz I.O ist.

ich finde aber beim besten wille nichts, was falsch ist.


ich kopiere jetzt mal die HTML und Javascript datei hier rein, und füge das komplette widget als anhang an.


Code:
[HTML] <html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="daclock.js" />
<style type="text/css" title="AppleStyle">
    @import "daclock.css";
</style>

</head>

<body >

    <div id ="front">
        <image src="vorne.png" class="vorne">


<script type="text/javascript">
//onmousemove='mousemove(event);' onmouseout='mouseexit();'
showflash();
</script>

<div class="flip" id="fliprollie"></div>
    
        <div class="flip" id="flip" onclick="showbackside(event);updateColor();" onmouseover="enterflip(event);" onmouseout="exitflip(event);"></div>
    </div>

    <div id='back'>
        <image src="hinten.png" class="vorne">
<input type="range" min="0" max="100" id="red" oninput="updateColor()" value="100" class="sliderred">
<input type="range" min="0" max="100" id="green" oninput="updateColor()" value="100" class="slidergreen">
<input type="range" min="0" max="100" id="blue" oninput="updateColor()" value="100" class="sliderblue">
<div id="feld" class="feld"> </div>
<image src="icon_maske.png" class="maske">
<input id=output>

<div class="deButton" id="doneButton" onclick='hidePrefs();'>Done</div>
    </div>

</body>
</html>

[/HTML]

[CODE]var flipShown = false;
var animation = {duration:0, starttime:0, to:1.0, now:0.0, from:0.0, firstElement:null, timer:null};

function mousemove (event)
{
    if (!flipShown)
    {
        if (animation.timer != null)
        {
            clearInterval (animation.timer);
            animation.timer  = null;
        }
            
        var starttime = (new Date).getTime() - 13;
            
        animation.duration = 500;
        animation.starttime = starttime;
        animation.firstElement = document.getElementById ('flip');
        animation.timer = setInterval ("animate();", 13);
        animation.from = animation.now;
        animation.to = 1.0;
        animate();
        flipShown = true;
    }
}
function mouseexit (event)
{
    if (flipShown)
    {
        if (animation.timer != null)
        {
            clearInterval (animation.timer);
            animation.timer  = null;
        }
            
        var starttime = (new Date).getTime() - 13;
            
        animation.duration = 500;
        animation.starttime = starttime;
        animation.firstElement = document.getElementById ('flip');
        animation.timer = setInterval ("animate();", 13);
        animation.from = animation.now;
        animation.to = 0.0;
        animate();
        flipShown = false;
    }
}
function animate()
{
    var T;
    var ease;
    var time = (new Date).getTime();
            
    
    T = limit_3(time-animation.starttime, 0, animation.duration);
    
    if (T >= animation.duration)
    {
        clearInterval (animation.timer);
        animation.timer = null;
        animation.now = animation.to;
    }
    else
    {
        ease = 0.5 - (0.5 * Math.cos(Math.PI * T / animation.duration));
        animation.now = computeNextFloat (animation.from, animation.to, ease);
    }
    
    animation.firstElement.style.opacity = animation.now;
}
function limit_3 (a, b, c)
{
    return a < b ? b : (a > c ? c : a);
}
function computeNextFloat (from, to, ease)
{
    return from + (to - from) * ease;
}
function enterflip(event)
{
    document.getElementById("fliprollie").style.display = "block";
}

function exitflip(event)
{
    document.getElementById("fliprollie").style.display = "none";
}
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);
}
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);


}


function showbackside(event)
{
    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);


    document.getElementById("fliprollie").style.display = "none";
}




function updateColor() {
        inputred = document.getElementById('red');

        inputgreen = document.getElementById('green');

        inputblue = document.getElementById('blue');


        var red=Math.round(parseInt(inputred.value)*2.55);
        var green=Math.round(parseInt(inputgreen.value)*2.55);
        var blue=Math.round(parseInt(inputblue.value)*2.55);

        //widget.setPreferenceForKey(red,"red");
        //widget.setPreferenceForKey(green,"green");
        //widget.setPreferenceForKey(blue,"blue");

        var rgbtext="rgb("+red+","+green+","+blue+")";

        var hexred=red.toString(16);
        if(hexred.length==1){hexred="0"+hexred}else{hexred=hexred};
        hexred=hexred.toUpperCase();

        var hexgreen=green.toString(16);
        if(hexgreen.length==1){hexgreen="0"+hexgreen}else{hexgreen=hexgreen};
        hexgreen=hexgreen.toUpperCase();

        var hexblue=blue.toString(16);
        if(hexblue.length==1){hexblue="0"+hexblue}else{hexblue=hexblue};
        hexblue=hexblue.toUpperCase();


        var hex=hexred+hexgreen+hexblue;
    
        document.getElementById('output').value=hex;

        document.getElementById("feld").style.backgroundColor = rgbtext;
      }





function showflash(){


document.write("<embed src='clock.swf?hexcode=FFFFFF' width=305 height=82 pluginspage='http://www.macromedia.com/shockwave/download/' class='clock' id='clock'></embed>");

}
noch was, beim javascript, dass hab ich aus dem widget von flickr, dem "flidget".


ich glaube auch, dass es kaum was am code selber ist, den selbst wenn ich das javascript deaktiviere (sprich den import vom .js entferne) und auch alle javascript anweisungen aus der html datei rausnehme, lässt sich widget nicht öffnen.

an was könnte es wohl sonst noch liegen?

also, im anhang mal das widget.

danke im vorraus, für tipps
 
Zurück
Oben Unten