Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: openURL makes widget lose window.widget functionality



> oops! that would make sense, sorry.
> 
> here is the HTML code that is launching the widget.openURL, it is a
Sorry I meant the unix tool "sample".  I.e. Use Activity Monitor.app to get
the pid of your process and then:

 sample <pid> 3

>From a terminal window.

Thanks,
jl

> basic form used to search my site.
> 
> <form name="SearchForm">
>                                          <input type="search"
> id="searchText">
>                      <input type="submit" onclick="getSearch()"
> value="Search" id="mysearch">
>                      &nbsp;
>                  </form>
> 
> 
> and this is the javascript that handles everything.
> 
> function getSearch () {
>                if(window.widget)
>                {
> 
>                    getUser();
>                    var theURL = "http://www.mysite.com/
> file_search.php?action=file&text=" + document.getElementById
> ("searchText").value;
>                     widget.openURL(theURL);
>                   }
>       }
> 
> function wrapURL (theURL) {
>     if (window.widget) {
>        theURL = "javascript:widget.openURL('" + theURL + "');";
>     }
>     return theURL;
> }
> 
> function getUser ()
> {
>      if(window.widget)
>      {
>          widget.setPreferenceForKey(document.getElementById
> ("username").value, "username");
>          widget.setPreferenceForKey(document.getElementById
> ("password").value, "password");
>      }
> 
>      document.getElementById("feedcontainer").innerHTML = " ";
>      if(window.widget){
>          if(widget.preferenceForKey("username")){
>              document.getElementById('getinfo').style.display = 'block';
>              document.getElementById
> ('enterPassword').style.display='none';
>              document.getElementById
> ('feedcontainer').style.display='block';
>              var url  = 'http://www.mysite.com/
> user_data_dashboard.php?username=' + widget.preferenceForKey
> ("username") + '&password=' + widget.preferenceForKey("password");
>              importXML(url,'parseRSS');
> 
>              } else {
>                      document.getElementById
> ('enterPassword').style.display='block';
>                      document.getElementById
> ('feedcontainer').style.display='none';
>              }
>          }
> }
> if(window.widget)
>      {
>          widget.onfocus = getUser;
>      }
> if(window.widget)
>      {
>          widget.onshow = getUser;
>      }
> 
> 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)
>      {
>          // fade in the info button
>          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';
> }
> 
> 
> // Perform the flip from front to back.
> 
> function showPrefs()
> {
>      var front = document.getElementById('front');
>      var back = document.getElementById('back');
> 
>      if (window.widget)
>          widget.prepareForTransition('ToBack');        // freezes the
> widget so that you can change it without the user noticing
> 
>      front.style.display='none';        // hide the front
>      back.style.display='block';        // show the back
> 
> 
>      if (window.widget)
>          setTimeout ('widget.performTransition();', 0);    // and
> flip the widget over
> }
> 
> // Perform the flip from back to front, refresh content under the
> assumption
> // that the configuration has changed.
> 
> function hidePrefs()
> {
>      var front = document.getElementById('front');
>      var back = document.getElementById('back');
>      var flipcircle = document.getElementById('fliprollie');
>      if (window.widget)
>          widget.prepareForTransition('ToFront');        // freezes
> the widget and prepares it for the flip back to the front
> 
>      flipcircle.style.display='none';
>      back.style.display='none';            // hide the back
>      front.style.display='block';        // show the front
> 
> 
> 
> 
> 
>      if (window.widget)
>          setTimeout ('widget.performTransition();', 0);        // and
> flip the widget back to the front
> 
>      getUser();
> }
> 
> 
> 
> a little long winded, but basically ive narrowed it down to something
> happening when the getSearch function is called.
> 
> Thanks
> 
> Andy
> 
> On 11-May-05, at 11:42 AM, John Louch wrote:
> 
>> You would need to sample the widget for us to tell what is happening.
>> 
>> Thanks,
>> jl
>> 
>> 
>>> i have a widget that displays some xml data from a website.
>>> everything works
>>> fine, until i leave the widget using widget.openURL . when you
>>> return to the
>>> widget it seems to lose all javascript functionality that used the
>>> widget.
>>> object.
>>> 
>>> widget.openURL no longer works, the flip transitions no longer
>>> work, and my
>>> preference keys are gone. basically all functions that use
>>> widget.anything no
>>> longer work.
>>> 
>>> anyone have any idea what is happening?
>>> 
>>> andy
>>> 
>>> 
>>>  _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Dashboard-dev mailing list      (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/dashboard-dev/email@hidden
>>> 
>>> This email sent to email@hidden
>>> 
>> 
>> 
>> --------------------------------------------------
>> John Louch         Internet #: email@hidden
>> (805) 541 2965
>> 
>> 
>> 
>> 
> 

--------------------------------------------------
John Louch         Internet #: email@hidden
(805) 541 2965


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: openURL makes widget lose window.widget functionality (From: Andy MacDonald <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.