Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. JQuery comment references this:http://www.w3.org/TR/selectors/#pseudo-classesI have not used this in Javascript. I thought it was only in CSS? // Generate shortcuts for custom animationsjQuery.each({slideDown: genFx("show"),slideUp: genFx("hide"),slideToggle: genFx("toggle"),fadeIn: { opacity: "show" },fadeOut: { opacity: "hide" },fadeToggle: { opacity: "toggle" }}, function( name, props ) {jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback );};});
  2. davej

    Hidden Divs?

    Oh yeah. I expected that code to be compressed and unreadable like the other was.
  3. davej

    Hidden Divs?

    So after looking around a bit I think it may be the JQuery function "slidedown" <!DOCTYPE html><html><head> <style>div { background:#de9a44; margin:3px; width:80px;height:40px; display:none; float:left; }</style> <script src="http://code.jquery.com/jquery-latest.js"></script></head><body> Click me!<div>aaa</div><div>bbb</div><div>ccc</div><script>$(document.body).click(function () {if ($("div:first").is(":hidden")) {$("div").slideDown("slow");} else {$("div").hide();}});</script></body></html> Can I go somewhere to look at the underlying Javascript inside JQuery? Thanks
  4. davej

    Hidden Divs?

    It's minified. I don't find it readable. */(function(){var f={glow:true},b=/([$^\\\/()|?+*\[\]{}.-])/g,a=navigator.userAgent.toLowerCase(),k="1.7.7",r=0,g=[],m=0,q=[],o=0,s=false,n={VERSION:k,UID:"glow"+Math.floor(Math.random()*(1<<30)),isDomReady:window.gloader&&gloader.isReady,isReady:window.gloader&&gloader.isReady,env:function(){var u=[0,NaN],d=(/opera[\s\/]([\w\.]+)/.exec(a)||u)[1],v=d?NaN:(/msie ([\w\.]+)/.exec(a)||u)[1],x=(/rv:([\w\.]+).*gecko\//.exec(a)||u)[1],e=(/applewebkit\/([\w\.]+)/.exec(a)||u)[1],t=(/khtml\/([\w\.]+)/.exec(a)||u)[1],w=parseFloat;return{gecko:w(x),ie:w(v),opera:w(d),webkit:w(e),khtml:w(t),version:v||x||e||d||t,standardsMode:document.compatMode!="BackCompat"&&(!v||v>=6)};}(),module:function(u){var t=2,w=u.depends[0]||[],d=w.length,e=u.name,v=window.glow;if(u.library[1]!=n.VERSION){throw new Error("Cannot register "+e+": Version mismatch");}if(w[2]){for(;t<d;t++){if(!f[w[t]]){throw new Error("Module "+w[t]+" required before "+e);}}}u.builder(n);f[e]=true;return n;},ready:function(d){if(this.isReady){d();}else{q[o++]=d;}return this;},_readyBlockers:{},_addReadyBlock:function(d){if(!n._readyBlockers[d]){n._readyBlockers[d]=true;n.isReady=false;r++;}return n;},_removeReadyBlock:function(d){if(n._readyBlockers[d]){n._readyBlockers[d]=false;r--;if(!r){n.isReady=true;p();}}return n;},onDomReady:function(d){if(this.isDomReady){d();}else{g[m++]=d;}},lang:{trim:function(d){return d.replace(/^\s*((?:[\S\s]*\S)?)\s*$/,"$1");},toArray:function(e){if(e.constructor==Array){return e;}var u=[],t=0,d=e.length;for(;t<d;t++){u[t]=e[t];}return u;},apply:function(d,t){for(var e in t){d[e]=t[e];}return d;},map:function(e,x,w){if(Array.prototype.map){return Array.prototype.map.call(e,x,w||e);}if(!x.call){throw new TypeError();}var d=e.length,v=[],u=w||e,t=0;for(;t<d;t++){if(t in e){v[t]=x.call(u,e[t],t,e);}}return v;},replace:(function(){var d="g".replace(/g/,function(){return"l";})!="l",e=String.prototype.replace;return function(y,w,t){var z,v,x,u;if(!d||typeof(t)!="function"){return e.call(y,w,t);}if(!(w instanceof RegExp)){z=y.indexOf(w);return z==-1?y:e.call(y,w,t.call(null,w,z,y));}u=[];x=w.lastIndex=0;while((v=w.exec(y))!=null){z=v.index;u[u.length]=y.slice(x,z);u[u.length]=t.apply(null,v);if(w.global){x=w.lastIndex;}else{x=z+v[0].length;break;}}u[u.length]=y.slice(x);return u.join("");};})(),interpolate:function(t,w,u){var d,v,e,x;u=u||{};if(u.escapeHtml){if(!n.dom){throw new Error("glow.lang.interpolate - glow.dom is needed for escapeHtml");}x=n.dom.create("<div></div>");}if(u.delimiter==undefined){d=/\{[^{}]+\}/g;}else{v=u.delimiter.substr(0,1).replace(b,"\\$1");e=u.delimiter.substr(1,1).replace(b,"\\$1")||v;d=new RegExp(v+"[^"+v+e+"]+"+e,"g");}return t.replace(d,function(D){var A=D.slice(1,-1),C=A.split("."),B,z=0,y=C.length;if(A in w){B=w[A];}else{B=w;for(;z<y;z++){if(C[z] in {B=B[C[z]];}else{return D;}}}if(u.escapeHtml){B=x.text(.html();}return B;});},hasOwnProperty:{}.hasOwnProperty?function(d,e){return d.hasOwnProperty(e);}:function(x,y){var u=x[y],w=x.__proto__,t=w?w[y]:{};if(u!==t){return true;}var e=n.lang.hasOwnProperty(w,y),d=w[y]={},v=(x[y]!==d);delete w[y];if(e){w[name]=d;}return v;},extend:function(e,u,d){var t=function(){},v;t.prototype=u.prototype;v=new t();e.prototype=v;v.constructor=e;e.base=u;if(d){n.lang.apply(e.prototype,d);}},clone:function(t){var d,u,e;t=t.valueOf();if(typeof t!=="object"){return t;}else{if(t[0]||t.concat){e=[];d=t.length;while(d--){e[d]=arguments.callee(t[d]);}}else{e={};for(d in t){e[d]=arguments.callee(t[d]);}}return e;}}}},h=n.env,l=document;function c(){n.isDomReady=true;for(var d=0;d<m;d++){g[d]();}}function p(){if(s){return;}s=true;for(var d=0;d<o;){q[d]();d++;if®{break;}}q=q.slice(d);o=o-d;s=false;}(function(){if(n.isDomReady){return;}n._addReadyBlock("glow_domReady");if(h.ie){if(typeof window.frameElement!="undefined"){l.attachEvent("onreadystatechange",function(){if(l.readyState=="complete"){l.detachEvent("onreadystatechange",arguments.callee);c();n._removeReadyBlock("glow_domReady");}});}else{(function(){try{l.documentElement.doScroll("left");}catch(u){setTimeout(arguments.callee,0);return;}c();n._removeReadyBlock("glow_domReady");})();}}else{if(n.env.webkit<525.13&&typeof l.readyState!="undefined"){var e=function(){if(/loaded|complete/.test(l.readyState)){c();n._removeReadyBlock("glow_domReady");}else{setTimeout(e,0);}};e();}else{var t=function(){if(t.fired){return;}t.fired=true;c();n._removeReadyBlock("glow_domReady");};if(l.addEventListener){l.addEventListener("DOMContentLoaded",t,false);}var d=window.onload;window.onload=function(){if(d){d();}t();};}}})();n.isSupported=!(h.ie<6||(h.gecko<1.9&&!/^1\.8\.1/.test(h.version))||h.opera<9||h.webkit<412);if(!n.isSupported){n._addReadyBlock("glow_browserSupport");}if(window.gloader){gloader.library({name:"glow",version:"1.7.7",builder:function(){return n;}});}else{if(window.glow){throw new Error("Glow global object already exists");}else{window.glow=n;}}if(n.ie){try{document.execCommand("BackgroundImageCache",false,true);}catch(j){}}})();/*@cc_on @*//*@if (@_jscript_version > 5.5)@*/(window.gloader||glow).module({name:"glow.i18n",library:["glow","1.7.7"],depends:[["glow","1.7.7"]],builder:function®{var A;var t={l:/^[a-z]$/,lv:/^[a-z]{2,3}$/,s:/^[A-Z][a-z]{3}$/,r:/^[A-Z]{2}|[0-9]{3}$/,v:/^[a-z0-9]{4,}$/};var s=1,k=2,l=4,j=8,p=s+k+l+j,f=s+l+j,x=s+k+j,c=s+j,y=s+k+l,e=s+l,d=s+k;var m={l:s,s:k,r:l,v:j},I=["l","s","r","v"],F={l:0,s:1,r:2,v:3};var C={};var b={};var o=w(document.documentElement.lang||"en")||w("en");function D(K){for(var J in t){if(t[J].test(K)){return J;}}return"";}function w(V){if(!V.split){V="";}var N=V.split("-"),Q=N.length,R=[],K={l:"",s:"",r:"",v:""},J=0,O=J,U=0,P,S;for(var M=0,T=I.length;M<T;M++){O=J;P=I[M];S=F[P];while((D(N[O]).indexOf(P)==-1)&&(O<Q)){O++;}if(O<Q){R[s]=N[O];U+=m[P];K[P]=N[O];N[O]="*";J=O;}}var L=R.join("-").replace(/-+/g,"-");if((L=="")||(L.substring(0,1)=="-")){return false;}else{return{canonical:L,mask:U,subtags:K};}}function g(K,M,J){var L;if((J&~K.mask)==0){L=K.subtags.l;if(k&J){L=L+"-"+K.subtags.s;}if(l&J){L=L+"-"+K.subtags.r;}if(j&J){L=L+"-"+K.subtags.v;}if(M(L)){return L;}}return false;}function a(K,N,J,L){var M;switch(K.mask){case f:if((M=g(K,N,f))){break;}case e:if((M=g(K,N,e))){break;}case p:if((M=g(K,N,p))){break;}case y:if((M=g(K,N,y))){break;}case x:if((M=g(K,N,x))){break;}case d:if((M=g(K,N,d))){break;}case c:if((M=g(K,N,c))){break;}case s:if((M=g(K,N,s))){break;}default:if(N("en")){M="en";}else{M=null;}}if(M==null){L();}else{J(M);}}function v(L){var J=o,K=w(L);if(K){o=K;o.next=J;}return A;}function H(){o=o.next||o;return A;}function B(){return o.canonical;}function h(M,L,Q){var J=w(L),P,O,K;if(J){P=C[J.canonical]=C[J.canonical]||{};O=P[M]=P[M]||{};K=b[M]=b[M]||{};for(var N in Q){O[N]=Q[N];K[N]=1;}}return A;}function E(K,J){var L={},S=J||{},N=b[K]||{},O=o,T,Q;function P(U){if(C[u]&&C[u][K]&&C[u][K][Q]){return true;}else{return false;}}function R(U){L[Q]=C[u][K][Q];}function M(){L[Q]="[Error! No "+K+"."+Q+" on "+O.canonical+"]";}if(S.locale!=undefined){T=w(S.locale);if(T){O=T;}}for(Q in N){a(O,P,R,M);}return L;}function G(K,L){for(var J in L){h(J,K,L[J]);}return A;}function u(L,M){var K=M||{},J=w(L);if(K.module){if(K.label){return q(J,K.module,K.label);}else{return n(J,K.module);}}else{return z(J);}return null;}function q(L,N,M){var J;function P(Q){if(C[Q]&&C[Q][N]&&C[Q][N][M]){return true;}else{return false;}}function O(Q){J=Q;}function K(){J="**error** - no negotiated value exists";}a(L,P,O,K);return J;}function n(L,O){var K=b[O]||{},N={},M;function Q®{if(C[R]&&C[R][O]&&C[R][O][M]){return true;}else{return false;}}function P®{N[M]=R;}function J(){N[M]="**error** - no negotiated value exists";}for(M in K){a(L,Q,P,J);}return N;}function z(K){var N={},M,L;function P(Q){if(C[Q]&&C[Q][M]&&C[Q][M][L]){return true;}else{return false;}}function O(Q){N[M][L]=Q;}function J(){N[M][L]="**error** - no negotiated value exists";}for(M in {N[M]={};for(L in b[M]){a(K,P,O,J);}}return N;}r.i18n=A={setLocale:v,revertLocale:H,getLocale:B,addLocaleModule:h,getLocaleModule:E,addLocalePack:G,checkLocale:u};G("en",{PROPERTIES:{LANGUAGE:"English",DIR:"ltr"}});}});(window.gloader||glow).module({name:"glow.dom",library:["glow","1.7.7"],depends:[],builder:function(u){var n=u.env,k=u.lang,s={tagName:/^(\w+|\*)/,combinator:/^\s*([>]?)\s*/,classNameOrId:(n.webkit<417)?new RegExp("^([\\.#])((??![\\.#\\[:\\s\\\\]).|\\\\.)+)"):/^([\.#])((?:[^\.#\[:\\\s]+|\\.)+)/},X=/([$^\\\/()|?+*\[\]{}.-])/g,B={},R={checked:"checked","class":"className",disabled:"disabled","for":"htmlFor",maxlength:"maxLength"},c={checked:true,disabled:true},ah={maxlength:function®{return r.toString()=="2147483647"?undefined:r;}},ad=1,x="_unique"+u.UID,ai="_uniqueData"+u.UID,ag=1,L=[],I={black:0,silver:12632256,gray:8421504,white:16777215,maroon:8388608,red:16711680,purple:8388736,fuchsia:16711935,green:32768,lime:65280,olive:8421376,yellow:16776960,navy:128,blue:255,teal:32896,aqua:65535,orange:16753920},D=/height|top/,t=/^rgb\(([\d\.]+)(%?),\s*([\d\.]+)(%?),\s*([\d\.]+)(%?)/i,A=/^(?:(width|height)|(border-(top|bottom|left|right)-width))$/,C=/width|height|top$|bottom$|left$|right$|spacing$|indent$|font-size/,T,d,K,H,aa=window,l=document,V,G,w,P=l.createElement("div"),y=[1,"<table>","</table>"],ab=[0,"",""],O=n.webkit<526?[0,"","</div>",true]:[1,"b<div>","</div>"],a=[3,"<table><tbody><tr>","</tr></tbody></table>"],E={caption:y,thead:y,th:a,colgroup:y,tbody:y,tr:[2,"<table><tbody>","</tbody></table>"],td:a,tfoot:y,option:[1,"<select>","</select>"],legend:[1,"<fieldset>","</fieldset>"],link:O,script:O,style:O};if(n.ie){window.attachEvent("onunload",function(){P=null;});}u.ready(function(){V=l.body;G=l.documentElement;}); [...etc...]
  5. davej

    W3 Validation

    Seems strange that when I paste in their own stuff I still get a warning.http://www.w3.org/TR/xhtml1/#docconf Result: Passed, 1 warning(s) <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Virtual Library</title> </head> <body> <p>Moved to <a href="http://example.org/">example.org</a>.</p> </body></html> http://validator.w3.org/check
  6. Little smart monitors? What are you talking about? Is this a website or not?
  7. davej

    Hidden Divs?

    Yes I eventually did that, but I don't feel very comfortable with Chrome. I'm used to FF but FF was unstable on my machine and there were too many updates coming out constantly. In Chrome how do I find the Javascript?
  8. davej

    Hidden Divs?

    Good question. I'm using Chrome and actually I think Chrome sucks, but yes I can see it's not an image.
  9. davej

    Hidden Divs?

    Ok, it's just a div containing a set of unordered lists. But obviously the display:none on the div is only part of the trick.
  10. davej

    Hidden Divs?

    Oh, I had a typo. == rather than = So I wonder if the BBC div is actually an image? <html><head><title>hide abc</title><style type="text/css">div#hide{background-color: yellow;height: 200px;}div#def{background-color: green;height: 200px;}p{text-align:center;}</style><script type="text/javascript">window.onload = function(){$("btn_h").onclick = hide;$("btn_d").onclick = disp;$("btn_a").onclick = animate;}function hide(){if ($("hide").style.visibility=="hidden"){$("hide").style.visibility="visible";}else{$("hide").style.visibility="hidden";}}function disp(){if ($("hide").style.display!="none"){$("hide").style.display="none";}else{$("hide").style.display="";}}function animate(){if ($("hide").style.height!="0px"){//alert('['+$("hide").style.height+']');$("hide").style.height="0px";}else{$("hide").style.height="200px";}}function $(id){return document.getElementById(id);}</script></head><body><a href="#" id="btn_h">hide</a><a href="#" id="btn_d">display</a><a href="#" id="btn_a">animate</a><div id="hide"><p>abc</p></div><div id="def"><p>def</p></div></body></html>
  11. davej

    Hidden Divs?

    Ah, thanks! Somehow I never noticed the "none" option there. Excellent! Then there is the matter of animating the height. Style.height isn't working for me. Is there another trick? Thanks!
  12. davej

    Hidden Divs?

    What happens when you mouse-hover over "More..." on the top bar here? http://www.bbc.co.uk/news/ Even if I apply the style "hidden" the div is still there taking up space, so how are divs added and removed? Thanks
  13. davej

    Google Maps?

    Well, I'm reading this stuff... https://developers.google.com/apps-script/service_maps In the past I have posted maps of a desired area with several visible location pins but now I want to dynamically display routes and measure distances and be able to modify the paths easily.
  14. davej

    Google Maps?

    Anyone worked much with Google maps? I have used Google Maps a little and have visited a site called http://www.mapmyride.com that allows arbitrary off-road paths to be plotted and stored and the associated distances to be measured. I would like to do something like that on my webpage. Thanks.
  15. davej

    CGI ?

    Ok, I had wondered if there was perhaps some standard reason to mix some of these server-side languages. Thanks.
  16. davej

    CGI ?

    I guess the intention of my original question was to ask whether something like Perl is still desirable to augment the server-side code of a website?
  17. davej

    CGI ?

    Ok, I'm under the impression that almost all webservers use Apache or Microsoft IIS server software. The server software then interprets HTML files or somehow launches server-side code which might be Java/JSP, ASP, ASP.NET, PHP, or I don't know what else. Is CGI exactly the same thing or is it something different? Thanks
  18. davej

    CGI ?

    Ok, I had scanned the Wikipedia entry before posting my question and my understanding was that CGI implies that the webserver is set up to launch some executable program in response to particular page accesses -- but why do this? Why not just use ordinary server-side code? Are there some things that the CGI approach is better at? Or is CGI an older, semi-obsolete approach? Thanks
  19. davej

    CGI ?

    Are CGI scripts obsolete or do they fill some particular niche?
  20. Yes indeed, that makes it work. I had never seen that form of subquery before. Thanks!
  21. Over on Yahoo Answers someone posted this PL/SQL code, which was claimed to be functional: select max(c_id), req_id, exp_datefrom(select req_id, max(exp_date)from tablegroup by req_id) t1join(select c_id, req_id, exp_datefrom table) t2on (t1.exp_date = t2.exp_date)group by req_id, exp_date The stated purpose of the code is to eliminate duplicate REQ_ID rows and to select only rows with the most recent date and highest C_ID in a table of the form. C_ID | REQ_ID | EXP_DATE24 211 2012-7-1539 211 2012-8-1526 211 2012-9-2036 222 2012-9-20 What strikes me about this code is the use of a subquery in the FROM line. I have never written a subquery in that form. In fact I did not know it was possible. In SqlServer I tried this preliminary test; SELECT *FROM( SELECT C_ID FROM mytable ) ; And it produced a syntax error. So what is the truth here?
  22. I suppose you might be able to say that anything that can be done properly with JS should be done with JS and PHP should be used only where necessary. In many cases it is best to use both JS and PHP working together.
  23. http://www.softlayer.com/ Looks fine to me in Chrome20.0
  24. Actually JS is a bit odd. There is a substr() and a substring() and they are DIFFERENT. <!DOCTYPE html><html><body><script type="text/javascript">var str="0123456789";document.write(str.substring(1,4));document.write(" ");document.write(str.substr(1,4));</script></body></html> the output is "123 1234"
  25. I tried it in FF13, Chrome20, and IE8 and thought they all looked very similar. All the buttons were rather large. Also when you scrunch the width of the page things start overlapping, which doesn't look good.
×
×
  • Create New...