mootools countdown conversion?

Discussion in 'JavaScript' started by jnm, Nov 17, 2008.

  1. #1
    jnm, Nov 17, 2008 IP
  2. rrhode

    rrhode Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi there,

    I have played around with mootools before and it seems its documentation is very good. So if you do the upgrade and something no longer works properly or any of the functions are different it is probably not too hard to look up in the documentation of mootools how to use those functions and adjust the code accordingly.

    There is always the chance it would work just fine with either version as long as you have the right classes and functions added into the script.

    Ryan
     
    rrhode, Nov 18, 2008 IP
  3. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #3
    ryan: thats just not true.

    1.11 and 1.2.1 have some significant CORE CHANGES that affect number of functions, structures, declarations and methods. it changes the way classes are implemented and a lot more... conversions between the two can be a pain although once you get the hang of it, it is a breeze... last month i converted 3,000 lines of 1.11 code to 1.2.1...

    for a countdown script, i doubt it woul dbe that hard though

    the problem for this countdown is: there is no download link and the author uses a dean edwards packed version:

    eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('8 w=n u({5:{t:m,4:m,6:m,9:m,a:m,e:r,I:\'%4% 4 \',A:\'%6% 6 \',E:\'%9% 11 \',G:\'%a% 12\',s:\'M\',C:u.z,H:u.z},N:f(h,5){2.W(5);2.h=h;2.B=d.v($7()/o);2.e=n O(h.P).x()/o;b(2.e==\'Q\')k;b(!2.e)k;2.3=2.e-2.B;b(2.3<0&&2.5.t==r){2.y();k}2.q()},q:f(){8 3=2.3;2.x();2.J(2.7);b(2.3<=0&&2.5.t==r){2.y();k}b(3!=2.3){2.F(\'C\',2.7)}(f(){2.q()}.R(2)).S(T)},x:f(){8 c=V;8 g=X;8 l=Y;2.3=2.e-d.v($7()/o);b(2.3<=0){2.3=2.e-d.v($7()/o);2.3=2.3*(-1);8 4=2.5.4?d.j(2.3/c):0;8 6=2.5.6?d.j((2.3-(4*c))/g):0;8 9=2.5.9?d.j((2.3-(4*c)-(6*g))/l):0;8 a=2.5.a?2.3-(4*c)-(6*g)-(9*l):0}10{8 4=2.5.4?d.j(2.3/c):0;8 6=2.5.6?d.j((2.3-(4*c))/g):0;8 9=2.5.9?d.j((2.3-(4*c)-(6*g))/l):0;8 a=2.5.a?2.3-(4*c)-(6*g)-(9*l):0}2.7={4:4,6:6,9:9,a:a}},J:f(){2.h.D(2.L())},L:f(){8 i=\'\';b(2.7.4>0){i+=2.5.I.p(\'%4%\',2.7.4)}b(2.7.4>0||2.7.6>0){i+=2.5.A.p(\'%6%\',2.7.6)}b(2.7.4>0||2.7.6>0||2.7.9>0){i+=2.5.E.p(\'%9%\',2.7.9)}i+=2.5.G.p(\'%a%\',2.7.a);k i},y:f(){2.h.D(2.5.s);2.F(\'H\',2.5.s)}});w.K(n U);w.K(n Z);',62,65,'||this|remaining|days|options|hours|time|var|minutes|seconds|if|day|Math|target|function|hour|el|str|floor|return|minute|true|new|1000|replace|tick|false|message|countplus|Class|round|Countdown|getTime|done|empty|formatHours|now|onTick|setHTML|formatMinutes|fireEvent|formatSeconds|onComplete|formatDays|display|implement|format|Expired|initialize|Date|innerHTML|NaN|bind|delay|500|Options|86400|setOptions|3600|60|Events|else|mins|secs'.split('|'),0,{}))
    
    HTML:
    quite frankly - as long as countdown.js is available in plaintext for dev, it should not be too difficult for such a small script.
     
    dimitar christoff, Nov 19, 2008 IP
  4. rrhode

    rrhode Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what did i say that wasn't true =p
     
    rrhode, Nov 19, 2008 IP
  5. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #5
    not in 99% of the instances. for example:
    setHTML deprecated, now part of set("html", blah) or set ({ html: blah, other props });
    setText removed
    setProperty -> set
    getProperty -> get
    getStyle/s and setStyle/s is now via get("styles") or set("styles", { css });

    etc etc. the list is quite long. you can include all the 'right' classes and functions this won't make a difference as you reference core functions that have changed...
     
    dimitar christoff, Nov 19, 2008 IP